@@ -777,6 +777,7 @@ class TaskSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
777
777
}
778
778
779
779
constexpr static StringLiteral TaskChildren[] = {
780
+ " address" ,
780
781
" id" ,
781
782
" kind" ,
782
783
" enqueuPriority" ,
@@ -822,29 +823,44 @@ class TaskSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
822
823
823
824
switch (idx) {
824
825
case 0 :
825
- RETURN_CHILD (m_id_sp, id, uint64_type);
826
+ if (!m_address_sp) {
827
+ // TypeMangling for "Swift.UnsafeRawPointer"
828
+ CompilerType raw_pointer_type =
829
+ m_ts->GetTypeFromMangledTypename (ConstString (" $sSVD" ));
830
+
831
+ addr_t value = m_task_ptr;
832
+ DataExtractor data{reinterpret_cast <const void *>(&value),
833
+ sizeof (value), endian::InlHostByteOrder (),
834
+ sizeof (void *)};
835
+ m_address_sp = ValueObject::CreateValueObjectFromData (
836
+ " address" , data, m_backend.GetExecutionContextRef (),
837
+ raw_pointer_type);
838
+ }
839
+ return m_address_sp;
826
840
case 1 :
827
- RETURN_CHILD (m_kind_sp, kind, uint32_type );
841
+ RETURN_CHILD (m_id_sp, id, uint64_type );
828
842
case 2 :
829
- RETURN_CHILD (m_enqueue_priority_sp, enqueuePriority , uint32_type);
843
+ RETURN_CHILD (m_kind_sp, kind , uint32_type);
830
844
case 3 :
831
- RETURN_CHILD (m_is_child_task_sp, isChildTask, bool_type );
845
+ RETURN_CHILD (m_enqueue_priority_sp, enqueuePriority, uint32_type );
832
846
case 4 :
833
- RETURN_CHILD (m_is_future_sp, isFuture , bool_type);
847
+ RETURN_CHILD (m_is_child_task_sp, isChildTask , bool_type);
834
848
case 5 :
835
- RETURN_CHILD (m_is_group_child_task_sp, isGroupChildTask , bool_type);
849
+ RETURN_CHILD (m_is_future_sp, isFuture , bool_type);
836
850
case 6 :
837
- RETURN_CHILD (m_is_async_let_task_sp, isAsyncLetTask , bool_type);
851
+ RETURN_CHILD (m_is_group_child_task_sp, isGroupChildTask , bool_type);
838
852
case 7 :
839
- RETURN_CHILD (m_is_cancelled_sp, isCancelled , bool_type);
853
+ RETURN_CHILD (m_is_async_let_task_sp, isAsyncLetTask , bool_type);
840
854
case 8 :
855
+ RETURN_CHILD (m_is_cancelled_sp, isCancelled, bool_type);
856
+ case 9 :
841
857
RETURN_CHILD (m_is_status_record_locked_sp, isStatusRecordLocked,
842
858
bool_type);
843
- case 9 :
844
- RETURN_CHILD (m_is_escalated_sp, isEscalated, bool_type);
845
859
case 10 :
860
+ RETURN_CHILD (m_is_escalated_sp, isEscalated, bool_type);
861
+ case 11 :
846
862
RETURN_CHILD (m_is_enqueued_sp, isEnqueued, bool_type);
847
- case 11 : {
863
+ case 12 : {
848
864
if (!m_child_tasks_sp) {
849
865
const auto &tasks = m_task_info.childTasks ;
850
866
std::string mangled_typename =
@@ -859,7 +875,7 @@ class TaskSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
859
875
}
860
876
return m_child_tasks_sp;
861
877
}
862
- case 12 :
878
+ case 13 :
863
879
RETURN_CHILD (m_is_running_sp, isRunning, bool_type);
864
880
default :
865
881
return {};
@@ -875,19 +891,19 @@ class TaskSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
875
891
ValueObjectSP task_obj_sp = m_backend.GetChildMemberWithName (" _task" );
876
892
if (!task_obj_sp)
877
893
return ChildCacheState::eRefetch;
878
- uint64_t task_ptr = task_obj_sp->GetValueAsUnsigned (LLDB_INVALID_ADDRESS);
879
- if (task_ptr != LLDB_INVALID_ADDRESS) {
894
+ m_task_ptr = task_obj_sp->GetValueAsUnsigned (LLDB_INVALID_ADDRESS);
895
+ if (m_task_ptr != LLDB_INVALID_ADDRESS) {
880
896
llvm::Expected<ReflectionContextInterface::AsyncTaskInfo> task_info =
881
- reflection_ctx->asyncTaskInfo (task_ptr );
897
+ reflection_ctx->asyncTaskInfo (m_task_ptr );
882
898
if (auto err = task_info.takeError ()) {
883
899
LLDB_LOG_ERROR (
884
900
GetLog (LLDBLog::DataFormatters | LLDBLog::Types), std::move (err),
885
- " could not get info for async task {0:x}: {1}" , task_ptr );
901
+ " could not get info for async task {0:x}: {1}" , m_task_ptr );
886
902
} else {
887
903
m_task_info = *task_info;
888
904
for (auto child :
889
- {m_id_sp, m_kind_sp, m_enqueue_priority_sp, m_is_child_task_sp ,
890
- m_is_future_sp, m_is_group_child_task_sp,
905
+ {m_address_sp, m_id_sp, m_kind_sp, m_enqueue_priority_sp,
906
+ m_is_child_task_sp, m_is_future_sp, m_is_group_child_task_sp,
891
907
m_is_async_let_task_sp, m_is_cancelled_sp,
892
908
m_is_status_record_locked_sp, m_is_escalated_sp,
893
909
m_is_enqueued_sp, m_child_tasks_sp, m_is_running_sp})
@@ -939,7 +955,9 @@ class TaskSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
939
955
940
956
private:
941
957
TypeSystemSwiftTypeRef *m_ts = nullptr ;
958
+ addr_t m_task_ptr = LLDB_INVALID_ADDRESS;
942
959
ReflectionContextInterface::AsyncTaskInfo m_task_info;
960
+ ValueObjectSP m_address_sp;
943
961
ValueObjectSP m_id_sp;
944
962
ValueObjectSP m_kind_sp;
945
963
ValueObjectSP m_enqueue_priority_sp;
0 commit comments