diff options
author | Tom de Vries <tdevries@suse.de> | 2021-02-10 17:26:50 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2021-02-10 17:26:50 +0100 |
commit | d9d9d8ef8ce984dee45f35a5f00f4cf74bcab1e6 (patch) | |
tree | 223510b0377a24eff8375dc9ec5d6f3b735da424 | |
parent | e92c8eb86dcef673652644694c832c504cf9a9a9 (diff) | |
download | gdb-d9d9d8ef8ce984dee45f35a5f00f4cf74bcab1e6.zip gdb-d9d9d8ef8ce984dee45f35a5f00f4cf74bcab1e6.tar.gz gdb-d9d9d8ef8ce984dee45f35a5f00f4cf74bcab1e6.tar.bz2 |
[binutils] Handle absolute DW_AT_dwo_name
With an exec:
...
$ pwd
/home/vries/tmp
$ gcc /home/vries/tmp/src/hello.c -gsplit-dwarf -c \
-o /home/vries/tmp/obj/hello.o
...
I get:
...
$ readelf -w obj/hello.o > READELF
readelf: Warning: Unable to load dwo file: \
/home/vries/tmp//home/vries/tmp/obj/hello.dwo
...
The dwo file name is listed here:
...
<20> DW_AT_GNU_dwo_name: /home/vries/tmp/obj/hello.dwo
<24> DW_AT_comp_dir : /home/vries/tmp
...
The standard states about the DW_AT_dwo_name attribute:
...
value is a null-terminated string containing the full or relative path name
(relative to the value of the DW_AT_comp_dir attribute, see below) of the
object file that contains the full compilation unit.
...
So, readelf shouldn't try to prefix an absolute path with DW_AT_comp_dir.
Fix this in load_dwo_file by handling the absolute path case.
binutils/ChangeLog:
2021-02-10 Tom de Vries <tdevries@suse.de>
PR binutils/27391
* dwarf.c (load_dwo_file): Handle case that name is absolute path.
-rw-r--r-- | binutils/ChangeLog | 5 | ||||
-rw-r--r-- | binutils/dwarf.c | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 1d6b967..594fbff 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,5 +1,10 @@ 2021-02-10 Tom de Vries <tdevries@suse.de> + PR binutils/27391 + * dwarf.c (load_dwo_file): Handle case that name is absolute path. + +2021-02-10 Tom de Vries <tdevries@suse.de> + PR binutils/27371 * dwarf.c (display_debug_ranges): Filter range lists according to section. diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 84d63f6..3cbd197 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -11092,8 +11092,11 @@ load_dwo_file (const char * main_filename, const char * name, const char * dir, char * separate_filename; void * separate_handle; - /* FIXME: Skip adding / if dwo_dir ends in /. */ - separate_filename = concat (dir, "/", name, NULL); + if (IS_ABSOLUTE_PATH (name)) + separate_filename = strdup (name); + else + /* FIXME: Skip adding / if dwo_dir ends in /. */ + separate_filename = concat (dir, "/", name, NULL); if (separate_filename == NULL) { warn (_("Out of memory allocating dwo filename\n")); |