Re: printing PGresult content with gdb

From: Lana ABADIE <clipperDB(at)gmx(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: printing PGresult content with gdb
Date: 2024-07-04 16:11:40
Message-ID: trinity-ad245337-3615-4511-ae0f-293359d4eef9-1720109500405@3c-app-mailcom-bs07
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>&nbsp;</div>

<div>&nbsp;
<div>&nbsp;
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Envoy&eacute;:</b>&nbsp;mercredi 3 juillet 2024 &agrave; 17:55<br/>
<b>De:</b>&nbsp;&quot;Tom Lane&quot; &lt;tgl(at)sss(dot)pgh(dot)pa(dot)us&gt;<br/>
<b>&Agrave;:</b>&nbsp;clipperDB(at)gmx(dot)fr<br/>
<b>Cc:</b>&nbsp;pgsql-general(at)lists(dot)postgresql(dot)org<br/>
<b>Objet:</b>&nbsp;Re: printing PGresult content with gdb</div>

<div name="quoted-content">clipperDB(at)gmx(dot)fr writes:<br/>
&gt; I don&#39;t know if it is the right mailing list, but i was<br/>
&gt; wondering if one could introspect via gdb the content of PGresult.<br/>
<br/>
You might have better luck with that if you install the debuginfo<br/>
RPM corresponding to your libpq RPM. PGresult&#39;s innards are not<br/>
exposed to applications by libpq-fe.h, so your own app&#39;s debug<br/>
data is not going to contain the details of the struct. But I think<br/>
it would be available to gdb if libpq&#39;s debug symbols were installed.<br/>
<br/>
regards, tom lane</div>

<div name="quoted-content">&nbsp;</div>

<div name="quoted-content">thanks Tom</div>

<div name="quoted-content">Indeed installing the debuginfo rpm on my system solves the issue, i could print the content</div>

<div name="quoted-content">see trace below</div>

<div name="quoted-content">
<pre>(gdb) p *res
&#36;2 = {ntups = 0, numAttributes = 0, attDescs = 0x0, tuples = 0x0, tupArrSize = 0, numParameters = 0, paramDescs = 0x0, resultStatus = PGRES_FATAL_ERROR,&nbsp;
&nbsp; cmdStatus = &quot;&#92;000ELECT 3&#92;000&#92;061&quot;, &#39;&#92;000&#39; &lt;repeats 53 times&gt;, binary = 0, noticeHooks = {noticeRec = 0x7f0731f40770 &lt;defaultNoticeReceiver&gt;, noticeRecArg = 0x0,&nbsp;
&nbsp; &nbsp; noticeProc = 0x7f0731f40500 &lt;defaultNoticeProcessor&gt;, noticeProcArg = 0x0}, events = 0x0, nEvents = 0, client_encoding = 6,&nbsp;
&nbsp; errMsg = 0x7f07180076e8 &quot;server closed the connection unexpectedly&#92;n&#92;tThis probably means the server terminated abnormally&#92;n&#92;tbefore or while processing the request.&#92;n&quot;,&nbsp;
&nbsp; errFields = 0x0, errQuery = 0x0, null_field = &quot;&quot;, curBlock = 0x7f07180076e0, curOffset = 146, spaceLeft = 1902, memorySize = 2264}</pre>
</div>
</div>
</div>
</div></div></body></html>

Attachment Content-Type Size
unknown_filename text/html 2.5 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Shenavai, Manuel 2024-07-04 17:24:37 RE: Configure autovacuum
Previous Message Adrian Klaver 2024-07-04 15:42:50 Re: Configure autovacuum