forked from OSchip/llvm-project
[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
This commit is contained in:
parent
8770b4ecca
commit
db2da0c8f9
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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()) {
|
||||
|
|
Loading…
Reference in New Issue