mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +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
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