public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/29967] New: Issue with line number information after symbols read from elf
@ 2023-01-06 11:16 prashant.malladi at amd dot com
  2023-01-06 11:18 ` [Bug gdb/29967] " prashant.malladi at amd dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: prashant.malladi at amd dot com @ 2023-01-06 11:16 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29967
           Summary: Issue with line number information after symbols read
                    from elf
           Product: gdb
           Version: 10.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: prashant.malladi at amd dot com
  Target Milestone: ---

Created attachment 14559
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14559&action=edit
elf file attached

We’re trying to add debug support for AMD-Xilinx cores to GDB. 
During our testing, we have few observations listed below. I’m attaching the
elf file for reference.
The line number information is not available even after the symbols are read
from the file. Refer below snippet.
-------------------------------------------------------
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) file 24_0
Reading symbols from 24_0...
(gdb) info line main
No line number information available for address 0x110 <main ()>
-----------------------------------------------------------------

After some debugging, we were able to identify that the function
check_line_address() in dwarf2/read.c sets the flag m_currently_recording_lines
to false if the address in the CU is 0. 
If we dump the .debug_line section from the elf, we find the line number
statements for every CU starts with this statement - “Extended opcode 2: set
Address to 0x0”.  
-----------------------------------------------------------------
Line Number Statements:
[0x0000021b] Extended opcode 2: set Address to 0x0
[0x00000222] Advance Line by -1 to 0
[0x00000224] Set File Name to entry 1 in the File Name Table
[0x00000226] Advance Line by 33 to 33
[0x00000228] Advance PC by 272 to 0x110
[0x0000022b] Copy
[0x0000022c] Set is stmt to 1
[0x0000022d] Special opcode 5: advance Address by 0 to 0x110 and Line by 0 to
33
-------------------------------------------------------------------

Since the address is set to 0 in every CU, and the address is always < lowPC,
the flag m_currently_recording_lines is always set to false and no line number
information is recorded. If we comment the line which sets the flag to false,
we can read the line number information without any issue. 


After modifying the gdb with the above changes, we can see the line number
information
-------------------------------------------------------------------
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) file 24_0
Reading symbols from 24_0...
(gdb) info line main
Line 33 of "../src/24_0.cc" starts at address 0x110 <main ()> and ends at 0x11c
<main () +12>.
-------------------------------------------------------------------

-- 
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/29967] Issue with line number information after symbols read from elf
  2023-01-06 11:16 [Bug gdb/29967] New: Issue with line number information after symbols read from elf prashant.malladi at amd dot com
@ 2023-01-06 11:18 ` prashant.malladi at amd dot com
  2023-01-06 19:32 ` tromey at sourceware dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: prashant.malladi at amd dot com @ 2023-01-06 11:18 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Malladi, Prashant <prashant.malladi at amd dot com> ---
Created attachment 14560
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14560&action=edit
reference

Attaching a document with some screenshots for easy understanding

-- 
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/29967] Issue with line number information after symbols read from elf
  2023-01-06 11:16 [Bug gdb/29967] New: Issue with line number information after symbols read from elf prashant.malladi at amd dot com
  2023-01-06 11:18 ` [Bug gdb/29967] " prashant.malladi at amd dot com
@ 2023-01-06 19:32 ` tromey at sourceware dot org
  2023-01-11  5:57 ` prashant.malladi at amd dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at sourceware dot org @ 2023-01-06 19:32 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
I'm not really sure what to do in a case like this.
That special case for 0 is there to avoid problems
with section GC.  I guess you'd have to find some
way to distinguish the two cases.

> Attaching a document with some screenshots for easy understanding

This seems to have been attached as text, but I'm
not sure screenshots are any better than just cut-and-paste anyhow.

-- 
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/29967] Issue with line number information after symbols read from elf
  2023-01-06 11:16 [Bug gdb/29967] New: Issue with line number information after symbols read from elf prashant.malladi at amd dot com
  2023-01-06 11:18 ` [Bug gdb/29967] " prashant.malladi at amd dot com
  2023-01-06 19:32 ` tromey at sourceware dot org
@ 2023-01-11  5:57 ` prashant.malladi at amd dot com
  2023-01-11 20:54 ` tromey at sourceware dot org
  2023-09-05 11:00 ` rajesh.palla at amd dot com
  4 siblings, 0 replies; 6+ messages in thread
From: prashant.malladi at amd dot com @ 2023-01-11  5:57 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Malladi, Prashant <prashant.malladi at amd dot com> ---
Thanks for you comments Tom.
Do you think, the elf generation is fine?
Any problem with these line statements - especially the first 2 lines here. 
-------------------------------------------------------------------
Line Number Statements:
[0x0000021b] Extended opcode 2: set Address to 0x0
[0x00000222] Advance Line by -1 to 0
[0x00000224] Set File Name to entry 1 in the File Name Table
[0x00000226] Advance Line by 33 to 33
[0x00000228] Advance PC by 272 to 0x110
[0x0000022b] Copy
[0x0000022c] Set is stmt to 1
[0x0000022d] Special opcode 5: advance Address by 0 to 0x110 and Line by 0 to
33
-------------------------------------------------------------------

-- 
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/29967] Issue with line number information after symbols read from elf
  2023-01-06 11:16 [Bug gdb/29967] New: Issue with line number information after symbols read from elf prashant.malladi at amd dot com
                   ` (2 preceding siblings ...)
  2023-01-11  5:57 ` prashant.malladi at amd dot com
@ 2023-01-11 20:54 ` tromey at sourceware dot org
  2023-09-05 11:00 ` rajesh.palla at amd dot com
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at sourceware dot org @ 2023-01-11 20:54 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
The problem here is that while the DWARF may be correct,
it's also the case that this mimics the output of a
common failure case -- when section GC is used and a function
is deleted.

What you'd have to do is try a patch and then make sure
it doesn't regress that case as well.  So maybe it would
have to be a bit smarter, I'm not sure.

I don't recall offhand if there's a test case for the section GC
scenario in the gdb test suite.  That would also be good.

-- 
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/29967] Issue with line number information after symbols read from elf
  2023-01-06 11:16 [Bug gdb/29967] New: Issue with line number information after symbols read from elf prashant.malladi at amd dot com
                   ` (3 preceding siblings ...)
  2023-01-11 20:54 ` tromey at sourceware dot org
@ 2023-09-05 11:00 ` rajesh.palla at amd dot com
  4 siblings, 0 replies; 6+ messages in thread
From: rajesh.palla at amd dot com @ 2023-09-05 11:00 UTC (permalink / raw)
  To: gdb-prs

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

Palla, Rajesh <rajesh.palla at amd dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rajesh.palla at amd 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

end of thread, other threads:[~2023-09-05 11:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 11:16 [Bug gdb/29967] New: Issue with line number information after symbols read from elf prashant.malladi at amd dot com
2023-01-06 11:18 ` [Bug gdb/29967] " prashant.malladi at amd dot com
2023-01-06 19:32 ` tromey at sourceware dot org
2023-01-11  5:57 ` prashant.malladi at amd dot com
2023-01-11 20:54 ` tromey at sourceware dot org
2023-09-05 11:00 ` rajesh.palla at amd dot com

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