Skip to content

Commit 68099b1

Browse files
committed
[lldb] Add a getter for the process' system architecture
This patch adds a getter for the process' system architecture. I went with Process::GetSystemArchitecture to match Platform::GetSystemArchitecture. Differential revision: https://reviews.llvm.org/D121443
1 parent 9b7b21d commit 68099b1

File tree

5 files changed

+15
-0
lines changed

5 files changed

+15
-0
lines changed

lldb/include/lldb/Target/Process.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,9 @@ class Process : public std::enable_shared_from_this<Process>,
696696
virtual JITLoaderList &GetJITLoaders();
697697

698698
public:
699+
/// Get the system architecture for this process.
700+
virtual ArchSpec GetSystemArchitecture() { return {}; }
701+
699702
/// Get the system runtime plug-in for this process.
700703
///
701704
/// \return

lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,10 @@ bool ProcessWindows::IsAlive() {
576576
}
577577
}
578578

579+
ArchSpec ProcessWindows::GetSystemArchitecture() {
580+
return HostInfo::GetArchitecture();
581+
}
582+
579583
size_t ProcessWindows::DoReadMemory(lldb::addr_t vm_addr, void *buf,
580584
size_t size, Status &error) {
581585
size_t bytes_read = 0;

lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ class ProcessWindows : public Process, public ProcessDebugger {
7171
ThreadList &new_thread_list) override;
7272
bool IsAlive() override;
7373

74+
ArchSpec GetSystemArchitecture override();
75+
7476
size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
7577
Status &error) override;
7678
size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size,

lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ std::chrono::seconds ProcessGDBRemote::GetPacketTimeout() {
208208
return std::chrono::seconds(GetGlobalPluginProperties().GetPacketTimeout());
209209
}
210210

211+
ArchSpec ProcessGDBRemote::GetSystemArchitecture() {
212+
return m_gdb_comm.GetHostArchitecture();
213+
}
214+
211215
bool ProcessGDBRemote::CanDebug(lldb::TargetSP target_sp,
212216
bool plugin_specified_by_name) {
213217
if (plugin_specified_by_name)

lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ class ProcessGDBRemote : public Process,
7070

7171
static std::chrono::seconds GetPacketTimeout();
7272

73+
ArchSpec GetSystemArchitecture() override;
74+
7375
// Check if a given Process
7476
bool CanDebug(lldb::TargetSP target_sp,
7577
bool plugin_specified_by_name) override;

0 commit comments

Comments
 (0)