Is there any enhanced gdb console for Eclipse? - c++

Currently the gdb console of Eclipse just connects the stdin/stdout between the java gui and the underlying gdb process, hence many gdb shell features are missing, e.g. tab-autocomplete, command history etc.
I want to know if there is an enhanced console for fast gdb interacting. I really like the frequently used gdb commands like "print" and "call" etc. IMHO, "print" command is superiors sometimes than Eclipse "Expression watcher" because it only execute once and the later will be evaluated any time and be crash-prone.
If you think there is no need to use gdb console, then what's you best-practise in terms of gdb UI to eclipse UI transfer.

There doesn't seem to be any gdb-specific plugin, beside the initial gdb integration initiated with Eclipse3.4.
And the current list of gdb bugs doesn't include your missing features.

If you're writing c/++, why not just find the eclipse-generated elf and use gdb via the shell?

Related

Pass gdb commands on command-line

This answer describes how you can manipulate the debugging environment when running gdb interactively. The specific suggestion is to use the following command aid in catching a Heisenbug.
(gdb) set disable-randomization off
However, when using gdb from the command-line, you lose a lot of amenities that you would have with a graphical debugging front end (such as nemiver or kdbg). I am using kdbg, which allows me to specify a command-line for use when invoking gdb. Is there a command-line argument that achieves the same results as the interactive command shown above?

Debugging C/C++ code with IPython

Say I am in IPython (e.g. on the new QT console), and that I call a C++ library that I wrote from it (e.g. using SWIG or Boost.Python). I would like to set a breakpoint in my C++ code and have the ability to interact with my C++ workspace (i.e. my variables when I hit the breakpoint) with IPython (e.g. plot my C++ variables, etc.).
In other words I would like to debug my C++ code from IPython. Is this at all possible? What are some tools I can use for this?
(assuming you are on Linux)
You just need gdb. First set up configuration telling gdb where your source files are by adding this to $HOME/.gdbinit:
directory absolute-path-to-source
Now start gdb python and on the gdb prompt do:
set args /usr/bin/ipython
run
You can't directly do gdb ipython because ipython is a script. Please refer to the gdb documentation from here on.
In general, you won't be able to debug C++ code directly with IPython. What you can do, though, is use a C++ debugger to debug your C++ code.
Essentially, you tell your C++ debugger to execute whatever process you need to use to run your code (this could be IPython itself), and set a breakpoint in your C++ code (your debugger will know to wait for the appropriate DLL to be loaded if it's in a DLL). From there, you are debugging your part of the code that is running in the IPython process.

How can I enter commands to a gdb prompt while debugging with Eclipse CDT?

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.)
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).
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.

How to run and debug C++ application in Eclipse that's started with a script?

I'm trying to use Eclipse CDT on Ubuntu for C++ development. I'm working on a large C++ project that leverages Tcl as a scripting language to kick off and control the application.
How can I configure Eclipse to launch the application using shell scripts rather than using a C++ "main" application? The shell scripts launch a Tcl application that in turn calls into the C++ application.
Also, is it possible to debug a C++ application using Eclipse and gdb that's started via a script? If so, how does one go about doing it?
Interesting question. Without being able to provide you a straight solution, but Eclipse (gdb) can be attached to a running program - that may not help in your case.
What about trying to employ some kind of remote debugging? I.e. you start your program with gdb and configure gdb to wait for a remote debugger to attach? The 'remote' debugger will be on your local system, of course.
EDIT:
Start your program via
gdbserver localhost:1234 <executable>
Configure your debug session in Eclipse:
- GDB Hardware Debugging
- I had to select the "Standard GDB Hardware debugging launcher" (Debugger tab at the bottom for Helios)
- Check use remote target: Generic TCP/IP: localhost, port 1234
I didn't manage to resolve symbols yet, that might be a path issue.

How to do remote debugging with Eclipse CDT without gdbserver?

We're using the Eclipse CDT 5 C++ IDE on Windows to develop a C++ application on a remote AIX host.
Eclipse CDT has the ability to perform remote debugging using gdbserver. Unfortunately, gdbserver is not supported on AIX.
Is anyone familiar with a way to debug remotely using Eclipse CDT without gdbserver? Perhaps using an SSH shell connection to gdb?
finally I got gdb run remotly anyhow now. At the Bug-symbol on the taskbar I took Debug Configurations - GDB Hardware Debugging.
In Main C/C++ Applications I set the full path on the Samba share of the executable (X:\abin\vlmi9506). I also set a linked folder on X:\abin in the project. Then I modified my batch-script in GDB Setup. It's not directly calling gdb in the plink-session but a unix-shell-script, which opens gdb. By this I have the possibility to set some unix environment-variables for the program before doing debug. The call in my batch:
plink.exe prevoax1 -l suttera -pw XXXXX -i /proj/user/dev/suttera/vl/9506/test/vlmi9506ddd.run 20155 dev o m
In the unix script I started gdb with the command line params from eclipse, that I found in my former tryals. The call in the shell command looks like this:
gdb -nw -i mi -cd=$LVarPathExec $LVarPathExec/vlmi9506
Then IBM just gives gdb 6.0 for AIX. I found version 6.8 in the net at http://www.perzl.org/aix/index.php?n=Main.Gdb. Our Admin installed it.
I can now step through the program and watch variables. I even can write gdb-commands directly in the console-view. yabadabadooooooo
Hope that helps to others as well. Can not tell, what was really the winner-action.
But each answer gives more new questions. Now I got 3 of them.
When I start the debug config I have to click restart in the toolbar to come really in the main procedure. Is it possible to come directly in main without restarting?
On AIX our programs are first preprocessed for embedded sql. The preprocessed c-source is put in another directory. When I duble-click the line to set a breakpoint, I get the warning "unresolved breakpoint" and in the gdb-console I see, that the break is set to the preprocessed source which is wrong. Is it possible to set the breakpoints on the right source?
We are using CICS on AIX. With the xldb-Debugger and the CDCN-command of CICS we manage that debugging is started, when we come in our programs. Is it possible to get that remotely (in plink) with gdb-eclipse as well?
I wouldn't normally take a shot in the dark on a question I can't really test the answer to, but since this one has sat around for a day, I'll give it a shot. It seems from looking at:
http://wiki.eclipse.org/TM_and_RSE_FAQ#How_can_I_do_Remote_Debugging_with_CDT.3F
...that even if the CDT has changed since that wiki page was made, you should still be able to change the debug command to:
ssh remotehost gdb
instead of using TM which uses gdbserver. This will probably be slightly slower than the TM remote debugging since that actually uses a local gdb, but on the other hand this way you won't have to NFS or SMB mount your source code to make it available to the local debugger (and if you're on a LAN it probably won't matter anyhow).
There's also a reference TCF implementation for linux, which you may or may not have any luck recompiling for AIX, but it allows for remote debugging if gdbserver is otherwise not available:
http://wiki.eclipse.org/DSDP/TM/TCF_FAQ
tried also to remotly debug an aix-appl with windows eclipse-cdt-gdb.
Got blocked at the end with unix/windows path-problems. Maybe my result can help u a little further - maybe you already got it work. I'm interested in your comment. asked on eclipse news portal- following the answer of martin oberhuber (thanks again) tried dsp dd (also blocked with path problem) and set an request in eclipse bugzilla.
here the link to news:
http://www.eclipse.org/newsportal/article.php?id=406&group=eclipse.dsdp.tm
Here my bugzilla:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=252758
At the moment we still debug localy with xldb but I am trying ddd-gdb at the moment. At least locally gdb is running.