Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gdb split view with code

Tags:

gdb

It's called the TUI (no kidding). Start for example with gdbtui or gdb -tui ...


Please also see this answer by Ciro Santilli. It wasn't available in 2012 to the best of my knowledge, but definitely worth a look.


You can trigger it dynamically by push ctrl+x and ctrl+a.


There are two variants of it.

  1. to only see code Press

Press CTRL X together and then 1

  1. To see both source and assembly

Press 'CTRL' 'X' together and then '2'

http://www.cs.fsu.edu/~baker/ada/gnat/html/gdb_23.html

A screen shot of the view with code and assembly. enter image description here

Also check out this amazing Github project.


GDB Dashboard

https://github.com/cyrus-and/gdb-dashboard

GDB dashboard uses the official GDB Python API and prints the information that you want when GDB stops e.g. after a next, like the native display command.

Vs TUI:

  • more robust, as it just prints to stdout instead of putting the shell on a more magic curses state, e.g.:

    • vi mode in .inputrc causes problems: https://superuser.com/questions/180512/how-to-turn-off-gdb-tui/927728#927728
    • program stdout / stderr breaks your interface: GDB in TUI mode: how to deal with stderr's interaction with the ui
  • highly configurable from Python: you can select what you want to output and how big each section is depending on what you are debugging.

    The most useful views are already implemented: source, assembly, registers, stack, memory, threads, expressions... but it should be easy to extend it with any information that is exposed on the GDB Python API.

    TUI only allows showing two of source, assembly and registers and that is it. Unless you want to modify it's C source code of course ;-)

enter image description here

I believe that GDB should ship with a setup like that out of the box and turned on by default, it would attract much more users that way.

Oh, and the main developer, Andrea Cardaci, has been very responsive and awesome. Big kudos.

See also: How to highlight and color gdb output during interactive debugging?


You can also start it from the gdb shell using the command "-" (dash). Not sure how to dynamically turn it off though.