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. linux find 10天内改动过的文件

    find . -name "*.h" -mtime -10 -type f -print find . -regex ".*\.\(c\|h\)" -mtime ...

  2. Java中的线程实现

    线程实现有两种方法: 1.写一个类来继承Thread类,然后复写run()方法. public class HelloThread extends Thread { public void run() ...

  3. c# action<> func<> 这2个委托怎么用和理解

    其实很好理解的呢!~首先你需要明白,他们是委托的简写形式. 一.[action<>]指定那些只有输入参数,没有返回值的委托 1.1定义一个委托: 比如,我们原来写委托: public de ...

  4. 使用模拟对象(Mock Object)技术进行测试驱动开发

    敏捷开发 敏捷软件开发又称敏捷开发,是一种从上世纪 90 年代开始引起开发人员注意的新型软件开发方法.和传统瀑布式开发方法对比,敏捷开发强调的是在几周或者几个月很短的时间周期,完成相对较小功能,并交付 ...

  5. mysqldump参数详细说明

    Mysqldump参数大全(参数来源于mysql5.5.19源码)   参数 参数说明 --all-databases  , -A 导出全部数据库. mysqldump  -uroot -p --al ...

  6. sqlserver 临时表、表变量、CTE的比较

    原文地址:  sqlserver 临时表.表变量.CTE的比较 1.临时表 1.1 临时表包括:以#开头的局部临时表,以##开头的全局临时表. 1.2 存储 不管是局部临时表,还是全局临时表,都会放存 ...

  7. JAVA 是否会发生内存泄露(转)

    原文链接: JAVA 是否会发生内存泄露 几次面试,面试官都问到了这个问题,于是搜集了答案.总结出虽然java自身有垃圾回收机制,但是很多情况下还是发生内存泄露的. java导致内存泄露的原因很明确: ...

  8. verilog语法实例学习(4)

    Verilog模块 Verilog中代码描述的电路叫模块,模块具有以下的结构: module module_name[ (portname {, portname})]; //端口列表 [parame ...

  9. C/C++ 二维数组

    使用C语言用到了二维数组 #include <iostream> #include <stdlib.h> using namespace std; ], int row){ ; ...

  10. Linux下线程同步的几种方法

    Linux下提供了多种方式来处理线程同步,最常用的是互斥锁.条件变量和信号量. 一.互斥锁(mutex) 锁机制是同一时刻只允许一个线程执行一个关键部分的代码.  1. 初始化锁 int pthrea ...