10#include "lldb/Host/Config.h"
14#include <sys/utsname.h>
31#define MAP_PRIVATE 0x0002
32#define MAP_ANON 0x1000
45 LLDB_LOG(log,
"force = {0}, arch=({1}, {2})", force,
46 arch ? arch->GetArchitectureName() :
"<null>",
47 arch ? arch->GetTriple().getTriple() :
"<null>");
50 if (!create && arch && arch->IsValid()) {
51 const llvm::Triple &triple = arch->GetTriple();
52 switch (triple.getOS()) {
53 case llvm::Triple::NetBSD:
62 LLDB_LOG(log,
"create = {0}", create);
71 return "Local NetBSD user platform plug-in.";
72 return "Remote NetBSD user platform plug-in.";
79#if defined(__NetBSD__)
81 default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture());
106 ArchSpec hostArch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
108 if (hostArch.
GetTriple().isArch64Bit()) {
110 HostInfo::GetArchitecture(HostInfo::eArchKind32));
114 {llvm::Triple::x86_64, llvm::Triple::x86}, llvm::Triple::NetBSD);
138 strm.
Printf(
" Kernel: %s\n", un.sysname);
139 strm.
Printf(
" Release: %s\n", un.release);
140 strm.
Printf(
" Version: %s\n", un.version);
147 uint32_t resume_count = 0;
160 std::string shell_string = shell.
GetPath();
165 const char *shell_name = strrchr(shell_string.c_str(),
'/');
166 if (shell_name ==
nullptr)
167 shell_name = shell_string.c_str();
171 if (strcmp(shell_name,
"csh") == 0 || strcmp(shell_name,
"tcsh") == 0 ||
172 strcmp(shell_name,
"zsh") == 0 || strcmp(shell_name,
"sh") == 0) {
195 unsigned prot,
unsigned flags,
197 uint64_t flags_platform = 0;
204 MmapArgList args({addr, length, prot, flags_platform, fd, offset});
210 std::lock_guard<std::mutex> guard(
m_mutex);
212 m_type_system = std::make_shared<TypeSystemClang>(
"siginfo", triple);
268 if (triple.isArch64Bit())
284 {
"_value", sigval_type},
288 ast->AddFieldToRecordType(
289 union_type,
"_child",
290 ast->CreateStructForIdentifier(llvm::StringRef(),
294 {
"_status", int_type},
295 {
"_utime", clock_type},
296 {
"_stime", clock_type},
300 ast->AddFieldToRecordType(
301 union_type,
"_fault",
302 ast->CreateStructForIdentifier(llvm::StringRef(),
304 {
"_addr", voidp_type},
306 {
"_trap2", int_type},
307 {
"_trap3", int_type},
311 ast->AddFieldToRecordType(
313 ast->CreateStructForIdentifier(llvm::StringRef(),
315 {
"_band", long_type},
320 ast->AddFieldToRecordType(union_type,
"_syscall",
321 ast->CreateStructForIdentifier(
324 {
"_sysnum", int_type},
325 {
"_retval", int_type.GetArrayType(2)},
326 {
"_error", int_type},
327 {
"_args", long_long_type.GetArrayType(8)},
331 ast->AddFieldToRecordType(
332 union_type,
"_ptrace_state",
333 ast->CreateStructForIdentifier(llvm::StringRef(),
335 {
"_pe_report_event", int_type},
336 {
"_option", ptrace_option_type},
340 ast->CompleteTagDeclarationDefinition(union_type);
341 ast->AddFieldToRecordType(ksiginfo_type,
"_reason", union_type,
344 ast->CompleteTagDeclarationDefinition(ksiginfo_type);
345 ast->AddFieldToRecordType(siginfo_type,
"_info", ksiginfo_type,
348 ast->CompleteTagDeclarationDefinition(siginfo_type);
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_PLUGIN_DEFINE(PluginName)
An architecture specification class.
llvm::Triple & GetTriple()
Architecture triple accessor.
Generic representation of a type in a programming language.
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
A uniqued constant string class.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
bool Test(ValueType bit) const
Test a single flag bit.
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
const FileSpec & GetShell() const
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
A TypeSystem implementation based on Clang.
CompilerType GetBasicType(lldb::BasicType type)
static clang::FieldDecl * AddFieldToRecordType(const CompilerType &type, llvm::StringRef name, const CompilerType &field_type, lldb::AccessType access, uint32_t bitfield_bit_size)
CompilerType CreateStructForIdentifier(llvm::StringRef type_name, const std::initializer_list< std::pair< const char *, CompilerType > > &type_fields, bool packed=false)
static bool CompleteTagDeclarationDefinition(const CompilerType &type)
CompilerType CreateRecordType(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, llvm::StringRef name, int kind, lldb::LanguageType language, std::optional< ClangASTMetadata > metadata=std::nullopt, bool exports_symbols=false)
static bool StartTagDeclarationDefinition(const CompilerType &type)
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
llvm::SmallVector< lldb::addr_t, 6 > MmapArgList
std::shared_ptr< lldb_private::Platform > PlatformSP
@ eLanguageTypeC
Non-standardized C, such as K&R.