public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "ahmet_kcbyk at hotmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug breakpoints/30215] New: GDB cannot hit second time in empty while loop
Date: Thu, 09 Mar 2023 12:50:30 +0000	[thread overview]
Message-ID: <bug-30215-4717@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2023-03-09 12:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09 12:50 ahmet_kcbyk at hotmail dot com [this message]
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

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@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: link
Be 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).