From 9ab5dc2417f6338cc5ad6ab117f62ba895cc8c20 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Thu, 21 Jul 2016 08:30:55 +0000 Subject: Add a new DynamicLoader plugin that uses SPI that are in development for the fall (northern hemisphere) 2016 Darwin platforms to learn about loaded images, instead of reading dyld internal data structures. These new SPI don't exist on older releases, and new packets are needed from debugserver to use them (those changes are already committed). I had to change the minimum deployment target for debugserver in the xcode project file to macOS 10.10 so that debugserver will use the [[NSProcessInfo processInfo] operatingSystemVersion] call in MachProcess::GetOSVersionNumbers to get the operarting system version # -- this API is only available in macOS 10.10 and newer ("OS X Yosemite", released Oct 2014). If we have many people building llvm.org lldb on older systems still, we can back off on this for the llvm.org sources. There should be no change in behavior with this commit, either to older darwin systems or newer darwin systems. For now the new DynamicLoader plugin is never activated - I'm forcing the old plugin to be used in DynamicLoaderDarwin::UseDYLDSPI. I'll remove that unconditional use of the old plugin soon, so the newer plugin is used on the newest Darwin platforms. llvm-svn: 276254 --- .../Process/gdb-remote/ProcessGDBRemote.cpp | 49 +++++++++++++++++++--- 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp') diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 4d56f6ea3ba..728c5123dda 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -4165,7 +4165,7 @@ ProcessGDBRemote::GetExtendedInfoForThread (lldb::tid_t tid) StreamString packet; packet << "jThreadExtendedInfo:"; - args_dict->Dump (packet); + args_dict->Dump (packet, false); // FIXME the final character of a JSON dictionary, '}', is the escape // character in gdb-remote binary mode. lldb currently doesn't escape @@ -4193,6 +4193,44 @@ ProcessGDBRemote::GetExtendedInfoForThread (lldb::tid_t tid) StructuredData::ObjectSP ProcessGDBRemote::GetLoadedDynamicLibrariesInfos (lldb::addr_t image_list_address, lldb::addr_t image_count) +{ + + StructuredData::ObjectSP args_dict(new StructuredData::Dictionary()); + args_dict->GetAsDictionary()->AddIntegerItem ("image_list_address", image_list_address); + args_dict->GetAsDictionary()->AddIntegerItem ("image_count", image_count); + + return GetLoadedDynamicLibrariesInfos_sender (args_dict); +} + +StructuredData::ObjectSP +ProcessGDBRemote::GetLoadedDynamicLibrariesInfos () +{ + StructuredData::ObjectSP args_dict(new StructuredData::Dictionary()); + + args_dict->GetAsDictionary()->AddBooleanItem ("fetch_all_solibs", true); + + return GetLoadedDynamicLibrariesInfos_sender (args_dict); +} + +StructuredData::ObjectSP +ProcessGDBRemote::GetLoadedDynamicLibrariesInfos (const std::vector &load_addresses) +{ + StructuredData::ObjectSP args_dict(new StructuredData::Dictionary()); + StructuredData::ArraySP addresses(new StructuredData::Array); + + for (auto addr : load_addresses) + { + StructuredData::ObjectSP addr_sp (new StructuredData::Integer (addr)); + addresses->AddItem (addr_sp); + } + + args_dict->GetAsDictionary()->AddItem ("solib_addresses", addresses); + + return GetLoadedDynamicLibrariesInfos_sender (args_dict); +} + +StructuredData::ObjectSP +ProcessGDBRemote::GetLoadedDynamicLibrariesInfos_sender (StructuredData::ObjectSP args_dict) { StructuredData::ObjectSP object_sp; @@ -4201,13 +4239,9 @@ ProcessGDBRemote::GetLoadedDynamicLibrariesInfos (lldb::addr_t image_list_addres // Scope for the scoped timeout object GDBRemoteCommunication::ScopedTimeout timeout (m_gdb_comm, 10); - StructuredData::ObjectSP args_dict(new StructuredData::Dictionary()); - args_dict->GetAsDictionary()->AddIntegerItem ("image_list_address", image_list_address); - args_dict->GetAsDictionary()->AddIntegerItem ("image_count", image_count); - StreamString packet; packet << "jGetLoadedDynamicLibrariesInfos:"; - args_dict->Dump (packet); + args_dict->Dump (packet, false); // FIXME the final character of a JSON dictionary, '}', is the escape // character in gdb-remote binary mode. lldb currently doesn't escape @@ -4233,6 +4267,9 @@ ProcessGDBRemote::GetLoadedDynamicLibrariesInfos (lldb::addr_t image_list_addres return object_sp; } + + + // Establish the largest memory read/write payloads we should use. // If the remote stub has a max packet size, stay under that size. // -- cgit v1.2.3