From: Pedro Alves <palves@redhat.com>
To: Marcus Shawcroft <marcus.shawcroft@arm.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] gdbserver switch ps_get_thread_area to PTRACE_GETREGSET
Date: Wed, 06 Feb 2013 18:56:00 -0000 [thread overview]
Message-ID: <5112A735.9020603@redhat.com> (raw)
In-Reply-To: <51129511.7070601@arm.com>
On 02/06/2013 05:38 PM, Marcus Shawcroft wrote:
>
> diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
> index 7f99887..e56ea80 100644
> --- a/gdb/gdbserver/linux-aarch64-low.c
> +++ b/gdb/gdbserver/linux-aarch64-low.c
> @@ -1089,16 +1089,22 @@ aarch64_stopped_by_watchpoint (void)
> /* Fetch the thread-local storage pointer for libthread_db. */
>
> ps_err_e
> -ps_get_thread_area (const struct ps_prochandle * ph,
> +ps_get_thread_area (const struct ps_prochandle *ph,
> lwpid_t lwpid, int idx, void **base)
> {
> - if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
> + struct iovec iovec;
> + CORE_ADDR reg;
> +
> + iovec.iov_base = ®
> + iovec.iov_len = sizeof (reg);
Something like 'uint64_t reg' would be better than assuming
gdb's own CORE_ADDR type is exactly 64-bit (although it
actually will be in practice).
OK with that change.
> +
> + if (ptrace (PTRACE_GETREGSET, lwpid, NT_ARM_TLS, &iovec) != 0)
> return PS_ERR;
>
> /* IDX is the bias from the thread pointer to the beginning of the
> thread descriptor. It has to be subtracted due to implementation
> quirks in libthread_db. */
> - *base = (void *) ((char *) *base - idx);
> + *base = (void *) (reg - idx);
>
> return PS_OK;
> }
--
Pedro Alves
prev parent reply other threads:[~2013-02-06 18:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-06 17:38 Marcus Shawcroft
2013-02-06 18:56 ` Pedro Alves [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=5112A735.9020603@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=marcus.shawcroft@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