paseena
paseena

Reputation: 4315

How to set a breakpoint in gdb for all invocations of a function?

I have a third part library function call scattered at a lot of places in my executable. My executable is built using debug symbols, but the third party library does not have the debug symbols, hence I cannot place a breakpoint on the function. I want to put a breakpoint whenever the library function is called, to examine the call stack. How can I set a breakpoint at all invocations of a library function call within my executable.

Upvotes: 5

Views: 234

Answers (1)

Adam Sznajder
Adam Sznajder

Reputation: 9216

I think that the only way is to:

  • find any call of this function in your code;
  • create a breakpoint in that line;
  • run the debugger and stop there;
  • write in gdb nexti to get to the first function instruction;
  • get current eip which will point at the beginning of that function;
  • create a new breakpoint at the address pointed by eip;

Upvotes: 4

Related Questions