From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2628 invoked by alias); 6 Sep 2013 08:40:32 -0000 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 Received: (qmail 2618 invoked by uid 89); 6 Sep 2013 08:40:32 -0000 Received: from ra.se.axis.com (HELO ra.se.axis.com) (195.60.68.13) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Sep 2013 08:40:32 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.5 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: ra.se.axis.com Received: from localhost (localhost [127.0.0.1]) by ra.se.axis.com (Postfix) with ESMTP id 5F60913B92; Fri, 6 Sep 2013 10:40:29 +0200 (CEST) Received: from ra.se.axis.com ([127.0.0.1]) by localhost (ra.se.axis.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id QHkoP1ZKhdp5; Fri, 6 Sep 2013 10:40:28 +0200 (CEST) Received: from boulder.se.axis.com (boulder.se.axis.com [10.0.2.104]) by ra.se.axis.com (Postfix) with ESMTP id 2CD9211DEC; Fri, 6 Sep 2013 10:40:28 +0200 (CEST) Received: from boulder.se.axis.com (localhost [127.0.0.1]) by postfix.imss71 (Postfix) with ESMTP id 16CD075D; Fri, 6 Sep 2013 10:40:28 +0200 (CEST) Received: from seth.se.axis.com (seth.se.axis.com [10.0.2.172]) by boulder.se.axis.com (Postfix) with ESMTP id 0B73E561; Fri, 6 Sep 2013 10:40:28 +0200 (CEST) Received: from xmail2.se.axis.com (xmail2.se.axis.com [10.0.5.74]) by seth.se.axis.com (Postfix) with ESMTP id 099283E06F; Fri, 6 Sep 2013 10:40:28 +0200 (CEST) Received: from lnxricardw.se.axis.com (10.88.7.1) by xmail2.se.axis.com (10.0.5.74) with Microsoft SMTP Server (TLS) id 8.2.255.0; Fri, 6 Sep 2013 10:40:27 +0200 Date: Fri, 06 Sep 2013 08:40:00 -0000 From: Ricard Wanderlof To: Pedro Alves CC: "gdb-patches@sourceware.org" Subject: Re: [PATCH v2][CRISv32] Add support for threaded debugging In-Reply-To: <5225F8E2.5090709@redhat.com> Message-ID: References: <5225F8E2.5090709@redhat.com> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8BIT X-SW-Source: 2013-09/txt/msg00209.txt.bz2 On Tue, 3 Sep 2013, Pedro Alves wrote: > On 09/03/2013 03:18 PM, Ricard Wanderlof wrote: > >> >> 2013-09-03 Ricard Wanderlof >> >> * cris-tdep.c: >> (cris_gdbarch_init): Add call to >> get_gdbarch_fetch_tls_load_module_address. > > Spurious ':' / wrong formatting: > > * cris-tdep.c (cris_gdbarch_init): Add call to > get_gdbarch_fetch_tls_load_module_address. > >> >> gdbserver >> >> * linux-crisv32-low.c: PTRACE_GET_THREAD_AREA: New macro. >> (ps_get_thread_area): New function. > > Wrong formatting: > > * linux-crisv32-low.c (PTRACE_GET_THREAD_AREA): New macro. > (ps_get_thread_area): New function. > > OK with those changes. Committed now. /Ricard Add support for threaded debugging for CRISv32. 2013-09-06 Ricard Wanderlof * cris-tdep.c (cris_gdbarch_init): Add call to get_gdbarch_fetch_tls_load_module_address. gdbserver * linux-crisv32-low.c (PTRACE_GET_THREAD_AREA): New macro. (ps_get_thread_area): New function. diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 1b0e3cd..ef2746d 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -4137,6 +4137,11 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_single_step_through_delay (gdbarch, crisv32_single_step_through_delay); + /* FIXME: Ricard W/2013-09-03: Linux-specific stuff like this + should really go in (a new) cris-linux-tdep.c. */ + set_gdbarch_fetch_tls_load_module_address (gdbarch, + svr4_fetch_objfile_link_map); + break; default: diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c index 2849d02..84cb7ff 100644 --- a/gdb/gdbserver/linux-crisv32-low.c +++ b/gdb/gdbserver/linux-crisv32-low.c @@ -27,6 +27,10 @@ extern const struct target_desc *tdesc_crisv32; /* CRISv32 */ #define cris_num_regs 49 +#ifndef PTRACE_GET_THREAD_AREA +#define PTRACE_GET_THREAD_AREA 25 +#endif + /* Note: Ignoring USP (having the stack pointer in two locations causes trouble without any significant gain). */ @@ -339,6 +343,20 @@ cris_stopped_data_address (void) return eda; } +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; +} + static void cris_fill_gregset (struct regcache *regcache, void *buf) { -- Ricard Wolf Wanderlöf ricardw(at)axis.com Axis Communications AB, Lund, Sweden www.axis.com Phone +46 46 272 2016 Fax +46 46 13 61 30