Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/exp] Fix printing of type of optimized out vla
Date: Wed, 18 Jul 2018 19:53:00 -0000	[thread overview]
Message-ID: <f2ff4d053355277a66716e693b8d47f8@polymtl.ca> (raw)
In-Reply-To: <20180703141821.wzcayjt4ykepdotg@delia>

On 2018-07-03 10:18, Tom de Vries wrote:
> Hi,
> 
> Consider this snippet from gcc/testsuite/gcc.dg/guality/vla-1.c:
> ...
> int __attribute__((noinline))
> f1 (int i)
> {
>   char a[i + 1];
>   a[0] = 5;             /* { dg-final { gdb-test .+1 "i" "5" } } */
>   return a[0];          /* { dg-final { gdb-test . "sizeof (a)" "6" } } 
> */
> }
> ...
> 
> When we compile the test-case with -O1 -g, and query the size of 
> optimized
> out vla 'a', we get:
> ...
> $ ./gdb -batch -ex "b f1" -ex "r" -ex "p sizeof (a)" vla-1.exe
> Breakpoint 1 at 0x4004a8: file vla-1.c, line 17.
> 
> Breakpoint 1, f1 (i=i@entry=5) at vla-1.c:17
> 17        return a[0];
> $1 = 0
> ...
> while we expect a size of '6'.
> 
> The problem is that default_read_var_value does not resolve the dynamic 
> type
> of a variable if the variable is optimized out.
> 
> This patch fixes that, and consequently gdb prints '6', as expected.
> 
> Tested on x86_64-linux.
> 
> OK for trunk?
> 
> Thanks,
> - Tom

Thanks, that LGTM.

Simon


      parent reply	other threads:[~2018-07-18 19:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-03 14:18 Tom de Vries
2018-07-13  6:16 ` [PING][PATCH][gdb/exp] " Tom de Vries
2018-07-18 19:53 ` 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=f2ff4d053355277a66716e693b8d47f8@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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