public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: John Baldwin <jhb@FreeBSD.org>
To: Luis Machado <luis.machado@arm.com>,
	binutils@sourceware.org, gdb-patches@sourceware.org
Subject: Re: [PATCH 02/12] fbsd-nat: Add helper routines for register sets using PT_[G]SETREGSET.
Date: Thu, 24 Mar 2022 10:45:12 -0700	[thread overview]
Message-ID: <71802c0a-ec75-6d2e-69f4-5ca0dc0bba7d@FreeBSD.org> (raw)
In-Reply-To: <b2ff95e7-56b0-a4a6-5e0b-b0a2f69dcf9a@arm.com>

On 3/24/22 1:51 AM, Luis Machado wrote:
> On 3/23/22 21:00, John Baldwin wrote:
>> FreeBSD's kernel has recently added PT_GETREGSET and PT_SETREGSET
>> operations to fetch a register set named by an ELF note type.  These
>> helper routines provide helpers to check for a register set's
>> existence, fetch registers for a register set, and store registers to
>> a register set.
>> ---
>>    gdb/fbsd-nat.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++
>>    gdb/fbsd-nat.h | 42 +++++++++++++++++++++++++++++
>>    2 files changed, 114 insertions(+)
>>
>> diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
>> index 934fdbad6ef..84abdd9a322 100644
>> --- a/gdb/fbsd-nat.c
>> +++ b/gdb/fbsd-nat.c
>> @@ -1772,6 +1772,78 @@ fbsd_nat_target::store_register_set (struct regcache *regcache, int regnum,
>>      return false;
>>    }
>>    
>> +#ifdef PT_GETREGSET
> 
> Instead of ifdef-ing the entire block of code, wouldn't it be better to
> conditionally define the constant and have the code do checks at runtime?
> 
> If GDB is built on a machine without the proper headers and copied onto
> a machine with support for PT_GETREGSET, it won't be able to use this
> improvement. On the other hand, if we build GDB on a machine with the
> headers, but copy it into a machine without support for PT_GETREGSET,
> things will break, no?

FreeBSD does not generally support forwards compatibility (the second case
of a newer binary on an older kernel), only backwards compatibility.
However, it is true that in the use cases for PT_GETREGSET for the
foreseeable future, they will all be conditioned on a runtime check
via the 'have_regset' function enabling an architecture feature, so I
could add a fallback for the macro and always enable these functions.  I
will go ahead and make that change.

-- 
John Baldwin

  reply	other threads:[~2022-03-24 17:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23 21:00 [PATCH 00/12] * Support for Thread Local Storage (TLS) variables on FreeBSD arm and aarch64 architectures John Baldwin
2022-03-23 21:00 ` [PATCH 01/12] Handle another edge case for TLS variable lookups John Baldwin
2022-03-23 23:55   ` John Baldwin
2022-03-23 21:00 ` [PATCH 02/12] fbsd-nat: Add helper routines for register sets using PT_[G]SETREGSET John Baldwin
2022-03-24  8:51   ` Luis Machado
2022-03-24 17:45     ` John Baldwin [this message]
2022-03-23 21:00 ` [PATCH 03/12] Create pseudo sections for NT_ARM_TLS notes on FreeBSD John Baldwin
2022-03-23 21:00 ` [PATCH 04/12] Add an arm-tls feature which includes the tpidruro register from CP15 John Baldwin
2022-04-04  8:01   ` Luis Machado
2022-04-12 23:36     ` John Baldwin
2022-04-14 10:23       ` Luis Machado
2022-04-19 16:18         ` John Baldwin
2022-04-20  6:59           ` Luis Machado
2022-03-23 21:00 ` [PATCH 05/12] Read the tpidruro register from NT_ARM_TLS core dump notes on FreeBSD/arm John Baldwin
2022-03-23 21:00 ` [PATCH 06/12] Support TLS variables " John Baldwin
2022-03-23 21:00 ` [PATCH 07/12] Fetch the NT_ARM_TLS register set for native FreeBSD/arm processes John Baldwin
2022-03-23 21:00 ` [PATCH 08/12] Add an aarch64-tls feature which includes the tpidr register John Baldwin
2022-03-28 10:16   ` Luis Machado
2022-04-01 23:30     ` John Baldwin
2022-04-04  8:06       ` Luis Machado
2022-04-04 12:18         ` Luis Machado
2022-05-03 21:14   ` Luis Machado
2022-03-23 21:00 ` [PATCH 09/12] Read the tpidr register from NT_ARM_TLS core dump notes on FreeBSD/Aarch64 John Baldwin

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=71802c0a-ec75-6d2e-69f4-5ca0dc0bba7d@FreeBSD.org \
    --to=jhb@freebsd.org \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    --cc=luis.machado@arm.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).