Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Watchpoint a fixed address

For my current embedded application I am trying to put GDB watch point at a fixed memory address.

As an example, my application updates the following address: 0x10793ad0. In order to be sure which part of the code is corrupting the value, I tried

watch 0x10793ad0 

Even though GDB does not print any error after this, it is not able to break during execution even though I verified the value is getting modified at between start and end of execution.

Questions:

  1. Can I really put watch at a fixed address? I didn't come across any such example online.
  2. Is this the right way or am I missing something?
like image 649
maniac_inside Avatar asked Sep 06 '10 06:09

maniac_inside


People also ask

What is a watchpoint in GDB?

Setting watchpoints. You can use a watchpoint to stop execution whenever the value of an expression changes, without having to predict a particular place where this may happen. Depending on your system, watchpoints may be implemented in software or hardware.

How are watchpoints used?

Watchpoints can be used to monitor “write”, “read” or “read/write” accesses. For example, a watchpoint might be configured to trip when a variable gets updated, a region of the stack is written to, or a particular buffer is read from.

How do I delete a watchpoint in GDB?

Simply quit GDB, and all breakpoints and watchpoints will be gone. Or do (gdb) delete (without specifying a break point), and confirm that you want to delete all.


1 Answers

The right way to set watchpoint on address is watch *0x10793ad0. See gdb doc

like image 133
ks1322 Avatar answered Oct 12 '22 16:10

ks1322