diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2017-09-16 14:19:31 +0200 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2017-09-16 14:19:31 +0200 |
commit | 5e1875543df7413d3cbc3831390445e347064b75 (patch) | |
tree | 215e09584279387448ae183671588f0bac07a1f6 /gdb/gdbserver | |
parent | c3d7b541fa920e6ecb0f06ffe1e0e3f070fa295d (diff) | |
download | gdb-5e1875543df7413d3cbc3831390445e347064b75.zip gdb-5e1875543df7413d3cbc3831390445e347064b75.tar.gz gdb-5e1875543df7413d3cbc3831390445e347064b75.tar.bz2 |
Make xml_escape_text return an std::string
This is a simple replacement, it allows removing some manual free'ing in
the callers.
gdb/ChangeLog:
* common/buffer.c (buffer_xml_printf): Adjust.
* common/xml-utils.c (xml_escape_text): Change return type to
std::string, update code accordingly.
* common/xml-utils.h (xml_escape_text): Change return type to
std::string.
* rs6000-aix-tdep.c (rs6000_aix_shared_library_to_xml): Adjust.
* windows-tdep.c (windows_xfer_shared_library): Adjust.
* unittests/xml-utils-selftests.c (test_xml_escape_text):
Adjust.
gdb/gdbserver/ChangeLog:
* linux-low.c (linux_qxfer_libraries_svr4): Adjust to change of
return type of xml_escape_text.
* server.c (emit_dll_description): Likewise.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/gdbserver/linux-low.c | 6 | ||||
-rw-r--r-- | gdb/gdbserver/server.c | 6 |
3 files changed, 10 insertions, 8 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 61b2e06..49a76c9 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,11 @@ 2017-09-16 Simon Marchi <simon.marchi@ericsson.com> + * linux-low.c (linux_qxfer_libraries_svr4): Adjust to change of + return type of xml_escape_text. + * server.c (emit_dll_description): Likewise. + +2017-09-16 Simon Marchi <simon.marchi@ericsson.com> + * server.c (captured_main): Accept argument for --selftest. Update run_tests call. * linux-x86-tdesc-selftest.c (initialize_low_tdesc): Add names diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 1d96ec2..1bc8f38 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -7288,7 +7288,6 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf, { /* 6x the size for xml_escape_text below. */ size_t len = 6 * strlen ((char *) libname); - char *name; if (!header_done) { @@ -7307,12 +7306,11 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf, p = document + document_len; } - name = xml_escape_text ((char *) libname); + std::string name = xml_escape_text ((char *) libname); p += sprintf (p, "<library name=\"%s\" lm=\"0x%lx\" " "l_addr=\"0x%lx\" l_ld=\"0x%lx\"/>", - name, (unsigned long) lm_addr, + name.c_str (), (unsigned long) lm_addr, (unsigned long) l_addr, (unsigned long) l_ld); - free (name); } } diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 99dedb2..92943e2 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -1532,13 +1532,11 @@ emit_dll_description (struct inferior_list_entry *inf, void *arg) struct dll_info *dll = (struct dll_info *) inf; char **p_ptr = (char **) arg; char *p = *p_ptr; - char *name; strcpy (p, " <library name=\""); p = p + strlen (p); - name = xml_escape_text (dll->name); - strcpy (p, name); - free (name); + std::string name = xml_escape_text (dll->name); + strcpy (p, name.c_str ()); p = p + strlen (p); strcpy (p, "\"><segment address=\""); p = p + strlen (p); |