前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Host Shell的gdb模式

Host Shell的gdb模式

作者头像
Taishan3721
发布2021-01-08 15:39:32
6680
发布2021-01-08 15:39:32
举报
文章被收录于专栏:这里只有VxWorks这里只有VxWorks

Host Shell集成了四种解释器,其中一个叫gdb。gdb者,gnu之debugger也。

gdb里提供了大量的命令,例如可以查看线程(Task)信息

更多的是用于debug

完整命令集如下

代码语言:javascript
复制

(gdb) 
List of classes of commands: 
aliases -- Aliases of other commands 
breakpoints -- Making program stop at certain points 
data -- Examining data 
files -- Specifying and examining files 
internals -- Maintenance commands 
obscure -- Obscure features 
ocd -- On-Chip Debugging facilities 
running -- Running the program 
stack -- Examining the stack 
status -- Status inquiries 
support -- Support facilities 
tracepoints -- Tracing of program execution without stopping the program 
user-defined -- User-defined commands 
Type "help" followed by a class name for a list of commands in that class. 
Type "help" followed by command name for full documentation. 
Command name abbreviations are allowed if unambiguous.

(gdb) help aliases
Aliases of other commands.
List of commands:
! -> shell -- Execute the rest of the line as a shell command
b -> break -- Set breakpoint at specified line or function
bt -> backtrace -- Print backtrace of all stack frames
c -> continue -- Continue program being debugged
dis -> disable -- Disable some breakpoints
f -> frame -- Select and print a stack frame
h -> show commands -- Show the history of commands you typed
halt -> interrupt -- Interrupt the execution of the debugged program
i -> info -- Generic command for showing things about the program being debugged
i r -> info registers -- List of integer registers and their contents
inspect -> print -- Print value of expression EXP
k -> kill -- Kill execution of program being debugged
l -> list -- List specified function or line
ls -> shell ls
mi -> interpreter-exec mi
n -> next -- Step program
ni -> nexti -- Step one instruction
p -> print -- Print value of expression EXP
p* -> print* -- Print value of dereferencing expression EXP
r -> run -- Start debugged program
rc -> rcontinue -- Reverse continue program being debugged
rn -> rnext -- Reverse step program
rni -> rnexti -- Reverse step one instruction
rs -> rstep -- Reverse step program until it reaches a different source line
rsi -> rstepi -- Reverse step one instruction exactly
s -> step -- Step program until it reaches a different source line
si -> stepi -- Step one instruction exactly
t -> tbreak -- Set a temporary breakpoint
where -> backtrace -- Print backtrace of all stack frames

(gdb) help breakpoints
Making program stop at certain points.
List of commands:
break -- Set breakpoint at specified line or function
clear -- Clear breakpoint at specified line or function
commands -- Set commands to be executed when a breakpoint is hit
condition -- Specify breakpoint number N to break only if COND is true
delete -- Delete some breakpoints or auto-display expressions
delete breakpoints -- Delete some breakpoints or auto-display expressions
delete commands -- Delete commands to be executed when a breakpoint is hit
disable -- Disable some breakpoints
disable breakpoints -- Disable some breakpoints
disable commands -- Disable commands to be executed when a breakpoint is hit
dprintf -- Set dynamic printf eventpoint at specified line or function
enable -- Enable some breakpoints
enable commands -- Enable commands to be executed when a breakpoint is hit
enable delete -- Enable breakpoints and delete when hit
enable keep -- Enable breakpoints until you command otherwise
enable once -- Enable breakpoints for one hit
hbreak -- Set a hardware assisted  breakpoint
hdprintf -- Set a hardware dynamic printf eventpoint
ignore -- Set ignore-count of breakpoint number N to COUNT
tbreak -- Set a temporary breakpoint
unset -- Delete some breakpoints or auto-display expressions

