From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29972 invoked by alias); 16 May 2002 16:16:50 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 29950 invoked from network); 16 May 2002 16:16:45 -0000 Received: from unknown (HELO dell-pe2450-3.cambridge.redhat.com) (195.224.55.225) by sources.redhat.com with SMTP; 16 May 2002 16:16:45 -0000 Received: from north-pole.nickc.cambridge.redhat.com (host217-39-2-165.in-addr.btopenworld.com [217.39.2.165]) by dell-pe2450-3.cambridge.redhat.com (Postfix) with ESMTP id 78BB4857C8 for ; Thu, 16 May 2002 17:16:44 +0100 (BST) Received: from north-pole.nickc.cambridge.redhat.com.nickc.cambridge.redhat.com (localhost [127.0.0.1]) by north-pole.nickc.cambridge.redhat.com (Postfix) with ESMTP id C78201C39D; Thu, 16 May 2002 17:16:34 +0100 (BST) To: gdb-patches@sources.redhat.com Cc: Richard.Earnshaw@arm.com Subject: Add support for target switches in simulator References: <200205091111.MAA22264@cam-mail2.cambridge.arm.com> From: Nick Clifton Date: Thu, 16 May 2002 09:16:00 -0000 In-Reply-To: <200205091111.MAA22264@cam-mail2.cambridge.arm.com> Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-05/txt/msg00647.txt.bz2 Hi Guys, I would like permission to apply the following patch. It adds the ability for simulator backends to parse their own command line switches, thus creating target specific simulator options. I would like this facility in order to be able to add a new switch to the ARM simulator - a switch to select which set(s) of SWI emulations it should perform. I have not worked out how this feature would be accessed from GDB. My guess is that the switches could be added to the arguments passed via sim_open(), but how would a GDB user tell GDB to add these switches ? Cheers Nick sim/common/ChangeLog 2002-05-16 Nick Clifton * run.c (main): Call sim_target_parse_command_line if SIM_TARGET_SWITCHES is defined. (usage): Call sim_target_display_usage if SIM_TARGET_SWITCHES is defined. include/ChangeLog 2002-05-16 Nick Clifton * remote-sim.h: Provide prototypes for sim_target_parse_command_line and sim_target_display_usage if SIM_TARGET_SWITCHES is defined. Index: sim/common/run.c =================================================================== RCS file: /cvs/src/src/sim/common/run.c,v retrieving revision 1.7 diff -c -3 -p -w -r1.7 run.c *** sim/common/run.c 21 Dec 2001 00:47:18 -0000 1.7 --- sim/common/run.c 16 May 2002 16:04:36 -0000 *************** main (ac, av) *** 111,116 **** --- 111,120 ---- default_callback.init (&default_callback); sim_set_callbacks (&default_callback); + #ifdef SIM_TARGET_SWITCHES + ac = sim_target_parse_command_line (ac, av); + #endif + /* FIXME: This is currently being rewritten to have each simulator do all argv processing. */ *************** usage () *** 334,338 **** --- 338,346 ---- fprintf (stderr, "\n"); fprintf (stderr, "program args Arguments to pass to simulated program.\n"); fprintf (stderr, " Note: Very few simulators support this.\n"); + #ifdef SIM_TARGET_SWITCHES + fprintf (stderr, "\nTarget specific options:\n"); + sim_target_display_usage (); + #endif exit (1); } Index: include/remote-sim.h =================================================================== RCS file: /cvs/src/src/include/remote-sim.h,v retrieving revision 1.4 diff -c -3 -p -w -r1.4 remote-sim.h *** include/remote-sim.h 14 Mar 2001 02:27:43 -0000 1.4 --- include/remote-sim.h 16 May 2002 16:07:49 -0000 *************** void sim_set_profile_size PARAMS ((int n *** 346,351 **** --- 346,362 ---- multi-cpu simulators. */ void sim_kill PARAMS ((SIM_DESC sd)); + + #ifdef SIM_TARGET_SWITCHES + /* Parse the command line, extracting any target specific switches + before the generic simulator code gets a chance to complain + about them. Returns the adjusted value of argc. */ + int sim_target_parse_command_line PARAMS ((int, char **)); + + /* Display a list of target specific switches supported by this + target. */ + void sim_target_display_usage PARAMS ((void)); + #endif #ifdef __cplusplus }