diff options
Diffstat (limited to 'gdb/tracefile-tfile.c')
-rw-r--r-- | gdb/tracefile-tfile.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index 5d63c16..255bbc9 100644 --- a/gdb/tracefile-tfile.c +++ b/gdb/tracefile-tfile.c @@ -275,17 +275,19 @@ tfile_write_tdesc (struct trace_file_writer *self) { struct tfile_trace_file_writer *writer = (struct tfile_trace_file_writer *) self; - char *tdesc = target_fetch_description_xml (¤t_target); - char *ptr = tdesc; - char *next; - if (tdesc == NULL) + gdb::optional<std::string> tdesc + = target_fetch_description_xml (¤t_target); + + if (!tdesc) return; + const char *ptr = tdesc->c_str (); + /* Write tdesc line by line, prefixing each line with "tdesc ". */ while (ptr != NULL) { - next = strchr (ptr, '\n'); + const char *next = strchr (ptr, '\n'); if (next != NULL) { fprintf (writer->fp, "tdesc %.*s\n", (int) (next - ptr), ptr); @@ -299,8 +301,6 @@ tfile_write_tdesc (struct trace_file_writer *self) } ptr = next; } - - xfree (tdesc); } /* This is the implementation of trace_file_write_ops method |