@@ -27,6 +27,19 @@ using lldb::SBValue;
27
27
using lldb::eReturnStatusFailed;
28
28
using lldb::eReturnStatusSuccessFinishResult;
29
29
30
+ const char * const
31
+ FindReferencesCmd::ObjectScanner::property_reference_template =
32
+ " 0x%" PRIx64 " : %s.%s=0x%" PRIx64 " \n " ;
33
+ const char * const FindReferencesCmd::ObjectScanner::array_reference_template =
34
+ " 0x%" PRIx64 " : %s[%" PRId64 " ]=0x%" PRIx64 " \n " ;
35
+
36
+
37
+ const char * const
38
+ FindReferencesCmd::StringScanner::property_reference_template =
39
+ " 0x%" PRIx64 " : %s.%s=0x%" PRIx64 " '%s'\n " ;
40
+ const char * const FindReferencesCmd::StringScanner::array_reference_template =
41
+ " 0x%" PRIx64 " : %s[%" PRId64 " ]=0x%" PRIx64 " '%s'\n " ;
42
+
30
43
bool FindObjectsCmd::DoExecute (SBDebugger d, char ** cmd,
31
44
SBCommandReturnObject& result) {
32
45
SBTarget target = d.GetSelectedTarget ();
@@ -611,8 +624,8 @@ void FindReferencesCmd::ReferenceScanner::PrintRefs(
611
624
if (v.raw () != search_value_.raw ()) continue ;
612
625
613
626
std::string type_name = js_obj.GetTypeName (err);
614
- result.Printf (" 0x% " PRIx64 " : %s[% " PRId64 " ]=0x% " PRIx64 " \n " ,
615
- js_obj. raw (), type_name. c_str (), i, search_value_.raw ());
627
+ result.Printf (array_reference_template, js_obj. raw (), type_name. c_str (), i ,
628
+ search_value_.raw ());
616
629
}
617
630
618
631
// Walk all the properties in this object.
@@ -627,7 +640,7 @@ void FindReferencesCmd::ReferenceScanner::PrintRefs(
627
640
if (v.raw () == search_value_.raw ()) {
628
641
std::string key = entry.first .ToString (err);
629
642
std::string type_name = js_obj.GetTypeName (err);
630
- result.Printf (" 0x% " PRIx64 " : %s.%s=0x% " PRIx64 " \n " , js_obj.raw (),
643
+ result.Printf (property_reference_template , js_obj.raw (),
631
644
type_name.c_str (), key.c_str (), search_value_.raw ());
632
645
}
633
646
}
@@ -642,38 +655,37 @@ void FindReferencesCmd::ReferenceScanner::PrintRefs(
642
655
643
656
// Concatenated and sliced strings refer to other strings so
644
657
// we need to check their references.
645
-
646
658
if (repr == v8->string ()->kSlicedStringTag ) {
647
659
v8::SlicedString sliced_str (str);
648
660
v8::String parent = sliced_str.Parent (err);
649
661
if (err.Success () && parent.raw () == search_value_.raw ()) {
650
662
std::string type_name = sliced_str.GetTypeName (err);
651
- result.Printf (" 0x% " PRIx64 " : %s.%s=0x% " PRIx64 " \n " , str.raw (),
652
- type_name. c_str (), " <Parent>" , search_value_.raw ());
663
+ result.Printf (property_reference_template , str.raw (), type_name. c_str (),
664
+ " <Parent>" , search_value_.raw ());
653
665
}
654
666
} else if (repr == v8->string ()->kConsStringTag ) {
655
667
v8::ConsString cons_str (str);
656
668
657
669
v8::String first = cons_str.First (err);
658
670
if (err.Success () && first.raw () == search_value_.raw ()) {
659
671
std::string type_name = cons_str.GetTypeName (err);
660
- result.Printf (" 0x% " PRIx64 " : %s.%s=0x% " PRIx64 " \n " , str.raw (),
661
- type_name. c_str (), " <First>" , search_value_.raw ());
672
+ result.Printf (property_reference_template , str.raw (), type_name. c_str (),
673
+ " <First>" , search_value_.raw ());
662
674
}
663
675
664
676
v8::String second = cons_str.Second (err);
665
677
if (err.Success () && second.raw () == search_value_.raw ()) {
666
678
std::string type_name = cons_str.GetTypeName (err);
667
- result.Printf (" 0x% " PRIx64 " : %s.%s=0x% " PRIx64 " \n " , str.raw (),
668
- type_name. c_str (), " <Second>" , search_value_.raw ());
679
+ result.Printf (property_reference_template , str.raw (), type_name. c_str (),
680
+ " <Second>" , search_value_.raw ());
669
681
}
670
682
} else if (repr == v8->string ()->kThinStringTag ) {
671
683
v8::ThinString thin_str (str);
672
684
v8::String actual = thin_str.Actual (err);
673
685
if (err.Success () && actual.raw () == search_value_.raw ()) {
674
686
std::string type_name = thin_str.GetTypeName (err);
675
- result.Printf (" 0x% " PRIx64 " : %s.%s=0x% " PRIx64 " \n " , str.raw (),
676
- type_name. c_str (), " <Actual>" , search_value_.raw ());
687
+ result.Printf (property_reference_template , str.raw (), type_name. c_str (),
688
+ " <Actual>" , search_value_.raw ());
677
689
}
678
690
}
679
691
// Nothing to do for other kinds of string.
@@ -794,7 +806,7 @@ void FindReferencesCmd::PropertyScanner::PrintRefs(
794
806
}
795
807
if (key == search_value_) {
796
808
std::string type_name = js_obj.GetTypeName (err);
797
- result.Printf (" 0x% " PRIx64 " : %s.%s=0x% " PRIx64 " \n " , js_obj.raw (),
809
+ result.Printf (property_reference_template , js_obj.raw (),
798
810
type_name.c_str (), key.c_str (), entry.second .raw ());
799
811
}
800
812
}
@@ -1280,8 +1292,7 @@ bool LLScan::ScanHeapForObjects(lldb::SBTarget target,
1280
1292
return true ;
1281
1293
}
1282
1294
1283
- std::string
1284
- FindJSObjectsVisitor::MapCacheEntry::GetTypeNameWithProperties (
1295
+ std::string FindJSObjectsVisitor::MapCacheEntry::GetTypeNameWithProperties (
1285
1296
ShowArrayLength show_array_length, size_t max_properties) {
1286
1297
std::string type_name_with_properties (type_name);
1287
1298
@@ -1306,8 +1317,7 @@ FindJSObjectsVisitor::MapCacheEntry::GetTypeNameWithProperties(
1306
1317
1307
1318
bool FindJSObjectsVisitor::MapCacheEntry::Load (v8::Map map,
1308
1319
v8::HeapObject heap_object,
1309
- v8::LLV8* llv8,
1310
- v8::Error& err) {
1320
+ v8::LLV8* llv8, v8::Error& err) {
1311
1321
// Check type first
1312
1322
is_histogram = FindJSObjectsVisitor::IsAHistogramType (map, err);
1313
1323
0 commit comments