diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2017-10-14 09:09:21 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2017-10-14 09:09:22 -0400 |
commit | c9cb8905b489d094c6c42e103d4bc6e231e00cf0 (patch) | |
tree | b8bfecc29cc70d3e58901eff2a358ec824202437 /gdb/gdbserver/server.c | |
parent | 2098b39391a5ade9ed308d76f2dfc7ceedd2d9a3 (diff) | |
download | gdb-c9cb8905b489d094c6c42e103d4bc6e231e00cf0.zip gdb-c9cb8905b489d094c6c42e103d4bc6e231e00cf0.tar.gz gdb-c9cb8905b489d094c6c42e103d4bc6e231e00cf0.tar.bz2 |
gdbserver: Use std::list for all_dlls
As a small step towards removing inferior_list/inferior_list_entry, this
patch replaces the usage of inferior_list for the list of dlls by an
std::list. The dll_info type now uses an std::string for name and has a
simple constructor.
I am able to build gdbserver with mingw on Linux, but I am not able to
test this on a Windows machine (the only platform that uses this code).
gdb/gdbserver/ChangeLog:
* dll.h: Include <list>.
(struct dll_info): Add constructor.
<entry>: Remove field.
(all_dlls): Change type to std::list<dll_info>.
* dll.c: Include <algorithm>.
(get_dll): Remove macro.
(all_dlls): Change type to std::list<dll_info *>.
(free_one_dll): Remove.
(match_dll): Likewise.
(loaded_dll): Adjust.
(unloaded_dll): Adjust to all_dlls type change, use
std::find_if. Inline code from match_dll.
(clear_dlls): Adjust to all_dlls type change.
* server.c (emit_dll_description): Remove.
(handle_qxfer_libraries): Adjust to all_dlls type change,
integrate emit_dll_description's functionality.
Diffstat (limited to 'gdb/gdbserver/server.c')
-rw-r--r-- | gdb/gdbserver/server.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index a959735..9f0c186 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -1533,21 +1533,6 @@ handle_qxfer_features (const char *annex, return len; } -/* Worker routine for handle_qxfer_libraries. - Emit the XML to describe the library in INF. */ - -static void -emit_dll_description (struct inferior_list_entry *inf, void *arg) -{ - struct dll_info *dll = (struct dll_info *) inf; - std::string *document = (std::string *) arg; - std::string name = xml_escape_text (dll->name); - - *document += string_printf - (" <library name=\"%s\"><segment address=\"0x%lx\"/></library>\n", - name.c_str (), (long) dll->base_addr); -} - /* Handle qXfer:libraries:read. */ static int @@ -1563,7 +1548,10 @@ handle_qxfer_libraries (const char *annex, std::string document = "<library-list version=\"1.0\">\n"; - for_each_inferior_with_data (&all_dlls, emit_dll_description, &document); + for (const dll_info &dll : all_dlls) + document += string_printf + (" <library name=\"%s\"><segment address=\"0x%lx\"/></library>\n", + dll.name.c_str (), (long) dll.base_addr); document += "</library-list>\n"; |