Skip to content

Commit 05aef7d

Browse files
Added NativeThreadAIX
1 parent 5b91756 commit 05aef7d

File tree

3 files changed

+125
-0
lines changed

3 files changed

+125
-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: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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+
#include <procinfo.h>
13+
#include <sys/procfs.h>
14+
15+
using namespace lldb;
16+
using namespace lldb_private;
17+
using namespace lldb_private::process_aix;
18+
19+
NativeThreadAIX::NativeThreadAIX(NativeProcessAIX &process, lldb::tid_t tid)
20+
: NativeThreadProtocol(process, tid), m_state(StateType::eStateInvalid) {}
21+
22+
std::string NativeThreadAIX::GetName() {
23+
NativeProcessAIX &process = GetProcess();
24+
auto BufferOrError = getProcFile(process.GetID(), "psinfo");
25+
if (!BufferOrError)
26+
return "";
27+
auto &Buffer = *BufferOrError;
28+
if (Buffer->getBufferSize() < sizeof(psinfo_t))
29+
return "";
30+
const psinfo_t *psinfo =
31+
reinterpret_cast<const psinfo_t *>(Buffer->getBufferStart());
32+
return std::string(psinfo->pr_fname);
33+
}
34+
35+
lldb::StateType NativeThreadAIX::GetState() { return m_state; }
36+
37+
bool NativeThreadAIX::GetStopReason(ThreadStopInfo &stop_info,
38+
std::string &description) {
39+
return false;
40+
}
41+
42+
Status NativeThreadAIX::SetWatchpoint(lldb::addr_t addr, size_t size,
43+
uint32_t watch_flags, bool hardware) {
44+
return Status();
45+
}
46+
47+
Status NativeThreadAIX::RemoveWatchpoint(lldb::addr_t addr) {
48+
return Status("Clearing hardware watchpoint failed.");
49+
}
50+
51+
Status NativeThreadAIX::SetHardwareBreakpoint(lldb::addr_t addr, size_t size) {
52+
return Status();
53+
}
54+
55+
Status NativeThreadAIX::RemoveHardwareBreakpoint(lldb::addr_t addr) {
56+
return Status("Clearing hardware breakpoint failed.");
57+
}
58+
59+
NativeProcessAIX &NativeThreadAIX::GetProcess() {
60+
return static_cast<NativeProcessAIX &>(m_process);
61+
}
62+
63+
const NativeProcessAIX &NativeThreadAIX::GetProcess() const {
64+
return static_cast<const NativeProcessAIX &>(m_process);
65+
}
66+
67+
llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
68+
NativeThreadAIX::GetSiginfo() const {
69+
return llvm::createStringError(llvm::inconvertibleErrorCode(),
70+
"Not implemented");
71+
}
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)