* [PATCH] gdbserver switch ps_get_thread_area to PTRACE_GETREGSET
@ 2013-02-06 17:38 Marcus Shawcroft
2013-02-06 18:56 ` Pedro Alves
0 siblings, 1 reply; 2+ messages in thread
From: Marcus Shawcroft @ 2013-02-06 17:38 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 324 bytes --]
This patch switches the aarch64 gdbserver ps_get_thread_area()
implementation from PTRACE_GET_THREAD_AREA to PTRACE_GETREGSET.
OK?
/Marcus
2013-02-06 Marcus Shawcroft <marcus.shawcroft@arm.com>
* linux-aarch64-low.c (ps_get_thread_area): Replace
PTRACE_GET_THREAD_AREA with PTRACE_GETREGSET.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-AArch64-GDBServer-switch-from-PTRACE_GET_THREAD_AREA.patch --]
[-- Type: text/x-patch; name=0001-AArch64-GDBServer-switch-from-PTRACE_GET_THREAD_AREA.patch, Size: 1060 bytes --]
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);
+
+ 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;
}
--
1.7.9.5
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] gdbserver switch ps_get_thread_area to PTRACE_GETREGSET
2013-02-06 17:38 [PATCH] gdbserver switch ps_get_thread_area to PTRACE_GETREGSET Marcus Shawcroft
@ 2013-02-06 18:56 ` Pedro Alves
0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2013-02-06 18:56 UTC (permalink / raw)
To: Marcus Shawcroft; +Cc: gdb-patches
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-02-06 18:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-06 17:38 [PATCH] gdbserver switch ps_get_thread_area to PTRACE_GETREGSET Marcus Shawcroft
2013-02-06 18:56 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox