1

I am debugging a binary (assembly only) using GDB 7.1 compiled via MacPorts for Snow Leopard. I am interested in a specific address that I found using find gdb command. So that, it is a valid address indeed:

(gdb) printf "%s\n", 0x00196f34
bruno
(gdb)

The problem is whenever I set a watchpoint for it (watch *0x00196f34) AND it gets accessed, the system crashes and reboots right away.

I noticed hardware watchpoint is enabled then, expecting a less severe result, I switched to software watchpoint using set can-use-hw-watchpoints 0 but this didn't fix the problem.

I tried to use gdb 6.3 version that comes with Xcode and watch works fine. There is a difference I noticed when setting such watch for both 6.3 and 7.1:

for gdb 6.3

(gdb) watch *0x00196f34
Watchpoint 1: *0x00196f34
(gdb) info breakpoints 
Num     Type           Disp Enb Address    What
1       watchpoint     keep y              *0x00196f34

for gdb 7.1

(gdb) watch *0x00196f34
Hardware watchpoint 1: *1666868
(gdb) info breakpoints 
Num Type           Disp Enb Address    What
1   hw watchpoint  keep y              *1666868

Why does the older gdb, which works, print in hex while the new one translates the address into decimal number? I still want to work with gdb 7, so any clue what is it going on here?

Bruno Velasco

Bruno Velasco
  • 135
  • 1
  • 6
  • OTMH, handling the traps on hardware watchpoints requires OS support. Since default GDB does not support them (or does some magic dance around the debug registers) you probably want to stay away from that feature in 7.1 for now. – Nikolai Fetissov Jan 12 '11 at 16:19

0 Answers0