mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 21:59:07 +00:00
HackStudio: Support debugging library code
We can now step into library code in the debugger. Since we now need the whole source code of our libraries (and not just the headers), we clone the whole serenity git repo into /usr/share/serenity.
This commit is contained in:
parent
310063fed8
commit
7eac9fe10e
Notes:
sideshowbarker
2024-07-19 03:37:03 +09:00
Author: https://github.com/itamar8910
Commit: 7eac9fe10e
Pull-request: https://github.com/SerenityOS/serenity/pull/3153
Issue: https://github.com/SerenityOS/serenity/issues/3152
Reviewed-by: https://github.com/awesomekling
4 changed files with 69 additions and 32 deletions
|
@ -146,8 +146,14 @@ Optional<DebugInfo::SourcePosition> DebugInfo::get_source_position(u32 target_ad
|
|||
|
||||
Optional<u32> DebugInfo::get_instruction_from_source(const String& file, size_t line) const
|
||||
{
|
||||
String file_path = file;
|
||||
constexpr char SERENITY_LIBS_PREFIX[] = "/usr/src/serenity";
|
||||
if (file.starts_with(SERENITY_LIBS_PREFIX)) {
|
||||
file_path = file.substring(sizeof(SERENITY_LIBS_PREFIX), file.length() - sizeof(SERENITY_LIBS_PREFIX));
|
||||
file_path = String::format("../%s", file_path.characters());
|
||||
}
|
||||
for (const auto& line_entry : m_sorted_lines) {
|
||||
if (line_entry.file == file && line_entry.line == line)
|
||||
if (line_entry.file == file_path && line_entry.line == line)
|
||||
return Optional<u32>(line_entry.address);
|
||||
}
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue