From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6E3F43858D35; Fri, 6 Jan 2023 11:16:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6E3F43858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673003809; bh=tt0bD997yAQYrF2P7sfyOlR5jTlG0NznAXaoVthlBpw=; h=From:To:Subject:Date:From; b=IVg6UpY9qtj5EECoSfzRE46GZdb6Y9jwHE1LiQb2WNtxKMcVmNUB0+mwaZ4Gh3kh2 Pxx88evVEVfwd3frbKHy74pJZifvVo3wHyLNh2AyHJiP3eTyzSTmeoXdBo4QZeeQ2g eP9JkPqx/8dpMSbttCYv2twZoOi8W5JfqoeBzTLU= From: "prashant.malladi at amd dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/29967] New: Issue with line number information after symbols read from elf Date: Fri, 06 Jan 2023 11:16:48 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 10.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: prashant.malladi at amd dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29967 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=3D14559&action=3Ded= it elf file attached We=E2=80=99re trying to add debug support for AMD-Xilinx cores to GDB.=20 During our testing, we have few observations listed below. I=E2=80=99m atta= ching 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
----------------------------------------------------------------- After some debugging, we were able to identify that the function check_line_address() in dwarf2/read.c sets the flag m_currently_recording_l= ines to false if the address in the CU is 0.=20 If we dump the .debug_line section from the elf, we find the line number statements for every CU starts with this statement - =E2=80=9CExtended opco= de 2: set Address to 0x0=E2=80=9D.=20=20 ----------------------------------------------------------------- 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 < lowP= C, the flag m_currently_recording_lines is always set to false and no line num= ber information is recorded. If we comment the line which sets the flag to fals= e, we can read the line number information without any issue.=20 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
and ends at 0= x11c
. ------------------------------------------------------------------- --=20 You are receiving this mail because: You are on the CC list for the bug.=