(target: lldb.SBTarget)
| 105 | |
| 106 | |
| 107 | def get_bthreads_num(target: lldb.SBTarget): |
| 108 | root_agent = find_global_value( |
| 109 | target, "bthread::g_task_control._nbthreads._combiner._agents.root_") |
| 110 | global_res = find_global_value( |
| 111 | target, "bthread::g_task_control._nbthreads._combiner._global_result").GetValueAsSigned() |
| 112 | long_type = target.GetBasicType(lldb.eBasicTypeLong) |
| 113 | |
| 114 | last_node = root_agent |
| 115 | # agent_type: bvar::detail::AgentCombiner<long, long, bvar::detail::AddTo<long> >::Agent> |
| 116 | agent_type: lldb.SBType = last_node.GetType().GetTemplateArgumentType(0) |
| 117 | while True: |
| 118 | agent = last_node.Cast(agent_type) |
| 119 | if (last_node.GetLocation() != root_agent.GetLocation()): |
| 120 | val = get_child(agent, "element._value").Cast( |
| 121 | long_type).GetValueAsSigned() |
| 122 | global_res += val |
| 123 | if (get_child(agent, "next_").Dereference().GetLocation() == root_agent.GetLocation()): |
| 124 | return global_res |
| 125 | last_node = get_child(agent, "next_").Dereference() |
| 126 | |
| 127 | |
| 128 | def get_all_bthreads(target: lldb.SBTarget, total: int): |
no test coverage detected