How do you debug c / c ++ source code in linux using emacs?

I use emacs and autotools to write and compile c / C ++ sources in linux.
I am using gdb via GUD in emacs.
I have defined for convenience: F7: compilation, F10: gud-next, F11: gud-step, F5: gud-cont, F9: gud-tbreak, F8: gud-until, F4: gud-print.
I'm mostly interested in debugging linux c / c ++ source code from emacs, and I would like to get the maximum gdb. Unfortunately, I only use F4, which prints the variable under the cursor.

So my question is: how do you guys debug the source code?
What programs do you use?
What key bindings (functionality) do you use mostly?
What do you need a debugger to do for you?
If you do strange things, it does not matter. I would like to know everything in order to slightly increase the speed.
Thanks in advance. Mihai

+3
source share
5 answers

You will get the most out of gdbusing the command line instead of key bindings. The most useful commands I use are:

  • bt- prints the return line; It’s useful to know the full context of where you are.
  • s, n, cont - , ,
  • run -
  • watch - ; .
  • call -
  • display - , .
+2

M-x gdb... , gdb.

+3

C-x SPC , gdb ,

+2

valgrind . , .

gdb , , - gui, ddd Eclipse (, gdb Eclipse, ).

+1
source

I use only a debugger to get backtracking by segmentation error. For everything else, I use printf debugging.

0
source

Source: https://habr.com/ru/post/1740296/


All Articles