Persuading JDE to run jdb such that it attaches to an existing process
involves a little trickery.  It's not a pretty solution, but it works.

Set the jde-db-read-vm-args variable to "on" via the
JDE->Project->Options->General customization buffer.

Edit an empty file named ".java".  Clear JDE's jde-global-classpath
variable.  You can do this manually, but it's a lot more convenient if you
have a directory that contains only the ".java" file and a "prj.el" file
that clears the variable.

Invoke jde-debug by selecting the JDE->Debug app menu item or the C-c, C-v,
C-d key sequence.  When prompted for input in the mini-buffer, enter
"-attach <addr>" where <addr> is the value that was used for the "address="
argument when the VM was started.

For example, let's say that you want to attach the debugger to a VM that was
started with the command:

    java -Xdebug
-Xrunjdwp:transport=dt_shmem,address=jdbconn,server=y,suspend=n MyClass

You would enter "-attach jdbconn" in the mini-buffer.  This would run the
command
"jdb -attach jdbconn" in an emacs debug buffer.

When you run the debugger, JDE appends the class name currently being edited
to the jdb command line.  It does this by deleting the ".java" suffix from
the name of the current buffer.  So, editing the file named ".java" is just
a cheap trick to keep JDE from appending an unnecessary argument to the jdb
command line.

Alternatively, you could edit an empty file named "jdbconn.java" and enter
only "-attach" when prompted for input in the mini-buffer.  The same command
line would be constructed to start the debugger.

Constructing a valid jdb command line is also the reason you want to ensure
that there is no value for jde-global-classpath.  If this has a value, then
JDE will append the "-classpath" option to the jdb command line.

Of course, you also need to ensure that jde-db-source-directories is set
appropriately.

Note that if you are using a JDK 1.2 VM and jdb, you will have to modify
your input in the mini-buffer to something like "-host <host> -password
<passwd>".

Hope this helps.

--
Chris Britton
[EMAIL PROTECTED]


-----Original Message-----
From: Paul Kinnucan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 15, 2000 3:46 PM
To: Zhou Ye
Cc: [EMAIL PROTECTED]
Subject: Re: Problems and Comments on JDE225


At 03:57 PM 11/15/00 -0800, Zhou Ye wrote:
>
[snip]

[stuff deleted]

>> >c) Using jdb
>> >
>> >I then tried to use jdb.   I was able to set it up and debug an app
>> >launched by jdb.  Stepping thru the code also seemed to work fine.
>> >
>> >However, I can 't figure out how to make it to do attach.  I tried a few
>> >things but can't seem to make JDE to accept my "-attach" correctly.
>> >
>> >Is there a way to use jdb for attaching?
>> >
>>
>> The JDE does not really support attaching jdb to an existing process.
It's
>> possible to do it by setting the right debug options. You have to turn
off
>> some things and turn on others. I've forgotten the details of how to do
it.
>>
>> - Paul
>
>jdb does offer the command window feature.  Any plan in future support of
it?
>

The JDE already provides an interface to jdb, though not to the attach mode
of jdb. I personally do not plan to invest any more time in the JDE's jdb
interface other than to keep it current with the current JDK.


- Paul

Reply via email to