summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2021-04-28 12:29:51 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2021-04-28 12:29:51 +0000
commit9081900a20690ef3dffce783e60dff8e0c120916 (patch)
tree8ccf77cf217ee19d12bf3e1bc5a85a305d28322b /gnu
parent01b8018ce4042607c5a12a48321f24f0bba03ab1 (diff)
Import LLVM 11.1.0 release including clang, lld and lldb.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/llvm/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp66
1 files changed, 37 insertions, 29 deletions
diff --git a/gnu/llvm/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp b/gnu/llvm/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
index 9d5ed1fa266..7729e58f858 100644
--- a/gnu/llvm/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
+++ b/gnu/llvm/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
@@ -26,12 +26,10 @@
#include "lldb/Target/Thread.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/DataExtractor.h"
-#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegisterValue.h"
#include "lldb/Utility/Status.h"
-#include <optional>
#include <vector>
using namespace lldb;
@@ -109,7 +107,7 @@ ABISysV_x86_64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch)
bool ABISysV_x86_64::PrepareTrivialCall(Thread &thread, addr_t sp,
addr_t func_addr, addr_t return_addr,
llvm::ArrayRef<addr_t> args) const {
- Log *log = GetLog(LLDBLog::Expressions);
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
if (log) {
StreamString s;
@@ -268,7 +266,7 @@ bool ABISysV_x86_64::GetArgumentValues(Thread &thread,
// We currently only support extracting values with Clang QualTypes. Do we
// care about others?
CompilerType compiler_type = value->GetCompilerType();
- std::optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
+ llvm::Optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
if (!bit_size)
return false;
bool is_signed;
@@ -338,7 +336,7 @@ Status ABISysV_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
error.SetErrorString(
"We don't support returning complex values at present");
else {
- std::optional<uint64_t> bit_width =
+ llvm::Optional<uint64_t> bit_width =
compiler_type.GetBitSize(frame_sp.get());
if (!bit_width) {
error.SetErrorString("can't get type size");
@@ -401,14 +399,14 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectSimple(
const uint32_t type_flags = return_compiler_type.GetTypeInfo();
if (type_flags & eTypeIsScalar) {
- value.SetValueType(Value::ValueType::Scalar);
+ value.SetValueType(Value::eValueTypeScalar);
bool success = false;
if (type_flags & eTypeIsInteger) {
// Extract the register context so we can read arguments from registers
- std::optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(&thread);
+ llvm::Optional<uint64_t> byte_size =
+ return_compiler_type.GetByteSize(nullptr);
if (!byte_size)
return return_valobj_sp;
uint64_t raw_value = thread.GetRegisterContext()->ReadRegisterAsUnsigned(
@@ -454,8 +452,8 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectSimple(
if (type_flags & eTypeIsComplex) {
// Don't handle complex yet.
} else {
- std::optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(&thread);
+ llvm::Optional<uint64_t> byte_size =
+ return_compiler_type.GetByteSize(nullptr);
if (byte_size && *byte_size <= sizeof(long double)) {
const RegisterInfo *xmm0_info =
reg_ctx->GetRegisterInfoByName("xmm0", 0);
@@ -489,12 +487,12 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectSimple(
value.GetScalar() =
(uint64_t)thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id,
0);
- value.SetValueType(Value::ValueType::Scalar);
+ value.SetValueType(Value::eValueTypeScalar);
return_valobj_sp = ValueObjectConstResult::Create(
thread.GetStackFrameAtIndex(0).get(), value, ConstString(""));
} else if (type_flags & eTypeIsVector) {
- std::optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(&thread);
+ llvm::Optional<uint64_t> byte_size =
+ return_compiler_type.GetByteSize(nullptr);
if (byte_size && *byte_size > 0) {
const RegisterInfo *altivec_reg =
reg_ctx->GetRegisterInfoByName("xmm0", 0);
@@ -512,7 +510,7 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectSimple(
if (reg_ctx->ReadRegister(altivec_reg, reg_value)) {
Status error;
if (reg_value.GetAsMemoryData(
- *altivec_reg, heap_data_up->GetBytes(),
+ altivec_reg, heap_data_up->GetBytes(),
heap_data_up->GetByteSize(), byte_order, error)) {
DataExtractor data(DataBufferSP(heap_data_up.release()),
byte_order,
@@ -540,10 +538,10 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectSimple(
Status error;
if (reg_value.GetAsMemoryData(
- *altivec_reg, heap_data_up->GetBytes(),
+ altivec_reg, heap_data_up->GetBytes(),
altivec_reg->byte_size, byte_order, error) &&
reg_value2.GetAsMemoryData(
- *altivec_reg2,
+ altivec_reg2,
heap_data_up->GetBytes() + altivec_reg->byte_size,
heap_data_up->GetByteSize() - altivec_reg->byte_size,
byte_order, error)) {
@@ -588,8 +586,8 @@ static bool FlattenAggregateType(
uint64_t field_bit_offset = 0;
CompilerType field_compiler_type = return_compiler_type.GetFieldAtIndex(
idx, name, &field_bit_offset, nullptr, nullptr);
- std::optional<uint64_t> field_bit_width =
- field_compiler_type.GetBitSize(&thread);
+ llvm::Optional<uint64_t> field_bit_width =
+ field_compiler_type.GetBitSize(&thread);
// if we don't know the size of the field (e.g. invalid type), exit
if (!field_bit_width || *field_bit_width == 0) {
@@ -631,7 +629,7 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectImpl(
if (!reg_ctx_sp)
return return_valobj_sp;
- std::optional<uint64_t> bit_width = return_compiler_type.GetBitSize(&thread);
+ llvm::Optional<uint64_t> bit_width = return_compiler_type.GetBitSize(&thread);
if (!bit_width)
return return_valobj_sp;
if (return_compiler_type.IsAggregateType()) {
@@ -639,14 +637,14 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectImpl(
bool is_memory = true;
std::vector<uint32_t> aggregate_field_offsets;
std::vector<CompilerType> aggregate_compiler_types;
- auto ts = return_compiler_type.GetTypeSystem();
- if (ts && ts->CanPassInRegisters(return_compiler_type) &&
- *bit_width <= 128 &&
- FlattenAggregateType(thread, exe_ctx, return_compiler_type, 0,
- aggregate_field_offsets,
- aggregate_compiler_types)) {
+ if (return_compiler_type.GetTypeSystem()->CanPassInRegisters(
+ return_compiler_type) &&
+ *bit_width <= 128 &&
+ FlattenAggregateType(thread, exe_ctx, return_compiler_type,
+ 0, aggregate_field_offsets,
+ aggregate_compiler_types)) {
ByteOrder byte_order = target->GetArchitecture().GetByteOrder();
- WritableDataBufferSP data_sp(new DataBufferHeap(16, 0));
+ DataBufferSP data_sp(new DataBufferHeap(16, 0));
DataExtractor return_ext(data_sp, byte_order,
target->GetArchitecture().GetAddressByteSize());
@@ -889,7 +887,6 @@ bool ABISysV_x86_64::CreateDefaultUnwindPlan(UnwindPlan &unwind_plan) {
const int32_t ptr_size = 8;
row->GetCFAValue().SetIsRegisterPlusOffset(dwarf_rbp, 2 * ptr_size);
row->SetOffset(0);
- row->SetUnspecifiedRegistersAreUndefined(true);
row->SetRegisterLocationToAtCFAPlusOffset(fp_reg_num, ptr_size * -2, true);
row->SetRegisterLocationToAtCFAPlusOffset(pc_reg_num, ptr_size * -1, true);
@@ -935,8 +932,6 @@ uint32_t ABISysV_x86_64::GetGenericNum(llvm::StringRef name) {
.Case("rsp", LLDB_REGNUM_GENERIC_SP)
.Case("rbp", LLDB_REGNUM_GENERIC_FP)
.Case("rflags", LLDB_REGNUM_GENERIC_FLAGS)
- // gdbserver uses eflags
- .Case("eflags", LLDB_REGNUM_GENERIC_FLAGS)
.Case("rdi", LLDB_REGNUM_GENERIC_ARG1)
.Case("rsi", LLDB_REGNUM_GENERIC_ARG2)
.Case("rdx", LLDB_REGNUM_GENERIC_ARG3)
@@ -954,3 +949,16 @@ void ABISysV_x86_64::Initialize() {
void ABISysV_x86_64::Terminate() {
PluginManager::UnregisterPlugin(CreateInstance);
}
+
+lldb_private::ConstString ABISysV_x86_64::GetPluginNameStatic() {
+ static ConstString g_name("sysv-x86_64");
+ return g_name;
+}
+
+// PluginInterface protocol
+
+lldb_private::ConstString ABISysV_x86_64::GetPluginName() {
+ return GetPluginNameStatic();
+}
+
+uint32_t ABISysV_x86_64::GetPluginVersion() { return 1; }