简体   繁体   中英

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.

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM