This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug breakpoints/11613] New: hardware watchpoint missed for -O2 -g inferior


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]