0

I set a watch point on memory location in gdb and load a application through gdb load command. watch point does not hit during load command although memory location is being changed during loading of application.

(gdb) watch *0x1c
Hardware watchpoint 2: *0x1c
(gdb) p/x *0x1c   
$2 = 0xffffffff
(gdb) load
Loading section .text, size 0x53b4 lma 0x0
Loading section .eh_frame, size 0x4 lma 0x53b4
Loading section .ARM.exidx, size 0x8 lma 0x53b8
Loading section .rodata, size 0x238 lma 0x53c0
Loading section .data, size 0x520 lma 0x55f8
Start address 0xe4, load size 23320
Transfer rate: 9 KB/sec, 4664 bytes/write.
(gdb) p/x *0x1c
$3 = 0xfdfcdf08
(gdb)

Does watch point work during gdb load command?

Equation Solver
  • 545
  • 7
  • 18
  • Do you want to see when the remote gdbserver writes to that location? If so, then starting another debugger with that gdbserver process as the target (if that's possible - it depends on the remote OS) may do what you want. – Mark Plotnick Feb 19 '15 at 16:23

1 Answers1

0

I think it would be very unexpected if this triggered. Watchpoints are for changes made by running your program. In this case, your program isn't running, it is being loaded.

Tom Tromey
  • 21,507
  • 2
  • 45
  • 63
  • then what else can I do for watching memory location during load.? – Equation Solver Feb 18 '15 at 17:21
  • I don't know. I don't really understand what you hope to see with this. Normally one uses a watchpoint to detect exactly which code changes memory. But here you know -- it is the load command. And, since this isn't part of your application, you can't really see a meaningful stack trace or anything like that... – Tom Tromey Feb 18 '15 at 18:10