Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Maxim Kuvyrkov <maxim@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Andreas Schwab <schwab@redhat.com>
Subject: [PATCH, M68K] Handle TLS
Date: Tue, 03 Nov 2009 16:12:00 -0000	[thread overview]
Message-ID: <4AF05659.1070404@codesourcery.com> (raw)

[-- 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,

             reply	other threads:[~2009-11-03 16:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-03 16:12 Maxim Kuvyrkov [this message]
2009-11-03 23:08 ` Daniel Jacobowitz
2009-11-04  8:26   ` Maxim Kuvyrkov
2010-05-19 15:06     ` Maxim Kuvyrkov

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=4AF05659.1070404@codesourcery.com \
    --to=maxim@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=schwab@redhat.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