From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 91A173850431; Wed, 26 Aug 2020 08:07:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 91A173850431 From: "jaydeepchauhan1494 at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/26538] New: Line number zero in line table gives incorrect debugging experince with gdb Date: Wed, 26 Aug 2020 08:07:18 +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: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jaydeepchauhan1494 at gmail 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 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 08:07:18 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26538 Bug ID: 26538 Summary: Line number zero in line table gives incorrect debugging experince with gdb Product: gdb Version: HEAD Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: jaydeepchauhan1494 at gmail dot com Target Milestone: --- Created attachment 12798 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D12798&action=3Ded= it Attached Assembly file. Hi Everyone, We have a situation with GDB(latest trunk) and below testcase referred for further discussion : $ cat gdb.c 1 /* demo testcase */ 2 int garr[2]; 3 int main() { 4 5 if((garr[0] && garr[1])=3D=3D0){ 6 garr[0]=3D1; 7 garr[1]=3D1; 8 } 9 else { 10 garr[0]=3D2; 11 garr[1]=3D2; 12 } 13 printf("%d %d\n",garr[0], garr[1]); 14 return 0; 15 } $clang -target arm64 -g -c gdb.c $./llvm-dwarfdump --debug-line gdb.o ... ... Address Line Column File ISA Discriminator Flags ------------------ ------ ------ ------ --- ------------- ------------- 0x0000000000000000 3 0 1 0 0 is_stmt 0x000000000000000c 0 0 1 0 0 is_stmt prologue= _end 0x000000000000001c 5 13 1 0 0 is_stmt 0x000000000000002c 5 21 1 0 0 0x0000000000000030 0 21 1 0 0 0x0000000000000034 5 24 1 0 0 0x0000000000000038 5 21 1 0 0 0x0000000000000044 0 21 1 0 0 0x0000000000000048 5 12 1 0 0 0x000000000000004c 0 12 1 0 0 0x0000000000000054 6 24 1 0 0 is_stmt 0x000000000000005c 7 24 1 0 0 is_stmt 0x0000000000000060 8 9 1 0 0 is_stmt 0x0000000000000064 0 9 1 0 0 0x000000000000006c 10 25 1 0 0 is_stmt 0x0000000000000074 11 25 1 0 0 is_stmt 0x0000000000000078 0 0 1 0 0 0x000000000000007c 13 27 1 0 0 is_stmt 0x0000000000000084 13 36 1 0 0 0x0000000000000088 0 0 1 0 0 0x0000000000000090 13 10 1 0 0 0x0000000000000098 14 10 1 0 0 is_stmt 0x00000000000000a8 14 10 1 0 0 is_stmt end_sequ= ence =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Let=E2=80=99s demonstrate two issue=E2=80=99s that we see w.r.t gdb that= are related to=20 zero line number. 1)As per above line table prologue_end is set to line zero and we set breakpoint on function then gdb info was stated like below . (gdb) b main Breakpoint 1 at 0x800005ec: file test.c, line 0. It should be, something like=20 (gdb) b main Breakpoint 1 at 0x800005ec: file test.c, line 3. 2)=20 Breakpoint 1, main () at test.c:0 1 /* demo testcase */ (gdb) n 5 if((garr[0] && garr[1])=3D=3D0){ (gdb) 1 /* demo testcase */=20=20=20=20=20 (gdb) 5 if((garr[0] && garr[1])=3D=3D0){ (gdb) 1 /* demo testcase */ (gdb) 6 garr[0]=3D1; (gdb) 7 garr[1]=3D1; (gdb) 8 } (gdb) 1 /* demo testcase */ (gdb) 13 printf("%d %d\n",garr[0], garr[1]); (gdb) 1 /* demo testcase */ (gdb) 13 printf("%d %d\n",garr[0], garr[1]); (gdb) 1 1 14 return 0; (gdb) Here the sequence like =E2=80=9C5->1->5->6=E2=80=9D should be =E2=80=9C5->5= ->6=E2=80=9D and as per DWARF standard ,ZERO line has a well-defined meaning and stands for "no source l= ine corresponds to this location". >>From LLVM point of view the ZERO-LINE debug info added to the compiler generated remat statement=E2=80=99s like loading global constant /value ,w= hich doesn=E2=80=99t have =E2=80=9C.loc=E2=80=9D info from the source. Also attached assembly file in bug for reference. Please share your valuable thoughts on this issue=E2=80=99s. Thanks in Advance, Jaydeep. --=20 You are receiving this mail because: You are on the CC list for the bug.=