Commit | Line | Data |
---|---|---|
fafce69a AC |
1 | /* Miscellaneous simulator utilities. |
2 | Copyright (C) 1997 Free Software Foundation, Inc. | |
3 | Contributed by Cygnus Support. | |
4 | ||
5 | This file is part of GDB, the GNU debugger. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2, or (at your option) | |
10 | any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License along | |
18 | with this program; if not, write to the Free Software Foundation, Inc., | |
19 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | #ifndef SIM_UTILS_H | |
22 | #define SIM_UTILS_H | |
23 | ||
24 | /* Memory management with an allocator that clears memory before use. */ | |
25 | ||
26 | void *zalloc (unsigned long size); | |
27 | ||
28 | #define ZALLOC(TYPE) (TYPE*)zalloc(sizeof (TYPE)) | |
29 | ||
30 | void zfree(void*); | |
31 | ||
32 | /* Turn VALUE into a string with commas. */ | |
33 | char *sim_add_commas (char *, int, unsigned long); | |
34 | ||
35 | /* Utilities for elapsed time reporting. */ | |
36 | ||
37 | /* Opaque type, known only inside sim_elapsed_time_foo fns. */ | |
38 | typedef unsigned long SIM_ELAPSED_TIME; | |
39 | ||
40 | /* Get reference point for future call to sim_time_elapsed. */ | |
41 | SIM_ELAPSED_TIME sim_elapsed_time_get (void); | |
42 | ||
43 | /* Elapsed time in milliseconds since START. */ | |
44 | unsigned long sim_elapsed_time_since (SIM_ELAPSED_TIME start); | |
45 | ||
46 | /* Utilities for manipulating the load image. */ | |
47 | ||
48 | SIM_RC sim_analyze_program (SIM_DESC sd, char *prog_name, | |
49 | struct _bfd *prog_bfd); | |
50 | ||
51 | char **sim_copy_argv (char **argv); | |
52 | ||
53 | /* Load program PROG into the simulator. | |
54 | If PROG_BFD is non-NULL, the file has already been opened. | |
55 | If VERBOSE_P is non-zero statistics are printed of each loaded section | |
56 | and the transfer rate (for consistency with gdb). | |
57 | If this fails an error message is printed and NULL is returned. | |
58 | If it succeeds the bfd is returned. */ | |
59 | ||
60 | struct _bfd *sim_load_file (SIM_DESC sd, const char *myname, | |
61 | host_callback *callback, char *prog, | |
62 | struct _bfd *prog_bfd, int verbose_p); | |
63 | ||
64 | /* These are defined in callback.c as cover functions to the vprintf | |
65 | callbacks. */ | |
66 | ||
67 | void sim_cb_printf (host_callback *, const char *, ...); | |
68 | void sim_cb_eprintf (host_callback *, const char *, ...); | |
69 | ||
70 | #endif |