aboutsummaryrefslogtreecommitdiff
path: root/gdb/xml-tdesc.c
diff options
context:
space:
mode:
authorMarcin Koƛcielnicki <koriakin@0x04.net>2016-02-05 21:32:52 +0100
committerMarcin Koƛcielnicki <koriakin@0x04.net>2016-02-10 23:31:11 +0100
commit18d3cec54e1b4fce278dba436484846f8048d7d6 (patch)
tree6e78be8ae681262aef75f4f164d157c62e050e47 /gdb/xml-tdesc.c
parent9f6a71b4bfdad8fa2fe33e86f799fa0d362973dc (diff)
downloadgdb-18d3cec54e1b4fce278dba436484846f8048d7d6.zip
gdb-18d3cec54e1b4fce278dba436484846f8048d7d6.tar.gz
gdb-18d3cec54e1b4fce278dba436484846f8048d7d6.tar.bz2
gdb.trace: Save XML target description in tfile.
gdb/ChangeLog: * ctf.c (ctf_write_tdesc): New function. (ctf_write_ops): Wire in ctf_write_tdesc. * tracefile-tfile.c (tfile_write_tdesc): New function. (tfile_write_ops): Wire in tfile_write_tdesc. * tracefile.c (trace_save): Call write_tdesc method. * tracefile.h (struct trace_file_write_ops): Add write_tdesc method. * xml-tdesc.c (target_fetch_description_xml): New function. * xml-tdesc.h: Add target_fetch_description_xml prototype.
Diffstat (limited to 'gdb/xml-tdesc.c')
-rw-r--r--gdb/xml-tdesc.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gdb/xml-tdesc.c b/gdb/xml-tdesc.c
index 5eeda86..4625b60 100644
--- a/gdb/xml-tdesc.c
+++ b/gdb/xml-tdesc.c
@@ -630,3 +630,33 @@ target_read_description_xml (struct target_ops *ops)
return tdesc;
}
+
+/* Fetches an XML target description using OPS, processing
+ includes, but not parsing it. Used to dump whole tdesc
+ as a single XML file. */
+
+char *
+target_fetch_description_xml (struct target_ops *ops)
+{
+ struct target_desc *tdesc;
+ char *tdesc_str;
+ char *expanded_text;
+ struct cleanup *back_to;
+
+ tdesc_str = fetch_available_features_from_target ("target.xml", ops);
+ if (tdesc_str == NULL)
+ return NULL;
+
+ back_to = make_cleanup (xfree, tdesc_str);
+ expanded_text = xml_process_xincludes (_("target description"),
+ tdesc_str,
+ fetch_available_features_from_target, ops, 0);
+ do_cleanups (back_to);
+ if (expanded_text == NULL)
+ {
+ warning (_("Could not load XML target description; ignoring"));
+ return NULL;
+ }
+
+ return expanded_text;
+}