Using gdb to obtain statement - Mailing list pgsql-general

From Markus Wollny
Subject Using gdb to obtain statement
Date
Msg-id 2266D0630E43BB4290742247C891057507ECD997@dozer.computec.de
Whole thread Raw
Responses Re: Using gdb to obtain statement  (Andreas Seltenreich <andreas+pg@gate450.dyndns.org>)
List pgsql-general
Hello!

As pg_stat_activity.current_query truncates statements to about 255
characters, I've tinkered a bit with gdb, as suggested by Tom Lane a
little while ago. But when I attach to the backend in question, the only
output I get from p debug_query_string is some number, for example:

mysrv:/var/log # gdb /opt/pgsql/bin/postgres 1485
GNU gdb 5.2.1
Copyright 2002 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 "i586-suse-linux"...
Attaching to program: /opt/pgsql/bin/postgres, process 1485
Reading symbols from /lib/libz.so.1...done.
Loaded symbols for /lib/libz.so.1
Reading symbols from /lib/libreadline.so.4...done.
Loaded symbols for /lib/libreadline.so.4
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libresolv.so.2...done.
Loaded symbols for /lib/libresolv.so.2
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/i686/libm.so.6...done.
Loaded symbols for /lib/i686/libm.so.6
Reading symbols from /lib/i686/libc.so.6...done.
Loaded symbols for /lib/i686/libc.so.6
Reading symbols from /lib/libncurses.so.5...done.
Loaded symbols for /lib/libncurses.so.5
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /usr/lib/gconv/ISO8859-1.so...done.
Loaded symbols for /usr/lib/gconv/ISO8859-1.so
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
0x40198cd4 in read () from /lib/i686/libc.so.6
(gdb) p debug_query_string
$1 = 137763608

What am I doing wrong?

Kind regards

   Markus

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: psql: server closed the connection unexpetedly
Next
From: David Fetter
Date:
Subject: Re: [OT?] ETL tools