From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1336 invoked by alias); 8 Mar 2012 13:38:07 -0000 Received: (qmail 1227 invoked by uid 22791); 8 Mar 2012 13:38:06 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,TW_EG X-Spam-Check-By: sourceware.org Received: from mail-out.m-online.net (HELO mail-out.m-online.net) (212.18.0.9) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Mar 2012 13:37:52 +0000 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3V3Xpl0JpLz4KMZQ for ; Thu, 8 Mar 2012 14:37:50 +0100 (CET) X-Auth-Info: /3je1Ok0AAO5Af0Rn0kua5YSZYvU4qEORlHAja67cc8= Received: from igel.home (ppp-88-217-111-71.dynamic.mnet-online.de [88.217.111.71]) by mail.mnet-online.de (Postfix) with ESMTPA id 3V3Xpk5dTrz4KK6s for ; Thu, 8 Mar 2012 14:37:50 +0100 (CET) Received: by igel.home (Postfix, from userid 501) id 727B9CA2A1; Thu, 8 Mar 2012 14:37:50 +0100 (CET) From: Andreas Schwab To: gdb-patches@sourceware.org Subject: m68k-linux: fix thread debugging X-Yow: I'll take ROAST BEEF if you're out of LAMB!! Date: Thu, 08 Mar 2012 13:38:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: 2012-03/txt/msg00261.txt.bz2 2012-03-08 Andreas Schwab * m68klinux-nat.c: Include "gdb_proc_service.h". (PTRACE_GET_THREAD_AREA): Define. (ps_get_thread_area): New function. diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c index c7137c0..d4410e6 100644 --- a/gdb/m68klinux-nat.c +++ b/gdb/m68klinux-nat.c @@ -51,6 +51,13 @@ /* Prototypes for supply_gregset etc. */ #include "gregset.h" + +/* Defines ps_err_e, struct ps_prochandle. */ +#include "gdb_proc_service.h" + +#ifndef PTRACE_GET_THREAD_AREA +#define PTRACE_GET_THREAD_AREA 25 +#endif /* This table must line up with gdbarch_register_name in "m68k-tdep.c". */ static const int regmap[] = @@ -556,6 +563,24 @@ fetch_core_registers (struct regcache *regcache, } +/* 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 = (char *) *base - idx; + + return PS_OK; +} + + /* Register that we are able to handle GNU/Linux ELF core file formats. */ -- 1.7.9.3 -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."