JDB 调试命令集合 (debug command set)

本文档详细介绍了 JDBdebug 的使用方法,包括如何连接调试器、列出可用的连接器和传输方式、执行应用的主要类、列出线程及堆栈跟踪等。此外还介绍了设置断点、观察字段变化、跟踪方法调用等多种调试技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

JDB debug operators
connectors** list available connectors and transports in this VM
run [class [args]]** start execution of application's main class
threads [threadgroup]** list threads
thread <thread id>** set default thread
suspend [thread id(s)]** suspend threads (default: all)
resume [thread id(s)]** resume threads (default: all)
where [<thread id> | all]** dump a thread's stack
wherei [<thread id> | all]** dump a thread's stack, with pc info
up [n frames]** move up a thread's stack
down [n frames]** move down a thread's stack
kill <thread id> <expr>** kill a thread with the given exception object
interrupt <thread id>** interrupt a thread
print <expr>** print value of expression
dump <expr>** print all object information
eval <expr>** evaluate expression (same as print)
set <lvalue> = <expr>** assign new value to field/variable/array element
locals** print all local variables in current stack frame
classes** list currently known classes
class <class id>** show details of named class
methods <class id>** list a class's methods
fields <class id>** list a class's fields
threadgroups** list threadgroups
threadgroup <name>** set current threadgroup stop in <class id>.<method>[(argument_type,...)]
** set a breakpoint in a method
stop at <class id>:<line>** set a breakpoint at a line
clear <class id>.<method>[(argument_type,...)]** clear a breakpoint in a method
clear <class id>:<line>** clear a breakpoint at a line
clear** list breakpoints
catch [uncaught|caught|all] <class id>|<class pattern>** break when specified exception occurs
ignore [uncaught|caught|all] <class id>|<class pattern>** cancel 'catch' for the specified exception
watch [access|all] <class id>.<field name>** watch access/modifications to a field
unwatch [access|all] <class id>.<field name>** discontinue watching access/modifications to a field
trace [go] methods [thread]** trace method entries and exits.
** All threads are suspended unless 'go' is specified
trace [go] method exit | exits [thread]** trace the current method's exit, or all methods' ex
its** All threads are suspended unless 'go' is specified
untrace [methods]** stop tracing method entrys and/or exits
step** execute current line
step up** execute until the current method returns to its cal
ler
stepi** execute current instruction
next** step one line (step OVER calls)
cont** continue execution from breakpoint
list [line number|method]** print source code
use (or sourcepath) [source file path]** display or change the source path
exclude [<class pattern>, ... | "none"]** do not report step or method events for specified c
lasses
classpath** print classpath info from target VM
monitor <command>** execute command each time the program stops
monitor** list monitors
unmonitor <monitor#>** delete a monitor
read <filename>** read and execute a command file
lock <expr>** print lock info for an object
threadlocks [thread id]** print lock info for a thread
pop** pop the stack through and including the current fra
me
reenter** same as pop, but current frame is reentered
redefine <class id> <class file name>** redefine the code for a class
disablegc <expr>** prevent garbage collection of an object
enablegc <expr>** permit garbage collection of an object
!!** repeat last command
<n> <command>** repeat command n times
# <command>** discard (no-op)
help (or ?)** list commands
version** print version information
exit (or quit)** exit debugger

<class id>: a full class name with package qualifiers

<class pattern>: a class name with a leading or trailing wildcard ('*')

<thread id>: thread number as reported in the 'threads' command

<expr>: a Java(tm) Programming Language expression.

Most common syntax is supported.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值