Finds and fixes bugs in Java platform programs. Synopsis jdb [options] [classname] [arguments] options Command-line options. See Options. classname Name of the main class to debug. arguments Arguments passed to the main() method of the class. Description The Java Debugger (JDB) is a simple command-line debugger for Java classes. The jdb command and its options call the JDB. The jdb command demonstrates the Java Platform Debugger Architecture (JDBA) and provides inspection and debugging of a local or remote Java Virtual Machine (JVM). See Java Platform Debugger Architecture (JDBA) at http://docs.oracle.com/javase/8/docs/technotes/guides/jpda/index.html Start a JDB Session There are many ways to start a JDB session. The most frequently used way is to have JDB launch a new JVM with the main class of the application to be debugged. Do this by substituting the jdb command for the java command in the command line. For example, if your application's main class is MyClass, then use the following command to debug it under JDB: jdb MyClass When started this way, the jdb command calls a second JVM with the specified parameters, loads the specified class, and stops the JVM before executing that class's first instruction. Another way to use the jdb command is by attaching it to a JVM that is already running. Syntax for starting a JVM to which the jdb command attaches when the JVM is running is as follows. This loads in-process debugging libraries and specifies the kind of connection to be made. java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n MyClass You can then attach the jdb command to the JVM with the following command: jdb -attach 8000 The MyClass argument is not specified in the jdb command line in this case because the jdb command is connecting to an existing JVM instead of launching a new JVM. There are many other ways to connect the debugger to a JVM, and all of them are supported by the jdb command. The Java Platform Debugger Architecture has additional documentation on these connection options. Basic jdb Commands The following is a list of the basic jdb commands. The JDB supports other commands that you can list with the -help option. help or ? The help or ? commands display the list of recognized commands with a brief description. run After you start JDB and set breakpoints, you can use the run command to execute the debugged application. The run command is available only when the jdb command starts the debugged application as opposed to attaching to an existing JVM. cont Continues execution of the debugged application after a breakpoint, exception, or step. print Displays Java objects and primitive values. For variables or fields of primitive types, the actual value is printed. For objects, a short description is printed. See the dump command to find out how to get more information about an object. Note: To display local variables, the containing class must have been compiled with the javac -g option. The print command supports many simple Java expressions including those with method invocations, for example: print MyClass.myStaticField print myObj.myInstanceField print i + j + k (i, j, k are primities and either fields or local variables) print myObj.myMethod() (if myMethod returns a non-null) print new java.lang.String("Hello").length() dump For primitive values, the dump command is identical to the print command. For objects, the dump command prints the current value of each field defined in the object. Static and instance fields are included. The dump command supports the same set of expressions as the print command. threads List the threads that are currently running. For each thread, its name and current status are printed and an index that can be used in other commands. In this example, the thread index is 4, the thread is an instance of java.lang.Thread, the thread name is main, and it is currently running. 4. (java.lang.Thread)0x1 main running thread Select a thread to be the current thread. Many jdb commands are based on the setting of the current thread. The thread is specified with the thread index described in the threads command. where The where command with no arguments dumps the stack of the current thread. The where all command dumps the stack of all threads in the current thread group. The where threadindex command dumps the stack of the specified thread. If the current thread is suspended either through an event such as a breakpoint or through the suspend command, then local variables and fields can be displayed with the print and dump commands. The up and down commands select which stack frame is the current stack frame. Breakpoints Breakpoints can be set in JDB at line numbers or at the first instruction of a method, for example: The command stop at MyClass:22 sets a breakpoint at the first instruction for line 22 of the source file containing MyClass. The command stop in java.lang.String.length sets a breakpoint at the beginning of the method java.lang.String.length. The command stop in MyClass.<clinit> uses <clinit> to identify the static initialization code for MyClass. When a method is overloaded, you must also specify its argument types so that the proper method can be selected for a breakpoint. For example, MyClass.myMethod(int,java.lang.String) or MyClass.myMethod(). The clear command removes breakpoints using the following syntax: clear MyClass:45. Using the clear or stop command with no argument displays a list of all breakpoints currently set. The cont command continues execution. Stepping The step command advances execution to the next line whether it is in the current stack frame or a called method. The next command advances execution to the next line in the current stack frame. Exceptions When an exception occurs for which there is not a catch statement anywhere in the throwing thread's call stack, the JVM typically prints an exception trace and exits. When running under JDB, however, control returns to JDB at the offending throw. You can then use the jdb command to diagnose the cause of the exception. Use the catch command to cause the debugged application to stop at other thrown exceptions, for example: catch java.io.FileNotFoundException or catch mypackage.BigTroubleException. Any exception that is an instance of the specified class or subclass stops the application at the point where it is thrown. The ignore command negates the effect of an earlier catch command. The ignore command does not cause the debugged JVM to ignore specific exceptions, but only to ignore the debugger. Options When you use the jdb command instead of the java command on the command line, the jdb command accepts many of the same options as the java command, including -D, -classpath, and -X options. The following list contains additional options that are accepted by the jdb command. Other options are supported to provide alternate mechanisms for connecting the debugger to the JVM it is to debug. For additional documentation about these connection alternatives, see Java Platform Debugger Architecture (JPDA) at http://docs.oracle.com/javase/8/docs/technotes/guides/jpda/index.html -help Displays a help message. -sourcepath dir1:dir2: . . . Uses the specified path to search for source files in the specified path. If this option is not specified, then use the default path of dot (.). -attach address Attaches the debugger to a running JVM with the default connection mechanism. -listen address Waits for a running JVM to connect to the specified address with a standard connector. -launch Starts the debugged application immediately upon startup of JDB. The -launch option removes the need for the run command. The debugged application is launched and then stopped just before the initial application class is loaded. At that point, you can set any necessary breakpoints and use the cont command to continue execution. -listconnectors List the connectors available in this JVM. -connect connector-name:name1=value1 Connects to the target JVM with the named connector and listed argument values. -dbgtrace [flags] Prints information for debugging the jdb command. -tclient Runs the application in the Java HotSpot VM client. -tserver Runs the application in the Java HotSpot VM server. -Joption Passes option to the JVM, where option is one of the options described on the reference page for the Java application launcher. For example, -J-Xms48m sets the startup memory to 48 MB. See java(1). Options Forwarded to the Debugger Process -v -verbose[:class|gc|jni] Turns on verbose mode. -Dname=value Sets a system property. -classpath dir Lists directories separated by colons in which to look for classes. -Xoption Nonstandard target JVM option.
相关推荐
然而,Android系统的安全性机制使得直接使用JDB(Java Debugger)进行远程附加调试变得困难重重。本文将深入探讨如何解决这一问题,以便更有效地进行Android So动态调试。 首先,我们需要理解JDB在Android中的工作...
"DB_JDB驱动.rar"这个压缩包文件,正如其标题所示,包含的是用于连接数据库的JDBC驱动程序,主要服务于Java开发者,帮助他们实现Java应用程序与数据库之间的通信。 JDBC是Java API的一个重要部分,它提供了一种标准...
(非常详细)_l1jdb_l1j_lineageserver_lineage_timeli 在数据库管理领域,Lineage 1(简称L1)服务器模拟是一个备受关注的话题,特别是对于那些热衷于游戏服务器架设的爱好者而言。"全DB核心修改大全"这一主题深入...
Haier海尔洗衣机XQB100-M21JDB是一款家用电动洗衣机,具有多项功能和安全考虑。这款洗衣机的设计遵循了多项国家和行业标准,包括Q/0212HRE 007《家用电动洗衣机》、GB 4706.1 《家用和类似用途电器的安全 第1部分:...
### jdb 快速参考指南:调试 Java 程序必备 #### 一、概述 在 Java 开发过程中,程序调试是一项重要的技能。jdb 是一个功能强大的命令行 Java 调试工具,它允许开发者在运行时控制 Java 程序的执行,并查看其内部...
在处理井下矿用隔爆型真空电磁启动器因JDB电机综合保护装置动作而不能正常启动的故障过程中,发现真空电磁启动器9#线在改接前后JDB漏电保护的安全防范性能发生改变,从而进一步对9#线改接前后的JDB工作原理及安全性...
jdb_official_v1.9.18.apk
jdb_official_v1.9.14.apk
jdb_official_v1.9.9.ipa
德力西JDB-11P系列电动机保护器是专门用于电动机保护的装置,它能够有效地对电动机进行断相、过载和堵转保护。该系列产品的设计充分考虑了电动机在实际使用中的不同功率特点,并以此为基础划分产品规格,确保了产品...
标题“Jdb.rar_connect”和描述“java connect db java connect db”表明这是一个关于Java数据库连接(JDBC)的教程或代码示例。JDBC是Java编程语言中用于与各种数据库进行交互的一组接口和类。这里我们将深入探讨...
JDB(Java Debugger)是Java SDK自带的一个命令行调试工具,它可以用来对Java应用程序进行远程或本地的源代码级调试。本文将深入探讨JDB断点调试技术,以及如何在Java应用程序中连接数据库。 首先,我们需要理解...
jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8jdb1.8
Cognos测试数据源XQE-JDB-0004错误的解决方案 1. 将driver文件复制到: db2jcc4.jar 和 db2jcc_license_cu.jar 和 sqljdbc.jar 和 sqljdbc4.jar 软件安装根目录的 v5dataserver/lib 文件夹内 和 软件安装根目录的/...
标题“JDB.demo.rar_DEMO_JDB.demo”和描述中提到了使用JavaScript通过ActiveXObject访问Access数据库的一个示例。这是一个在Windows系统上实现的技术,利用了JavaScript的ActiveXObject,它是Internet Explorer特有...
《JDB代码分析——深入理解Linux文件系统》 在Linux操作系统中,文件系统的稳定性和效率至关重要,而JBD(Journaling Block Device)是Linux内核中的一个关键组件,它为文件系统提供了日志式事务处理功能,确保了...
本文将详细介绍如何使用JDB来调试Android应用程序,并结合提供的"JDBTest"示例,探讨其实际应用。 首先,了解JDB的基本用法。JDB可以通过adb(Android Debug Bridge)与设备或模拟器进行通信。要启动JDB调试,你...
本文总结了 JDK 中的各种命令,包括 javac、java、javah、jdb 等,详细介绍了 JDB 调试工具的使用方法和命令列表。通过学习这些命令,可以更好地学习和使用 Java 语言。 一、JDK 命令简介 JDK 中提供了许多实用的...
JDB 是基于文本和命令行的调试工具,提供了许多有用的命令来调试 Java 应用程序。下面是 JDB 的一些重要知识点: 命令列表 1. 连接器和传送器:使用 `connectors` 命令列出当前 VM 中可用的连接器和传送器。 2. ...