Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lldb/source/Plugins/Process/AIX/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
add_lldb_library(lldbPluginProcessAIX
NativeProcessAIX.cpp
NativeThreadAIX.cpp

LINK_LIBS
lldbCore
Expand Down
71 changes: 71 additions & 0 deletions lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
//===-- NativeThreadAIX.cpp ---------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "NativeThreadAIX.h"
#include "NativeProcessAIX.h"
#include "lldb/Utility/State.h"
#include <procinfo.h>
#include <sys/procfs.h>

using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::process_aix;

NativeThreadAIX::NativeThreadAIX(NativeProcessAIX &process, lldb::tid_t tid)
: NativeThreadProtocol(process, tid), m_state(StateType::eStateInvalid) {}

std::string NativeThreadAIX::GetName() {
NativeProcessAIX &process = GetProcess();
auto BufferOrError = getProcFile(process.GetID(), "psinfo");
if (!BufferOrError)
return "";
auto &Buffer = *BufferOrError;
if (Buffer->getBufferSize() < sizeof(psinfo_t))
return "";
const psinfo_t *psinfo =
reinterpret_cast<const psinfo_t *>(Buffer->getBufferStart());
return std::string(psinfo->pr_fname);
}

lldb::StateType NativeThreadAIX::GetState() { return m_state; }

bool NativeThreadAIX::GetStopReason(ThreadStopInfo &stop_info,
std::string &description) {
return false;
}

Status NativeThreadAIX::SetWatchpoint(lldb::addr_t addr, size_t size,
uint32_t watch_flags, bool hardware) {
return Status();
}

Status NativeThreadAIX::RemoveWatchpoint(lldb::addr_t addr) {
return Status("Clearing hardware watchpoint failed.");
}

Status NativeThreadAIX::SetHardwareBreakpoint(lldb::addr_t addr, size_t size) {
return Status();
}

Status NativeThreadAIX::RemoveHardwareBreakpoint(lldb::addr_t addr) {
return Status("Clearing hardware breakpoint failed.");
}

NativeProcessAIX &NativeThreadAIX::GetProcess() {
return static_cast<NativeProcessAIX &>(m_process);
}

const NativeProcessAIX &NativeThreadAIX::GetProcess() const {
return static_cast<const NativeProcessAIX &>(m_process);
}

llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
NativeThreadAIX::GetSiginfo() const {
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"Not implemented");
}
53 changes: 53 additions & 0 deletions lldb/source/Plugins/Process/AIX/NativeThreadAIX.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//===-- NativeThreadAIX.h ----------------------------------- -*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLDB_SOURCE_PLUGINS_PROCESS_AIX_NATIVETHREADAIX_H_
#define LLDB_SOURCE_PLUGINS_PROCESS_AIX_NATIVETHREADAIX_H_

#include "lldb/Host/common/NativeThreadProtocol.h"

namespace lldb_private::process_aix {

class NativeProcessAIX;

class NativeThreadAIX : public NativeThreadProtocol {
friend class NativeProcessAIX;

public:
NativeThreadAIX(NativeProcessAIX &process, lldb::tid_t tid);

// NativeThreadProtocol Interface
std::string GetName() override;

lldb::StateType GetState() override;

bool GetStopReason(ThreadStopInfo &stop_info,
std::string &description) override;

Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags,
bool hardware) override;

Status RemoveWatchpoint(lldb::addr_t addr) override;

Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override;

Status RemoveHardwareBreakpoint(lldb::addr_t addr) override;

NativeProcessAIX &GetProcess();

const NativeProcessAIX &GetProcess() const;

llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
GetSiginfo() const override;

private:
lldb::StateType m_state;
};
} // namespace lldb_private::process_aix

#endif // #ifndef LLDB_SOURCE_PLUGINS_PROCESS_AIX_NATIVETHREADAIX_H_
Loading