In general we need to use ';' as path separator and '\' and directory separator on windows. The shell will automatically translate paths to some extent, but we have to call "pwd -W" rather than plain "pwd" to get something useful.
Signed-off-by: Ulf Hermann <ulf.herm...@qt.io> --- lib/ChangeLog | 5 ++ lib/system.h | 16 ++++++ libdwfl/ChangeLog | 8 +++ libdwfl/dwfl_build_id_find_elf.c | 5 +- libdwfl/find-debuginfo.c | 106 ++++++++++++++++++----------------- libdwfl/libdwflP.h | 4 ++ libdwfl/linux-kernel-modules.c | 3 +- libdwfl/linux-proc-maps.c | 4 +- src/ChangeLog | 6 ++ src/addr2line.c | 4 +- src/size.c | 4 +- src/strip.c | 4 +- tests/ChangeLog | 10 ++++ tests/asm-tst4.c | 7 ++- tests/asm-tst5.c | 6 +- tests/asm-tst6.c | 6 +- tests/run-addr2line-alt-debugpath.sh | 4 +- tests/run-addrname-test.sh | 8 +-- tests/run-prelink-addr-test.sh | 60 ++++++++++---------- tests/test-subr.sh | 1 + 20 files changed, 171 insertions(+), 100 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 9fa8ff0..59939bd 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,5 +1,10 @@ 2017-05-04 Ulf Hermann <ulf.herm...@qt.io> + * system.h: Define FILE_SYSTEM_PREFIX_LEN, ISDIRSEP, DIRSEP, PATHSEP, + and IS_ABSOLUTE_PATH to help with handling file system paths. + +2017-05-04 Ulf Hermann <ulf.herm...@qt.io> + * eu-config.h: Define O_BINARY to 0 if it doesn't exist. 2017-05-04 Ulf Hermann <ulf.herm...@qt.io> diff --git a/lib/system.h b/lib/system.h index ffa2bc7..3a6b8e9 100644 --- a/lib/system.h +++ b/lib/system.h @@ -51,6 +51,22 @@ # error "Unknown byte order" #endif +#if (defined _WIN32 || defined __WIN32__) +# define _IS_DRIVE_LETTER(c) (((unsigned int) (c) | ('a' - 'A')) - 'a' <= 'z' - 'a') +# define FILE_SYSTEM_PREFIX_LEN(filename) \ + (_IS_DRIVE_LETTER ((filename)[0]) && (filename)[1] == ':' ? 2 : 0) +# define ISDIRSEP(c) ((c) == '/' || (c) == '\\') +# define DIRSEP '\\' +# define PATHSEP ';' +# define IS_ABSOLUTE_PATH(f) ISDIRSEP ((f)[FILE_SYSTEM_PREFIX_LEN (f)]) +#else +# define FILE_SYSTEM_PREFIX_LEN(filename) 0 +# define ISDIRSEP(c) ((c) == '/') +# define DIRSEP '/' +# define PATHSEP ':' +# define IS_ABSOLUTE_PATH(p) (ISDIRSEP ((p)[0])) +#endif + #ifndef MAX #define MAX(m, n) ((m) < (n) ? (n) : (m)) #endif diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 6f3a561..ee550d0 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,5 +1,13 @@ 2017-05-04 Ulf Hermann <ulf.herm...@qt.io> + * dwfl_build_id_find_elf.c: Don't assume unix file system conventions. + * find-debuginfo.c: Likewise. + * linux-kernel-modules.c: Likewise. + * linux-proc-maps.c: Likewise. + * libdwflP.h: Add a windows-compatible default debuginfo path. + +2017-05-04 Ulf Hermann <ulf.herm...@qt.io> + * argp-std.c: Open files in O_BINARY. * dwfl_build_id_find_elf.c: Likewise. * dwfl_build_id_find_elf.c: Likewise. diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c index 6ce2c1c..cf2a0f1 100644 --- a/libdwfl/dwfl_build_id_find_elf.c +++ b/libdwfl/dwfl_build_id_find_elf.c @@ -79,13 +79,14 @@ __libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, char **file_name, int fd = -1; char *dir; char *paths = path; - while (fd < 0 && (dir = strsep (&paths, ":")) != NULL) + char pathsep[] = { PATHSEP, '\0' }; + while (fd < 0 && (dir = strsep (&paths, pathsep)) != NULL) { if (dir[0] == '+' || dir[0] == '-') ++dir; /* Only absolute directory names are useful to us. */ - if (dir[0] != '/') + if (IS_ABSOLUTE_PATH(dir)) continue; size_t dirlen = strlen (dir); diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c index 7f7e108..ac568d0 100644 --- a/libdwfl/find-debuginfo.c +++ b/libdwfl/find-debuginfo.c @@ -52,9 +52,10 @@ try_open (const struct stat *main_stat, if (unlikely (fname == NULL)) return -1; } - else if ((subdir == NULL ? asprintf (&fname, "%s/%s", dir, debuglink) - : dir == NULL ? asprintf (&fname, "%s/%s", subdir, debuglink) - : asprintf (&fname, "%s/%s/%s", dir, subdir, debuglink)) < 0) + else if ((subdir == NULL ? asprintf (&fname, "%s%c%s", dir, DIRSEP, debuglink) + : dir == NULL ? asprintf (&fname, "%s%c%s", subdir, DIRSEP, debuglink) + : asprintf (&fname, "%s%c%s%c%s", dir, DIRSEP, subdir, DIRSEP, + debuglink)) < 0) return -1; struct stat st; @@ -231,7 +232,8 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name, return -1; } char *p; - while ((p = strsep (&path, ":")) != NULL) + const char pathsep[] = { PATHSEP, '\0' }; + while ((p = strsep (&path, pathsep)) != NULL) { /* A leading - or + says whether to check file CRCs for this element. */ bool check = defcheck; @@ -244,53 +246,57 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name, bool try_file_basename; const char *dir, *subdir, *file; - switch (p[0]) - { - case '\0': - /* An empty entry says to try the main file's directory. */ - dir = file_dirname; - subdir = NULL; - file = debuglink_file; - try_file_basename = false; - break; - case '/': - /* An absolute path says to look there for a subdirectory - named by the main file's absolute directory. This cannot - be applied to a relative file name. For alt debug files - it means to look for the basename file in that dir or the - .dwz subdir (see below). */ - if (mod->dw == NULL - && (file_dirname == NULL || file_dirname[0] != '/')) - continue; - dir = p; - if (mod->dw == NULL) - { - subdir = file_dirname; - /* We want to explore all sub-subdirs. Chop off one slash - at a time. */ - explore_dir: - subdir = strchr (subdir, '/'); - if (subdir != NULL) - subdir = subdir + 1; - if (subdir && *subdir == 0) - continue; - file = debuglink_file; - } - else - { + if (IS_ABSOLUTE_PATH(p)) + { + /* An absolute path says to look there for a subdirectory + named by the main file's absolute directory. This cannot + be applied to a relative file name. For alt debug files + it means to look for the basename file in that dir or the + .dwz subdir (see below). */ + if (mod->dw == NULL + && (file_dirname == NULL || !IS_ABSOLUTE_PATH(file_dirname))) + continue; + dir = p; + if (mod->dw == NULL) { + subdir = file_dirname; + /* We want to explore all sub-subdirs. Chop off one slash + at a time. */ + explore_dir: + while (subdir && *subdir && !ISDIRSEP(*subdir)) + ++subdir; + if (subdir != NULL && *subdir != 0) + subdir = subdir + 1; + if (subdir && *subdir == 0) + continue; + file = debuglink_file; + } + else + { + subdir = NULL; + file = basename (debuglink_file); + } + try_file_basename = debuglink_null; + } + else + { + switch (p[0]) + { + case '\0': + /* An empty entry says to try the main file's directory. */ + dir = file_dirname; subdir = NULL; - file = basename (debuglink_file); + file = debuglink_file; + try_file_basename = false; + break; + default: + /* A relative path says to try a subdirectory of that name + in the main file's directory. */ + dir = file_dirname; + subdir = p; + file = debuglink_file; + try_file_basename = debuglink_null; + break; } - try_file_basename = debuglink_null; - break; - default: - /* A relative path says to try a subdirectory of that name - in the main file's directory. */ - dir = file_dirname; - subdir = p; - file = debuglink_file; - try_file_basename = debuglink_null; - break; } char *fname = NULL; @@ -304,7 +310,7 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name, case ENOTDIR: /* If we are looking for the alt file also try the .dwz subdir. But only if this is the empty or absolute path. */ - if (mod->dw != NULL && (p[0] == '\0' || p[0] == '/')) + if (mod->dw != NULL && (p[0] == '\0' || IS_ABSOLUTE_PATH(p))) { fd = try_open (&main_stat, dir, ".dwz", basename (file), &fname); diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h index 7d5f795..fbd1a64 100644 --- a/libdwfl/libdwflP.h +++ b/libdwfl/libdwflP.h @@ -766,7 +766,11 @@ INTDECL (dwfl_frame_pc) /* The default used by dwfl_standard_find_debuginfo. */ +#if (defined _WIN32 || defined __WIN32__) +#define DEFAULT_DEBUGINFO_PATH ";.debug" +#else #define DEFAULT_DEBUGINFO_PATH ":.debug:/usr/lib/debug" +#endif #endif /* libdwflP.h */ diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c index 139a477..bd963d3 100644 --- a/libdwfl/linux-kernel-modules.c +++ b/libdwfl/linux-kernel-modules.c @@ -48,6 +48,7 @@ #include <sys/utsname.h> #include <fcntl.h> #include <unistd.h> +#include <system.h> /* If fts.h is included before config.h, its indirect inclusions may not give us the right LFS aliases of these functions, so map them manually. */ @@ -96,7 +97,7 @@ try_kernel_name (Dwfl *dwfl, char **fname, bool try_debug) tried because we give its own basename as DEBUGLINK_FILE. */ int fd = ((((dwfl->callbacks->debuginfo_path ? *dwfl->callbacks->debuginfo_path : NULL) - ?: DEFAULT_DEBUGINFO_PATH)[0] == ':') ? -1 + ?: DEFAULT_DEBUGINFO_PATH)[0] == PATHSEP) ? -1 : TEMP_FAILURE_RETRY (open (*fname, O_RDONLY | O_BINARY))); if (fd < 0) diff --git a/libdwfl/linux-proc-maps.c b/libdwfl/linux-proc-maps.c index 78f472a..8eb9a5c 100644 --- a/libdwfl/linux-proc-maps.c +++ b/libdwfl/linux-proc-maps.c @@ -245,7 +245,7 @@ proc_maps_report (Dwfl *dwfl, FILE *f, GElf_Addr sysinfo_ehdr, pid_t pid) } char *file = line + nread + strspn (line + nread, " \t"); - if (file[0] != '/' || (ino == 0 && dmajor == 0 && dminor == 0)) + if (!IS_ABSOLUTE_PATH(file) || (ino == 0 && dmajor == 0 && dminor == 0)) /* This line doesn't indicate a file mapping. */ continue; @@ -362,7 +362,7 @@ dwfl_linux_proc_find_elf (Dwfl_Module *mod __attribute__ ((unused)), char **file_name, Elf **elfp) { int pid = -1; - if (module_name[0] == '/') + if (IS_ABSOLUTE_PATH (module_name)) { /* When this callback is used together with dwfl_linux_proc_report then we might see mappings of special character devices. Make diff --git a/src/ChangeLog b/src/ChangeLog index 7103770..0d1e57d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2017-05-04 Ulf Hermann <ulf.herm...@qt.io> + * addr2line.c: Don't assume unix file system conventions. + * size.c: Likewise. + * strip.c: Likewise. + +2017-05-04 Ulf Hermann <ulf.herm...@qt.io> + * ar.c: Open files in O_BINARY. * elfcmp.c: Likewise. * elfcompress.c: Likewise. diff --git a/src/addr2line.c b/src/addr2line.c index ba414a7..7ee9fcf 100644 --- a/src/addr2line.c +++ b/src/addr2line.c @@ -375,7 +375,7 @@ print_dwarf_function (Dwfl_Module *mod, Dwarf_Addr addr) file = "???"; else if (only_basenames) file = basename (file); - else if (use_comp_dir && file[0] != '/') + else if (use_comp_dir && !IS_ABSOLUTE_PATH(file)) { const char *const *dirs; size_t ndirs; @@ -559,7 +559,7 @@ print_src (const char *src, int lineno, int linecol, Dwarf_Die *cu) if (only_basenames) src = basename (src); - else if (use_comp_dir && src[0] != '/') + else if (use_comp_dir && !IS_ABSOLUTE_PATH(src)) { Dwarf_Attribute attr; comp_dir = dwarf_formstring (dwarf_attr (cu, DW_AT_comp_dir, &attr)); diff --git a/src/size.c b/src/size.c index 4774800..9e5c20a 100644 --- a/src/size.c +++ b/src/size.c @@ -350,7 +350,7 @@ handle_ar (int fd, Elf *elf, const char *prefix, const char *fname) if (prefix != NULL) { cp = mempcpy (cp, prefix, prefix_len); - *cp++ = ':'; + *cp++ = PATHSEP; } memcpy (cp, fname, fname_len); @@ -635,7 +635,7 @@ handle_elf (Elf *elf, const char *prefix, const char *fname) if (prefix != NULL) { cp = mempcpy (cp, prefix, prefix_len); - *cp++ = ':'; + *cp++ = PATHSEP; } memcpy (cp, fname, fname_len); diff --git a/src/strip.c b/src/strip.c index db8ff2f..60f6700 100644 --- a/src/strip.c +++ b/src/strip.c @@ -440,7 +440,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, if (prefix != NULL) { cp = mempcpy (cp, prefix, prefix_len); - *cp++ = ':'; + *cp++ = PATHSEP; } memcpy (cp, fname, fname_len); @@ -2263,7 +2263,7 @@ handle_ar (int fd, Elf *elf, const char *prefix, const char *fname, if (prefix != NULL) { cp = mempcpy (cp, prefix, prefix_len); - *cp++ = ':'; + *cp++ = PATHSEP; } memcpy (cp, fname, fname_len); diff --git a/tests/ChangeLog b/tests/ChangeLog index 5616c74..5e29f82 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,5 +1,15 @@ 2017-05-04 Ulf Hermann <ulf.herm...@qt.io> + * asm-tst4.c: Don't assume unix file system conventions. + * asm-tst5.c: Likewise. + * asm-tst6.c: Likewise. + * test-subr.sh: Define work_dir to be "pwd -W" or "pwd". + * run-addr2line-alt-debugpath.sh: Use $work_dir rather than $(pwd). + * run-addrname-test.sh: Likewise. + * run-prelink-addr-test.sh: Likewise. + +2017-05-04 Ulf Hermann <ulf.herm...@qt.io> + * run-addr2line-test.sh: Add --strip-trailing-cr option to diff. * run-readelf-test1.sh: Likewise. * run-unstrip-n.sh: Likewise. diff --git a/tests/asm-tst4.c b/tests/asm-tst4.c index 52e9e20..c076f6f 100644 --- a/tests/asm-tst4.c +++ b/tests/asm-tst4.c @@ -28,6 +28,7 @@ #include <unistd.h> #include <sys/wait.h> +#include <system.h> static const char fname[] = "asm-tst4-out.o"; @@ -93,7 +94,11 @@ main (void) } if (result == 0) - result = WEXITSTATUS (system ("../src/elflint -q asm-tst4-out.o")); + { + char command[128]; + sprintf(command, "..%csrc%celflint -q asm-tst4-out.o", DIRSEP, DIRSEP); + result = WEXITSTATUS (system (command)); + } /* We don't need the file anymore. */ unlink (fname); diff --git a/tests/asm-tst5.c b/tests/asm-tst5.c index 5a29b01..4db6d1f 100644 --- a/tests/asm-tst5.c +++ b/tests/asm-tst5.c @@ -105,7 +105,11 @@ main (void) } if (result == 0) - result = WEXITSTATUS (system ("../src/elflint -q asm-tst5-out.o")); + { + char command[128]; + sprintf(command, "..%csrc%celflint -q asm-tst5-out.o", DIRSEP, DIRSEP); + result = WEXITSTATUS (system (command)); + } /* We don't need the file anymore. */ unlink (fname); diff --git a/tests/asm-tst6.c b/tests/asm-tst6.c index bd9b362..34b5bc6 100644 --- a/tests/asm-tst6.c +++ b/tests/asm-tst6.c @@ -139,7 +139,11 @@ main (void) } if (result == 0) - result = WEXITSTATUS (system ("../src/elflint -q asm-tst6-out.o")); + { + char command[128]; + sprintf(command, "..%csrc%celflint -q asm-tst6-out.o", DIRSEP, DIRSEP); + result = WEXITSTATUS (system (command)); + } /* We don't need the file anymore. */ unlink (fname); diff --git a/tests/run-addr2line-alt-debugpath.sh b/tests/run-addr2line-alt-debugpath.sh index b508700..ac45bfb 100755 --- a/tests/run-addr2line-alt-debugpath.sh +++ b/tests/run-addr2line-alt-debugpath.sh @@ -23,8 +23,8 @@ testfiles testfile-inlines # Split off the debuginfo and put it under a separate subdir from the # original binary. Use --debuginfo-path to connect the dots again. # Note that we use separate subdirs/roots for the binaries and debug files. -abs_test_bindir=$(pwd)/bindir -abs_test_debugdir=$(pwd)/debugdir +abs_test_bindir=$work_dir/bindir +abs_test_debugdir=$work_dir/debugdir mkdir ${abs_test_bindir} mkdir ${abs_test_bindir}/bin diff --git a/tests/run-addrname-test.sh b/tests/run-addrname-test.sh index 90e19df..69d8189 100755 --- a/tests/run-addrname-test.sh +++ b/tests/run-addrname-test.sh @@ -58,10 +58,10 @@ testfiles testfile12 testfile14 tempfiles testmaps cat > testmaps <<EOF -00400000-00401000 r-xp 00000000 fd:01 4006812 `pwd`/testfile14 -00500000-00501000 rw-p 00000000 fd:01 4006812 `pwd`/testfile14 -01000000-01001000 r-xp 00000000 fd:01 1234567 `pwd`/testfile12 -01100000-01011000 rw-p 00000000 fd:01 1234567 `pwd`/testfile12 +00400000-00401000 r-xp 00000000 fd:01 4006812 $work_dir/testfile14 +00500000-00501000 rw-p 00000000 fd:01 4006812 $work_dir/testfile14 +01000000-01001000 r-xp 00000000 fd:01 1234567 $work_dir/testfile12 +01100000-01011000 rw-p 00000000 fd:01 1234567 $work_dir/testfile12 2aaaaaaab000-2aaaaaaad000 rw-p 2aaaaaaab000 00:00 0 2aaaaaae2000-2aaaaaae3000 rw-p 2aaaaaae2000 00:00 0 7fff61068000-7fff6107d000 rw-p 7ffffffea000 00:00 0 [stack] diff --git a/tests/run-prelink-addr-test.sh b/tests/run-prelink-addr-test.sh index 3398c0d..da2807e 100755 --- a/tests/run-prelink-addr-test.sh +++ b/tests/run-prelink-addr-test.sh @@ -36,12 +36,12 @@ tempfiles testmaps52-32 testfile52-32.noshdrs.so.debug ln -snf testfile52-32.so.debug testfile52-32.noshdrs.so.debug cat > testmaps52-32 <<EOF -00111000-00112000 r-xp 00000000 fd:01 1 `pwd`/testfile52-32.so -00112000-00113000 rw-p 00000000 fd:01 1 `pwd`/testfile52-32.so -41000000-41001000 r-xp 00000000 fd:01 2 `pwd`/testfile52-32.prelink.so -41001000-41002000 rw-p 00000000 fd:01 2 `pwd`/testfile52-32.prelink.so -42000000-42001000 r-xp 00000000 fd:01 3 `pwd`/testfile52-32.noshdrs.so -42001000-42002000 rw-p 00000000 fd:01 3 `pwd`/testfile52-32.noshdrs.so +00111000-00112000 r-xp 00000000 fd:01 1 $work_dir/testfile52-32.so +00112000-00113000 rw-p 00000000 fd:01 1 $work_dir/testfile52-32.so +41000000-41001000 r-xp 00000000 fd:01 2 $work_dir/testfile52-32.prelink.so +41001000-41002000 rw-p 00000000 fd:01 2 $work_dir/testfile52-32.prelink.so +42000000-42001000 r-xp 00000000 fd:01 3 $work_dir/testfile52-32.noshdrs.so +42001000-42002000 rw-p 00000000 fd:01 3 $work_dir/testfile52-32.noshdrs.so EOF # Prior to commit 1743d7f, libdwfl would fail on the second address, @@ -65,15 +65,15 @@ tempfiles testmaps52-64 testfile52-64.noshdrs.so.debug ln -snf testfile52-64.so.debug testfile52-64.noshdrs.so.debug cat > testmaps52-64 <<EOF -1000000000-1000001000 r-xp 00000000 fd:11 1 `pwd`/testfile52-64.so -1000001000-1000200000 ---p 00001000 fd:11 1 `pwd`/testfile52-64.so -1000200000-1000201000 rw-p 00000000 fd:11 1 `pwd`/testfile52-64.so -3000000000-3000001000 r-xp 00000000 fd:11 2 `pwd`/testfile52-64.prelink.so -3000001000-3000200000 ---p 00001000 fd:11 2 `pwd`/testfile52-64.prelink.so -3000200000-3000201000 rw-p 00000000 fd:11 2 `pwd`/testfile52-64.prelink.so -3800000000-3800001000 r-xp 00000000 fd:11 3 `pwd`/testfile52-64.noshdrs.so -3800001000-3800200000 ---p 00001000 fd:11 3 `pwd`/testfile52-64.noshdrs.so -3800200000-3800201000 rw-p 00000000 fd:11 3 `pwd`/testfile52-64.noshdrs.so +1000000000-1000001000 r-xp 00000000 fd:11 1 $work_dir/testfile52-64.so +1000001000-1000200000 ---p 00001000 fd:11 1 $work_dir/testfile52-64.so +1000200000-1000201000 rw-p 00000000 fd:11 1 $work_dir/testfile52-64.so +3000000000-3000001000 r-xp 00000000 fd:11 2 $work_dir/testfile52-64.prelink.so +3000001000-3000200000 ---p 00001000 fd:11 2 $work_dir/testfile52-64.prelink.so +3000200000-3000201000 rw-p 00000000 fd:11 2 $work_dir/testfile52-64.prelink.so +3800000000-3800001000 r-xp 00000000 fd:11 3 $work_dir/testfile52-64.noshdrs.so +3800001000-3800200000 ---p 00001000 fd:11 3 $work_dir/testfile52-64.noshdrs.so +3800200000-3800201000 rw-p 00000000 fd:11 3 $work_dir/testfile52-64.noshdrs.so EOF testrun_compare ${abs_top_builddir}/src/addr2line -S -M testmaps52-64 \ @@ -151,12 +151,12 @@ tempfiles testmaps54-32 # this is testing finding the symbols in .dynsym via PT_DYNAMIC. cat > testmaps54-32 <<EOF -00111000-00112000 r--p 00000000 fd:01 1 `pwd`/testfile54-32.so -00112000-00113000 rw-p 00000000 fd:01 1 `pwd`/testfile54-32.so -41000000-41001000 r--p 00000000 fd:01 2 `pwd`/testfile54-32.prelink.so -41001000-41002000 rw-p 00000000 fd:01 2 `pwd`/testfile54-32.prelink.so -42000000-42001000 r--p 00000000 fd:01 3 `pwd`/testfile54-32.noshdrs.so -42001000-42002000 rw-p 00000000 fd:01 3 `pwd`/testfile54-32.noshdrs.so +00111000-00112000 r--p 00000000 fd:01 1 $work_dir/testfile54-32.so +00112000-00113000 rw-p 00000000 fd:01 1 $work_dir/testfile54-32.so +41000000-41001000 r--p 00000000 fd:01 2 $work_dir/testfile54-32.prelink.so +41001000-41002000 rw-p 00000000 fd:01 2 $work_dir/testfile54-32.prelink.so +42000000-42001000 r--p 00000000 fd:01 3 $work_dir/testfile54-32.noshdrs.so +42001000-42002000 rw-p 00000000 fd:01 3 $work_dir/testfile54-32.noshdrs.so EOF testrun_compare ${abs_top_builddir}/src/addr2line -S -M testmaps54-32 \ @@ -182,15 +182,15 @@ tempfiles testmaps54-64 # this is testing finding the symbols in .dynsym via PT_DYNAMIC. cat > testmaps54-64 <<EOF -1000000000-1000001000 r--p 00000000 fd:11 1 `pwd`/testfile54-64.so -1000001000-1000200000 ---p 00001000 fd:11 1 `pwd`/testfile54-64.so -1000200000-1000201000 rw-p 00000000 fd:11 1 `pwd`/testfile54-64.so -3000000000-3000001000 r--p 00000000 fd:11 2 `pwd`/testfile54-64.prelink.so -3000001000-3000200000 ---p 00001000 fd:11 2 `pwd`/testfile54-64.prelink.so -3000200000-3000201000 rw-p 00000000 fd:11 2 `pwd`/testfile54-64.prelink.so -3800000000-3800001000 r--p 00000000 fd:11 3 `pwd`/testfile54-64.noshdrs.so -3800001000-3800200000 ---p 00001000 fd:11 3 `pwd`/testfile54-64.noshdrs.so -3800200000-3800201000 rw-p 00000000 fd:11 3 `pwd`/testfile54-64.noshdrs.so +1000000000-1000001000 r--p 00000000 fd:11 1 $work_dir/testfile54-64.so +1000001000-1000200000 ---p 00001000 fd:11 1 $work_dir/testfile54-64.so +1000200000-1000201000 rw-p 00000000 fd:11 1 $work_dir/testfile54-64.so +3000000000-3000001000 r--p 00000000 fd:11 2 $work_dir/testfile54-64.prelink.so +3000001000-3000200000 ---p 00001000 fd:11 2 $work_dir/testfile54-64.prelink.so +3000200000-3000201000 rw-p 00000000 fd:11 2 $work_dir/testfile54-64.prelink.so +3800000000-3800001000 r--p 00000000 fd:11 3 $work_dir/testfile54-64.noshdrs.so +3800001000-3800200000 ---p 00001000 fd:11 3 $work_dir/testfile54-64.noshdrs.so +3800200000-3800201000 rw-p 00000000 fd:11 3 $work_dir/testfile54-64.noshdrs.so EOF testrun_compare ${abs_top_builddir}/src/addr2line -S -M testmaps54-64 \ diff --git a/tests/test-subr.sh b/tests/test-subr.sh index 8bea18c..60ff8cd 100644 --- a/tests/test-subr.sh +++ b/tests/test-subr.sh @@ -26,6 +26,7 @@ set -e test_dir="test-$$" mkdir -p "$test_dir" cd "$test_dir" +work_dir=`pwd -W 2> /dev/null || pwd` #LC_ALL=C #export LC_ALL -- 2.1.4