4

Is there a way to tell GDB to break right after a given function has returned?

Randomblue
  • 112,777
  • 145
  • 353
  • 547
  • You should not create a second question for an issue you're already covering, especially just 5 minutes after the first one. It's preferrable that you edit your previous question to include additional details about your situation. – zneak May 08 '12 at 15:21

2 Answers2

2

If you're about to execute the function, n[ext]. If you're inside, fin[ish] will stop when it returns and show the return value.

Kevin
  • 53,822
  • 15
  • 101
  • 132
  • Thanks. But this [does not work for my use case](http://stackoverflow.com/questions/10501121/gdb-script-not-working-as-expected). – Randomblue May 08 '12 at 15:12
  • If it does not work for your use case, then the problem here is that you asked a new question with no information about your use case instead of following up on your existing question. – R.. GitHub STOP HELPING ICE May 08 '12 at 16:24
1

You can add a breakpoint to the function then finish to step out.

zneak
  • 134,922
  • 42
  • 253
  • 328
  • Thanks. But this [does not work for my use case](http://stackoverflow.com/questions/10501121/gdb-script-not-working-as-expected). – Randomblue May 08 '12 at 15:11