mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
This commit is contained in:
parent
7235ddfd98
commit
019c9eb749
Notes:
sideshowbarker
2024-07-18 23:59:14 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/019c9eb749f Pull-request: https://github.com/SerenityOS/serenity/pull/4870
13 changed files with 41 additions and 28 deletions
|
@ -162,7 +162,7 @@ void DownloadWidget::did_progress(Optional<u32> total_size, u32 downloaded_size)
|
|||
|
||||
void DownloadWidget::did_finish(bool success)
|
||||
{
|
||||
dbg() << "did_finish, success=" << success;
|
||||
dbgln("did_finish, success={}", success);
|
||||
|
||||
m_close_button->set_enabled(true);
|
||||
m_cancel_button->set_text("Open in Folder");
|
||||
|
|
|
@ -260,7 +260,7 @@ void IRCAppWindow::setup_menus()
|
|||
auto menubar = GUI::MenuBar::construct();
|
||||
auto& app_menu = menubar->add_menu("IRC Client");
|
||||
app_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) {
|
||||
dbg() << "Terminal: Quit menu activated!";
|
||||
dbgln("Terminal: Quit menu activated!");
|
||||
GUI::Application::the()->quit();
|
||||
return;
|
||||
}));
|
||||
|
|
|
@ -308,15 +308,15 @@ Position Sheet::offset_relative_to(const Position& base, const Position& offset,
|
|||
auto base_column_it = m_columns.find(base.column);
|
||||
|
||||
if (offset_column_it.is_end()) {
|
||||
dbg() << "Column '" << offset.column << "' does not exist!";
|
||||
dbgln("Column '{}' does not exist!", offset.column);
|
||||
return base;
|
||||
}
|
||||
if (offset_base_column_it.is_end()) {
|
||||
dbg() << "Column '" << offset_base.column << "' does not exist!";
|
||||
dbgln("Column '{}' does not exist!", offset.column);
|
||||
return base;
|
||||
}
|
||||
if (base_column_it.is_end()) {
|
||||
dbg() << "Column '" << base.column << "' does not exist!";
|
||||
dbgln("Column '{}' does not exist!", offset.column);
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
@ -376,7 +376,7 @@ void Sheet::copy_cells(Vector<Position> from, Vector<Position> to, Optional<Posi
|
|||
}
|
||||
|
||||
// Just disallow misaligned copies.
|
||||
dbg() << "Cannot copy " << from.size() << " cells to " << to.size() << " cells";
|
||||
dbgln("Cannot copy {} cells to {} cells", from.size(), to.size());
|
||||
}
|
||||
|
||||
RefPtr<Sheet> Sheet::from_json(const JsonObject& object, Workbook& workbook)
|
||||
|
|
|
@ -208,7 +208,7 @@ int main(int argc, char* argv[])
|
|||
auto& sheet = spreadsheet_widget.current_worksheet();
|
||||
|
||||
for (auto& line : spreadsheet_data.value().split_view('\n')) {
|
||||
dbg() << "Paste line '" << line << "'";
|
||||
dbgln("Paste line '{}'", line);
|
||||
auto position = sheet.position_from_url(line);
|
||||
if (position.has_value())
|
||||
source_positions.append(position.release_value());
|
||||
|
|
|
@ -125,7 +125,7 @@ TextEditorWidget::TextEditorWidget()
|
|||
m_editor->document().update_regex_matches(needle);
|
||||
|
||||
auto found_range = m_editor->document().find_next(needle, m_editor->normalized_selection().end(), GUI::TextDocument::SearchShouldWrap::Yes, m_find_use_regex);
|
||||
dbg() << "find_next(\"" << needle << "\") returned " << found_range;
|
||||
dbgln("find_next('{}') returned {}", needle, found_range);
|
||||
if (found_range.is_valid()) {
|
||||
m_editor->set_selection(found_range);
|
||||
} else {
|
||||
|
|
|
@ -128,7 +128,7 @@ void RemoteProcess::set_property(FlatPtr object, const StringView& name, const J
|
|||
void RemoteProcess::update()
|
||||
{
|
||||
m_socket->on_connected = [this] {
|
||||
dbg() << "Connected to PID " << m_pid;
|
||||
dbgln("Connected to PID {}", m_pid);
|
||||
|
||||
{
|
||||
JsonObject request;
|
||||
|
|
|
@ -153,7 +153,7 @@ NEVER_INLINE static void dump_backtrace_impl(FlatPtr base_pointer, bool use_ksym
|
|||
FlatPtr* stack_ptr = (FlatPtr*)base_pointer;
|
||||
while (stack_ptr && safe_memcpy(copied_stack_ptr, stack_ptr, sizeof(copied_stack_ptr), fault_at)) {
|
||||
FlatPtr retaddr = copied_stack_ptr[1];
|
||||
dbg() << String::format("%x", retaddr) << " (next: " << String::format("%x", (stack_ptr ? (u32*)copied_stack_ptr[0] : 0)) << ")";
|
||||
dbgln("{:p} (next: {:p})", retaddr, stack_ptr ? (u32*)copied_stack_ptr[0] : 0);
|
||||
stack_ptr = (FlatPtr*)copied_stack_ptr[0];
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -168,15 +168,15 @@ Region* Process::allocate_region_with_vmobject(const Range& range, NonnullRefPtr
|
|||
ASSERT(range.is_valid());
|
||||
size_t end_in_vmobject = offset_in_vmobject + range.size();
|
||||
if (end_in_vmobject <= offset_in_vmobject) {
|
||||
dbg() << "allocate_region_with_vmobject: Overflow (offset + size)";
|
||||
dbgln("allocate_region_with_vmobject: Overflow (offset + size)");
|
||||
return nullptr;
|
||||
}
|
||||
if (offset_in_vmobject >= vmobject->size()) {
|
||||
dbg() << "allocate_region_with_vmobject: Attempt to allocate a region with an offset past the end of its VMObject.";
|
||||
dbgln("allocate_region_with_vmobject: Attempt to allocate a region with an offset past the end of its VMObject.");
|
||||
return nullptr;
|
||||
}
|
||||
if (end_in_vmobject > vmobject->size()) {
|
||||
dbg() << "allocate_region_with_vmobject: Attempt to allocate a region with an end past the end of its VMObject.";
|
||||
dbgln("allocate_region_with_vmobject: Attempt to allocate a region with an end past the end of its VMObject.");
|
||||
return nullptr;
|
||||
}
|
||||
offset_in_vmobject &= PAGE_MASK;
|
||||
|
@ -304,7 +304,7 @@ RefPtr<Process> Process::create_user_process(RefPtr<Thread>& first_thread, const
|
|||
|
||||
error = process->exec(path, move(arguments), move(environment));
|
||||
if (error != 0) {
|
||||
dbg() << "Failed to exec " << path << ": " << error;
|
||||
dbgln("Failed to exec {}: {}", path, error);
|
||||
first_thread = nullptr;
|
||||
return {};
|
||||
}
|
||||
|
@ -469,13 +469,13 @@ void Process::crash(int signal, u32 eip, bool out_of_memory)
|
|||
ASSERT(Process::current() == this);
|
||||
|
||||
if (out_of_memory) {
|
||||
dbg() << "\033[31;1mOut of memory\033[m, killing: " << *this;
|
||||
dbgln("\033[31;1mOut of memory\033[m, killing: {}", *this);
|
||||
} else {
|
||||
if (eip >= 0xc0000000 && g_kernel_symbols_available) {
|
||||
auto* symbol = symbolicate_kernel_address(eip);
|
||||
dbg() << "\033[31;1m" << String::format("%p", eip) << " " << (symbol ? demangle(symbol->name) : "(k?)") << " +" << (symbol ? eip - symbol->address : 0) << "\033[0m\n";
|
||||
dbgln("\033[31;1m{:p} {} +{}\033[0m\n", eip, (symbol ? demangle(symbol->name) : "(k?)"), (symbol ? eip - symbol->address : 0));
|
||||
} else {
|
||||
dbg() << "\033[31;1m" << String::format("%p", eip) << " (?)\033[0m\n";
|
||||
dbgln("\033[31;1m{:p} (?)\033[0m\n", eip);
|
||||
}
|
||||
dump_backtrace();
|
||||
}
|
||||
|
@ -797,7 +797,7 @@ void Process::terminate_due_to_signal(u8 signal)
|
|||
ASSERT_INTERRUPTS_DISABLED();
|
||||
ASSERT(signal < 32);
|
||||
ASSERT(Process::current() == this);
|
||||
dbg() << "Terminating " << *this << " due to signal " << signal;
|
||||
dbgln("Terminating {} due to signal {}", *this, signal);
|
||||
m_termination_status = 0;
|
||||
m_termination_signal = signal;
|
||||
die();
|
||||
|
|
|
@ -761,7 +761,7 @@ inline u32 Thread::effective_priority() const
|
|||
#define REQUIRE_NO_PROMISES \
|
||||
do { \
|
||||
if (Process::current()->has_promises()) { \
|
||||
dbg() << "Has made a promise"; \
|
||||
dbgln("Has made a promise"); \
|
||||
cli(); \
|
||||
Process::current()->crash(SIGABRT, 0); \
|
||||
ASSERT_NOT_REACHED(); \
|
||||
|
@ -772,7 +772,7 @@ inline u32 Thread::effective_priority() const
|
|||
do { \
|
||||
if (Process::current()->has_promises() \
|
||||
&& !Process::current()->has_promised(Pledge::promise)) { \
|
||||
dbg() << "Has not pledged " << #promise; \
|
||||
dbgln("Has not pledged {}", #promise); \
|
||||
cli(); \
|
||||
Process::current()->crash(SIGABRT, 0); \
|
||||
ASSERT_NOT_REACHED(); \
|
||||
|
@ -785,3 +785,11 @@ inline static String copy_string_from_user(const Kernel::Syscall::StringArgument
|
|||
{
|
||||
return copy_string_from_user(string.characters, string.length);
|
||||
}
|
||||
|
||||
template<>
|
||||
struct AK::Formatter<Kernel::Process> : AK::Formatter<String> {
|
||||
void format(FormatBuilder& builder, const Kernel::Process& value)
|
||||
{
|
||||
return AK::Formatter<String>::format(builder, String::formatted("{}({})", value.name(), value.pid().value()));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -532,7 +532,7 @@ void Scheduler::notify_finalizer()
|
|||
|
||||
void Scheduler::idle_loop(void*)
|
||||
{
|
||||
dbg() << "Scheduler[" << Processor::current().id() << "]: idle loop running";
|
||||
dbgln("Scheduler[{}]: idle loop running", Processor::current().id());
|
||||
ASSERT(are_interrupts_enabled());
|
||||
|
||||
for (;;) {
|
||||
|
|
|
@ -48,10 +48,15 @@ void SharedBuffer::sanity_check(const char* what)
|
|||
found_refs += ref.count;
|
||||
|
||||
if (found_refs != m_total_refs) {
|
||||
dbg() << what << " sanity -- SharedBuffer{" << this << "} id: " << m_shbuf_id << " has total refs " << m_total_refs << " but we found " << found_refs;
|
||||
for (const auto& ref : m_refs) {
|
||||
dbg() << " ref from pid " << ref.pid.value() << ": refcnt " << ref.count;
|
||||
}
|
||||
dbgln("{} sanity -- SharedBuffer({}) id: {} has total refs {} but we found {}",
|
||||
what,
|
||||
this,
|
||||
m_shbuf_id,
|
||||
m_total_refs,
|
||||
found_refs);
|
||||
|
||||
for (const auto& ref : m_refs)
|
||||
dbgln(" ref from pid {}: reference count {}", ref.pid.value(), ref.count);
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ void init_stage2(void*)
|
|||
bool text_mode = kernel_command_line().lookup("boot_mode").value_or("graphical") == "text";
|
||||
|
||||
if (text_mode) {
|
||||
dbg() << "Text mode enabled";
|
||||
dbgln("Text mode enabled");
|
||||
} else {
|
||||
bool bxvga_found = false;
|
||||
PCI::enumerate([&](const PCI::Address&, PCI::ID id) {
|
||||
|
@ -300,7 +300,7 @@ void init_stage2(void*)
|
|||
|
||||
void setup_serial_debug()
|
||||
{
|
||||
// serial_debug will output all the klog() and dbg() data to COM1 at
|
||||
// serial_debug will output all the klog() and dbgln() data to COM1 at
|
||||
// 8-N-1 57600 baud. this is particularly useful for debugging the boot
|
||||
// process on live hardware.
|
||||
//
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
static bool serial_debug;
|
||||
// A recursive spinlock allows us to keep writing in the case where a
|
||||
// page fault happens in the middle of a dbg(), klog(), etc
|
||||
// page fault happens in the middle of a dbgln(), klog(), etc
|
||||
static RecursiveSpinLock s_log_lock;
|
||||
|
||||
void set_serial_debug(bool on_or_off)
|
||||
|
|
Loading…
Reference in a new issue