Debug info is lost for functions only called from functions marked with cmse_nonsecur...
[binutils-gdb.git] / sim / igen / misc.h
blobeff8a203cabf0dc432edafc222f51fdacceff6c2
1 /* The IGEN simulator generator for GDB, the GNU Debugger.
3 Copyright 2002-2023 Free Software Foundation, Inc.
5 Contributed by Andrew Cagney.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 /* Frustrating header junk */
26 enum
28 default_insn_bit_size = 32,
29 max_insn_bit_size = 64,
33 #include <ctype.h>
34 #include <stdint.h>
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <string.h>
39 #include "ansidecl.h"
41 #include "filter_host.h"
43 typedef struct _line_ref line_ref;
44 struct _line_ref
46 const char *file_name;
47 int line_nr;
50 /* Error appends a new line, warning and notify do not */
51 typedef void error_func (const line_ref *line, const char *msg, ...)
52 ATTRIBUTE_PRINTF (2, 3);
54 extern ATTRIBUTE_NORETURN error_func error;
55 extern error_func warning;
56 extern error_func notify;
59 #define ERROR(EXPRESSION) \
60 do { \
61 line_ref line; \
62 line.file_name = filter_filename (__FILE__); \
63 line.line_nr = __LINE__; \
64 error (&line, EXPRESSION "\n"); \
65 } while (0)
67 #define ASSERT(EXPRESSION) \
68 do { \
69 if (!(EXPRESSION)) { \
70 line_ref line; \
71 line.file_name = filter_filename (__FILE__); \
72 line.line_nr = __LINE__; \
73 error (&line, "assertion failed - %s\n", #EXPRESSION); \
74 } \
75 } while (0)
77 #define ZALLOC(TYPE) ((TYPE*) zalloc (sizeof(TYPE)))
78 #define NZALLOC(TYPE,N) ((TYPE*) zalloc (sizeof(TYPE) * (N)))
80 extern void *zalloc (long size);
82 extern unsigned target_a2i (int ms_bit_nr, const char *a);
84 extern unsigned i2target (int ms_bit_nr, unsigned bit);
86 extern unsigned long long a2i (const char *a);
89 /* Try looking for name in the map table (returning the corresponding
90 integer value).
92 If the the sentinal (NAME == NULL) its value if >= zero is returned
93 as the default. */
95 typedef struct _name_map
97 const char *name;
98 int i;
100 name_map;
102 extern int name2i (const char *name, const name_map * map);
104 extern const char *i2name (const int i, const name_map * map);