xml-syscall.c revision 1.9 1 1.1 christos /* Functions that provide the mechanism to parse a syscall XML file
2 1.1 christos and get its values.
3 1.1 christos
4 1.9 christos Copyright (C) 2009-2020 Free Software Foundation, Inc.
5 1.1 christos
6 1.1 christos This file is part of GDB.
7 1.1 christos
8 1.1 christos This program is free software; you can redistribute it and/or modify
9 1.1 christos it under the terms of the GNU General Public License as published by
10 1.1 christos the Free Software Foundation; either version 3 of the License, or
11 1.1 christos (at your option) any later version.
12 1.1 christos
13 1.1 christos This program is distributed in the hope that it will be useful,
14 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of
15 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 1.1 christos GNU General Public License for more details.
17 1.1 christos
18 1.1 christos You should have received a copy of the GNU General Public License
19 1.1 christos along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 1.1 christos
21 1.1 christos #include "defs.h"
22 1.1 christos #include "gdbtypes.h"
23 1.1 christos #include "xml-support.h"
24 1.1 christos #include "xml-syscall.h"
25 1.3 christos #include "gdbarch.h"
26 1.1 christos
27 1.1 christos /* For the struct syscall definition. */
28 1.1 christos #include "target.h"
29 1.1 christos
30 1.1 christos #include "filenames.h"
31 1.1 christos
32 1.1 christos #ifndef HAVE_LIBEXPAT
33 1.1 christos
34 1.1 christos /* Dummy functions to indicate that there's no support for fetching
35 1.1 christos syscalls information. */
36 1.1 christos
37 1.1 christos static void
38 1.1 christos syscall_warn_user (void)
39 1.1 christos {
40 1.1 christos static int have_warned = 0;
41 1.1 christos if (!have_warned)
42 1.1 christos {
43 1.1 christos have_warned = 1;
44 1.1 christos warning (_("Can not parse XML syscalls information; XML support was "
45 1.1 christos "disabled at compile time."));
46 1.1 christos }
47 1.1 christos }
48 1.1 christos
49 1.1 christos void
50 1.3 christos set_xml_syscall_file_name (struct gdbarch *gdbarch, const char *name)
51 1.1 christos {
52 1.1 christos return;
53 1.1 christos }
54 1.1 christos
55 1.1 christos void
56 1.3 christos get_syscall_by_number (struct gdbarch *gdbarch,
57 1.3 christos int syscall_number, struct syscall *s)
58 1.1 christos {
59 1.1 christos syscall_warn_user ();
60 1.1 christos s->number = syscall_number;
61 1.1 christos s->name = NULL;
62 1.1 christos }
63 1.1 christos
64 1.8 christos bool
65 1.8 christos get_syscalls_by_name (struct gdbarch *gdbarch, const char *syscall_name,
66 1.8 christos std::vector<int> *syscall_numbers)
67 1.1 christos {
68 1.1 christos syscall_warn_user ();
69 1.8 christos return false;
70 1.1 christos }
71 1.1 christos
72 1.1 christos const char **
73 1.3 christos get_syscall_names (struct gdbarch *gdbarch)
74 1.1 christos {
75 1.1 christos syscall_warn_user ();
76 1.1 christos return NULL;
77 1.1 christos }
78 1.1 christos
79 1.8 christos bool
80 1.8 christos get_syscalls_by_group (struct gdbarch *gdbarch, const char *group,
81 1.8 christos std::vector<int> *syscall_numbers)
82 1.6 christos {
83 1.6 christos syscall_warn_user ();
84 1.8 christos return false;
85 1.6 christos }
86 1.6 christos
87 1.6 christos const char **
88 1.6 christos get_syscall_group_names (struct gdbarch *gdbarch)
89 1.6 christos {
90 1.6 christos syscall_warn_user ();
91 1.6 christos return NULL;
92 1.6 christos }
93 1.6 christos
94 1.1 christos #else /* ! HAVE_LIBEXPAT */
95 1.1 christos
96 1.1 christos /* Structure which describes a syscall. */
97 1.8 christos struct syscall_desc
98 1.1 christos {
99 1.8 christos syscall_desc (int number_, std::string name_, std::string alias_)
100 1.8 christos : number (number_), name (name_), alias (alias_)
101 1.8 christos {}
102 1.8 christos
103 1.1 christos /* The syscall number. */
104 1.1 christos
105 1.1 christos int number;
106 1.1 christos
107 1.1 christos /* The syscall name. */
108 1.1 christos
109 1.8 christos std::string name;
110 1.8 christos
111 1.8 christos /* An optional alias. */
112 1.8 christos
113 1.8 christos std::string alias;
114 1.8 christos };
115 1.8 christos
116 1.8 christos typedef std::unique_ptr<syscall_desc> syscall_desc_up;
117 1.1 christos
118 1.6 christos /* Structure of a syscall group. */
119 1.8 christos struct syscall_group_desc
120 1.6 christos {
121 1.8 christos syscall_group_desc (const std::string &name_)
122 1.8 christos : name (name_)
123 1.8 christos {}
124 1.8 christos
125 1.6 christos /* The group name. */
126 1.6 christos
127 1.8 christos std::string name;
128 1.6 christos
129 1.8 christos /* The syscalls that are part of the group. This is a non-owning
130 1.8 christos reference. */
131 1.8 christos
132 1.8 christos std::vector<syscall_desc *> syscalls;
133 1.8 christos };
134 1.6 christos
135 1.8 christos typedef std::unique_ptr<syscall_group_desc> syscall_group_desc_up;
136 1.6 christos
137 1.1 christos /* Structure that represents syscalls information. */
138 1.1 christos struct syscalls_info
139 1.1 christos {
140 1.1 christos /* The syscalls. */
141 1.1 christos
142 1.8 christos std::vector<syscall_desc_up> syscalls;
143 1.3 christos
144 1.6 christos /* The syscall groups. */
145 1.6 christos
146 1.8 christos std::vector<syscall_group_desc_up> groups;
147 1.6 christos
148 1.3 christos /* Variable that will hold the last known data-directory. This is
149 1.3 christos useful to know whether we should re-read the XML info for the
150 1.3 christos target. */
151 1.3 christos
152 1.8 christos std::string my_gdb_datadir;
153 1.1 christos };
154 1.1 christos
155 1.8 christos typedef std::unique_ptr<syscalls_info> syscalls_info_up;
156 1.8 christos
157 1.1 christos /* Callback data for syscall information parsing. */
158 1.1 christos struct syscall_parsing_data
159 1.1 christos {
160 1.1 christos /* The syscalls_info we are building. */
161 1.1 christos
162 1.3 christos struct syscalls_info *syscalls_info;
163 1.1 christos };
164 1.1 christos
165 1.6 christos /* Create a new syscall group. Return pointer to the
166 1.6 christos syscall_group_desc structure that represents the new group. */
167 1.6 christos
168 1.6 christos static struct syscall_group_desc *
169 1.6 christos syscall_group_create_syscall_group_desc (struct syscalls_info *syscalls_info,
170 1.6 christos const char *group)
171 1.6 christos {
172 1.8 christos syscall_group_desc *groupdesc = new syscall_group_desc (group);
173 1.6 christos
174 1.8 christos syscalls_info->groups.emplace_back (groupdesc);
175 1.6 christos
176 1.6 christos return groupdesc;
177 1.6 christos }
178 1.6 christos
179 1.6 christos /* Add a syscall to the group. If group doesn't exist, create it. */
180 1.6 christos
181 1.6 christos static void
182 1.6 christos syscall_group_add_syscall (struct syscalls_info *syscalls_info,
183 1.6 christos struct syscall_desc *syscall,
184 1.6 christos const char *group)
185 1.6 christos {
186 1.8 christos /* Search for an existing group. */
187 1.8 christos std::vector<syscall_group_desc_up>::iterator it
188 1.8 christos = syscalls_info->groups.begin ();
189 1.6 christos
190 1.8 christos for (; it != syscalls_info->groups.end (); it++)
191 1.6 christos {
192 1.8 christos if ((*it)->name == group)
193 1.6 christos break;
194 1.6 christos }
195 1.6 christos
196 1.8 christos syscall_group_desc *groupdesc;
197 1.8 christos
198 1.8 christos if (it != syscalls_info->groups.end ())
199 1.8 christos groupdesc = it->get ();
200 1.8 christos else
201 1.6 christos {
202 1.6 christos /* No group was found with this name. We must create a new
203 1.6 christos one. */
204 1.6 christos groupdesc = syscall_group_create_syscall_group_desc (syscalls_info,
205 1.6 christos group);
206 1.6 christos }
207 1.6 christos
208 1.8 christos groupdesc->syscalls.push_back (syscall);
209 1.6 christos }
210 1.6 christos
211 1.1 christos static void
212 1.3 christos syscall_create_syscall_desc (struct syscalls_info *syscalls_info,
213 1.8 christos const char *name, int number, const char *alias,
214 1.6 christos char *groups)
215 1.1 christos {
216 1.8 christos syscall_desc *sysdesc = new syscall_desc (number, name,
217 1.8 christos alias != NULL ? alias : "");
218 1.1 christos
219 1.8 christos syscalls_info->syscalls.emplace_back (sysdesc);
220 1.6 christos
221 1.6 christos /* Add syscall to its groups. */
222 1.6 christos if (groups != NULL)
223 1.6 christos {
224 1.9 christos char *saveptr;
225 1.9 christos for (char *group = strtok_r (groups, ",", &saveptr);
226 1.6 christos group != NULL;
227 1.9 christos group = strtok_r (NULL, ",", &saveptr))
228 1.6 christos syscall_group_add_syscall (syscalls_info, sysdesc, group);
229 1.6 christos }
230 1.1 christos }
231 1.1 christos
232 1.1 christos /* Handle the start of a <syscall> element. */
233 1.1 christos static void
234 1.1 christos syscall_start_syscall (struct gdb_xml_parser *parser,
235 1.1 christos const struct gdb_xml_element *element,
236 1.8 christos void *user_data,
237 1.8 christos std::vector<gdb_xml_value> &attributes)
238 1.1 christos {
239 1.6 christos struct syscall_parsing_data *data = (struct syscall_parsing_data *) user_data;
240 1.1 christos /* syscall info. */
241 1.1 christos char *name = NULL;
242 1.1 christos int number = 0;
243 1.8 christos char *alias = NULL;
244 1.6 christos char *groups = NULL;
245 1.1 christos
246 1.8 christos for (const gdb_xml_value &attr : attributes)
247 1.1 christos {
248 1.8 christos if (strcmp (attr.name, "name") == 0)
249 1.8 christos name = (char *) attr.value.get ();
250 1.8 christos else if (strcmp (attr.name, "number") == 0)
251 1.8 christos number = * (ULONGEST *) attr.value.get ();
252 1.8 christos else if (strcmp (attr.name, "alias") == 0)
253 1.8 christos alias = (char *) attr.value.get ();
254 1.8 christos else if (strcmp (attr.name, "groups") == 0)
255 1.8 christos groups = (char *) attr.value.get ();
256 1.1 christos else
257 1.1 christos internal_error (__FILE__, __LINE__,
258 1.8 christos _("Unknown attribute name '%s'."), attr.name);
259 1.1 christos }
260 1.1 christos
261 1.1 christos gdb_assert (name);
262 1.8 christos syscall_create_syscall_desc (data->syscalls_info, name, number, alias,
263 1.8 christos groups);
264 1.1 christos }
265 1.1 christos
266 1.1 christos
267 1.1 christos /* The elements and attributes of an XML syscall document. */
268 1.1 christos static const struct gdb_xml_attribute syscall_attr[] = {
269 1.1 christos { "number", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
270 1.1 christos { "name", GDB_XML_AF_NONE, NULL, NULL },
271 1.8 christos { "alias", GDB_XML_AF_OPTIONAL, NULL, NULL },
272 1.6 christos { "groups", GDB_XML_AF_OPTIONAL, NULL, NULL },
273 1.1 christos { NULL, GDB_XML_AF_NONE, NULL, NULL }
274 1.1 christos };
275 1.1 christos
276 1.1 christos static const struct gdb_xml_element syscalls_info_children[] = {
277 1.1 christos { "syscall", syscall_attr, NULL,
278 1.1 christos GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
279 1.1 christos syscall_start_syscall, NULL },
280 1.1 christos { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
281 1.1 christos };
282 1.1 christos
283 1.1 christos static const struct gdb_xml_element syselements[] = {
284 1.1 christos { "syscalls_info", NULL, syscalls_info_children,
285 1.1 christos GDB_XML_EF_NONE, NULL, NULL },
286 1.1 christos { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
287 1.1 christos };
288 1.1 christos
289 1.1 christos static struct syscalls_info *
290 1.1 christos syscall_parse_xml (const char *document, xml_fetch_another fetcher,
291 1.1 christos void *fetcher_baton)
292 1.1 christos {
293 1.1 christos struct syscall_parsing_data data;
294 1.8 christos syscalls_info_up sysinfo (new syscalls_info ());
295 1.1 christos
296 1.8 christos data.syscalls_info = sysinfo.get ();
297 1.1 christos
298 1.1 christos if (gdb_xml_parse_quick (_("syscalls info"), NULL,
299 1.1 christos syselements, document, &data) == 0)
300 1.1 christos {
301 1.1 christos /* Parsed successfully. */
302 1.8 christos return sysinfo.release ();
303 1.1 christos }
304 1.1 christos else
305 1.1 christos {
306 1.1 christos warning (_("Could not load XML syscalls info; ignoring"));
307 1.1 christos return NULL;
308 1.1 christos }
309 1.1 christos }
310 1.1 christos
311 1.1 christos /* Function responsible for initializing the information
312 1.1 christos about the syscalls. It reads the XML file and fills the
313 1.1 christos struct syscalls_info with the values.
314 1.1 christos
315 1.1 christos Returns the struct syscalls_info if the file is valid, NULL otherwise. */
316 1.3 christos static struct syscalls_info *
317 1.1 christos xml_init_syscalls_info (const char *filename)
318 1.1 christos {
319 1.8 christos gdb::optional<gdb::char_vector> full_file
320 1.9 christos = xml_fetch_content_from_file (filename,
321 1.9 christos const_cast<char *>(gdb_datadir.c_str ()));
322 1.8 christos if (!full_file)
323 1.1 christos return NULL;
324 1.1 christos
325 1.8 christos return syscall_parse_xml (full_file->data (),
326 1.8 christos xml_fetch_content_from_file,
327 1.8 christos (void *) ldirname (filename).c_str ());
328 1.1 christos }
329 1.1 christos
330 1.1 christos /* Initializes the syscalls_info structure according to the
331 1.1 christos architecture. */
332 1.1 christos static void
333 1.3 christos init_syscalls_info (struct gdbarch *gdbarch)
334 1.1 christos {
335 1.3 christos struct syscalls_info *syscalls_info = gdbarch_syscalls_info (gdbarch);
336 1.3 christos const char *xml_syscall_file = gdbarch_xml_syscall_file (gdbarch);
337 1.3 christos
338 1.1 christos /* Should we re-read the XML info for this target? */
339 1.8 christos if (syscalls_info != NULL && !syscalls_info->my_gdb_datadir.empty ()
340 1.8 christos && filename_cmp (syscalls_info->my_gdb_datadir.c_str (),
341 1.9 christos gdb_datadir.c_str ()) != 0)
342 1.1 christos {
343 1.1 christos /* The data-directory changed from the last time we used it.
344 1.1 christos It means that we have to re-read the XML info. */
345 1.8 christos delete syscalls_info;
346 1.3 christos syscalls_info = NULL;
347 1.3 christos set_gdbarch_syscalls_info (gdbarch, NULL);
348 1.1 christos }
349 1.1 christos
350 1.3 christos /* Did we succeed at initializing this? */
351 1.3 christos if (syscalls_info != NULL)
352 1.1 christos return;
353 1.1 christos
354 1.3 christos syscalls_info = xml_init_syscalls_info (xml_syscall_file);
355 1.1 christos
356 1.3 christos /* If there was some error reading the XML file, we initialize
357 1.3 christos gdbarch->syscalls_info anyway, in order to store information
358 1.3 christos about our attempt. */
359 1.3 christos if (syscalls_info == NULL)
360 1.8 christos syscalls_info = new struct syscalls_info ();
361 1.1 christos
362 1.8 christos if (syscalls_info->syscalls.empty ())
363 1.1 christos {
364 1.3 christos if (xml_syscall_file != NULL)
365 1.1 christos warning (_("Could not load the syscall XML file `%s/%s'."),
366 1.9 christos gdb_datadir.c_str (), xml_syscall_file);
367 1.1 christos else
368 1.1 christos warning (_("There is no XML file to open."));
369 1.1 christos
370 1.1 christos warning (_("GDB will not be able to display "
371 1.1 christos "syscall names nor to verify if\n"
372 1.1 christos "any provided syscall numbers are valid."));
373 1.1 christos }
374 1.1 christos
375 1.1 christos /* Saving the data-directory used to read this XML info. */
376 1.8 christos syscalls_info->my_gdb_datadir.assign (gdb_datadir);
377 1.3 christos
378 1.3 christos set_gdbarch_syscalls_info (gdbarch, syscalls_info);
379 1.1 christos }
380 1.1 christos
381 1.6 christos /* Search for a syscall group by its name. Return syscall_group_desc
382 1.6 christos structure for the group if found or NULL otherwise. */
383 1.6 christos
384 1.6 christos static struct syscall_group_desc *
385 1.6 christos syscall_group_get_group_by_name (const struct syscalls_info *syscalls_info,
386 1.6 christos const char *group)
387 1.6 christos {
388 1.6 christos if (syscalls_info == NULL)
389 1.6 christos return NULL;
390 1.6 christos
391 1.6 christos if (group == NULL)
392 1.6 christos return NULL;
393 1.6 christos
394 1.8 christos /* Search for existing group. */
395 1.8 christos for (const syscall_group_desc_up &groupdesc : syscalls_info->groups)
396 1.6 christos {
397 1.8 christos if (groupdesc->name == group)
398 1.8 christos return groupdesc.get ();
399 1.6 christos }
400 1.6 christos
401 1.6 christos return NULL;
402 1.6 christos }
403 1.6 christos
404 1.8 christos static bool
405 1.8 christos xml_get_syscalls_by_name (struct gdbarch *gdbarch, const char *syscall_name,
406 1.8 christos std::vector<int> *syscall_numbers)
407 1.1 christos {
408 1.3 christos struct syscalls_info *syscalls_info = gdbarch_syscalls_info (gdbarch);
409 1.1 christos
410 1.8 christos bool found = false;
411 1.8 christos if (syscalls_info != NULL && syscall_name != NULL && syscall_numbers != NULL)
412 1.8 christos for (const syscall_desc_up &sysdesc : syscalls_info->syscalls)
413 1.8 christos if (sysdesc->name == syscall_name || sysdesc->alias == syscall_name)
414 1.8 christos {
415 1.8 christos syscall_numbers->push_back (sysdesc->number);
416 1.8 christos found = true;
417 1.8 christos }
418 1.1 christos
419 1.8 christos return found;
420 1.1 christos }
421 1.1 christos
422 1.1 christos static const char *
423 1.3 christos xml_get_syscall_name (struct gdbarch *gdbarch,
424 1.1 christos int syscall_number)
425 1.1 christos {
426 1.3 christos struct syscalls_info *syscalls_info = gdbarch_syscalls_info (gdbarch);
427 1.1 christos
428 1.3 christos if (syscalls_info == NULL
429 1.1 christos || syscall_number < 0)
430 1.1 christos return NULL;
431 1.1 christos
432 1.8 christos for (const syscall_desc_up &sysdesc : syscalls_info->syscalls)
433 1.1 christos if (sysdesc->number == syscall_number)
434 1.8 christos return sysdesc->name.c_str ();
435 1.1 christos
436 1.1 christos return NULL;
437 1.1 christos }
438 1.1 christos
439 1.1 christos static const char **
440 1.3 christos xml_list_of_syscalls (struct gdbarch *gdbarch)
441 1.1 christos {
442 1.3 christos struct syscalls_info *syscalls_info = gdbarch_syscalls_info (gdbarch);
443 1.1 christos
444 1.3 christos if (syscalls_info == NULL)
445 1.1 christos return NULL;
446 1.1 christos
447 1.8 christos int nsyscalls = syscalls_info->syscalls.size ();
448 1.8 christos const char **names = XNEWVEC (const char *, nsyscalls + 1);
449 1.1 christos
450 1.8 christos int i;
451 1.8 christos for (i = 0; i < syscalls_info->syscalls.size (); i++)
452 1.8 christos names[i] = syscalls_info->syscalls[i]->name.c_str ();
453 1.1 christos
454 1.1 christos names[i] = NULL;
455 1.1 christos
456 1.1 christos return names;
457 1.1 christos }
458 1.1 christos
459 1.6 christos /* Iterate over the syscall_group_desc element to return a list of
460 1.8 christos syscalls that are part of the given group. If the syscall group
461 1.8 christos doesn't exist, return false. */
462 1.6 christos
463 1.8 christos static bool
464 1.8 christos xml_list_syscalls_by_group (struct gdbarch *gdbarch, const char *group,
465 1.8 christos std::vector<int> *syscalls)
466 1.6 christos {
467 1.6 christos struct syscalls_info *syscalls_info = gdbarch_syscalls_info (gdbarch);
468 1.6 christos struct syscall_group_desc *groupdesc;
469 1.6 christos
470 1.8 christos if (syscalls_info == NULL || syscalls == NULL)
471 1.8 christos return false;
472 1.6 christos
473 1.6 christos groupdesc = syscall_group_get_group_by_name (syscalls_info, group);
474 1.6 christos if (groupdesc == NULL)
475 1.8 christos return false;
476 1.6 christos
477 1.8 christos for (const syscall_desc *sysdesc : groupdesc->syscalls)
478 1.8 christos syscalls->push_back (sysdesc->number);
479 1.6 christos
480 1.8 christos return true;
481 1.6 christos }
482 1.6 christos
483 1.6 christos /* Return a NULL terminated list of syscall groups or an empty list, if
484 1.6 christos no syscall group is available. Return NULL, if there is no syscall
485 1.6 christos information available. */
486 1.6 christos
487 1.6 christos static const char **
488 1.6 christos xml_list_of_groups (struct gdbarch *gdbarch)
489 1.6 christos {
490 1.6 christos struct syscalls_info *syscalls_info = gdbarch_syscalls_info (gdbarch);
491 1.6 christos const char **names = NULL;
492 1.8 christos int ngroups;
493 1.6 christos int i;
494 1.6 christos
495 1.6 christos if (syscalls_info == NULL)
496 1.6 christos return NULL;
497 1.6 christos
498 1.8 christos ngroups = syscalls_info->groups.size ();
499 1.6 christos names = (const char**) xmalloc ((ngroups + 1) * sizeof (char *));
500 1.6 christos
501 1.8 christos for (i = 0; i < syscalls_info->groups.size (); i++)
502 1.8 christos names[i] = syscalls_info->groups[i]->name.c_str ();
503 1.6 christos
504 1.6 christos names[i] = NULL;
505 1.6 christos
506 1.6 christos return names;
507 1.6 christos }
508 1.6 christos
509 1.1 christos void
510 1.3 christos set_xml_syscall_file_name (struct gdbarch *gdbarch, const char *name)
511 1.1 christos {
512 1.3 christos set_gdbarch_xml_syscall_file (gdbarch, name);
513 1.1 christos }
514 1.1 christos
515 1.1 christos void
516 1.3 christos get_syscall_by_number (struct gdbarch *gdbarch,
517 1.3 christos int syscall_number, struct syscall *s)
518 1.1 christos {
519 1.3 christos init_syscalls_info (gdbarch);
520 1.1 christos
521 1.1 christos s->number = syscall_number;
522 1.3 christos s->name = xml_get_syscall_name (gdbarch, syscall_number);
523 1.1 christos }
524 1.1 christos
525 1.8 christos bool
526 1.8 christos get_syscalls_by_name (struct gdbarch *gdbarch, const char *syscall_name,
527 1.8 christos std::vector<int> *syscall_numbers)
528 1.1 christos {
529 1.3 christos init_syscalls_info (gdbarch);
530 1.1 christos
531 1.8 christos return xml_get_syscalls_by_name (gdbarch, syscall_name, syscall_numbers);
532 1.1 christos }
533 1.1 christos
534 1.1 christos const char **
535 1.3 christos get_syscall_names (struct gdbarch *gdbarch)
536 1.1 christos {
537 1.3 christos init_syscalls_info (gdbarch);
538 1.1 christos
539 1.3 christos return xml_list_of_syscalls (gdbarch);
540 1.1 christos }
541 1.1 christos
542 1.6 christos /* See comment in xml-syscall.h. */
543 1.6 christos
544 1.8 christos bool
545 1.8 christos get_syscalls_by_group (struct gdbarch *gdbarch, const char *group,
546 1.8 christos std::vector<int> *syscall_numbers)
547 1.6 christos {
548 1.6 christos init_syscalls_info (gdbarch);
549 1.6 christos
550 1.8 christos return xml_list_syscalls_by_group (gdbarch, group, syscall_numbers);
551 1.6 christos }
552 1.6 christos
553 1.6 christos /* See comment in xml-syscall.h. */
554 1.6 christos
555 1.6 christos const char **
556 1.6 christos get_syscall_group_names (struct gdbarch *gdbarch)
557 1.6 christos {
558 1.6 christos init_syscalls_info (gdbarch);
559 1.6 christos
560 1.6 christos return xml_list_of_groups (gdbarch);
561 1.6 christos }
562 1.6 christos
563 1.1 christos #endif /* ! HAVE_LIBEXPAT */
564