public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/27494] New: Handle DW_MACRO_define_strp in version 4 .debug_macro.dwo
@ 2021-03-01 15:47 vries at gcc dot gnu.org
2021-04-14 13:24 ` [Bug gdb/27494] " vries at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: vries at gcc dot gnu.org @ 2021-03-01 15:47 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=27494
Bug ID: 27494
Summary: Handle DW_MACRO_define_strp in version 4
.debug_macro.dwo
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
[ See gcc PR https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99319 . ]
Consider:
...
$ gcc -ggdb3 -g hello.c -gsplit-dwarf
$ gdb -q -batch -readnow a.out
DW_FORM_strp pointing outside of .debug_str section [in module
/home/vries/hello/a.out]
...
When reading a version 4 .debug_macro.dwo section we should expect the second
operand of DW_MACRO_define_strp to be a uleb128.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug gdb/27494] Handle DW_MACRO_define_strp in version 4 .debug_macro.dwo
2021-03-01 15:47 [Bug gdb/27494] New: Handle DW_MACRO_define_strp in version 4 .debug_macro.dwo vries at gcc dot gnu.org
@ 2021-04-14 13:24 ` vries at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: vries at gcc dot gnu.org @ 2021-04-14 13:24 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=27494
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
This patch fixes the error message:
...
diff --git a/gdb/dwarf2/macro.c b/gdb/dwarf2/macro.c
index 2ecebe6173c..b8d5676c63b 100644
--- a/gdb/dwarf2/macro.c
+++ b/gdb/dwarf2/macro.c
@@ -502,8 +502,17 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
{
LONGEST str_offset;
- str_offset = read_offset (abfd, mac_ptr, offset_size);
- mac_ptr += offset_size;
+ if (DW_MACRO_define_strp == macinfo_type
+ && strcmp (section->s.section->name, ".debug_macro.dwo") ==
0)
+ {
+ str_offset = read_unsigned_leb128 (abfd, mac_ptr,
&bytes_read);
+ mac_ptr += bytes_read;
+ }
+ else
+ {
+ str_offset = read_offset (abfd, mac_ptr, offset_size);
+ mac_ptr += offset_size;
+ }
if (macinfo_type == DW_MACRO_define_sup
|| macinfo_type == DW_MACRO_undef_sup
@@ -866,7 +875,14 @@ dwarf_decode_macros (dwarf2_per_objfile *per_objfile,
read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
mac_ptr += bytes_read;
- mac_ptr += offset_size;
+ if (DW_MACRO_define_strp == macinfo_type
+ && strcmp (section->s.section->name, ".debug_macro.dwo") == 0)
+ {
+ read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
+ mac_ptr += bytes_read;
+ }
+ else
+ mac_ptr += offset_size;
}
break;
case DW_MACRO_define_strx:
...
But a simple example still doesn't work:
...
$ cat test.c
#include <stdio.h>
#define BLA "hello"
int
main (void)
{
printf (BLA "\n");
return 0;
}
$ gcc-10 test.c -ggdb3
$ gdb -q -batch a.out -ex start -ex "info macro BLA"
Temporary breakpoint 1 at 0x40050a: file test.c, line 8.
Temporary breakpoint 1, main () at test.c:8
8 printf (BLA "\n");
Defined at /home/vries/test.c:3
#define BLA "hello"
$ gcc-10 test.c -ggdb3 -gsplit-dwarf
$ gdb -q -batch a.out -ex start -ex "info macro BLA"
Temporary breakpoint 1 at 0x40050a: file test.c, line 8.
Temporary breakpoint 1, main () at test.c:8
8 printf (BLA "\n");
The symbol `BLA' has no definition as a C/C++ preprocessor macro
at <user-defined>:-1
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-14 13:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-01 15:47 [Bug gdb/27494] New: Handle DW_MACRO_define_strp in version 4 .debug_macro.dwo vries at gcc dot gnu.org
2021-04-14 13:24 ` [Bug gdb/27494] " vries at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).