summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2021-01-09 00:11:15 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-09 21:11:09 +0100
commit019c9eb749f2fdb6f99f0ce0aba86c331538636d (patch)
tree73c61d5c90c283c25f9a03621c6b154adfee684f
parent7235ddfd98a2c718afe7d773ed24db0720f2c4db (diff)
downloadserenity-019c9eb749f2fdb6f99f0ce0aba86c331538636d.zip
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.
-rw-r--r--Applications/Browser/DownloadWidget.cpp2
-rw-r--r--Applications/IRCClient/IRCAppWindow.cpp2
-rw-r--r--Applications/Spreadsheet/Spreadsheet.cpp8
-rw-r--r--Applications/Spreadsheet/main.cpp2
-rw-r--r--Applications/TextEditor/TextEditorWidget.cpp2
-rw-r--r--DevTools/Inspector/RemoteProcess.cpp2
-rw-r--r--Kernel/KSyms.cpp2
-rw-r--r--Kernel/Process.cpp16
-rw-r--r--Kernel/Process.h12
-rw-r--r--Kernel/Scheduler.cpp2
-rw-r--r--Kernel/SharedBuffer.cpp13
-rw-r--r--Kernel/init.cpp4
-rw-r--r--Kernel/kprintf.cpp2
13 files changed, 41 insertions, 28 deletions
diff --git a/Applications/Browser/DownloadWidget.cpp b/Applications/Browser/DownloadWidget.cpp
index ed7796c3ac..39d931e216 100644
--- a/Applications/Browser/DownloadWidget.cpp
+++ b/Applications/Browser/DownloadWidget.cpp
@@ -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");
diff --git a/Applications/IRCClient/IRCAppWindow.cpp b/Applications/IRCClient/IRCAppWindow.cpp
index cfe6f101bf..8d4f931025 100644
--- a/Applications/IRCClient/IRCAppWindow.cpp
+++ b/Applications/IRCClient/IRCAppWindow.cpp
@@ -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;
}));
diff --git a/Applications/Spreadsheet/Spreadsheet.cpp b/Applications/Spreadsheet/Spreadsheet.cpp
index e01eb77781..0d20b22fdd 100644
--- a/Applications/Spreadsheet/Spreadsheet.cpp
+++ b/Applications/Spreadsheet/Spreadsheet.cpp
@@ -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)
diff --git a/Applications/Spreadsheet/main.cpp b/Applications/Spreadsheet/main.cpp
index 5b7663e44f..e13a89cdac 100644
--- a/Applications/Spreadsheet/main.cpp
+++ b/Applications/Spreadsheet/main.cpp
@@ -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());
diff --git a/Applications/TextEditor/TextEditorWidget.cpp b/Applications/TextEditor/TextEditorWidget.cpp
index 67e1f6b7d2..a6ca93fa82 100644
--- a/Applications/TextEditor/TextEditorWidget.cpp
+++ b/Applications/TextEditor/TextEditorWidget.cpp
@@ -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 {
diff --git a/DevTools/Inspector/RemoteProcess.cpp b/DevTools/Inspector/RemoteProcess.cpp
index 9e19892815..aa36b46cae 100644
--- a/DevTools/Inspector/RemoteProcess.cpp
+++ b/DevTools/Inspector/RemoteProcess.cpp
@@ -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;
diff --git a/Kernel/KSyms.cpp b/Kernel/KSyms.cpp
index 8d1f93a870..fe0db7add4 100644
--- a/Kernel/KSyms.cpp
+++ b/Kernel/KSyms.cpp
@@ -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;
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 608772e872..a270b8c198 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -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();
diff --git a/Kernel/Process.h b/Kernel/Process.h
index 3d511f9079..1476a885e0 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -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()));
+ }
+};
diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp
index bd5137a440..7e7aac64b3 100644
--- a/Kernel/Scheduler.cpp
+++ b/Kernel/Scheduler.cpp
@@ -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 (;;) {
diff --git a/Kernel/SharedBuffer.cpp b/Kernel/SharedBuffer.cpp
index 89d0fad1b0..4713e8da9f 100644
--- a/Kernel/SharedBuffer.cpp
+++ b/Kernel/SharedBuffer.cpp
@@ -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();
}
}
diff --git a/Kernel/init.cpp b/Kernel/init.cpp
index 8beb09ea94..669ea74efa 100644
--- a/Kernel/init.cpp
+++ b/Kernel/init.cpp
@@ -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.
//
diff --git a/Kernel/kprintf.cpp b/Kernel/kprintf.cpp
index d03388c5d1..131e5946ea 100644
--- a/Kernel/kprintf.cpp
+++ b/Kernel/kprintf.cpp
@@ -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)