diff options
author | Tom de Vries <tdevries@suse.de> | 2022-07-05 22:41:25 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2022-07-05 22:41:25 +0200 |
commit | 22f8e2e726629e7f09a49c66a6a2f746a49ba479 (patch) | |
tree | 169ce874f5765641ecc0ea93c2034ff5a6023cb3 /gdb/cp-valprint.c | |
parent | 99298c958c5393402cd2bc2885c195838a9dd363 (diff) | |
download | gdb-22f8e2e726629e7f09a49c66a6a2f746a49ba479.zip gdb-22f8e2e726629e7f09a49c66a6a2f746a49ba479.tar.gz gdb-22f8e2e726629e7f09a49c66a6a2f746a49ba479.tar.bz2 |
[gdb/exp] Fix internal error when printing C++ pointer-to-member
When running the test-case included with this patch, we run into:
...
(gdb) print ptm^M
$1 = gdb/gdbtypes.h:695: internal-error: loc_bitpos: \
Assertion `m_loc_kind == FIELD_LOC_KIND_BITPOS' failed.^M
...
while printing a c++ pointer-to-member.
Fix this by skipping static fields in cp_find_class_member, such that we have:
...
(gdb) print ptm^M
$1 = &A::i^M
...
Tested on x86_64-linux.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29294
Diffstat (limited to 'gdb/cp-valprint.c')
-rw-r--r-- | gdb/cp-valprint.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 43a5269..1d7dafc 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -636,7 +636,10 @@ cp_find_class_member (struct type **self_p, int *fieldno, for (i = TYPE_N_BASECLASSES (self); i < len; i++) { - LONGEST bitpos = self->field (i).loc_bitpos (); + field &f = self->field (i); + if (field_is_static (&f)) + continue; + LONGEST bitpos = f.loc_bitpos (); QUIT; if (offset == bitpos) |