1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 17:44:56 +09:00

LibDebug: Convert a bunch of dbg() to dbgln()

This commit is contained in:
Andreas Kling 2021-01-09 15:07:10 +01:00
parent 08190dd0ce
commit d56f4f635a
Notes: sideshowbarker 2024-07-19 00:00:15 +09:00
5 changed files with 22 additions and 23 deletions

View file

@ -64,13 +64,13 @@ void DebugInfo::parse_scopes_impl(const Dwarf::DIE& die)
if (child.get_attribute(Dwarf::Attribute::Inline).has_value()) { if (child.get_attribute(Dwarf::Attribute::Inline).has_value()) {
#ifdef DEBUG_SPAM #ifdef DEBUG_SPAM
dbg() << "DWARF inlined functions are not supported"; dbgln("DWARF inlined functions are not supported");
#endif #endif
return; return;
} }
if (child.get_attribute(Dwarf::Attribute::Ranges).has_value()) { if (child.get_attribute(Dwarf::Attribute::Ranges).has_value()) {
#ifdef DEBUG_SPAM #ifdef DEBUG_SPAM
dbg() << "DWARF ranges are not supported"; dbgln("DWARF ranges are not supported");
#endif #endif
return; return;
} }
@ -83,7 +83,7 @@ void DebugInfo::parse_scopes_impl(const Dwarf::DIE& die)
if (!child.get_attribute(Dwarf::Attribute::LowPc).has_value()) { if (!child.get_attribute(Dwarf::Attribute::LowPc).has_value()) {
#ifdef DEBUG_SPAM #ifdef DEBUG_SPAM
dbg() << "DWARF: Couldn't find attribute LowPc for scope"; dbgln("DWARF: Couldn't find attribute LowPc for scope");
#endif #endif
return; return;
} }
@ -215,7 +215,7 @@ static Optional<Dwarf::DIE> parse_variable_type_die(const Dwarf::DIE& variable_d
if (type_name.has_value()) { if (type_name.has_value()) {
variable_info.type_name = type_name.value().data.as_string; variable_info.type_name = type_name.value().data.as_string;
} else { } else {
dbg() << "Unnamed DWARF type at offset: " << type_die.offset(); dbgln("Unnamed DWARF type at offset: {}", type_die.offset());
variable_info.name = "[Unnamed Type]"; variable_info.name = "[Unnamed Type]";
} }

View file

@ -90,7 +90,7 @@ public:
void dump_breakpoints() void dump_breakpoints()
{ {
for (auto addr : m_breakpoints.keys()) { for (auto addr : m_breakpoints.keys()) {
dbg() << addr; dbgln("{}", addr);
} }
} }

View file

@ -180,7 +180,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form,
break; break;
} }
default: default:
dbg() << "Unimplemented AttributeDataForm: " << (u32)form; dbgln("Unimplemented AttributeDataForm: {}", (u32)form);
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
return value; return value;

View file

@ -53,8 +53,8 @@ Value evaluate(ReadonlyBytes bytes, const PtraceRegisters& regs)
} }
default: default:
dbg() << "DWARF expr addr: " << (const void*)bytes.data(); dbgln("DWARF expr addr: {}", (const void*)bytes.data());
dbg() << "unsupported opcode: " << (u8)opcode; dbgln("unsupported opcode: {}", (u8)opcode);
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
} }

View file

