Commit | Line | Data |
---|---|---|
a983c8f0 MM |
1 | /* This file is part of the program psim. |
2 | ||
3 | Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au> | |
4 | ||
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. | |
9 | ||
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. | |
14 | ||
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. | |
18 | ||
19 | */ | |
20 | ||
21 | ||
22 | #ifndef _DEBUG_C_ | |
23 | #define _DEBUG_C_ | |
24 | ||
73c4941b | 25 | #include "config.h" |
a983c8f0 | 26 | #include "basics.h" |
c494cadd | 27 | |
73c4941b | 28 | #ifdef HAVE_STDLIB_H |
a983c8f0 | 29 | #include <stdlib.h> |
c494cadd | 30 | #endif |
a983c8f0 MM |
31 | |
32 | int ppc_trace[nr_trace_options]; | |
33 | int print_info; | |
34 | ||
35 | typedef struct _trace_option_descriptor { | |
36 | trace_options option; | |
37 | const char *name; | |
38 | const char *description; | |
39 | } trace_option_descriptor; | |
40 | ||
41 | static trace_option_descriptor trace_description[] = { | |
42 | { trace_gdb, "gdb", "calls made by gdb to the sim_calls.c file" }, | |
43 | { trace_os_emul, "os-emul", "VEA mode sytem calls - like strace/spy" }, | |
44 | /* decode/issue */ | |
45 | { trace_semantics, "semantics", "Instruction execution (issue)" }, | |
46 | { trace_idecode, "idecode", "instruction decode (when miss in cache)" }, | |
47 | { trace_alu, "alu", "results of integer ALU" }, | |
48 | { trace_load_store, "load-store", "transfers to from data registers" }, | |
49 | /* devices */ | |
50 | { trace_device_tree, "device-tree", }, | |
51 | { trace_devices, "devices" }, | |
52 | { trace_pass_device, "pass-device" }, | |
53 | { trace_console_device, "console-device" }, | |
54 | { trace_icu_device, "icu-device" }, | |
55 | { trace_halt_device, "halt-device" }, | |
56 | { trace_register_device, "register-device" }, | |
57 | { trace_vm_device, "vm-device" }, | |
58 | { trace_memory_device, "memory-device" }, | |
59 | { trace_htab_device, "htab-device" }, | |
60 | { trace_pte_device, "pte-device" }, | |
61 | { trace_binary_device, "binary-device" }, | |
62 | { trace_file_device, "file-device" }, | |
63 | { trace_core_device, "core-device" }, | |
64 | { trace_stack_device, "stack-device" }, | |
65 | /* misc */ | |
845ff5a4 MM |
66 | { trace_opts, "options", "Print options simulator was compiled with" }, |
67 | { trace_tbd, "tbd", "Trace any missing features" }, | |
a983c8f0 MM |
68 | /* sentinal */ |
69 | { nr_trace_options, NULL }, | |
70 | }; | |
71 | ||
72 | extern void | |
73 | trace_option(const char *option) | |
74 | { | |
75 | int setting = 1; | |
76 | if (option[0] == '!') { | |
77 | setting = 0; /* clear it */ | |
78 | option += 1; | |
79 | } | |
80 | if (strcmp(option, "all") == 0) { | |
81 | trace_options i; | |
82 | for (i = 0; i < nr_trace_options; i++) | |
83 | ppc_trace[i] = setting; | |
84 | } | |
85 | else { | |
86 | int i = 0; | |
87 | while (trace_description[i].option < nr_trace_options | |
88 | && strcmp(option, trace_description[i].name) != 0) | |
89 | i++; | |
90 | if (trace_description[i].option < nr_trace_options) | |
91 | ppc_trace[trace_description[i].option] = setting; | |
92 | else { | |
93 | i = strtoul(option, 0, 0); | |
94 | if (i > 0 && i < nr_trace_options) | |
95 | ppc_trace[i] = setting; | |
96 | else | |
97 | error("Unknown trace option: %s\n", option); | |
98 | } | |
99 | ||
100 | } | |
101 | } | |
102 | ||
103 | ||
104 | extern void | |
105 | trace_usage(void) | |
106 | { | |
107 | const char *format = "\t%-18s%s\n"; | |
108 | int i; | |
109 | printf_filtered("Possible <trace-option>s are:\n"); | |
110 | printf_filtered(format, "!<trace-option>", "Disable the specified option"); | |
111 | printf_filtered(format, "all", "enable all the trace options"); | |
112 | for (i = 0; trace_description[i].option < nr_trace_options; i++) | |
113 | printf_filtered(format, | |
114 | trace_description[i].name, | |
115 | (trace_description[i].description | |
116 | ? trace_description[i].description | |
117 | : "")); | |
118 | } | |
119 | ||
120 | #endif /* _DEBUG_C_ */ |