@@ -951,50 +951,65 @@ class CommandObjectMultiwordObjC_TaggedPointer_Info
951
951
952
952
Process *process = m_exe_ctx.GetProcessPtr ();
953
953
ExecutionContext exe_ctx (process);
954
+
954
955
ObjCLanguageRuntime *objc_runtime = ObjCLanguageRuntime::Get (*process);
955
- if (objc_runtime) {
956
- ObjCLanguageRuntime::TaggedPointerVendor *tagged_ptr_vendor =
957
- objc_runtime->GetTaggedPointerVendor ();
958
- if (tagged_ptr_vendor) {
959
- for (size_t i = 0 ; i < command.GetArgumentCount (); i++) {
960
- const char *arg_str = command.GetArgumentAtIndex (i);
961
- if (!arg_str)
962
- continue ;
963
- Status error;
964
- lldb::addr_t arg_addr = OptionArgParser::ToAddress (
965
- &exe_ctx, arg_str, LLDB_INVALID_ADDRESS, &error);
966
- if (arg_addr == 0 || arg_addr == LLDB_INVALID_ADDRESS || error.Fail ())
967
- continue ;
968
- auto descriptor_sp = tagged_ptr_vendor->GetClassDescriptor (arg_addr);
969
- if (!descriptor_sp)
970
- continue ;
971
- uint64_t info_bits = 0 ;
972
- uint64_t value_bits = 0 ;
973
- uint64_t payload = 0 ;
974
- if (descriptor_sp->GetTaggedPointerInfo (&info_bits, &value_bits,
975
- &payload)) {
976
- result.GetOutputStream ().Printf (
977
- " 0x%" PRIx64 " is tagged.\n\t payload = 0x%" PRIx64
978
- " \n\t value = 0x%" PRIx64 " \n\t info bits = 0x%" PRIx64
979
- " \n\t class = %s\n " ,
980
- (uint64_t )arg_addr, payload, value_bits, info_bits,
981
- descriptor_sp->GetClassName ().AsCString (" <unknown>" ));
982
- } else {
983
- result.GetOutputStream ().Printf (" 0x%" PRIx64 " is not tagged.\n " ,
984
- (uint64_t )arg_addr);
985
- }
986
- }
987
- } else {
988
- result.AppendError (" current process has no tagged pointer support" );
956
+ if (!objc_runtime) {
957
+ result.AppendError (" current process has no Objective-C runtime loaded" );
958
+ result.SetStatus (lldb::eReturnStatusFailed);
959
+ return false ;
960
+ }
961
+
962
+ ObjCLanguageRuntime::TaggedPointerVendor *tagged_ptr_vendor =
963
+ objc_runtime->GetTaggedPointerVendor ();
964
+ if (!tagged_ptr_vendor) {
965
+ result.AppendError (" current process has no tagged pointer support" );
966
+ result.SetStatus (lldb::eReturnStatusFailed);
967
+ return false ;
968
+ }
969
+
970
+ for (size_t i = 0 ; i < command.GetArgumentCount (); i++) {
971
+ const char *arg_str = command.GetArgumentAtIndex (i);
972
+ if (!arg_str)
973
+ continue ;
974
+
975
+ Status error;
976
+ lldb::addr_t arg_addr = OptionArgParser::ToAddress (
977
+ &exe_ctx, arg_str, LLDB_INVALID_ADDRESS, &error);
978
+ if (arg_addr == 0 || arg_addr == LLDB_INVALID_ADDRESS || error.Fail ()) {
979
+ result.AppendErrorWithFormat (
980
+ " could not convert '%s' to a valid address\n " , arg_str);
989
981
result.SetStatus (lldb::eReturnStatusFailed);
990
982
return false ;
991
983
}
992
- result.SetStatus (lldb::eReturnStatusSuccessFinishResult);
993
- return true ;
984
+
985
+ auto descriptor_sp = tagged_ptr_vendor->GetClassDescriptor (arg_addr);
986
+ if (!descriptor_sp) {
987
+ result.AppendErrorWithFormat (
988
+ " could not get class descriptor for 0x%" PRIx64 " \n " ,
989
+ (uint64_t )arg_addr);
990
+ result.SetStatus (lldb::eReturnStatusFailed);
991
+ return false ;
992
+ }
993
+
994
+ uint64_t info_bits = 0 ;
995
+ uint64_t value_bits = 0 ;
996
+ uint64_t payload = 0 ;
997
+ if (descriptor_sp->GetTaggedPointerInfo (&info_bits, &value_bits,
998
+ &payload)) {
999
+ result.GetOutputStream ().Printf (
1000
+ " 0x%" PRIx64 " is tagged.\n\t payload = 0x%" PRIx64
1001
+ " \n\t value = 0x%" PRIx64 " \n\t info bits = 0x%" PRIx64
1002
+ " \n\t class = %s\n " ,
1003
+ (uint64_t )arg_addr, payload, value_bits, info_bits,
1004
+ descriptor_sp->GetClassName ().AsCString (" <unknown>" ));
1005
+ } else {
1006
+ result.GetOutputStream ().Printf (" 0x%" PRIx64 " is not tagged.\n " ,
1007
+ (uint64_t )arg_addr);
1008
+ }
994
1009
}
995
- result. AppendError ( " current process has no Objective-C runtime loaded " );
996
- result.SetStatus (lldb::eReturnStatusFailed );
997
- return false ;
1010
+
1011
+ result.SetStatus (lldb::eReturnStatusSuccessFinishResult );
1012
+ return true ;
998
1013
}
999
1014
};
1000
1015
0 commit comments