Skip to content
thallgren edited this page Jan 14, 2013 · 1 revision

Recompile PL/Java with symbolic information

 make clean
 make CFLAGS=-g

Start psql and set the PL/Java debug flag, and issue a call to some Java function

In psql:

 set pljava.debug=true
 select sqlj.get_classpath();

This should cause psql to hang after printing something similar to the following:

psql printout:
INFO: Backend pid = 2830. Attach the debugger and set pljavaDebug to false to continue Use another window and attatch the gdb debugger.
In another shell

 gdb <full path to the postgres executable> <your Backend pid>

The debugger will break into the PL/Java code while it is in a dummy loop. You can break this loop by setting the global variable pljavaDebug to false. You then have the ability to set breakpoints etc. before you continue execution.
In gdb

 (gdb) set pljavaDebug=0
 (gdb) <set breakpoints etc. here>
 (gdb) cont

Thats it!