This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/22242] recursive display of variable information
- From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Fri, 30 Mar 2018 22:30:33 +0000
- Subject: [Bug c++/22242] recursive display of variable information
- Auto-submitted: auto-generated
- References: <bug-22242-4717@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=22242
--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The fixes branch has been updated by Weimin Pan <wmpan@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c9cf7302418ad14b7f72949ba0421b9df3cd1127
commit c9cf7302418ad14b7f72949ba0421b9df3cd1127
Author: Weimin Pan <weimin.pan@oracle.com>
Date: Wed Mar 28 13:23:48 2018 -0600
Fix infinite recursion when printing static member with typedef
The original problem was fixed (see related PR 22242). But using a typedef
as the declared type for a static member variable, as commented in this PR,
is still causing gdb to get into infinite loop when printing the static
member's value. This problem can be reproduced as follows:
% cat t.cc
class A {
typedef A type;
public:
bool operator==(const type& other) { return true; }
static const type INSTANCE;
};
const A A::INSTANCE;
int main() {
A a;
if (a == A::INSTANCE) {
return -1;
}
return 0;
}
% g++ -g t.cc
% gdb -ex "start" -ex "p a" a.out
The fix is rather trivial - in cp_print_static_field(), should call
check_typedef() to get the static member's real type and use it to
check whether it's a struct or an array.
As Simon suggested, I've added a new test case to the testsuite
and am passing the original type, not the real type, as argument
to both cp_print_value_fields() and val_print().
Re-tested on both aarch64-linux-gnu and amd64-linux-gnu. No regressions.
--
You are receiving this mail because:
You are on the CC list for the bug.