public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb/exp] Fix printing of out of bounds struct members
Date: Wed, 24 Jan 2024 17:15:16 +0100	[thread overview]
Message-ID: <ee69cd12-3989-4df6-a51b-423c415d88bb@suse.de> (raw)
In-Reply-To: <87h6j5jpqh.fsf@tromey.com>

On 1/22/24 17:29, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
> 
> Tom> When building gdb with -O0 -fsanitize=address, and running test-case
> Tom> gdb.ada/uninitialized_vars.exp, I run into:
> Tom> ...
> 
> Thanks for looking into this.
> 
> Tom> - when y.a happens to be set to 216, as above, gdb interprets this as the
> Tom>   variable having the c+d variant (which is why trying to print y.b fails).
> 
> One thing I see here is that y.a is not one of the valid values.  So I
> wonder if this kind of corruption should be detected at a different
> spot, like throwing an exception from compute_variant_fields_inner.
> 

I've looked into that, but I think it requires a cleanup related to 
TYPE_CODE_BOOL, see this PR ( 
https://sourceware.org/bugzilla/show_bug.cgi?id=31282 ).  Currently 
there's no reliable way to determine what valid bool values are.  I've 
updated the commit message to mention this way of fixing it in the v2.

> Tom> [ Given the description at the top of gdb/value.h of optimized out and
> Tom> unavailable, I was not sure which one to pick for this case, so this is more
> Tom> or less a random choice.
> 
> Yeah, neither seems like precisely the right fit.

OK, I've updated v2 to use an error then.

V2: https://sourceware.org/pipermail/gdb-patches/2024-January/206200.html

Thanks,
- Tom


  reply	other threads:[~2024-01-24 16:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 13:28 Tom de Vries
2024-01-22 16:29 ` Tom Tromey
2024-01-24 16:15   ` Tom de Vries [this message]
2024-01-24 17:33     ` Tom Tromey
2024-01-25 12:56       ` Tom de Vries

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=ee69cd12-3989-4df6-a51b-423c415d88bb@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.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).