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. 用SwipeBackLayout实现滑动关闭当前Activity

    说起SwipeBackLayout,我对它还是有一定怨念的.当时就希望能实现关闭当前Activity的效果,但完全搜不当相关的东西,最后好不容易搜到了这个SwipeBackLayout,觉得可以实现滑 ...

  2. EditText 限制输入,自定义样式,监听输入的字符,自动换行

    自动获取焦点 <!-- 添加:<requestFocus /> 会自动获取焦点 --> <EditText android:layout_width="matc ...

  3. 《ASP.NET Web API 2框架揭秘》

    <ASP.NET Web API 2框架揭秘> 基本信息 作者: 蒋金楠 出版社:电子工业出版社 ISBN:9787121235368 上架时间:2014-7-5 出版日期:2014 年7 ...

  4. Orchard模块开发全接触5:深度改造前台第二部分

    在这一部分,我们继续完善我们的购物车,我们要做以下一些事情: 1:完成 shoppingcart.cshtml: 2:让用户可以更新数量及从购物车删除商品: 3:创建一个 widget,在上面可以看到 ...

  5. Java Callable接口、Runable接口、Future接口

    1. Callable与Runable区别 Java从发布的第一个版本开始就可以很方便地编写多线程的应用程序,并在设计中引入异步处理.Thread类.Runnable接口和Java内存管理模型使得多线 ...

  6. 显卡、显卡驱动、CUDA、cuDNN之间的关系

    作者:冬瓜哥链接:https://www.zhihu.com/question/59184480/answer/166167659来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注 ...

  7. junit5了解一下

    要求java8及以上版本 JUnit 5 = JUnit Platform + JUnit Jupiter + JUnit Vintage https://junit.org/junit5/docs/ ...

  8. 算法: 实现LRU缓存,读取、写入O(1)实现

    这题应该见的不少了,写写记录一下. 实现该功能分析: (1) O(1) 时间完成查找,那除了 hash 别无选择. (2) LRU 最近最少使用算法,为了方便数据的淘汰.需要对最近访问的数据放未访问数 ...

  9. 前端Js框架汇总【转】

    概述: 有些日子没有正襟危坐写博客了,互联网飞速发展的时代,技术更新迭代的速度也在加快.看着Java.Js.Swift在各领域心花路放,也是煞是羡慕.寻了寻.net的消息,也是振奋人心,.net co ...

  10. 读书笔记,《深入理解java虚拟机》,第二章,java内存区域与内存溢出异常

    第二节,运行时数据区域.    在这个章节中,作者给出了一个java虚拟机运行时数据区的框图,图的左侧是方法区和堆,这两个数据区是所有的线程所共享的.然后是虚拟机栈.本地方法栈.还有程序计数器,这三个 ...