mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:58:11 +00:00
LibDebug: Add remove_breakpoint
Also, change the interface of all breakpoint management functions to only take the address of the breakpoint as an argument.
This commit is contained in:
parent
e00b85b8c0
commit
009b4ea3f4
4 changed files with 59 additions and 18 deletions
|
@ -39,6 +39,7 @@ public:
|
|||
struct SourcePosition {
|
||||
String file_path;
|
||||
size_t line_number { 0 };
|
||||
u32 address_of_first_statement { 0 };
|
||||
|
||||
bool operator==(const SourcePosition& other) const { return file_path == other.file_path && line_number == other.line_number; }
|
||||
bool operator!=(const SourcePosition& other) const { return !(*this == other); }
|
||||
|
@ -47,6 +48,20 @@ public:
|
|||
Optional<SourcePosition> get_source_position(u32 address) const;
|
||||
Optional<u32> get_instruction_from_source(const String& file, size_t line) const;
|
||||
|
||||
template<typename Callback>
|
||||
void for_each_source_position(Callback callback) const
|
||||
{
|
||||
String 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)
|
||||
continue;
|
||||
previous_file = line_info.file;
|
||||
previous_line = line_info.line;
|
||||
callback({ line_info.file, line_info.line, line_info.address });
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void prepare_lines();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue