Path: blob/main/contrib/llvm-project/lldb/source/Host/aix/HostInfoAIX.cpp
213799 views
//===-- HostInfoAIX.cpp -------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "lldb/Host/aix/HostInfoAIX.h"9#include "lldb/Host/posix/Support.h"10#include <sys/procfs.h>1112using namespace lldb_private;1314void HostInfoAIX::Initialize(SharedLibraryDirectoryHelper *helper) {15HostInfoPosix::Initialize(helper);16}1718void HostInfoAIX::Terminate() { HostInfoBase::Terminate(); }1920FileSpec HostInfoAIX::GetProgramFileSpec() {21static FileSpec g_program_filespec;22struct psinfo psinfoData;23auto BufferOrError = getProcFile(getpid(), "psinfo");24if (BufferOrError) {25std::unique_ptr<llvm::MemoryBuffer> PsinfoBuffer =26std::move(*BufferOrError);27memcpy(&psinfoData, PsinfoBuffer->getBufferStart(), sizeof(psinfoData));28llvm::StringRef exe_path(29psinfoData.pr_psargs,30strnlen(psinfoData.pr_psargs, sizeof(psinfoData.pr_psargs)));31if (!exe_path.empty())32g_program_filespec.SetFile(exe_path, FileSpec::Style::native);33}34return g_program_filespec;35}363738