public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Pedro Alves <pedro@palves.net>
Cc: gdb-patches@sourceware.org, Tom Tromey <tom@tromey.com>,
	Tom de Vries <tdevries@suse.de>
Subject: Re: [PATCH] [gdb/exp] Fix cast handling for indirection
Date: Sun, 5 May 2024 17:54:39 -0700	[thread overview]
Message-ID: <20240505175439.4a1c3317@f40-zbm-amd> (raw)
In-Reply-To: <1b81045d-5353-49cf-b80e-f64498dd3562@palves.net>

On Sat, 4 May 2024 00:26:49 +0100
Pedro Alves <pedro@palves.net> wrote:

> I kind of emphasized the sign extension part above, but to be clear, with
> 
>   (gdb) p (long long)*a_loc()
> 
> and gdb assuming that means a_loc returns "long long *", gdb incorrectly reads a
> 64-bit value off of the pointer address, which is totally bogus and would not
> be what gdb would do if it had debug info for a_loc(), in which case GDB would
> know that it returns char *, and thus would deref only one byte and behave like
> described above in the 1: 2: 3: steps.  The behavior of the expression should not
> change like that depending on whether you have debug info.  Thus, GDB should error
> out.

This argument is compelling.  You've convinced me.

Kevin


  reply	other threads:[~2024-05-06  0:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02 15:49 Tom de Vries
2024-05-03  2:31 ` Kevin Buettner
2024-05-03  7:37   ` Tom de Vries
2024-05-03 15:27   ` Tom Tromey
2024-05-03 16:04     ` Pedro Alves
2024-05-03 17:30       ` Kevin Buettner
2024-05-03 23:17         ` Pedro Alves
2024-05-03 23:26           ` Pedro Alves
2024-05-06  0:54             ` Kevin Buettner [this message]
2024-05-06  6:52               ` 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=20240505175439.4a1c3317@f40-zbm-amd \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    --cc=tdevries@suse.de \
    --cc=tom@tromey.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).