There are 3 functions: f1, f2, f3:
void f1()
{
f3();
}
void f2()
{
f3();
}
void f3()
{
....
}
I want to put a breakpoint somewhere inside f3, but only if f3 was called from f1.
There are 3 functions: f1, f2, f3:
void f1()
{
f3();
}
void f2()
{
f3();
}
void f3()
{
....
}
I want to put a breakpoint somewhere inside f3, but only if f3 was called from f1.
A solution among others consists of setting a conditional breakpoint. the call of f3 is identified by int boolean
code:
#include <stdio.h>
int boolean =0;
void f3()
{
}
void f2()
{
boolean = 1;
f3();
}
void f1()
{
boolean = 0;
f3();
}
int main()
{
f2();
f1();
f2();
f1();
return 0;
}
In gdb to set a break in f3 only if you come from f2
(gdb)b f3 if boolean==1