public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "sourav0311 at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/27966] New: macro tests failing when using -gdwarf-5 -gsplit-dwarf
Date: Tue, 08 Jun 2021 07:24:11 +0000	[thread overview]
Message-ID: <bug-27966-4717@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2021-06-08  7:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08  7:24 sourav0311 at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-27966-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).