aboutsummaryrefslogtreecommitdiff
path: root/lldb
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2021-04-16 13:49:24 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2021-04-16 13:49:38 -0700
commitdb2da0c8f907c444e0bf8b788d8186c4c67db0b2 (patch)
tree7b02146d76bea9a9ea516307a4f5b6b7ec5ac48c /lldb
parent[lldb] Implement ABI::Fix{Code,Data}Address for AArch64 (diff)
downloadllvm-project-db2da0c8f907c444e0bf8b788d8186c4c67db0b2.tar.gz
llvm-project-db2da0c8f907c444e0bf8b788d8186c4c67db0b2.tar.bz2
llvm-project-db2da0c8f907c444e0bf8b788d8186c4c67db0b2.zip
[lldb] Set addressable bits from qHostInfo
Read the number of addressable bits from the qHostInfo packet and use it to set the code and data address mask in the process. The data (addressing_bits) is already present in the packet. Differential revision: https://reviews.llvm.org/D100520
Diffstat (limited to 'lldb')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp25
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h3
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp6
3 files changed, 25 insertions, 9 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index ef6441289fc5..d709716d8e45 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -100,11 +100,11 @@ GDBRemoteCommunicationClient::GDBRemoteCommunicationClient()
m_supports_jThreadsInfo(true), m_supports_jModulesInfo(true),
m_curr_pid(LLDB_INVALID_PROCESS_ID), m_curr_tid(LLDB_INVALID_THREAD_ID),
m_curr_tid_run(LLDB_INVALID_THREAD_ID),
- m_num_supported_hardware_watchpoints(0), m_host_arch(), m_process_arch(),
- m_os_build(), m_os_kernel(), m_hostname(), m_gdb_server_name(),
- m_gdb_server_version(UINT32_MAX), m_default_packet_timeout(0),
- m_max_packet_size(0), m_qSupported_response(),
- m_supported_async_json_packets_is_valid(false),
+ m_num_supported_hardware_watchpoints(0), m_addressing_bits(0),
+ m_host_arch(), m_process_arch(), m_os_build(), m_os_kernel(),
+ m_hostname(), m_gdb_server_name(), m_gdb_server_version(UINT32_MAX),
+ m_default_packet_timeout(0), m_max_packet_size(0),
+ m_qSupported_response(), m_supported_async_json_packets_is_valid(false),
m_supported_async_json_packets_sp(), m_qXfer_memory_map(),
m_qXfer_memory_map_loaded(false) {}
@@ -1202,11 +1202,13 @@ bool GDBRemoteCommunicationClient::GetHostInfo(bool force) {
} else if (name.equals("ptrsize")) {
if (!value.getAsInteger(0, pointer_byte_size))
++num_keys_decoded;
+ } else if (name.equals("addressing_bits")) {
+ if (!value.getAsInteger(0, m_addressing_bits))
+ ++num_keys_decoded;
} else if (name.equals("os_version") ||
- name.equals(
- "version")) // Older debugserver binaries used the
- // "version" key instead of
- // "os_version"...
+ name.equals("version")) // Older debugserver binaries used
+ // the "version" key instead of
+ // "os_version"...
{
if (!m_os_version.tryParse(value))
++num_keys_decoded;
@@ -1357,6 +1359,11 @@ GDBRemoteCommunicationClient::GetHostArchitecture() {
return m_host_arch;
}
+uint32_t GDBRemoteCommunicationClient::GetAddressingBits() {
+ if (m_qHostInfo_is_valid == eLazyBoolCalculate)
+ GetHostInfo();
+ return m_addressing_bits;
+}
seconds GDBRemoteCommunicationClient::GetHostDefaultPacketTimeout() {
if (m_qHostInfo_is_valid == eLazyBoolCalculate)
GetHostInfo();
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
index d559882ed7dc..1891842a6944 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
@@ -275,6 +275,8 @@ public:
ArchSpec GetSystemArchitecture();
+ uint32_t GetAddressingBits();
+
bool GetHostname(std::string &s);
lldb::addr_t GetShlibInfoAddr();
@@ -573,6 +575,7 @@ protected:
// continue, step, etc
uint32_t m_num_supported_hardware_watchpoints;
+ uint32_t m_addressing_bits;
ArchSpec m_host_arch;
ArchSpec m_process_arch;
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 97368d5b0e31..5ff00f856699 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1042,6 +1042,12 @@ void ProcessGDBRemote::DidLaunchOrAttach(ArchSpec &process_arch) {
process_arch.GetTriple().getTriple());
}
+ if (int addresssable_bits = m_gdb_comm.GetAddressingBits()) {
+ lldb::addr_t address_mask = ~((1ULL << addresssable_bits) - 1);
+ SetCodeAddressMask(address_mask);
+ SetDataAddressMask(address_mask);
+ }
+
if (process_arch.IsValid()) {
const ArchSpec &target_arch = GetTarget().GetArchitecture();
if (target_arch.IsValid()) {