public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug varobj/27757] -var-list-children coredump Date: Thu, 22 Apr 2021 19:05:40 +0000 [thread overview] Message-ID: <bug-27757-4717-dwLh1GiAuk@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-27757-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=27757 --- Comment #16 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> --- The gdb-10-branch branch has been updated by Simon Marchi <simark@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a2602365509739da6f611d1668eebdb8ea1bffec commit a2602365509739da6f611d1668eebdb8ea1bffec Author: Simon Marchi <simon.marchi@polymtl.ca> Date: Thu Apr 22 15:05:18 2021 -0400 gdb: fix getting range of flexible array member in Python As reported in bug 27757, we get an internal error when doing: $ cat test.c struct foo { int len; int items[]; }; struct foo *p; int main() { return 0; } $ gcc test.c -g -O0 -o test $ ./gdb -q -nx --data-directory=data-directory ./test -ex 'python gdb.parse_and_eval("p").type.target()["items"].type.range()' Reading symbols from ./test... /home/simark/src/binutils-gdb/gdb/gdbtypes.h:435: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) This is because the Python code (typy_range) blindly reads the high bound of the type of `items` as a constant value. Since it is a flexible array member, it has no high bound, the property is undefined. Since commit 8c2e4e0689 ("gdb: add accessors to struct dynamic_prop"), the getters check that you are not getting a property value of the wrong kind, so this causes a failed assertion. Fix it by checking if the property is indeed a constant value before accessing it as such. Otherwise, use 0. This restores the previous GDB behavior: because the structure was zero-initialized, this is what was returned before. But now this behavior is explicit and not accidental. Add a test, gdb.python/flexible-array-member.exp, that is derived from gdb.base/flexible-array-member.exp. It tests the same things, but through the Python API. It also specifically tests getting the range from the various kinds of flexible array member types (AFAIK it wasn't possible to do the equivalent through the CLI). gdb/ChangeLog: PR gdb/27757 * python/py-type.c (typy_range): Check that bounds are constant before accessing them as such. * guile/scm-type.c (gdbscm_type_range): Likewise. gdb/testsuite/ChangeLog: PR gdb/27757 * gdb.python/flexible-array-member.c: New test. * gdb.python/flexible-array-member.exp: New test. * gdb.guile/scm-type.exp (test_range): Add test for flexible array member. * gdb.guile/scm-type.c (struct flex_member): New. (main): Use it. Change-Id: Ibef92ee5fd871ecb7c791db2a788f203dff2b841 -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2021-04-22 19:05 UTC|newest] Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-20 8:18 [Bug varobj/27757] New: " ilia.motornyi at jetbrains dot com 2021-04-20 8:19 ` [Bug varobj/27757] " ilia.motornyi at jetbrains dot com 2021-04-20 8:20 ` ilia.motornyi at jetbrains dot com 2021-04-20 8:21 ` ilia.motornyi at jetbrains dot com 2021-04-20 8:21 ` ilia.motornyi at jetbrains dot com 2021-04-20 10:54 ` ilia.motornyi at jetbrains dot com 2021-04-21 20:03 ` tromey at sourceware dot org 2021-04-21 20:10 ` tromey at sourceware dot org 2021-04-21 20:13 ` tromey at sourceware dot org 2021-04-21 20:15 ` tromey at sourceware dot org 2021-04-21 20:44 ` ilia.motornyi at jetbrains dot com 2021-04-21 21:13 ` simark at simark dot ca 2021-04-21 21:16 ` simark at simark dot ca 2021-04-22 7:07 ` ilia.motornyi at jetbrains dot com 2021-04-22 8:15 ` ilia.motornyi at jetbrains dot com 2021-04-22 13:50 ` simark at simark dot ca 2021-04-22 14:13 ` simark at simark dot ca 2021-04-22 19:02 ` cvs-commit at gcc dot gnu.org 2021-04-22 19:05 ` cvs-commit at gcc dot gnu.org [this message] 2021-04-22 19:08 ` simark at simark dot ca 2021-04-23 6:11 ` ilia.motornyi at jetbrains dot com 2021-04-23 15:22 ` tromey at sourceware dot org 2021-06-27 17:44 ` ahmedsayeed1982 at yahoo dot com 2021-08-09 9:38 ` phillipsaeverett84 at gmail dot com 2021-08-09 9:55 ` mark at klomp dot org 2021-08-17 2:04 ` ampva300 at gmail dot com 2021-08-17 2:05 ` ampva300 at gmail dot com 2021-08-24 19:51 ` okedf at rover dot info 2021-09-02 11:06 ` donipah907 at mtlcz dot com 2021-09-05 7:35 ` kimolsun2020 at yahoo dot com 2021-09-06 9:08 ` focixujo at livinginsurance dot co.uk 2021-09-06 9:13 ` focixujo at livinginsurance dot co.uk 2021-09-10 19:37 ` mehmetgelisin at aol dot com 2021-10-09 11:00 ` gulsenenginar at aol dot com 2021-10-09 17:45 ` svitvitraga at gmail dot com 2021-10-19 7:13 ` progonsaytu at gmail dot com 2021-10-20 9:21 ` jaj058080 at gmail dot com 2021-10-24 10:01 ` glassmtech at ukr dot net 2021-11-13 19:34 ` tesaso8237 at funboxcn dot com 2021-11-22 6:48 ` gexed96894 at keagenan dot com 2021-11-25 11:39 ` joyruth102798 at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-27757-4717-dwLh1GiAuk@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).