newprint
newprint

Reputation: 7136

Method/Function Breakpoints in Eclipse CDT

I am debugging executable (without source code) that was compiled for debugging. GDB has option to set breakpoints at specific function, like break division()

Is there a way to do the same thing in Eclipse CDT ??? Thanks !

Upvotes: 3

Views: 2791

Answers (2)

Howard Rubin
Howard Rubin

Reputation: 360

Here are two ways to do it:

(1) In the Breakpoints window (Window | Show View | Breakpoints) pick "Add Function Breakpoint" (it's in the dropdown menu). Enter your function name (and any conditions etc) in the Function Breakpoint dialog box.

(2) Open the gdb console (In Eclipse Juno: Window | View | Console. Then from the little TV picture icon, pick "gdb") You can enter arbitrary gdb commands there:

break unlink
Breakpoint 11 at 0x7ffed58b3320

info breakpoints
Num     Type           Disp Enb Address            What
11      breakpoint     keep y   0x00007ffed58b3320 <unlink>

Upvotes: 4

Itamar Katz
Itamar Katz

Reputation: 9645

I am not sure how useful it is for you to debug without the source code, but here is a way to do it.

Assuming you have the executable loaded into an Eclipse project:

  • Go to the Debug perspective, and open the "Debug Configurations" window (you can find it under the "Run" menu).
  • Choose your executable on the left side, and press the "Debugger" tab.
  • Check the 'Stop on startup' checkbox, and in the text field enter the function name.
  • Press the 'Debug' button and your debug session will launch, and stop at function you entered.

EDIT: here is the screen-shot:alt text

Upvotes: 3

Related Questions