Re: Postgres and gdb: p debug_query_string RE: Query

From: Garo Hussenjian <garo(at)xapnet(dot)com>
To: Marco Kraaijeveld <marco(at)cybersolutions(dot)nl>
Cc: Postgresql General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgres and gdb: p debug_query_string RE: Query
Date: 2003-03-06 18:17:21
Message-ID: BA8CD0B1.8200%garo@xapnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Marco,

Instead of 'p debug_query_string'...

Use 'x/s debug_query_string' which should give the actual query!

Regards,
Garo.

> Hello Garo,
>
> I'm sorry to bother you, but after searching on Google, I found that you have
> had the exact same problem as I currently have. Unfortunately, the answer to
> the problem isn't listed on Google.
>
> The problem is when attaching gdb to a postgres process, after giving the 'p
> debug_query_string' command, it doesn't show the query. How did you fix this
> problem?
>
>> $ gdb /path/to/postgres-executable
>> gdb> attach PID-OF-PROCESS
>> gdb> p debug_query_string
>> gdb> quit
>>
> Thanks, Tom.
>
> Here's what I got going...
>
> semerjia% gdb usr/local/pgsql/bin/postmaster
> GNU gdb 4.18
> < MORE GDB STUFF... >
> (gdb) attach 43179
> Attaching to program: /usr/home/semerjia/usr/local/pgsql/bin/postmaster,
> process 43179
> Reading symbols from /usr/lib/libz.so.2...done.
> Reading symbols from /usr/lib/libcrypt.so.2...done.
> Reading symbols from /usr/lib/libm.so.2...done.
> Reading symbols from /usr/lib/libutil.so.3...done.
> Reading symbols from /usr/lib/libreadline.so.4...done.
> Reading symbols from /usr/lib/libc.so.4...done.
> Reading symbols from /usr/lib/libncurses.so.5...done.
> Reading symbols from /usr/libexec/ld-elf.so.1...done.
> 0x28346088 in read () from /usr/lib/libc.so.4
> (gdb) p debug_query_string
> $1 = 138514480
> (gdb)
>
>
>> This should work unless you are running a stripped backend executable.
>> (On many systems, the "file" command can tell you whether an executable
>> has been stripped of debug symbols.)
>
> I can't tell if this worked... What is '$1 = 138514480'. After running gdb,
> the process STAT for 42179 changed from R to T so I kill'ed it...
>
>>
>
> Kind regards,
> Marco Kraaijeveld
>

=-=-==-=-=-==

Xapnet Internet Solutions
1501 Powell St., Suite N
Emeryville, CA 94608

Tel - (510) 655-9771
Fax - (510) 655-9775
Web - http://www.xapnet.com

Browse pgsql-general by date

  From Date Subject
Next Message Patrick Macdonald 2003-03-06 18:21:07 Re: 7.4?
Previous Message Bruce Momjian 2003-03-06 18:10:34 Re: 7.4?