public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: GDB Patches <gdb-patches@sourceware.org>, Eli Zaretskii <eliz@gnu.org>
Subject: Re: [PATCH v2] Fix segfault when using 'set print object on' + whatis <struct> (Re: [PATCH] Fix segfault when using 'set print object on' + whatis <struct>)
Date: Mon, 22 Jan 2018 19:53:00 -0000	[thread overview]
Message-ID: <89e94b33-96dd-474f-cfd6-56125aca7a6d@redhat.com> (raw)
In-Reply-To: <87tvvdbwho.fsf@redhat.com>

On 01/22/2018 06:04 PM, Sergio Durigan Junior wrote:
> On Monday, January 22 2018, Pedro Alves wrote:
> 
> /me prepares himself for the "this is completely wrong" e-mail
> 

:-)

>> On 01/20/2018 01:03 AM, Sergio Durigan Junior wrote:
>>> This problem was hidden behind a "maybe-uninitialized" warning
>>> generated when compiling GDB with a recent GCC.  The warning is:
>>>
>>>   ../../gdb/typeprint.c: In function 'void whatis_exp(const char*, int)':
>>>   ../../gdb/typeprint.c:515:12: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
>>>     real_type = value_rtti_type (val, &full, &top, &using_enc);
>>>     ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>
>>> I submitted a patch fixing this by initializing "val" to NULL, but it
>>> was the wrong fix, as Pedro pointed out on
>>> <https://sourceware.org/ml/gdb-patches/2018-01/msg00346.html>:
>>
>> IMHO, adding such history to the commit log directly doesn't really
>> add much here.  It's better IMO to leave that to "what changed in v2"
>> comments (that don't go in the commit log), and instead update
>> the commit log to go straight to the point.  (please keep reading.)
> 
> OK.  I personally think that it's good to document the actions and
> reactions that led me to writing this patch, but this is a small detail.

It's good to describe approaches that are
seemingly-obvious-but-then-don't-actually-work.  That spares the
reader/reviewer from going through the same thought process, and/or
immediately shooting back with a "why didn't you do it in the other
seemingly obvious way" question.   In this case, just explaining that
the warning is valid obviously switches the previous approach to
the "really-obviously-not-correct/incomplete" department, so there's
no need to explain it.  Commit messages are meant to help future
readers understand why changes were made, and being concise and to
the point helps.  The thing that led to the discovery of the issue
is the GCC warning, and that is still mentioned.

> Right, I should have added one more test to cover this case as well,
> sorry.

No worries.  This is team work.  :-)

>>
>> As I was writing/experimenting the above, I ended up addressing
>> my own comments.  What do you think of this patch instead?
> 
> The patch is yours now, so you should be listed as the author, and you
> will probably want to rewrite the subject line to make it more correct.
> Other than that, and after your e-mail, I don't really have the
> expertise to criticize anything.

I don't mind either way, but I've pushed the patch in respecting that.

And now I realize that this should be needed on the 8.1 branch too.
I'll take care of that.

Thanks,
Pedro Alves

  reply	other threads:[~2018-01-22 19:53 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <announce.20180105041805.3FC35808E9@joel.gnat.com>
2018-01-16 17:31 ` [ANNOUNCEMENT] GDB 8.1 release branch created! Eli Zaretskii
2018-01-16 19:02   ` Sergio Durigan Junior
2018-01-16 19:46     ` [PATCH] Fix warning on gdb/compile/compile.c (C++-ify "triplet_rx") Sergio Durigan Junior
2018-01-17 15:33       ` Eli Zaretskii
2018-01-17 17:17       ` Simon Marchi
2018-01-17 23:07         ` Sergio Durigan Junior
2018-01-17 23:42           ` Simon Marchi
2018-01-17 23:48             ` Sergio Durigan Junior
2018-01-16 20:32     ` [PATCH] Fix unitialized warning on gdb/typeprint.c:whatis_exp Sergio Durigan Junior
2018-01-17 15:34       ` Eli Zaretskii
2018-01-17 16:48       ` Pedro Alves
2018-01-17 18:03         ` Sergio Durigan Junior
2018-01-20  1:03       ` [PATCH] Fix segfault when using 'set print object on' + whatis <struct> Sergio Durigan Junior
2018-01-22 17:42         ` [PATCH v2] Fix segfault when using 'set print object on' + whatis <struct> (Re: [PATCH] Fix segfault when using 'set print object on' + whatis <struct>) Pedro Alves
2018-01-22 18:04           ` Sergio Durigan Junior
2018-01-22 19:53             ` Pedro Alves [this message]
2018-01-22 20:11               ` Sergio Durigan Junior
2018-01-16 20:36     ` [ANNOUNCEMENT] GDB 8.1 release branch created! Sergio Durigan Junior
2018-01-17  3:36       ` Eli Zaretskii
2018-01-17 16:46         ` Sergio Durigan Junior
2018-01-17 11:04       ` Pedro Alves
2018-01-17 16:38         ` Sergio Durigan Junior
2018-01-17 16:46           ` Eli Zaretskii
2018-01-17 16:50             ` Pedro Alves
2018-01-17 18:21               ` Eli Zaretskii
2018-01-18 15:53   ` Eli Zaretskii
2018-01-25 16:58     ` Eli Zaretskii
2018-01-26 14:18       ` Eli Zaretskii
2018-01-26 15:37         ` Simon Marchi
2018-01-26 18:53           ` Eli Zaretskii
2018-01-27 16:42             ` Eli Zaretskii
2018-02-01 15:12               ` Yao Qi
2018-02-01 16:27                 ` Eli Zaretskii
2018-02-01 16:51                   ` Yao Qi
2018-02-01 17:33                     ` Eli Zaretskii
2018-02-01 21:32                       ` Yao Qi
2018-02-02 15:23                         ` Eli Zaretskii
2018-02-02 15:53                           ` Joel Brobecker
2018-02-02 16:27                             ` Simon Marchi
2018-02-02 17:42                             ` Joseph Myers

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=89e94b33-96dd-474f-cfd6-56125aca7a6d@redhat.com \
    --to=palves@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=sergiodj@redhat.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).