Skip to content

Commit 7e770f9

Browse files
committed
Revert "Add SBValue::GetValueAsAddress API for removing non-addressing metadata"
Revert while I investigate two CI bot failures; the more important is the lldb-arm-ubuntu where the FixAddress is removing the 0th bit so we're adding the `actual=` decorator on a string pointer, ``` Got output: (char *) strptr = 0x00400817 (actual=0x400816) ptr = [{ },{H}] ``` in TestDataFormatterSmartArray.py line 229. This reverts commit 4d635be.
1 parent 00854cb commit 7e770f9

File tree

9 files changed

+2
-157
lines changed

9 files changed

+2
-157
lines changed

lldb/bindings/interface/SBValueDocstrings.i

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -135,24 +135,6 @@ linked list."
135135
%feature("docstring", "Expands nested expressions like .a->b[0].c[1]->d."
136136
) lldb::SBValue::GetValueForExpressionPath;
137137

138-
%feature("docstring", "
139-
Return the value as an address. On failure, LLDB_INVALID_ADDRESS
140-
will be returned. On architectures like AArch64, where the
141-
top (unaddressable) bits can be used for authentication,
142-
memory tagging, or top byte ignore, this method will return
143-
the value with those top bits cleared.
144-
145-
GetValueAsUnsigned returns the actual value, with the
146-
authentication/Top Byte Ignore/Memory Tagging Extension bits.
147-
148-
Calling this on a random value which is not a pointer is
149-
incorrect. Call GetType().IsPointerType() if in doubt.
150-
151-
An SB API program may want to show both the literal byte value
152-
and the address it refers to in memory. These two SBValue
153-
methods allow SB API writers to behave appropriately for their
154-
interface.") lldb::SBValue::GetValueAsAddress;
155-
156138
%feature("doctstring", "
157139
Returns the number for children.
158140

lldb/include/lldb/API/SBValue.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ class LLDB_API SBValue {
6262

6363
uint64_t GetValueAsUnsigned(uint64_t fail_value = 0);
6464

65-
lldb::addr_t GetValueAsAddress();
66-
6765
ValueType GetValueType();
6866

6967
// If you call this on a newly created ValueObject, it will always return

lldb/include/lldb/Core/ValueObject.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,6 @@ class ValueObject {
564564

565565
lldb::addr_t GetPointerValue(AddressType *address_type = nullptr);
566566

567-
/// Remove TBI/MTE/ptrauth bits from address, if those are defined on this
568-
/// target/ABI.
569-
lldb::addr_t GetStrippedPointerValue(lldb::addr_t address);
570-
571567
lldb::ValueObjectSP GetSyntheticChild(ConstString key) const;
572568

573569
lldb::ValueObjectSP GetSyntheticArrayMember(size_t index, bool can_create);

lldb/source/API/SBValue.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include "lldb/Symbol/Type.h"
3131
#include "lldb/Symbol/Variable.h"
3232
#include "lldb/Symbol/VariableList.h"
33-
#include "lldb/Target/ABI.h"
3433
#include "lldb/Target/ExecutionContext.h"
3534
#include "lldb/Target/Process.h"
3635
#include "lldb/Target/StackFrame.h"
@@ -925,25 +924,6 @@ uint64_t SBValue::GetValueAsUnsigned(uint64_t fail_value) {
925924
return fail_value;
926925
}
927926

928-
lldb::addr_t SBValue::GetValueAsAddress() {
929-
addr_t fail_value = LLDB_INVALID_ADDRESS;
930-
ValueLocker locker;
931-
lldb::ValueObjectSP value_sp(GetSP(locker));
932-
if (value_sp) {
933-
bool success = true;
934-
uint64_t ret_val = fail_value;
935-
ret_val = value_sp->GetValueAsUnsigned(fail_value, &success);
936-
if (!success)
937-
return fail_value;
938-
if (ProcessSP process_sp = m_opaque_sp->GetProcessSP())
939-
if (ABISP abi_sp = process_sp->GetABI())
940-
return abi_sp->FixCodeAddress(ret_val);
941-
return ret_val;
942-
}
943-
944-
return fail_value;
945-
}
946-
947927
bool SBValue::MightHaveChildren() {
948928
LLDB_INSTRUMENT_VA(this);
949929

lldb/source/Core/ValueObject.cpp

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "lldb/Symbol/SymbolContext.h"
3232
#include "lldb/Symbol/Type.h"
3333
#include "lldb/Symbol/Variable.h"
34-
#include "lldb/Target/ABI.h"
3534
#include "lldb/Target/ExecutionContext.h"
3635
#include "lldb/Target/Language.h"
3736
#include "lldb/Target/LanguageRuntime.h"
@@ -1454,14 +1453,6 @@ addr_t ValueObject::GetAddressOf(bool scalar_is_load_address,
14541453
return LLDB_INVALID_ADDRESS;
14551454
}
14561455

1457-
addr_t ValueObject::GetStrippedPointerValue(addr_t address) {
1458-
ExecutionContext exe_ctx(GetExecutionContextRef());
1459-
if (Process *process = exe_ctx.GetProcessPtr())
1460-
if (ABISP abi_sp = process->GetABI())
1461-
return abi_sp->FixCodeAddress(address);
1462-
return address;
1463-
}
1464-
14651456
addr_t ValueObject::GetPointerValue(AddressType *address_type) {
14661457
addr_t address = LLDB_INVALID_ADDRESS;
14671458
if (address_type)
@@ -1477,15 +1468,11 @@ addr_t ValueObject::GetPointerValue(AddressType *address_type) {
14771468
address = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
14781469
break;
14791470

1480-
case Value::ValueType::HostAddress: {
1481-
lldb::offset_t data_offset = 0;
1482-
address = m_data.GetAddress(&data_offset);
1483-
} break;
1484-
1471+
case Value::ValueType::HostAddress:
14851472
case Value::ValueType::LoadAddress:
14861473
case Value::ValueType::FileAddress: {
14871474
lldb::offset_t data_offset = 0;
1488-
address = GetStrippedPointerValue(m_data.GetAddress(&data_offset));
1475+
address = m_data.GetAddress(&data_offset);
14891476
} break;
14901477
}
14911478

@@ -3024,11 +3011,6 @@ lldb::ValueObjectSP ValueObject::CreateValueObjectFromAddress(
30243011
if (type) {
30253012
CompilerType pointer_type(type.GetPointerType());
30263013
if (pointer_type) {
3027-
if (Process *process = exe_ctx.GetProcessPtr()) {
3028-
if (ABISP abi_sp = process->GetABI()) {
3029-
address = abi_sp->FixCodeAddress(address);
3030-
}
3031-
}
30323014
lldb::DataBufferSP buffer(
30333015
new lldb_private::DataBufferHeap(&address, sizeof(lldb::addr_t)));
30343016
lldb::ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create(

lldb/source/DataFormatters/ValueObjectPrinter.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -440,13 +440,6 @@ bool ValueObjectPrinter::PrintValueAndSummaryIfNeeded(bool &value_printed,
440440
if (!m_options.m_hide_name)
441441
m_stream->PutChar(' ');
442442
m_stream->PutCString(m_value);
443-
if (IsPointerValue(m_valobj->GetCompilerType())) {
444-
uint64_t orig_value = m_valobj->GetValueAsUnsigned(0);
445-
addr_t stripped = m_valobj->GetPointerValue();
446-
if (stripped != orig_value) {
447-
m_stream->Printf(" (actual=0x%" PRIx64 ")", stripped);
448-
}
449-
}
450443
value_printed = true;
451444
}
452445
}

lldb/test/API/api/clear-sbvalue-nonadressable-bits/Makefile

Lines changed: 0 additions & 3 deletions
This file was deleted.

lldb/test/API/api/clear-sbvalue-nonadressable-bits/TestClearSBValueNonAddressableBits.py

Lines changed: 0 additions & 58 deletions
This file was deleted.

lldb/test/API/api/clear-sbvalue-nonadressable-bits/main.c

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)