I'm checking out a segfault in one of our apps. A short time after starting the app, the main gdb
status bar changes to:
(Debugger:run [signal-received])
A (gdb)
prompt appears but the contents of all other windows remain unchanged (empty). Typing anything at the prompt does nothing - gdb
appears to be hanging. Running the same steps on the command line
results in the expected output from gdb
with a complete and correct backtrace.
This is my first time debugging with the -i=mi
integration between emacs
and gdb
. I'm using emacs
24.2 and gdb
7.5.
Are there any suggestions on how I can debug this further?
Is it possible to reduce the level of integration? Would that allow me to determine which area is causing the problem?
A final point is that the initial loading of the app takes around 70s compared with around 3s from the command line
.
You need to help gdbgui out by typing main into the file browser box: and selecting the main.rs file. The source code should then appear in the browser and you can click to set breakpoints and run the program. Of course, if you want to break in some other file, you can find that in the file browser instead.
GDB (GNU debugger) can pause the execution of a running program and let you examine/take control of its memory. It's probably one of the most powerful tools that can help you nail down the exact cause of a problem with your program.
gdb will stop your program at whatever line it has just executed. From here you can examine variables and move through your program.
Load time can be reduced by setting gdb-create-source-file-list
to nil
(use customize). See the documentation for what this does and why it substantially increases load times in some instances.
You can use M-x gud-gdb
to use the old gud mode (i.e. without the mi
interaction). Less fancy but more reliable.
It appears that gdb-ui
from emacs 23 will still work in emacs 24:
gdb-ui
(In my case gdb-ui.el.gz
and gdb-ui.elc
from a backup)~/emacs-modes
)Then add the following to your .emacs:
(add-to-list 'load-path "~/emacs-modes")
(require 'gdb-ui)
Running gdb
will now use the old --annotate=3
mode rather than -i=mi
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With