1 /* front end to the simulator.
3 Written by Steve Chamberlain of Cygnus Support.
6 This file is part of H8/300 sim
9 THIS SOFTWARE IS NOT COPYRIGHTED
11 Cygnus offers the following for use in the public domain. Cygnus
12 makes no warranty with regard to the software or it's performance
13 and the user accepts the software "AS IS" with all faults.
15 CYGNUS DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO
16 THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
31 #include "remote-sim.h"
43 bfd_vma start_address
;
52 while ((i
= getopt (ac
, av
, "c:htv")) != EOF
)
56 sim_csize (atoi (optarg
));
77 printf ("run %s\n", name
);
79 abfd
= bfd_openr (name
, "coff-h8300");
82 fprintf (stderr
, "%s: unable to open %s\n", av
[0], name
);
86 if (! bfd_check_format(abfd
, bfd_object
))
88 fprintf (stderr
, "%s: %s is not a valid executable\n", av
[0], name
);
92 if (abfd
->arch_info
->mach
== bfd_mach_h8300h
)
95 for (s
= abfd
->sections
; s
; s
=s
->next
)
97 char *buffer
= malloc(bfd_section_size(abfd
,s
));
98 bfd_get_section_contents(abfd
, s
, buffer
, 0, bfd_section_size(abfd
,s
));
99 sim_write(s
->vma
, buffer
, bfd_section_size(abfd
,s
));
102 start_address
= bfd_get_start_address(abfd
);
103 sim_create_inferior (start_address
, NULL
, NULL
);
106 sim_info (verbose
- 1);
107 sim_stop_reason (&reason
, &sigrc
);
108 /* FIXME: this test is insufficient but we can't do much
109 about it until sim_stop_reason is cleaned up. */
115 /* gdb callback used by simulator */
118 printf_filtered (va_alist
)
125 msg
= va_arg (args
, char *);
126 vfprintf (stdout
, msg
, args
);
133 fprintf (stderr
, "usage: run [-h] [-t] [-v] [-c csize] program\n");