From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9907 invoked by alias); 23 Apr 2012 18:13:36 -0000 Received: (qmail 9892 invoked by uid 22791); 23 Apr 2012 18:13:34 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_EG X-Spam-Check-By: sourceware.org Received: from mail-ob0-f169.google.com (HELO mail-ob0-f169.google.com) (209.85.214.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Apr 2012 18:13:20 +0000 Received: by obbeh20 with SMTP id eh20so13096836obb.0 for ; Mon, 23 Apr 2012 11:13:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :organization:content-type:x-mailer:content-transfer-encoding :mime-version:x-gm-message-state; bh=fa0D1HT+pQV+Odsm04DtwmP9NZATA1xctObtJkkQSMM=; b=OEYfYC7eZAV4QixWTolo0LlWCc+dafty8xtTNNBkyOoY1Lo5RbyVsDEcHVchVC4EX1 j4ewTrA7Vvt+R1ZLdWENHdbG8oLknBWfSBHHeo/QVk9FWcNdCfswqPi8V0YwdsEyAZxr rsQEkVSo/5RQyQhxw25ZiWrmNaNqScSrb1mVX1ew1kZCIJ2/BQsuRTyW85ftupCCzbCL Ttr2h5Rv4uXvLYLwadN/pmnhjU0c/O0hDZq5/dFQjYzDA+/Ulx7rJYPLMHKV9n4E/aI7 mh2dDk21ovsU381PiDErZlJyhVxseDWwvvdKBtpSO/YLLvHx46MWTo/YdG6nFnOTGgIe CKiQ== Received: by 10.182.179.68 with SMTP id de4mr8774305obc.13.1335204799471; Mon, 23 Apr 2012 11:13:19 -0700 (PDT) Received: from [192.168.1.50] ([186.212.84.116]) by mx.google.com with ESMTPS id d6sm13678737oeh.3.2012.04.23.11.13.16 (version=SSLv3 cipher=OTHER); Mon, 23 Apr 2012 11:13:18 -0700 (PDT) Message-ID: <1335204794.31250.1.camel@hactar> Subject: Re: [RFA] handle android bionic ptrace in gdbserver. From: Thiago Jung Bauermann To: Pedro Alves Cc: Mark Kettenis , gdb-patches@sourceware.org Date: Mon, 23 Apr 2012 18:53:00 -0000 In-Reply-To: <1333139333.11673.4.camel@hactar> References: <1332802002.30339.16.camel@hactar> <201203271611.q2RGBs2N025666@glazunov.sibelius.xs4all.nl> <1332894408.16415.14.camel@hactar> <4F7490E9.40903@redhat.com> <1333139333.11673.4.camel@hactar> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Mime-Version: 1.0 X-Gm-Message-State: ALoCoQmrN/pVjMUDRQCEkONphiiClC+/Paay9/jAe9x0ORPm2znFsCMVL+vcJNKSDI/Q0331GW43 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-04/txt/msg00752.txt.bz2 On Fri, 2012-03-30 at 17:28 -0300, Thiago Jung Bauermann wrote: > Updated patch follows. Ping. > 2012-03-30 Thiago Jung Bauermann > > * linux-low.h (PTRACE_ARG3_TYPE): Move macro from linux-low.c. > (PTRACE_ARG4_TYPE): Likewise. > (PTRACE_XFER_TYPE): Likewise. > * linux-arm-low.c (arm_prepare_to_resume): Cast third argument > of > ptrace to PTRACE_ARG3_TYPE. > * linux-low.c (PTRACE_ARG3_TYPE): Move macro to linux-low.h. > (PTRACE_ARG4_TYPE): Likewise. > (PTRACE_XFER_TYPE): Likewise. > (linux_detach_one_lwp): Cast fourth argument of > ptrace to long then PTRACE_ARG4_TYPE. > (regsets_fetch_inferior_registers): Cast third argument of > ptrace to long then PTRACE_ARG3_TYPE. > (regsets_store_inferior_registers): Likewise. > > > diff --git a/gdb/gdbserver/linux-arm-low.c > b/gdb/gdbserver/linux-arm-low.c > index bf1792b..c4d2000 100644 > --- a/gdb/gdbserver/linux-arm-low.c > +++ b/gdb/gdbserver/linux-arm-low.c > @@ -709,13 +709,15 @@ arm_prepare_to_resume (struct lwp_info *lwp) > errno = 0; > > if (arm_hwbp_control_is_enabled (proc_info->bpts[i].control)) > - if (ptrace (PTRACE_SETHBPREGS, pid, ((i << 1) + 1), > - &proc_info->bpts[i].address) < 0) > + if (ptrace (PTRACE_SETHBPREGS, pid, > + (PTRACE_ARG3_TYPE) ((i << 1) + 1), > + &proc_info->bpts[i].address) < 0) > perror_with_name ("Unexpected error setting breakpoint > address"); > > if (arm_hwbp_control_is_initialized > (proc_info->bpts[i].control)) > - if (ptrace (PTRACE_SETHBPREGS, pid, ((i << 1) + 2), > - &proc_info->bpts[i].control) < 0) > + if (ptrace (PTRACE_SETHBPREGS, pid, > + (PTRACE_ARG3_TYPE) ((i << 1) + 2), > + &proc_info->bpts[i].control) < 0) > perror_with_name ("Unexpected error setting breakpoint"); > > lwp_info->bpts_changed[i] = 0; > @@ -727,13 +729,15 @@ arm_prepare_to_resume (struct lwp_info *lwp) > errno = 0; > > if (arm_hwbp_control_is_enabled (proc_info->wpts[i].control)) > - if (ptrace (PTRACE_SETHBPREGS, pid, -((i << 1) + 1), > - &proc_info->wpts[i].address) < 0) > + if (ptrace (PTRACE_SETHBPREGS, pid, > + (PTRACE_ARG3_TYPE) -((i << 1) + 1), > + &proc_info->wpts[i].address) < 0) > perror_with_name ("Unexpected error setting watchpoint > address"); > > if (arm_hwbp_control_is_initialized > (proc_info->wpts[i].control)) > - if (ptrace (PTRACE_SETHBPREGS, pid, -((i << 1) + 2), > - &proc_info->wpts[i].control) < 0) > + if (ptrace (PTRACE_SETHBPREGS, pid, > + (PTRACE_ARG3_TYPE) -((i << 1) + 2), > + &proc_info->wpts[i].control) < 0) > perror_with_name ("Unexpected error setting watchpoint"); > > lwp_info->wpts_changed[i] = 0; > diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c > index 043451d..51f6801 100644 > --- a/gdb/gdbserver/linux-low.c > +++ b/gdb/gdbserver/linux-low.c > @@ -241,10 +241,6 @@ struct pending_signals > struct pending_signals *prev; > }; > > -#define PTRACE_ARG3_TYPE void * > -#define PTRACE_ARG4_TYPE void * > -#define PTRACE_XFER_TYPE long > - > #ifdef HAVE_LINUX_REGSETS > static char *disabled_regsets; > static int num_regsets; > @@ -1151,7 +1147,8 @@ linux_detach_one_lwp (struct inferior_list_entry > *entry, void *args) > /* Finally, let it resume. */ > if (the_low_target.prepare_to_resume != NULL) > the_low_target.prepare_to_resume (lwp); > - if (ptrace (PTRACE_DETACH, lwpid_of (lwp), 0, sig) < 0) > + if (ptrace (PTRACE_DETACH, lwpid_of (lwp), 0, > + (PTRACE_ARG4_TYPE) (long) sig) < 0) > error (_("Can't detach %s: %s"), > target_pid_to_str (ptid_of (lwp)), > strerror (errno)); > @@ -3991,7 +3988,8 @@ regsets_fetch_inferior_registers (struct > regcache *regcache) > data = buf; > > #ifndef __sparc__ > - res = ptrace (regset->get_request, pid, nt_type, data); > + res = ptrace (regset->get_request, pid, > + (PTRACE_ARG3_TYPE) (long) nt_type, data); > #else > res = ptrace (regset->get_request, pid, data, nt_type); > #endif > @@ -4064,7 +4062,8 @@ regsets_store_inferior_registers (struct > regcache *regcache) > data = buf; > > #ifndef __sparc__ > - res = ptrace (regset->get_request, pid, nt_type, data); > + res = ptrace (regset->get_request, pid, > + (PTRACE_ARG3_TYPE) (long) nt_type, data); > #else > res = ptrace (regset->get_request, pid, data, nt_type); > #endif > @@ -4076,7 +4075,8 @@ regsets_store_inferior_registers (struct > regcache *regcache) > > /* Only now do we write the register set. */ > #ifndef __sparc__ > - res = ptrace (regset->set_request, pid, nt_type, data); > + res = ptrace (regset->set_request, pid, > + (PTRACE_ARG3_TYPE) (long) nt_type, data); > #else > res = ptrace (regset->set_request, pid, data, nt_type); > #endif > diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h > index 07eda12..de4d1fa 100644 > --- a/gdb/gdbserver/linux-low.h > +++ b/gdb/gdbserver/linux-low.h > @@ -24,6 +24,10 @@ > > #include "gdb_proc_service.h" > > +#define PTRACE_ARG3_TYPE void * > +#define PTRACE_ARG4_TYPE void * > +#define PTRACE_XFER_TYPE long > + > #ifdef HAVE_LINUX_REGSETS > typedef void (*regset_fill_func) (struct regcache *, void *); > typedef void (*regset_store_func) (struct regcache *, const void *); > -- []'s Thiago Jung Bauermann Linaro Toolchain Working Group