Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sOygs-002I6m-1w for pgsql-general@arkaria.postgresql.org; Wed, 03 Jul 2024 12:02:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sOygp-008Knt-SS for pgsql-general@arkaria.postgresql.org; Wed, 03 Jul 2024 12:02:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sOygo-008Knl-Pl for pgsql-general@lists.postgresql.org; Wed, 03 Jul 2024 12:02:24 +0000 Received: from p-impout005aa.msg.pkvw.co.charter.net ([47.43.26.136] helo=p-impout005.msg.pkvw.co.charter.net) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sOygh-000CIh-Kp for pgsql-general@lists.postgresql.org; Wed, 03 Jul 2024 12:02:22 +0000 Received: from raker.lan ([24.163.71.136]) by cmsmtp with ESMTPA id OygesqTYrxypEOygfsGldk; Wed, 03 Jul 2024 12:02:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nc.rr.com; s=c20240129; t=1720008133; bh=lVN+eoaOeAtRKQBdkDOnHZeIYONwVSI+RawJKI3BlzQ=; h=Subject:From:Reply-To:To:In-Reply-To:References:Date; b=YmbMxfe8Y39bQuzLSAV1MuwtTkvZunMLdPs+OmrxYkJzOtVWqvmyym8zZSiUh6B/P mmg2NOybdiAoKVN5ghEMWKCdOM3LMO4UmSNrNittT7bnPlQs5JFZtVETRVXus7bFiV jDXeDWYK8UEsDZXj35zxMtVCXUSHYg3MwHPK6UMvl/s0cZdDhSUefiw24Y1/NNpq8b 0teT+cg5RG8s55iu2Rc0l6De+vi9yUUj1TBCSx/yX3VwJqOHYjAkXf4ftuRy1ig0H3 wAj6drdZwKM9QsbebHd0dBuPpDcaJEIcxry+GErbiGnHKXUpcArdeKa0EiWiB3uCT5 eoGvbh0LcXH8Q== X-Authority-Analysis: v=2.4 cv=Pd35hDhd c=1 sm=1 tr=0 ts=66853dc5 a=y/ftIks74FodBkIlVPcSGg==:117 a=y/ftIks74FodBkIlVPcSGg==:17 a=IkcTkHD0fZMA:10 a=epTmVMiNAAAA:8 a=Zco0LX8C1NsAjws4VR0A:9 a=QEXdDO2ut3YA:10 a=ndEWmUVY6Yapc0oHF_P4:22 Message-ID: Subject: Re: printing PGresult content with gdb From: Reid Thompson Reply-To: jreidthompson@nc.rr.com To: clipperDB@gmx.fr, pgsql-general@lists.postgresql.org In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Date: Wed, 03 Jul 2024 08:02:06 -0400 MIME-Version: 1.0 User-Agent: Evolution 3.44.4-0ubuntu2 X-CMAE-Envelope: MS4xfCPDFDY395ST6mA3gPTFMlJ9fSlk0K8hTFu7G69nSs24iv9n8+JJ20zNoQbzU+Owh0wmp4tE538FvQtUlo7fh/jv86QTvFRIB6T/KYKlKKYzYKbYuA2z 1LKSH8336ce/69KyxsfNI15wEJaXYoHrVlDPKJhmpdPSA7HBTQwdj/5dFEW5mFLUhh62cKMcOqgUP0mt5dxzGZXXWWLOT6lSkkf8tEGnL9IDpQM5wvQubkSt ch04DNECxxUGDmLeGI+t5uCV6XqjjleOZBccza79XB8= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 2024-07-02 at 18:13 +0200, clipperDB@gmx.fr wrote: > =C2=A0 > Hi all > I don't know if it is the right mailing list, but i was wondering if > one could introspect via gdb the content of PGresult. > In my case i got a coredump and when i tried to analyze the core and > try to print the content of PGresult i got incomplete type > I'm using libpq-13.3 (installed via libpq-13.3-1.el8_4.x86_64, > RHEL8.5). Any help would be appreciated (i'm trying to get the > errMesg value of this field) > (gdb) p res > $1 =3D (PGresult *) 0x7f0718000b80 > (gdb) p *res > $2 =3D > (gdb) ptype res > type =3D struct pg_result { > =C2=A0 =C2=A0 > } * > (gdb) explore res > 'res' is a pointer to a value of type 'PGresult' > Continue exploring it as a pointer to a single value [y/n]: y > The value of '*res' is of type 'PGresult' which is a typedef of type > 'pg_result' > The value of '*res' is a struct/class of type 'pg_result' with no > fields. > (gdb)=C2=A0 > thanks for your hints > doris https://wiki.postgresql.org/wiki/Developer_FAQ#Why_do_we_use_Node_and_List_= to_make_data_structures.3F may be of help. Instead of printing values in gdb format, you can use the next two commands to print out List, Node, and structure contents in a verbose format that is easier to understand. Lists are unrolled into nodes, and nodes are printed in detail. The first prints in a short format, and the second in a long format: (gdb) call print(any_pointer) (gdb) call pprint(any_pointer) The output appears in the server log file, or on your screen if you are running a backend directly without a postmaster. I found that from https://wiki.postgresql.org/wiki/Developer_FAQ#gdb