How to set conditional breakpoin based on parameter value using windbg -
I want to set a conditional breakpoint on a member of a parameter, the command I now check this parameter I can use dt, my code looks like this:
zero test (const myClassB and inst, int value) {}
now I I can use the dt command to see the first parameter, the result:
0: 000: x86> DT MyClassB @ esp 4 dbgee MyClassB + 0x000 ID: (null) + 0x004 meters: 0n2130567168 + 0x008 myClassA: MyClassA
Now I want to set a conditional breakpoint based on the pattern Inst The value of .m, can anyone show me how to do this? Thanks a bunch!
And how to use an offset (like +0x004 for M), thanks, someone can give it information!
After the
snippet Setbal pause time width == 7 conditional breakpoint syntax Explanation The command should be in one line Results cl / gi / nologo / w4 / analysis% 1% / link / release < Compiled with / code> MSVC ++ 2010exp
#include Stdio.h & gt; Class MyClass {int width, length; Public: zero set_val (int, int); Int area (); }; Zero MyClass :: set_val (int x, int y) {width = x; Length = y; } Int MyClass :: Area () {Return width * Length; } Zero main (zero) {MyClass foo; For (int i = 0; i
classtest! MyClass :: set_val
& lt; Module! Class :: method & gt;
Using
method ( c ++ expression evaluator
@ecx
using <@> this indicator
The appropriate code is MyClass *
width
a is a member of MyClass
for this reason, We use 6
- We are setting the break code before the execution of set_val () uninitialized garbage
to Note when printing for the first time)
width == 7 to break
gc
m After displaying yClass go to the position if width! = 7
.
BP classtest! MyClass :: set_val ".if (@@ c ++ (((MyClass * @xx) -> width) = 6) {dt MyClass @ecx; gc}"
0: 000> BP classtest MyClass :: set_val "If (@@ c ++ ((((MyClass *) @ecx) - & gt; width)! = 6) {dt MyClass @ecx; GC}" 0: 000 & gt ; BL 0 e 00,401,000 0001 (0001) 0: **** classtest MyClass :: set_val "If (@@ c ++ ((((MyClass *) @ecx) - & gt; width))! = 6 ) {dt MyClass @ecx; GC} "0: 000 & gt; G ModLoad: 5cb70000 5cb96000 C: \ WINDOWS \ system32 \ ShimEng.dll classtest MyClass + 0x000 width: 0n4205541 + 0x004 length: 0n4208683 classtest MyClass + 0x000 width: 0n0 + 0x004 length: 0n5 classtest !! MyClass + 0x000 width: 0n1 + 0x004 length: 0n5 classtest MyClass + 0x000 width: 0n2 + 0x004 length: 0n5 classtest MyClass + 0x000 width: 0n3 + 0x004 length: 0n5 classtest MyClass + 0x000 width: 0n4 + 0x004 Length: 0n5 Classtest! MyClass + 0x000 Width: 0n5 + 0x004 Nbai: 0n5 eax = 00000007 ebx = 7ffdf000 ecx = 0013ff70 edx = 00416680 esi = 00000000 edi = 0098f6ee AIP = 00401000 esp = 0013ff60 ebp = 0013ff78 iopl = 0 NV up EI ng NJ AC po cy cs = 001b ss = 0023 ds = 0023 es = 0023 FS = 003B gs = 0000 EFL = 00,000,293 classtest MyClass :: set_val: 00401,000 55 push EBP 0: 000> Dd esp L3 00 13ff60 0040106C00000007 00000005 0: 000> X 0eeep 0: 000 & gt; ?? @AP unsigned int 0x401000 0: 000 & gt; LSA 0,1> 8: Maikls :: Set_vl (INT x, INT y) zero {0: 000 & gt; The DV = 0xfffffffe x = 0n7 y = 0n5
Comments
Post a Comment