gdb split view with code

后端 未结 9 2054
温柔的废话
温柔的废话 2020-11-27 10:02

I was just debugging a program in gdb and somehow I found a new feature I\'ve never seen or even heard of before, a split view where I can see and browse the code in additio

相关标签:
9条回答
  • 2020-11-27 10:50

    tui mode was clearly inspired by emacs -- I discovered it by accident when I hit ^X-o, which switches among split windows in emacs -- I sometimes hit that absent-mindedly when what I should be doing is switching to a different program. Anyway, that leads to another feature not mentioned yet, that you can move the cursor from the code window (where you can scroll) to the command line, or vice versa, with ^X-o.

    0 讨论(0)
  • 2020-11-27 10:51

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

    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?

    0 讨论(0)
  • 2020-11-27 10:52

    When GDB is in the standard mode, using win will automatically switch in the TUI mode.
    Other command for TUI mode:

    • info win
      List and give the size of all displayed windows.
    • focus next | prev | src | asm | regs | split
      Set the focus to the named window. This command allows to change the active window so that scrolling keys can be affected to another window.

    Read here form more help.

    0 讨论(0)
提交回复
热议问题