Re: [HACKERS] postgres under gdb - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: [HACKERS] postgres under gdb
Date
Msg-id 3891BC7E.4F893E83@alumni.caltech.edu
Whole thread Raw
In response to postgres under gdb  (Chris <chris@bitmead.com>)
List pgsql-hackers
> How do you run postgres under gdb?

gdb postgres
GNU gdb 4.17.0.4 with Linux/x86 hardware watchpoint and FPU support
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux"...
(gdb) b ParseFuncOrColumn
Breakpoint 1 at 0x80e5656: file parse_func.c, line 228.
(gdb) run postgres
Starting program: /opt/postgres/current/bin/postgres postgres
DEBUG:  Data Base System is starting up at Thu Jan 27 17:45:46 2000
DEBUG:  Data Base System was interrupted being in production at Thu
Jan 27 17:40:53 2000
DEBUG:  CheckPoint record at (0, 920)
DEBUG:  Redo record at (0, 920); Undo record at (0, 0)
DEBUG:  NextTransactionId: 0; NextOid: 0
DEBUG:  Invalid NextTransactionId/NextOid
DEBUG:  The DataBase system was not properly shut down       Automatic recovery is in progress...
DEBUG:  ReadRecord: invalid record len 0 in (0, 968)
DEBUG:  Formatting logfile 0 seg 0 block 0 at offset 968
DEBUG:  The last logId/logSeg is (0, 0)
DEBUG:  Redo is not required
DEBUG:  Undo is not required
DEBUG:  Data Base System is in production state at Thu Jan 27 17:45:49
2000

POSTGRES backend interactive interface 
$Revision: 1.139 $ $Date: 2000/01/09 12:17:33 $

backend> select b from t1 tx (b);

Breakpoint 1, ParseFuncOrColumn (pstate=0x824eb70, funcname=0x824f098
"b", fargs=0x824f0f8, agg_star=0 '\000',    agg_distinct=0 '\000', curr_resno=0x824eb70, precedence=1) at
parse_func.c:228
228             Oid                     rettype = InvalidOid;
(gdb) l 310
...

You can also give more command line options when you type "run". A
tip: when trying to track down why elog() errors are being thrown, set
a breakpoint on elog itself and then do a "where". Use "frame #" to
bop around the stack. Been doing that a lot lately ;)
                  - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


pgsql-hackers by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: [HACKERS] Re: ORDBMS
Next
From: Thomas Lockhart
Date:
Subject: Re: AW: AW: [HACKERS] Some notes on optimizer cost estimates