1 /* run front end support for all the simulators.
2 Copyright (C) 1992, 1993 1994, 1995 Free Software Foundation, Inc.
4 This file is part of SH SIM
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
28 #include "remote-sim.h"
31 #define SIGQUIT SIGTERM
38 int target_byte_order
;
40 extern host_callback default_callback
;
47 bfd_vma start_address
;
56 while ((i
= getopt (ac
, av
, "m:p:s:tv")) != EOF
)
60 sim_size (atoi (optarg
));
63 sim_set_profile (atoi (optarg
));
66 sim_set_profile_size (atoi (optarg
));
87 printf ("run %s\n", name
);
89 abfd
= bfd_openr (name
, 0);
90 sim_set_callbacks (&default_callback
);
91 default_callback
.init (&default_callback
);
94 if (bfd_check_format (abfd
, bfd_object
))
97 for (s
= abfd
->sections
; s
; s
= s
->next
)
99 unsigned char *buffer
= (unsigned char *)malloc (bfd_section_size (abfd
, s
));
100 bfd_get_section_contents (abfd
,
104 bfd_section_size (abfd
, s
));
105 sim_write (s
->vma
, buffer
, bfd_section_size (abfd
, s
));
108 start_address
= bfd_get_start_address (abfd
);
109 sim_create_inferior (start_address
, NULL
, NULL
);
111 target_byte_order
= abfd
->xvec
->byteorder_big_p
? 4321 : 1234;
128 sim_stop_reason (&reason
, &sigrc
);
130 if (sigrc
== SIGQUIT
)
132 return sim_get_quit_code();
145 fprintf (stderr
, "usage: run [-tv][-m size] program\n");