[Pljava-dev] Debugging application

Thomas Hallgren thhal at mailblocks.com
Fri Jun 18 08:08:12 UTC 2004


Hi Arul,
The very short answer is yes, but not with the current binaries.

A more elaborate (and perhaps more helpful answer) is:

The current version is a bit crippled with respect to debugging since
there's no way to pass command-line options to the JVM. There're ways around
that though, if you are willing to compile the source locally. A more
elaborate solution will be released but it's dependent on new functionality
that will be included with PostgreSQL 7.5.

Regardless of versions, the procedure is to pass something like:
-Xdebug
-Xnoagent
-Djava.compiler=NONE
-Xjunjdwp:transport=dt_socket,address=NNNN,server=y,suspend=y

(various other configurations exists, Eclipse might stipulate another
transport, some might be dependent on the JVM you are using). This will make
bring the backend to a halt the first time the JVM is started. The JVM now
waits for a debugger to attach on the given transport (in this case a socket
on port NNNN but the transport can also be shared memory based).

The way I see it, you have two options:

1. Compile the Pl/Java source together with a PostgreSQL 7.4.x (you need a
source distribution of PostgreSQL too), patch the Backend.c (from Pl/Java)
to include the above options in the call to JNI_CreateJavaVM.

2. Compile the Pl/Java source towards the CVS HEAD of PostgreSQL and make
use of the posgresql.conf variable "custom_variable_classes", i.e. put:

   custom_variable_classes=pljava
   pljava.vmoptions="<the options above>"

in the postgresql.conf file.

I should also mention that the CVS HEAD of Pl/Java runs fine with the GCJ
(GNU's version of Java) provided it's version 3.4. Running that, you'd use
standard GDB (now Java aware) to do the debugging.

I hope this helps.

Kind regards,

Thomas Hallgren


> -----Original Message-----
> From: pljava-dev-bounces at gborg.postgresql.org [mailto:pljava-dev-
> bounces at gborg.postgresql.org] On Behalf Of Arul Shaji
> Sent: Friday, June 18, 2004 9:45 AM
> To: pljava-dev at gborg.postgresql.org
> Subject: [Pljava-dev] Debugging application
> 
> Hi,
> 
> I am now using PL/Java for my JSP in Postgres....
> 
> I want to know if it is possible to debug the applications I write for
> pljava when I am using Eclipse....
> 
> Here is what I want to do exactly... I write a JDBC program which has some
> calls to one of the SP.... If I start debugging from my code, can I
> continue
> through the pljava code all the way to Postgres and back ?
> 
> If I can, how and what are the tools I will need to achieve this ??
> 
> Rgds,
> Arul
> 
> This is an email from Fujitsu Australia Software Technology Pty Ltd, ABN
> 27 003 693 481. It is confidential to the ordinary user of the email
> address to which it was addressed and may contain copyright and/or legally
> privileged information. No one else may read, print, store, copy or
> forward all or any of it or its attachments. If you receive this email in
> error, please return to sender. Thank you.
> 
> If you do not wish to receive commercial email messages from Fujitsu
> Australia Software Technology Pty Ltd, please email
> unsubscribe at fast.fujitsu.com.au
> 
> 
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at gborg.postgresql.org
> http://gborg.postgresql.org/mailman/listinfo/pljava-dev





More information about the Pljava-dev mailing list