summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2020-08-15 10:58:16 +0300
committerAndreas Kling <kling@serenityos.org>2020-08-15 15:06:35 +0200
commit7eac9fe10e6917aaa24b6ca8f332f275aab74206 (patch)
treeb08665567542415b931b4e4ae3bb37e38691f3c6 /Libraries
parent310063fed8a005b74dd2472ce812158fbb34d879 (diff)
downloadserenity-7eac9fe10e6917aaa24b6ca8f332f275aab74206.zip
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.
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibDebug/DebugInfo.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Libraries/LibDebug/DebugInfo.cpp b/Libraries/LibDebug/DebugInfo.cpp
index 16ee6131e4..6d66ddae0f 100644
--- a/Libraries/LibDebug/DebugInfo.cpp
+++ b/Libraries/LibDebug/DebugInfo.cpp
@@ -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 {};