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

* [Bug gdb/27966] macro tests failing when using -gdwarf-5 -gsplit-dwarf
  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 ` sourav0311 at gmail dot com
  2023-01-04  1:44 ` tromey at sourceware dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: sourav0311 at gmail dot com @ 2021-06-08  7:25 UTC (permalink / raw)
  To: gdb-prs

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

Sourabh Singh Tomar <sourav0311 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |keiths at redhat dot com,
                   |                            |sourav0311 at gmail dot com

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

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

* [Bug gdb/27966] macro tests failing when using -gdwarf-5 -gsplit-dwarf
  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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at sourceware dot org @ 2023-01-04  1:44 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org
             Blocks|                            |27453, 26909


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=26909
[Bug 26909] [meta] Debug Clang-built code
https://sourceware.org/bugzilla/show_bug.cgi?id=27453
[Bug 27453] [meta] DWARF 5 support
-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug gdb/27966] macro tests failing when using -gdwarf-5 -gsplit-dwarf
  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
  4 siblings, 0 replies; 6+ messages in thread
From: simark at simark dot ca @ 2023-01-04 17:23 UTC (permalink / raw)
  To: gdb-prs

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

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simark at simark dot ca

--- Comment #1 from Simon Marchi <simark at simark dot ca> ---
(In reply to Sourabh Singh Tomar from comment #0)
> **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
> ```

This should be fixed since this commit

https://gitlab.com/gnutools/binutils-gdb/-/commit/7900b17e334b114ff149c5a3da7884e6ab3f7136

Can you confirm?

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

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

* [Bug gdb/27966] macro tests failing when using -gdwarf-5 -gsplit-dwarf
  2021-06-08  7:24 [Bug gdb/27966] New: macro tests failing when using -gdwarf-5 -gsplit-dwarf sourav0311 at gmail dot com
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at sourceware dot org @ 2023-01-04 22:37 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2023-01-04

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
I usually move the bugs to "waiting" when there's a question.
That way when we stumble over it again in N years we know we
can just close it.

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

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

* [Bug gdb/27966] macro tests failing when using -gdwarf-5 -gsplit-dwarf
  2021-06-08  7:24 [Bug gdb/27966] New: macro tests failing when using -gdwarf-5 -gsplit-dwarf sourav0311 at gmail dot com
                   ` (3 preceding siblings ...)
  2023-01-04 22:37 ` tromey at sourceware dot org
@ 2023-01-05  1:42 ` simark at simark dot ca
  4 siblings, 0 replies; 6+ messages in thread
From: simark at simark dot ca @ 2023-01-05  1:42 UTC (permalink / raw)
  To: gdb-prs

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

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #3 from Simon Marchi <simark at simark dot ca> ---
(In reply to Tom Tromey from comment #2)
> I usually move the bugs to "waiting" when there's a question.
> That way when we stumble over it again in N years we know we
> can just close it.

That's a good idea.  However, here I'll move it to NEW (i.e. confirmed),
because the main point of the bug is still valid.  With the test binary
generated with:

$ make check TESTS=gdb.base/macscp.exp RUNTESTFLAGS="CC_FOR_TARGET=clang
CFLAGS_FOR_TARGET='-gdwarf-5 -gsplit-dwarf'"

I get:

$ ./gdb -q -nx --data-directory=data-directory
/home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/macscp/macscp
-ex "b macscp2_2" -ex r -ex  "info macro WHERE" -batch
...
The symbol `WHERE' has no definition as a C/C++ preprocessor macro
at /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/macscp2.h:22
  included at /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/macscp1.c:1

Whereas with:

$ make check TESTS=gdb.base/macscp.exp RUNTESTFLAGS="CC_FOR_TARGET=clang"

I get:

$ ./gdb -q -nx --data-directory=data-directory
/home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/macscp/macscp
-ex "b macscp2_2" -ex r -ex  "info macro WHERE" -batch
...
Defined at /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/macscp2.h:16
  included at /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/macscp1.c:61
#define WHERE before macscp2_2

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