merlin2011
merlin2011

Reputation: 75629

Is there a way to test for whether we are on a breakpoint, using pure gdb scripting?

I am attempting to use this answer to generate an instruction trace between two lines of code.

Unfortunately, the condition in the while loop is a simple count, and I need to keep running the loop until a particular line of code in the source code is reached.

Does there exists a way to check whether we are either on a particular line of code, or at a particular breakpoint, within a pure gdb script?

I am aware of the solution here which uses the Python API. I am also aware of pin-instat, but I want to know whether this can done with pure gdb.

Upvotes: 0

Views: 130

Answers (1)

user184968
user184968

Reputation:

What if do what you want in this way

1) Get information about pc for the line which you would like to reach

Use info line or use disas /m to get information about addresses of the particular line of code.

2) Write the similar loop as in Tracing/profiling instructions

 while $pc != ADDRESS-FROM-FIRST-STEP
   si 
 end. 

This way you will keep running the loop until a particular line of code in the source code is reached

Upvotes: 1

Related Questions