(gdb) help data
Examining data.
List of commands:
call -- Call a function in the program
delete display -- Cancel some expressions to be displayed when program stops
disable display -- Disable some expressions to be displayed when program stops
disassemble -- Disassemble a specified section of memory
display -- Print value of expression EXP each time the program stops
enable display -- Enable some expressions to be displayed when program stops
output -- Like "print" but don't put in value history and don't print newline
print -- Print value of expression EXP
print* -- Print value of dereferencing expression EXP
printf -- Write formatted output
set -- Evaluate expression EXP and assign result to variable VAR
set annotate -- Set the annotation level
set args -- Set argument list to give program being debugged when it is started
set breakpoint -- "set breakpoint" must be followed by the name of a breakpoint subcommand
set config -- Set host shell configuration variables or print them if no argument 
set confirm -- Set whether to confirm potentially dangerous operations
set debug-file-directory -- Set the directories where separate debug symbols are searched for
set emacs -- Enable gdb integration into emacs
set environment -- Set environment variable value to give the program
set funccall -- Set state of function call support in 'set' and 'print' commands
set height -- Set number of lines gdb thinks are in a page
set history -- Generic command for setting command history parameters
set max-user-call-depth -- Set the max call depth for user-defined commands
set mi -- Switch to GDB/MI mode
set pagination -- Set state of pagination
set print -- Generic command for setting how things print
set repeat-last-command -- Enable or disable the repetition of the last command when the user 
set srcpathmapping -- Source path mapping allows you to map source file paths that the debugger 
set tgtpathmapping -- Set the target path mapping variable
set variable -- Evaluate expression EXP and assign result to variable VAR
set width -- Set number of characters gdb thinks are in a line
undisplay -- Cancel some expressions to be displayed when program stops
x -- Examine memory: x/FMT ADDRESS

(gdb) help files
Specifying and examining files.
List of commands:
add-symbol-file -- Load the symbols from FILE
cd -- Set working directory to DIR for debugger and program being debugged
directory -- Add directory DIR to beginning of search path for source files
exec-file -- Use FILE as program for getting contents of pure memory
file -- Use FILE as program to be debugged
list -- List specified function or line
load -- Dynamically load FILE into the running program
path -- Add directory DIR(s) to beginning of search path for object files
pwd -- Print working directory
symbol-file -- Load symbol table from executable file FILE
unload -- Unload module from the target

(gdb) help obscure
Obscure features.
List of commands:
? -- Interpreter switch
C -- Interpreter switch
cmd -- Interpreter switch
complete -- List the completions for the rest of the line as a command
gdb -- Interpreter switch
shEval -- Interpreter switch
tcl -- Interpreter switch

(gdb) help ocd
On-Chip Debugging facilities.
List of commands:
wrsdeftarget -- Define a new target connection
wrsdownload -- Download to target memory or flash
wrsmemmap -- Define a target memory map in the debugger backend
wrspassthru -- Pass commands directly to the firmware without interpretation
wrsplayback -- Play a file of commands directly to the firmware
wrsregquery -- Query the Wind River registry to list target definitions
wrsreset -- Reset one or more cores on the target
wrstargetdisconnect -- Disconnect from a target
wrsupload -- Upload data from target memory

(gdb) help running
Running the program.
List of commands:
attach -- Attach to a process or file outside of GDB
attach kernel -- Attach to kernel container (task mode)
attach system -- Attach to kernel container and switch to system mode
continue -- Continue program being debugged
detach -- Detach a process or file previously attached
finish -- Execute until selected stack frame returns
handle -- Specify how to handle a signal
interrupt -- Interrupt the execution of the debugged program
jump -- Continue program being debugged at specified line or address
kill -- Kill execution of program being debugged
next -- Step program
nexti -- Step one instruction
rcontinue -- Reverse continue program being debugged
reboot -- Reboot the target
rfinish -- Reverse execute until selected stack frame returns
rnext -- Reverse step program
rnexti -- Reverse step one instruction
rstep -- Reverse step program until it reaches a different source line
rstepi -- Reverse step one instruction exactly
run -- Start debugged program
set core -- Select the current core
set system -- Set the subsystem to debug
show cores -- Show core(s) list of the system
show systems -- Show subsystems running on target
signal -- Continue program giving it signal specified by the argument
spawn -- Spawn a vxWorks kernel task
step -- Step program until it reaches a different source line
stepi -- Step one instruction exactly
thread -- Use this command to switch between threads
until -- Execute until the program reaches a source line greater than the current 

