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
* [Bug gdb/29558] [gdb/symtab] Handle gas-generated debug info (DW_TAG_unspecified_type)
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 ` vries at gcc dot gnu.org
2022-09-08 8:46 ` vries at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 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
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
See also PR17271 - "unsupported tag: DW_TAG_unspecified_type"
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/29558] [gdb/symtab] Handle gas-generated debug info (DW_TAG_unspecified_type)
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
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-08 8:46 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29558
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nickc at redhat dot com
--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Debug info looks like:
...
Compilation Unit @ offset 0xf4:
Length: 0x35 (32-bit)
Version: 5
Unit Type: DW_UT_compile (1)
Abbrev Offset: 0xa3
Pointer Size: 8
<0><100>: Abbrev Number: 3 (DW_TAG_unspecified_type)
<0><101>: Abbrev Number: 1 (DW_TAG_compile_unit)
<102> DW_AT_stmt_list : 0x123
<106> DW_AT_low_pc : 0x4004ac
<10e> DW_AT_high_pc : 11
<10f> DW_AT_name : test2.s
<113> DW_AT_comp_dir : /home/vries/gdb_versions/devel
<117> DW_AT_producer : GNU AS 2.39.50
<11b> DW_AT_language : 32769 (MIPS assembler)
<1><11d>: Abbrev Number: 2 (DW_TAG_subprogram)
<11e> DW_AT_name : (indirect string, offset: 0x241): foo
<122> DW_AT_external : 1
<122> DW_AT_type : <0x100>
<123> DW_AT_low_pc : 0x4004ac
<12b> DW_AT_high_pc : 11
...
OK, that looks highly unregular, the DW_TAG_unspecified_type die as a top-level
DIE.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/29558] [gdb/symtab] Handle gas-generated debug info (DW_TAG_unspecified_type)
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
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-08 8:51 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29558
--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
In the dwarf-5 standard I read:
...
For each compilation unit compiled with a DWARF producer, a contribution is
made to the .debug_info section of the object file. Each such contribution
consists of a compilation unit header followed by a single DW_TAG_compile_unit
or DW_TAG_partial_unit debugging information entry, together with its children.
...
Ok, so this is in fact incorrect dwarf.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/29558] [gdb/symtab] Handle gas-generated debug info (DW_TAG_unspecified_type)
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
` (2 preceding siblings ...)
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
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-08 9:01 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29558
--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #3)
> Ok, so this is in fact incorrect dwarf.
Filed gas PR29559 - "gas generated incorrect debug info (top-level
DW_TAG_unspecified_type DIE)".
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/29558] [gdb/symtab] Handle gas-generated debug info (DW_TAG_unspecified_type)
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
` (3 preceding siblings ...)
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
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-08 10:45 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29558
--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 14326
--> https://sourceware.org/bugzilla/attachment.cgi?id=14326&action=edit
Dwarf assembly test-case
Currently, this fails:
...
(gdb) PASS: gdb.dwarf2/dw2-unspecified-type.exp: p ((int (*) ()) foo) ()
p (int) foo ()^M
Invalid cast.^M
(gdb) FAIL: gdb.dwarf2/dw2-unspecified-type.exp: p (int) foo ()
...
because DW_TAG_unspecified_type is translated as void.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/29558] [gdb/symtab] Handle gas-generated debug info (DW_TAG_unspecified_type)
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
` (4 preceding siblings ...)
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
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-08 10:45 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29558
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kevinb at redhat dot com
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug gdb/29558] [gdb/symtab] Handle gas-generated debug info (DW_TAG_unspecified_type)
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
` (5 preceding siblings ...)
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
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-08 12:20 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29558
--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> See also PR17271 - "unsupported tag: DW_TAG_unspecified_type"
I've looked now at that one, and it looks unrelated, that's the case when a
DW_TAG_unspecificed_type DIE has a name attribute.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug symtab/29558] [gdb/symtab] Handle gas-generated debug info (DW_TAG_unspecified_type)
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
` (6 preceding siblings ...)
2022-09-08 12:20 ` vries at gcc dot gnu.org
@ 2022-09-08 13:06 ` vries at gcc dot gnu.org
2022-09-11 7:02 ` vries at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-08 13:06 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29558
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|gdb |symtab
--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2022-September/191753.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug symtab/29558] [gdb/symtab] Handle gas-generated debug info (DW_TAG_unspecified_type)
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
` (7 preceding siblings ...)
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
10 siblings, 0 replies; 12+ messages in thread
From: vries at gcc dot gnu.org @ 2022-09-11 7:02 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29558
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
Target Milestone|--- |13.1
--- Comment #8 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=a34a90995ae7c2f0c0b79ad32d8087d507fe42db
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug symtab/29558] [gdb/symtab] Handle gas-generated debug info (DW_TAG_unspecified_type)
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
` (8 preceding siblings ...)
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
10 siblings, 0 replies; 12+ messages in thread
From: mark at klomp dot org @ 2023-01-26 17:28 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29558
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mark at klomp dot org
--- Comment #9 from Mark Wielaard <mark at klomp dot org> ---
Created attachment 14632
--> https://sourceware.org/bugzilla/attachment.cgi?id=14632&action=edit
tests: Handle DW_TAG_unspecified_type in funcretval test
This patch just fixes the testcase to check for DW_TAG_unspecified_type as
return type.
With your test binary tests/funcretval now prints:
() _start: returns unspecified type
() main: return value location: {0x50, 0}
But maybe a better fix is for dwfl_module_return_value_location to return zero
(which technically means that the function doesn't have a return value).
Opinions?
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug symtab/29558] [gdb/symtab] Handle gas-generated debug info (DW_TAG_unspecified_type)
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
` (9 preceding siblings ...)
2023-01-26 17:28 ` mark at klomp dot org
@ 2023-01-26 17:29 ` mark at klomp dot org
10 siblings, 0 replies; 12+ messages in thread
From: mark at klomp dot org @ 2023-01-26 17:29 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29558
--- Comment #10 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Mark Wielaard from comment #9)
> Created attachment 14632 [details]
> tests: Handle DW_TAG_unspecified_type in funcretval test
>
> This patch just fixes the testcase to check for DW_TAG_unspecified_type as
> return type.
> With your test binary tests/funcretval now prints:
>
> () _start: returns unspecified type
> () main: return value location: {0x50, 0}
>
> But maybe a better fix is for dwfl_module_return_value_location to return
> zero (which technically means that the function doesn't have a return value).
>
> Opinions?
Sorry, this patch was for elfutils, specifically
https://sourceware.org/bugzilla/show_bug.cgi?id=30047 I was just looking how
gdb handled this.
Apologies.
--
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).