]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/ppc/debug.c
sim: unify -Werror build settings
[thirdparty/binutils-gdb.git] / sim / ppc / debug.c
1 /* This file is part of the program psim.
2
3 Copyright (C) 1994-1997, 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 3 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, see <http://www.gnu.org/licenses/>.
17
18 */
19
20
21 #ifndef _DEBUG_C_
22 #define _DEBUG_C_
23
24 /* This must come before any other includes. */
25 #include "defs.h"
26
27 #include "basics.h"
28
29 #include <stdlib.h>
30 #include <string.h>
31
32 int ppc_trace[nr_trace_options];
33
34 typedef struct _trace_option_descriptor {
35 trace_options option;
36 const char *name;
37 const char *description;
38 } trace_option_descriptor;
39
40 static trace_option_descriptor trace_description[] = {
41 { trace_gdb, "gdb", "calls made by gdb to the sim_calls.c file" },
42 { trace_os_emul, "os-emul", "VEA mode sytem calls - like strace" },
43 { trace_events, "events", "event queue handling" },
44 /* decode/issue */
45 { trace_semantics, "semantics", "Instruction execution (issue)" },
46 { trace_idecode, "idecode", "instruction decode (when miss in icache)" },
47 { trace_alu, "alu", "results of integer ALU" },
48 { trace_vm, "vm", "OEA address translation" },
49 { trace_load_store, "load-store", "transfers between registers and memory" },
50 { trace_model, "model", "model specific information" },
51 { trace_interrupts, "interrupts", "interrupt handling" },
52 /* devices */
53 { trace_device_tree, "device-tree", },
54 { trace_devices, "devices" },
55 { trace_binary_device, "binary-device" },
56 { trace_com_device, "com-device" },
57 { trace_console_device, "console-device" },
58 { trace_core_device, "core-device" },
59 { trace_disk_device, "disk-device" },
60 { trace_eeprom_device, "eeprom-device" },
61 { trace_file_device, "file-device" },
62 { trace_glue_device, "glue-device" },
63 { trace_halt_device, "halt-device" },
64 { trace_htab_device, "htab-device" },
65 { trace_icu_device, "icu-device" },
66 { trace_ide_device, "ide-device" },
67 { trace_memory_device, "memory-device" },
68 { trace_opic_device, "opic-device" },
69 { trace_pal_device, "pal-device" },
70 { trace_pass_device, "pass-device" },
71 { trace_phb_device, "phb-device" },
72 { trace_register_device, "register-device", "Device initializing registers" },
73 { trace_sem_device, "sem-device" },
74 { trace_shm_device, "shm-device" },
75 { trace_stack_device, "stack-device" },
76 { trace_vm_device, "vm-device" },
77 /* packages */
78 { trace_disklabel_package, "disklabel-package" },
79 /* misc */
80 { trace_print_info, "print-info", "Print performance analysis information" },
81 { trace_opts, "options", "Print options simulator was compiled with" },
82 /*{ trace_tbd, "tbd", "Trace any missing features" },*/
83 { trace_print_device_tree, "print-device-tree", "Output the contents of the device tree" },
84 { trace_dump_device_tree, "dump-device-tree", "Output the contents of the device tree then exit" },
85 /* sentinal */
86 { nr_trace_options, NULL },
87 };
88
89 extern void
90 trace_option(const char *option,
91 int setting)
92 {
93 if (strcmp(option, "all") == 0) {
94 trace_options i;
95 for (i = 0; i < nr_trace_options; i++)
96 if (i != trace_dump_device_tree) {
97 ppc_trace[i] = setting;
98 }
99 }
100 else {
101 int i = 0;
102 while (trace_description[i].option < nr_trace_options
103 && strcmp(option, trace_description[i].name) != 0)
104 i++;
105 if (trace_description[i].option < nr_trace_options)
106 ppc_trace[trace_description[i].option] = setting;
107 else {
108 i = strtoul(option, 0, 0);
109 if (i > 0 && i < nr_trace_options)
110 ppc_trace[i] = setting;
111 else
112 error("Unknown trace option: %s\n", option);
113 }
114
115 }
116 }
117
118
119 extern void
120 trace_usage(int verbose)
121 {
122 if (verbose) {
123 printf_filtered("\n");
124 printf_filtered("The following are possible <trace> options:\n");
125 printf_filtered("\n");
126 }
127 if (verbose == 1) {
128 int pos;
129 int i;
130 printf_filtered(" all");
131 pos = strlen("all") + 2;
132 for (i = 0; trace_description[i].option < nr_trace_options; i++) {
133 pos += strlen(trace_description[i].name) + 2;
134 if (pos > 75) {
135 pos = strlen(trace_description[i].name) + 2;
136 printf_filtered("\n");
137 }
138 printf_filtered(" %s", trace_description[i].name);
139 }
140 printf_filtered("\n");
141 }
142 if (verbose > 1) {
143 const char *format = "\t%-18s%s\n";
144 int i;
145 printf_filtered(format, "all", "enable all the trace options");
146 for (i = 0; trace_description[i].option < nr_trace_options; i++)
147 printf_filtered(format,
148 trace_description[i].name,
149 (trace_description[i].description
150 ? trace_description[i].description
151 : ""));
152 }
153 }
154
155 #endif /* _DEBUG_C_ */