mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-08 10:01:53 +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
|
@ -10,9 +10,9 @@
|
|||
|
||||
namespace HackStudio {
|
||||
|
||||
NonnullRefPtr<BacktraceModel> BacktraceModel::create(const Debug::DebugSession& debug_session, const PtraceRegisters& regs)
|
||||
NonnullRefPtr<BacktraceModel> BacktraceModel::create(Debug::ProcessInspector const& inspector, const PtraceRegisters& regs)
|
||||
{
|
||||
return adopt_ref(*new BacktraceModel(create_backtrace(debug_session, regs)));
|
||||
return adopt_ref(*new BacktraceModel(create_backtrace(inspector, regs)));
|
||||
}
|
||||
|
||||
GUI::Variant BacktraceModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
|
||||
|
@ -31,13 +31,13 @@ GUI::ModelIndex BacktraceModel::index(int row, int column, const GUI::ModelIndex
|
|||
return create_index(row, column, &m_frames.at(row));
|
||||
}
|
||||
|
||||
Vector<BacktraceModel::FrameInfo> BacktraceModel::create_backtrace(const Debug::DebugSession& debug_session, const PtraceRegisters& regs)
|
||||
Vector<BacktraceModel::FrameInfo> BacktraceModel::create_backtrace(Debug::ProcessInspector const& inspector, PtraceRegisters const& regs)
|
||||
{
|
||||
FlatPtr current_ebp = regs.bp();
|
||||
FlatPtr current_instruction = regs.ip();
|
||||
Vector<BacktraceModel::FrameInfo> frames;
|
||||
do {
|
||||
auto lib = debug_session.library_at(regs.ip());
|
||||
auto lib = inspector.library_at(regs.ip());
|
||||
if (!lib)
|
||||
continue;
|
||||
String name = lib->debug_info->name_of_containing_function(current_instruction - lib->base_address);
|
||||
|
@ -47,7 +47,7 @@ Vector<BacktraceModel::FrameInfo> BacktraceModel::create_backtrace(const Debug::
|
|||
}
|
||||
|
||||
frames.append({ name, current_instruction, current_ebp });
|
||||
auto frame_info = Debug::StackFrameUtils::get_info(*Debugger::the().session(), current_ebp);
|
||||
auto frame_info = Debug::StackFrameUtils::get_info(inspector, current_ebp);
|
||||
VERIFY(frame_info.has_value());
|
||||
current_instruction = frame_info.value().return_address;
|
||||
current_ebp = frame_info.value().next_ebp;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue