Jdb-basic-commands
提供:Dev Guides
JDB-基本コマンド
この章では、JDBの基本的なコマンドについて説明します。 セッションの起動後、これらのコマンドはプログラムのデバッグに使用されます。
以下は、デバッグに使用されるコマンドのリストです。
Name | Description |
---|---|
help or ? | The most important *JDB *command; it displays a list of recognized commands with a brief description. |
run | After starting* JDB* and setting the necessary breakpoints, you can use this command to start execution and debug an application. |
cont | Continues execution of the debugged application after a breakpoint, exception, or step. |
Displays Java objects and primitive values. | |
dump | For primitive values, this command is identical to print. For objects, it prints the current value of each field defined in the object. Static and instance fields are included. |
threads | Lists the threads that are currently running. |
thread | Selects a thread to be the current thread. |
where | Dumps the stack of the current thread. |
例
次の例の Add というサンプルクラスがあると仮定します。
Add.java
次のコマンドを使用して、このクラスAdd.javaをコンパイルします。
Run
このコマンドは、デバッグのためにJDBに追加されるメインクラスファイルを実行します。 次のコマンドを実行して、Addクラスを実行します。
これらのコマンドを実行すると、次の出力が表示されます。