Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH, M68K] Handle TLS
@ 2009-11-03 16:12 Maxim Kuvyrkov
  2009-11-03 23:08 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Maxim Kuvyrkov @ 2009-11-03 16:12 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andreas Schwab

[-- Attachment #1: Type: text/plain, Size: 308 bytes --]

Hi,

The following simple patch adds handling of TLS to m68k gdbserver.

A corresponding kernel patch is being reviewed here 
<http://marc.info/?l=linux-m68k&m=125447760017098&w=2>.

Tested on coldfire-linux.

OK to apply?

Thanks!

-- 
Maxim Kuvyrkov
CodeSourcery
maxim@codesourcery.com
(650) 331-3385 x724

[-- Attachment #2: fsf-gdb-cf-tls.ChangeLog --]
[-- Type: text/plain, Size: 132 bytes --]

2009-11-03  Maxim Kuvyrkov  <maxim@codesourcery.com>

	* linux-m68k-low.c: Include <asm/ptrace.h>
	(ps_get_thread_area): Implement.

[-- Attachment #3: fsf-gdb-cf-tls.patch --]
[-- Type: text/plain, Size: 1041 bytes --]

Index: gdb/gdbserver/linux-m68k-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-m68k-low.c,v
retrieving revision 1.13
diff -u -p -r1.13 linux-m68k-low.c
--- gdb/gdbserver/linux-m68k-low.c	3 Jan 2009 05:57:57 -0000	1.13
+++ gdb/gdbserver/linux-m68k-low.c	3 Nov 2009 15:47:25 -0000
@@ -154,6 +154,25 @@ m68k_breakpoint_at (CORE_ADDR pc)
   return 0;
 }
 
+#include <asm/ptrace.h>
+
+/* Fetch the thread-local storage pointer for libthread_db.  */
+
+ps_err_e
+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)
+    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);
+
+  return PS_OK;
+}
+
 struct linux_target_ops the_low_target = {
   init_registers_m68k,
   m68k_num_regs,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH, M68K] Handle TLS
  2009-11-03 16:12 [PATCH, M68K] Handle TLS Maxim Kuvyrkov
@ 2009-11-03 23:08 ` Daniel Jacobowitz
  2009-11-04  8:26   ` Maxim Kuvyrkov
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2009-11-03 23:08 UTC (permalink / raw)
  To: Maxim Kuvyrkov; +Cc: gdb-patches, Andreas Schwab

On Tue, Nov 03, 2009 at 07:12:09PM +0300, Maxim Kuvyrkov wrote:
> Hi,
> 
> The following simple patch adds handling of TLS to m68k gdbserver.
> 
> A corresponding kernel patch is being reviewed here
> <http://marc.info/?l=linux-m68k&m=125447760017098&w=2>.
> 
> Tested on coldfire-linux.
> 
> OK to apply?

This is fine with two caveats:

* I think it would be best to not apply it until you have an ack for
the kernel patch defining PTRACE_GET_THREAD_AREA.

* Provide a fallback definition for PTRACE_GET_THREAD_AREA.  I assume
existing m68k kernel headers do not define it, so the build would
fail.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH, M68K] Handle TLS
  2009-11-03 23:08 ` Daniel Jacobowitz
@ 2009-11-04  8:26   ` Maxim Kuvyrkov
  2010-05-19 15:06     ` Maxim Kuvyrkov
  0 siblings, 1 reply; 4+ messages in thread
From: Maxim Kuvyrkov @ 2009-11-04  8:26 UTC (permalink / raw)
  To: Maxim Kuvyrkov, gdb-patches, Andreas Schwab

Daniel Jacobowitz wrote:
> On Tue, Nov 03, 2009 at 07:12:09PM +0300, Maxim Kuvyrkov wrote:
>> Hi,
>>
>> The following simple patch adds handling of TLS to m68k gdbserver.
>>
>> A corresponding kernel patch is being reviewed here
>> <http://marc.info/?l=linux-m68k&m=125447760017098&w=2>.
>>
>> Tested on coldfire-linux.
>>
>> OK to apply?
> 
> This is fine with two caveats:
> 
> * I think it would be best to not apply it until you have an ack for
> the kernel patch defining PTRACE_GET_THREAD_AREA.

OK, that may take a while though.
> 
> * Provide a fallback definition for PTRACE_GET_THREAD_AREA.  I assume
> existing m68k kernel headers do not define it, so the build would
> fail.

OK.

Thanks for the review!

-- 
Maxim Kuvyrkov
CodeSourcery
maxim@codesourcery.com
(650) 331-3385 x724


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH, M68K] Handle TLS
  2009-11-04  8:26   ` Maxim Kuvyrkov
@ 2010-05-19 15:06     ` Maxim Kuvyrkov
  0 siblings, 0 replies; 4+ messages in thread
From: Maxim Kuvyrkov @ 2010-05-19 15:06 UTC (permalink / raw)
  To: Maxim Kuvyrkov; +Cc: gdb-patches, Andreas Schwab

On 11/4/09 11:26 AM, Maxim Kuvyrkov wrote:
> Daniel Jacobowitz wrote:
>> On Tue, Nov 03, 2009 at 07:12:09PM +0300, Maxim Kuvyrkov wrote:
>>> Hi,
>>>
>>> The following simple patch adds handling of TLS to m68k gdbserver.
>>>
>>> A corresponding kernel patch is being reviewed here
>>> <http://marc.info/?l=linux-m68k&m=125447760017098&w=2>.
>>>
>>> Tested on coldfire-linux.
>>>
>>> OK to apply?
>>
>> This is fine with two caveats:
>>
>> * I think it would be best to not apply it until you have an ack for
>> the kernel patch defining PTRACE_GET_THREAD_AREA.
>
> OK, that may take a while though.
>>
>> * Provide a fallback definition for PTRACE_GET_THREAD_AREA. I assume
>> existing m68k kernel headers do not define it, so the build would
>> fail.
>
> OK.

The kernel patches implementing NPTL support and PTRACE_GET_THREAD_AREA 
were checked in several months ago.

I have now checked this GDB patch with definition of ps_get_thread_area 
conditioned on "#ifdef PTRACE_GET_THREAD_AREA".

Regards,

-- 
Maxim Kuvyrkov
CodeSourcery
maxim@codesourcery.com
(650) 331-3385 x724


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-19 14:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-03 16:12 [PATCH, M68K] Handle TLS Maxim Kuvyrkov
2009-11-03 23:08 ` Daniel Jacobowitz
2009-11-04  8:26   ` Maxim Kuvyrkov
2010-05-19 15:06     ` Maxim Kuvyrkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox