1 /* The IGEN simulator generator for GDB, the GNU Debugger.
3 Copyright 2002 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 2 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, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
45 /* NB: Because warning and error can be interchanged, neither append a
49 error (const line_ref
*line
,
55 fprintf (stderr
, "%s:%d: ", line
->file_name
, line
->line_nr
);
57 vfprintf (stderr
, msg
, ap
);
63 warning (const line_ref
*line
,
69 fprintf (stderr
, "%s:%d: warning: ", line
->file_name
, line
->line_nr
);
71 vfprintf (stderr
, msg
, ap
);
76 notify (const line_ref
*line
,
82 fprintf (stdout
, "%s %d: info: ", line
->file_name
, line
->line_nr
);
84 vfprintf (stdout
, msg
, ap
);
91 void *memory
= malloc(size
);
93 ERROR ("zalloc failed");
94 memset(memory
, 0, size
);
104 unsigned long long num
= 0;
110 if (strcmp (a
, "true") == 0
111 || strcmp (a
, "TRUE") == 0)
114 if (strcmp (a
, "false") == 0
115 || strcmp (a
, "false") == 0)
126 if (a
[1] == 'x' || a
[1] == 'X')
131 else if (a
[1] == 'b' || a
[1] == 'b')
152 if (ch
>= '0' && ch
<= '1')
154 num
= (num
* 2) + (ch
- '0');
163 if (ch
>= '0' && ch
<= '9')
165 num
= (num
* 10) + (ch
- '0');
174 if (ch
>= '0' && ch
<= '7')
176 num
= (num
* 8) + (ch
- '0');
185 if (ch
>= '0' && ch
<= '9')
187 num
= (num
* 16) + (ch
- '0');
189 else if (ch
>= 'a' && ch
<= 'f')
191 num
= (num
* 16) + (ch
- 'a' + 10);
193 else if (ch
>= 'A' && ch
<= 'F')
195 num
= (num
* 16) + (ch
- 'A' + 10);
212 target_a2i(int ms_bit_nr
,
216 return (ms_bit_nr
- a2i(a
));
222 i2target(int ms_bit_nr
,
226 return ms_bit_nr
- bit
;
233 name2i (const char *names
,
236 const name_map
*curr
;
237 const char *name
= names
;
238 while (*name
!= '\0')
241 char *end
= strchr(name
, ',');
246 end
= strchr(name
, '\0');
256 while (curr
->name
!= NULL
)
258 if (strncmp (curr
->name
, name
, len
) == 0
259 && strlen (curr
->name
) == len
)
265 /* nothing found, possibly return a default */
267 while (curr
->name
!= NULL
)
272 error (NULL
, "%s contains no valid names", names
);
280 while (map
->name
!= NULL
)
286 error (NULL
, "map lookup failed for %d\n", i
);
This page took 0.035774 seconds and 4 git commands to generate.