This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/2] In cp_print_value_fields() obey dont_print_statmem=1 explicitly passed from cp_print_static_field()
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: Patrick Frants <osscontribute at gmail dot com>, <gdb-patches at sourceware dot org>
- Date: Wed, 18 Oct 2017 09:39:09 -0400
- Subject: Re: [PATCH 1/2] In cp_print_value_fields() obey dont_print_statmem=1 explicitly passed from cp_print_static_field()
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=simon dot marchi at ericsson dot com;
- References: <20171018131729.23137-1-osscontribute@gmail.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 2017-10-18 09:17 AM, Patrick Frants wrote:
> This fixes Bug gdb/13669 (https://sourceware.org/bugzilla/show_bug.cgi?id=13669)
>
> cp_print_value_fields() in cp-valprint.c optionally skips static members based on options->static_field_print. Additionally cp_print_value_fields() has a parameter dont_print_statmem, which instructs the current invocation to skip static members. The "if () continue" statement (line 236) fails to take into account this parameter and therefore gdb gets into an infinite recursion involving cp_print_value_fields() and cp_print_static_field().
Hi Patrick,
Thanks for taking the time to provide a patch and test case, it's really appreciated.
I haven't looked at the patch in details, as I would need more time to get familiar with that code, but I ran the gdb.cp tests and noticed two failures in gdb.cp/classes.exp:
-PASS: gdb.cp/classes.exp: print csi with static members
-PASS: gdb.cp/classes.exp: print cnsi with static members
+FAIL: gdb.cp/classes.exp: print csi with static members
+FAIL: gdb.cp/classes.exp: print cnsi with static members
The problem seems to be with the message "same as static member..." not appearing. Before:
2377 print csi^M
2378 $39 = {x = 10, y = 20, static null = {x = 0, y = 0, static null = <same as static member of an already seen type>}}^M
2379 (gdb) PASS: gdb.cp/classes.exp: print csi with static members
After:
2377 print csi^M
2378 $39 = {x = 10, y = 20, static null = {x = 0, y = 0}}^M
2379 (gdb) FAIL: gdb.cp/classes.exp: print csi with static members
You can try running the C++-specific tests by running this in the gdb/ dir:
make check TESTS="gdb.cp/*.exp"
The test result summary is in testsuite/gdb.sum. However, some tests are already
broken. So what you should do is compare the gdb.sum of two test runs, without and
with your patch applied (don't forget to rebuild gdb in between). To analyze
failures, look in testsuite/gdb.log.
More tips on running the testsuite here:
https://sourceware.org/gdb/wiki/TestingGDB
Simon