Skip to content

Commit

Permalink
Everywhere: Replace a bundle of dbg with dbgln.
Browse files Browse the repository at this point in the history
These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.Everything:

The modifications in this commit were automatically made using the
following command:

    find . -name '*.cpp' -exec sed -i -E 's/dbg\(\) << ("[^"{]*");/dbgln\(\1\);/' {} \;
  • Loading branch information
asynts authored and awesomekling committed Jan 9, 2021
1 parent 40b8e21 commit 938e5c7
Show file tree
Hide file tree
Showing 95 changed files with 331 additions and 331 deletions.
8 changes: 4 additions & 4 deletions Kernel/ACPI/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void Parser::locate_static_data()
PhysicalAddress Parser::find_table(const StringView& signature)
{
#ifdef ACPI_DEBUG
dbg() << "ACPI: Calling Find Table method!";
dbgln("ACPI: Calling Find Table method!");
#endif
for (auto p_sdt : m_sdt_pointers) {
auto sdt = map_typed<Structures::SDTHeader>(p_sdt);
Expand Down Expand Up @@ -244,7 +244,7 @@ size_t Parser::get_table_size(PhysicalAddress table_header)
{
InterruptDisabler disabler;
#ifdef ACPI_DEBUG
dbg() << "ACPI: Checking SDT Length";
dbgln("ACPI: Checking SDT Length");
#endif
return map_typed<Structures::SDTHeader>(table_header)->length;
}
Expand All @@ -253,15 +253,15 @@ u8 Parser::get_table_revision(PhysicalAddress table_header)
{
InterruptDisabler disabler;
#ifdef ACPI_DEBUG
dbg() << "ACPI: Checking SDT Revision";
dbgln("ACPI: Checking SDT Revision");
#endif
return map_typed<Structures::SDTHeader>(table_header)->revision;
}

void Parser::initialize_main_system_description_table()
{
#ifdef ACPI_DEBUG
dbg() << "ACPI: Checking Main SDT Length to choose the correct mapping size";
dbgln("ACPI: Checking Main SDT Length to choose the correct mapping size");
#endif
ASSERT(!m_main_system_description_table.is_null());
auto length = get_table_size(m_main_system_description_table);
Expand Down
6 changes: 3 additions & 3 deletions Kernel/Arch/i386/CPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ void page_fault_handler(TrapFrame* trap)
handle_crash(regs, "Page Fault", SIGSEGV, response == PageFaultResponse::OutOfMemory);
} else if (response == PageFaultResponse::Continue) {
#ifdef PAGE_FAULT_DEBUG
dbg() << "Continuing after resolved page fault";
dbgln("Continuing after resolved page fault");
#endif
} else {
ASSERT_NOT_REACHED();
Expand Down Expand Up @@ -605,7 +605,7 @@ void unregister_generic_interrupt_handler(u8 interrupt_number, GenericInterruptH
{
ASSERT(s_interrupt_handler[interrupt_number] != nullptr);
if (s_interrupt_handler[interrupt_number]->type() == HandlerType::UnhandledInterruptHandler) {
dbg() << "Trying to unregister unused handler (?)";
dbgln("Trying to unregister unused handler (?)");
return;
}
if (s_interrupt_handler[interrupt_number]->is_shared_handler() && !s_interrupt_handler[interrupt_number]->is_sharing_with_others()) {
Expand Down Expand Up @@ -844,7 +844,7 @@ static void idt_init()
register_interrupt_handler(0xfe, interrupt_254_asm_entry);
register_interrupt_handler(0xff, interrupt_255_asm_entry);

dbg() << "Installing Unhandled Handlers";
dbgln("Installing Unhandled Handlers");

for (u8 i = 0; i < GENERIC_INTERRUPT_HANDLERS_COUNT; ++i) {
new UnhandledInterruptHandler(i);
Expand Down
12 changes: 6 additions & 6 deletions Kernel/Devices/I8042Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ I8042Controller::I8042Controller()
do_wait_then_write(I8042_STATUS, 0x60);
do_wait_then_write(I8042_BUFFER, configuration);
} else {
dbg() << "I8042: Controller self test failed";
dbgln("I8042: Controller self test failed");
}

// Test ports and enable them if available
Expand All @@ -88,7 +88,7 @@ I8042Controller::I8042Controller()
configuration |= 1;
configuration &= ~(1 << 4);
} else {
dbg() << "I8042: Keyboard port not available";
dbgln("I8042: Keyboard port not available");
}

if (m_is_dual_channel) {
Expand All @@ -99,7 +99,7 @@ I8042Controller::I8042Controller()
configuration |= 2;
configuration &= ~(1 << 5);
} else {
dbg() << "I8042: Mouse port not available";
dbgln("I8042: Mouse port not available");
}
}

Expand All @@ -116,7 +116,7 @@ I8042Controller::I8042Controller()
if (KeyboardDevice::the().initialize()) {
m_devices[0].device = &KeyboardDevice::the();
} else {
dbg() << "I8042: Keyboard device failed to initialize, disable";
dbgln("I8042: Keyboard device failed to initialize, disable");
m_devices[0].available = false;
configuration &= ~1;
configuration |= 1 << 4;
Expand All @@ -129,7 +129,7 @@ I8042Controller::I8042Controller()
if (PS2MouseDevice::the().initialize()) {
m_devices[1].device = &PS2MouseDevice::the();
} else {
dbg() << "I8042: Mouse device failed to initialize, disable";
dbgln("I8042: Mouse device failed to initialize, disable");
m_devices[1].available = false;
configuration |= 1 << 5;
ScopedSpinLock lock(m_lock);
Expand Down Expand Up @@ -223,7 +223,7 @@ u8 I8042Controller::do_write_to_device(Device device, u8 data)
response = do_wait_then_read(I8042_BUFFER);
} while (response == I8042_RESEND && ++attempts < 3);
if (attempts >= 3)
dbg() << "Failed to write byte to device, gave up";
dbgln("Failed to write byte to device, gave up");
return response;
}

Expand Down
2 changes: 1 addition & 1 deletion Kernel/Devices/KeyboardDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ KeyboardDevice::~KeyboardDevice()
bool KeyboardDevice::initialize()
{
if (!m_controller.reset_device(I8042Controller::Device::Keyboard)) {
dbg() << "KeyboardDevice: I8042 controller failed to reset device";
dbgln("KeyboardDevice: I8042 controller failed to reset device");
return false;
}
return true;
Expand Down
6 changes: 3 additions & 3 deletions Kernel/Devices/PS2MouseDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void PS2MouseDevice::irq_handle_byte_read(u8 byte)
switch (m_data_state) {
case 0:
if (!(byte & 0x08)) {
dbg() << "PS2Mouse: Stream out of sync.";
dbgln("PS2Mouse: Stream out of sync.");
break;
}
++m_data_state;
Expand Down Expand Up @@ -223,7 +223,7 @@ void PS2MouseDevice::set_sample_rate(u8 rate)
bool PS2MouseDevice::initialize()
{
if (!m_controller.reset_device(I8042Controller::Device::Mouse)) {
dbg() << "PS2MouseDevice: I8042 controller failed to reset device";
dbgln("PS2MouseDevice: I8042 controller failed to reset device");
return false;
}

Expand Down Expand Up @@ -284,7 +284,7 @@ KResultOr<size_t> PS2MouseDevice::read(FileDescription&, size_t, UserOrKernelBuf
#ifdef PS2MOUSE_DEBUG
dbg() << "PS2 Mouse Read: Buttons " << String::format("%x", packet.buttons);
dbg() << "PS2 Mouse: X " << packet.x << ", Y " << packet.y << ", Z " << packet.z << " Relative " << packet.buttons;
dbg() << "PS2 Mouse Read: Filter packets";
dbgln("PS2 Mouse Read: Filter packets");
#endif
size_t bytes_read_from_packet = min(remaining_space_in_buffer, sizeof(MousePacket));
if (!buffer.write(&packet, nread, bytes_read_from_packet))
Expand Down
2 changes: 1 addition & 1 deletion Kernel/FileSystem/DevFS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ KResultOr<NonnullRefPtr<Inode>> DevFSRootDirectoryInode::create_child(const Stri
if (link.name() == name)
return KResult(-EEXIST);
}
dbg() << "DevFS: Success on create new symlink";
dbgln("DevFS: Success on create new symlink");
auto new_link_inode = adopt(*new DevFSLinkInode(m_parent_fs, name));
m_links.append(new_link_inode);
m_parent_fs.m_nodes.append(new_link_inode);
Expand Down
8 changes: 4 additions & 4 deletions Kernel/FileSystem/Ext2FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ Ext2FS::BlockListShape Ext2FS::compute_block_list_shape(unsigned blocks) const
if (!blocks_remaining)
return shape;

dbg() << "we don't know how to compute tind ext2fs blocks yet!";
dbgln("we don't know how to compute tind ext2fs blocks yet!");
ASSERT_NOT_REACHED();

shape.triply_indirect_blocks = min(blocks_remaining, entries_per_block * entries_per_block * entries_per_block);
Expand Down Expand Up @@ -420,7 +420,7 @@ bool Ext2FS::write_block_list_for_inode(InodeIndex inode_index, ext2_inode& e2in
return true;

// FIXME: Implement!
dbg() << "we don't know how to write tind ext2fs blocks yet!";
dbgln("we don't know how to write tind ext2fs blocks yet!");
ASSERT_NOT_REACHED();
}

Expand Down Expand Up @@ -1137,7 +1137,7 @@ Vector<Ext2FS::BlockIndex> Ext2FS::allocate_blocks(GroupIndex preferred_group_in

Vector<BlockIndex> blocks;
#ifdef EXT2_DEBUG
dbg() << "Ext2FS: allocate_blocks:";
dbgln("Ext2FS: allocate_blocks:");
#endif
blocks.ensure_capacity(count);

Expand Down Expand Up @@ -1474,7 +1474,7 @@ KResultOr<NonnullRefPtr<Inode>> Ext2FS::create_inode(InodeIdentifier parent_id,

size_t needed_blocks = ceil_div(static_cast<size_t>(size), block_size());
if ((size_t)needed_blocks > super_block().s_free_blocks_count) {
dbg() << "Ext2FS: create_inode: not enough free blocks";
dbgln("Ext2FS: create_inode: not enough free blocks");
return KResult(-ENOSPC);
}

Expand Down
8 changes: 4 additions & 4 deletions Kernel/FileSystem/Plan9FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ bool Plan9FS::initialize()

result = post_message_and_wait_for_a_reply(attach_message);
if (result.is_error()) {
dbg() << "Attaching failed";
dbgln("Attaching failed");
return false;
}

Expand Down Expand Up @@ -663,7 +663,7 @@ ssize_t Plan9FS::adjust_buffer_size(ssize_t size) const

void Plan9FS::thread_main()
{
dbg() << "Plan9FS: Thread running";
dbgln("Plan9FS: Thread running");
do {
auto result = read_and_dispatch_one_message();
if (result.is_error()) {
Expand All @@ -676,11 +676,11 @@ void Plan9FS::thread_main()
}
m_completions.clear();
m_completion_blocker.unblock_all();
dbg() << "Plan9FS: Thread terminating, error reading";
dbgln("Plan9FS: Thread terminating, error reading");
return;
}
} while (!m_thread_shutdown);
dbg() << "Plan9FS: Thread terminating";
dbgln("Plan9FS: Thread terminating");
}

void Plan9FS::ensure_thread()
Expand Down
2 changes: 1 addition & 1 deletion Kernel/FileSystem/ProcFS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ ssize_t ProcFSInode::read_bytes(off_t offset, ssize_t count, UserOrKernelBuffer&
return -EIO;
if (!description->data()) {
#ifdef PROCFS_DEBUG
dbg() << "ProcFS: Do not have cached data!";
dbgln("ProcFS: Do not have cached data!");
#endif
return -EIO;
}
Expand Down
2 changes: 1 addition & 1 deletion Kernel/FileSystem/VirtualFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ KResult VFS::unmount(Inode& guest_inode)
if (&mount.guest() == &guest_inode) {
auto result = mount.guest_fs().prepare_to_unmount();
if (result.is_error()) {
dbg() << "VFS: Failed to unmount!";
dbgln("VFS: Failed to unmount!");
return result;
}
dbg() << "VFS: found fs " << mount.guest_fs().fsid() << " at mount index " << i << "! Unmounting...";
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Interrupts/APIC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ void APIC::boot_aps()
Processor::smp_enable();

#ifdef APIC_DEBUG
dbg() << "All processors initialized and waiting, trigger all to continue";
dbgln("All processors initialized and waiting, trigger all to continue");
#endif

// Now trigger all APs to continue execution (need to do this after
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Interrupts/InterruptManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ RefPtr<IRQController> InterruptManagement::get_responsible_irq_controller(u8 int

PhysicalAddress InterruptManagement::search_for_madt()
{
dbg() << "Early access to ACPI tables for interrupt setup";
dbgln("Early access to ACPI tables for interrupt setup");
auto rsdp = ACPI::StaticParsing::find_rsdp();
if (!rsdp.has_value())
return {};
Expand Down Expand Up @@ -165,7 +165,7 @@ void InterruptManagement::switch_to_ioapic_mode()
InterruptDisabler disabler;

if (m_madt.is_null()) {
dbg() << "Interrupts: ACPI MADT is not available, reverting to PIC mode";
dbgln("Interrupts: ACPI MADT is not available, reverting to PIC mode");
switch_to_pic_mode();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Net/Socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ KResult Socket::getsockopt(FileDescription&, int level, int option, Userspace<vo
case SO_ERROR: {
if (size < sizeof(int))
return KResult(-EINVAL);
dbg() << "getsockopt(SO_ERROR): FIXME!";
dbgln("getsockopt(SO_ERROR): FIXME!");
int errno = 0;
if (!copy_to_user(static_ptr_cast<int*>(value), &errno))
return KResult(-EFAULT);
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Net/TCPSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ void TCPSocket::shut_down_for_writing()
{
if (state() == State::Established) {
#ifdef TCP_SOCKET_DEBUG
dbg() << " Sending FIN/ACK from Established and moving into FinWait1";
dbgln(" Sending FIN/ACK from Established and moving into FinWait1");
#endif
[[maybe_unused]] auto rc = send_tcp_packet(TCPFlags::FIN | TCPFlags::ACK);
set_state(State::FinWait1);
Expand All @@ -475,7 +475,7 @@ KResult TCPSocket::close()
auto result = IPv4Socket::close();
if (state() == State::CloseWait) {
#ifdef TCP_SOCKET_DEBUG
dbg() << " Sending FIN from CloseWait and moving into LastAck";
dbgln(" Sending FIN from CloseWait and moving into LastAck");
#endif
[[maybe_unused]] auto rc = send_tcp_packet(TCPFlags::FIN | TCPFlags::ACK);
set_state(State::LastAck);
Expand Down
4 changes: 2 additions & 2 deletions Kernel/PCI/IOAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void IOAccess::initialize()
if (!Access::is_initialized()) {
new IOAccess();
#ifdef PCI_DEBUG
dbg() << "PCI: IO access initialised.";
dbgln("PCI: IO access initialised.");
#endif
}
}
Expand Down Expand Up @@ -102,7 +102,7 @@ void IOAccess::write32_field(Address address, u32 field, u32 value)
void IOAccess::enumerate_hardware(Function<void(Address, ID)> callback)
{
#ifdef PCI_DEBUG
dbg() << "PCI: IO enumerating hardware";
dbgln("PCI: IO enumerating hardware");
#endif
// Single PCI host controller.
if ((read8_field(Address(), PCI_HEADER_TYPE) & 0x80) == 0) {
Expand Down
4 changes: 2 additions & 2 deletions Kernel/PCI/MMIOAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void MMIOAccess::initialize(PhysicalAddress mcfg)
if (!Access::is_initialized()) {
new MMIOAccess(mcfg);
#ifdef PCI_DEBUG
dbg() << "PCI: MMIO access initialised.";
dbgln("PCI: MMIO access initialised.");
#endif
}
}
Expand All @@ -97,7 +97,7 @@ MMIOAccess::MMIOAccess(PhysicalAddress p_mcfg)

auto checkup_region = MM.allocate_kernel_region(p_mcfg.page_base(), (PAGE_SIZE * 2), "PCI MCFG Checkup", Region::Access::Read | Region::Access::Write);
#ifdef PCI_DEBUG
dbg() << "PCI: Checking MCFG Table length to choose the correct mapping size";
dbgln("PCI: Checking MCFG Table length to choose the correct mapping size");
#endif

auto* sdt = (ACPI::Structures::SDTHeader*)checkup_region->vaddr().offset(p_mcfg.offset_in_page()).as_ptr();
Expand Down
6 changes: 3 additions & 3 deletions Kernel/Storage/IDEChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void IDEChannel::start_request(AsyncBlockDeviceRequest& request, bool use_dma, b
{
ScopedSpinLock lock(m_request_lock);
#ifdef PATA_DEBUG
dbg() << "IDEChannel::start_request";
dbgln("IDEChannel::start_request");
#endif
m_current_request = &request;
m_current_request_block_index = 0;
Expand Down Expand Up @@ -246,7 +246,7 @@ void IDEChannel::handle_irq(const RegisterState&)

if (!m_current_request) {
#ifdef PATA_DEBUG
dbg() << "IDEChannel: IRQ but no pending request!";
dbgln("IDEChannel: IRQ but no pending request!");
#endif
return;
}
Expand Down Expand Up @@ -444,7 +444,7 @@ void IDEChannel::ata_read_sectors(bool slave_request)
auto& request = *m_current_request;
ASSERT(request.block_count() <= 256);
#ifdef PATA_DEBUG
dbg() << "IDEChannel::ata_read_sectors";
dbgln("IDEChannel::ata_read_sectors");
#endif

while (m_io_group.io_base().offset(ATA_REG_STATUS).in<u8>() & ATA_SR_BSY)
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Syscalls/fork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pid_t Process::sys$fork(RegisterState& regs)
#endif
auto region_clone = region.clone(*child);
if (!region_clone) {
dbg() << "fork: Cannot clone region, insufficient memory";
dbgln("fork: Cannot clone region, insufficient memory");
// TODO: tear down new process?
return -ENOMEM;
}
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Syscalls/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ int Process::sys$module_load(Userspace<const char*> user_path, size_t path_lengt

auto* text_base = section_storage_by_name.get(".text").value_or(nullptr);
if (!text_base) {
dbg() << "No .text section found in module!";
dbgln("No .text section found in module!");
return -EINVAL;
}

Expand Down
2 changes: 1 addition & 1 deletion Kernel/Syscalls/mount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int Process::sys$mount(Userspace<const Syscall::SC_mount_params*> user_params)
if (description.is_null())
return -EBADF;
if (!description->file().is_seekable()) {
dbg() << "mount: this is not a seekable file";
dbgln("mount: this is not a seekable file");
return -ENODEV;
}

Expand Down
Loading

0 comments on commit 938e5c7

Please sign in to comment.