【正文】
? 使用 IBM 試用軟件 改進(jìn)您的下一個(gè)開源開發(fā)項(xiàng)目,可以下載或從 DVD 獲得。 ? 在 IBM alphaWorks 上查看最新的 Eclipse 技術(shù)下載 。 ? 您是 Eclipse 新手嗎?閱讀 developerWorks 文章 “Eclipse 平臺入門 ” 以了解它的起源和架構(gòu),以及如何用插件擴(kuò)展 Eclipse。 ? 要初步了解如何在 Eclipse 平臺上進(jìn)行調(diào)試,請參閱 “使用 Eclipse 平臺進(jìn)行調(diào)試 使用 Eclipse 平臺調(diào)試您的軟件項(xiàng)目 ”。清單 7 顯示了如何將 Java 應(yīng)用程序作為調(diào)試客戶機(jī)并調(diào)用它,然后使用端口 8000 上的主機(jī) 的套接字將其連接到一個(gè)正在運(yùn)行的調(diào)試器應(yīng)用程序。為了在同一臺機(jī)器上運(yùn)行遠(yuǎn)程應(yīng)用程序,僅需將主機(jī) IP 指定為 localhost 或 。簡單的 Java 應(yīng)用程序就可以充當(dāng)調(diào)試服務(wù)器或客戶機(jī)。如果應(yīng)用程序在斷點(diǎn)處停止執(zhí)行,則表明調(diào)試信息正確顯示。 清單 4. 調(diào)試示例代碼 package 。這兩種連接器對應(yīng)用程序調(diào)試沒有影響,用戶可以任意選擇。 清單 3. 作為調(diào)試客戶機(jī)的目標(biāo) VM Xdebug Xrunjdwp:transport=dt_socket,address=:8000 Eclipse 中的遠(yuǎn)程調(diào)試特性 Eclipse 是一個(gè)圖形化 Java 調(diào)試器前端。否則,它將連接到特定地址上的調(diào)試器應(yīng)用程序。它通過傳輸和 JDWP 協(xié)議與獨(dú)立的調(diào)試器應(yīng)用程序通信。 要遠(yuǎn)程調(diào)試 Java 程序,難點(diǎn)不是在調(diào)試器的前端,而是遠(yuǎn)程 Java 后端。連接器 “映射 ” 到可用的傳輸類型和連接模式。根據(jù) Sun 的 JPDA 規(guī)范,被調(diào)試的程序常常稱為 debuggee。 JPDA 簡介 啟動配置類型 啟動配置 保存一組用于啟動程序的屬性。 Eclipse 最新的套接字監(jiān)聽連接器允許您打開 Java 調(diào)試器,它能夠監(jiān)聽特定套接字上的連接。S_CMP=EDU 使用 Eclipse 遠(yuǎn)程調(diào)試 Java 應(yīng)用程序 利用 Eclipse IDE 的強(qiáng)大功能遠(yuǎn)程調(diào)試 Java 應(yīng)用程序 級別: 中級 Charles Lu, 軟件工程師 , IBM 2020年 12月 9日 在本地計(jì)算機(jī)上調(diào)試 Java? 應(yīng)用程序并不是惟一的選擇。 Eclipse project resources. ? To listen to interesting interviews and discussions for software developers, check out check out developerWorks podcasts. ? Stay current with developerWorks39。: socket transport and shared memory transport. Available connectors: ? Socketattaching connector ? Sharedmemory attaching connector ? Socketlistening connector ? Sharedmemory listening connector ? Commandline launching connector In establishing a connection between a debugger application and target VM, one side acts as a server and listens for a connection. At some later time, the other side attaches to the listener and establishes a connection. The connections allow the debugger application or the target VM to act as a server. The munications among processes can be running on one machine or different machines. The problem with debugging a Java program remotely is not in the debugger front end but the remote Java back end. Unfortunately, there is not much information about this in the Eclipse help system. In fact, JDI and JVMTI are implemented by Eclipse and the Java runtime environment, respectively. The only thing we are concerned with is the JDWP, which contains the information to municate with the JVMTI and JDI. The JDWP contains many arguments that have been added to invoke the application for the remote Java application. Following are some of the arguments used in this article. Xdebug Enables debugging features. Xrunjdwp:suboptions Loads the implementation of JDWP in the target VM. It uses a transport and the JDWP protocol to municate with a separate debugger application. Specific suboptions are described below. Starting from Java V5, you can use the agentlib:jdwp option, instead of Xdebug and Xrunjdwp. But if you have to connect to the VM prior to V5, Xdebug and Xrunjdwp will be the only choice. Following are brief descriptions of the Xrunjdwp suboptions. transport Generally, socket transport is used. But sharedmemory transport can also be used on the Windows platform, if available. server If the value is y, the target application listens for a debugger application to attach. Otherwise, it attaches to a debugger application at the specified address. address This is the transport address for the connection. If the server is n, attempt to attach to a debugger application at this address. Otherwise, listen for a connection at this port. suspend If the value is y, the target VM will be suspended until the debugger application connects. For detailed explanations for each debug setting, refer to the JPDA documentation (see Resources). Listing 2 shows an example of how to launch a VM in debug mode and listen for a socket connection at port 8765. Listing 2. Target VM acts as a debug server Xdebug Xrunjdwp:transport=dt_socket,server=y,address=8765 Listing 3 shows how to attach to a running debugger application using a socket on host at port 8000. Listing 3. Target VM acts as a debug client Xdebug Xrunjdwp:transport=dt_socket,address=:8000 Remote debugging features in Eclipse Eclipse is a graphical Java debugger front end. The JDI is implemented in bundle. In this article, we don39。 Java SE Development Kit (JDK). In this article, we focus on remote debugging, rather than detail each of Eclipse39。t have it already, download Eclipse (Ganymede). In Ganymede, the socket listening connector has been added to the Remote Java Application launchconfiguration type. Eclipse39。s JPDA specification. The JDI is a highlevel interface to define the information and requests used for remote debugging. The architecture is structured as follows. Listing 1. The Java Platform Debugger Architecture Components Debugger Interfaces / || / | VM | debuggee ( || JVMTI Java VM Tool Interface \ | backend | \ || / | m channel ( |