OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [sim/] [ppc/] [debug.c] - Blame information for rev 252

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.