Merge lldb release_80 branch r351543, and resolve conflicts.

This commit is contained in:
dim 2019-01-22 20:16:41 +00:00
parent d0fd469700
commit b21d06ec06
3 changed files with 27 additions and 21 deletions

View File

@ -12,12 +12,13 @@
#include "lldb/Host/posix/HostInfoPosix.h"
#include "lldb/Utility/FileSpec.h"
#include "llvm/Support/VersionTuple.h"
namespace lldb_private {
class HostInfoOpenBSD : public HostInfoPosix {
public:
static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
static llvm::VersionTuple GetOSVersion();
static bool GetOSBuildString(std::string &s);
static bool GetOSKernelDescription(std::string &s);
static FileSpec GetProgramFileSpec();

View File

@ -210,31 +210,35 @@ bool Value::ValueOf(ExecutionContext *exe_ctx) {
}
uint64_t Value::GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx) {
uint64_t byte_size = 0;
switch (m_context_type) {
case eContextTypeRegisterInfo: // RegisterInfo *
if (GetRegisterInfo()) {
if (error_ptr)
error_ptr->Clear();
return GetRegisterInfo()->byte_size;
}
if (GetRegisterInfo())
byte_size = GetRegisterInfo()->byte_size;
break;
case eContextTypeInvalid:
case eContextTypeLLDBType: // Type *
case eContextTypeVariable: // Variable *
{
auto *scope = exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr;
if (llvm::Optional<uint64_t> size = GetCompilerType().GetByteSize(scope)) {
if (error_ptr)
error_ptr->Clear();
return *size;
const CompilerType &ast_type = GetCompilerType();
if (ast_type.IsValid())
if (llvm::Optional<uint64_t> size = ast_type.GetByteSize(
exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr))
byte_size = *size;
} break;
}
if (error_ptr) {
if (byte_size == 0) {
if (error_ptr->Success())
error_ptr->SetErrorString("Unable to determine byte size.");
} else {
error_ptr->Clear();
}
break;
}
}
if (error_ptr && error_ptr->Success())
error_ptr->SetErrorString("Unable to determine byte size.");
return 0;
return byte_size;
}
const CompilerType &Value::GetCompilerType() {

View File

@ -17,16 +17,17 @@
using namespace lldb_private;
bool HostInfoOpenBSD::GetOSVersion(uint32_t &major, uint32_t &minor,
uint32_t &update) {
llvm::VersionTuple HostInfoOpenBSD::GetOSVersion() {
struct utsname un;
::memset(&un, 0, sizeof(utsname));
if (uname(&un) < 0)
return false;
return llvm::VersionTuple();
int status = sscanf(un.release, "%u.%u", &major, &minor);
return status == 2;
unsigned major, minor;
if (2 == sscanf(un.release, "%u.%u", &major, &minor))
return llvm::VersionTuple(major, minor);
return llvm::VersionTuple();
}
bool HostInfoOpenBSD::GetOSBuildString(std::string &s) {