From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C10683858C2D; Thu, 9 Mar 2023 18:58:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C10683858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678388302; bh=gB0jS5fYyVng9DMPT6PvGr66l6QOFp40DN13ycDbp9o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gISjkH47fghALp2hC8giwHHUQMmHWBV0WQSz+lPZpl9z5ATSYqAFFSzoUC+RfHp7Q 296qLcgO+y9PhrfiZAV3UIfM1rBaQFLgRCcpWVABWBQeqjy2ZerEFHEt0aLxuNGfxN 85gdr5SxoBT0/WQGCgjqFnaiaVXYddmBkmhctNt8= From: "ssbssa at sourceware dot org" To: gdb-prs@sourceware.org Subject: [Bug breakpoints/30215] GDB cannot hit second time in empty while loop Date: Thu, 09 Mar 2023 18:58:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: breakpoints X-Bugzilla-Version: 12.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ssbssa at sourceware dot org 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: cc Message-ID: In-Reply-To: References: 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=3D30215 Hannes Domani changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ssbssa at sourceware dot o= rg --- Comment #2 from Hannes Domani --- Seems similar to the issue of this question: https://stackoverflow.com/questions/75333490/gdb-breakpoint-not-hit Simplified code: int main(int argc, char **argv) { int ret; while (1) { if (argc > 3) ret =3D 1; else if (argc > 2) ret =3D 2; else ret =3D 3; break; // BREAKPOINT } return ret; } It will hit the breakpoint only if the first if-condition is fulfilled, even though there are 3 locations in the line-table for line 13: INDEX LINE ADDRESS IS-STMT 0 2 0x000000013ffd1600 Y 1 2 0x000000013ffd160f Y 2 7 0x000000013ffd1614 Y 3 8 0x000000013ffd161a Y 4 13 0x000000013ffd1621 Y 5 9 0x000000013ffd1623 Y 6 10 0x000000013ffd1629 Y 7 13 0x000000013ffd1630 Y 8 12 0x000000013ffd1632 Y 9 13 0x000000013ffd1639 Y 10 16 0x000000013ffd163a Y 11 17 0x000000013ffd163d Y 12 END 0x000000013ffd1643 Y 0x000000013ffd1600 <+0>: push %rbp 0x000000013ffd1601 <+1>: mov %rsp,%rbp 0x000000013ffd1604 <+4>: sub $0x30,%rsp 0x000000013ffd1608 <+8>: mov %ecx,0x10(%rbp) 0x000000013ffd160b <+11>: mov %rdx,0x18(%rbp) 0x000000013ffd160f <+15>: call 0x13ffd1700 <__main> 0x000000013ffd1614 <+20>: cmpl $0x3,0x10(%rbp) 0x000000013ffd1618 <+24>: jle 0x13ffd1623 0x000000013ffd161a <+26>: movl $0x1,-0x4(%rbp) 0x000000013ffd1621 <+33>: jmp 0x13ffd1639 0x000000013ffd1623 <+35>: cmpl $0x2,0x10(%rbp) 0x000000013ffd1627 <+39>: jle 0x13ffd1632 0x000000013ffd1629 <+41>: movl $0x2,-0x4(%rbp) 0x000000013ffd1630 <+48>: jmp 0x13ffd1639 0x000000013ffd1632 <+50>: movl $0x3,-0x4(%rbp) 0x000000013ffd1639 <+57>: nop 0x000000013ffd163a <+58>: mov -0x4(%rbp),%eax 0x000000013ffd163d <+61>: add $0x30,%rsp 0x000000013ffd1641 <+65>: pop %rbp 0x000000013ffd1642 <+66>: ret --=20 You are receiving this mail because: You are on the CC list for the bug.=