Reputation: 5371
Here is a function in my program
void
quicksort (int *num, int p, int r, int june)
{
int q, bbc, ccd;
if (p < r)
{
call++;
q = partition (num, p, r, june);//<--I want to skip this call in gdb session
bbc = q - 1 - p + 1;//<-- and want to continue execution step by step from here
quicksort (num, p, q - 1, bbc);
ccd=r-q+1;
quicksort (num, q + 1, r, ccd);
}
} //since it is a recursive function each time quicksort is called partition is also executed I want to focus my debugging only to quicksort
If you notice it calls another function partition in between.While running in a gdb session I want to skip the gdb showing me steps of parition i.e. I know function partition is correct so do what partition does and then jump to next instruction
bbc = q - 1 - p + 1;
and in my debugging session do not show info about partition. So how can I skip that part and continue debugging quicksort.
Upvotes: 2
Views: 1733
Reputation: 231313
You can either set a breakpoint for the line after partition
:
b <line number>
Then use c
to continue until the breakpoint.
Or you can use n
to skip over the partition
call (that is, type n
when you reach the partition
call, and it will skip the body of the function).
Or you can type finish
to exit the partition
function after entering it.
Upvotes: 1
Reputation: 5153
I think you are looking for a step over.
Step Over is the same as Step Into, except that when it reaches a call for another procedure, it will not step into the procedure. The procedure will run, and you will be brought to the next statement in the current procedure.
In GDB, you do this by issuing the next
command.
When you are running the q = partition (num, p, r, june);
line in gdb, type next
and it will just execute the partition function without going into its code in detail.
You can find detailed information about stepping in gdb in this reference.
Upvotes: 3
Reputation: 34587
b <line number>
will set a break point
c
will continue until the next breakpoint.
Upvotes: 2