public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: John Baldwin <jhb@FreeBSD.org>
To: Thiago Jung Bauermann <thiago.bauermann@linaro.org>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH v2] gdb/arm: Remove tpidruro register from non-FreeBSD target descriptions
Date: Wed, 28 Feb 2024 11:10:56 -0800	[thread overview]
Message-ID: <44e4bc44-f58b-435f-ba1e-58fb949c5b09@FreeBSD.org> (raw)
In-Reply-To: <20240228031042.375726-1-thiago.bauermann@linaro.org>

On 2/27/24 7:10 PM, Thiago Jung Bauermann wrote:
> Commit 92d48a1e4eac ("Add an arm-tls feature which includes the tpidruro
> register from CP15.") introduced the org.gnu.gdb.arm.tls feature, which
> adds the tpidruro register, and unconditionally enabled it in
> aarch32_create_target_description.
> 
> In Linux, the tpidruro register isn't available via ptrace in the 32-bit
> kernel but it is available for an aarch32 program running under an arm64
> kernel via the ptrace compat interface.  This isn't currently implemented
> however, which causes GDB on arm-linux with 64-bit kernel to list the
> register but show it as unavailable, as reported by Tom de Vries:
> 
>    $ gdb -q -batch a.out -ex start -ex 'p $tpidruro'
>    Temporary breakpoint 1 at 0x512
> 
>    Temporary breakpoint 1, 0xaaaaa512 in main ()
>    $1 = <unavailable>
> 
> Simon Marchi then clarified:
> 
>> The only time we should be seeing some "unavailable" registers or memory
>> is in the context of tracepoints, for things that are not collected.
>> Seeing an unavailable register here is a sign that something is not
>> right.
> 
> Therefore, disable the TLS feature in aarch32 target descriptions for Linux
> and NetBSD targets (the latter also doesn't seem to support accessing
> tpidruro either, based on a quick look at arm-netbsd-nat.c).
> 
> This patch fixes the following tests:
> 
> Running gdb.base/inline-frame-cycle-unwind.exp ...
> FAIL: gdb.base/inline-frame-cycle-unwind.exp: cycle at level 3: backtrace when the unwind is broken at frame 3
> FAIL: gdb.base/inline-frame-cycle-unwind.exp: cycle at level 5: backtrace when the unwind is broken at frame 5
> FAIL: gdb.base/inline-frame-cycle-unwind.exp: cycle at level 1: backtrace when the unwind is broken at frame 1
> 
> Tested with Ubuntu 22.04.3 on armv8l-linux-gnueabihf in native,
> native-gdbserver and native-extended-gdbserver targets with no regressions.
> 
> PR tdep/31418
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31418
> ---
> 
> Hello,
> 
> As often happens, after I sent v1 of this patch I noticed a problem with it:
> It introduces two variants of aarch32 target description (one with TLS
> support and one without), but only creates and returns the first one that was
> requested.  This version fixes the problem.
> 
> The only change compared to v1 is in gdb/aarch32-tdep.c.
> 
> Changes in v2:
> - Cache two versions of tdesc_aarch32 in aarch32_read_description, one with
> TLS support and one without.t

Good catch, V2 looks ok to me as well.

Approved-By: John Baldwin <jhb@FreeBSD.org>

-- 
John Baldwin


  reply	other threads:[~2024-02-28 19:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28  3:10 Thiago Jung Bauermann
2024-02-28 19:10 ` John Baldwin [this message]
2024-02-29 15:34   ` Thiago Jung Bauermann

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=44e4bc44-f58b-435f-ba1e-58fb949c5b09@FreeBSD.org \
    --to=jhb@freebsd.org \
    --cc=gdb-patches@sourceware.org \
    --cc=thiago.bauermann@linaro.org \
    /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).