Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the commands at gdb console? [closed]

Xcode 4. So I can do p something to print a variable. What else I can do?

like image 516
user4951 Avatar asked May 03 '11 14:05

user4951


People also ask

How do I end a GDB session?

To exit GDB, use the quit command (abbreviated q ), or type an end-of-file character (usually C-d ). If you do not supply expression , GDB will terminate normally; otherwise it will terminate using the result of expression as the error code.

Which command in GDB stops execution?

To stop your program while it is running, type "(ctrl) + c" (hold down the ctrl key and press c). gdb will stop your program at whatever line it has just executed. From here you can examine variables and move through your program.

How can I see all functions in GDB?

If specified, the info functions command will list the functions matching the regex. If omitted, the command wil list all functions in all loaded modules (main program and shared libraries).


1 Answers

Because you obviously don't want anything complete but only some pointers, you can

  • list: list the lines around current position
  • list -: list lines before that
  • just enter: do the same thing again
  • cont: continue
  • break 'Class::method()': set a breakpoint
  • run: run the program from the start
  • start: run and stop in main()
  • kill: kill the running program
  • fin: continue until the function returns
  • up/down: go up/down one stack frame
  • bt: get the backtrace
  • t a a bt (thread apply all bt): get a backtrace for all threads
  • step: run until different code line (descending into functions)
  • next: run until different code line (skipping over functions)
  • commands: set automatic actions on breakpoints
  • en/dis/del: enable/disable/delete breakpoints
  • catch throw: enable breaking when an exception is thrown
  • return <value>: force the function to return now and return <value>
  • set pagination off: disable --- More --- prompt
  • set history save on
  • set history filename /home/<user>/.gdb_history (both of those at best in /home/<user>/.gdbinit)
  • ... and ... help: get help about any gdb command

So far my random collection.

like image 177
Tilman Vogel Avatar answered Sep 23 '22 09:09

Tilman Vogel