aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp63
1 files changed, 24 insertions, 39 deletions
diff --git a/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index af95ef0718a5..5f3c1ad9c1e1 100644
--- a/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -23,13 +23,6 @@
#include <ctime>
#include <sys/types.h>
-#include <algorithm>
-#include <csignal>
-#include <map>
-#include <memory>
-#include <mutex>
-#include <sstream>
-
#include "lldb/Breakpoint/Watchpoint.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
@@ -70,8 +63,16 @@
#include "lldb/Utility/State.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/Timer.h"
+#include <algorithm>
+#include <csignal>
+#include <map>
+#include <memory>
+#include <mutex>
+#include <sstream>
+#include <thread>
#include "GDBRemoteRegisterContext.h"
+#include "GDBRemoteRegisterFallback.h"
#ifdef LLDB_ENABLE_ALL
#include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
#endif // LLDB_ENABLE_ALL
@@ -255,9 +256,8 @@ ProcessGDBRemote::ProcessGDBRemote(lldb::TargetSP target_sp,
m_addr_to_mmap_size(), m_thread_create_bp_sp(),
m_waiting_for_attach(false), m_destroy_tried_resuming(false),
m_command_sp(), m_breakpoint_pc_offset(0),
- m_initial_tid(LLDB_INVALID_THREAD_ID), m_replay_mode(false),
- m_allow_flash_writes(false), m_erased_flash_ranges(),
- m_vfork_in_progress(false) {
+ m_initial_tid(LLDB_INVALID_THREAD_ID), m_allow_flash_writes(false),
+ m_erased_flash_ranges(), m_vfork_in_progress(false) {
m_async_broadcaster.SetEventName(eBroadcastBitAsyncThreadShouldExit,
"async thread should exit");
m_async_broadcaster.SetEventName(eBroadcastBitAsyncContinue,
@@ -397,6 +397,7 @@ void ProcessGDBRemote::BuildDynamicRegisterInfo(bool force) {
// 2 - If the target definition doesn't have any of the info from the
// target.xml (registers) then proceed to read the target.xml.
// 3 - Fall back on the qRegisterInfo packets.
+ // 4 - Use hardcoded defaults if available.
FileSpec target_definition_fspec =
GetGlobalPluginProperties().GetTargetDefinitionFile();
@@ -510,6 +511,9 @@ void ProcessGDBRemote::BuildDynamicRegisterInfo(bool force) {
}
}
+ if (registers.empty())
+ registers = GetFallbackRegisters(arch_to_use);
+
AddRemoteRegisters(registers, arch_to_use);
}
@@ -527,7 +531,7 @@ Status ProcessGDBRemote::WillAttachToProcessWithName(const char *process_name,
}
Status ProcessGDBRemote::DoConnectRemote(llvm::StringRef remote_url) {
- Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+ Log *log = GetLog(GDBRLog::Process);
Status error(WillLaunchOrAttach());
if (error.Fail())
@@ -604,8 +608,7 @@ Status ProcessGDBRemote::DoConnectRemote(llvm::StringRef remote_url) {
ReadModuleFromMemory(FileSpec(namebuf), standalone_value);
}
- Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(
- LIBLLDB_LOG_DYNAMIC_LOADER));
+ Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
if (module_sp.get()) {
target.GetImages().AppendIfNeeded(module_sp, false);
@@ -3320,24 +3323,6 @@ Status ProcessGDBRemote::DoSignal(int signo) {
return error;
}
-Status ProcessGDBRemote::ConnectToReplayServer() {
- Status status = m_gdb_replay_server.Connect(m_gdb_comm);
- if (status.Fail())
- return status;
-
- // Enable replay mode.
- m_replay_mode = true;
-
- // Start server thread.
- m_gdb_replay_server.StartAsyncThread();
-
- // Start client thread.
- StartAsyncThread();
-
- // Do the usual setup.
- return ConnectToDebugserver("");
-}
-
Status
ProcessGDBRemote::EstablishConnectionIfNeeded(const ProcessInfo &process_info) {
// Make sure we aren't already connected?
@@ -4374,9 +4359,9 @@ bool ProcessGDBRemote::GetGDBServerRegisterInfoXMLAndProcess(
} else if (name == "osabi") {
node.GetElementText(target_info.osabi);
} else if (name == "xi:include" || name == "include") {
- llvm::StringRef href = node.GetAttributeValue("href");
+ std::string href = node.GetAttributeValue("href");
if (!href.empty())
- target_info.includes.push_back(href.str());
+ target_info.includes.push_back(href);
} else if (name == "feature") {
feature_nodes.push_back(node);
} else if (name == "groups") {
@@ -4415,9 +4400,9 @@ bool ProcessGDBRemote::GetGDBServerRegisterInfoXMLAndProcess(
const XMLNode &node) -> bool {
llvm::StringRef name = node.GetName();
if (name == "xi:include" || name == "include") {
- llvm::StringRef href = node.GetAttributeValue("href");
+ std::string href = node.GetAttributeValue("href");
if (!href.empty())
- target_info.includes.push_back(href.str());
+ target_info.includes.push_back(href);
}
return true;
});
@@ -4553,7 +4538,7 @@ llvm::Expected<LoadedModuleInfoList> ProcessGDBRemote::GetLoadedModuleList() {
"Error finding library-list-svr4 xml element");
// main link map structure
- llvm::StringRef main_lm = root_element.GetAttributeValue("main-lm");
+ std::string main_lm = root_element.GetAttributeValue("main-lm");
// FIXME: we're silently ignoring invalid data here
if (!main_lm.empty())
llvm::to_integer(main_lm, list.m_link_map);
@@ -4641,15 +4626,15 @@ llvm::Expected<LoadedModuleInfoList> ProcessGDBRemote::GetLoadedModuleList() {
"library", [log, &list](const XMLNode &library) -> bool {
LoadedModuleInfoList::LoadedModuleInfo module;
- llvm::StringRef name = library.GetAttributeValue("name");
- module.set_name(name.str());
+ std::string name = library.GetAttributeValue("name");
+ module.set_name(name);
// The base address of a given library will be the address of its
// first section. Most remotes send only one section for Windows
// targets for example.
const XMLNode &section =
library.FindFirstChildElementWithName("section");
- llvm::StringRef address = section.GetAttributeValue("address");
+ std::string address = section.GetAttributeValue("address");
uint64_t address_value = LLDB_INVALID_ADDRESS;
llvm::to_integer(address, address_value);
module.set_base(address_value);