mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-14 23:22:52 +00:00
HackStudio: Use ProcessInspector instead of DebugSession where possible
This commit is contained in:
parent
7950f5cb51
commit
94d68583fb
Notes:
sideshowbarker
2024-07-18 00:57:23 +09:00
Author: https://github.com/itamar8910
Commit: 94d68583fb
Pull-request: https://github.com/SerenityOS/serenity/pull/10973
Reviewed-by: https://github.com/linusg ✅
8 changed files with 29 additions and 21 deletions
|
@ -12,9 +12,14 @@ namespace HackStudio {
|
|||
|
||||
GUI::ModelIndex VariablesModel::index(int row, int column, const GUI::ModelIndex& parent_index) const
|
||||
{
|
||||
if (!parent_index.is_valid())
|
||||
if (!parent_index.is_valid()) {
|
||||
if (static_cast<size_t>(row) >= m_variables.size())
|
||||
return {};
|
||||
return create_index(row, column, &m_variables[row]);
|
||||
}
|
||||
auto* parent = static_cast<const Debug::DebugInfo::VariableInfo*>(parent_index.internal_data());
|
||||
if (static_cast<size_t>(row) >= parent->members.size())
|
||||
return {};
|
||||
auto* child = &parent->members[row];
|
||||
return create_index(row, column, child);
|
||||
}
|
||||
|
@ -158,13 +163,13 @@ GUI::Variant VariablesModel::data(const GUI::ModelIndex& index, GUI::ModelRole r
|
|||
}
|
||||
}
|
||||
|
||||
RefPtr<VariablesModel> VariablesModel::create(const PtraceRegisters& regs)
|
||||
RefPtr<VariablesModel> VariablesModel::create(Debug::ProcessInspector& inspector, PtraceRegisters const& regs)
|
||||
{
|
||||
auto lib = Debugger::the().session()->library_at(regs.ip());
|
||||
auto lib = inspector.library_at(regs.ip());
|
||||
if (!lib)
|
||||
return nullptr;
|
||||
auto variables = lib->debug_info->get_variables_in_current_scope(regs);
|
||||
return adopt_ref(*new VariablesModel(move(variables), regs));
|
||||
return adopt_ref(*new VariablesModel(inspector, move(variables), regs));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue