From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7905 invoked by alias); 16 May 2002 18:08:19 -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 7874 invoked from network); 16 May 2002 18:08:16 -0000 Received: from unknown (HELO cygnus.com) (205.180.83.203) by sources.redhat.com with SMTP; 16 May 2002 18:08:16 -0000 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id LAA06934; Thu, 16 May 2002 11:08:14 -0700 (PDT) Message-ID: <3CE3F259.BF10636B@redhat.com> Date: Thu, 16 May 2002 11:08:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. X-Accept-Language: en MIME-Version: 1.0 To: Nick Clifton CC: gdb-patches@sources.redhat.com, Richard.Earnshaw@arm.com Subject: Re: Add support for target switches in simulator References: <200205091111.MAA22264@cam-mail2.cambridge.arm.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-05/txt/msg00656.txt.bz2 Nick Clifton wrote: > > 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 ? >From memory, don't you do something like: (gdb) target sim xxx=yyy > > 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 > }