1 /* This file is part of the program psim.
3 Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #include "function_unit.h"
44 extern char **environ
;
51 printf_filtered(const char *msg
, ...)
60 error (char *msg
, ...)
72 void *memory
= malloc(size
);
74 error("zmalloc failed\n");
88 printf_filtered("Usage:\n\tpsim [ -t <trace-option> ] [-m model] [-i] [-I] <image> [ <image-args> ... ]\n");
94 main(int argc
, char **argv
)
97 const char *name_of_file
;
103 /* check for arguments -- note sim_calls.c also contains argument processing
104 code for the simulator linked within gdb. */
105 while ((letter
= getopt (argc
, argv
, "Iim:t:")) != EOF
)
109 trace_option(optarg
);
112 function_unit_model(optarg
);
126 name_of_file
= argv
[optind
];
128 /* create the simulator */
129 system
= psim_create(name_of_file
);
131 /* fudge the environment so that _=prog-name */
132 arg_
= (char*)zalloc(strlen(argv
[optind
]) + strlen("_=") + 1);
134 strcat(arg_
, argv
[optind
]);
139 psim_stack(system
, &argv
[optind
], environ
);
143 /* any final clean up */
145 psim_print_info (system
, print_info
);
147 /* why did we stop */
148 status
= psim_get_status(system
);
149 switch (status
.reason
) {
151 error("psim: continuing while stoped!\n");
154 error("psim: no trap insn\n");
157 return status
.signal
;
159 printf ("%s: Caught signal %d at address 0x%lx\n",
160 name_of_file
, (int)status
.signal
,
161 (long)status
.program_counter
);
162 return status
.signal
;
164 error("unknown halt condition\n");
This page took 0.033959 seconds and 5 git commands to generate.