forked from Imagelibrary/binutils-gdb
gdbserver: convert the global dll list into a process_info field
The 'all_dlls' list is global. This would cause the complete dll list to be reported for individual processes. Move the list into the process_info struct. Currently the dll list is used only by the win32-low target, which does not support the multi-process feature. Therefore, it practically does not matter whether the list is global or per-process. However, there may be targets that are outside the binutils-gdb repo (e.g. we, at Intel, have such a target) that have multi-process and use the dll list. So, it makes sense to do the right thing. gdbserver/ChangeLog: 2021-03-22 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * inferiors.h (struct process_info) <all_dlls, dlls_changed>: New fields. * dll.h (loaded_dll) (unloaded_dll): Declare an overloaded version that takes a proc parameter. * dll.cc (loaded_dll) (unloaded_dll): Implement the overloaded versions. (clear_dlls): Clear all process' dll lists. (all_dlls, dlls_changed): Remove the global variables. * remote-utils.cc (prepare_resume_reply): Update to consider a dll list per proc. * server.cc (handle_qxfer_libraries): Ditto. (handle_v_attach): Ditto. (captured_main): Ditto.
This commit is contained in:
@@ -1470,7 +1470,8 @@ handle_qxfer_libraries (const char *annex,
|
||||
|
||||
std::string document = "<library-list version=\"1.0\">\n";
|
||||
|
||||
for (const dll_info &dll : all_dlls)
|
||||
process_info *proc = current_process ();
|
||||
for (const dll_info &dll : proc->all_dlls)
|
||||
document += string_printf
|
||||
(" <library name=\"%s\"><segment address=\"0x%s\"/></library>\n",
|
||||
dll.name.c_str (), paddress (dll.base_addr));
|
||||
@@ -2848,7 +2849,7 @@ handle_v_attach (char *own_buf)
|
||||
some libraries are preloaded. GDB will always poll the
|
||||
library list. Avoids the "stopped by shared library event"
|
||||
notice on the GDB side. */
|
||||
dlls_changed = 0;
|
||||
current_process ()->dlls_changed = false;
|
||||
|
||||
if (non_stop)
|
||||
{
|
||||
@@ -3796,7 +3797,8 @@ captured_main (int argc, char *argv[])
|
||||
/* Don't report shared library events on the initial connection,
|
||||
even if some libraries are preloaded. Avoids the "stopped by
|
||||
shared library event" notice on gdb side. */
|
||||
dlls_changed = 0;
|
||||
if (current_thread != nullptr)
|
||||
current_process ()->dlls_changed = false;
|
||||
|
||||
if (cs.last_status.kind == TARGET_WAITKIND_EXITED
|
||||
|| cs.last_status.kind == TARGET_WAITKIND_SIGNALLED)
|
||||
|
||||
Reference in New Issue
Block a user