Index: lldb/source/Expression/DWARFExpression.cpp =================================================================== --- lldb/source/Expression/DWARFExpression.cpp +++ lldb/source/Expression/DWARFExpression.cpp @@ -1030,6 +1030,7 @@ if (ABISP abi_sp = process->GetABI()) pointer_value = abi_sp->FixCodeAddress(pointer_value); stack.back().GetScalar() = pointer_value; + stack.back().GetScalar().MakeSigned(); stack.back().ClearContext(); } else { if (error_ptr) @@ -1120,6 +1121,7 @@ break; } stack.back().GetScalar() = ptr; + stack.back().GetScalar().MakeSigned(); stack.back().ClearContext(); } break; case Value::ValueType::FileAddress: { @@ -1147,6 +1149,7 @@ stack.back().GetScalar() = DerefSizeExtractDataHelper( addr_bytes, size, objfile->GetByteOrder(), size); + stack.back().GetScalar().MakeSigned(); stack.back().ClearContext(); break; } else { @@ -1177,6 +1180,7 @@ stack.back().GetScalar() = DerefSizeExtractDataHelper(addr_bytes, sizeof(addr_bytes), process->GetByteOrder(), size); + stack.back().GetScalar().MakeSigned(); stack.back().ClearContext(); } else { if (error_ptr) Index: lldb/test/API/commands/expression/signed-dw-op-deref/Makefile =================================================================== --- /dev/null +++ lldb/test/API/commands/expression/signed-dw-op-deref/Makefile @@ -0,0 +1,5 @@ +C_SOURCES := main.c +CFLAGS_EXTRAS := -g -O1 +override CC := gcc + +include Makefile.rules Index: lldb/test/API/commands/expression/signed-dw-op-deref/TestSignedDeref.py =================================================================== --- /dev/null +++ lldb/test/API/commands/expression/signed-dw-op-deref/TestSignedDeref.py @@ -0,0 +1,11 @@ +"""Test that we can print values represented via DW_OP_deref and DW_OP_lt""" + +import lldb +from lldbsuite.test.lldbtest import * + +class SignedDerefTestCase(TestBase): + def test_signed_div(self): + """Test that we can print values represented via DW_OP_deref and DW_OP_lt""" + self.build() + _, process, _, bkpt = lldbutil.run_to_source_breakpoint(self, '// break here', lldb.SBFileSpec('main.c')) + self.expect_expr('p_13', result_type='int', result_value='1') Index: lldb/test/API/commands/expression/signed-dw-op-deref/main.c =================================================================== --- /dev/null +++ lldb/test/API/commands/expression/signed-dw-op-deref/main.c @@ -0,0 +1,12 @@ +#include +int a; +signed char b = -48; +static int func_12(int p_13) { + for (;a;); // break here + return 0; +} +int main() { + func_12(0 > b); + printf(0); + return 0; +}