aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index c7fc016..156f6f7 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1102,6 +1102,8 @@ void ProcessGDBRemote::DidLaunchOrAttach(ArchSpec &process_arch) {
}
}
+ MaybeLoadExecutableModule();
+
// Find out which StructuredDataPlugins are supported by the debug monitor.
// These plugins transmit data over async $J packets.
if (StructuredData::Array *supported_packets =
@@ -1109,6 +1111,31 @@ void ProcessGDBRemote::DidLaunchOrAttach(ArchSpec &process_arch) {
MapSupportedStructuredDataPlugins(*supported_packets);
}
+void ProcessGDBRemote::MaybeLoadExecutableModule() {
+ ModuleSP module_sp = GetTarget().GetExecutableModule();
+ if (!module_sp)
+ return;
+
+ llvm::Optional<QOffsets> offsets = m_gdb_comm.GetQOffsets();
+ if (!offsets)
+ return;
+
+ bool is_uniform =
+ size_t(llvm::count(offsets->offsets, offsets->offsets[0])) ==
+ offsets->offsets.size();
+ if (!is_uniform)
+ return; // TODO: Handle non-uniform responses.
+
+ bool changed = false;
+ module_sp->SetLoadAddress(GetTarget(), offsets->offsets[0],
+ /*value_is_offset=*/true, changed);
+ if (changed) {
+ ModuleList list;
+ list.Append(module_sp);
+ m_process->GetTarget().ModulesDidLoad(list);
+ }
+}
+
void ProcessGDBRemote::DidLaunch() {
ArchSpec process_arch;
DidLaunchOrAttach(process_arch);