From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19327 invoked by alias); 8 Aug 2011 08:30:27 -0000 Received: (qmail 19299 invoked by uid 22791); 8 Aug 2011 08:30:24 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 08 Aug 2011 08:30:00 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3) with ESMTP id p788SV3Z023035; Mon, 8 Aug 2011 10:28:31 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id p788SSjq018524; Mon, 8 Aug 2011 10:28:28 +0200 (CEST) Date: Mon, 08 Aug 2011 08:30:00 -0000 Message-Id: <201108080828.p788SSjq018524@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: yao@codesourcery.com CC: vapier@gentoo.org, gdb-patches@sourceware.org In-reply-to: <4E3F4E05.6010409@codesourcery.com> (message from Yao Qi on Mon, 08 Aug 2011 10:46:29 +0800) Subject: Re: [RFA 4/8] New port: TI C6x: Read loadmap from gdbserver References: <4E263865.2070100@codesourcery.com> <4E2CF0C6.2060504@codesourcery.com> <201108072030.02712.vapier@gentoo.org> <4E3F4E05.6010409@codesourcery.com> 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: 2011-08/txt/msg00135.txt.bz2 > Date: Mon, 08 Aug 2011 10:46:29 +0800 > From: Yao Qi > > On 08/08/2011 08:30 AM, Mike Frysinger wrote: > > On Monday, July 25, 2011 00:27:50 Yao Qi wrote: > >> On 07/22/2011 10:16 AM, Mike Frysinger wrote: > >>>> +#if defined __DSBT__ > >>>> +static int > >>> > >>> rather than being tied to the exec format that *gdbserver* is being > >>> built as, shouldnt this be bound to the ptrace defines being available > >>> ? how abut using "#ifdef PTRACE_GETDSBT" ? > >> > >> Yeah, that makes sense. Done. > > > > i think you missed a spot. one place uses __DSBT__ while another uses > > PTRACE_GETDSBT. > > Yes, I thought it is not quite related to PTRACE stuff, so I didn't > change that. I agree that we should use macros in a consistent way. I > replace PTRACE_GETDSBT and __DSBT__ with PT_GETDSBT, because PT_GETDSBT > is defined in sys/ptrace.h, but PTRACE_GETDSBT is defined in asm/ptrace.h. Well, that leads to the following funny situation: > +#if defined PT_GETDSBT You check for PT_GETDSBT here... > +static int > +linux_read_loadmap (const char *annex, CORE_ADDR offset, > + unsigned char *myaddr, unsigned int len) > +{ > + int pid = lwpid_of (get_thread_lwp (current_inferior)); > + int addr = -1; > + struct target_loadmap *data = NULL; > + unsigned int actual_length, copy_length; > + > + if (strcmp (annex, "exec") == 0) > + addr= (int) PTRACE_GETDSBT_EXEC; > + else if (strcmp (annex, "interp") == 0) > + addr = (int) PTRACE_GETDSBT_INTERP; > + else > + return -1; > + > + if (ptrace (PTRACE_GETDSBT, pid, addr, &data) != 0) ...but use PTRACE_GETDSBT here. Now the kernel vs. libc headers issue has always been a contentious one on Linux. But I think you should use the PTRACE_-prefixed names in your code since those are the "official" Linux names, since Linux was intended to be System V compatible. The PT_-prefixed names are really only for compatibility with BSD (So I don't really understand why people keep adding them for ptrace(2) requests that no BSD variant ever had).