public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Sébastien Michelland" <sebastien.michelland@lcis.grenoble-inp.fr>
To: Simon Marchi <simark@simark.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: specify sh4al-dsp register types
Date: Mon, 1 Apr 2024 11:14:20 +0200	[thread overview]
Message-ID: <a3d2fdbe-0a59-404c-a2f1-0b9498e6ce71@lcis.grenoble-inp.fr> (raw)
In-Reply-To: <8121bf38-bf7e-4af0-9e22-f15c1ad60731@simark.ca>

On 2024-04-01 05:25, Simon Marchi wrote:
> On 2024-03-31 18:26, Sébastien Michelland wrote:
>> This avoids $pc and similar registers being interpreted as negative when
>> in the upper half of the address space (e.g. by x/i), which doesn't
>> interact well with Xfer memory maps.
>> ---
>>
>> Hi,
>>
>> This patch fixes a pretty funny issue for the sh4al-dsp resulting from
>> $pc being typed as an int. When $pc is in the upper half of the address
>> space, `x/i $pc' would resolve to a negative value. At least in the case
>> of a remote target with an Xfer memory map, this leads to a spurious
>> "cannot access memory" error as negative addresses are out of bounds.
>>
>> (gdb) x/i $pc
>>     0x8c202c04:	Cannot access memory at address 0x8c202c04
>> (gdb) x/i 0x8c202c04
>> => 0x8c202c04 <gintctl_gint_gdb+304>:	mov.l	@r1,r10
>>
>> Affected registers are pc, pr (return address of a call), gbr (base
>> register for some specific addressing modes), vbr (interrupt handler)
>> and spc (return address after interrupt).
>>
>> It's not immediately clear to me why existing sh variants don't also do
>> that. Maybe it should be considered an issue with the memory map, or
>> maybe it's just a rare enough condition to not care.
> 
> Hi Sébastien,
> 
> I would suggest including all that info in the commit message proper.
> If I were to do some git-blaming and fall on that commit, I would
> appreciate having all that info right there.
> 
> I checked a few other arches, and it seems customary for arches to
> indicate that the PC register and some others should be typed as a
> builtin_func_ptr (while the SP register and some others should be typed
> as a builtin_data_ptr).  The fact that the sh arch doesn't do it seems
> like an oversight.
> 
> Another effect of having the pc typed as an int is that printing it will
> show it as a decimal, without symbol resolution.

Hi Simon, thanks for checking this patch.

I didn't think much of it but I do also get the decimal printing.

> If you want to try to fix the behavior on all sh arches, feel free to do
> so.  But otherwise, the patch LGTM:
> 
> Approved-By: Simon Marchi <simon.marchi@efficios.com>
> 
> Let me know if you don't have push access and would like me to push it
> for you.

I'll submit a v2 to get that same behavior on all sh arches--it feels 
better to have a consistent interpretation.

I indeed don't have push access, thanks for your help.

Sébastien

      reply	other threads:[~2024-04-01  9:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-31 22:26 Sébastien Michelland
2024-04-01  3:25 ` Simon Marchi
2024-04-01  9:14   ` Sébastien Michelland [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=a3d2fdbe-0a59-404c-a2f1-0b9498e6ce71@lcis.grenoble-inp.fr \
    --to=sebastien.michelland@lcis.grenoble-inp.fr \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /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).