public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: GDB Patches <gdb-patches@sourceware.org>,  Eli Zaretskii <eliz@gnu.org>
Subject: Re: [PATCH] Fix unitialized warning on gdb/typeprint.c:whatis_exp
Date: Wed, 17 Jan 2018 18:03:00 -0000	[thread overview]
Message-ID: <87fu74fjmy.fsf@redhat.com> (raw)
In-Reply-To: <c777d6d6-cf3d-3dab-69bd-7d67d42d8c14@redhat.com> (Pedro Alves's	message of "Wed, 17 Jan 2018 16:47:51 +0000")

On Wednesday, January 17 2018, Pedro Alves wrote:

> On 01/16/2018 08:32 PM, Sergio Durigan Junior wrote:
>> This simple patch initializes "struct value *val" to NULL, which
>> silences a when compiling GDB with certain GCC versions.
>
> Please include a representative paste of warnings in git logs.
> It makes it easier to see what a patch/commit is about.

Will do.

>> This warning is technically incorrect, because there is now way that
>> "val" will be used unitialized if you look at the code flow, but it's
>> a simple "fix" and doesn't do any harm.
>
> No, it's not incorrect.  It's showing a real bug.  Try, e.g.:
>
> (gdb) set print object on
> (gdb) whatis some_structure_type
>
> Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
> 0x00000000005dda90 in check_typedef (type=0x6120736573756170) at src/gdb/gdbtypes.c:2388
> 2388      int instance_flags = TYPE_INSTANCE_FLAGS (type);
> (top-gdb) bt
> #0  0x00000000005dda90 in check_typedef(type*) (type=0x6120736573756170) at src/gdb/gdbtypes.c:2388
> #1 0x00000000005e63fb in gnuv3_rtti_type(value*, int*, LONGEST*, int*)
> (value=0xdf21b7, full_p=0x7fffffffd180, top_p=0x7fffffffd188,
> using_enc_p=0x7fffffffd184) at src/gdb/gnu-v3-abi.c:293
> #2  0x000000000055f7d8 in value_rtti_type(value*, int*, long*, int*) (v=0xdf21b7, full=0x7fffffffd180, top=0x7fffffffd188, using_enc=0x7fffffffd184) at src/gdb/cp-abi.c:117
> #3  0x00000000006cc61f in whatis_exp(char const*, int) (exp=<optimized out>, show=-1) at src/gdb/typeprint.c:515
> #4  0x0000000000472462 in cmd_func(cmd_list_element*, char const*, int) (cmd=<optimized out>, args=<optimized out>, from_tty=<optimized out>)
>     at src/gdb/cli/cli-decode.c:1886
> #5  0x00000000006b833a in execute_command(char const*, int) (p=<optimized out>, from_tty=1) at src/gdb/top.c:630
> #6  0x00000000005c0f8c in command_handler(char const*) (command=0xdf21b0 "whatis siginfo_t") at src/gdb/event-top.c:583
> #7  0x00000000005c12d8 in command_line_handler(char*) (rl=<optimized out>) at /home/pedro/gdb/mygit/src/gdb/event-top.c:774
> ...

Ah, I totally missed that.  Sorry about jumping into the conclusion that
it was incorrect.

I'll try to investigate what's happening here.

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

  reply	other threads:[~2018-01-17 18:03 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 [this message]
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
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=87fu74fjmy.fsf@redhat.com \
    --to=sergiodj@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@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).