aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-12-23 12:55:10 -0700
committerTom Tromey <tom@tromey.com>2023-01-09 12:16:02 -0700
commitbf716a53bd8f725975979397b3c6b9d4bd4434ef (patch)
tree472d2628a581b225e82347da900f37ccc4fdd720 /gdb/eval.c
parent000f9cbef95caeacdd5a02a9ca9eae7928e1e63e (diff)
downloadfsf-binutils-gdb-bf716a53bd8f725975979397b3c6b9d4bd4434ef.zip
fsf-binutils-gdb-bf716a53bd8f725975979397b3c6b9d4bd4434ef.tar.gz
fsf-binutils-gdb-bf716a53bd8f725975979397b3c6b9d4bd4434ef.tar.bz2
Fix crash with C++ qualified names
PR c++/29503 points out that something like "b->Base::member" will crash when 'b' does not have pointer type. This seems to be a simple oversight in eval_op_member. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29503 Reviewed-By: Bruno Larsen <blarsen@redhat.com>
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index 05e3594..bb42e69 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1309,6 +1309,8 @@ eval_op_member (struct type *expect_type, struct expression *exp,
case TYPE_CODE_MEMBERPTR:
/* Now, convert these values to an address. */
+ if (check_typedef (value_type (arg1))->code () != TYPE_CODE_PTR)
+ arg1 = value_addr (arg1);
arg1 = value_cast_pointers (lookup_pointer_type (TYPE_SELF_TYPE (type)),
arg1, 1);