Is it possible to set a complex breakpoint which has condition which involves check on the argument passed to the outer function(frame).
eg.
1 #0 sample::_processMessage (this=0xa5c8c0, data=0x7fffe5ae31db "\027w\270߸\023\032\212\v", line=0x7fffe4799db8 "224.4.2.197:60200", should_process=true) a sample.cpp:426
2 #1 0x00007ffff682f05d in sample::_process (this=0xa5c8c0, should_process=true, line=0x7fffe4799db8 "224.4.2.197:60200", data=0x7fffe5ae31db "\027w\270߸\023\032\212\v", sn=31824) a sample.cpp:390
3 #2 0x00007ffff6836744 in sample::drain (this=0xa5c8c0, force=true) at sample.cpp:2284
4 #3 0x00007ffff682ed81 in sample::process (this=0xa5c8c0, mdData=0x7fffe67914e0) at sample.cpp:354
Here I want to set a break point on sample.cpp:356,which is on in the function process-frame#3, if the _process or frame #1 at the time hitting breakpoint has sn == 31824
so actually break point is at function _process but I want pause the execution in the function process
Thanks in advance
I don't know if it's possible to create conditional breakpoints that reference an outer frame, but you could use breakpoint commands to achieve a similar result.
Here's an example gdb session:
(gdb) break some-location
(gdb) commands
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
>silent
>up
>if (sn != 31824)
>continue
>end
>end
Now every time gdb
hits the breakpoint it will automatically move up a frame, check sn
and continue if the value is not correct. This will not be any (or much) slower than a conditional breakpoint, and the only real downside is that it will print out a line each time the breakpoint is hit, even if gdb then continues.
The silent
in the command list cuts down on some of the normal output that is produced when a breakpoint is hit, this can be removed to get a more verbose experience.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With