Hi,
I just merged new experimental feature to Bochs debugger you might find interesting.
The feature is ‘conditional continue’ and the syntax is:
> continue if <expression>
The continue will happen ONLY when expression is evaluated as TRUE.
For this reason new operators >, <, >=, <=, ==, != were added to the expression evaluation.
So now you could set a breakpoint in the beginning of function and write rc script which looks like:
Set breakpoint
- c ; reach bp
- c if rax < 10 ; actually it turns bp to conditional, do nothing if condition is false
- c if rax < 10 ; actually it turns bp to conditional, do nothing if condition is false
- c if rax < 10 ; actually it turns bp to conditional, do nothing if condition is false
- c if rax < 10 ; actually it turns bp to conditional, do nothing if condition is false
- c if rax < 10 ; actually it turns bp to conditional, do nothing if condition is false
- c if rax < 10 ; actually it turns bp to conditional, do nothing if condition is false
- c if rax < 10 ; actually it turns bp to conditional, do nothing if condition is false
- c if rax < 10 ; actually it turns bp to conditional, do nothing if condition is false
… how many false steps are expected ?
At the end you stopped on right break point!
Collecting comments about the extension and ways to improve it, probably apply to other Bochs commands
Thanks,
Stanislav
Bochs debugger new feature: conditional breakpoint
Bochs debugger new feature: conditional breakpoint
Last edited by stlw on Tue Aug 22, 2017 1:02 pm, edited 1 time in total.
-
- Member
- Posts: 223
- Joined: Thu Jul 05, 2007 8:58 am
Re: Bochs debugger new feature: conditional continue
I think a feature like this would be more useful if you could associate it with a specific breakpoint, both so you don't have to type it n times in a script, and also so that it is more useful when doing non-script-assisted debugging. Kind of like how the gdb cond command works. This also solves the problem that these expressions could get quite large if you have multiple breakpoints, and want some subset of them to have conditions.
Re: Bochs debugger new feature: conditional continue
Yes, this would be next step.davidv1992 wrote:I think a feature like this would be more useful if you could associate it with a specific breakpoint, both so you don't have to type it n times in a script, and also so that it is more useful when doing non-script-assisted debugging. Kind of like how the gdb cond command works. This also solves the problem that these expressions could get quite large if you have multiple breakpoints, and want some subset of them to have conditions.
I am still thinking how to hack this into the debugger.
Probably I will have to remember condition as a string together with breakpoint and in case of breakpoint hit 'throw in' into parser the condition and see how it is resolved.
And ignore breakpoint hit if condition is false ...
But for now it is much more complicated for me so I added smth which was trivial to add and can have immediate added value
NEW: Bochs debugger new feature: conditional breakpoint
I implemented conditional breakpoint support in Bochs debugger.
the operation is very simple: when setting instruction breakpoint you also could supply
and the breakpoint will be triggered only if expression is true.
arbitrary expression can be accepted like: EAX > 100 & ECX < 10
Please test and reply if there any problems you may see.
Stanislav
the operation is very simple: when setting instruction breakpoint you also could supply
Code: Select all
lbreak address if "expression"
arbitrary expression can be accepted like: EAX > 100 & ECX < 10
Please test and reply if there any problems you may see.
Stanislav