On Wed, 2003-10-15 at 11:43, kkim3@ncsu.edu wrote:
> Hello,
>
> I'm a student who use postgresql. I'd like to debug postgres source code.I
> tried to use "ddd" in linux. The thing what I want to do is debugging
> backend part.How can I do that. The commands that I used until now are
> following.
>
> 1. ddd postgres
> 2. In the ddd,I tried to attach pid. (but I can't find pid about backend)
> 3. When I tried to run program with break point,I met error like "can't
> find 2003-10-15(that is the date and time when I run)".
>
> So,I'm not sure how can I use "ddd". Could let me know how can I use this?
If you'd like info on using ddd, read the ddd docs or ask on their
mailing list -- there shouldn't be anything particularly unique about
using ddd on PostgreSQL rather than any other program that uses fork().
In any case, it's pretty straightforward to use gdb. I do the following:
1. build PostgreSQL with --enable-debug. Also, debugging is less painful
if you use CFLAGS='-O0'.
2. start up PostgreSQL and connect to it
3. find the PID of the postgres backend using ps or some equivalent
4. run 'gdb -p xxx', where xxx is the PID of the postgres backend
process -- then set breakpoints, and all that jazz.
-Neil