public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "tromey at sourceware dot org" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug breakpoints/30215] GDB cannot hit second time in empty while loop Date: Thu, 09 Mar 2023 16:50:33 +0000 [thread overview] Message-ID: <bug-30215-4717-H9GjO4cGcE@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-30215-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=30215 Tom Tromey <tromey at sourceware dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tromey at sourceware dot org --- Comment #1 from Tom Tromey <tromey at sourceware dot org> --- The Fedora 36 gcc has this issue. Look at my source and the decodedline dump: murgatroyd. nl -ba q.c 1 void foo(void) 2 { 3 int a = 1; 4 while(a); 5 } murgatroyd. readelf --debug-dump=decodedline q.o Contents of the .debug_line section: CU: ./q.c: File name Line number Starting address View Stmt q.c 2 0 x q.c 3 0x4 x q.c 4 0xb x q.c 4 0xc x q.c 5 0x12 x q.c - 0x16 Now the disassembly: 0000000000000000 <foo>: 0: 55 push %rbp 1: 48 89 e5 mov %rsp,%rbp 4: c7 45 fc 01 00 00 00 movl $0x1,-0x4(%rbp) b: 90 nop c: 83 7d fc 00 cmpl $0x0,-0x4(%rbp) 10: 75 fa jne c <foo+0xc> ... Both 0xb and 0xc are marked as statements. However when setting a breakpoint, I think gdb picks the lowest address. So on the one hand, maybe this is a gdb bug. Perhaps it should set a low-level breakpoint at each instruction that is marked as being a statement at the given line. The idea being, if a given statement has multiple "entry points", gdb should catch them all. These would have to be spots where stepping would stop as well. On the other hand, IMO this behavior by the compiler is pathological. -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2023-03-09 16:50 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-09 12:50 [Bug breakpoints/30215] New: " ahmet_kcbyk at hotmail dot com 2023-03-09 12:51 ` [Bug breakpoints/30215] " ahmet_kcbyk at hotmail dot com 2023-03-09 16:50 ` tromey at sourceware dot org [this message] 2023-03-09 18:58 ` ssbssa at sourceware dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-30215-4717-H9GjO4cGcE@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).