File tree Expand file tree Collapse file tree 6 files changed +46
-9
lines changed
test/API/python_api/value Expand file tree Collapse file tree 6 files changed +46
-9
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,8 @@ class TargetProperties : public Properties {
167
167
168
168
bool GetEnableSyntheticValue () const ;
169
169
170
+ bool ShowHexVariableValuesWithLeadingZeroes () const ;
171
+
170
172
uint32_t GetMaxZeroPaddingInFloatFormat () const ;
171
173
172
174
uint32_t GetMaximumNumberOfChildrenToDisplay () const ;
Original file line number Diff line number Diff line change @@ -620,10 +620,17 @@ lldb::offset_t lldb_private::DumpDataExtractor(
620
620
case 2 :
621
621
case 4 :
622
622
case 8 :
623
- s->Printf (wantsuppercase ? " 0x%*.*" PRIX64 : " 0x%*.*" PRIx64,
624
- (int )(2 * item_byte_size), (int )(2 * item_byte_size),
625
- DE.GetMaxU64Bitfield (&offset, item_byte_size, item_bit_size,
626
- item_bit_offset));
623
+ if (Target::GetGlobalProperties ()
624
+ .ShowHexVariableValuesWithLeadingZeroes ()) {
625
+ s->Printf (wantsuppercase ? " 0x%*.*" PRIX64 : " 0x%*.*" PRIx64,
626
+ (int )(2 * item_byte_size), (int )(2 * item_byte_size),
627
+ DE.GetMaxU64Bitfield (&offset, item_byte_size, item_bit_size,
628
+ item_bit_offset));
629
+ } else {
630
+ s->Printf (wantsuppercase ? " 0x%" PRIX64 : " 0x%" PRIx64,
631
+ DE.GetMaxU64Bitfield (&offset, item_byte_size, item_bit_size,
632
+ item_bit_offset));
633
+ }
627
634
break ;
628
635
default : {
629
636
assert (item_bit_size == 0 && item_bit_offset == 0 );
Original file line number Diff line number Diff line change @@ -4236,8 +4236,8 @@ bool TargetProperties::SetPreferDynamicValue(lldb::DynamicValueType d) {
4236
4236
}
4237
4237
4238
4238
bool TargetProperties::GetPreloadSymbols () const {
4239
- if (INTERRUPT_REQUESTED (m_target->GetDebugger (),
4240
- " Interrupted checking preload symbols" )) {
4239
+ if (INTERRUPT_REQUESTED (m_target->GetDebugger (),
4240
+ " Interrupted checking preload symbols" )) {
4241
4241
return false ;
4242
4242
}
4243
4243
const uint32_t idx = ePropertyPreloadSymbols;
@@ -4539,6 +4539,12 @@ bool TargetProperties::GetEnableSyntheticValue() const {
4539
4539
idx, g_target_properties[idx].default_uint_value != 0 );
4540
4540
}
4541
4541
4542
+ bool TargetProperties::ShowHexVariableValuesWithLeadingZeroes () const {
4543
+ const uint32_t idx = ePropertyShowHexVariableValuesWithLeadingZeroes;
4544
+ return GetPropertyAtIndexAs<bool >(
4545
+ idx, g_target_properties[idx].default_uint_value != 0 );
4546
+ }
4547
+
4542
4548
uint32_t TargetProperties::GetMaxZeroPaddingInFloatFormat () const {
4543
4549
const uint32_t idx = ePropertyMaxZeroPaddingInFloatFormat;
4544
4550
return GetPropertyAtIndexAs<uint64_t >(
Original file line number Diff line number Diff line change @@ -82,6 +82,10 @@ let Definition = "target" in {
82
82
def SaveObjectsDir: Property<"save-jit-objects-dir", "FileSpec">,
83
83
DefaultStringValue<"">,
84
84
Desc<"If specified, the directory to save intermediate object files generated by the LLVM JIT">;
85
+ def ShowHexVariableValuesWithLeadingZeroes: Property<"show-hex-variable-values-with-leading-zeroes", "Boolean">,
86
+ Global,
87
+ DefaultTrue,
88
+ Desc<"Whether to display leading zeroes when printing variable values in hex format.">;
85
89
def MaxZeroPaddingInFloatFormat: Property<"max-zero-padding-in-float-format", "UInt64">,
86
90
DefaultUnsignedValue<6>,
87
91
Desc<"The maximum number of zeroes to insert when displaying a very small float before falling back to scientific notation.">;
Original file line number Diff line number Diff line change 3
3
"""
4
4
5
5
import lldb
6
+ from lldbsuite .test import lldbutil
6
7
from lldbsuite .test .decorators import *
7
8
from lldbsuite .test .lldbtest import *
8
- from lldbsuite .test import lldbutil
9
9
10
10
11
11
class ValueAPITestCase (TestBase ):
@@ -206,3 +206,18 @@ def test(self):
206
206
- 526164208 ,
207
207
"signed sinthex == -526164208" ,
208
208
)
209
+
210
+ # Check that hex value printing works as expected.
211
+ self .assertEqual (
212
+ frame0 .FindVariable ("fixed_int_ptr" ).GetValue (),
213
+ "0x00000000000000aa" ,
214
+ )
215
+ self .runCmd ("settings set target.show-hex-values-with-leading-zeroes false" )
216
+ self .assertEqual (
217
+ frame0 .FindVariable ("another_fixed_int_ptr" ).GetValue (),
218
+ "0xaa" ,
219
+ )
220
+ self .assertEqual (
221
+ frame0 .FindVariable ("a_null_int_ptr" ).GetValue (),
222
+ "0x0" ,
223
+ )
Original file line number Diff line number Diff line change @@ -44,13 +44,16 @@ int main (int argc, char const *argv[])
44
44
int i ;
45
45
MyInt a = 12345 ;
46
46
struct MyStruct s = { 11 , 22 };
47
- struct MyBiggerStruct f = { 33 , 44 , 55 };
47
+ struct MyBiggerStruct f = { 33 , 44 , 55 };
48
48
int * my_int_ptr = & g_my_int ;
49
49
printf ("my_int_ptr points to location %p\n" , my_int_ptr );
50
+ int * fixed_int_ptr = (int * )(void * )0xAA ;
51
+ int * another_fixed_int_ptr = (int * )(void * )0xAA ;
52
+ int * a_null_int_ptr = NULL ;
50
53
const char * * str_ptr = days_of_week ;
51
54
for (i = 0 ; i < 7 ; ++ i )
52
55
printf ("%s\n" , str_ptr [i ]); // Break at this line
53
56
// and do str_ptr_val.GetChildAtIndex(5, lldb.eNoDynamicValues, True).
54
-
57
+
55
58
return 0 ;
56
59
}
You can’t perform that action at this time.
0 commit comments