This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add support for target switches in simulator


HI Guys,

> Andrew Cagney <ac131313@cygnus.com> writes:

> I think a better place would be a new file sim/common/sim-run.h to 
> indicate that this is part of the interface that run.c uses.

OK - an adjusted patch is attached below.

> As for converting Arm to use the new framework, I would recommend 
> creating a change-request :-)

I think that would be best.  I certainly feel that it is outside the
scope of this patch, so I hope that continuing to use the old
interface (ie not sim-options.[ch]) will not stop the patch from being
accepted.

  Is this version OK ?

Cheers
        Nick


2002-05-20  Nick Clifton  <nickc@cambridge.redhat.com>

	* run.h: New header.  Provide prototypes for functions used
	between run() and libsim.a which are not used by GDB.
	* run.c: Include run.h.
        (main): If SIM_TARGET_SWITCHES is defined call
        sim_target_parse_command_line.
        (usage): If SIM_TARGET_SWITCHES is defined call
        sim_target_display_usage.

Index: sim/common/run.c
===================================================================
RCS file: /cvs/src/src/sim/common/run.c,v
retrieving revision 1.8
diff -c -3 -p -w -r1.8 run.c
*** sim/common/run.c	17 May 2002 19:09:12 -0000	1.8
--- sim/common/run.c	20 May 2002 13:06:02 -0000
*************** with this program; if not, write to the 
*** 46,51 ****
--- 46,52 ----
  #include "callback.h"
  #include "remote-sim.h"
  #include "ansidecl.h"
+ #include "run.h"
  
  static void usage PARAMS ((void));
  extern int optind;
*************** main (ac, av)
*** 111,116 ****
--- 112,121 ----
    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 ()
*** 338,342 ****
--- 343,351 ----
    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);
  }

*** /dev/null	Thu Aug 30 21:30:55 2001
--- sim/common/run.h	Mon May 20 14:03:14 2002
***************
*** 0 ****
--- 1,32 ----
+ /* This file defines the part of the interface between the standalone
+    simaulator program - run - and simulator library - libsim.a - that
+    is not used by GDB.  The GDB part is described in include/remote-sim.h.
+    
+    Copyright 2002 Free Software Foundation, Inc.
+ 
+    This file is part of GDB.
+ 
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+ 
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ 
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+ 
+ #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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]