debugging with gdb

Started by Ravi Kiranalmost 12 years ago2 messagesgeneral
Jump to latest
#1Ravi Kiran
ravi.kolanpaka@gmail.com

Hi,

I am facing some problem with gdb for the past few days.

I want to debug nestloop.c in postgresql , so I followed the below steps.

I followed the steps given in the below for collecting the stack trace.

https://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Linux/BSD

1) I started Postgresql using eclipse using run.

2) I started one client using the following command in bash
3)psql test(Where test is the database and it has the tables student and
marks)
4)Then using the command pg_backend_pid(); , I got the pid of the client.
5)In another terminal I started gdb using the command sudo gdb -p pid
6)set pagination off
7)set detach-on-fork off
8)set schedule-multiple on
9)handle SIGUSR1 noprint nostop

handle SIGUSR2 noprint nostop

10)python gdb.events.exited.connect(lambda x: [gdb.execute('inferior
1'), gdb.post_event(lambda: gdb.execute('continue'))])

11)b ExecNestLoop(which is the function in nodenestloop.c)
12)In the client I did a join query, select * from student inner join marks
on student.id=marks.id;
13)n

But the problem is that the code in nodenestloop.c is not getting executed.

could anyone help me with that.

Thank you

#2Michael Paquier
michael@paquier.xyz
In reply to: Ravi Kiran (#1)
Re: debugging with gdb

On Fri, Jul 11, 2014 at 11:26 PM, Ravi Kiran <ravi.kolanpaka@gmail.com> wrote:

13)n

In gdb, 'n' or 'next' is used to have the debugger switch to the next
line, if you want to stop automatically to the next breakpoint, use
either 'c' of 'continue'.
--
Michael

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general