(gdb) help stack
Examining the stack. 
The stack is made up of stack frames. Gdb assigns numbers to stack frames 
counting from zero for the innermost (currently executing) frame. 
At any time gdb identifies one frame as the "selected" frame. 
Variable lookups are done with respect to the selected frame. 
When the program being debugged stops, gdb selects the innermost frame. 
The commands below can be used to select other frames by number or address.
List of commands:
backtrace -- Print backtrace of all stack frames
down -- Select and print stack frame called by this one
frame -- Select and print a stack frame
up -- Select and print stack frame that called this one

(gdb) help status
Status inquiries.
List of commands:
info -- Generic command for showing things about the program being debugged
info all-registers -- List of all registers and their contents
info args -- Argument variables of current stack frame
info breakpoints -- Status of user-settable breakpoints
info commands -- Commands to be executed when a breakpoint is hit
info display -- Expressions to display when program stops
info extensions -- All filename extensions associated with a source language
info frame -- All about selected stack frame
info functions -- All function names
info handle -- What debugger does when program gets various signals
info locals -- Local variables of current stack frame
info modules -- This command displays the kernel modules loaded on the target
info proc -- Show information about any running process
info registers -- List of integer registers and their contents
info source -- Information about the current source file
info sources -- Source files in the program
info stack -- Print backtrace of all stack frames
info symbol -- Describe what symbol is at location ADDR
info system -- Describe in which debug mode the target is running
info target -- Names of targets and files being debugged
info threads -- IDs of currently known threads
info variables -- All global and static variable names
info warranty -- Various kinds of warranty you do not have
info watchpoints -- Synonym for "info breakpoints"
show -- Generic command for showing things about the debugger
show annotate -- Show annotation_level
show args -- Show argument list to give program being debugged when it is started
show breakpoint -- Breakpoint specific settings 
show commands -- Show the history of commands you typed
show config -- Show host shell configuration variables
show confirm -- Show whether to confirm potentially dangerous operations
show convenience -- Debugger convenience ("$foo") variables
show debug-file-directory -- Show the directories where separate debug symbols are searched for
show directories -- Current search path for finding source files
show environment -- The environment to give the program
show funccall -- Show state of funccall (function call)
show height -- Show number of lines gdb thinks are in a page
show history -- Generic command for showing command history parameters
show max-user-call-depth -- Show the max call depth for user-defined commands
show pagination -- Show state of pagination
show paths -- Current search path for finding object files
show print -- Generic command for showing print settings
show repeat-last-command -- Show state of the repeat-last-command flag
show srcpathmapping -- Show the current source path mapping
show tgtpathmapping -- Show the current target path mapping
show user -- Show definitions of user defined commands
show values -- Elements of value history around item number IDX (or last ten)
show version -- Show what version of host shell this is
show warranty -- Various kinds of warranty you do not have

(gdb) help support
Support facilities.
List of commands:
apropos -- Search for commands matching a REGEXP
define -- Define a new command name
document -- Document a user-defined command
dont-repeat -- Don't repeat this command
echo -- Print a constant string
end -- Ends a list of commands or actions
help -- Print list of commands
if -- Execute nested commands once IF the conditional expression is non zero
interpreter-exec -- Execute a command in an interpreter
loop_break -- This command exits the `while' loop in whose body it is included
loop_continue -- This command skips the execution of the rest of the body of
quit -- Exit gdb
shell -- Execute the rest of the line as a shell command
source -- Read commands from a file named FILE
while -- Execute nested commands WHILE the conditional expression is non zero

我是泰山 专注VX 0x10年

一起学习 共同进步

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2020-12-28,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 这里只有VxWorks 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档