From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17873 invoked by alias); 3 Nov 2009 16:12:27 -0000 Received: (qmail 17865 invoked by uid 22791); 3 Nov 2009 16:12:26 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Nov 2009 16:12:18 +0000 Received: (qmail 9953 invoked from network); 3 Nov 2009 16:12:16 -0000 Received: from unknown (HELO ?172.16.1.24?) (maxim@127.0.0.2) by mail.codesourcery.com with ESMTPA; 3 Nov 2009 16:12:16 -0000 Message-ID: <4AF05659.1070404@codesourcery.com> Date: Tue, 03 Nov 2009 16:12:00 -0000 From: Maxim Kuvyrkov User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: gdb-patches@sourceware.org CC: Andreas Schwab Subject: [PATCH, M68K] Handle TLS Content-Type: multipart/mixed; boundary="------------010105060908010103060307" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-11/txt/msg00052.txt.bz2 This is a multi-part message in MIME format. --------------010105060908010103060307 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 308 Hi, The following simple patch adds handling of TLS to m68k gdbserver. A corresponding kernel patch is being reviewed here . Tested on coldfire-linux. OK to apply? Thanks! -- Maxim Kuvyrkov CodeSourcery maxim@codesourcery.com (650) 331-3385 x724 --------------010105060908010103060307 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0"; name="fsf-gdb-cf-tls.ChangeLog" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="fsf-gdb-cf-tls.ChangeLog" Content-length: 132 2009-11-03 Maxim Kuvyrkov * linux-m68k-low.c: Include (ps_get_thread_area): Implement. --------------010105060908010103060307 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0"; name="fsf-gdb-cf-tls.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="fsf-gdb-cf-tls.patch" Content-length: 1041 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 + +/* 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, --------------010105060908010103060307--