public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "jan dot kratochvil at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug breakpoints/11613] New: hardware watchpoint missed for -O2 -g inferior
Date: Wed, 19 May 2010 19:51:00 -0000	[thread overview]
Message-ID: <20100519195106.11613.jan.kratochvil@redhat.com> (raw)

==> 1.c <==
int
g (int j)
{
  int l = j + 2;
  return l;
}
extern int f (int i);
int
main (int argc, char **argv)
{
  f (1);
  return 0;
}

==> 2.c <==
extern int g (int j);
int
f (int i)
{
  i++;
  g (2);
  return g (i);
}


gcc 1.c 2.s -Wall -o 1 -m32
# Tested with gcc-4.4.3-4.fc12.x86_64 but 1.c -> 2.s is attached precompiled.

Works using 'set can-use-hw-watchpoints 0' workaround:

$ gdb -nx -ex 'set can-use-hw-watchpoints 0' -ex 'b f' -ex r -ex 'p i' -ex
'watch i' -ex 'adv 7' -ex 'p i' ./1
$1 = 1
Watchpoint 2: i
Watchpoint 2: i

Old value = 1
New value = 2
f (i=2) at 2.c:6
6	  g (2);
$2 = 2


Does not work without the workaround:
$ gdb -nx -ex 'b f' -ex r -ex 'p i' -ex 'watch i' -ex 'adv 7' -ex 'p i' ./1
$1 = 1
Hardware watchpoint 2: i
f (i=2) at 2.c:7
7	  return g (i);
$2 = 2
The value has changed but the breakpoint has not triggered.

 <2><3e>: Abbrev Number: 3 (DW_TAG_formal_parameter)
    <3f>   DW_AT_name        : i
    <43>   DW_AT_type        : <0x4c>
    <47>   DW_AT_location    : 0x0      (location list)
Contents of the .debug_loc section:
    Offset   Begin    End      Expression
    00000000 080483d0 080483da (DW_OP_fbreg: 0)
    00000000 080483da 080483f1 (DW_OP_breg3: 1; DW_OP_stack_value)
    00000000 <End of list>

-- 
           Summary: hardware watchpoint missed for -O2 -g inferior
           Product: gdb
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: breakpoints
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: jan dot kratochvil at redhat dot com
                CC: gdb-prs at sourceware dot org,sergiodj at redhat dot com
GCC target triplet: i386-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=11613

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


             reply	other threads:[~2010-05-19 19:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 19:51 jan dot kratochvil at redhat dot com [this message]
2010-05-19 19:52 ` [Bug breakpoints/11613] " jan dot kratochvil at redhat dot com

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=20100519195106.11613.jan.kratochvil@redhat.com \
    --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).