From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1702 invoked by alias); 30 Aug 2010 07:13:22 -0000 Received: (qmail 1688 invoked by uid 22791); 30 Aug 2010 07:13:20 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_CP,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 30 Aug 2010 07:13:16 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7U7DEIw003399 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 30 Aug 2010 03:13:14 -0400 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7U7DCkb004512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 30 Aug 2010 03:13:14 -0400 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o7U7DC4J011528 for ; Mon, 30 Aug 2010 09:13:12 +0200 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o7U7DC0s011527 for gdb-patches@sourceware.org; Mon, 30 Aug 2010 09:13:12 +0200 Date: Mon, 30 Aug 2010 07:13:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch 5/9]#2 Move siginfo_fixup linux-nat -> inf-ptrace Message-ID: <20100830071312.GF6831@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) X-IsSubscribed: yes 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: 2010-08/txt/msg00485.txt.bz2 Hi, as the siginfo biarch conversion needs to be done now even during inf-ptrace ptrace calls the interface had to be moved there. There are no code changes of it in this patch. Thanks, Jan gdb/ 2010-08-30 Jan Kratochvil * amd64-linux-nat.c: Include inf-ptrace.h. (_initialize_amd64_linux_nat): Rename linux_nat_set_siginfo_fixup to inf_ptrace_set_siginfo_fixup. * linux-nat.c (linux_nat_siginfo_fixup, siginfo_fixup) (linux_nat_set_siginfo_fixup): Move ... * inf-ptrace.c (inf_ptrace_siginfo_fixup, siginfo_fixup) (inf_ptrace_set_siginfo_fixup): ... here and rename them. Remove static from siginfo_fixup. * linux-nat.h (linux_nat_set_siginfo_fixup): Move ... * inf-ptrace.h (inf_ptrace_set_siginfo_fixup): ... here and rename it. New declaration siginfo_fixup. --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c @@ -26,6 +26,7 @@ #include "regset.h" #include "linux-nat.h" #include "amd64-linux-tdep.h" +#include "inf-ptrace.h" #include "gdb_assert.h" #include "gdb_string.h" @@ -815,5 +816,5 @@ _initialize_amd64_linux_nat (void) /* Register the target. */ linux_nat_add_target (t); linux_nat_set_new_thread (t, amd64_linux_new_thread); - linux_nat_set_siginfo_fixup (t, amd64_linux_siginfo_fixup); + inf_ptrace_set_siginfo_fixup (t, amd64_linux_siginfo_fixup); } --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -796,3 +796,42 @@ inf_ptrace_trad_target (CORE_ADDR (*register_u_offset) return t; } + +/* The method to call, if any, when the siginfo object needs to be + converted between the layout returned by ptrace, and the layout in + the architecture of the inferior. */ +static int (*inf_ptrace_siginfo_fixup) (struct siginfo *, gdb_byte *, int); + +/* Register a method that converts a siginfo object between the layout + that ptrace returns, and the layout in the architecture of the + inferior. */ +void +inf_ptrace_set_siginfo_fixup (struct target_ops *t, + int (*siginfo_fixup) (struct siginfo *, + gdb_byte *, int)) +{ + /* Save the pointer. */ + inf_ptrace_siginfo_fixup = siginfo_fixup; +} + +/* Convert a native/host siginfo object, into/from the siginfo in the + layout of the inferiors' architecture. */ + +void +siginfo_fixup (struct siginfo *siginfo, gdb_byte *inf_siginfo, int direction) +{ + int done = 0; + + if (inf_ptrace_siginfo_fixup != NULL) + done = inf_ptrace_siginfo_fixup (siginfo, inf_siginfo, direction); + + /* If there was no callback, or the callback didn't do anything, + then just do a straight memcpy. */ + if (!done) + { + if (direction == 1) + memcpy (siginfo, inf_siginfo, sizeof (struct siginfo)); + else + memcpy (inf_siginfo, siginfo, sizeof (struct siginfo)); + } +} --- a/gdb/inf-ptrace.h +++ b/gdb/inf-ptrace.h @@ -34,4 +34,14 @@ extern struct target_ops * inf_ptrace_trad_target (CORE_ADDR (*register_u_offset) (struct gdbarch *, int, int)); +struct siginfo; +extern void siginfo_fixup (struct siginfo *siginfo, gdb_byte *inf_siginfo, + int direction); + +extern + void inf_ptrace_set_siginfo_fixup (struct target_ops *t, + int (*siginfo_fixup) (struct siginfo *, + gdb_byte *, + int)); + #endif --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -210,13 +210,6 @@ static struct target_ops linux_ops_saved; /* The method to call, if any, when a new thread is attached. */ static void (*linux_nat_new_thread) (ptid_t); -/* The method to call, if any, when the siginfo object needs to be - converted between the layout returned by ptrace, and the layout in - the architecture of the inferior. */ -static int (*linux_nat_siginfo_fixup) (struct siginfo *, - gdb_byte *, - int); - /* The saved to_xfer_partial method, inherited from inf-ptrace.c. Called by our to_xfer_partial. */ static LONGEST (*super_xfer_partial) (struct target_ops *, @@ -3899,28 +3892,6 @@ linux_nat_mourn_inferior (struct target_ops *ops) linux_fork_mourn_inferior (); } -/* Convert a native/host siginfo object, into/from the siginfo in the - layout of the inferiors' architecture. */ - -static void -siginfo_fixup (struct siginfo *siginfo, gdb_byte *inf_siginfo, int direction) -{ - int done = 0; - - if (linux_nat_siginfo_fixup != NULL) - done = linux_nat_siginfo_fixup (siginfo, inf_siginfo, direction); - - /* If there was no callback, or the callback didn't do anything, - then just do a straight memcpy. */ - if (!done) - { - if (direction == 1) - memcpy (siginfo, inf_siginfo, sizeof (struct siginfo)); - else - memcpy (inf_siginfo, siginfo, sizeof (struct siginfo)); - } -} - static LONGEST linux_xfer_siginfo (struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, @@ -5695,18 +5666,6 @@ linux_nat_set_new_thread (struct target_ops *t, void (*new_thread) (ptid_t)) linux_nat_new_thread = new_thread; } -/* Register a method that converts a siginfo object between the layout - that ptrace returns, and the layout in the architecture of the - inferior. */ -void -linux_nat_set_siginfo_fixup (struct target_ops *t, - int (*siginfo_fixup) (struct siginfo *, - gdb_byte *, - int)) -{ - /* Save the pointer. */ - linux_nat_siginfo_fixup = siginfo_fixup; -} /* Return the saved siginfo associated with PTID. */ struct siginfo * --- a/gdb/linux-nat.h +++ b/gdb/linux-nat.h @@ -155,14 +155,6 @@ void linux_nat_add_target (struct target_ops *); /* Register a method to call whenever a new thread is attached. */ void linux_nat_set_new_thread (struct target_ops *, void (*) (ptid_t)); -/* Register a method that converts a siginfo object between the layout - that ptrace returns, and the layout in the architecture of the - inferior. */ -void linux_nat_set_siginfo_fixup (struct target_ops *, - int (*) (struct siginfo *, - gdb_byte *, - int)); - /* Update linux-nat internal state when changing from one fork to another. */ void linux_nat_switch_fork (ptid_t new_ptid);