10#include "lldb/Host/Config.h"
14#include <sys/utsname.h>
31#include "llvm/TargetParser/Host.h"
32#include "llvm/TargetParser/Triple.h"
36#define MAP_PRIVATE 0x0002
37#define MAP_ANON 0x1000
50 LLDB_LOG(log,
"force = {0}, arch=({1}, {2})", force,
51 arch ? arch->GetArchitectureName() :
"<null>",
52 arch ? arch->GetTriple().getTriple() :
"<null>");
55 if (!create && arch && arch->IsValid()) {
56 const llvm::Triple &triple = arch->GetTriple();
57 switch (triple.getOS()) {
58 case llvm::Triple::FreeBSD:
62#if defined(__FreeBSD__)
65 case llvm::Triple::OSType::UnknownOS:
66 create = !arch->TripleOSWasSpecified();
73 LLDB_LOG(log,
"create = {0}", create);
82 return "Local FreeBSD user platform plug-in.";
83 return "Remote FreeBSD user platform plug-in.";
90#if defined(__FreeBSD__)
92 default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture());
117 ArchSpec hostArch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
119 if (hostArch.
GetTriple().isArch64Bit()) {
121 HostInfo::GetArchitecture(HostInfo::eArchKind32));
125 {llvm::Triple::x86_64, llvm::Triple::x86, llvm::Triple::aarch64,
126 llvm::Triple::arm, llvm::Triple::mips64, llvm::Triple::ppc64,
128 llvm::Triple::FreeBSD);
152 strm.
Printf(
" Kernel: %s\n", un.sysname);
153 strm.
Printf(
" Release: %s\n", un.release);
154 strm.
Printf(
" Version: %s\n", un.version);
174 unsigned prot,
unsigned flags,
176 uint64_t flags_platform = 0;
183 MmapArgList args({addr, length, prot, flags_platform, fd, offset});
184 if (arch.
GetTriple().getArch() == llvm::Triple::x86)
191 std::lock_guard<std::mutex> guard(
m_mutex);
193 m_type_system = std::make_shared<TypeSystemClang>(
"siginfo", triple);
246 union_type,
"_fault",
249 {
"_trapno", int_type},
253 ast->AddFieldToRecordType(
254 union_type,
"_timer",
255 ast->CreateStructForIdentifier(llvm::StringRef(),
257 {
"_timerid", int_type},
258 {
"_overrun", int_type},
262 ast->AddFieldToRecordType(
263 union_type,
"_mesgq",
264 ast->CreateStructForIdentifier(llvm::StringRef(),
270 ast->AddFieldToRecordType(
272 ast->CreateStructForIdentifier(llvm::StringRef(),
274 {
"_band", long_type},
278 ast->CompleteTagDeclarationDefinition(union_type);
279 ast->AddFieldToRecordType(siginfo_type,
"_reason", union_type,
282 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.
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
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.