watchpoint

Is it possible to set a gdb watchpoint programmatically?

别等时光非礼了梦想. 提交于 2020-01-19 06:59:18
问题 I want to set a watchpoint (break on hardware write) temporarily in my C++ program to find memory corruption. I've seen all the ways to do it manually through gdb, but I would like to actually set the watchpoint via some method in my code so I don't have to break into gdb, find out the address, set the watchpoint and then continue. Something like: #define SET_WATCHPOINT(addr) asm ("set break on hardware write %addr") 回答1: Set hardware watchpoint from child process. #include <signal.h>

Is it possible to set a gdb watchpoint programmatically?

时光毁灭记忆、已成空白 提交于 2020-01-19 06:59:06
问题 I want to set a watchpoint (break on hardware write) temporarily in my C++ program to find memory corruption. I've seen all the ways to do it manually through gdb, but I would like to actually set the watchpoint via some method in my code so I don't have to break into gdb, find out the address, set the watchpoint and then continue. Something like: #define SET_WATCHPOINT(addr) asm ("set break on hardware write %addr") 回答1: Set hardware watchpoint from child process. #include <signal.h>

break *main VS break main() in GDB

两盒软妹~` 提交于 2020-01-04 01:58:31
问题 what is the difference between break *main and break main() in essence? for example: #include <iostream> using namespace std; int main() { int x=30; int y=40; x=y; return 0; } when I use break *main and watch x , it is this: (gdb) b *main Breakpoint 1 at 0x400674: file aa.cpp, line 4. (gdb) r Starting program: /root/dd/aa.out Breakpoint 1, main () at aa.cpp:4 4 { (gdb) n 5 int x=30; (gdb) watch x Hardware watchpoint 2: x (gdb) c Continuing. Hardware watchpoint 2: x Old value = 0 New value =

GDB: How to force a watchpoint to not be deleted after a function returned?

蓝咒 提交于 2020-01-02 06:22:06
问题 Watchpoints on function-local variables usually get removed upon the function return, with a message «Watchpoint 7 deleted because the program has left the block in». Illustration: struct mystruct{ int a, b, c; }; void MyFunc(){ mystruct obj; obj.a = 2; } int main(){ MyFunc(); } gdb session example (gdb) b 7 Breakpoint 1 at 0x4004f1: file /tmp/test2.cpp, line 7. (gdb) r Starting program: /tmp/test2 Breakpoint 1, MyFunc () at /tmp/test2.cpp:7 7 obj.a = 2; (gdb) wa obj Hardware watchpoint 2:

In XCode 6 how can you set a watchpoint without stopping execution?

点点圈 提交于 2019-12-30 04:25:10
问题 You can easily set a watchpoint in XCode by following these steps (btw if there is a simpler way, I'd like to know it...): - Run your program - Set a breakpoint in the code where your variable is used - when reaching breakpoint, use a right click on the variable and select 'Watch "nameOfTheVariable"' - Continue execution. The only problem is that execution will stop every time the variable value changes. I would like XCode to continue the execution without stopping, i.e. merely display the

Hardware watchpoints - how do they work?

自闭症网瘾萝莉.ら 提交于 2019-12-21 17:42:24
问题 How do GDB watchpoints work? Can similar functionality be implemented to harness byte level access at defined locations? 回答1: I believe gdb uses the MMU so that the memory pages containing watched address ranges are marked as protected - then when an exception occurs for a write to a protected pages gdb handles the exception, checks to see whether the address of the write corresponds to a particular watchpoint, and then either resumes or drops to the gdb command prompt accordingly. You can

Is it possible to set watchpoints on Swift properties?

匆匆过客 提交于 2019-12-18 14:48:15
问题 In Objective-C, I would sometimes set watchpoints in LLDB to let me know when instance variables had changed. Can I do this with Swift properties too? Right now, the only way I can achieve this is: adding a didSet handler to the property and setting a breakpoint inside (but this requires stopping the program and recompiling, which kind of defeats the purpose) adding a symbolic breakpoint on [setPropertyName:] but this only works if the class happens to support Objective-C bridging Do I have

Want to watch consistently and examine occasionally the variable outside the current frame in gdb

痞子三分冷 提交于 2019-12-11 13:13:35
问题 Say I define a variable named var in the main function. And the I set a watchpoint to it. Then I enter another function called func() . At this time, the watchpoints may be deleted so that I have no access to that variable. Any method to make to possible to always keep the watchpoint whenever you are? Also, I know I can use syntax like print main::var to print out the value of the variable. But that is not sufficient enough. Any good idea? 回答1: An oddity of gdb is that watch tries to respect

iphone Xcode 3.1.4 3.1.2 SDK, watchpoints don't work?

戏子无情 提交于 2019-12-09 16:44:55
问题 If I try to set a watchpoint I get a gdb error: " can't clear hardware watchpoints without the 'Z2' (write-watchpoint) packet " Then it seems to corrupt the device (on restarting the device it complains that the OS is too old for the SDK, even though it's OS 3.1.2). I've got a bug to track down that really would be easy to track down with a watchpoint so this really is a pain. Anybody know if watchpoints are supposed to work? How to get them to work? 回答1: Unfortunately this is a known bug in

Conditional breakpoint by caller in Java eclipse

只愿长相守 提交于 2019-12-09 09:27:13
问题 I am trying to track a change of a value using watchpoint in a Java program in Eclipse debugger. The class hierarchy is pretty complex and the value I am tracking is wrapped in container, which is used on many places. To be more specific, there is a container SizeRequirement , which has a property minimum , which I am tracking. This class is used by many layout managers on many places for many components to define requirement for component's sizes. I need to catch exact call, where the value