WIP
This commit is contained in:
@@ -1510,9 +1510,21 @@ void LLDBBackend::remove_data_node(size_t id)
|
||||
exit(1);
|
||||
}
|
||||
_data_nodes.erase(it);
|
||||
_dag_linear_valid = false;
|
||||
|
||||
auto res_it = _data_src_id_to_res_idx.find(id);
|
||||
if (res_it == _data_src_id_to_res_idx.end())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!_data_res[res_it->second]
|
||||
|| _data_res[res_it->second]->no_delete_on_src_delete)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<uint16_t> to_delete{};
|
||||
to_delete.push_back(id);
|
||||
to_delete.push_back(res_it->second);
|
||||
size_t old_size = 0;
|
||||
while (to_delete.size() != old_size)
|
||||
{
|
||||
@@ -1539,8 +1551,6 @@ void LLDBBackend::remove_data_node(size_t id)
|
||||
this->send_remove_data_node(idx);
|
||||
_data_res[idx] = {};
|
||||
}
|
||||
|
||||
_dag_linear_valid = false;
|
||||
}
|
||||
|
||||
void LLDBBackend::check_data_changes()
|
||||
@@ -1571,6 +1581,19 @@ void LLDBBackend::check_data_changes()
|
||||
auto res_vec = std::vector<data::result::Node>{};
|
||||
auto src_id_mapping = this->calc_data_res(*node_it, res_vec);
|
||||
|
||||
if (src_id_mapping)
|
||||
{
|
||||
auto it = _data_src_id_to_res_idx.find(src_id_mapping->second);
|
||||
if (it != _data_src_id_to_res_idx.end())
|
||||
{
|
||||
it->second = src_id_mapping->first;
|
||||
} else
|
||||
{
|
||||
_data_src_id_to_res_idx.emplace(src_id_mapping->second,
|
||||
src_id_mapping->first);
|
||||
}
|
||||
}
|
||||
|
||||
if (!res_vec.empty())
|
||||
{
|
||||
// TODO: queue and send at once to prevent UI lag?
|
||||
@@ -1733,6 +1756,54 @@ std::optional<std::pair<uint16_t, size_t>>
|
||||
.data = pc,
|
||||
});
|
||||
}
|
||||
case variable:
|
||||
{
|
||||
uint16_t cache_idx = 0;
|
||||
if (auto found_idx = find_node_for_src_id(node.id); found_idx)
|
||||
{
|
||||
cache_idx = *found_idx;
|
||||
} else
|
||||
{
|
||||
cache_idx = get_free_res_slot();
|
||||
// TODO: this will probably fail if cache_idx == 0
|
||||
_data_res[cache_idx] = CachedDataRes{.src_id = node.id};
|
||||
}
|
||||
|
||||
// TODO
|
||||
const auto &info =
|
||||
std::get<data::source::Source::Variable>(src_data.data);
|
||||
auto res_node = data::result::Node{
|
||||
.idx = cache_idx,
|
||||
.type_id = data::type_info::TypeID::none(),
|
||||
.success = false,
|
||||
};
|
||||
|
||||
auto thread = _process->GetSelectedThread();
|
||||
auto frame = thread.GetSelectedFrame();
|
||||
if (!frame.IsValid())
|
||||
{
|
||||
return check_single_res_changed(std::move(res_node));
|
||||
}
|
||||
|
||||
auto var = frame.GetValueForVariablePath(info.expr_path.c_str(),
|
||||
lldb::eDynamicDontRunTarget);
|
||||
if (!var.IsValid() || !var.IsInScope())
|
||||
{
|
||||
return check_single_res_changed(std::move(res_node));
|
||||
}
|
||||
|
||||
auto res_idx = this->build_nodes_for_var(var, data_res);
|
||||
if (!res_idx)
|
||||
{
|
||||
return check_single_res_changed(std::move(res_node));
|
||||
}
|
||||
|
||||
printf("Got res for %s: %u (%u)\n", info.expr_path.c_str(), *res_idx,
|
||||
_data_res[*res_idx]->node.type_id.type);
|
||||
res_node.success = true;
|
||||
res_node.children.push_back(*res_idx);
|
||||
return check_single_res_changed(std::move(res_node));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user