mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:17:36 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -142,7 +142,7 @@ Optional<DebugInfo::SourcePositionAndAddress> DebugInfo::get_address_from_source
|
|||
}
|
||||
|
||||
Optional<SourcePositionAndAddress> result;
|
||||
for (const auto& line_entry : m_sorted_lines) {
|
||||
for (auto const& line_entry : m_sorted_lines) {
|
||||
if (!line_entry.file.ends_with(file_path))
|
||||
continue;
|
||||
|
||||
|
@ -159,12 +159,12 @@ Optional<DebugInfo::SourcePositionAndAddress> DebugInfo::get_address_from_source
|
|||
return result;
|
||||
}
|
||||
|
||||
NonnullOwnPtrVector<DebugInfo::VariableInfo> DebugInfo::get_variables_in_current_scope(const PtraceRegisters& regs) const
|
||||
NonnullOwnPtrVector<DebugInfo::VariableInfo> DebugInfo::get_variables_in_current_scope(PtraceRegisters const& regs) const
|
||||
{
|
||||
NonnullOwnPtrVector<DebugInfo::VariableInfo> variables;
|
||||
|
||||
// TODO: We can store the scopes in a better data structure
|
||||
for (const auto& scope : m_scopes) {
|
||||
for (auto const& scope : m_scopes) {
|
||||
FlatPtr ip;
|
||||
#if ARCH(I386)
|
||||
ip = regs.eip;
|
||||
|
@ -174,7 +174,7 @@ NonnullOwnPtrVector<DebugInfo::VariableInfo> DebugInfo::get_variables_in_current
|
|||
if (ip - m_base_address < scope.address_low || ip - m_base_address >= scope.address_high)
|
||||
continue;
|
||||
|
||||
for (const auto& die_entry : scope.dies_of_variables) {
|
||||
for (auto const& die_entry : scope.dies_of_variables) {
|
||||
auto variable_info = create_variable_info(die_entry, regs);
|
||||
if (!variable_info)
|
||||
continue;
|
||||
|
@ -357,7 +357,7 @@ String DebugInfo::name_of_containing_function(FlatPtr address) const
|
|||
|
||||
Optional<DebugInfo::VariablesScope> DebugInfo::get_containing_function(FlatPtr address) const
|
||||
{
|
||||
for (const auto& scope : m_scopes) {
|
||||
for (auto const& scope : m_scopes) {
|
||||
if (!scope.is_function || address < scope.address_low || address >= scope.address_high)
|
||||
continue;
|
||||
return scope;
|
||||
|
@ -368,7 +368,7 @@ Optional<DebugInfo::VariablesScope> DebugInfo::get_containing_function(FlatPtr a
|
|||
Vector<DebugInfo::SourcePosition> DebugInfo::source_lines_in_scope(VariablesScope const& scope) const
|
||||
{
|
||||
Vector<DebugInfo::SourcePosition> source_lines;
|
||||
for (const auto& line : m_sorted_lines) {
|
||||
for (auto const& line : m_sorted_lines) {
|
||||
if (line.address < scope.address_low)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
union {
|
||||
u32 as_u32;
|
||||
u32 as_i32;
|
||||
const char* as_string;
|
||||
char const* as_string;
|
||||
} constant_data { 0 };
|
||||
|
||||
Dwarf::EntryTag type_tag;
|
||||
|
@ -107,22 +107,22 @@ public:
|
|||
FlatPtr address;
|
||||
};
|
||||
|
||||
Optional<SourcePositionAndAddress> get_address_from_source_position(const String& file, size_t line) const;
|
||||
Optional<SourcePositionAndAddress> get_address_from_source_position(String const& file, size_t line) const;
|
||||
|
||||
String name_of_containing_function(FlatPtr address) const;
|
||||
Vector<SourcePosition> source_lines_in_scope(const VariablesScope&) const;
|
||||
Vector<SourcePosition> source_lines_in_scope(VariablesScope const&) const;
|
||||
Optional<VariablesScope> get_containing_function(FlatPtr address) const;
|
||||
|
||||
private:
|
||||
void prepare_variable_scopes();
|
||||
void prepare_lines();
|
||||
void parse_scopes_impl(const Dwarf::DIE& die);
|
||||
OwnPtr<VariableInfo> create_variable_info(const Dwarf::DIE& variable_die, const PtraceRegisters&, u32 address_offset = 0) const;
|
||||
static bool is_variable_tag_supported(const Dwarf::EntryTag& tag);
|
||||
void add_type_info_to_variable(const Dwarf::DIE& type_die, const PtraceRegisters& regs, DebugInfo::VariableInfo* parent_variable) const;
|
||||
void parse_scopes_impl(Dwarf::DIE const& die);
|
||||
OwnPtr<VariableInfo> create_variable_info(Dwarf::DIE const& variable_die, PtraceRegisters const&, u32 address_offset = 0) const;
|
||||
static bool is_variable_tag_supported(Dwarf::EntryTag const& tag);
|
||||
void add_type_info_to_variable(Dwarf::DIE const& type_die, PtraceRegisters const& regs, DebugInfo::VariableInfo* parent_variable) const;
|
||||
|
||||
Optional<Dwarf::LineProgram::DirectoryAndFile> get_source_path_of_inline(const Dwarf::DIE&) const;
|
||||
Optional<uint32_t> get_line_of_inline(const Dwarf::DIE&) const;
|
||||
Optional<Dwarf::LineProgram::DirectoryAndFile> get_source_path_of_inline(Dwarf::DIE const&) const;
|
||||
Optional<uint32_t> get_line_of_inline(Dwarf::DIE const&) const;
|
||||
|
||||
ELF::Image const& m_elf;
|
||||
String m_source_root;
|
||||
|
|
|
@ -29,12 +29,12 @@ DebugSession::~DebugSession()
|
|||
if (m_is_debuggee_dead)
|
||||
return;
|
||||
|
||||
for (const auto& bp : m_breakpoints) {
|
||||
for (auto const& bp : m_breakpoints) {
|
||||
disable_breakpoint(bp.key);
|
||||
}
|
||||
m_breakpoints.clear();
|
||||
|
||||
for (const auto& wp : m_watchpoints) {
|
||||
for (auto const& wp : m_watchpoints) {
|
||||
disable_watchpoint(wp.key);
|
||||
}
|
||||
m_watchpoints.clear();
|
||||
|
@ -46,8 +46,8 @@ DebugSession::~DebugSession()
|
|||
|
||||
void DebugSession::for_each_loaded_library(Function<IterationDecision(LoadedLibrary const&)> func) const
|
||||
{
|
||||
for (const auto& lib_name : m_loaded_libraries.keys()) {
|
||||
const auto& lib = *m_loaded_libraries.get(lib_name).value();
|
||||
for (auto const& lib_name : m_loaded_libraries.keys()) {
|
||||
auto const& lib = *m_loaded_libraries.get(lib_name).value();
|
||||
if (func(lib) == IterationDecision::Break)
|
||||
break;
|
||||
}
|
||||
|
@ -80,11 +80,11 @@ OwnPtr<DebugSession> DebugSession::exec_and_attach(String const& command,
|
|||
|
||||
auto parts = command.split(' ');
|
||||
VERIFY(!parts.is_empty());
|
||||
const char** args = bit_cast<const char**>(calloc(parts.size() + 1, sizeof(const char*)));
|
||||
char const** args = bit_cast<char const**>(calloc(parts.size() + 1, sizeof(char const*)));
|
||||
for (size_t i = 0; i < parts.size(); i++) {
|
||||
args[i] = parts[i].characters();
|
||||
}
|
||||
const char** envp = bit_cast<const char**>(calloc(2, sizeof(const char*)));
|
||||
char const** envp = bit_cast<char const**>(calloc(2, sizeof(char const*)));
|
||||
// This causes loader to stop on a breakpoint before jumping to the entry point of the program.
|
||||
envp[0] = "_LOADER_BREAKPOINT=1";
|
||||
int rc = execvpe(args[0], const_cast<char**>(args), const_cast<char**>(envp));
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
FlatPtr as_addr() const;
|
||||
u64 as_unsigned() const { return m_data.as_unsigned; }
|
||||
i64 as_signed() const { return m_data.as_signed; }
|
||||
const char* as_string() const;
|
||||
char const* as_string() const;
|
||||
bool as_bool() const { return m_data.as_bool; }
|
||||
ReadonlyBytes as_raw_bytes() const { return m_data.as_raw_bytes; }
|
||||
|
||||
|
@ -46,7 +46,7 @@ private:
|
|||
FlatPtr as_addr;
|
||||
u64 as_unsigned;
|
||||
i64 as_signed;
|
||||
const char* as_string; // points to bytes in the memory mapped elf image
|
||||
char const* as_string; // points to bytes in the memory mapped elf image
|
||||
bool as_bool;
|
||||
ReadonlyBytes as_raw_bytes;
|
||||
} m_data {};
|
||||
|
|
|
@ -54,7 +54,7 @@ Optional<AttributeValue> DIE::get_attribute(Attribute const& attribute) const
|
|||
auto abbreviation_info = m_compilation_unit.abbreviations_map().get(m_abbreviation_code);
|
||||
VERIFY(abbreviation_info);
|
||||
|
||||
for (const auto& attribute_spec : abbreviation_info->attribute_specifications) {
|
||||
for (auto const& attribute_spec : abbreviation_info->attribute_specifications) {
|
||||
auto value = m_compilation_unit.dwarf_info().get_attribute_value(attribute_spec.form, attribute_spec.value, stream, &m_compilation_unit);
|
||||
if (attribute_spec.attribute == attribute) {
|
||||
return value;
|
||||
|
|
|
@ -77,7 +77,7 @@ void DwarfInfo::populate_compilation_units()
|
|||
}
|
||||
|
||||
AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form, ssize_t implicit_const_value,
|
||||
InputMemoryStream& debug_info_stream, const CompilationUnit* unit) const
|
||||
InputMemoryStream& debug_info_stream, CompilationUnit const* unit) const
|
||||
{
|
||||
AttributeValue value;
|
||||
value.m_form = form;
|
||||
|
@ -98,7 +98,7 @@ AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form, ssize_t im
|
|||
value.m_type = AttributeValue::Type::String;
|
||||
|
||||
auto strings_data = debug_strings_data();
|
||||
value.m_data.as_string = bit_cast<const char*>(strings_data.offset_pointer(offset));
|
||||
value.m_data.as_string = bit_cast<char const*>(strings_data.offset_pointer(offset));
|
||||
break;
|
||||
}
|
||||
case AttributeDataForm::Data1: {
|
||||
|
@ -199,7 +199,7 @@ AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form, ssize_t im
|
|||
debug_info_stream >> str;
|
||||
VERIFY(!debug_info_stream.has_any_error());
|
||||
value.m_type = AttributeValue::Type::String;
|
||||
value.m_data.as_string = bit_cast<const char*>(debug_info_data().offset_pointer(str_offset));
|
||||
value.m_data.as_string = bit_cast<char const*>(debug_info_data().offset_pointer(str_offset));
|
||||
break;
|
||||
}
|
||||
case AttributeDataForm::Block1: {
|
||||
|
@ -241,7 +241,7 @@ AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form, ssize_t im
|
|||
value.m_type = AttributeValue::Type::String;
|
||||
|
||||
auto strings_data = debug_line_strings_data();
|
||||
value.m_data.as_string = bit_cast<const char*>(strings_data.offset_pointer(offset));
|
||||
value.m_data.as_string = bit_cast<char const*>(strings_data.offset_pointer(offset));
|
||||
break;
|
||||
}
|
||||
case AttributeDataForm::ImplicitConst: {
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
void for_each_compilation_unit(Callback) const;
|
||||
|
||||
AttributeValue get_attribute_value(AttributeDataForm form, ssize_t implicit_const_value,
|
||||
InputMemoryStream& debug_info_stream, const CompilationUnit* unit = nullptr) const;
|
||||
InputMemoryStream& debug_info_stream, CompilationUnit const* unit = nullptr) const;
|
||||
|
||||
Optional<DIE> get_die_at_address(FlatPtr) const;
|
||||
|
||||
|
@ -89,7 +89,7 @@ private:
|
|||
template<typename Callback>
|
||||
void DwarfInfo::for_each_compilation_unit(Callback callback) const
|
||||
{
|
||||
for (const auto& unit : m_compilation_units) {
|
||||
for (auto const& unit : m_compilation_units) {
|
||||
callback(unit);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
namespace Debug {
|
||||
|
||||
const LoadedLibrary* ProcessInspector::library_at(FlatPtr address) const
|
||||
LoadedLibrary const* ProcessInspector::library_at(FlatPtr address) const
|
||||
{
|
||||
const LoadedLibrary* result = nullptr;
|
||||
for_each_loaded_library([&result, address](const auto& lib) {
|
||||
LoadedLibrary const* result = nullptr;
|
||||
for_each_loaded_library([&result, address](auto const& lib) {
|
||||
if (address >= lib.base_address && address < lib.base_address + lib.debug_info->elf().size()) {
|
||||
result = &lib;
|
||||
return IterationDecision::Break;
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
virtual void set_registers(PtraceRegisters const&) = 0;
|
||||
virtual void for_each_loaded_library(Function<IterationDecision(LoadedLibrary const&)>) const = 0;
|
||||
|
||||
const LoadedLibrary* library_at(FlatPtr address) const;
|
||||
LoadedLibrary const* library_at(FlatPtr address) const;
|
||||
struct SymbolicationResult {
|
||||
String library_name;
|
||||
String symbol;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue