public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/29558] New: [gdb/symtab] Handle gas-generated debug info (DW_TAG_unspecified_type)
@ 2022-09-08  8:38 vries at gcc dot gnu.org
  2022-09-08  8:38 ` [Bug gdb/29558] " vries at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-08  8:38 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29558
           Summary: [gdb/symtab] Handle gas-generated debug info
                    (DW_TAG_unspecified_type)
           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: ---

I.

A recent commit 5578fbf672e ("GAS: Add a return type tag to DWARF DIEs
generated for function symbols") fixes a problem with gas-generated dwarf info.

So, let's see if we can reproduce the problem and test the fix in gdb.

Multi-source test-case:
...
$ cat test.c
extern int foo (void);

int
main (void)
{
  int res = foo ();
  return res;
}
$ cat test2.c
int
foo (void)
{
  return 0;
}
...

Test script:
...
$ cat compile.sh
#!/bin/sh

as=/home/vries/binutils/install/bin/as

gcc -c -g test.c
gcc -S test2.c
$as --64 -gdwarf-5 -o test2.o test2.s
gcc test.o test2.o 

./gdb.sh -batch a.out -ex start -ex "p foo" -ex "p (int) foo ()"
...


II. 2.38

Using $as from 2.38:
...
$ ./compile.sh
Temporary breakpoint 1 at 0x40049f: file test.c, line 6.

Temporary breakpoint 1, main () at test.c:6
6         int res = foo ();
$1 = {<text variable, no debug info>} 0x4004ac <foo>
$2 = 0
...
Looks as expected.

III. 2.39

Using $as from 2.39:
...
$ ./compile.sh
Temporary breakpoint 1 at 0x40049f: file test.c, line 6.

Temporary breakpoint 1, main () at test.c:6
6         int res = foo ();
$1 = {void (void)} 0x4004ac <foo>
Invalid cast.
...
So, this is the bug the commit is trying to fix.


III. current trunk

Using $as from current trunk:
...
$ ./compile.sh
Dwarf Error: unexpected tag 'DW_TAG_unspecified_type' at offset 0xf4
Temporary breakpoint 1 at 0x40049f: file test.c, line 6.

Temporary breakpoint 1, main () at test.c:6
6         int res = foo ();
Dwarf Error: unexpected tag 'DW_TAG_unspecified_type' at offset 0xf4
Dwarf Error: unexpected tag 'DW_TAG_unspecified_type' at offset 0xf4
...

So, either the debug info is invalid, or gdb needs to learn how to handle this.

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

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

end of thread, other threads:[~2023-01-26 17:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-08  8:38 [Bug gdb/29558] New: [gdb/symtab] Handle gas-generated debug info (DW_TAG_unspecified_type) vries at gcc dot gnu.org
2022-09-08  8:38 ` [Bug gdb/29558] " vries at gcc dot gnu.org
2022-09-08  8:46 ` vries at gcc dot gnu.org
2022-09-08  8:51 ` vries at gcc dot gnu.org
2022-09-08  9:01 ` vries at gcc dot gnu.org
2022-09-08 10:45 ` vries at gcc dot gnu.org
2022-09-08 10:45 ` vries at gcc dot gnu.org
2022-09-08 12:20 ` vries at gcc dot gnu.org
2022-09-08 13:06 ` [Bug symtab/29558] " vries at gcc dot gnu.org
2022-09-11  7:02 ` vries at gcc dot gnu.org
2023-01-26 17:28 ` mark at klomp dot org
2023-01-26 17:29 ` mark at klomp dot 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).