primitive locals

This commit is contained in:
T0b1
2023-06-17 01:12:11 +02:00
parent 9ab08de243
commit 679e38e711
13 changed files with 1778 additions and 78 deletions

View File

@@ -57,14 +57,38 @@ namespace dbgui::backend
};
data::result::Node node;
bool child_node;
uint16_t parent_node;
uint16_t parent_member_id;
// bool child_node;
bool no_delete_on_src_delete = false;
size_t src_id; // invalid = size_t::MAX
// std::variant<std::monostate, DisasmInfo> extra_info;
};
struct Local
{
lldb::SBValue lldb_val;
std::optional<uint16_t> cached_node;
};
struct VarCacheEntry
{
// for globals/statics compare location + expr path (bc unions)
// for others compare location + expr path + symctx (without line entry)
// TODO: this will repeatedly retrieve cyclic values
// probably bad so maybe detect this some other way mby without expr paths?
// but then we need to cache types somehow...
lldb::SBValue lldb_val;
lldb::SBSymbolContext sym_ctx;
std::string expr_path;
// NOTE: when used is set to true, this means that the var was
// diffed this step already and will no longer be so careful with changing this
bool used;
bool
global_or_static; // need to only compare compilation unit and module
std::optional<data::result::NodeIdx> cached_node;
};
// TODO: source_init_file: false
LLDBBackend(std::string filename);
virtual ~LLDBBackend();
@@ -102,7 +126,29 @@ namespace dbgui::backend
void check_thread_changes();
void check_frame_changes();
void check_data_changes();
std::optional<std::pair<uint16_t, size_t>>
// TODO: func to clear locals if they are no longer requested
// node_id, did_change
// std::pair<uint16_t, bool> build_locals();
data::type_info::TypeID build_type_from_lldb_type(lldb::SBType &);
bool is_type_equal(data::type_info::TypeID, lldb::SBType &);
std::optional<data::result::NodeIdx>
build_nodes_for_var(lldb::SBValue &val,
std::vector<data::result::Node> &to_send);
data::result::NodeIdx
build_nodes_for_var_uncached(lldb::SBValue &,
std::vector<data::result::Node> &to_send);
void build_nodes_for_var_cached(lldb::SBValue &,
data::result::NodeIdx cache_idx,
std::vector<data::result::Node> &to_send);
void clear_unused_vars_from_cache();
void delete_node_and_childs(uint16_t);
data::result::NodeIdx get_free_data_node();
std::optional<std::pair<data::result::NodeIdx, size_t>>
calc_data_res(const data::source::Node &,
std::vector<data::result::Node> &data_res);
@@ -129,8 +175,17 @@ namespace dbgui::backend
bool _dag_linear_valid = false;
// util::DAG _data_res_dag = {};
std::vector<std::optional<CachedDataRes>> _data_res = {};
std::vector<std::pair<lldb::SBValue, bool>> _locals = {};
std::optional<lldb::SBFrame> _last_frame = {};
std::vector<Local> _locals = {};
std::optional<data::result::NodeIdx> _locals_node = {};
std::optional<lldb::SBFrame> _last_frame = {};
std::vector<
std::optional<std::pair<lldb::SBType, data::type_info::TypeInfo>>>
_types = {};
std::vector<VarCacheEntry> _var_cache{};
// std::unordered_map<size_t, uint16_t> _src_id_to_data_idx = {};
// std::vector<data::DataResult> _cached_data_results = {};