summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-11-16 09:06:31 +0100
committerAndreas Kling <kling@serenityos.org>2020-11-16 09:10:49 +0100
commit395313039d8754192807a8c8980f823ef0edc109 (patch)
treefd239ecff6da73b5f8736f9eb4dd19ae29aa1fec
parent4eb3cf68b7bdb80df2934e9d9af49fc36060c69c (diff)
downloadserenity-395313039d8754192807a8c8980f823ef0edc109.zip
LibDebug: Use FlyString for file paths
The same file path occurs over and over in debug info, so let's store them as FlyString to ensure we only have one of each in memory.
-rw-r--r--Libraries/LibDebug/DebugInfo.h4
-rw-r--r--Libraries/LibDebug/Dwarf/LineProgram.h6
2 files changed, 5 insertions, 5 deletions
diff --git a/Libraries/LibDebug/DebugInfo.h b/Libraries/LibDebug/DebugInfo.h
index 3a02fa8003..cb4fe30b8a 100644
--- a/Libraries/LibDebug/DebugInfo.h
+++ b/Libraries/LibDebug/DebugInfo.h
@@ -43,7 +43,7 @@ public:
explicit DebugInfo(NonnullRefPtr<const ELF::Loader> elf);
struct SourcePosition {
- String file_path;
+ FlyString file_path;
size_t line_number { 0 };
u32 address_of_first_statement { 0 };
@@ -96,7 +96,7 @@ public:
template<typename Callback>
void for_each_source_position(Callback callback) const
{
- String previous_file = "";
+ FlyString previous_file = "";
size_t previous_line = 0;
for (const auto& line_info : m_sorted_lines) {
if (line_info.file == previous_file && line_info.line == previous_line)
diff --git a/Libraries/LibDebug/Dwarf/LineProgram.h b/Libraries/LibDebug/Dwarf/LineProgram.h
index 3272125ece..fad62f2078 100644
--- a/Libraries/LibDebug/Dwarf/LineProgram.h
+++ b/Libraries/LibDebug/Dwarf/LineProgram.h
@@ -26,8 +26,8 @@
#pragma once
+#include <AK/FlyString.h>
#include <AK/MemoryStream.h>
-#include <AK/String.h>
#include <AK/Vector.h>
namespace Debug::Dwarf {
@@ -38,7 +38,7 @@ public:
struct LineInfo {
u32 address { 0 };
- String file;
+ FlyString file;
size_t line { 0 };
};
@@ -93,7 +93,7 @@ private:
};
struct FileEntry {
- String name;
+ FlyString name;
size_t directory_index { 0 };
};