Operating System - HP-UX
1755130 Members
3327 Online
108830 Solutions
New Discussion юеВ

Debugging C++ code called through Java routines

 
Amit_22
Occasional Contributor

Debugging C++ code called through Java routines

I have an application running using WebLogic on HP UNIX. The code internally calls many C++ methods. I want to debug the C++ code called using debugger.
I tried in HP-DDE by attaching the running process. I was able to attach the running process through DDE. I was also able to see the code but I am not able to set break points. When I set breakpoints it says "Permission Denied".
I checked in the HP-DDE manual for attaching running processes. One point which was written there was that breakpoint cannot be set in shared libraries used by program unless we run /usr/lib/pxdb -s on .
As WebLogic runs the process through java when I did /usr/lib/pxdb -s on java it gives me the error:
crt0 out of date
pxdb32: java is not a valid executable file.

Can anyone suggest some more things about debugging this
2 REPLIES 2
Nicolas Portais
Frequent Advisor

Re: Debugging C++ code called through Java routines

Hi,

you can debug JNI application with gdb.

on dspp developper site, there is some documentations which explain how to debugging JNI application:
- "debugging a native JNI library with gdb on Java??? SDK 1.2": http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,914,00.html
- "debugging a native JNI library with Java??? 2 HotSpot VM under gdb": http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,2732,00.html

Nicolas
Mike Stroyan
Honored Contributor

Re: Debugging C++ code called through Java routines

As hinted in the links that Nicolas pointed you to, the bin/java "command" is a script that really invokes a program such as /opt/java1.2/jre/bin/PA_RISC/native_threads/java
You would need to use pxdb against the real program.
An easier alternative is to set
DEBUG_PROG=wdb in your environment. The java startup script will then invoke the java program with the wdb debugger.

The java program will still need the arguments set, since wdb does not pass them on. You can set them with "set args myargs" or with "r myargs".

I often see a "SIGSEGV" in starting java under wdb. Just
continue on with "c" and java will catch the SIGSEGV and work correctly!

You can get the latest wdb from
http://www.hp.com/go/wdb . The latest one can even unwind the stack into java code