#include "lldb/Utility/Status.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/VASPrintf.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-enumerations.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Errno.h"
#include "llvm/Support/FormatProviders.h"
#include <cerrno>
#include <cstdarg>
#include <string>
#include <system_error>
#ifdef __APPLE__
#include <mach/mach.h>
#endif
#ifdef _WIN32
#include <windows.h>
#endif
#include <cstdint>
namespace llvm {
class raw_ostream;
}
usingnamespacelldb;
usingnamespacelldb_private;
char CloneableError::ID;
char CloneableECError::ID;
char MachKernelError::ID;
char Win32Error::ID;
char ExpressionErrorBase::ID;
namespace {
class LLDBGenericCategory : public std::error_category { … };
LLDBGenericCategory &lldb_generic_category() { … }
}
Status::Status() : … { … }
static llvm::Error ErrorFromEnums(Status::ValueType err, ErrorType type,
std::string msg) { … }
Status::Status(ValueType err, ErrorType type, std::string msg)
: … { … }
Status::Status(std::error_code EC)
: … { … }
Status::Status(std::string err_str)
: … { … }
const Status &Status::operator=(Status &&other) { … }
Status Status::FromErrorStringWithFormat(const char *format, ...) { … }
static llvm::Error CloneError(const llvm::Error &error) { … }
Status Status::FromError(llvm::Error error) { … }
llvm::Error Status::ToError() const { … }
Status::~Status() { … }
#ifdef _WIN32
static std::string RetrieveWin32ErrorString(uint32_t error_code) {
char *buffer = nullptr;
std::string message;
if (::FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_MAX_WIDTH_MASK,
NULL, error_code, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
(LPSTR)&buffer, 0, NULL)) {
message.assign(buffer);
::LocalFree(buffer);
}
else if (::FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_MAX_WIDTH_MASK,
NULL, error_code, 0, (LPSTR)&buffer, 0, NULL)) {
message.assign(buffer);
::LocalFree(buffer);
}
return message;
}
#endif
std::string MachKernelError::message() const { … }
std::string Win32Error::message() const { … }
std::unique_ptr<CloneableError> MachKernelError::Clone() const { … }
std::unique_ptr<CloneableError> Win32Error::Clone() const { … }
const char *Status::AsCString(const char *default_error_str) const { … }
void Status::Clear() { … }
Status::ValueType Status::GetError() const { … }
static ErrorType ErrorCodeToErrorType(std::error_code ec) { … }
ErrorType CloneableECError::GetErrorType() const { … }
lldb::ErrorType MachKernelError::GetErrorType() const { … }
lldb::ErrorType Win32Error::GetErrorType() const { … }
lldb::ErrorType ExpressionErrorBase::GetErrorType() const { … }
ErrorType Status::GetType() const { … }
bool Status::Fail() const { … }
Status Status::FromErrno() { … }
bool Status::Success() const { … }
void llvm::format_provider<lldb_private::Status>::format(
const lldb_private::Status &error, llvm::raw_ostream &OS,
llvm::StringRef Options) { … }
const char *lldb_private::ExpressionResultAsCString(ExpressionResults result) { … }