2
* gdb-lex.h - A GLib-based parser for GNU debugger machine interface output.
3
* Copyright 2008 Jeff Pohlmeyer <yetanothergeek(at)gmail(dot)com>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License along
18
* with this program; if not, write to the Free Software Foundation, Inc.,
19
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
Simply put, the GDB/MI output is parsed into one of three types:
29
anything inside quotes is a string; anything inside curly brackets
30
is a hash table; and anything inside square braces is a list.
31
In some cases list elements are produced by GDB as key-value pairs
32
with duplicate key names for each element. For these cases the
33
key names are safely and silently ignored, only the values are kept.
38
{ vt_STRING, vt_HASH, vt_LIST } GdbLxValueType;
54
GHashTable *gdblx_parse_results(gchar * resutls);
57
The gdblx_lookup_* functions below return NULL if their hash is NULL,
58
if the key is not found, or if its value is not of the expected
61
gchar *gdblx_lookup_string(GHashTable * hash, gchar * key);
62
GHashTable *gdblx_lookup_hash(GHashTable * hash, gchar * key);
63
GSList *gdblx_lookup_list(GHashTable * hash, gchar * key);
66
Returns TRUE if hash is not NULL, key exists, and key type is vt_STRING,
67
and the key's value matches 'expected'.
69
gboolean gdblx_check_keyval(GHashTable * hash, gchar * key, gchar * expected);
72
/* Dumps a pretty-printed representation of the hash table to stderr */
73
void gdblx_dump_table(GHashTable * hash);
78
The global scanner object is automatically intialized as soon
79
as it is needed, but it must be explicitly destroyed.
81
void gdblx_scanner_done();