Options need to be added to the standard launch of a virtual machine (VM) to enable the debugging architecture, allowing us to attach (hook in) and collect data.

-Xdebug

Enables remote debugging.

-Xnoagent

On a Sun VM, disables the proprietary debugging interface thus letting JPDA work correctly.在Sun VM上,禁用专有调试接口,从而允许JPDA正确工作。

-Djava.compiler=NONE

Disables Just-In-Time (JIT) compilation..

我们一般debug程序的时候,只是关注其中的一部分代码,而且大部分情况下是设置断点,然后单步执行,而JIT的编译单位是class,只要我们执行了class里面的代码,JIT就会对整个class进行编译,而我们实际执行的代码一般都是其中的一部分代码,所以从整个时间效率上来看,采用JIT反而更费时间。也就是说在JVM远程调试这个事情上,禁用JIT(只使用转译器,解释一行执行一条)更合理,所以通过-Djava.compiler=NONE来禁止JIT。

-Xrunjdwp:

transport=dt_socket,

server=y,

address=5000,

suspend=y

Loads JDWP (Java Debug Wire Protocol), the reference implementation of JPDA. Sub-options further specify the option.

transport=dt_socket

Sets the transport type for the connection with the debugging application; in this example, we will connect via a socket.

server=y

Tells the VM whether it must be receptive to an attaching debugging application.

address=5000

The port address for our connection; we will need 5000 for our example.

suspend=y

This option can be set depending on whether we want to suspend the exectution of the VM until a debugging application connects. This is useful if we seek to understand what happens when a server starts.

1、If we wish to make the VM wait for a connection before a full launch, we will need a command line such as this :

java …. -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=,suspend=y

2、If we want the VM to be fully executing and listening for a debugging application, we will require a command line such as this one :

java …. -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=,suspend=n

第2种模式是一种比较好的方式,VM采用侦听的方式等待调试程序的连接。

Configuring the launch of the remote virtual machine to debug的更多相关文章

  1. [SQL in Azure] Windows Azure Virtual Machine Readiness and Capacity Assessment

    http://technet.microsoft.com/en-us/solutionaccelerators/dd537566.aspx http://blogs.technet.com/b/map ...

  2. [SQL in Azure] Provisioning a SQL Server Virtual Machine on Azure

    http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-provision-sql-server/ Provi ...

  3. PatentTips - Improving security in a virtual machine host

    BACKGROUND Computer viruses are a common problem for computer users. One typical mode of attack is t ...

  4. Configuring Network in CentOS 6.3 Virtual Box + Screenshots

    Configuring Network in CentOS 6.3 Virtual Box + Screenshots Posted: May 23, 2013 in Uncategorized Ta ...

  5. [译] libvirt 虚机的生命周期 (Libvirt Virtual Machine Lifecycle)

    翻译自:http://wiki.libvirt.org/page/VM_lifecycle   这篇文章描述虚机生命周期的基本概念.其目的在于在一篇文章中提供完整的关于虚机创建.运行.停止.迁移和删除 ...

  6. Internet Explorer for Mac the Easy Way: Run IE 7, IE8, & IE9 Free in a Virtual Machine

        From link: http://osxdaily.com/2011/09/04/internet-explorer-for-mac-ie7-ie8-ie-9-free/ If you’re ...

  7. 60年代进程 80年代线程 IPC How the Java Virtual Machine (JVM) Works

    小结: 1. To facilitate communication between processes, most operating systems support Inter Process C ...

  8. PatentTips - Safe general purpose virtual machine computing system

    BACKGROUND OF THE INVENTION The present invention relates to virtual machine implementations, and in ...

  9. PatentTips - System and method to deprivilege components of a virtual machine monitor

    BACKGROUND INFORMATION An embodiment of the present invention relates generally to virtualization pl ...

随机推荐

  1. 用SAX和PULL进行XML文件的解析与生成

    XML解析有传统的dom方法还有Jsoup,SAX,PULL等,这里讲的是比较省内存的SAX和PULL方法.Android中极力推荐用PULL的方式来解析,我个人觉得pull确实比较简单,但其内部的逻 ...

  2. C# 关键字Event

    1>>> 在委托实例前,不加event,那这个委托就是一个普通的委托,我们可以用别的函数调用,也可以直接用对象调用,但加上关键字之后,只能用成员函数调用 public delegat ...

  3. C# 程序设置开机启动(一)

    一.示例使用VBScript创建启动文件,并添加到Windows系统的启动目录 默认情况下 所有用户启动目录:C:\ProgramData\Microsoft\Windows\Start Menu\P ...

  4. java中 列表,集合,数组之间的转换

    java中 列表,集合,数组之间的转换 java中 列表,集合,数组之间的转换 java中 列表,集合,数组之间的转换 List和Set都是接口,它们继承Collection(集合),集合里面任何数据 ...

  5. Django静态文件的加载以及STATIC_URL、 STATIC_ROOT 、STATICFILES_DIRS的区别

    Djangon生产环境静态资源的处理 Django 关闭DEBUG模式后,就相当于是生产环境了. Django框架一旦作为生产环境,它的静态文件访问接口就不应该从Django框架中走,必须在Djang ...

  6. idea 2018.1破解激活方法,有效期至2099年 idea 激活 破解

    最近笔者测试了好多破解Idea的方法,最简单操作方法莫过于用license server激活,但是此类方法对最新的2017.3.2版已经无效了,亲测哦,如下图所示.  针对新版的IntelliJ ID ...

  7. 【BZOJ】【3697】采药人的路径&【3127】【USACO2013 Open】Yin and Yang

    点分治 Orz hzwer 倒是比较好想到点分治……然而在方案统计这里,我犯了两个错误…… 1.我比较傻逼的想的是:通过儿子来更新父亲,也就是统计以x为根的子树中xxxx的路径有多少条……这样转移. ...

  8. JVM编译优化

    在部分的商用虚拟机中,Java 程序最初是通过解释器(Interpreter )进行解释执行的,当虚拟机发现某个方法或代码块的运行特别频繁的时候,就会把这些代码认定为“热点代码”.为了提高热点代码的执 ...

  9. windows核心编程-互斥器(Mutexes)

    线程同步的方式主要有:临界区.互斥区.事件.信号量四种方式. 前边讲过了临界区线程同步-----windows核心编程-关键段(临界区)线程同步,这章我来介绍一下互斥器(Mutexes)在线程同步中的 ...

  10. 算法生成N芒星

    前面两个图像生成算法是:道教的太极八卦图和佛教的卐和卍字图.这一节整个洋气的图像:芒星.但愿我别召唤出什么恐怖的禁忌,尤其今晚还是万圣节之夜.平时看玄幻小说,经常读到有关六芒星,七芒星,九芒星的技法. ...