Reputation: 9519
I'm using Eclipse (Helios SR1) CDT for my C++ development. Eclipse interfaces with GDB for debugging, but I can't figure out how to manually enter commands to GDB while debugging through the Eclipse interface. For example, it would be nice to be able to enter p myVar
instead of having to click and scroll through the local variables window.
Note: The only reason I'd like to use the Eclipse interface for debugging is because I like how it shows the code that is being stepped through. So if anyone has an alternative to suggest that would allow me to view the code that's being stepped through, please suggest! (I've used DDD, but I don't especially like it.)
Upvotes: 19
Views: 9792
Reputation: 9476
It is actually very simple.
Start debugging (eclipse will switch to Debug Perspective). Then make sure Console View is shown. If it's not show it (Window->Show view...). In that view you will find "Display selected console" icon. Select down arrow next to it an select console named "gdb" (not gdb traces!).
What you enter in this console is forwarded directly to gdb (you can use all gdb commands).
Upvotes: 23
Reputation: 9173
If you are not debugging under Windows, you could try the gdb TUI. It's a little awkward to get used to, and is sometimes buggy, but in general it works fairly well. You can see the code being stepped through in one window while still being able to enter commands.
Assuming your version of gdb was built with the --enable-tui
configure option, simply fire up gdb and press C-x C-a
to enter the TUI. Then, to make sure you can see the code and command windows, press C-x 2
(for two-window layout)
It's been a while since I've had to use the TUI, but it should work for your requirements.
Upvotes: 3