public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: Patrick Frants <osscontribute@gmail.com>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH 1/2] In cp_print_value_fields() obey dont_print_statmem=1 explicitly passed from cp_print_static_field()
Date: Wed, 18 Oct 2017 13:39:00 -0000	[thread overview]
Message-ID: <0d0edd05-2367-b966-9558-8e08175f8e4e@ericsson.com> (raw)
In-Reply-To: <20171018131729.23137-1-osscontribute@gmail.com>

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

      parent reply	other threads:[~2017-10-18 13:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-18 13:17 Patrick Frants
2017-10-18 13:17 ` [PATCH 2/2] Add unit test for bug 13669 "Infinite recursion in cp_print_value_fields" Patrick Frants
2017-10-18 13:39 ` Simon Marchi [this message]

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=0d0edd05-2367-b966-9558-8e08175f8e4e@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    --cc=osscontribute@gmail.com \
    /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: link
Be 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).