Debugging a JavaVM created in C/C++.

illinoiseggoSoftware and s/w Development

Oct 28, 2013 (3 years and 7 months ago)

79 views

Debugging a JavaVM created in C/C++.



C/C++

1.

Add a new JavaVMOption to the JavaVMInitArgument used to create JavaVM:

-
agentlib:jdwp=transport=dt_socket,server=y,suspend=n, address=
port

If suspend=y, the application will be suspended until a remote debugger
is attached,
otherwise it will continue. The address port must match the port used by the remote
debugger.

2.

Run application launching the JavaVM.



Eclipse:

1.

Create a new project and add the java source files.

2.

Create the debug configuration for remote debugger
:

-

Select Run
-
>Debug Configuration

-

Right click on Java Remote Application and select New.

-

Set Project to your newly created project, Host to localhost and Port to the address used
by JavaVM.

-

Execute Remote Debugger to attach to JavaVM.


CUBRID


Debugging J
SP Server:

1.

Set in cubrid.conf file two parameters:

JAVA_STORED_PROCEDURE=yes


// runs JSP server

DEBUG_JSP_SERVER=yes



// allows debugging on JSP Server

DEBUG_JSP_SERVER_PORT=port_number

// sets the debug port, default 8000

2.

Start cubrid server.

3.

Start Eclipse and follow the steps descriped above (the java source files can be found in
src/jdbc/com).

4.

Put a breakpoint in com.cubrid.jsp.ExecuteThread
.run().

5.

Connect to cubrid server and call a java stored procedure.

Note: If you’re debugging the C/C++
code, the java remote debugger will be blocked to
o
. Continue
to the point where the C/C++ application waits for answer in order to debug JSP

Server
.