public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/27966] New: macro tests failing when using -gdwarf-5 -gsplit-dwarf
@ 2021-06-08  7:24 sourav0311 at gmail dot com
  2021-06-08  7:25 ` [Bug gdb/27966] " sourav0311 at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: sourav0311 at gmail dot com @ 2021-06-08  7:24 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27966

            Bug ID: 27966
           Summary: macro tests failing when using -gdwarf-5 -gsplit-dwarf
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: sourav0311 at gmail dot com
  Target Milestone: ---

Compiler used: CLANG trunk
GDB Version: trunk (GNU gdb (GDB) 11.0.50.20210606-git)
```
make check TESTS=gdb.base/macscp.exp RUNTESTFLAGS='"CC_FOR_TARGET=clang"
CFLAGS_FOR_TARGET="-gdwarf-5 -gsplit-dwarf"'

=== gdb Summary ===

# of expected passes            234
# of unexpected failures        65
# of known failures             40

65 tests case failed while 234 testcases passing, this suggests some part of
"-gsplit-dwarf" and macro machinery is still working great :)

For a typical case one can observe the macro visible inside GDB:
$ clang -fdebug-macro -gdwarf-5 -gsplit-dwarf ./macro.c
...
 gdb a.out -q
Reading symbols from a.out...
(gdb) start
Temporary breakpoint 1 at 0x201664: file ./macro.c, line 2.
Starting program: /home/sourabh/work/dwarf/c_c++/a.out

Temporary breakpoint 1, main () at ./macro.c:2
2       int main() {}
(gdb) info macros
Defined at /home/sourabh/work/dwarf/c_c++/./macro.c:1
#define HELLO_GDB 1
Defined at /home/sourabh/work/dwarf/c_c++/./macro.c:-1
#define __FILE__ "/home/sourabh/work/dwarf/c_c++/./macro.c"
Defined at /home/sourabh/work/dwarf/c_c++/./macro.c:-1
#define __LINE__ 2
...

Coming to 65 failures observed:
We observed that, GDB doesn't reads the specialized line table from
`.debug_line.dwo` section. Looking at the source code it seems to me that this
is on purpose and `.debug_line.dwo` is only read if type units are present
Code snippet from dwarf2/read.c
```
 get_debug_line_section (struct dwarf2_cu *cu)
   /* For TUs in DWO files, the DW_AT_stmt_list attribute lives in the
      DWO file.  */
  if (cu->dwo_unit && cu->per_cu->is_debug_types)
```

Please note that `clang` emits specialized line table `.debug_line.dwo` for 2
cases:
1. For if type units are present (As per DWARFv5 spec)
2. For if `.debug_macro.dwo` section is present. DWARFIssue file to capture
this http://dwarfstd.org/ShowIssue.php?issue=200602.1

**NOTE**: 
*Non-absolute/Relative* path still does not work(both split & no-split case)
yet :(
Patch in progress, needs clarification on the approach from maintainers.
https://sourceware.org/pipermail/gdb-patches/2021-May/179190.html

i.e
```
$ clang -fdebug-macro -gdwarf-5 -gsplit-dwarf macro.c
gdb a.out -q
Reading symbols from a.out...
(gdb) start
Temporary breakpoint 1 at 0x201664: file macro.c, line 2.
Starting program: /home/sourabh/work/dwarf/c_c++/a.out

Temporary breakpoint 1, main () at macro.c:2
2       int main() {}
(gdb) info macros
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-05  1:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08  7:24 [Bug gdb/27966] New: macro tests failing when using -gdwarf-5 -gsplit-dwarf sourav0311 at gmail dot com
2021-06-08  7:25 ` [Bug gdb/27966] " sourav0311 at gmail dot com
2023-01-04  1:44 ` tromey at sourceware dot org
2023-01-04 17:23 ` simark at simark dot ca
2023-01-04 22:37 ` tromey at sourceware dot org
2023-01-05  1:42 ` simark at simark dot ca

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).