From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27125 invoked by alias); 22 Mar 2011 00:08:44 -0000 Received: (qmail 26961 invoked by uid 22791); 22 Mar 2011 00:08:40 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT,TW_OC X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.151) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 22 Mar 2011 00:08:04 +0000 Received: from md1.u-strasbg.fr (md1.u-strasbg.fr [IPv6:2001:660:2402::186]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id p2M07u2M036863 for ; Tue, 22 Mar 2011 01:07:56 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms8.u-strasbg.fr [130.79.204.17]) by md1.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p2M07uZt055400 for ; Tue, 22 Mar 2011 01:07:56 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p2M07tC5021709 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Tue, 22 Mar 2011 01:07:55 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: Subject: [RFC] Remove START_INFERIOR_TRAPS_EXPECTED macro from nm header Date: Tue, 22 Mar 2011 09:38:00 -0000 Message-ID: <003e01cbe825$321015a0$963040e0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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-03/txt/msg00982.txt.bz2 This patch achieves the subject by adding a new field to target_ops structure called to_start_inferior_traps_expected. The changes are otherwise quite straightforward, but once again, I have no way to even check that this compiles for the different native GDB that it affects... Comments welcome, Pierre Muller 2011-03-22 Pierre Muller Replace START_INFERIOR_TRAPS_EXPECTED macro by a new filed in target_ops struct named to_start_inferior_traps_expected. * config/alpha/alpha-osf3.mh: Set MH_CFLAGS to be able to set to_start_inferior_traps_expected correctly. config/alpha/nm-osf3.h: Remove START_INFERIOR_TRAPS_EXCEPTED macro. * target.h (struct target_ops): Add to_start_inferior_traps_expected field. * target.c (update_current_target): Inherit field to_start_inferior_traps_expected for beneath and set default to 2. * alpha-nat.c (_initialize_alpha_nat): Set to_start_inferior_traps_expected to 3 if macro _STARTUP_INF_3_TRAPS. (darwin_ptrace_him): Use darwin_ops to_start_inferior_traps_expected field for startup_inferior parameter. * inf-ptrace.c (inf_ptrace_create_inferior): Adapt startup_inferior call using ops->to=E8start_inferior_traps_expected. inf-ttrace.c (inf_ttrace_him): Ditto. * procfs.c (procfs_init_inferior): Ditto. diff --git a/gdb/alpha-nat.c b/gdb/alpha-nat.c index 1a55ea9..bb77035 100644 --- a/gdb/alpha-nat.c +++ b/gdb/alpha-nat.c @@ -197,6 +197,16 @@ _initialize_alpha_nat (void) struct target_ops *t; =20 t =3D procfs_target (); + + /* OSF-3 needs three traps. */ +#ifdef _STARTUP_INF_3_TRAPS +/* Number of traps that happen between exec'ing the shell + to run an inferior, and when we finally get to + the inferior code. This is 2 on most implementations. */ +/* was define START_INFERIOR_TRAPS_EXPECTED 3 */ + t->to_start_inferior_traps_expected =3D 3; +#endif + add_target (t); =20 deprecated_add_core_fns (&alpha_osf_core_fns); diff --git a/gdb/config/alpha/alpha-osf3.mh b/gdb/config/alpha/alpha-osf3.mh index 8dc6f80..1ef7195 100644 --- a/gdb/config/alpha/alpha-osf3.mh +++ b/gdb/config/alpha/alpha-osf3.mh @@ -1,5 +1,6 @@ # Host: Little-endian Alpha running OSF/1-3.x and higher using procfs NAT_FILE=3D nm-osf3.h +MH_CFLAGS=3D-D_STARTUP_INF_3_TRAPS NATDEPFILES=3D corelow.o alpha-nat.o fork-child.o \ solib-osf.o solib.o procfs.o proc-api.o proc-events.o proc-flags.o \ proc-why.o dec-thread.o diff --git a/gdb/config/alpha/nm-osf3.h b/gdb/config/alpha/nm-osf3.h index 626a497..56bf4d9 100644 --- a/gdb/config/alpha/nm-osf3.h +++ b/gdb/config/alpha/nm-osf3.h @@ -16,11 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ =20 -/* Number of traps that happen between exec'ing the shell - to run an inferior, and when we finally get to - the inferior code. This is 2 on most implementations. */ -#define START_INFERIOR_TRAPS_EXPECTED 3 - /* Don't trace faults under OSF/1, rely on the posting of the appropriate signal if fault tracing is disabled. Tracing T_IFAULT under Alpha OSF/1 causes a `floating point enable' diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index 7be85d5..74c8b5a 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -1485,7 +1485,7 @@ darwin_ptrace_him (int pid) =20 darwin_init_thread_list (inf); =20 - startup_inferior (START_INFERIOR_TRAPS_EXPECTED); + startup_inferior (darwin_ops->to_start_inferior_traps_expected); } =20 static void diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index b5e1744..0a3f776 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -142,7 +142,7 @@ inf_ptrace_create_inferior (struct target_ops *ops, /* START_INFERIOR_TRAPS_EXPECTED is defined in inferior.h, and will be 1 or 2 depending on whether we're starting without or with a shell. */ - startup_inferior (START_INFERIOR_TRAPS_EXPECTED); + startup_inferior (ops->to_start_inferior_traps_expected); =20 /* On some targets, there must be some explicit actions taken after the inferior has been started up. */ diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c index ab075db..7b9ee2d 100644 --- a/gdb/inf-ttrace.c +++ b/gdb/inf-ttrace.c @@ -630,7 +630,7 @@ inf_ttrace_him (struct target_ops *ops, int pid) /* START_INFERIOR_TRAPS_EXPECTED is defined in inferior.h, and will be 1 or 2 depending on whether we're starting without or with a shell. */ - startup_inferior (START_INFERIOR_TRAPS_EXPECTED); + startup_inferior (ops->to_start_inferior_traps_expected); =20 /* On some targets, there must be some explicit actions taken after the inferior has been started up. */ diff --git a/gdb/procfs.c b/gdb/procfs.c index 5d7cb23..467af2c 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -4710,7 +4710,7 @@ procfs_init_inferior (struct target_ops *ops, int pid) =20 /* Typically two, one trap to exec the shell, one to exec the program being debugged. Defined by "inferior.h". */ - startup_inferior (START_INFERIOR_TRAPS_EXPECTED); + startup_inferior (ops->to_start_inferior_traps_expected); =20 #ifdef SYS_syssgi /* On mips-irix, we need to stop the inferior early enough during diff --git a/gdb/target.c b/gdb/target.c index 45259fd..3ab7248 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -677,6 +677,7 @@ update_current_target (void) INHERIT (to_static_tracepoint_marker_at, t); INHERIT (to_static_tracepoint_markers_by_strid, t); INHERIT (to_traceframe_info, t); + INHERIT (to_start_inferior_traps_expected, t); INHERIT (to_magic, t); /* Do not inherit to_memory_map. */ /* Do not inherit to_flash_erase. */ @@ -886,6 +887,7 @@ update_current_target (void) de_fault (to_traceframe_info, (struct traceframe_info * (*) (void)) tcomplain); + de_fault (to_start_inferior_traps_expected, 2); #undef de_fault =20 /* Finally, position the target-stack beneath the squashed diff --git a/gdb/target.h b/gdb/target.h index 237d1aa..9842a0a 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -743,6 +743,9 @@ struct target_ops re-fetching when necessary. */ struct traceframe_info *(*to_traceframe_info) (void); =20 + /* Number of traps expected at startup of target. */ + int to_start_inferior_traps_expected; + int to_magic; /* Need sub-structure for target machine related rather than comm related? */