gdb tui

相关命令:

 

22. GDB Text User Interface

22.1 TUI Overview  TUI overview
22.2 TUI Key Bindings  TUI key bindings
22.3 TUI Single Key Mode  TUI single key mode
22.4 TUI-specific Commands  TUI-specific commands
22.5 TUI Configuration Variables  TUI configuration variables

The GDB Text User Interface (TUI) is a terminal interface which uses the curses library to show the source file, the assembly output, the program registers and GDB commands in separate text windows. The TUI mode is supported only on platforms where a suitable version of the curses library is available.

The TUI mode is enabled by default when you invoke GDB as either `gdbtui' or `gdb -tui'. You can also switch in and out of TUI mode while GDB runs by using various TUI commands and key bindings, such as C-x C-a. See section TUI Key Bindings.


[ < ][ > ] [ << ][ Up ][ >> ]    [Top][Contents][Index][ ? ]

22.1 TUI Overview

In TUI mode, GDB can display several text windows:

command  --------> kuike: window's name in command is cmd
This window is the GDB command window with the GDB prompt and the GDB output. The GDB input is still managed using readline.
source
 -------->src
The source window shows the source file of the program. The current line and active breakpoints are displayed in this window.
assembly -------->asm
The assembly window shows the disassembly output of the program.
register  -------->regs
This window shows the processor registers. Registers are highlighted when their values change.

The source and assembly windows show the current program position by highlighting the current line and marking it with a `>' marker. Breakpoints are indicated with two markers. The first marker indicates the breakpoint type:

B
Breakpoint which was hit at least once.
b
Breakpoint which was never hit.
H
Hardware breakpoint which was hit at least once.
h
Hardware breakpoint which was never hit.

The second marker indicates whether the breakpoint is enabled or not:

+
Breakpoint is enabled.
-
Breakpoint is disabled.

The source, assembly and register windows are updated when the current thread changes, when the frame changes, or when the program counter changes.

These windows are not all visible at the same time. The command window is always visible. The others can be arranged in several layouts:

  • source only,
  • assembly only,
  • source and assembly,
  • source and registers, or
  • assembly and registers.

A status line above the command window shows the following information:

target
Indicates the current GDB target. (see section  Specifying a Debugging Target).
process
Gives the current process or thread number. When no process is being debugged, this field is set to  No process.
function
Gives the current function name for the selected frame. The name is demangled if demangling is turned on (see section  8.7 Print Settings). When there is no symbol corresponding to the current program counter, the string  ?? is displayed.
line
Indicates the current line number for the selected frame. When the current line number is not known, the string  ?? is displayed.
pc
Indicates the current program counter address.


[ < ][ > ] [ << ][ Up ][ >> ]    [Top][Contents][Index][ ? ]

22.2 TUI Key Bindings

The TUI installs several key bindings in the readline keymaps (see section 27. Command Line Editing). The following key bindings are installed for both TUI mode and the GDB standard mode.

C-x C-a   ----->Kuike: C means Ctrl, so C-x means Ctrl+x
C-x a
C-x A
Enter or leave the TUI mode. When leaving the TUI mode, the curses window management stops and GDB operates using its standard mode, writing on the terminal directly. When reentering the TUI mode, control is given back to the curses windows. The screen is then refreshed.
--->kuike: gdb command win  also can enter TUI mode 

C-x 1
Use a TUI layout with only one window. The layout will either be  `source' or  `assembly'. When the TUI mode is not active, it will switch to the TUI mode.

Think of this key binding as the Emacs C-x 1 binding.

C-x 2
Use a TUI layout with at least two windows. When the current layout already has two windows, the next layout with two windows is used. When a new layout is chosen, one window will always be common to the previous layout and the new one.

Think of it as the Emacs C-x 2 binding.

C-x o
Change the active window. The TUI associates several key bindings (like scrolling and arrow keys) with the active window. This command gives the focus to the next TUI window.

Think of it as the Emacs C-x o binding.

C-x s
Switch in and out of the TUI SingleKey mode that binds single keys to GDB commands (see section  22.3 TUI Single Key Mode).

The following key bindings only work in the TUI mode:

PgUp
Scroll the active window one page up.

PgDn
Scroll the active window one page down.

Up
Scroll the active window one line up.

Down
Scroll the active window one line down.

Left
Scroll the active window one column left.

Right
Scroll the active window one column right.

C-L
Refresh the screen.

Because the arrow keys scroll the active window in the TUI mode, they are not available for their normal use by readline unless the command window has the focus. When another window is active, you must use other readline key bindings such as C-pC-nC-b and C-f to control the command window.


[ < ][ > ] [ << ][ Up ][ >> ]    [Top][Contents][Index][ ? ]

22.3 TUI Single Key Mode

The TUI also provides a SingleKey mode, which binds several frequently used GDB commands to single keys. Type C-x s to switch into this mode, where the following key bindings are used:

c
continue

d
down

f
finish

n
next

q
exit the SingleKey mode.

r
run

s
step

u
up

v
info locals

w
where

Other keys temporarily switch to the GDB command prompt. The key that was pressed is inserted in the editing buffer so that it is possible to type most GDB commands without interaction with the TUI SingleKey mode. Once the command is entered the TUI SingleKey mode is restored. The only way to permanently leave this mode is by typing q or C-x s.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值