public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/30215] New: GDB cannot hit second time in empty while loop
@ 2023-03-09 12:50 ahmet_kcbyk at hotmail dot com
  2023-03-09 12:51 ` [Bug breakpoints/30215] " ahmet_kcbyk at hotmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ahmet_kcbyk at hotmail dot com @ 2023-03-09 12:50 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30215
           Summary: GDB cannot hit second time in empty while loop
           Product: gdb
           Version: 12.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: ahmet_kcbyk at hotmail dot com
  Target Milestone: ---

This report describes a problem encountered when using GDB 12.1 to debug a C
program compiled with x86-64 11.2 gcc and the following flags: -O0 -g -gdwarf-2
-Wall -c -fmessage-length=0 -nostdinc -fno-builtin -finput-charset=Cp1252
-fcommon. 
The problem occurs when setting a breakpoint at the beginning of an empty while
loop that contains three assembly instructions: first a nop, then a compare and
a jump. The breakpoint is hit only once at the first iteration of the loop, but
not at subsequent iterations because the compare-jump block skips over the nop
instruction where the breakpoint is set. This makes it difficult to debug the
loop behavior using GDB breakpoints. 
We used Eclipse 2022-12 in Ubuntu 2022.04.1 5.19.0-32-generic linux kernel.
Here is an example code that generates the situation, the breakpoint must be
placed on the while loop. Breakpoint only hits once.

#include <stdio.h>

void foo(void) 
{
int a = 1;
while(a);
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-09 18:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-09 12:50 [Bug breakpoints/30215] New: GDB cannot hit second time in empty while loop 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
2023-03-09 18:58 ` ssbssa at sourceware dot org

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