public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/31745] New: [gdb/symtab] Can't print pre-defined macros with binaries built with clang -save-temps
@ 2024-05-16 10:34 vries at gcc dot gnu.org
2024-05-16 12:08 ` [Bug symtab/31745] " vries at gcc dot gnu.org
2024-05-17 11:16 ` [Bug macros/31745] [gdb/macros] " vries at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-16 10:34 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31745
Bug ID: 31745
Summary: [gdb/symtab] Can't print pre-defined macros with
binaries built with clang -save-temps
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: symtab
Assignee: unassigned at sourceware dot org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
Consider a hello world compiled with clang:
...
$ clang-15 -gdwarf-5 -g3 -fdebug-macro ~/data/hello.c
...
Printing a pre-defined macro works fine (thanks to commit e7e7469e7a3 "gdb: Fix
issue with Clang CLI macros", the fix for PR29034):
...
$ gdb -q -batch a.out -ex start -ex "p __DBL_MAX__"
Temporary breakpoint 1 at 0x6af: file /home/vries/data/hello.c, line 6.
Temporary breakpoint 1, main () at /home/vries/data/hello.c:6
6 printf ("hello\n");
$1 = 1.7976931348623157e+308
...
However, if we add -save-temps:
...
$ clang-15 -gdwarf-5 -g3 -fdebug-macro ~/data/hello.c -save-temps
hello.s:4:2: warning: inconsistent use of MD5 checksums
.file 1 "/home/vries" "data/hello.c"
^
...
we get:
...
$ gdb -q -batch a.out -ex start -ex "p __DBL_MAX__"
Temporary breakpoint 1 at 0x6af: file /home/vries/data/hello.c, line 6.
Temporary breakpoint 1, main () at /home/vries/data/hello.c:6
6 printf ("hello\n");
No symbol "__DBL_MAX__" in current context.
...
It's possible something is wrong with the debug info, so let's try to see what
lldb does:
...
$ lldb -b a.out -o "b main" -o run -o "print __DBL_MAX__"
(lldb) target create "a.out"
Current executable set to '/home/vries/gcc/a.out' (x86_64).
(lldb) b main
Breakpoint 1: where = a.out`main + 15 at hello.c:6:3, address =
0x00000000000006af
(lldb) run
Process 10477 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x00005555555546af a.out`main at hello.c:6:3
3 int
4 main (void)
5 {
-> 6 printf ("hello\n");
7 return 0;
8 }
Process 10477 launched: '/home/vries/gcc/a.out' (x86_64)
(lldb) print __DBL_MAX__
(double) $0 = 1.7976931348623157E+308
...
It has no problems getting the info, which would suggest that gdb could be
fixed as well.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug symtab/31745] [gdb/symtab] Can't print pre-defined macros with binaries built with clang -save-temps
2024-05-16 10:34 [Bug symtab/31745] New: [gdb/symtab] Can't print pre-defined macros with binaries built with clang -save-temps vries at gcc dot gnu.org
@ 2024-05-16 12:08 ` vries at gcc dot gnu.org
2024-05-17 11:16 ` [Bug macros/31745] [gdb/macros] " vries at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-16 12:08 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31745
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
With this:
...
diff --git a/gdb/dwarf2/macro.c b/gdb/dwarf2/macro.c
index a511d0a3b44..6686fd84f49 100644
--- a/gdb/dwarf2/macro.c
+++ b/gdb/dwarf2/macro.c
@@ -838,6 +838,12 @@ dwarf_decode_macros (dwarf2_per_objfile *per_objfile,
do
{
+ if (producer_is_clang (cu))
+ {
+ current_file = macro_start_file (builder, 1, 0, nullptr, lh);
+ break;
+ }
+
/* Do we at least have room for a macinfo type byte? */
if (mac_ptr >= mac_end)
{
...
we get:
...
$ gdb -q -batch a.out -ex start -ex "p __DBL_MAX__"
Temporary breakpoint 1 at 0x6af: file /home/vries/data/hello.c, line 6.
Temporary breakpoint 1, main () at /home/vries/data/hello.c:6
6 printf ("hello\n");
$1 = 1.7976931348623157e+308
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug macros/31745] [gdb/macros] Can't print pre-defined macros with binaries built with clang -save-temps
2024-05-16 10:34 [Bug symtab/31745] New: [gdb/symtab] Can't print pre-defined macros with binaries built with clang -save-temps vries at gcc dot gnu.org
2024-05-16 12:08 ` [Bug symtab/31745] " vries at gcc dot gnu.org
@ 2024-05-17 11:16 ` vries at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-17 11:16 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31745
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[gdb/symtab] Can't print |[gdb/macros] Can't print
|pre-defined macros with |pre-defined macros with
|binaries built with clang |binaries built with clang
|-save-temps |-save-temps
Component|symtab |macros
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-17 11:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-16 10:34 [Bug symtab/31745] New: [gdb/symtab] Can't print pre-defined macros with binaries built with clang -save-temps vries at gcc dot gnu.org
2024-05-16 12:08 ` [Bug symtab/31745] " vries at gcc dot gnu.org
2024-05-17 11:16 ` [Bug macros/31745] [gdb/macros] " 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).