Skip to content

Commit bcb1227

Browse files
[lldb][AIX] Adding NativeThreadAIX (#139537)
This PR is in reference to porting LLDB on AIX. Link to discussions on llvm discourse and github: 1. https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640 2. #101657 The complete changes for porting are present in this draft PR: #102601 **Description:** Adding NativeThreadAIX base files, to be integrated with already merged NativeProcessAIX.
1 parent 86e9be0 commit bcb1227

File tree

3 files changed

+112
-0
lines changed

3 files changed

+112
-0
lines changed

lldb/source/Plugins/Process/AIX/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
add_lldb_library(lldbPluginProcessAIX
22
NativeProcessAIX.cpp
3+
NativeThreadAIX.cpp
34

45
LINK_LIBS
56
lldbCore
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
//===-- NativeThreadAIX.cpp ---------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "NativeThreadAIX.h"
10+
#include "NativeProcessAIX.h"
11+
#include "lldb/Utility/State.h"
12+
13+
using namespace lldb;
14+
using namespace lldb_private;
15+
using namespace lldb_private::process_aix;
16+
17+
NativeThreadAIX::NativeThreadAIX(NativeProcessAIX &process, lldb::tid_t tid)
18+
: NativeThreadProtocol(process, tid), m_state(StateType::eStateInvalid) {}
19+
20+
std::string NativeThreadAIX::GetName() { return ""; }
21+
22+
lldb::StateType NativeThreadAIX::GetState() { return m_state; }
23+
24+
bool NativeThreadAIX::GetStopReason(ThreadStopInfo &stop_info,
25+
std::string &description) {
26+
return false;
27+
}
28+
29+
Status NativeThreadAIX::SetWatchpoint(lldb::addr_t addr, size_t size,
30+
uint32_t watch_flags, bool hardware) {
31+
return Status("Unable to Set hardware watchpoint.");
32+
}
33+
34+
Status NativeThreadAIX::RemoveWatchpoint(lldb::addr_t addr) {
35+
return Status("Clearing hardware watchpoint failed.");
36+
}
37+
38+
Status NativeThreadAIX::SetHardwareBreakpoint(lldb::addr_t addr, size_t size) {
39+
return Status("Unable to set hardware breakpoint.");
40+
}
41+
42+
Status NativeThreadAIX::RemoveHardwareBreakpoint(lldb::addr_t addr) {
43+
return Status("Clearing hardware breakpoint failed.");
44+
}
45+
46+
NativeProcessAIX &NativeThreadAIX::GetProcess() {
47+
return static_cast<NativeProcessAIX &>(m_process);
48+
}
49+
50+
const NativeProcessAIX &NativeThreadAIX::GetProcess() const {
51+
return static_cast<const NativeProcessAIX &>(m_process);
52+
}
53+
54+
llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
55+
NativeThreadAIX::GetSiginfo() const {
56+
return llvm::createStringError(llvm::inconvertibleErrorCode(),
57+
"Not implemented");
58+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
//===-- NativeThreadAIX.h ----------------------------------- -*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLDB_SOURCE_PLUGINS_PROCESS_AIX_NATIVETHREADAIX_H_
10+
#define LLDB_SOURCE_PLUGINS_PROCESS_AIX_NATIVETHREADAIX_H_
11+
12+
#include "lldb/Host/common/NativeThreadProtocol.h"
13+
14+
namespace lldb_private::process_aix {
15+
16+
class NativeProcessAIX;
17+
18+
class NativeThreadAIX : public NativeThreadProtocol {
19+
friend class NativeProcessAIX;
20+
21+
public:
22+
NativeThreadAIX(NativeProcessAIX &process, lldb::tid_t tid);
23+
24+
// NativeThreadProtocol Interface
25+
std::string GetName() override;
26+
27+
lldb::StateType GetState() override;
28+
29+
bool GetStopReason(ThreadStopInfo &stop_info,
30+
std::string &description) override;
31+
32+
Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags,
33+
bool hardware) override;
34+
35+
Status RemoveWatchpoint(lldb::addr_t addr) override;
36+
37+
Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override;
38+
39+
Status RemoveHardwareBreakpoint(lldb::addr_t addr) override;
40+
41+
NativeProcessAIX &GetProcess();
42+
43+
const NativeProcessAIX &GetProcess() const;
44+
45+
llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
46+
GetSiginfo() const override;
47+
48+
private:
49+
lldb::StateType m_state;
50+
};
51+
} // namespace lldb_private::process_aix
52+
53+
#endif // #ifndef LLDB_SOURCE_PLUGINS_PROCESS_AIX_NATIVETHREADAIX_H_

0 commit comments

Comments
 (0)