gdb: fix vfork with multiple threads
[deliverable/binutils-gdb.git] / sim / igen / misc.h
CommitLineData
feaee4bd
AC
1/* The IGEN simulator generator for GDB, the GNU Debugger.
2
3666a048 3 Copyright 2002-2021 Free Software Foundation, Inc.
feaee4bd
AC
4
5 Contributed by Andrew Cagney.
6
7 This file is part of GDB.
8
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
4744ac1b 11 the Free Software Foundation; either version 3 of the License, or
feaee4bd
AC
12 (at your option) any later version.
13
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.
18
19 You should have received a copy of the GNU General Public License
4744ac1b 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
feaee4bd 21
c906108c
SS
22
23
24/* Frustrating header junk */
25
4e0bf4c4
AC
26enum
27{
c906108c
SS
28 default_insn_bit_size = 32,
29 max_insn_bit_size = 64,
30};
31
32
33/* Define a 64bit data type */
34
35#if defined __GNUC__ || defined _WIN32
36#ifdef __GNUC__
37
38typedef long long signed64;
39typedef unsigned long long unsigned64;
40
4e0bf4c4 41#else /* _WIN32 */
c906108c
SS
42
43typedef __int64 signed64;
44typedef unsigned __int64 unsigned64;
45
46#endif /* _WIN32 */
47#else /* Not GNUC or WIN32 */
48/* Not supported */
49#endif
50
51
52#include <stdio.h>
53#include <ctype.h>
c906108c 54#include <string.h>
c906108c 55#include <stdlib.h>
c906108c
SS
56
57#if !defined (__attribute__) && (!defined(__GNUC__) || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7))
58#define __attribute__(arg)
59#endif
60
61
62
63#include "filter_host.h"
64
65typedef struct _line_ref line_ref;
4e0bf4c4
AC
66struct _line_ref
67{
c906108c
SS
68 const char *file_name;
69 int line_nr;
70};
71
72/* Error appends a new line, warning and notify do not */
4e0bf4c4 73typedef void error_func (const line_ref *line, char *msg, ...);
c906108c
SS
74
75extern error_func error;
76extern error_func warning;
77extern error_func notify;
78
79
80#define ERROR(EXPRESSION) \
81do { \
82 line_ref line; \
83 line.file_name = filter_filename (__FILE__); \
84 line.line_nr = __LINE__; \
85 error (&line, EXPRESSION); \
86} while (0)
87
88#define ASSERT(EXPRESSION) \
89do { \
90 if (!(EXPRESSION)) { \
91 line_ref line; \
92 line.file_name = filter_filename (__FILE__); \
93 line.line_nr = __LINE__; \
94 error(&line, "assertion failed - %s\n", #EXPRESSION); \
95 } \
96} while (0)
97
98#define ZALLOC(TYPE) ((TYPE*) zalloc (sizeof(TYPE)))
99#define NZALLOC(TYPE,N) ((TYPE*) zalloc (sizeof(TYPE) * (N)))
c906108c 100
4e0bf4c4 101extern void *zalloc (long size);
c906108c 102
4e0bf4c4 103extern unsigned target_a2i (int ms_bit_nr, const char *a);
c906108c 104
4e0bf4c4 105extern unsigned i2target (int ms_bit_nr, unsigned bit);
c906108c 106
4e0bf4c4 107extern unsigned long long a2i (const char *a);
c906108c
SS
108
109
110/* Try looking for name in the map table (returning the corresponding
111 integer value).
112
113 If the the sentinal (NAME == NULL) its value if >= zero is returned
114 as the default. */
115
4e0bf4c4
AC
116typedef struct _name_map
117{
c906108c
SS
118 const char *name;
119 int i;
4e0bf4c4
AC
120}
121name_map;
c906108c 122
4e0bf4c4 123extern int name2i (const char *name, const name_map * map);
c906108c 124
4e0bf4c4 125extern const char *i2name (const int i, const name_map * map);
This page took 0.945342 seconds and 4 git commands to generate.