Skip to content

Commit 6f6c305

Browse files
author
git apple-llvm automerger
committed
Merge commit 'fdbb5a7a91b0' from llvm.org/main into apple/main
2 parents a7c3ea3 + fdbb5a7 commit 6f6c305

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

lldb/include/lldb/Target/Process.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ class ProcessProperties : public Properties {
7777
Args GetExtraStartupCommands() const;
7878
void SetExtraStartupCommands(const Args &args);
7979
FileSpec GetPythonOSPluginPath() const;
80+
uint32_t GetVirtualAddressableBits() const;
81+
void SetVirtualAddressableBits(uint32_t bits);
8082
void SetPythonOSPluginPath(const FileSpec &file);
8183
bool GetIgnoreBreakpointsInExpressions() const;
8284
void SetIgnoreBreakpointsInExpressions(bool ignore);
@@ -1330,6 +1332,17 @@ class Process : public std::enable_shared_from_this<Process>,
13301332

13311333
virtual void DidExit() {}
13321334

1335+
lldb::addr_t GetCodeAddressMask();
1336+
lldb::addr_t GetDataAddressMask();
1337+
1338+
void SetCodeAddressMask(lldb::addr_t code_address_mask) {
1339+
m_code_address_mask = code_address_mask;
1340+
}
1341+
1342+
void SetDataAddressMask(lldb::addr_t data_address_mask) {
1343+
m_data_address_mask = data_address_mask;
1344+
}
1345+
13331346
/// Get the Modification ID of the process.
13341347
///
13351348
/// \return
@@ -2878,6 +2891,13 @@ void PruneThreadPlans();
28782891
/// from looking up or creating things during or after a finalize call.
28792892
std::atomic<bool> m_finalizing;
28802893

2894+
/// Mask for code an data addresses. The default value (0) means no mask is
2895+
/// set.
2896+
/// @{
2897+
lldb::addr_t m_code_address_mask = 0;
2898+
lldb::addr_t m_data_address_mask = 0;
2899+
/// @}
2900+
28812901
bool m_clear_thread_plans_on_stop;
28822902
bool m_force_next_event_delivery;
28832903
lldb::StateType m_last_broadcast_state; /// This helps with the Public event

lldb/source/Target/Process.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,16 @@ FileSpec ProcessProperties::GetPythonOSPluginPath() const {
200200
return m_collection_sp->GetPropertyAtIndexAsFileSpec(nullptr, idx);
201201
}
202202

203+
uint32_t ProcessProperties::GetVirtualAddressableBits() const {
204+
const uint32_t idx = ePropertyVirtualAddressableBits;
205+
return m_collection_sp->GetPropertyAtIndexAsUInt64(
206+
nullptr, idx, g_process_properties[idx].default_uint_value);
207+
}
208+
209+
void ProcessProperties::SetVirtualAddressableBits(uint32_t bits) {
210+
const uint32_t idx = ePropertyVirtualAddressableBits;
211+
m_collection_sp->SetPropertyAtIndexAsUInt64(nullptr, idx, bits);
212+
}
203213
void ProcessProperties::SetPythonOSPluginPath(const FileSpec &file) {
204214
const uint32_t idx = ePropertyPythonOSPluginPath;
205215
m_collection_sp->SetPropertyAtIndexAsFileSpec(nullptr, idx, file);
@@ -5547,6 +5557,26 @@ void Process::Flush() {
55475557
m_queue_list_stop_id = 0;
55485558
}
55495559

5560+
lldb::addr_t Process::GetCodeAddressMask() {
5561+
if (m_code_address_mask == 0) {
5562+
if (uint32_t number_of_addressable_bits = GetVirtualAddressableBits()) {
5563+
lldb::addr_t address_mask = ~((1ULL << number_of_addressable_bits) - 1);
5564+
SetCodeAddressMask(address_mask);
5565+
}
5566+
}
5567+
return m_code_address_mask;
5568+
}
5569+
5570+
lldb::addr_t Process::GetDataAddressMask() {
5571+
if (m_data_address_mask == 0) {
5572+
if (uint32_t number_of_addressable_bits = GetVirtualAddressableBits()) {
5573+
lldb::addr_t address_mask = ~((1ULL << number_of_addressable_bits) - 1);
5574+
SetDataAddressMask(address_mask);
5575+
}
5576+
}
5577+
return m_data_address_mask;
5578+
}
5579+
55505580
void Process::DidExec() {
55515581
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
55525582
LLDB_LOGF(log, "Process::%s()", __FUNCTION__);

lldb/source/Target/TargetProperties.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ let Definition = "process" in {
233233
def SteppingRunsAllThreads: Property<"run-all-threads", "Boolean">,
234234
DefaultFalse,
235235
Desc<"If true, stepping operations will run all threads. This is equivalent to setting the run-mode option to 'all-threads'.">;
236+
def VirtualAddressableBits: Property<"virtual-addressable-bits", "UInt64">,
237+
DefaultUnsignedValue<0>,
238+
Desc<"The number of bits used for addressing. If the value is 39, then bits 0..38 are used for addressing. The default value of 0 means unspecified.">;
236239
}
237240

238241
let Definition = "platform" in {

0 commit comments

Comments
 (0)