@ -50,7 +50,7 @@ void LineProgram::parse_unit_header()
ASSERT(m_unit_header.opcode_base == SPECIAL_OPCODES_BASE); ASSERT(m_unit_header.opcode_base == SPECIAL_OPCODES_BASE);
#ifdef DWARF_DEBUG #ifdef DWARF_DEBUG
dbg() << "unit length: " << m_unit_header.length; dbgln("unit length: {}", m_unit_header.length);
#endif #endif
} }
@ -62,7 +62,7 @@ void LineProgram::parse_source_directories()
String directory; String directory;
m_stream >> directory; m_stream >> directory;
#ifdef DWARF_DEBUG #ifdef DWARF_DEBUG
dbg() << "directory: " << directory; dbgln("directory: {}", directory);
#endif #endif
m_source_directories.append(move(directory)); m_source_directories.append(move(directory));
} }
@ -83,7 +83,7 @@ void LineProgram::parse_source_files()
m_stream.read_LEB128_unsigned(_unused); // skip modification time m_stream.read_LEB128_unsigned(_unused); // skip modification time
m_stream.read_LEB128_unsigned(_unused); // skip file size m_stream.read_LEB128_unsigned(_unused); // skip file size
#ifdef DWARF_DEBUG #ifdef DWARF_DEBUG
dbg() << "file: " << file_name << ", directory index: " << directory_index; dbgln("file: {}, directory index: {}", file_name, directory_index);
#endif #endif
m_source_files.append({ file_name, directory_index }); m_source_files.append({ file_name, directory_index });
} }
@ -94,7 +94,7 @@ void LineProgram::parse_source_files()
void LineProgram::append_to_line_info() void LineProgram::append_to_line_info()
{ {
#ifdef DWARF_DEBUG #ifdef DWARF_DEBUG
dbg() << "appending line info: " << (void*)m_address << ", " << m_source_files[m_file_index].name << ":" << m_line; dbgln("appending line info: {:p}, {}:{}", m_address, m_source_files[m_file_index].name, m_line);
#endif #endif
if (!m_is_statement) if (!m_is_statement)
return; return;
@ -135,20 +135,20 @@ void LineProgram::handle_extended_opcode()
ASSERT(length == sizeof(size_t) + 1); ASSERT(length == sizeof(size_t) + 1);
m_stream >> m_address; m_stream >> m_address;
#ifdef DWARF_DEBUG #ifdef DWARF_DEBUG
dbg() << "SetAddress: " << (void*)m_address; dbgln("SetAddress: {:p}", m_address);
#endif #endif
break; break;
} }
case ExtendedOpcodes::SetDiscriminator: { case ExtendedOpcodes::SetDiscriminator: {
#ifdef DWARF_DEBUG #ifdef DWARF_DEBUG
dbg() << "SetDiscriminator"; dbgln("SetDiscriminator");
#endif #endif
m_stream.discard_or_error(1); m_stream.discard_or_error(1);
break; break;
} }
default: default:
#ifdef DWARF_DEBUG #ifdef DWARF_DEBUG
dbg() << "offset: " << (void*)m_stream.offset(); dbgln("offset: {:p}", m_stream.offset());
#endif #endif
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
@ -165,7 +165,7 @@ void LineProgram::handle_standard_opcode(u8 opcode)
m_stream.read_LEB128_unsigned(operand); m_stream.read_LEB128_unsigned(operand);
size_t delta = operand * m_unit_header.min_instruction_length; size_t delta = operand * m_unit_header.min_instruction_length;
#ifdef DWARF_DEBUG #ifdef DWARF_DEBUG
dbg() << "AdvnacePC by: " << delta << " to: " << (void*)(m_address + delta); dbgln("AdvancePC by: {} to: {:p}", delta, m_address + delta);
#endif #endif
m_address += delta; m_address += delta;
break; break;
@ -174,7 +174,7 @@ void LineProgram::handle_standard_opcode(u8 opcode)
size_t new_file_index = 0; size_t new_file_index = 0;
m_stream.read_LEB128_unsigned(new_file_index); m_stream.read_LEB128_unsigned(new_file_index);
#ifdef DWARF_DEBUG #ifdef DWARF_DEBUG
dbg() << "SetFile: new file index: " << new_file_index; dbgln("SetFile: new file index: {}", new_file_index);
#endif #endif
m_file_index = new_file_index; m_file_index = new_file_index;
break; break;
@ -182,7 +182,7 @@ void LineProgram::handle_standard_opcode(u8 opcode)
case StandardOpcodes::SetColumn: { case StandardOpcodes::SetColumn: {
// not implemented // not implemented
#ifdef DWARF_DEBUG #ifdef DWARF_DEBUG
dbg() << "SetColumn"; dbgln("SetColumn");
#endif #endif
size_t new_column; size_t new_column;
m_stream.read_LEB128_unsigned(new_column); m_stream.read_LEB128_unsigned(new_column);
@ -192,17 +192,16 @@ void LineProgram::handle_standard_opcode(u8 opcode)
case StandardOpcodes::AdvanceLine: { case StandardOpcodes::AdvanceLine: {
ssize_t line_delta; ssize_t line_delta;
m_stream.read_LEB128_signed(line_delta); m_stream.read_LEB128_signed(line_delta);
// dbg() << "line_delta: " << line_delta;
ASSERT(line_delta >= 0 || m_line >= (size_t)(-line_delta)); ASSERT(line_delta >= 0 || m_line >= (size_t)(-line_delta));
m_line += line_delta; m_line += line_delta;
#ifdef DWARF_DEBUG #ifdef DWARF_DEBUG
dbg() << "AdvanceLine: " << m_line; dbgln("AdvanceLine: {}", m_line);
#endif #endif
break; break;
} }
case StandardOpcodes::NegateStatement: { case StandardOpcodes::NegateStatement: {
#ifdef DWARF_DEBUG #ifdef DWARF_DEBUG
dbg() << "NegateStatement"; dbgln("NegateStatement");
#endif #endif
m_is_statement = !m_is_statement; m_is_statement = !m_is_statement;
break; break;
@ -212,7 +211,7 @@ void LineProgram::handle_standard_opcode(u8 opcode)
ssize_t address_increment = (adjusted_opcode / m_unit_header.line_range) * m_unit_header.min_instruction_length; ssize_t address_increment = (adjusted_opcode / m_unit_header.line_range) * m_unit_header.min_instruction_length;
address_increment *= m_unit_header.min_instruction_length; address_increment *= m_unit_header.min_instruction_length;
#ifdef DWARF_DEBUG #ifdef DWARF_DEBUG
dbg() << "ConstAddPc: advance pc by: " << address_increment << " to: " << (m_address + address_increment); dbgln("ConstAddPc: advance pc by: {} to: {}", address_increment, (m_address + address_increment));
#endif #endif
m_address += address_increment; m_address += address_increment;
break; break;
@ -238,7 +237,7 @@ void LineProgram::handle_sepcial_opcode(u8 opcode)
m_line += line_increment; m_line += line_increment;
#ifdef DWARF_DEBUG #ifdef DWARF_DEBUG
dbg() << "Special adjusted_opcode: " << adjusted_opcode << ", delta_address: " << address_increment << ", delta_line: " << line_increment; dbgln("Special adjusted_opcode: {}, address_increment: {}, line_increment: {}", adjusted_opcode, address_increment, line_increment);
dbg() << "Address is now:" << (void*)m_address << ", and line is: " << m_source_files[m_file_index].name << ":" << m_line; dbg() << "Address is now:" << (void*)m_address << ", and line is: " << m_source_files[m_file_index].name << ":" << m_line;
#endif #endif