home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gdb-4.16-base.tgz / gdb-4.16-base.tar / fsf / gdb / sim / ppc / debug.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-22  |  2.8 KB  |  124 lines

  1. /*  This file is part of the program psim.
  2.  
  3.     Copyright (C) 1994-1996, 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_H_
  23. #define _DEBUG_H_
  24.  
  25. #include "filter_filename.h"
  26.  
  27. typedef enum {
  28.   trace_invalid,
  29.   trace_tbd,
  30.   /**/
  31.   trace_gdb,
  32.   trace_os_emul,
  33.   /**/
  34.   trace_device_tree,
  35.   trace_devices,
  36.   trace_pass_device,
  37.   trace_console_device,
  38.   trace_icu_device,
  39.   trace_halt_device,
  40.   trace_register_device,
  41.   trace_vm_device,
  42.   trace_memory_device,
  43.   trace_htab_device,
  44.   trace_binary_device,
  45.   trace_file_device,
  46.   trace_core_device,
  47.   trace_stack_device,
  48.   /**/
  49.   trace_semantics,
  50.   trace_idecode,
  51.   trace_alu,
  52.   trace_load_store,
  53.   trace_model,
  54.   /**/
  55.   trace_vm,
  56.   trace_core,
  57.   trace_psim,
  58.   trace_device_init,
  59.   trace_cpu,
  60.   trace_breakpoint,
  61.   trace_opts,
  62.   trace_print_info,
  63.   trace_print_device_tree,
  64.   trace_dump_device_tree,
  65.   nr_trace_options
  66. } trace_options;
  67.  
  68.  
  69.  
  70. extern int ppc_trace[nr_trace_options];
  71.  
  72. #if WITH_TRACE
  73. #define TRACE(OBJECT, ARGS) \
  74. do { \
  75.   if (ppc_trace[OBJECT]) { \
  76.     printf_filtered("%s:%d: ", filter_filename(__FILE__), __LINE__); \
  77.     printf_filtered ARGS; \
  78.   } \
  79. } while (0)
  80. /* issue */
  81. #define ITRACE(OBJECT, ARGS) \
  82. do { \
  83.   if (ppc_trace[OBJECT]) { \
  84.     printf_filtered("%s:%d:0x%lx", my_prefix, cpu_nr(processor) + 1, (unsigned long)cia); \
  85.     printf_filtered ARGS; \
  86.   } \
  87. } while (0)
  88. /* device */
  89. #define DTRACE(OBJECT, ARGS) \
  90. do { \
  91.   if (ppc_trace[trace_devices] || ppc_trace[trace_##OBJECT##_device]) { \
  92.     printf_filtered("%s:%d:%s: ", filter_filename(__FILE__), __LINE__, #OBJECT); \
  93.     printf_filtered ARGS; \
  94.   } \
  95. } while (0)
  96. #else
  97. #define TRACE(OBJECT, ARGS)
  98. #define ITRACE(OBJECT, ARGS)
  99. #define DTRACE(OBJECT, ARGS)
  100. #endif
  101.  
  102. #if WITH_ASSERT
  103. #define ASSERT(EXPRESSION) \
  104. do { \
  105.   if (!(EXPRESSION)) { \
  106.     error("%s:%d: assertion failed - %s\n", \
  107.       filter_filename(__FILE__), __LINE__, #EXPRESSION); \
  108.   } \
  109. } while (0)
  110. #else
  111. #define ASSERT(EXPRESSION)
  112. #endif
  113.  
  114. /* Parse OPTION updating the trace array */
  115. extern void
  116. trace_option(const char *option, int setting);
  117.  
  118. /* Output the list of trace options */
  119. extern void trace_usage
  120. (int verbose);
  121.  
  122.  
  123. #endif /* _DEBUG_H_ */
  124.