diff options
author | Pedro Alves <palves@redhat.com> | 2011-01-25 09:49:59 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2011-01-25 09:49:59 +0000 |
commit | efc0eabd6019406ff92286a36713d41a42515e09 (patch) | |
tree | ba00441bc43cc80496e16e09e2e9ae366e2079dd /gdb/remote.c | |
parent | f30f86fa955570721c2c0c95468d975f216bf754 (diff) | |
download | gdb-efc0eabd6019406ff92286a36713d41a42515e09.zip gdb-efc0eabd6019406ff92286a36713d41a42515e09.tar.gz gdb-efc0eabd6019406ff92286a36713d41a42515e09.tar.bz2 |
Simplify XML parsing a bit.
* xml-support.h (gdb_xml_parse_quick): Declare.
* xml-support.c (gdb_xml_create_parser_and_cleanup_1): Renamed
from gdb_xml_create_parser_and_cleanup, and added `old_chain'
parameter.
(gdb_xml_create_parser_and_cleanup): Reimplement on top of
gdb_xml_create_parser_and_cleanup_1.
(gdb_xml_parse_quick): New.
* memory-map.c (parse_memory_map): Use gdb_xml_parse_quick.
* osdata.c (osdata_parse): Ditto.
* remote.c (remote_threads_info): Ditto.
* solib-target.c (solib_target_parse_libraries): Ditto.
* xml-syscall.c (syscall_parse_xml): Ditto.
* xml-tdesc.c (tdesc_parse_xml): Ditto.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r-- | gdb/remote.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index 528e22f..48d9d55 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2595,25 +2595,16 @@ remote_threads_info (struct target_ops *ops) TARGET_OBJECT_THREADS, NULL); struct cleanup *back_to = make_cleanup (xfree, xml); + if (xml && *xml) { - struct gdb_xml_parser *parser; struct threads_parsing_context context; - struct cleanup *clear_parsing_context; - - context.items = 0; - /* Note: this parser cleanup is already guarded by BACK_TO - above. */ - parser = gdb_xml_create_parser_and_cleanup (_("threads"), - threads_elements, - &context); - gdb_xml_use_dtd (parser, "threads.dtd"); + context.items = NULL; + make_cleanup (clear_threads_parsing_context, &context); - clear_parsing_context - = make_cleanup (clear_threads_parsing_context, &context); - - if (gdb_xml_parse (parser, xml) == 0) + if (gdb_xml_parse_quick (_("threads"), "threads.dtd", + threads_elements, xml, &context) == 0) { int i; struct thread_item *item; @@ -2640,8 +2631,6 @@ remote_threads_info (struct target_ops *ops) } } } - - do_cleanups (clear_parsing_context); } do_cleanups (back_to); |