diff options
98 files changed, 414 insertions, 972 deletions
diff --git a/AK/Debug.h.in b/AK/Debug.h.in index b4210470c8..e6ada1949e 100644 --- a/AK/Debug.h.in +++ b/AK/Debug.h.in @@ -42,7 +42,7 @@ #cmakedefine01 SMP_DEBUG #cmakedefine01 BXVGA_DEBUG #cmakedefine01 PS2MOUSE_DEBUG -#cmakedefine01 VMWAREBACKDOOR_DEBUG +#cmakedefine01 VMWARE_BACKDOOR_DEBUG #cmakedefine01 FILEDESCRIPTION_DEBUG #cmakedefine01 PROCFS_DEBUG #cmakedefine01 VFS_DEBUG @@ -92,9 +92,9 @@ #cmakedefine01 REGEX_DEBUG #cmakedefine01 TLS_DEBUG #cmakedefine01 SPAM_DEBUG -#cmakedefine01 WRAPPER_GERNERATOR_DEBUG +#cmakedefine01 WRAPPER_GENERATOR_DEBUG #cmakedefine01 PARSER_DEBUG -#cmakedefine01 TOKENIZER_TRACE +#cmakedefine01 TOKENIZER_TRACE_DEBUG #cmakedefine01 IMAGE_LOADER_DEBUG #cmakedefine01 RESOURCE_DEBUG #cmakedefine01 CACHE_DEBUG @@ -113,567 +113,9 @@ #cmakedefine01 RESIZE_DEBUG #cmakedefine01 MOVE_DEBUG #cmakedefine01 DOUBLECLICK_DEBUG -#cmakedefine01 DISASM_DUMP +#cmakedefine01 DISASM_DUMP_DEBUG #cmakedefine01 PATH_DEBUG #cmakedefine01 LOCK_TRACE_DEBUG #cmakedefine01 LOCK_RESTORE_DEBUG #cmakedefine01 FUTEXQUEUE_DEBUG #cmakedefine01 FUTEX_DEBUG - -#if PROCESS_DEBUG -constexpr bool debug_process = true; -#else -constexpr bool debug_process = false; -#endif - -#if SCHEDULER_DEBUG -constexpr bool debug_scheduler = true; -#else -constexpr bool debug_scheduler = false; -#endif - -#if SCHEDULER_RUNNABLE_DEBUG -constexpr bool debug_scheduler_runnable = true; -#else -constexpr bool debug_scheduler_runnable = false; -#endif - -#if THREAD_DEBUG -constexpr bool debug_thread = true; -#else -constexpr bool debug_thread = false; -#endif - -#if LOCK_DEBUG -constexpr bool debug_lock = true; -#else -constexpr bool debug_lock = false; -#endif - -#if SIGNAL_DEBUG -constexpr bool debug_signal = true; -#else -constexpr bool debug_signal = false; -#endif - -#if BMP_DEBUG -constexpr bool debug_bmp = true; -#else -constexpr bool debug_bmp = false; -#endif - -#if WAITBLOCK_DEBUG -constexpr bool debug_waitblock = true; -#else -constexpr bool debug_waitblock = false; -#endif - -#if WAITQUEUE_DEBUG -constexpr bool debug_waitqueue = true; -#else -constexpr bool debug_waitqueue = false; -#endif - -#if MULTIPROCESSOR_DEBUG -constexpr bool debug_multiprocessor = true; -#else -constexpr bool debug_multiprocessor = false; -#endif - -#if ACPI_DEBUG -constexpr bool debug_acpi = true; -#else -constexpr bool debug_acpi = false; -#endif - -#if PAGE_FAULT_DEBUG -constexpr bool debug_page_fault = true; -#else -constexpr bool debug_page_fault = false; -#endif - -#if CONTEXT_SWITCH_DEBUG -constexpr bool debug_context_switch = true; -#else -constexpr bool debug_context_switch = false; -#endif - -#if SMP_DEBUG -constexpr bool debug_smp = true; -#else -constexpr bool debug_smp = false; -#endif - -#if BXVGA_DEBUG -constexpr bool debug_bxvga = true; -#else -constexpr bool debug_bxvga = false; -#endif - -#if PS2MOUSE_DEBUG -constexpr bool debug_ps2mouse = true; -#else -constexpr bool debug_ps2mouse = false; -#endif - -#if VMWAREBACKDOOR_DEBUG -constexpr bool debug_vmware_backdoor = true; -#else -constexpr bool debug_vmware_backdoor = false; -#endif - -#if FILEDESCRIPTION_DEBUG -constexpr bool debug_file_description = true; -#else -constexpr bool debug_file_description = false; -#endif - -#if PROCFS_DEBUG -constexpr bool debug_procfs = true; -#else -constexpr bool debug_procfs = false; -#endif - -#if VFS_DEBUG -constexpr bool debug_vfs = true; -#else -constexpr bool debug_vfs = false; -#endif - -#if IOAPIC_DEBUG -constexpr bool debug_ioapic = true; -#else -constexpr bool debug_ioapic = false; -#endif - -#if IRQ_DEBUG -constexpr bool debug_irq = true; -#else -constexpr bool debug_irq = false; -#endif - -#if INTERRUPT_DEBUG -constexpr bool debug_interrupt = true; -#else -constexpr bool debug_interrupt = false; -#endif - -#if E1000_DEBUG -constexpr bool debug_e1000 = true; -#else -constexpr bool debug_e1000 = false; -#endif - -#if IPV4_SOCKET_DEBUG -constexpr bool debug_ipv4_socket = true; -#else -constexpr bool debug_ipv4_socket = false; -#endif - -#if LOCAL_SOCKET_DEBUG -constexpr bool debug_local_socket = true; -#else -constexpr bool debug_local_socket = false; -#endif - -#if SOCKET_DEBUG -constexpr bool debug_socket = true; -#else -constexpr bool debug_socket = false; -#endif - -#if TCP_SOCKET_DEBUG -constexpr bool debug_tcp_socket = true; -#else -constexpr bool debug_tcp_socket = false; -#endif - -#if PCI_DEBUG -constexpr bool debug_pci = true; -#else -constexpr bool debug_pci = false; -#endif - -#if PATA_DEBUG -constexpr bool debug_pata = true; -#else -constexpr bool debug_pata = false; -#endif - -#if IO_DEBUG -constexpr bool debug_io = true; -#else -constexpr bool debug_io = false; -#endif - -#if FORK_DEBUG -constexpr bool debug_fork = true; -#else -constexpr bool debug_fork = false; -#endif - -#if POLL_SELECT_DEBUG -constexpr bool debug_poll_select = true; -#else -constexpr bool debug_poll_select = false; -#endif - -#if HPET_DEBUG -constexpr bool debug_hpet = true; -#else -constexpr bool debug_hpet = false; -#endif - -#if HPET_COMPARATOR_DEBUG -constexpr bool debug_hpet_comperator = true; -#else -constexpr bool debug_hpet_comperator = false; -#endif - -#if MASTERPTY_DEBUG -constexpr bool debug_masterpty = true; -#else -constexpr bool debug_masterpty = false; -#endif - -#if SLAVEPTY_DEBUG -constexpr bool debug_slavepty = true; -#else -constexpr bool debug_slavepty = false; -#endif - -#if PTMX_DEBUG -constexpr bool debug_ptmx = true; -#else -constexpr bool debug_ptmx = false; -#endif - -#if TTY_DEBUG -constexpr bool debug_tty = true; -#else -constexpr bool debug_tty = false; -#endif - -#if CONTIGUOUS_VMOBJECT_DEBUG -constexpr bool debug_contiguous_vmobject = true; -#else -constexpr bool debug_contiguous_vmobject = false; -#endif - -#if VRA_DEBUG -constexpr bool debug_vra = true; -#else -constexpr bool debug_vra = false; -#endif - -#if COPY_DEBUG -constexpr bool debug_copy = true; -#else -constexpr bool debug_copy = false; -#endif - -#if CURSOR_TOOL_DEBUG -constexpr bool debug_cursor_tool = true; -#else -constexpr bool debug_cursor_tool = false; -#endif - -#if FILE_CONTENT_DEBUG -constexpr bool debug_file_content = true; -#else -constexpr bool debug_file_content = false; -#endif - -#if GZIP_DEBUG -constexpr bool debug_gzip = true; -#else -constexpr bool debug_gzip = false; -#endif - -#if CNETWORKJOB_DEBUG -constexpr bool debug_cnetworkjob = true; -#else -constexpr bool debug_cnetworkjob = false; -#endif - -#if CSOCKET_DEBUG -constexpr bool debug_csocket = true; -#else -constexpr bool debug_csocket = false; -#endif - -#if SAFE_SYSCALL_DEBUG -constexpr bool debug_safe_syscall = true; -#else -constexpr bool debug_safe_syscall = false; -#endif - -#if GHASH_PROCESS_DEBUG -constexpr bool debug_ghash_process = true; -#else -constexpr bool debug_ghash_process = false; -#endif - -#if NT_DEBUG -constexpr bool debug_nt = true; -#else -constexpr bool debug_nt = false; -#endif - -#if CRYPTO_DEBUG -constexpr bool debug_crypto = true; -#else -constexpr bool debug_crypto = false; -#endif - -#if DWARF_DEBUG -constexpr bool debug_dwarf = true; -#else -constexpr bool debug_dwarf = false; -#endif - -#if HUNKS_DEBUG -constexpr bool debug_hunks = true; -#else -constexpr bool debug_hunks = false; -#endif - -#if JOB_DEBUG -constexpr bool debug_job = true; -#else -constexpr bool debug_job = false; -#endif - -#if GIF_DEBUG -constexpr bool debug_gif = true; -#else -constexpr bool debug_gif = false; -#endif - -#if JPG_DEBUG -constexpr bool debug_jpg = true; -#else -constexpr bool debug_jpg = false; -#endif - -#if EMOJI_DEBUG -constexpr bool debug_emoji = true; -#else -constexpr bool debug_emoji = false; -#endif - -#if FILL_PATH_DEBUG -constexpr bool debug_fill_path = true; -#else -constexpr bool debug_fill_path = false; -#endif - -#if PNG_DEBUG -constexpr bool debug_png = true; -#else -constexpr bool debug_png = false; -#endif - -#if PORTABLE_IMAGE_LOADER_DEBUG -constexpr bool debug_portable_image_loader = true; -#else -constexpr bool debug_portable_image_loader = false; -#endif - -#if SYNTAX_HIGHLIGHTING_DEBUG -constexpr bool debug_syntax_highlighting = true; -#else -constexpr bool debug_syntax_highlighting = false; -#endif - -#if KEYBOARD_SHORTCUTS_DEBUG -constexpr bool debug_keyboard_shortcuts = true; -#else -constexpr bool debug_keyboard_shortcuts = false; -#endif - -#if MARKDOWN_DEBUG -constexpr bool debug_markdown = true; -#else -constexpr bool debug_markdown = false; -#endif - -#if REGEX_DEBUG -constexpr bool debug_regex = true; -#else -constexpr bool debug_regex = false; -#endif - -#if TLS_DEBUG -constexpr bool debug_tls = true; -#else -constexpr bool debug_tls = false; -#endif - -#if SPAM_DEBUG -constexpr bool debug_spam = true; -#else -constexpr bool debug_spam = false; -#endif - -#if WRAPPER_GERNERATOR_DEBUG -constexpr bool debug_wrapper_generator = true; -#else -constexpr bool debug_wrapper_generator = false; -#endif - -#if PARSER_DEBUG -constexpr bool debug_parser = true; -#else -constexpr bool debug_parser = false; -#endif - -#if TOKENIZER_TRACE -constexpr bool debug_trace_tokenizer = true; -#else -constexpr bool debug_trace_tokenizer = false; -#endif - -#if IMAGE_LOADER_DEBUG -constexpr bool debug_image_loader = true; -#else -constexpr bool debug_image_loader = false; -#endif - -#if RESOURCE_DEBUG -constexpr bool debug_resource = true; -#else -constexpr bool debug_resource = false; -#endif - -#if CACHE_DEBUG -constexpr bool debug_cache = true; -#else -constexpr bool debug_cache = false; -#endif - -#if DHCPV4_DEBUG -constexpr bool debug_dhcpv4 = true; -#else -constexpr bool debug_dhcpv4 = false; -#endif - -#if DHCPV4CLIENT_DEBUG -constexpr bool debug_dhcpv4_client = true; -#else -constexpr bool debug_dhcpv4_client = false; -#endif - -#if IMAGE_DECODER_DEBUG -constexpr bool debug_image_decoder = true; -#else -constexpr bool debug_image_decoder = false; -#endif - -#if SYSTEM_MENU_DEBUG -constexpr bool debug_system_menu = true; -#else -constexpr bool debug_system_menu = false; -#endif - -#if SYSTEMSERVER_DEBUG -constexpr bool debug_system_server = true; -#else -constexpr bool debug_system_server = false; -#endif - -#if SERVICE_DEBUG -constexpr bool debug_service = true; -#else -constexpr bool debug_service = false; -#endif - -#if COMPOSE_DEBUG -constexpr bool debug_compose = true; -#else -constexpr bool debug_compose = false; -#endif - -#if MINIMIZE_ANIMATION_DEBUG -constexpr bool debug_minimize_animation = true; -#else -constexpr bool debug_minimize_animation = false; -#endif - -#if OCCLUSIONS_DEBUG -constexpr bool debug_occlusions = true; -#else -constexpr bool debug_occlusions = false; -#endif - -#if MENUS_DEBUG -constexpr bool debug_menus = true; -#else -constexpr bool debug_menus = false; -#endif - -#if WSSCREEN_DEBUG -constexpr bool debug_wsscreen = true; -#else -constexpr bool debug_wsscreen = false; -#endif - -#if WINDOWMANAGER_DEBUG -constexpr bool debug_window_manager = true; -#else -constexpr bool debug_window_manager = false; -#endif - -#if RESIZE_DEBUG -constexpr bool debug_resize = true; -#else -constexpr bool debug_resize = false; -#endif - -#if MOVE_DEBUG -constexpr bool debug_move = true; -#else -constexpr bool debug_move = false; -#endif - -#if DOUBLECLICK_DEBUG -constexpr bool debug_double_click = true; -#else -constexpr bool debug_double_click = false; -#endif - -#if DISASM_DUMP -constexpr bool debug_disasm_dump = true; -#else -constexpr bool debug_disasm_dump = false; -#endif - -#if PATH_DEBUG -constexpr bool debug_path = true; -#else -constexpr bool debug_path = false; -#endif - -#if LOCK_TRACE_DEBUG -constexpr bool debug_lock_trace = true; -#else -constexpr bool debug_lock_trace = false; -#endif - -#if LOCK_RESTORE_DEBUG -constexpr bool debug_lock_restore = true; -#else -constexpr bool debug_lock_restore = false; -#endif - -#if FUTEXQUEUE_DEBUG -constexpr bool debug_futex_queue = true; -#else -constexpr bool debug_futex_queue = false; -#endif - -#if FUTEX_DEBUG -constexpr bool debug_futex = true; -#else -constexpr bool debug_futex = false; -#endif diff --git a/Kernel/ACPI/MultiProcessorParser.cpp b/Kernel/ACPI/MultiProcessorParser.cpp index bc6340ea54..b0968adc9a 100644 --- a/Kernel/ACPI/MultiProcessorParser.cpp +++ b/Kernel/ACPI/MultiProcessorParser.cpp @@ -67,7 +67,7 @@ void MultiProcessorParser::parse_configuration_table() size_t entry_count = config_table->entry_count; auto* entry = config_table->entries; while (entry_count > 0) { - dbgln<debug_multiprocessor>("MultiProcessor: Entry Type {} detected.", entry->entry_type); + dbgln<MULTIPROCESSOR_DEBUG>("MultiProcessor: Entry Type {} detected.", entry->entry_type); switch (entry->entry_type) { case ((u8)MultiProcessor::ConfigurationTableEntryType::Processor): entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::ProcessorEntry); diff --git a/Kernel/ACPI/Parser.cpp b/Kernel/ACPI/Parser.cpp index c7e54570f6..64db353a2d 100644 --- a/Kernel/ACPI/Parser.cpp +++ b/Kernel/ACPI/Parser.cpp @@ -66,12 +66,12 @@ void Parser::locate_static_data() PhysicalAddress Parser::find_table(const StringView& signature) { - dbgln<debug_acpi>("ACPI: Calling Find Table method!"); + dbgln<ACPI_DEBUG>("ACPI: Calling Find Table method!"); for (auto p_sdt : m_sdt_pointers) { auto sdt = map_typed<Structures::SDTHeader>(p_sdt); - dbgln<debug_acpi>("ACPI: Examining Table @ {}", p_sdt); + dbgln<ACPI_DEBUG>("ACPI: Examining Table @ {}", p_sdt); if (!strncmp(sdt->sig, signature.characters_without_null_termination(), 4)) { - dbgln<debug_acpi>("ACPI: Found Table @ {}", p_sdt); + dbgln<ACPI_DEBUG>("ACPI: Found Table @ {}", p_sdt); return p_sdt; } } @@ -93,7 +93,7 @@ void Parser::init_fadt() auto sdt = map_typed<Structures::FADT>(m_fadt); - dbgln<debug_acpi>("ACPI: FADT @ V{}, {}", &sdt, m_fadt); + dbgln<ACPI_DEBUG>("ACPI: FADT @ V{}, {}", &sdt, m_fadt); klog() << "ACPI: Fixed ACPI data, Revision " << sdt->h.revision << ", Length " << sdt->h.length << " bytes"; klog() << "ACPI: DSDT " << PhysicalAddress(sdt->dsdt_ptr); @@ -219,7 +219,7 @@ void Parser::try_acpi_reboot() klog() << "ACPI: Reboot, Not supported!"; return; } - dbgln<debug_acpi>("ACPI: Rebooting, Probing FADT ({})", m_fadt); + dbgln<ACPI_DEBUG>("ACPI: Rebooting, Probing FADT ({})", m_fadt); auto fadt = map_typed<Structures::FADT>(m_fadt); ASSERT(validate_reset_register()); @@ -267,18 +267,18 @@ void Parser::initialize_main_system_description_table() auto& xsdt = (const Structures::XSDT&)*sdt; klog() << "ACPI: Using XSDT, Enumerating tables @ " << m_main_system_description_table; klog() << "ACPI: XSDT Revision " << revision << ", Total length - " << length; - dbgln<debug_acpi>("ACPI: XSDT pointer @ V{}", &xsdt); + dbgln<ACPI_DEBUG>("ACPI: XSDT pointer @ V{}", &xsdt); for (u32 i = 0; i < ((length - sizeof(Structures::SDTHeader)) / sizeof(u64)); i++) { - dbgln<debug_acpi>("ACPI: Found new table [{0}], @ V{1:p} - P{1:p}", i, &xsdt.table_ptrs[i]); + dbgln<ACPI_DEBUG>("ACPI: Found new table [{0}], @ V{1:p} - P{1:p}", i, &xsdt.table_ptrs[i]); m_sdt_pointers.append(PhysicalAddress(xsdt.table_ptrs[i])); } } else { auto& rsdt = (const Structures::RSDT&)*sdt; klog() << "ACPI: Using RSDT, Enumerating tables @ " << m_main_system_description_table; klog() << "ACPI: RSDT Revision " << revision << ", Total length - " << length; - dbgln<debug_acpi>("ACPI: RSDT pointer @ V{}", &rsdt); + dbgln<ACPI_DEBUG>("ACPI: RSDT pointer @ V{}", &rsdt); for (u32 i = 0; i < ((length - sizeof(Structures::SDTHeader)) / sizeof(u32)); i++) { - dbgln<debug_acpi>("ACPI: Found new table [{0}], @ V{1:p} - P{1:p}", i, &rsdt.table_ptrs[i]); + dbgln<ACPI_DEBUG>("ACPI: Found new table [{0}], @ V{1:p} - P{1:p}", i, &rsdt.table_ptrs[i]); m_sdt_pointers.append(PhysicalAddress(rsdt.table_ptrs[i])); } } diff --git a/Kernel/Arch/i386/CPU.cpp b/Kernel/Arch/i386/CPU.cpp index 540d068a5e..43558a2ec7 100644 --- a/Kernel/Arch/i386/CPU.cpp +++ b/Kernel/Arch/i386/CPU.cpp @@ -229,7 +229,7 @@ void page_fault_handler(TrapFrame* trap) asm("movl %%cr2, %%eax" : "=a"(fault_address)); - if constexpr (debug_page_fault) { + if constexpr (PAGE_FAULT_DEBUG) { u32 fault_page_directory = read_cr3(); dbgln("CPU #{} ring {} {} page fault in PD={:#x}, {}{} {}", Processor::is_initialized() ? Processor::current().id() : 0, @@ -1307,7 +1307,7 @@ void Processor::switch_context(Thread*& from_thread, Thread*& to_thread) ASSERT(m_in_critical == 1); ASSERT(is_kernel_mode()); - dbgln<debug_context_switch>("switch_context --> switching out of: {} {}", VirtualAddress(from_thread), *from_thread); + dbgln<CONTEXT_SWITCH_DEBUG>("switch_context --> switching out of: {} {}", VirtualAddress(from_thread), *from_thread); // Switch to new thread context, passing from_thread and to_thread // through to the new context using registers edx and eax @@ -1349,7 +1349,7 @@ void Processor::switch_context(Thread*& from_thread, Thread*& to_thread) [to_thread] "a" (to_thread) ); - dbgln<debug_context_switch>("switch_context <-- from {} {} to {} {}", VirtualAddress(from_thread), *from_thread, VirtualAddress(to_thread), *to_thread); + dbgln<CONTEXT_SWITCH_DEBUG>("switch_context <-- from {} {} to {} {}", VirtualAddress(from_thread), *from_thread, VirtualAddress(to_thread), *to_thread); } extern "C" void context_first_init([[maybe_unused]] Thread* from_thread, [[maybe_unused]] Thread* to_thread, [[maybe_unused]] TrapFrame* trap) @@ -1357,7 +1357,7 @@ extern "C" void context_first_init([[maybe_unused]] Thread* from_thread, [[maybe ASSERT(!are_interrupts_enabled()); ASSERT(is_kernel_mode()); - dbgln<debug_context_switch>("switch_context <-- from {} {} to {} {} (context_first_init)", VirtualAddress(from_thread), *from_thread, VirtualAddress(to_thread), *to_thread); + dbgln<CONTEXT_SWITCH_DEBUG>("switch_context <-- from {} {} to {} {} (context_first_init)", VirtualAddress(from_thread), *from_thread, VirtualAddress(to_thread), *to_thread); ASSERT(to_thread == Thread::current()); @@ -1465,7 +1465,7 @@ u32 Processor::init_context(Thread& thread, bool leave_crit) stack_top -= sizeof(u32); // pointer to TrapFrame *reinterpret_cast<u32*>(stack_top) = stack_top + 4; - if constexpr (debug_context_switch) { + if constexpr (CONTEXT_SWITCH_DEBUG) { if (return_to_user) { dbgln("init_context {} ({}) set up to execute at eip={}:{}, esp={}, stack_top={}, user_top={}:{}", thread, @@ -1532,7 +1532,7 @@ asm( void Processor::assume_context(Thread& thread, u32 flags) { - dbgln<debug_context_switch>("Assume context for thread {} {}", VirtualAddress(&thread), thread); + dbgln<CONTEXT_SWITCH_DEBUG>("Assume context for thread {} {}", VirtualAddress(&thread), thread); ASSERT_INTERRUPTS_DISABLED(); Scheduler::prepare_after_exec(); @@ -1756,7 +1756,7 @@ bool Processor::smp_process_pending_messages() next_msg = cur_msg->next; auto msg = cur_msg->msg; - dbgln<debug_smp>("SMP[{}]: Processing message {}", id(), VirtualAddress(msg)); + dbgln<SMP_DEBUG>("SMP[{}]: Processing message {}", id(), VirtualAddress(msg)); switch (msg->type) { case ProcessorMessage::Callback: @@ -1771,7 +1771,7 @@ bool Processor::smp_process_pending_messages() ASSERT(is_user_range(VirtualAddress(msg->flush_tlb.ptr), msg->flush_tlb.page_count * PAGE_SIZE)); if (read_cr3() != msg->flush_tlb.page_directory->cr3()) { // This processor isn't using this page directory right now, we can ignore this request - dbgln<debug_smp>("SMP[{}]: No need to flush {} pages at {}", id(), msg->flush_tlb.page_count, VirtualAddress(msg->flush_tlb.ptr)); + dbgln<SMP_DEBUG>("SMP[{}]: No need to flush {} pages at {}", id(), msg->flush_tlb.page_count, VirtualAddress(msg->flush_tlb.ptr)); break; } } @@ -1821,7 +1821,7 @@ void Processor::smp_broadcast_message(ProcessorMessage& msg) { auto& cur_proc = Processor::current(); - dbgln<debug_smp>("SMP[{}]: Broadcast message {} to cpus: {} proc: {}", cur_proc.id(), VirtualAddress(&msg), count(), VirtualAddress(&cur_proc)); + dbgln<SMP_DEBUG>("SMP[{}]: Broadcast message {} to cpus: {} proc: {}", cur_proc.id(), VirtualAddress(&msg), count(), VirtualAddress(&cur_proc)); atomic_store(&msg.refs, count() - 1, AK::MemoryOrder::memory_order_release); ASSERT(msg.refs > 0); @@ -1890,7 +1890,7 @@ void Processor::smp_unicast_message(u32 cpu, ProcessorMessage& msg, bool async) auto& target_proc = processors()[cpu]; msg.async = async; - dbgln<debug_smp>("SMP[{}]: Send message {} to cpu #{} proc: {}", cur_proc.id(), VirtualAddress(&msg), cpu, VirtualAddress(&target_proc)); + dbgln<SMP_DEBUG>("SMP[{}]: Send message {} to cpu #{} proc: {}", cur_proc.id(), VirtualAddress(&msg), cpu, VirtualAddress(&target_proc)); atomic_store(&msg.refs, 1u, AK::MemoryOrder::memory_order_release); if (target_proc->smp_queue_message(msg)) { diff --git a/Kernel/Devices/BXVGADevice.cpp b/Kernel/Devices/BXVGADevice.cpp index e7a58859a2..32f470ffa2 100644 --- a/Kernel/Devices/BXVGADevice.cpp +++ b/Kernel/Devices/BXVGADevice.cpp @@ -106,7 +106,7 @@ void BXVGADevice::revert_resolution() void BXVGADevice::set_resolution_registers(size_t width, size_t height) { - dbgln<debug_bxvga>("BXVGADevice resolution registers set to - {}x{}", width, height); + dbgln<BXVGA_DEBUG>("BXVGADevice resolution registers set to - {}x{}", width, height); set_register(VBE_DISPI_INDEX_ENABLE, VBE_DISPI_DISABLED); set_register(VBE_DISPI_INDEX_XRES, (u16)width); set_register(VBE_DISPI_INDEX_YRES, (u16)height); @@ -119,7 +119,7 @@ void BXVGADevice::set_resolution_registers(size_t width, size_t height) bool BXVGADevice::test_resolution(size_t width, size_t height) { - dbgln<debug_bxvga>("BXVGADevice resolution test - {}x{}", width, height); + dbgln<BXVGA_DEBUG>("BXVGADevice resolution test - {}x{}", width, height); set_resolution_registers(width, height); bool resolution_changed = validate_setup_resolution(width, height); revert_resolution(); @@ -239,7 +239,7 @@ int BXVGADevice::ioctl(FileDescription&, unsigned request, FlatPtr arg) if (resolution.width > MAX_RESOLUTION_WIDTH || resolution.height > MAX_RESOLUTION_HEIGHT) return -EINVAL; if (!set_resolution(resolution.width, resolution.height)) { - dbgln<debug_bxvga>("Reverting resolution: [{}x{}]", m_framebuffer_width, m_framebuffer_height); + dbgln<BXVGA_DEBUG>("Reverting resolution: [{}x{}]", m_framebuffer_width, m_framebuffer_height); resolution.pitch = m_framebuffer_pitch; resolution.width = m_framebuffer_width; resolution.height = m_framebuffer_height; @@ -247,7 +247,7 @@ int BXVGADevice::ioctl(FileDescription&, unsigned request, FlatPtr arg) return -EFAULT; return -EINVAL; } - dbgln<debug_bxvga>("New resolution: [{}x{}]", m_framebuffer_width, m_framebuffer_height); + dbgln<BXVGA_DEBUG>("New resolution: [{}x{}]", m_framebuffer_width, m_framebuffer_height); resolution.pitch = m_framebuffer_pitch; resolution.width = m_framebuffer_width; resolution.height = m_framebuffer_height; diff --git a/Kernel/Devices/PS2MouseDevice.cpp b/Kernel/Devices/PS2MouseDevice.cpp index 3792017bd7..962284acf6 100644 --- a/Kernel/Devices/PS2MouseDevice.cpp +++ b/Kernel/Devices/PS2MouseDevice.cpp @@ -99,7 +99,7 @@ void PS2MouseDevice::irq_handle_byte_read(u8 byte) auto commit_packet = [&] { m_data_state = 0; - dbgln<debug_ps2mouse>("PS2Mouse: {}, {} {} {}", + dbgln<PS2MOUSE_DEBUG>("PS2Mouse: {}, {} {} {}", m_data.bytes[1], m_data.bytes[2], (m_data.bytes[0] & 1) ? "Left" : "", @@ -283,7 +283,7 @@ KResultOr<size_t> PS2MouseDevice::read(FileDescription&, size_t, UserOrKernelBuf auto packet = m_queue.dequeue(); lock.unlock(); - if constexpr (debug_ps2mouse) { + if constexpr (PS2MOUSE_DEBUG) { dbgln("PS2 Mouse Read: Buttons {:x}", packet.buttons); dbgln("PS2 Mouse: X {}, Y {}, Z {}, Relative {}", packet.x, packet.y, packet.z, packet.buttons); dbgln("PS2 Mouse Read: Filter packets"); diff --git a/Kernel/Devices/VMWareBackdoor.cpp b/Kernel/Devices/VMWareBackdoor.cpp index 378a6da33d..06c53c7cac 100644 --- a/Kernel/Devices/VMWareBackdoor.cpp +++ b/Kernel/Devices/VMWareBackdoor.cpp @@ -177,7 +177,7 @@ void VMWareBackdoor::send_high_bandwidth(VMWareCommand& command) { vmware_high_bandwidth_send(command); - dbgln<debug_vmware_backdoor>("VMWareBackdoor Command High bandwidth Send Results: EAX {:#x} EBX {:#x} ECX {:#x} EDX {:#x}", + dbgln<VMWARE_BACKDOOR_DEBUG>("VMWareBackdoor Command High bandwidth Send Results: EAX {:#x} EBX {:#x} ECX {:#x} EDX {:#x}", command.ax, command.bx, command.cx, @@ -188,7 +188,7 @@ void VMWareBackdoor::get_high_bandwidth(VMWareCommand& command) { vmware_high_bandwidth_get(command); - dbgln<debug_vmware_backdoor>("VMWareBackdoor Command High bandwidth Get Results: EAX {:#x} EBX {:#x} ECX {:#x} EDX {:#x}", + dbgln<VMWARE_BACKDOOR_DEBUG>("VMWareBackdoor Command High bandwidth Get Results: EAX {:#x} EBX {:#x} ECX {:#x} EDX {:#x}", command.ax, command.bx, command.cx, @@ -199,7 +199,7 @@ void VMWareBackdoor::send(VMWareCommand& command) { vmware_out(command); - dbgln<debug_vmware_backdoor>("VMWareBackdoor Command Send Results: EAX {:#x} EBX {:#x} ECX {:#x} EDX {:#x}", + dbgln<VMWARE_BACKDOOR_DEBUG>("VMWareBackdoor Command Send Results: EAX {:#x} EBX {:#x} ECX {:#x} EDX {:#x}", command.ax, command.bx, command.cx, @@ -233,7 +233,7 @@ Optional<MousePacket> VMWareBackdoor::receive_mouse_packet() int y = (command.cx); int z = (command.dx); - if constexpr (debug_ps2mouse) { + if constexpr (PS2MOUSE_DEBUG) { dbgln("Absolute Mouse: Buttons {:x}", buttons); dbgln("Mouse: x={}, y={}, z={}", x, y, z); } diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp index 96fe39a48d..c69726fe66 100644 --- a/Kernel/FileSystem/FileDescription.cpp +++ b/Kernel/FileSystem/FileDescription.cpp @@ -49,7 +49,7 @@ KResultOr<NonnullRefPtr<FileDescription>> FileDescription::create(Custody& custo description->m_custody = custody; auto result = description->attach(); if (result.is_error()) { - dbgln<debug_file_description>("Failed to create file description for custody: {}", result); + dbgln<FILEDESCRIPTION_DEBUG>("Failed to create file description for custody: {}", result); return result; } return description; @@ -60,7 +60,7 @@ KResultOr<NonnullRefPtr<FileDescription>> FileDescription::create(File& file) auto description = adopt(*new FileDescription(file)); auto result = description->attach(); if (result.is_error()) { - dbgln<debug_file_description>("Failed to create file description for file: {}", result); + dbgln<FILEDESCRIPTION_DEBUG>("Failed to create file description for file: {}", result); return result; } return description; diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index d2eacf4e52..45c5632407 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -986,7 +986,7 @@ NonnullRefPtr<Inode> ProcFS::root_inode() const RefPtr<Inode> ProcFS::get_inode(InodeIdentifier inode_id) const { - dbgln<debug_procfs>("ProcFS::get_inode({})", inode_id.index()); + dbgln<PROCFS_DEBUG>("ProcFS::get_inode({})", inode_id.index()); if (inode_id == root_inode()->identifier()) return m_root_inode; @@ -1099,7 +1099,7 @@ void ProcFSInode::did_seek(FileDescription& description, off_t new_offset) InodeMetadata ProcFSInode::metadata() const { - dbgln<debug_procfs>("ProcFSInode::metadata({})", index()); + dbgln<PROCFS_DEBUG>("ProcFSInode::metadata({})", index()); InodeMetadata metadata; metadata.inode = identifier(); metadata.ctime = mepoch; @@ -1108,7 +1108,7 @@ InodeMetadata ProcFSInode::metadata() const auto proc_parent_directory = to_proc_parent_directory(identifier()); auto proc_file_type = to_proc_file_type(identifier()); - dbgln<debug_procfs>(" -> pid={}, fi={}, pdi={}", to_pid(identifier()).value(), (int)proc_file_type, (int)proc_parent_directory); + dbgln<PROCFS_DEBUG>(" -> pid={}, fi={}, pdi={}", to_pid(identifier()).value(), (int)proc_file_type, (int)proc_parent_directory); if (is_process_related_file(identifier())) { ProcessID pid = to_pid(identifier()); @@ -1173,14 +1173,14 @@ InodeMetadata ProcFSInode::metadata() const ssize_t ProcFSInode::read_bytes(off_t offset, ssize_t count, UserOrKernelBuffer& buffer, FileDescription* description) const { - dbgln<debug_procfs>("ProcFS: read_bytes offset: {} count: {}", offset, count); + dbgln<PROCFS_DEBUG>("ProcFS: read_bytes offset: {} count: {}", offset, count); ASSERT(offset >= 0); ASSERT(buffer.user_or_kernel_ptr()); if (!description) return -EIO; if (!description->data()) { - dbgln<debug_procfs>("ProcFS: Do not have cached data!"); + dbgln<PROCFS_DEBUG>("ProcFS: Do not have cached data!"); return -EIO; } @@ -1204,7 +1204,7 @@ InodeIdentifier ProcFS::ProcFSDirectoryEntry::identifier(unsigned fsid) const KResult ProcFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntryView&)> callback) const { - dbgln<debug_procfs>("ProcFS: traverse_as_directory {}", index()); + dbgln<PROCFS_DEBUG>("ProcFS: traverse_as_directory {}", index()); if (!Kernel::is_directory(identifier())) return ENOTDIR; diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp index b62f620550..549b72f43c 100644 --- a/Kernel/FileSystem/VirtualFileSystem.cpp +++ b/Kernel/FileSystem/VirtualFileSystem.cpp @@ -400,7 +400,7 @@ KResultOr<NonnullRefPtr<FileDescription>> VFS::create(StringView path, int optio return EROFS; LexicalPath p(path); - dbgln<debug_vfs>("VFS::create: '{}' in {}", p.basename(), parent_inode.identifier()); + dbgln<VFS_DEBUG>("VFS::create: '{}' in {}", p.basename(), parent_inode.identifier()); uid_t uid = owner.has_value() ? owner.value().uid : current_process->euid(); gid_t gid = owner.has_value() ? owner.value().gid : current_process->egid(); auto inode_or_error = parent_inode.create_child(p.basename(), mode, 0, uid, gid); @@ -442,7 +442,7 @@ KResult VFS::mkdir(StringView path, mode_t mode, Custody& base) return EROFS; LexicalPath p(path); - dbgln<debug_vfs>("VFS::mkdir: '{}' in {}", p.basename(), parent_inode.identifier()); + dbgln<VFS_DEBUG>("VFS::mkdir: '{}' in {}", p.basename(), parent_inode.identifier()); return parent_inode.create_child(p.basename(), S_IFDIR | mode, 0, current_process->euid(), current_process->egid()).result(); } diff --git a/Kernel/FutexQueue.cpp b/Kernel/FutexQueue.cpp index d12435782a..4c89c2f015 100644 --- a/Kernel/FutexQueue.cpp +++ b/Kernel/FutexQueue.cpp @@ -36,7 +36,7 @@ bool FutexQueue::should_add_blocker(Thread::Blocker& b, void* data) ASSERT(m_lock.is_locked()); ASSERT(b.blocker_type() == Thread::Blocker::Type::Futex); - dbgln<debug_futex_queue>("FutexQueue @ {}: should block thread {}", this, *static_cast<Thread*>(data)); + dbgln<FUTEXQUEUE_DEBUG>("FutexQueue @ {}: should block thread {}", this, *static_cast<Thread*>(data)); return true; } @@ -46,7 +46,7 @@ u32 FutexQueue::wake_n_requeue(u32 wake_count, const Function<FutexQueue*()>& ge is_empty_target = false; ScopedSpinLock lock(m_lock); - dbgln<debug_futex_queue>("FutexQueue @ {}: wake_n_requeue({}, {})", this, wake_count, requeue_count); + dbgln<FUTEXQUEUE_DEBUG>("FutexQueue @ {}: wake_n_requeue({}, {})", this, wake_count, requeue_count); u32 did_wake = 0, did_requeue = 0; do_unblock([&](Thread::Blocker& b, void* data, bool& stop_iterating) { @@ -54,7 +54,7 @@ u32 FutexQueue::wake_n_requeue(u32 wake_count, const Function<FutexQueue*()>& ge ASSERT(b.blocker_type() == Thread::Blocker::Type::Futex); auto& blocker = static_cast<Thread::FutexBlocker&>(b); - dbgln<debug_futex_queue>("FutexQueue @ {}: wake_n_requeue unblocking {}", this, *static_cast<Thread*>(data)); + dbgln<FUTEXQUEUE_DEBUG>("FutexQueue @ {}: wake_n_requeue unblocking {}", this, *static_cast<Thread*>(data)); ASSERT(did_wake < wake_count); if (blocker.unblock()) { if (++did_wake >= wake_count) @@ -68,7 +68,7 @@ u32 FutexQueue::wake_n_requeue(u32 wake_count, const Function<FutexQueue*()>& ge auto blockers_to_requeue = do_take_blockers(requeue_count); if (!blockers_to_requeue.is_empty()) { if (auto* target_futex_queue = get_target_queue()) { - dbgln<debug_futex_queue>("FutexQueue @ {}: wake_n_requeue requeueing {} blockers to {}", this, blockers_to_requeue.size(), target_futex_queue); + dbgln<FUTEXQUEUE_DEBUG>("FutexQueue @ {}: wake_n_requeue requeueing {} blockers to {}", this, blockers_to_requeue.size(), target_futex_queue); // While still holding m_lock, notify each blocker for (auto& info : blockers_to_requeue) { @@ -91,7 +91,7 @@ u32 FutexQueue::wake_n_requeue(u32 wake_count, const Function<FutexQueue*()>& ge target_futex_queue->do_append_blockers(move(blockers_to_requeue)); is_empty_target = target_futex_queue->is_empty_locked(); } else { - dbgln<debug_futex_queue>("FutexQueue @ {}: wake_n_requeue could not get target queue to requeue {} blockers", this, blockers_to_requeue.size()); + dbgln<FUTEXQUEUE_DEBUG>("FutexQueue @ {}: wake_n_requeue could not get target queue to requeue {} blockers", this, blockers_to_requeue.size()); do_append_blockers(move(blockers_to_requeue)); } } @@ -104,14 +104,14 @@ u32 FutexQueue::wake_n(u32 wake_count, const Optional<u32>& bitset, bool& is_emp if (wake_count == 0) return 0; // should we assert instead? ScopedSpinLock lock(m_lock); - dbgln<debug_futex_queue>("FutexQueue @ {}: wake_n({})", this, wake_count); + dbgln<FUTEXQUEUE_DEBUG>("FutexQueue @ {}: wake_n({})", this, wake_count); u32 did_wake = 0; do_unblock([&](Thread::Blocker& b, void* data, bool& stop_iterating) { ASSERT(data); ASSERT(b.blocker_type() == Thread::Blocker::Type::Futex); auto& blocker = static_cast<Thread::FutexBlocker&>(b); - dbgln<debug_futex_queue>("FutexQueue @ {}: wake_n unblocking {}", this, *static_cast<Thread*>(data)); + dbgln<FUTEXQUEUE_DEBUG>("FutexQueue @ {}: wake_n unblocking {}", this, *static_cast<Thread*>(data)); ASSERT(did_wake < wake_count); if (bitset.has_value() ? blocker.unblock_bitset(bitset.value()) : blocker.unblock()) { if (++did_wake >= wake_count) @@ -127,13 +127,13 @@ u32 FutexQueue::wake_n(u32 wake_count, const Optional<u32>& bitset, bool& is_emp u32 FutexQueue::wake_all(bool& is_empty) { ScopedSpinLock lock(m_lock); - dbgln<debug_futex_queue>("FutexQueue @ {}: wake_all", this); + dbgln<FUTEXQUEUE_DEBUG>("FutexQueue @ {}: wake_all", this); u32 did_wake = 0; do_unblock([&](Thread::Blocker& b, void* data, bool&) { ASSERT(data); ASSERT(b.blocker_type() == Thread::Blocker::Type::Futex); auto& blocker = static_cast<Thread::FutexBlocker&>(b); - dbgln<debug_futex_queue>("FutexQueue @ {}: wake_all unblocking", this, *static_cast<Thread*>(data)); + dbgln<FUTEXQUEUE_DEBUG>("FutexQueue @ {}: wake_all unblocking", this, *static_cast<Thread*>(data)); if (blocker.unblock(true)) { did_wake++; return true; diff --git a/Kernel/Interrupts/IOAPIC.cpp b/Kernel/Interrupts/IOAPIC.cpp index 980c0fb444..195bc0acb7 100644 --- a/Kernel/Interrupts/IOAPIC.cpp +++ b/Kernel/Interrupts/IOAPIC.cpp @@ -201,12 +201,12 @@ void IOAPIC::configure_redirection_entry(int index, u8 interrupt_vector, u8 deli u32 redirection_entry2 = destination << 24; write_register((index << 1) + IOAPIC_REDIRECTION_ENTRY_OFFSET, redirection_entry1); - if constexpr (debug_ioapic) + if constexpr (IOAPIC_DEBUG) dbgln("IOAPIC Value: {:#x}", read_register((index << 1) + IOAPIC_REDIRECTION_ENTRY_OFFSET)); write_register((index << 1) + IOAPIC_REDIRECTION_ENTRY_OFFSET + 1, redirection_entry2); - if constexpr (debug_ioapic) + if constexpr (IOAPIC_DEBUG) dbgln("IOAPIC Value: {:#x}", read_register((index << 1) + 0x11)); } @@ -320,13 +320,13 @@ void IOAPIC::write_register(u32 index, u32 value) const m_regs->select = index; m_regs->window = value; - dbgln<debug_ioapic>("IOAPIC Writing, Value {:#x} @ offset {:#x}", (u32)m_regs->window, (u32)m_regs->select); + dbgln<IOAPIC_DEBUG>("IOAPIC Writing, Value {:#x} @ offset {:#x}", (u32)m_regs->window, (u32)m_regs->select); } u32 IOAPIC::read_register(u32 index) const { InterruptDisabler disabler; m_regs->select = index; - dbgln<debug_ioapic>("IOAPIC Reading, Value {:#x} @ offset {:#x}", (u32)m_regs->window, (u32)m_regs->select); + dbgln<IOAPIC_DEBUG>("IOAPIC Reading, Value {:#x} @ offset {:#x}", (u32)m_regs->window, (u32)m_regs->select); return m_regs->window; } diff --git a/Kernel/Interrupts/IRQHandler.cpp b/Kernel/Interrupts/IRQHandler.cpp index e764fe7c37..620c4e9767 100644 --- a/Kernel/Interrupts/IRQHandler.cpp +++ b/Kernel/Interrupts/IRQHandler.cpp @@ -44,7 +44,7 @@ IRQHandler::~IRQHandler() bool IRQHandler::eoi() { - dbgln<debug_irq>("EOI IRQ {}", interrupt_number()); + dbgln<IRQ_DEBUG>("EOI IRQ {}", interrupt_number()); if (!m_shared_with_others) { ASSERT(!m_responsible_irq_controller.is_null()); m_responsible_irq_controller->eoi(*this); @@ -55,7 +55,7 @@ bool IRQHandler::eoi() void IRQHandler::enable_irq() { - dbgln<debug_irq>("Enable IRQ {}", interrupt_number()); + dbgln<IRQ_DEBUG>("Enable IRQ {}", interrupt_number()); m_enabled = true; if (!m_shared_with_others) m_responsible_irq_controller->enable(*this); @@ -63,7 +63,7 @@ void IRQHandler::enable_irq() void IRQHandler::disable_irq() { - dbgln<debug_irq>("Disable IRQ {}", interrupt_number()); + dbgln<IRQ_DEBUG>("Disable IRQ {}", interrupt_number()); m_enabled = false; if (!m_shared_with_others) m_responsible_irq_controller->disable(*this); diff --git a/Kernel/Interrupts/SharedIRQHandler.cpp b/Kernel/Interrupts/SharedIRQHandler.cpp index 465596cad8..5d327849f0 100644 --- a/Kernel/Interrupts/SharedIRQHandler.cpp +++ b/Kernel/Interrupts/SharedIRQHandler.cpp @@ -59,7 +59,7 @@ void SharedIRQHandler::unregister_handler(GenericInterruptHandler& handler) bool SharedIRQHandler::eoi() { - dbgln<debug_interrupt>("EOI IRQ {}", interrupt_number()); + dbgln<INTERRUPT_DEBUG>("EOI IRQ {}", interrupt_number()); m_responsible_irq_controller->eoi(*this); return true; } @@ -86,18 +86,18 @@ void SharedIRQHandler::handle_interrupt(const RegisterState& regs) { ASSERT_INTERRUPTS_DISABLED(); - if constexpr (debug_interrupt) { + if constexpr (INTERRUPT_DEBUG) { dbgln("Interrupt @ {}", interrupt_number()); dbgln("Interrupt Handlers registered - {}", m_handlers.size()); } int i = 0; for (auto* handler : m_handlers) { - dbgln<debug_interrupt>("Going for Interrupt Handling @ {}, Shared Interrupt {}", i, interrupt_number()); + dbgln<INTERRUPT_DEBUG>("Going for Interrupt Handling @ {}, Shared Interrupt {}", i, interrupt_number()); ASSERT(handler != nullptr); handler->increment_invoking_counter(); handler->handle_interrupt(regs); - dbgln<debug_interrupt>("Going for Interrupt Handling @ {}, Shared Interrupt {} - End", i, interrupt_number()); + dbgln<INTERRUPT_DEBUG>("Going for Interrupt Handling @ {}, Shared Interrupt {} - End", i, interrupt_number()); i++; } } diff --git a/Kernel/Lock.cpp b/Kernel/Lock.cpp index 602541d517..216d7567fc 100644 --- a/Kernel/Lock.cpp +++ b/Kernel/Lock.cpp @@ -56,7 +56,7 @@ void Lock::lock(Mode mode) Mode current_mode = m_mode; switch (current_mode) { case Mode::Unlocked: { - dbgln<debug_lock_trace>("Lock::lock @ {}: acquire {}, currently unlocked", this, mode_to_string(mode)); + dbgln<LOCK_TRACE_DEBUG>("Lock::lock @ {}: acquire {}, currently unlocked", this, mode_to_string(mode)); m_mode = mode; ASSERT(!m_holder); ASSERT(m_shared_holders.is_empty()); @@ -80,7 +80,7 @@ void Lock::lock(Mode mode) break; ASSERT(m_shared_holders.is_empty()); - if constexpr (debug_lock_trace) { + if constexpr (LOCK_TRACE_DEBUG) { if (mode == Mode::Exclusive) dbgln("Lock::lock @ {}: acquire {}, currently exclusive, holding: {}", this, mode_to_string(mode), m_times_locked); else @@ -101,7 +101,7 @@ void Lock::lock(Mode mode) if (mode != Mode::Shared) break; - dbgln<debug_lock_trace>("Lock::lock @ {}: acquire {}, currently shared, locks held {}", this, mode_to_string(mode), m_times_locked); + dbgln<LOCK_TRACE_DEBUG>("Lock::lock @ {}: acquire {}, currently shared, locks held {}", this, mode_to_string(mode), m_times_locked); ASSERT(m_times_locked > 0); m_times_locked++; @@ -139,7 +139,7 @@ void Lock::unlock() for (;;) { if (m_lock.exchange(true, AK::memory_order_acq_rel) == false) { Mode current_mode = m_mode; - if constexpr (debug_lock_trace) { + if constexpr (LOCK_TRACE_DEBUG) { if (current_mode == Mode::Shared) dbgln("Lock::unlock @ {}: release {}, locks held: {}", this, mode_to_string(current_mode), m_times_locked); else @@ -211,7 +211,7 @@ auto Lock::force_unlock_if_locked(u32& lock_count_to_restore) -> Mode return Mode::Unlocked; } - dbgln<debug_lock_restore>("Lock::force_unlock_if_locked @ {}: unlocking exclusive with lock count: {}", this, m_times_locked); + dbgln<LOCK_RESTORE_DEBUG>("Lock::force_unlock_if_locked @ {}: unlocking exclusive with lock count: {}", this, m_times_locked); m_holder = nullptr; ASSERT(m_times_locked > 0); @@ -234,7 +234,7 @@ auto Lock::force_unlock_if_locked(u32& lock_count_to_restore) -> Mode return Mode::Unlocked; } - dbgln<debug_lock_restore>("Lock::force_unlock_if_locked @ {}: unlocking exclusive with lock count: {}, total locks: {}", + dbgln<LOCK_RESTORE_DEBUG>("Lock::force_unlock_if_locked @ {}: unlocking exclusive with lock count: {}, total locks: {}", this, it->value, m_times_locked); ASSERT(it->value > 0); @@ -293,7 +293,7 @@ void Lock::restore_lock(Mode mode, u32 lock_count) if (!m_mode.compare_exchange_strong(expected_mode, Mode::Exclusive)) break; - dbgln<debug_lock_restore>("Lock::restore_lock @ {}: restoring {} with lock count {}, was unlocked", this, mode_to_string(mode), lock_count); + dbgln<LOCK_RESTORE_DEBUG>("Lock::restore_lock @ {}: restoring {} with lock count {}, was unlocked", this, mode_to_string(mode), lock_count); ASSERT(m_times_locked == 0); m_times_locked = lock_count; @@ -311,7 +311,7 @@ void Lock::restore_lock(Mode mode, u32 lock_count) if (!m_mode.compare_exchange_strong(expected_mode, Mode::Shared) && expected_mode != Mode::Shared) break; - dbgln<debug_lock_restore>("Lock::restore_lock @ {}: restoring {} with lock count {}, was {}", + dbgln<LOCK_RESTORE_DEBUG>("Lock::restore_lock @ {}: restoring {} with lock count {}, was {}", this, mode_to_string(mode), lock_count, mode_to_string(expected_mode)); ASSERT(expected_mode == Mode::Shared || m_times_locked == 0); diff --git a/Kernel/Net/E1000NetworkAdapter.cpp b/Kernel/Net/E1000NetworkAdapter.cpp index 4bfc195f0d..456cbfec42 100644 --- a/Kernel/Net/E1000NetworkAdapter.cpp +++ b/Kernel/Net/E1000NetworkAdapter.cpp @@ -362,7 +362,7 @@ void E1000NetworkAdapter::initialize_tx_descriptors() void E1000NetworkAdapter::out8(u16 address, u8 data) { - dbgln<debug_e1000>("E1000: OUT8 {:#02x} @ {:#04x}", data, address); + dbgln<E1000_DEBUG>("E1000: OUT8 {:#02x} @ {:#04x}", data, address); if (m_use_mmio) { auto* ptr = (volatile u8*)(m_mmio_base.get() + address); *ptr = data; @@ -373,7 +373,7 @@ void E1000NetworkAdapter::out8(u16 address, u8 data) void E1000NetworkAdapter::out16(u16 address, u16 data) { - dbgln<debug_e1000>("E1000: OUT16 {:#04x} @ {:#04x}", data, address); + dbgln<E1000_DEBUG>("E1000: OUT16 {:#04x} @ {:#04x}", data, address); if (m_use_mmio) { auto* ptr = (volatile u16*)(m_mmio_base.get() + address); *ptr = data; @@ -384,7 +384,7 @@ void E1000NetworkAdapter::out16(u16 address, u16 data) void E1000NetworkAdapter::out32(u16 address, u32 data) { - dbgln<debug_e1000>("E1000: OUT32 {:#08x} @ {:#04x}", data, address); + dbgln<E1000_DEBUG>("E1000: OUT32 {:#08x} @ {:#04x}", data, address); if (m_use_mmio) { auto* ptr = (volatile u32*)(m_mmio_base.get() + address); *ptr = data; @@ -395,7 +395,7 @@ void E1000NetworkAdapter::out32(u16 address, u32 data) u8 E1000NetworkAdapter::in8(u16 address) { - dbgln<debug_e1000>("E1000: IN8 @ {:#04x}", address); + dbgln<E1000_DEBUG>("E1000: IN8 @ {:#04x}", address); if (m_use_mmio) return *(volatile u8*)(m_mmio_base.get() + address); return m_io_base.offset(address).in<u8>(); @@ -403,7 +403,7 @@ u8 E1000NetworkAdapter::in8(u16 address) u16 E1000NetworkAdapter::in16(u16 address) { - dbgln<debug_e1000>("E1000: IN16 @ {:#04x}", address); + dbgln<E1000_DEBUG>("E1000: IN16 @ {:#04x}", address); if (m_use_mmio) return *(volatile u16*)(m_mmio_base.get() + address); return m_io_base.offset(address).in<u16>(); @@ -411,7 +411,7 @@ u16 E1000NetworkAdapter::in16(u16 address) u32 E1000NetworkAdapter::in32(u16 address) { - dbgln<debug_e1000>("E1000: IN32 @ {:#04x}", address); + dbgln<E1000_DEBUG>("E1000: IN32 @ {:#04x}", address); if (m_use_mmio) return *(volatile u32*)(m_mmio_base.get() + address); return m_io_base.offset(address).in<u32>(); diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp index ecb5bf596f..38d5bce0f9 100644 --- a/Kernel/Net/IPv4Socket.cpp +++ b/Kernel/Net/IPv4Socket.cpp @@ -66,7 +66,7 @@ KResultOr<NonnullRefPtr<Socket>> IPv4Socket::create(int type, int protocol) IPv4Socket::IPv4Socket(int type, int protocol) : Socket(AF_INET, type, protocol) { - dbgln<debug_ipv4_socket>("IPv4Socket({}) created with type={}, protocol={}", this, type, protocol); + dbgln<IPV4_SOCKET_DEBUG>("IPv4Socket({}) created with type={}, protocol={}", this, type, protocol); m_buffer_mode = type == SOCK_STREAM ? BufferMode::Bytes : BufferMode::Packets; if (m_buffer_mode == BufferMode::Bytes) { m_scratch_buffer = KBuffer::create_with_size(65536); @@ -119,7 +119,7 @@ KResult IPv4Socket::bind(Userspace<const sockaddr*> user_address, socklen_t addr m_local_address = IPv4Address((const u8*)&address.sin_addr.s_addr); m_local_port = requested_local_port; - dbgln<debug_ipv4_socket>("IPv4Socket::bind {}({}) to {}:{}", class_name(), this, m_local_address, m_local_port); + dbgln<IPV4_SOCKET_DEBUG>("IPv4Socket::bind {}({}) to {}:{}", class_name(), this, m_local_address, m_local_port); return protocol_bind(); } @@ -135,7 +135,7 @@ KResult IPv4Socket::listen(size_t backlog) m_role = Role::Listener; evaluate_block_conditions(); - dbgln<debug_ipv4_socket>("IPv4Socket({}) listening with backlog={}", this, backlog); + dbgln<IPV4_SOCKET_DEBUG>("IPv4Socket({}) listening with backlog={}", this, backlog); return protocol_listen(); } @@ -287,7 +287,7 @@ KResultOr<size_t> IPv4Socket::receive_packet_buffered(FileDescription& descripti packet = m_receive_queue.take_first(); set_can_read(!m_receive_queue.is_empty()); - dbgln<debug_ipv4_socket>("IPv4Socket({}): recvfrom without blocking {} bytes, packets in queue: {}", + dbgln<IPV4_SOCKET_DEBUG>("IPv4Socket({}): recvfrom without blocking {} bytes, packets in queue: {}", this, packet.data.value().size(), m_receive_queue.size()); @@ -316,7 +316,7 @@ KResultOr<size_t> IPv4Socket::receive_packet_buffered(FileDescription& descripti packet = m_receive_queue.take_first(); set_can_read(!m_receive_queue.is_empty()); - dbgln<debug_ipv4_socket>("IPv4Socket({}): recvfrom with blocking {} bytes, packets in queue: {}", + dbgln<IPV4_SOCKET_DEBUG>("IPv4Socket({}): recvfrom with blocking {} bytes, packets in queue: {}", this, packet.data.value().size(), m_receive_queue.size()); @@ -326,7 +326,7 @@ KResultOr<size_t> IPv4Socket::receive_packet_buffered(FileDescription& descripti packet_timestamp = packet.timestamp; if (addr) { - dbgln<debug_ipv4_socket>("Incoming packet is from: {}:{}", packet.peer_address, packet.peer_port); + dbgln<IPV4_SOCKET_DEBUG>("Incoming packet is from: {}:{}", packet.peer_address, packet.peer_port); sockaddr_in out_addr {}; memcpy(&out_addr.sin_addr, &packet.peer_address, sizeof(IPv4Address)); @@ -411,7 +411,7 @@ bool IPv4Socket::did_receive(const IPv4Address& source_address, u16 source_port, } m_bytes_received += packet_size; - if constexpr (debug_ipv4_socket) { + if constexpr (IPV4_SOCKET_DEBUG) { if (buffer_mode() == BufferMode::Bytes) dbgln("IPv4Socket({}): did_receive {} bytes, total_received={}", this, packet_size, m_bytes_received); else diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index 77db2528f3..6d604d9833 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -74,7 +74,7 @@ LocalSocket::LocalSocket(int type) evaluate_block_conditions(); }); - dbgln<debug_local_socket>("LocalSocket({}) created with type={}", this, type); + dbgln<LOCAL_SOCKET_DEBUG>("LocalSocket({}) created with type={}", this, type); } LocalSocket::~LocalSocket() @@ -110,7 +110,7 @@ KResult LocalSocket::bind(Userspace<const sockaddr*> user_address, socklen_t add auto path = String(address.sun_path, strnlen(address.sun_path, sizeof(address.sun_path))); - dbgln<debug_local_socket>("LocalSocket({}) bind({})", this, path); + dbgln<LOCAL_SOCKET_DEBUG>("LocalSocket({}) bind({})", this, path); mode_t mode = S_IFSOCK | (m_prebind_mode & 0777); UidAndGid owner { m_prebind_uid, m_prebind_gid }; @@ -154,7 +154,7 @@ KResult LocalSocket::connect(FileDescription& description, Userspace<const socka return EFAULT; safe_address[sizeof(safe_address) - 1] = '\0'; - dbgln<debug_local_socket>("LocalSocket({}) connect({})", this, safe_address); + dbgln<LOCAL_SOCKET_DEBUG>("LocalSocket({}) connect({})", this, safe_address); auto description_or_error = VFS::the().open(safe_address, O_RDWR, 0, Process::current()->current_directory()); if (description_or_error.is_error()) @@ -190,7 +190,7 @@ KResult LocalSocket::connect(FileDescription& description, Userspace<const socka return EINTR; } - dbgln<debug_local_socket>("LocalSocket({}) connect({}) status is {}", this, safe_address, to_string(setup_state())); + dbgln<LOCAL_SOCKET_DEBUG>("LocalSocket({}) connect({}) status is {}", this, safe_address, to_string(setup_state())); if (!((u32)unblock_flags & (u32)Thread::FileDescriptionBlocker::BlockFlags::Connect)) { set_connect_side_role(Role::None); @@ -210,7 +210,7 @@ KResult LocalSocket::listen(size_t backlog) m_role = Role::Listener; set_connect_side_role(Role::Listener, previous_role != m_role); - dbgln<debug_local_socket>("LocalSocket({}) listening with backlog={}", this, backlog); + dbgln<LOCAL_SOCKET_DEBUG>("LocalSocket({}) listening with backlog={}", this, backlog); return KSuccess; } diff --git a/Kernel/Net/Socket.cpp b/Kernel/Net/Socket.cpp index bacc5bb7e2..2b561cb233 100644 --- a/Kernel/Net/Socket.cpp +++ b/Kernel/Net/Socket.cpp @@ -64,7 +64,7 @@ Socket::~Socket() void Socket::set_setup_state(SetupState new_setup_state) { - dbgln<debug_socket>("Socket({}) setup state moving from {} to {}", this, to_string(m_setup_state), to_string(new_setup_state)); + dbgln<SOCKET_DEBUG>("Socket({}) setup state moving from {} to {}", this, to_string(m_setup_state), to_string(new_setup_state)); m_setup_state = new_setup_state; evaluate_block_conditions(); } @@ -74,7 +74,7 @@ RefPtr<Socket> Socket::accept() LOCKER(m_lock); if (m_pending.is_empty()) return nullptr; - dbgln<debug_socket>("Socket({}) de-queueing connection", this); + dbgln<SOCKET_DEBUG>("Socket({}) de-queueing connection", this); auto client = m_pending.take_first(); ASSERT(!client->is_connected()); auto& process = *Process::current(); @@ -88,7 +88,7 @@ RefPtr<Socket> Socket::accept() KResult Socket::queue_connection_from(NonnullRefPtr<Socket> peer) { - dbgln<debug_socket>("Socket({}) queueing connection", this); + dbgln<SOCKET_DEBUG>("Socket({}) queueing connection", this); LOCKER(m_lock); if (m_pending.size() >= m_backlog) return ECONNREFUSED; diff --git a/Kernel/Net/TCPSocket.cpp b/Kernel/Net/TCPSocket.cpp index 20714b7e13..c61e4dcbdd 100644 --- a/Kernel/Net/TCPSocket.cpp +++ b/Kernel/Net/TCPSocket.cpp @@ -47,7 +47,7 @@ void TCPSocket::for_each(Function<void(const TCPSocket&)> callback) void TCPSocket::set_state(State new_state) { - dbgln<debug_tcp_socket>("TCPSocket({}) state moving from {} to {}", this, to_string(m_state), to_string(new_state)); + dbgln<TCP_SOCKET_DEBUG>("TCPSocket({}) state moving from {} to {}", this, to_string(m_state), to_string(new_state)); auto was_disconnected = protocol_is_disconnected(); auto previous_role = m_role; @@ -154,7 +154,7 @@ TCPSocket::~TCPSocket() LOCKER(sockets_by_tuple().lock()); sockets_by_tuple().resource().remove(tuple()); - dbgln<debug_tcp_socket>("~TCPSocket in state {}", to_string(state())); + dbgln<TCP_SOCKET_DEBUG>("~TCPSocket in state {}", to_string(state())); } NonnullRefPtr<TCPSocket> TCPSocket::create(int protocol) @@ -273,14 +273,14 @@ void TCPSocket::receive_tcp_packet(const TCPPacket& packet, u16 size) if (packet.has_ack()) { u32 ack_number = packet.ack_number(); - dbgln<debug_tcp_socket>("TCPSocket: receive_tcp_packet: {}", ack_number); + dbgln<TCP_SOCKET_DEBUG>("TCPSocket: receive_tcp_packet: {}", ack_number); int removed = 0; LOCKER(m_not_acked_lock); while (!m_not_acked.is_empty()) { auto& packet = m_not_acked.first(); - dbgln<debug_tcp_socket>("TCPSocket: iterate: {}", packet.ack_number); + dbgln<TCP_SOCKET_DEBUG>("TCPSocket: iterate: {}", packet.ack_number); if (packet.ack_number <= ack_number) { m_not_acked.take_first(); @@ -290,7 +290,7 @@ void TCPSocket::receive_tcp_packet(const TCPPacket& packet, u16 size) } } - dbgln<debug_tcp_socket>("TCPSocket: receive_tcp_packet acknowledged {} packets", removed); + dbgln<TCP_SOCKET_DEBUG>("TCPSocket: receive_tcp_packet acknowledged {} packets", removed); } m_packets_in++; diff --git a/Kernel/PCI/Access.cpp b/Kernel/PCI/Access.cpp index d4e16fb78b..d9eeea1f44 100644 --- a/Kernel/PCI/Access.cpp +++ b/Kernel/PCI/Access.cpp @@ -74,34 +74,34 @@ PhysicalID Access::get_physical_id(Address address) const u8 Access::early_read8_field(Address address, u32 field) { - dbgln<debug_pci>("PCI: Early reading 8-bit field {:#08x} for {}", field, address); + dbgln<PCI_DEBUG>("PCI: Early reading 8-bit field {:#08x} for {}", field, address); IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field)); return IO::in8(PCI_VALUE_PORT + (field & 3)); } u16 Access::early_read16_field(Address address, u32 field) { - dbgln<debug_pci>("PCI: Early reading 16-bit field {:#08x} for {}", field, address); + dbgln<PCI_DEBUG>("PCI: Early reading 16-bit field {:#08x} for {}", field, address); IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field)); return IO::in16(PCI_VALUE_PORT + (field & 2)); } u32 Access::early_read32_field(Address address, u32 field) { - dbgln<debug_pci>("PCI: Early reading 32-bit field {:#08x} for {}", field, address); + dbgln<PCI_DEBUG>("PCI: Early reading 32-bit field {:#08x} for {}", field, address); IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field)); return IO::in32(PCI_VALUE_PORT); } u16 Access::early_read_type(Address address) { - dbgln<debug_pci>("PCI: Early reading type for {}", address); + dbgln<PCI_DEBUG>("PCI: Early reading type for {}", address); return (early_read8_field(address, PCI_CLASS) << 8u) | early_read8_field(address, PCI_SUBCLASS); } void Access::enumerate_functions(int type, u8 bus, u8 slot, u8 function, Function<void(Address, ID)>& callback) { - dbgln<debug_pci>("PCI: Enumerating function type={}, bus={}, slot={}, function={}", type, bus, slot, function); + dbgln<PCI_DEBUG>("PCI: Enumerating function type={}, bus={}, slot={}, function={}", type, bus, slot, function); Address address(0, bus, slot, function); if (type == -1 || type == early_read_type(address)) callback(address, { early_read16_field(address, PCI_VENDOR_ID), early_read16_field(address, PCI_DEVICE_ID) }); @@ -117,7 +117,7 @@ void Access::enumerate_functions(int type, u8 bus, u8 slot, u8 function, Functio void Access::enumerate_slot(int type, u8 bus, u8 slot, Function<void(Address, ID)>& callback) { - dbgln<debug_pci>("PCI: Enumerating slot type={}, bus={}, slot={}", type, bus, slot); + dbgln<PCI_DEBUG>("PCI: Enumerating slot type={}, bus={}, slot={}", type, bus, slot); Address address(0, bus, slot, 0); if (early_read16_field(address, PCI_VENDOR_ID) == PCI_NONE) return; @@ -133,7 +133,7 @@ void Access::enumerate_slot(int type, u8 bus, u8 slot, Function<void(Address, ID void Access::enumerate_bus(int type, u8 bus, Function<void(Address, ID)>& callback) { - dbgln<debug_pci>("PCI: Enumerating bus type={}, bus={}", type, bus); + dbgln<PCI_DEBUG>("PCI: Enumerating bus type={}, bus={}", type, bus); for (u8 slot = 0; slot < 32; ++slot) enumerate_slot(type, bus, slot, callback); } @@ -152,12 +152,12 @@ void enumerate(Function<void(Address, ID)> callback) Optional<u8> get_capabilities_pointer(Address address) { - dbgln<debug_pci>("PCI: Getting capabilities pointer for {}", address); + dbgln<PCI_DEBUG>("PCI: Getting capabilities pointer for {}", address); if (PCI::read16(address, PCI_STATUS) & (1 << 4)) { - dbgln<debug_pci>("PCI: Found capabilities pointer for {}", address); + dbgln<PCI_DEBUG>("PCI: Found capabilities pointer for {}", address); return PCI::read8(address, PCI_CAPABILITIES_POINTER); } - dbgln<debug_pci>("PCI: No capabilities pointer for {}", address); + dbgln<PCI_DEBUG>("PCI: No capabilities pointer for {}", address); return {}; } @@ -168,16 +168,16 @@ PhysicalID get_physical_id(Address address) Vector<Capability> get_capabilities(Address address) { - dbgln<debug_pci>("PCI: Getting capabilities for {}", address); + dbgln<PCI_DEBUG>("PCI: Getting capabilities for {}", address); auto capabilities_pointer = PCI::get_capabilities_pointer(address); if (!capabilities_pointer.has_value()) { - dbgln<debug_pci>("PCI: No capabilities for {}", address); + dbgln<PCI_DEBUG>("PCI: No capabilities for {}", address); return {}; } Vector<Capability> capabilities; auto capability_pointer = capabilities_pointer.value(); while (capability_pointer != 0) { - dbgln<debug_pci>("PCI: Reading in capability at {:#02x} for {}", capability_pointer, address); + dbgln<PCI_DEBUG>("PCI: Reading in capability at {:#02x} for {}", capability_pointer, address); u16 capability_header = PCI::read16(address, capability_pointer); u8 capability_id = capability_header & 0xff; capability_pointer = capability_header >> 8; diff --git a/Kernel/PCI/Definitions.h b/Kernel/PCI/Definitions.h index 4f823a1874..a3be8b7d71 100644 --- a/Kernel/PCI/Definitions.h +++ b/Kernel/PCI/Definitions.h @@ -194,7 +194,7 @@ public: , m_id(id) , m_capabilities(capabilities) { - if constexpr (debug_pci) { + if constexpr (PCI_DEBUG) { for (auto capability : capabilities) dbgln("{} has capability {}", address, capability.m_id); } diff --git a/Kernel/PCI/IOAccess.cpp b/Kernel/PCI/IOAccess.cpp index 73ac6a8413..8e67cf5f0b 100644 --- a/Kernel/PCI/IOAccess.cpp +++ b/Kernel/PCI/IOAccess.cpp @@ -35,7 +35,7 @@ void IOAccess::initialize() { if (!Access::is_initialized()) { new IOAccess(); - dbgln<debug_pci>("PCI: IO access initialised."); + dbgln<PCI_DEBUG>("PCI: IO access initialised."); } } @@ -49,37 +49,37 @@ IOAccess::IOAccess() u8 IOAccess::read8_field(Address address, u32 field) { - dbgln<debug_pci>("PCI: IO Reading 8-bit field {:#08x} for {}", field, address); + dbgln<PCI_DEBUG>("PCI: IO Reading 8-bit field {:#08x} for {}", field, address); return Access::early_read8_field(address, field); } u16 IOAccess::read16_field(Address address, u32 field) { - dbgln<debug_pci>("PCI: IO Reading 16-bit field {:#08x} for {}", field, address); + dbgln<PCI_DEBUG>("PCI: IO Reading 16-bit field {:#08x} for {}", field, address); return Access::early_read16_field(address, field); } u32 IOAccess::read32_field(Address address, u32 field) { - dbgln<debug_pci>("PCI: IO Reading 32-bit field {:#08x} for {}", field, address); + dbgln<PCI_DEBUG>("PCI: IO Reading 32-bit field {:#08x} for {}", field, address); return Access::early_read32_field(address, field); } void IOAccess::write8_field(Address address, u32 field, u8 value) { - dbgln<debug_pci>("PCI: IO Writing to 8-bit field {:#08x}, value={:#02x} for {}", field, value, address); + dbgln<PCI_DEBUG>("PCI: IO Writing to 8-bit field {:#08x}, value={:#02x} for {}", field, value, address); IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field)); IO::out8(PCI_VALUE_PORT + (field & 3), value); } void IOAccess::write16_field(Address address, u32 field, u16 value) { - dbgln<debug_pci>("PCI: IO Writing to 16-bit field {:#08x}, value={:#02x} for {}", field, value, address); + dbgln<PCI_DEBUG>("PCI: IO Writing to 16-bit field {:#08x}, value={:#02x} for {}", field, value, address); IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field)); IO::out16(PCI_VALUE_PORT + (field & 2), value); } void IOAccess::write32_field(Address address, u32 field, u32 value) { - dbgln<debug_pci>("PCI: IO Writing to 32-bit field {:#08x}, value={:#02x} for {}", field, value, address); + dbgln<PCI_DEBUG>("PCI: IO Writing to 32-bit field {:#08x}, value={:#02x} for {}", field, value, address); IO::out32(PCI_ADDRESS_PORT, address.io_address_for_field(field)); IO::out32(PCI_VALUE_PORT, value); } diff --git a/Kernel/PCI/MMIOAccess.cpp b/Kernel/PCI/MMIOAccess.cpp index 11844d39bd..b91f51ed61 100644 --- a/Kernel/PCI/MMIOAccess.cpp +++ b/Kernel/PCI/MMIOAccess.cpp @@ -109,7 +109,7 @@ MMIOAccess::MMIOAccess(PhysicalAddress p_mcfg) auto mcfg_region = MM.allocate_kernel_region(p_mcfg.page_base(), PAGE_ROUND_UP(length) + PAGE_SIZE, "PCI Parsing MCFG", Region::Access::Read | Region::Access::Write); auto& mcfg = *(ACPI::Structures::MCFG*)mcfg_region->vaddr().offset(p_mcfg.offset_in_page()).as_ptr(); - dbgln<debug_pci>("PCI: Checking MCFG @ {}, {}", VirtualAddress(&mcfg), PhysicalAddress(p_mcfg.get())); + dbgln<PCI_DEBUG>("PCI: Checking MCFG @ {}, {}", VirtualAddress(&mcfg), PhysicalAddress(p_mcfg.get())); for (u32 index = 0; index < ((mcfg.header.length - sizeof(ACPI::Structures::MCFG)) / sizeof(ACPI::Structures::PCI_MMIO_Descriptor)); index++) { u8 start_bus = mcfg.descriptors[index].start_pci_bus; @@ -127,26 +127,26 @@ MMIOAccess::MMIOAccess(PhysicalAddress p_mcfg) enumerate_hardware([&](const Address& address, ID id) { m_mapped_device_regions.append(make<DeviceConfigurationSpaceMapping>(address, m_segments.get(address.seg()).value())); m_physical_ids.append({ address, id, get_capabilities(address) }); - dbgln<debug_pci>("PCI: Mapping device @ pci ({}) {} {}", address, m_mapped_device_regions.last().vaddr(), m_mapped_device_regions.last().paddr()); + dbgln<PCI_DEBUG>("PCI: Mapping device @ pci ({}) {} {}", address, m_mapped_device_regions.last().vaddr(), m_mapped_device_regions.last().paddr()); }); } Optional<VirtualAddress> MMIOAccess::get_device_configuration_space(Address address) { - dbgln<debug_pci>("PCI: Getting device configuration space for {}", address); + dbgln<PCI_DEBUG>("PCI: Getting device configuration space for {}", address); for (auto& mapping : m_mapped_device_regions) { auto checked_address = mapping.address(); - dbgln<debug_pci>("PCI Device Configuration Space Mapping: Check if {} was requested", checked_address); + dbgln<PCI_DEBUG>("PCI Device Configuration Space Mapping: Check if {} was requested", checked_address); if (address.seg() == checked_address.seg() && address.bus() == checked_address.bus() && address.slot() == checked_address.slot() && address.function() == checked_address.function()) { - dbgln<debug_pci>("PCI Device Configuration Space Mapping: Found {}", checked_address); + dbgln<PCI_DEBUG>("PCI Device Configuration Space Mapping: Found {}", checked_address); return mapping.vaddr(); } } - dbgln<debug_pci>("PCI: No device configuration space found for {}", address); + dbgln<PCI_DEBUG>("PCI: No device configuration space found for {}", address); return {}; } @@ -154,7 +154,7 @@ u8 MMIOAccess::read8_field(Address address, u32 field) { InterruptDisabler disabler; ASSERT(field <= 0xfff); - dbgln<debug_pci>("PCI: MMIO Reading 8-bit field {:#08x} for {}", field, address); + dbgln<PCI_DEBUG>("PCI: MMIO Reading 8-bit field {:#08x} for {}", field, address); return *((u8*)(get_device_configuration_space(address).value().get() + (field & 0xfff))); } @@ -162,7 +162,7 @@ u16 MMIOAccess::read16_field(Address address, u32 field) { InterruptDisabler disabler; ASSERT(field < 0xfff); - dbgln<debug_pci>("PCI: MMIO Reading 16-bit field {:#08x} for {}", field, address); + dbgln<PCI_DEBUG>("PCI: MMIO Reading 16-bit field {:#08x} for {}", field, address); return *((u16*)(get_device_configuration_space(address).value().get() + (field & 0xfff))); } @@ -170,7 +170,7 @@ u32 MMIOAccess::read32_field(Address address, u32 field) { InterruptDisabler disabler; ASSERT(field <= 0xffc); - dbgln<debug_pci>("PCI: MMIO Reading 32-bit field {:#08x} for {}", field, address); + dbgln<PCI_DEBUG>("PCI: MMIO Reading 32-bit field {:#08x} for {}", field, address); return *((u32*)(get_device_configuration_space(address).value().get() + (field & 0xfff))); } @@ -178,28 +178,28 @@ void MMIOAccess::write8_field(Address address, u32 field, u8 value) { InterruptDisabler disabler; ASSERT(field <= 0xfff); - dbgln<debug_pci>("PCI: MMIO Writing 8-bit field {:#08x}, value={:#02x} for {}", field, value, address); + dbgln<PCI_DEBUG>("PCI: MMIO Writing 8-bit field {:#08x}, value={:#02x} for {}", field, value, address); *((u8*)(get_device_configuration_space(address).value().get() + (field & 0xfff))) = value; } void MMIOAccess::write16_field(Address address, u32 field, u16 value) { InterruptDisabler disabler; ASSERT(field < 0xfff); - dbgln<debug_pci>("PCI: MMIO Writing 16-bit field {:#08x}, value={:#02x} for {}", field, value, address); + dbgln<PCI_DEBUG>("PCI: MMIO Writing 16-bit field {:#08x}, value={:#02x} for {}", field, value, address); *((u16*)(get_device_configuration_space(address).value().get() + (field & 0xfff))) = value; } void MMIOAccess::write32_field(Address address, u32 field, u32 value) { InterruptDisabler disabler; ASSERT(field <= 0xffc); - dbgln<debug_pci>("PCI: MMIO Writing 32-bit field {:#08x}, value={:#02x} for {}", field, value, address); + dbgln<PCI_DEBUG>("PCI: MMIO Writing 32-bit field {:#08x}, value={:#02x} for {}", field, value, address); *((u32*)(get_device_configuration_space(address).value().get() + (field & 0xfff))) = value; } void MMIOAccess::enumerate_hardware(Function<void(Address, ID)> callback) { for (u16 seg = 0; seg < m_segments.size(); seg++) { - dbgln<debug_pci>("PCI: Enumerating Memory mapped IO segment {}", seg); + dbgln<PCI_DEBUG>("PCI: Enumerating Memory mapped IO segment {}", seg); // Single PCI host controller. if ((early_read8_field(Address(seg), PCI_HEADER_TYPE) & 0x80) == 0) { enumerate_bus(-1, 0, callback); diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 14c7b69bcc..ef6b9728f0 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -351,7 +351,7 @@ Process::Process(RefPtr<Thread>& first_thread, const String& name, uid_t uid, gi , m_ppid(ppid) , m_wait_block_condition(*this) { - dbgln<debug_process>("Created new process {}({})", m_name, m_pid.value()); + dbgln<PROCESS_DEBUG>("Created new process {}({})", m_name, m_pid.value()); m_page_directory = PageDirectory::create_for_userspace(*this, fork_parent ? &fork_parent->page_directory().range_allocator() : nullptr); @@ -615,7 +615,7 @@ void Process::finalize() { ASSERT(Thread::current() == g_finalizer); - dbgln<debug_process>("Finalizing process {}", *this); + dbgln<PROCESS_DEBUG>("Finalizing process {}", *this); if (is_dumpable()) { if (m_should_dump_core) diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index 05490139d5..30533328bf 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -129,13 +129,13 @@ bool Scheduler::pick_next() // Scheduler::enter_current because we don't want to allow it to // transition back to user mode. - if constexpr (debug_scheduler) + if constexpr (SCHEDULER_DEBUG) dbgln("Scheduler[{}]: Thread {} is dying", Processor::current().id(), *current_thread); current_thread->set_state(Thread::Dying); } - if constexpr (debug_scheduler_runnable) { + if constexpr (SCHEDULER_RUNNABLE_DEBUG) { dbgln("Scheduler[{}j]: Non-runnables:", Processor::current().id()); Scheduler::for_each_nonrunnable([&](Thread& thread) -> IterationDecision { if (thread.state() == Thread::Dying) { @@ -196,7 +196,7 @@ bool Scheduler::pick_next() // but since we're still holding the scheduler lock we're still in a critical section critical.leave(); - dbgln<debug_scheduler>("Processing pending donate to {} reason={}", *thread_to_schedule, reason); + dbgln<SCHEDULER_DEBUG>("Processing pending donate to {} reason={}", *thread_to_schedule, reason); return donate_to_and_switch(thread_to_schedule, reason); } @@ -224,7 +224,7 @@ bool Scheduler::pick_next() if (!thread_to_schedule) thread_to_schedule = Processor::current().idle_thread(); - if constexpr (debug_scheduler) { + if constexpr (SCHEDULER_DEBUG) { dbgln("Scheduler[{}]: Switch to {} @ {:04x}:{:08x}", Processor::current().id(), *thread_to_schedule, @@ -250,7 +250,7 @@ bool Scheduler::yield() scheduler_data.m_pending_donate_reason = nullptr; auto current_thread = Thread::current(); - dbgln<debug_scheduler>("Scheduler[{}]: yielding thread {} in_irq={}", proc.id(), *current_thread, proc.in_irq()); + dbgln<SCHEDULER_DEBUG>("Scheduler[{}]: yielding thread {} in_irq={}", proc.id(), *current_thread, proc.in_irq()); ASSERT(current_thread != nullptr); if (proc.in_irq() || proc.in_critical()) { // If we're handling an IRQ we can't switch context, or we're in @@ -263,7 +263,7 @@ bool Scheduler::yield() if (!Scheduler::pick_next()) return false; - if constexpr (debug_scheduler) + if constexpr (SCHEDULER_DEBUG) dbgln("Scheduler[{}]: yield returns to thread {} in_irq={}", Processor::current().id(), *current_thread, Processor::current().in_irq()); return true; } @@ -280,7 +280,7 @@ bool Scheduler::donate_to_and_switch(Thread* beneficiary, [[maybe_unused]] const return Scheduler::yield(); unsigned ticks_to_donate = min(ticks_left - 1, time_slice_for(*beneficiary)); - dbgln<debug_scheduler>("Scheduler[{}]: Donating {} ticks to {}, reason={}", proc.id(), ticks_to_donate, *beneficiary, reason); + dbgln<SCHEDULER_DEBUG>("Scheduler[{}]: Donating {} ticks to {}, reason={}", proc.id(), ticks_to_donate, *beneficiary, reason); beneficiary->set_ticks_left(ticks_to_donate); return Scheduler::context_switch(beneficiary); diff --git a/Kernel/Storage/IDEChannel.cpp b/Kernel/Storage/IDEChannel.cpp index bd3aff2513..ca6daf710b 100644 --- a/Kernel/Storage/IDEChannel.cpp +++ b/Kernel/Storage/IDEChannel.cpp @@ -176,7 +176,7 @@ void IDEChannel::complete_current_request(AsyncDeviceRequest::RequestResult resu // which could cause page faults. Note that this may be called immediately // before Processor::deferred_call_queue returns! Processor::deferred_call_queue([this, result]() { - dbgln<debug_pata>("IDEChannel::complete_current_request result: {}", (int)result); + dbgln<PATA_DEBUG>("IDEChannel::complete_current_request result: {}", (int)result); ASSERT(m_current_request); auto& request = *m_current_request; m_current_request = nullptr; @@ -364,7 +364,7 @@ void IDEChannel::ata_read_sectors_with_dma(bool slave_request) { auto& request = *m_current_request; u32 lba = request.block_index(); - dbgln<debug_pata>("IDEChannel::ata_read_sectors_with_dma ({} x {})", lba, request.block_count()); + dbgln<PATA_DEBUG>("IDEChannel::ata_read_sectors_with_dma ({} x {})", lba, request.block_count()); prdt().offset = m_dma_buffer_page->paddr(); prdt().size = 512 * request.block_count(); @@ -483,7 +483,7 @@ void IDEChannel::ata_write_sectors_with_dma(bool slave_request) { auto& request = *m_current_request; u32 lba = request.block_index(); - dbgln<debug_pata>("IDEChannel::ata_write_sectors_with_dma ({} x {})", lba, request.block_count()); + dbgln<PATA_DEBUG>("IDEChannel::ata_write_sectors_with_dma ({} x {})", lba, request.block_count()); prdt().offset = m_dma_buffer_page->paddr(); prdt().size = 512 * request.block_count(); diff --git a/Kernel/Syscalls/fcntl.cpp b/Kernel/Syscalls/fcntl.cpp index d0866296d5..ce83415c77 100644 --- a/Kernel/Syscalls/fcntl.cpp +++ b/Kernel/Syscalls/fcntl.cpp @@ -33,7 +33,7 @@ namespace Kernel { int Process::sys$fcntl(int fd, int cmd, u32 arg) { REQUIRE_PROMISE(stdio); - dbgln<debug_io>("sys$fcntl: fd={}, cmd={}, arg={}", fd, cmd, arg); + dbgln<IO_DEBUG>("sys$fcntl: fd={}, cmd={}, arg={}", fd, cmd, arg); auto description = file_description(fd); if (!description) return -EBADF; diff --git a/Kernel/Syscalls/fork.cpp b/Kernel/Syscalls/fork.cpp index a3cf64bc5f..edf359c3a5 100644 --- a/Kernel/Syscalls/fork.cpp +++ b/Kernel/Syscalls/fork.cpp @@ -50,7 +50,7 @@ pid_t Process::sys$fork(RegisterState& regs) child->m_pg = m_pg; child->m_umask = m_umask; - dbgln<debug_fork>("fork: child={}", child); + dbgln<FORK_DEBUG>("fork: child={}", child); child->m_extra_gids = m_extra_gids; @@ -79,7 +79,7 @@ pid_t Process::sys$fork(RegisterState& regs) { ScopedSpinLock lock(m_lock); for (auto& region : m_regions) { - dbgln<debug_fork>("fork: cloning Region({}) '{}' @ {}", ®ion, region.name(), region.vaddr()); + dbgln<FORK_DEBUG>("fork: cloning Region({}) '{}' @ {}", ®ion, region.name(), region.vaddr()); auto region_clone = region.clone(*child); if (!region_clone) { dbgln("fork: Cannot clone region, insufficient memory"); diff --git a/Kernel/Syscalls/futex.cpp b/Kernel/Syscalls/futex.cpp index 2851bced4e..0d12505aad 100644 --- a/Kernel/Syscalls/futex.cpp +++ b/Kernel/Syscalls/futex.cpp @@ -39,7 +39,7 @@ FutexQueue::FutexQueue(FlatPtr user_address_or_offset, VMObject* vmobject) : m_user_address_or_offset(user_address_or_offset) , m_is_global(vmobject != nullptr) { - dbgln<debug_futex>("Futex @ {}{}", + dbgln<FUTEX_DEBUG>("Futex @ {}{}", this, m_is_global ? " (global)" : " (local)"); @@ -56,7 +56,7 @@ FutexQueue::~FutexQueue() if (auto vmobject = m_vmobject.strong_ref()) vmobject->unregister_on_deleted_handler(*this); } - dbgln<debug_futex>("~Futex @ {}{}", + dbgln<FUTEX_DEBUG>("~Futex @ {}{}", this, m_is_global ? " (global)" : " (local)"); } @@ -68,7 +68,7 @@ void FutexQueue::vmobject_deleted(VMObject& vmobject) // to make sure we have at last a reference until we're done NonnullRefPtr<FutexQueue> own_ref(*this); - dbgln<debug_futex>("Futex::vmobject_deleted @ {}{}", + dbgln<FUTEX_DEBUG>("Futex::vmobject_deleted @ {}{}", this, m_is_global ? " (global)" : " (local)"); @@ -84,7 +84,7 @@ void FutexQueue::vmobject_deleted(VMObject& vmobject) bool did_wake_all; auto wake_count = wake_all(did_wake_all); - if constexpr (debug_futex) { + if constexpr (FUTEX_DEBUG) { if (wake_count > 0) dbgln("Futex @ {} unblocked {} waiters due to vmobject free", this, wake_count); } diff --git a/Kernel/Syscalls/open.cpp b/Kernel/Syscalls/open.cpp index ebbe7f950a..43b0cc2890 100644 --- a/Kernel/Syscalls/open.cpp +++ b/Kernel/Syscalls/open.cpp @@ -63,7 +63,7 @@ int Process::sys$open(Userspace<const Syscall::SC_open_params*> user_params) if (path.is_error()) return path.error(); - dbgln<debug_io>("sys$open(dirfd={}, path='{}', options={}, mode={})", dirfd, path.value(), options, mode); + dbgln<IO_DEBUG>("sys$open(dirfd={}, path='{}', options={}, mode={})", dirfd, path.value(), options, mode); int fd = alloc_fd(); if (fd < 0) return fd; @@ -99,7 +99,7 @@ int Process::sys$close(int fd) { REQUIRE_PROMISE(stdio); auto description = file_description(fd); - dbgln<debug_io>("sys$close({}) {}", fd, description.ptr()); + dbgln<IO_DEBUG>("sys$close({}) {}", fd, description.ptr()); if (!description) return -EBADF; int rc = description->close(); diff --git a/Kernel/Syscalls/read.cpp b/Kernel/Syscalls/read.cpp index 4b1b1f6902..b82924d34e 100644 --- a/Kernel/Syscalls/read.cpp +++ b/Kernel/Syscalls/read.cpp @@ -37,7 +37,7 @@ ssize_t Process::sys$read(int fd, Userspace<u8*> buffer, ssize_t size) return -EINVAL; if (size == 0) return 0; - dbgln<debug_io>("sys$read({}, {}, {})", fd, buffer.ptr(), size); + dbgln<IO_DEBUG>("sys$read({}, {}, {})", fd, buffer.ptr(), size); auto description = file_description(fd); if (!description) return -EBADF; diff --git a/Kernel/Syscalls/select.cpp b/Kernel/Syscalls/select.cpp index 8a0d9a1f92..aab13756ed 100644 --- a/Kernel/Syscalls/select.cpp +++ b/Kernel/Syscalls/select.cpp @@ -95,11 +95,11 @@ int Process::sys$select(const Syscall::SC_select_params* user_params) fds.append(fd); } - if constexpr (debug_io || debug_poll_select) + if constexpr (IO_DEBUG || POLL_SELECT_DEBUG) dbgln("selecting on {} fds, timeout={}", fds_info.size(), params.timeout); if (current_thread->block<Thread::SelectBlocker>(timeout, fds_info).was_interrupted()) { - dbgln<debug_poll_select>("select was interrupted"); + dbgln<POLL_SELECT_DEBUG>("select was interrupted"); return -EINTR; } @@ -198,7 +198,7 @@ int Process::sys$poll(Userspace<const Syscall::SC_poll_params*> user_params) current_thread->update_signal_mask(previous_signal_mask); }); - if constexpr (debug_io || debug_poll_select) + if constexpr (IO_DEBUG || POLL_SELECT_DEBUG) dbgln("polling on {} fds, timeout={}", fds_info.size(), params.timeout); if (current_thread->block<Thread::SelectBlocker>(timeout, fds_info).was_interrupted()) diff --git a/Kernel/Syscalls/waitid.cpp b/Kernel/Syscalls/waitid.cpp index e3090766be..b7c33972a5 100644 --- a/Kernel/Syscalls/waitid.cpp +++ b/Kernel/Syscalls/waitid.cpp @@ -55,7 +55,7 @@ pid_t Process::sys$waitid(Userspace<const Syscall::SC_waitid_params*> user_param if (!copy_from_user(¶ms, user_params)) return -EFAULT; - dbgln<debug_process>("sys$waitid({}, {}, {}, {})", params.idtype, params.id, params.infop, params.options); + dbgln<PROCESS_DEBUG>("sys$waitid({}, {}, {}, {})", params.idtype, params.id, params.infop, params.options); auto siginfo_or_error = do_waitid(static_cast<idtype_t>(params.idtype), params.id, params.options); if (siginfo_or_error.is_error()) diff --git a/Kernel/Syscalls/write.cpp b/Kernel/Syscalls/write.cpp index 326bc797c7..fea030731d 100644 --- a/Kernel/Syscalls/write.cpp +++ b/Kernel/Syscalls/write.cpp @@ -125,7 +125,7 @@ ssize_t Process::sys$write(int fd, const u8* data, ssize_t size) if (size == 0) return 0; - dbgln<debug_io>("sys$write({}, {}, {})", fd, data, size); + dbgln<IO_DEBUG>("sys$write({}, {}, {})", fd, data, size); auto description = file_description(fd); if (!description) return -EBADF; diff --git a/Kernel/TTY/MasterPTY.cpp b/Kernel/TTY/MasterPTY.cpp index dbb7e0f2da..e3da7a97cb 100644 --- a/Kernel/TTY/MasterPTY.cpp +++ b/Kernel/TTY/MasterPTY.cpp @@ -53,7 +53,7 @@ MasterPTY::MasterPTY(unsigned index) MasterPTY::~MasterPTY() { - dbgln<debug_masterpty>("~MasterPTY({})", m_index); + dbgln<MASTERPTY_DEBUG>("~MasterPTY({})", m_index); PTYMultiplexer::the().notify_master_destroyed({}, m_index); } @@ -91,7 +91,7 @@ bool MasterPTY::can_write(const FileDescription&, size_t) const void MasterPTY::notify_slave_closed(Badge<SlavePTY>) { - dbgln<debug_masterpty>("MasterPTY({}): slave closed, my retains: {}, slave retains: {}", m_index, ref_count(), m_slave->ref_count()); + dbgln<MASTERPTY_DEBUG>("MasterPTY({}): slave closed, my retains: {}, slave retains: {}", m_index, ref_count(), m_slave->ref_count()); // +1 ref for my MasterPTY::m_slave // +1 ref for FileDescription::m_device if (m_slave->ref_count() == 2) diff --git a/Kernel/TTY/PTYMultiplexer.cpp b/Kernel/TTY/PTYMultiplexer.cpp index 65e0e6339c..4bc9a3a886 100644 --- a/Kernel/TTY/PTYMultiplexer.cpp +++ b/Kernel/TTY/PTYMultiplexer.cpp @@ -61,7 +61,7 @@ KResultOr<NonnullRefPtr<FileDescription>> PTYMultiplexer::open(int options) return EBUSY; auto master_index = m_freelist.take_last(); auto master = adopt(*new MasterPTY(master_index)); - dbgln<debug_ptmx>("PTYMultiplexer::open: Vending master {}", master->index()); + dbgln<PTMX_DEBUG>("PTYMultiplexer::open: Vending master {}", master->index()); auto description = FileDescription::create(move(master)); if (!description.is_error()) { description.value()->set_rw_mode(options); @@ -74,7 +74,7 @@ void PTYMultiplexer::notify_master_destroyed(Badge<MasterPTY>, unsigned index) { LOCKER(m_lock); m_freelist.append(index); - dbgln<debug_ptmx>("PTYMultiplexer: {} added to freelist", index); + dbgln<PTMX_DEBUG>("PTYMultiplexer: {} added to freelist", index); } } diff --git a/Kernel/TTY/SlavePTY.cpp b/Kernel/TTY/SlavePTY.cpp index 401b6b9ed2..eef04946ef 100644 --- a/Kernel/TTY/SlavePTY.cpp +++ b/Kernel/TTY/SlavePTY.cpp @@ -47,7 +47,7 @@ SlavePTY::SlavePTY(MasterPTY& master, unsigned index) SlavePTY::~SlavePTY() { - dbgln<debug_slavepty>("~SlavePTY({})", m_index); + dbgln<SLAVEPTY_DEBUG>("~SlavePTY({})", m_index); DevPtsFS::unregister_slave_pty(*this); } diff --git a/Kernel/TTY/TTY.cpp b/Kernel/TTY/TTY.cpp index ffa73260dc..2bf26617a0 100644 --- a/Kernel/TTY/TTY.cpp +++ b/Kernel/TTY/TTY.cpp @@ -304,7 +304,7 @@ void TTY::set_termios(const termios& t) { m_termios = t; - dbgln<debug_tty>("{} set_termios: ECHO={}, ISIG={}, ICANON={}, ECHOE={}, ECHOK={}, ECHONL={}, ISTRIP={}, ICRNL={}, INLCR={}, IGNCR={}", + dbgln<TTY_DEBUG>("{} set_termios: ECHO={}, ISIG={}, ICANON={}, ECHOE={}, ECHOK={}, ECHONL={}, ISTRIP={}, ICRNL={}, INLCR={}, IGNCR={}", tty_name(), should_echo_input(), should_generate_signals(), diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index be9909f6c2..c3640c3098 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -59,7 +59,7 @@ Thread::Thread(NonnullRefPtr<Process> process) } else { m_tid = Process::allocate_pid().value(); } - if constexpr (debug_thread) + if constexpr (THREAD_DEBUG) dbgln("Created new thread {}({}:{})", m_process->name(), m_process->pid().value(), m_tid.value()); set_default_signal_dispositions(); m_fpu_state = (FPUState*)kmalloc_aligned<16>(sizeof(FPUState)); @@ -370,7 +370,7 @@ void Thread::finalize() { ScopedSpinLock lock(g_scheduler_lock); - dbgln<debug_thread>("Finalizing thread {}", *this); + dbgln<THREAD_DEBUG>("Finalizing thread {}", *this); set_state(Thread::State::Dead); m_join_condition.thread_finalizing(); } @@ -476,11 +476,11 @@ void Thread::send_signal(u8 signal, [[maybe_unused]] Process* sender) // FIXME: Figure out what to do for masked signals. Should we also ignore them here? if (should_ignore_signal(signal)) { - dbgln<debug_signal>("Signal {} was ignored by {}", signal, process()); + dbgln<SIGNAL_DEBUG>("Signal {} was ignored by {}", signal, process()); return; } - if constexpr (debug_signal) { + if constexpr (SIGNAL_DEBUG) { if (sender) dbgln("Signal: {} sent {} to {}", *sender, signal, process()); else @@ -493,12 +493,12 @@ void Thread::send_signal(u8 signal, [[maybe_unused]] Process* sender) if (m_state == Stopped) { ScopedSpinLock lock(m_lock); if (pending_signals_for_state()) { - dbgln<debug_signal>("Signal: Resuming stopped {} to deliver signal {}", *this, signal); + dbgln<SIGNAL_DEBUG>("Signal: Resuming stopped {} to deliver signal {}", *this, signal); resume_from_stopped(); } } else { ScopedSpinLock block_lock(m_block_lock); - dbgln<debug_signal>("Signal: Unblocking {} to deliver signal {}", *this, signal); + dbgln<SIGNAL_DEBUG>("Signal: Unblocking {} to deliver signal {}", *this, signal); unblock(signal); } } @@ -710,7 +710,7 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal) auto& process = this->process(); auto tracer = process.tracer(); if (signal == SIGSTOP || (tracer && default_signal_action(signal) == DefaultSignalAction::DumpCore)) { - dbgln<debug_signal>("signal: signal {} sopping thread {}", signal, *this); + dbgln<SIGNAL_DEBUG>("signal: signal {} sopping thread {}", signal, *this); set_state(State::Stopped, signal); return DispatchSignalResult::Yield; } @@ -873,13 +873,13 @@ void Thread::set_state(State new_state, u8 stop_signal) if (previous_state == Invalid) { // If we were *just* created, we may have already pending signals if (has_unmasked_pending_signals()) { - dbgln<debug_thread>("Dispatch pending signals to new thread {}", *this); + dbgln<THREAD_DEBUG>("Dispatch pending signals to new thread {}", *this); dispatch_one_pending_signal(); } } m_state = new_state; - dbgln<debug_thread>("Set thread {} state to {}", *this, state_string()); + dbgln<THREAD_DEBUG>("Set thread {} state to {}", *this, state_string()); } if (m_process->pid() != 0) { @@ -894,7 +894,7 @@ void Thread::set_state(State new_state, u8 stop_signal) process.for_each_thread([&](auto& thread) { if (&thread == this || !thread.is_stopped()) return IterationDecision::Continue; - dbgln<debug_thread>("Resuming peer thread {}", thread); + dbgln<THREAD_DEBUG>("Resuming peer thread {}", thread); thread.resume_from_stopped(); return IterationDecision::Continue; }); @@ -910,7 +910,7 @@ void Thread::set_state(State new_state, u8 stop_signal) process.for_each_thread([&](auto& thread) { if (&thread == this || thread.is_stopped()) return IterationDecision::Continue; - dbgln<debug_thread>("Stopping peer thread {}", thread); + dbgln<THREAD_DEBUG>("Stopping peer thread {}", thread); thread.set_state(Stopped, stop_signal); return IterationDecision::Continue; }); diff --git a/Kernel/ThreadBlockers.cpp b/Kernel/ThreadBlockers.cpp index a68447c7d2..6f5834ca3a 100644 --- a/Kernel/ThreadBlockers.cpp +++ b/Kernel/ThreadBlockers.cpp @@ -462,9 +462,9 @@ void Thread::WaitBlockCondition::try_unblock(Thread::WaitBlocker& blocker) if (blocker.is_wait()) { if (info.flags == Thread::WaitBlocker::UnblockFlags::Terminated) { m_processes.remove(i); - dbgln<debug_waitblock>("WaitBlockCondition[{}] terminated, remove {}", m_process, *info.process); + dbgln<WAITBLOCK_DEBUG>("WaitBlockCondition[{}] terminated, remove {}", m_process, *info.process); } else { - dbgln<debug_waitblock>("WaitBlockCondition[{}] terminated, mark as waited {}", m_process, *info.process); + dbgln<WAITBLOCK_DEBUG>("WaitBlockCondition[{}] terminated, mark as waited {}", m_process, *info.process); info.was_waited = true; } } @@ -488,7 +488,7 @@ void Thread::WaitBlockCondition::disowned_by_waiter(Process& process) ASSERT(did_unblock); // disowning must unblock everyone return true; }); - dbgln<debug_waitblock>("WaitBlockCondition[{}] disowned {}", m_process, *info.process); + dbgln<WAITBLOCK_DEBUG>("WaitBlockCondition[{}] disowned {}", m_process, *info.process); m_processes.remove(i); continue; } @@ -541,13 +541,13 @@ bool Thread::WaitBlockCondition::unblock(Process& process, WaitBlocker::UnblockF info.flags = flags; info.signal = signal; info.was_waited = did_wait; - dbgln<debug_waitblock>("WaitBlockCondition[{}] update {} flags={}, waited={}", m_process, process, (int)flags, info.was_waited); + dbgln<WAITBLOCK_DEBUG>("WaitBlockCondition[{}] update {} flags={}, waited={}", m_process, process, (int)flags, info.was_waited); updated_existing = true; break; } } if (!updated_existing) { - dbgln<debug_waitblock>("WaitBlockCondition[{}] add {} flags: {}", m_process, process, (int)flags); + dbgln<WAITBLOCK_DEBUG>("WaitBlockCondition[{}] add {} flags: {}", m_process, process, (int)flags); m_processes.append(ProcessBlockInfo(process, flags, signal)); } } diff --git a/Kernel/Time/HPET.cpp b/Kernel/Time/HPET.cpp index f44ebc2a8b..f2659d6a7c 100644 --- a/Kernel/Time/HPET.cpp +++ b/Kernel/Time/HPET.cpp @@ -206,7 +206,7 @@ void HPET::update_periodic_comparator_value() // and we can only write the period into the comparator value... timer.capabilities = timer.capabilities | (u32)HPETFlags::TimerConfiguration::ValueSet; u64 value = frequency() / comparator.ticks_per_second(); - dbgln<debug_hpet>("HPET: Update periodic comparator {} comparator value to {} main value was: {}", + dbgln<HPET_DEBUG>("HPET: Update periodic comparator {} comparator value to {} main value was: {}", comparator.comparator_number(), value, previous_main_value); @@ -217,7 +217,7 @@ void HPET::update_periodic_comparator_value() // Set the new target comparator value to the delta to the remaining ticks u64 current_value = (u64)timer.comparator_value.low | ((u64)timer.comparator_value.high << 32); u64 value = current_value - previous_main_value; - dbgln<debug_hpet>("HPET: Update non-periodic comparator {} comparator value from {} to {} main value was: {}", + dbgln<HPET_DEBUG>("HPET: Update non-periodic comparator {} comparator value from {} to {} main value was: {}", comparator.comparator_number(), current_value, value, diff --git a/Kernel/Time/HPETComparator.cpp b/Kernel/Time/HPETComparator.cpp index 85b0080779..66d7d5b52f 100644 --- a/Kernel/Time/HPETComparator.cpp +++ b/Kernel/Time/HPETComparator.cpp @@ -109,7 +109,7 @@ bool HPETComparator::try_to_set_frequency(size_t frequency) m_frequency = frequency; m_enabled = true; - dbgln<debug_hpet_comperator>("HPET Comparator: Max frequency {} Hz, want to set {} Hz, periodic: {}", hpet_frequency, frequency, is_periodic()); + dbgln<HPET_COMPARATOR_DEBUG>("HPET Comparator: Max frequency {} Hz, want to set {} Hz, periodic: {}", hpet_frequency, frequency, is_periodic()); if (is_periodic()) { HPET::the().update_periodic_comparator_value(); diff --git a/Kernel/VM/AnonymousVMObject.cpp b/Kernel/VM/AnonymousVMObject.cpp index a7342fa93e..dc7d359633 100644 --- a/Kernel/VM/AnonymousVMObject.cpp +++ b/Kernel/VM/AnonymousVMObject.cpp @@ -472,7 +472,7 @@ PageFaultResponse AnonymousVMObject::handle_cow_fault(size_t page_index, Virtual } u8* dest_ptr = MM.quickmap_page(*page); - dbgln<debug_page_fault>(" >> COW {} <- {}", page->paddr(), page_slot->paddr()); + dbgln<PAGE_FAULT_DEBUG>(" >> COW {} <- {}", page->paddr(), page_slot->paddr()); { SmapDisabler disabler; void* fault_at; diff --git a/Kernel/VM/ContiguousVMObject.cpp b/Kernel/VM/ContiguousVMObject.cpp index b17dcbd59f..e084f7d69d 100644 --- a/Kernel/VM/ContiguousVMObject.cpp +++ b/Kernel/VM/ContiguousVMObject.cpp @@ -42,7 +42,7 @@ ContiguousVMObject::ContiguousVMObject(size_t size) auto contiguous_physical_pages = MM.allocate_contiguous_supervisor_physical_pages(size); for (size_t i = 0; i < page_count(); i++) { physical_pages()[i] = contiguous_physical_pages[i]; - dbgln<debug_contiguous_vmobject>("Contiguous page[{}]: {}", i, physical_pages()[i]->paddr()); + dbgln<CONTIGUOUS_VMOBJECT_DEBUG>("Contiguous page[{}]: {}", i, physical_pages()[i]->paddr()); } } diff --git a/Kernel/VM/RangeAllocator.cpp b/Kernel/VM/RangeAllocator.cpp index 3e12588aca..f98f4015df 100644 --- a/Kernel/VM/RangeAllocator.cpp +++ b/Kernel/VM/RangeAllocator.cpp @@ -79,7 +79,7 @@ Vector<Range, 2> Range::carve(const Range& taken) if (taken.end() < end()) parts.append({ taken.end(), end().get() - taken.end().get() }); - if constexpr (debug_vra) { + if constexpr (VRA_DEBUG) { dbgln("VRA: carve: take {:x}-{:x} from {:x}-{:x}", taken.base().get(), taken.end().get() - 1, @@ -129,13 +129,13 @@ Range RangeAllocator::allocate_anywhere(size_t size, size_t alignment) Range allocated_range(VirtualAddress(aligned_base), size); if (available_range == allocated_range) { - dbgln<debug_vra>("VRA: Allocated perfect-fit anywhere({}, {}): {}", size, alignment, allocated_range.base().get()); + dbgln<VRA_DEBUG>("VRA: Allocated perfect-fit anywhere({}, {}): {}", size, alignment, allocated_range.base().get()); m_available_ranges.remove(i); return allocated_range; } carve_at_index(i, allocated_range); - if constexpr (debug_vra) { - dbgln<debug_vra>("VRA: Allocated anywhere({}, {}): {}", size, alignment, allocated_range.base().get()); + if constexpr (VRA_DEBUG) { + dbgln<VRA_DEBUG>("VRA: Allocated anywhere({}, {}): {}", size, alignment, allocated_range.base().get()); dump(); } return allocated_range; @@ -161,7 +161,7 @@ Range RangeAllocator::allocate_specific(VirtualAddress base, size_t size) } carve_at_index(i, allocated_range); - if constexpr (debug_vra) { + if constexpr (VRA_DEBUG) { dbgln("VRA: Allocated specific({}): {}", size, available_range.base().get()); dump(); } @@ -179,7 +179,7 @@ void RangeAllocator::deallocate(Range range) ASSERT(range.size()); ASSERT(range.base() < range.end()); - if constexpr (debug_vra) { + if constexpr (VRA_DEBUG) { dbgln("VRA: Deallocate: {}({})", range.base().get(), range.size()); dump(); } diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp index 72067d0ec0..e600440b01 100644 --- a/Kernel/VM/Region.cpp +++ b/Kernel/VM/Region.cpp @@ -410,7 +410,7 @@ PageFaultResponse Region::handle_fault(const PageFault& fault) return PageFaultResponse::ShouldCrash; } if (vmobject().is_inode()) { - dbgln<debug_page_fault>("NP(inode) fault in Region({})[{}]", this, page_index_in_region); + dbgln<PAGE_FAULT_DEBUG>("NP(inode) fault in Region({})[{}]", this, page_index_in_region); return handle_inode_fault(page_index_in_region); } @@ -435,10 +435,10 @@ PageFaultResponse Region::handle_fault(const PageFault& fault) } ASSERT(fault.type() == PageFault::Type::ProtectionViolation); if (fault.access() == PageFault::Access::Write && is_writable() && should_cow(page_index_in_region)) { - dbgln<debug_page_fault>("PV(cow) fault in Region({})[{}] at {}", this, page_index_in_region, fault.vaddr()); + dbgln<PAGE_FAULT_DEBUG>("PV(cow) fault in Region({})[{}] at {}", this, page_index_in_region, fault.vaddr()); auto* phys_page = physical_page(page_index_in_region); if (phys_page->is_shared_zero_page() || phys_page->is_lazy_committed_page()) { - dbgln<debug_page_fault>("NP(zero) fault in Region({})[{}] at {}", this, page_index_in_region, fault.vaddr()); + dbgln<PAGE_FAULT_DEBUG>("NP(zero) fault in Region({})[{}] at {}", this, page_index_in_region, fault.vaddr()); return handle_zero_fault(page_index_in_region); } return handle_cow_fault(page_index_in_region); @@ -472,14 +472,14 @@ PageFaultResponse Region::handle_zero_fault(size_t page_index_in_region) if (page_slot->is_lazy_committed_page()) { page_slot = static_cast<AnonymousVMObject&>(*m_vmobject).allocate_committed_page(page_index_in_vmobject); - dbgln<debug_page_fault>(" >> ALLOCATED COMMITTED {}", page_slot->paddr()); + dbgln<PAGE_FAULT_DEBUG>(" >> ALLOCATED COMMITTED {}", page_slot->paddr()); } else { page_slot = MM.allocate_user_physical_page(MemoryManager::ShouldZeroFill::Yes); if (page_slot.is_null()) { klog() << "MM: handle_zero_fault was unable to allocate a physical page"; return PageFaultResponse::OutOfMemory; } - dbgln<debug_page_fault>(" >> ALLOCATED {}", page_slot->paddr()); + dbgln<PAGE_FAULT_DEBUG>(" >> ALLOCATED {}", page_slot->paddr()); } if (!remap_vmobject_page(page_index_in_vmobject)) { @@ -518,10 +518,10 @@ PageFaultResponse Region::handle_inode_fault(size_t page_index_in_region) auto page_index_in_vmobject = translate_to_vmobject_page(page_index_in_region); auto& vmobject_physical_page_entry = inode_vmobject.physical_pages()[page_index_in_vmobject]; - dbgln<debug_page_fault>("Inode fault in {} page index: {}", name(), page_index_in_region); + dbgln<PAGE_FAULT_DEBUG>("Inode fault in {} page index: {}", name(), page_index_in_region); if (!vmobject_physical_page_entry.is_null()) { - dbgln<debug_page_fault>("MM: page_in_from_inode() but page already present. Fine with me!"); + dbgln<PAGE_FAULT_DEBUG>("MM: page_in_from_inode() but page already present. Fine with me!"); if (!remap_vmobject_page(page_index_in_vmobject)) return PageFaultResponse::OutOfMemory; return PageFaultResponse::Continue; diff --git a/Kernel/WaitQueue.cpp b/Kernel/WaitQueue.cpp index 42e13c30bf..ce2d74bba0 100644 --- a/Kernel/WaitQueue.cpp +++ b/Kernel/WaitQueue.cpp @@ -37,22 +37,22 @@ bool WaitQueue::should_add_blocker(Thread::Blocker& b, void* data) ASSERT(b.blocker_type() == Thread::Blocker::Type::Queue); if (m_wake_requested) { m_wake_requested = false; - dbgln<debug_waitqueue>("WaitQueue @ {}: do not block thread {}, wake was pending", this, data); + dbgln<WAITQUEUE_DEBUG>("WaitQueue @ {}: do not block thread {}, wake was pending", this, data); return false; } - dbgln<debug_waitqueue>("WaitQueue @ {}: should block thread {}", this, data); + dbgln<WAITQUEUE_DEBUG>("WaitQueue @ {}: should block thread {}", this, data); return true; } void WaitQueue::wake_one() { ScopedSpinLock lock(m_lock); - dbgln<debug_waitqueue>("WaitQueue @ {}: wake_one", this); + dbgln<WAITQUEUE_DEBUG>("WaitQueue @ {}: wake_one", this); bool did_unblock_one = do_unblock([&](Thread::Blocker& b, void* data, bool& stop_iterating) { ASSERT(data); ASSERT(b.blocker_type() == Thread::Blocker::Type::Queue); auto& blocker = static_cast<Thread::QueueBlocker&>(b); - dbgln<debug_waitqueue>("WaitQueue @ {}: wake_one unblocking {}", this, data); + dbgln<WAITQUEUE_DEBUG>("WaitQueue @ {}: wake_one unblocking {}", this, data); if (blocker.unblock()) { stop_iterating = true; return true; @@ -67,14 +67,14 @@ u32 WaitQueue::wake_n(u32 wake_count) if (wake_count == 0) return 0; // should we assert instead? ScopedSpinLock lock(m_lock); - dbgln<debug_waitqueue>("WaitQueue @ {}: wake_n({})", this, wake_count); + dbgln<WAITQUEUE_DEBUG>("WaitQueue @ {}: wake_n({})", this, wake_count); u32 did_wake = 0; bool did_unblock_some = do_unblock([&](Thread::Blocker& b, void* data, bool& stop_iterating) { ASSERT(data); ASSERT(b.blocker_type() == Thread::Blocker::Type::Queue); auto& blocker = static_cast<Thread::QueueBlocker&>(b); - dbgln<debug_waitqueue>("WaitQueue @ {}: wake_n unblocking {}", this, data); + dbgln<WAITQUEUE_DEBUG>("WaitQueue @ {}: wake_n unblocking {}", this, data); ASSERT(did_wake < wake_count); if (blocker.unblock()) { if (++did_wake >= wake_count) @@ -91,7 +91,7 @@ u32 WaitQueue::wake_all() { ScopedSpinLock lock(m_lock); - dbgln<debug_waitqueue>("WaitQueue @ {}: wake_all", this); + dbgln<WAITQUEUE_DEBUG>("WaitQueue @ {}: wake_all", this); u32 did_wake = 0; bool did_unblock_any = do_unblock([&](Thread::Blocker& b, void* data, bool&) { @@ -99,7 +99,7 @@ u32 WaitQueue::wake_all() ASSERT(b.blocker_type() == Thread::Blocker::Type::Queue); auto& blocker = static_cast<Thread::QueueBlocker&>(b); - dbgln<debug_waitqueue>("WaitQueue @ {}: wake_all unblocking {}", this, data); + dbgln<WAITQUEUE_DEBUG>("WaitQueue @ {}: wake_all unblocking {}", this, data); if (blocker.unblock()) { did_wake++; diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp index de31828a4f..edb09fddf3 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp +++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp @@ -353,7 +353,7 @@ void Sheet::copy_cells(Vector<Position> from, Vector<Position> to, Optional<Posi auto& target = to.first(); for (auto& position : from) { - dbgln<debug_copy>("Paste from '{}' to '{}'", position.to_url(), target.to_url()); + dbgln<COPY_DEBUG>("Paste from '{}' to '{}'", position.to_url(), target.to_url()); copy_to(position, resolve_relative_to.has_value() ? offset_relative_to(target, position, resolve_relative_to.value()) : target); } @@ -364,7 +364,7 @@ void Sheet::copy_cells(Vector<Position> from, Vector<Position> to, Optional<Posi // Fill the target selection with the single cell. auto& source = from.first(); for (auto& position : to) { - dbgln<debug_copy>("Paste from '{}' to '{}'", source.to_url(), position.to_url()); + dbgln<COPY_DEBUG>("Paste from '{}' to '{}'", source.to_url(), position.to_url()); copy_to(source, resolve_relative_to.has_value() ? offset_relative_to(position, source, resolve_relative_to.value()) : position); } return; diff --git a/Userland/DevTools/HackStudio/CursorTool.cpp b/Userland/DevTools/HackStudio/CursorTool.cpp index 30899dba16..e0dfb41c17 100644 --- a/Userland/DevTools/HackStudio/CursorTool.cpp +++ b/Userland/DevTools/HackStudio/CursorTool.cpp @@ -48,7 +48,7 @@ void CursorTool::on_mousedown(GUI::MouseEvent& event) m_editor.selection().toggle(*result.widget); } else if (!event.modifiers()) { if (!m_editor.selection().contains(*result.widget)) { - dbgln<debug_cursor_tool>("Selection didn't contain {}, making it the only selected one", *result.widget); + dbgln<CURSOR_TOOL_DEBUG>("Selection didn't contain {}, making it the only selected one", *result.widget); m_editor.selection().set(*result.widget); } diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp index c0555560e1..da1f768cc9 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp @@ -87,7 +87,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileOpened& messag auto document = GUI::TextDocument::create(&s_default_document_client); document->set_text(content_view); m_open_files.set(message.file_name(), document); - dbgln<debug_file_content>("{}", document->text()); + dbgln<FILE_CONTENT_DEBUG>("{}", document->text()); } void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText& message) diff --git a/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp b/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp index 0ae5a0c469..8fed3f44aa 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp @@ -87,7 +87,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileOpened& messag auto document = GUI::TextDocument::create(&s_default_document_client); document->set_text(content_view); m_open_files.set(message.file_name(), document); - dbgln<debug_file_content>("{}", document->text()); + dbgln<FILE_CONTENT_DEBUG>("{}", document->text()); } void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText& message) @@ -129,7 +129,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText }; document->remove(range); - dbgln<debug_file_content>("{}", document->text()); + dbgln<FILE_CONTENT_DEBUG>("{}", document->text()); } void ClientConnection::handle(const Messages::LanguageServer::AutoCompleteSuggestions& message) diff --git a/Userland/Libraries/LibCore/Gzip.cpp b/Userland/Libraries/LibCore/Gzip.cpp index 46ea61da20..87002b2b47 100644 --- a/Userland/Libraries/LibCore/Gzip.cpp +++ b/Userland/Libraries/LibCore/Gzip.cpp @@ -102,7 +102,7 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data) } auto new_size = data.size() - current; - dbgln<debug_gzip>("get_gzip_payload: Returning slice from {} with size {}", current, new_size); + dbgln<GZIP_DEBUG>("get_gzip_payload: Returning slice from {} with size {}", current, new_size); return data.slice(current, new_size); } @@ -110,7 +110,7 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data) { ASSERT(is_compressed(data)); - dbgln<debug_gzip>("Gzip::decompress: Decompressing gzip compressed data. size={}", data.size()); + dbgln<GZIP_DEBUG>("Gzip::decompress: Decompressing gzip compressed data. size={}", data.size()); auto optional_payload = get_gzip_payload(data); if (!optional_payload.has_value()) { return Optional<ByteBuffer>(); @@ -122,7 +122,7 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data) while (true) { unsigned long destination_len = destination.size(); - if constexpr (debug_gzip) { + if constexpr (GZIP_DEBUG) { dbgln("Gzip::decompress: Calling puff()"); dbgln(" destination_data = {}", destination.data()); dbgln(" destination_len = {}", destination_len); diff --git a/Userland/Libraries/LibCore/NetworkJob.cpp b/Userland/Libraries/LibCore/NetworkJob.cpp index 8a9827d94d..c3a742ed4b 100644 --- a/Userland/Libraries/LibCore/NetworkJob.cpp +++ b/Userland/Libraries/LibCore/NetworkJob.cpp @@ -55,7 +55,7 @@ void NetworkJob::did_finish(NonnullRefPtr<NetworkResponse>&& response) NonnullRefPtr<NetworkJob> protector(*this); m_response = move(response); - dbgln<debug_cnetworkjob>("{} job did_finish", *this); + dbgln<CNETWORKJOB_DEBUG>("{} job did_finish", *this); ASSERT(on_finish); on_finish(true); shutdown(); diff --git a/Userland/Libraries/LibCore/Socket.cpp b/Userland/Libraries/LibCore/Socket.cpp index 3adbed2d4f..dbe0476b81 100644 --- a/Userland/Libraries/LibCore/Socket.cpp +++ b/Userland/Libraries/LibCore/Socket.cpp @@ -79,7 +79,7 @@ bool Socket::connect(const String& hostname, int port) } IPv4Address host_address((const u8*)hostent->h_addr_list[0]); - dbgln<debug_csocket>("Socket::connect: Resolved '{}' to {}", hostname, host_address); + dbgln<CSOCKET_DEBUG>("Socket::connect: Resolved '{}' to {}", hostname, host_address); return connect(host_address, port); } @@ -98,7 +98,7 @@ bool Socket::connect(const SocketAddress& address, int port) { ASSERT(!is_connected()); ASSERT(address.type() == SocketAddress::Type::IPv4); - dbgln<debug_csocket>("{} connecting to {}...", *this, address); + dbgln<CSOCKET_DEBUG>("{} connecting to {}...", *this, address); ASSERT(port > 0 && port <= 65535); @@ -119,7 +119,7 @@ bool Socket::connect(const SocketAddress& address) { ASSERT(!is_connected()); ASSERT(address.type() == SocketAddress::Type::Local); - dbgln<debug_csocket>("{} connecting to {}...", *this, address); + dbgln<CSOCKET_DEBUG>("{} connecting to {}...", *this, address); sockaddr_un saddr; saddr.sun_family = AF_LOCAL; @@ -138,7 +138,7 @@ bool Socket::connect(const SocketAddress& address) bool Socket::common_connect(const struct sockaddr* addr, socklen_t addrlen) { auto connected = [this] { - dbgln<debug_csocket>("{} connected!", *this); + dbgln<CSOCKET_DEBUG>("{} connected!", *this); if (!m_connected) { m_connected = true; ensure_read_notifier(); @@ -153,7 +153,7 @@ bool Socket::common_connect(const struct sockaddr* addr, socklen_t addrlen) int rc = ::connect(fd(), addr, addrlen); if (rc < 0) { if (errno == EINPROGRESS) { - dbgln<debug_csocket>("{} connection in progress (EINPROGRESS)", *this); + dbgln<CSOCKET_DEBUG>("{} connection in progress (EINPROGRESS)", *this); m_notifier = Notifier::construct(fd(), Notifier::Event::Write, this); m_notifier->on_ready_to_write = move(connected); return true; @@ -163,7 +163,7 @@ bool Socket::common_connect(const struct sockaddr* addr, socklen_t addrlen) errno = saved_errno; return false; } - dbgln<debug_csocket>("{} connected ok!", *this); + dbgln<CSOCKET_DEBUG>("{} connected ok!", *this); connected(); return true; } diff --git a/Userland/Libraries/LibCore/SyscallUtils.h b/Userland/Libraries/LibCore/SyscallUtils.h index 5815fb67cd..de14ffed23 100644 --- a/Userland/Libraries/LibCore/SyscallUtils.h +++ b/Userland/Libraries/LibCore/SyscallUtils.h @@ -42,9 +42,9 @@ inline int safe_syscall(Syscall syscall, Args&&... args) for (;;) { int sysret = syscall(forward<Args>(args)...); if (sysret == -1) { - if constexpr (debug_safe_syscall) { + if constexpr (SAFE_SYSCALL_DEBUG) { int saved_errno = errno; - dbgln<debug_safe_syscall>("Core::safe_syscall: {} ({}: {})", sysret, saved_errno, strerror(saved_errno)); + dbgln<SAFE_SYSCALL_DEBUG>("Core::safe_syscall: {} ({}: {})", sysret, saved_errno, strerror(saved_errno)); } if (errno == EINTR) diff --git a/Userland/Libraries/LibCrypto/Authentication/GHash.cpp b/Userland/Libraries/LibCrypto/Authentication/GHash.cpp index 9ac2247a77..1b6794bb3c 100644 --- a/Userland/Libraries/LibCrypto/Authentication/GHash.cpp +++ b/Userland/Libraries/LibCrypto/Authentication/GHash.cpp @@ -89,7 +89,7 @@ GHash::TagType GHash::process(ReadonlyBytes aad, ReadonlyBytes cipher) auto high = [](u64 value) -> u32 { return value >> 32; }; auto low = [](u64 value) -> u32 { return value & 0xffffffff; }; - if constexpr (debug_ghash_process) { + if constexpr (GHASH_PROCESS_DEBUG) { dbgln("AAD bits: {} : {}", high(aad_bits), low(aad_bits)); dbgln("Cipher bits: {} : {}", high(cipher_bits), low(cipher_bits)); dbgln("Tag bits: {} : {} : {} : {}", tag[0], tag[1], tag[2], tag[3]); @@ -100,7 +100,7 @@ GHash::TagType GHash::process(ReadonlyBytes aad, ReadonlyBytes cipher) tag[2] ^= high(cipher_bits); tag[3] ^= low(cipher_bits); - dbgln<debug_ghash_process>("Tag bits: {} : {} : {} : {}", tag[0], tag[1], tag[2], tag[3]); + dbgln<GHASH_PROCESS_DEBUG>("Tag bits: {} : {} : {} : {}", tag[0], tag[1], tag[2], tag[3]); galois_multiply(tag, m_key, tag); diff --git a/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp b/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp index c939bfb6c5..e9a29c46f1 100644 --- a/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp +++ b/Userland/Libraries/LibCrypto/NumberTheory/ModularFunctions.cpp @@ -231,7 +231,7 @@ UnsignedBigInteger LCM(const UnsignedBigInteger& a, const UnsignedBigInteger& b) UnsignedBigInteger::divide_without_allocation(a, gcd_output, temp_1, temp_2, temp_3, temp_4, temp_quotient, temp_remainder); UnsignedBigInteger::multiply_without_allocation(temp_quotient, b, temp_1, temp_2, temp_3, temp_4, output); - dbgln<debug_nt>("quot: {} rem: {} out: {}", temp_quotient, temp_remainder, output); + dbgln<NT_DEBUG>("quot: {} rem: {} out: {}", temp_quotient, temp_remainder, output); return output; } diff --git a/Userland/Libraries/LibCrypto/PK/RSA.cpp b/Userland/Libraries/LibCrypto/PK/RSA.cpp index d6e2320bdd..1dc8e1e62e 100644 --- a/Userland/Libraries/LibCrypto/PK/RSA.cpp +++ b/Userland/Libraries/LibCrypto/PK/RSA.cpp @@ -116,7 +116,7 @@ RSA::KeyPairType RSA::parse_rsa_key(ReadonlyBytes in) void RSA::encrypt(ReadonlyBytes in, Bytes& out) { - dbgln<debug_crypto>("in size: {}", in.size()); + dbgln<CRYPTO_DEBUG>("in size: {}", in.size()); auto in_integer = UnsignedBigInteger::import_data(in.data(), in.size()); if (!(in_integer < m_public_key.modulus())) { dbgln("value too large for key"); @@ -230,7 +230,7 @@ VerificationConsistency RSA_EMSA_PSS<HashFunction>::verify(ReadonlyBytes in) void RSA_PKCS1_EME::encrypt(ReadonlyBytes in, Bytes& out) { auto mod_len = (m_public_key.modulus().trimmed_length() * sizeof(u32) * 8 + 7) / 8; - dbgln<debug_crypto>("key size: {}", mod_len); + dbgln<CRYPTO_DEBUG>("key size: {}", mod_len); if (in.size() > mod_len - 11) { dbgln("message too long :("); out = out.trim(0); @@ -262,7 +262,7 @@ void RSA_PKCS1_EME::encrypt(ReadonlyBytes in, Bytes& out) out.overwrite(3 + ps_length, in.data(), in.size()); out = out.trim(3 + ps_length + in.size()); // should be a single block - dbgln<debug_crypto>("padded output size: {} buffer size: {}", 3 + ps_length + in.size(), out.size()); + dbgln<CRYPTO_DEBUG>("padded output size: {} buffer size: {}", 3 + ps_length + in.size(), out.size()); RSA::encrypt(out, out); } diff --git a/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp b/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp index 9dab951d2f..9405d9f6cf 100644 --- a/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/LineProgram.cpp @@ -235,7 +235,7 @@ void LineProgram::handle_sepcial_opcode(u8 opcode) m_address += address_increment; m_line += line_increment; - if constexpr (debug_dwarf) { + if constexpr (DWARF_DEBUG) { dbgln("Special adjusted_opcode: {}, address_increment: {}, line_increment: {}", adjusted_opcode, address_increment, line_increment); dbgln("Address is now: {:p}, and line is: {}:{}", m_address, m_source_files[m_file_index].name, m_line); } @@ -251,7 +251,7 @@ void LineProgram::run_program() u8 opcode = 0; m_stream >> opcode; - dbgln<debug_dwarf>("{:p}: opcode: {}", m_stream.offset() - 1, opcode); + dbgln<DWARF_DEBUG>("{:p}: opcode: {}", m_stream.offset() - 1, opcode); if (opcode == 0) { handle_extended_opcode(); diff --git a/Userland/Libraries/LibDiff/Hunks.cpp b/Userland/Libraries/LibDiff/Hunks.cpp index 2d9c77405a..d94bedfa03 100644 --- a/Userland/Libraries/LibDiff/Hunks.cpp +++ b/Userland/Libraries/LibDiff/Hunks.cpp @@ -77,7 +77,7 @@ Vector<Hunk> parse_hunks(const String& diff) hunks.append(hunk); } - if constexpr (debug_hunks) { + if constexpr (HUNKS_DEBUG) { for (const auto& hunk : hunks) { dbgln("Hunk location:"); dbgln(" orig: {}", hunk.original_start_line); diff --git a/Userland/Libraries/LibGUI/CppSyntaxHighlighter.cpp b/Userland/Libraries/LibGUI/CppSyntaxHighlighter.cpp index a4c6fd1205..f0e0171f2e 100644 --- a/Userland/Libraries/LibGUI/CppSyntaxHighlighter.cpp +++ b/Userland/Libraries/LibGUI/CppSyntaxHighlighter.cpp @@ -84,7 +84,7 @@ void CppSyntaxHighlighter::rehighlight(Gfx::Palette palette) Vector<GUI::TextDocumentSpan> spans; for (auto& token : tokens) { - dbgln<debug_syntax_highlighting>("{} @ {}:{} - {}:{}", token.to_string(), token.m_start.line, token.m_start.column, token.m_end.line, token.m_end.column); + dbgln<SYNTAX_HIGHLIGHTING_DEBUG>("{} @ {}:{} - {}:{}", token.to_string(), token.m_start.line, token.m_start.column, token.m_end.line, token.m_end.column); GUI::TextDocumentSpan span; span.range.set_start({ token.m_start.line, token.m_start.column }); span.range.set_end({ token.m_end.line, token.m_end.column }); diff --git a/Userland/Libraries/LibGUI/JSSyntaxHighlighter.cpp b/Userland/Libraries/LibGUI/JSSyntaxHighlighter.cpp index 2f70a59098..267b572cd6 100644 --- a/Userland/Libraries/LibGUI/JSSyntaxHighlighter.cpp +++ b/Userland/Libraries/LibGUI/JSSyntaxHighlighter.cpp @@ -108,7 +108,7 @@ void JSSyntaxHighlighter::rehighlight(Gfx::Palette palette) spans.append(span); advance_position(str[str.length() - 1]); - dbgln<debug_syntax_highlighting>("{}{} @ '{}' {}:{} - {}:{}", + dbgln<SYNTAX_HIGHLIGHTING_DEBUG>("{}{} @ '{}' {}:{} - {}:{}", token.name(), is_trivia ? " (trivia)" : "", token.value(), diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.cpp b/Userland/Libraries/LibGUI/WindowServerConnection.cpp index 279f7a1a89..73e2715f28 100644 --- a/Userland/Libraries/LibGUI/WindowServerConnection.cpp +++ b/Userland/Libraries/LibGUI/WindowServerConnection.cpp @@ -141,25 +141,25 @@ void WindowServerConnection::handle(const Messages::WindowClient::KeyDown& messa auto key_event = make<KeyEvent>(Event::KeyDown, (KeyCode)message.key(), message.modifiers(), message.code_point(), message.scancode()); Action* action = nullptr; - dbgln<debug_keyboard_shortcuts>("Looking up action for {}", key_event->to_string()); + dbgln<KEYBOARD_SHORTCUTS_DEBUG>("Looking up action for {}", key_event->to_string()); if (auto* focused_widget = window->focused_widget()) { for (auto* widget = focused_widget; widget && !action; widget = widget->parent_widget()) { action = widget->action_for_key_event(*key_event); - dbgln<debug_keyboard_shortcuts>(" > Focused widget {} gave action: {}", *widget, action); + dbgln<KEYBOARD_SHORTCUTS_DEBUG>(" > Focused widget {} gave action: {}", *widget, action); } } if (!action) { action = window->action_for_key_event(*key_event); - dbgln<debug_keyboard_shortcuts>(" > Asked window {}, got action: {}", *window, action); + dbgln<KEYBOARD_SHORTCUTS_DEBUG>(" > Asked window {}, got action: {}", *window, action); } // NOTE: Application-global shortcuts are ignored while a modal window is up. if (!action && !window->is_modal()) { action = Application::the()->action_for_key_event(*key_event); - dbgln<debug_keyboard_shortcuts>(" > Asked application, got action: {}", action); + dbgln<KEYBOARD_SHORTCUTS_DEBUG>(" > Asked application, got action: {}", action); } if (action) { diff --git a/Userland/Libraries/LibGemini/Job.cpp b/Userland/Libraries/LibGemini/Job.cpp index 5cad2399f9..5175dd100d 100644 --- a/Userland/Libraries/LibGemini/Job.cpp +++ b/Userland/Libraries/LibGemini/Job.cpp @@ -67,7 +67,7 @@ void Job::on_socket_connected() m_sent_data = true; auto raw_request = m_request.to_raw_request(); - if constexpr (debug_job) { + if constexpr (JOB_DEBUG) { dbgln("Job: raw_request:"); dbgln("{}", String::copy(raw_request)); } diff --git a/Userland/Libraries/LibGfx/BMPLoader.cpp b/Userland/Libraries/LibGfx/BMPLoader.cpp index b84bab5c0a..7954142800 100644 --- a/Userland/Libraries/LibGfx/BMPLoader.cpp +++ b/Userland/Libraries/LibGfx/BMPLoader.cpp @@ -317,7 +317,7 @@ static u8 get_scaled_color(u32 data, u8 mask_size, i8 mask_shift) // to scale the values in order to reach the proper value of 255. static u32 int_to_scaled_rgb(BMPLoadingContext& context, u32 data) { - dbgln<debug_bmp>("DIB info sizes before access: #masks={}, #mask_sizes={}, #mask_shifts={}", + dbgln<BMP_DEBUG>("DIB info sizes before access: #masks={}, #mask_sizes={}, #mask_shifts={}", context.dib.info.masks.size(), context.dib.info.mask_sizes.size(), context.dib.info.mask_shifts.size()); @@ -465,7 +465,7 @@ static bool decode_bmp_header(BMPLoadingContext& context) return true; if (!context.file_bytes || context.file_size < bmp_header_size) { - dbgln<debug_bmp>("Missing BMP header"); + dbgln<BMP_DEBUG>("Missing BMP header"); context.state = BMPLoadingContext::State::Error; return false; } @@ -474,7 +474,7 @@ static bool decode_bmp_header(BMPLoadingContext& context) u16 header = streamer.read_u16(); if (header != 0x4d42) { - dbgln<debug_bmp>("BMP has invalid magic header number: {:#04x}", header); + dbgln<BMP_DEBUG>("BMP has invalid magic header number: {:#04x}", header); context.state = BMPLoadingContext::State::Error; return false; } @@ -490,13 +490,13 @@ static bool decode_bmp_header(BMPLoadingContext& context) streamer.drop_bytes(4); context.data_offset = streamer.read_u32(); - if constexpr (debug_bmp) { + if constexpr (BMP_DEBUG) { dbgln("BMP file size: {}", context.file_size); dbgln("BMP data offset: {}", context.data_offset); } if (context.data_offset >= context.file_size) { - dbgln<debug_bmp>("BMP data offset is beyond file end?!"); + dbgln<BMP_DEBUG>("BMP data offset is beyond file end?!"); return false; } @@ -549,7 +549,7 @@ static bool decode_bmp_core_dib(BMPLoadingContext& context, Streamer& streamer) return false; } - if constexpr (debug_bmp) { + if constexpr (BMP_DEBUG) { dbgln("BMP width: {}", core.width); dbgln("BMP height: {}", core.height); dbgln("BMP bits_per_pixel: {}", core.bpp); @@ -598,7 +598,7 @@ static bool decode_bmp_osv2_dib(BMPLoadingContext& context, Streamer& streamer, return false; } - if constexpr (debug_bmp) { + if constexpr (BMP_DEBUG) { dbgln("BMP width: {}", core.width); dbgln("BMP height: {}", core.height); dbgln("BMP bits_per_pixel: {}", core.bpp); @@ -638,7 +638,7 @@ static bool decode_bmp_osv2_dib(BMPLoadingContext& context, Streamer& streamer, // ColorEncoding (4) + Identifier (4) streamer.drop_bytes(8); - if constexpr (debug_bmp) { + if constexpr (BMP_DEBUG) { dbgln("BMP compression: {}", info.compression); dbgln("BMP image size: {}", info.image_size); dbgln("BMP horizontal res: {}", info.horizontal_resolution); @@ -678,7 +678,7 @@ static bool decode_bmp_info_dib(BMPLoadingContext& context, Streamer& streamer) if (info.number_of_important_palette_colors == 0) info.number_of_important_palette_colors = info.number_of_palette_colors; - if constexpr (debug_bmp) { + if constexpr (BMP_DEBUG) { dbgln("BMP compression: {}", info.compression); dbgln("BMP image size: {}", info.image_size); dbgln("BMP horizontal res: {}", info.horizontal_resolution); @@ -699,7 +699,7 @@ static bool decode_bmp_v2_dib(BMPLoadingContext& context, Streamer& streamer) context.dib.info.masks.append(streamer.read_u32()); context.dib.info.masks.append(streamer.read_u32()); - if constexpr (debug_bmp) { + if constexpr (BMP_DEBUG) { dbgln("BMP red mask: {:#08x}", context.dib.info.masks[0]); dbgln("BMP green mask: {:#08x}", context.dib.info.masks[1]); dbgln("BMP blue mask: {:#08x}", context.dib.info.masks[2]); @@ -719,12 +719,12 @@ static bool decode_bmp_v3_dib(BMPLoadingContext& context, Streamer& streamer) // suite results. if (context.dib.info.compression == Compression::ALPHABITFIELDS) { context.dib.info.masks.append(streamer.read_u32()); - dbgln<debug_bmp>("BMP alpha mask: {:#08x}", context.dib.info.masks[3]); + dbgln<BMP_DEBUG>("BMP alpha mask: {:#08x}", context.dib.info.masks[3]); } else if (context.dib_size() >= 56 && context.dib.core.bpp >= 16) { auto mask = streamer.read_u32(); if ((context.dib.core.bpp == 32 && mask != 0) || context.dib.core.bpp == 16) { context.dib.info.masks.append(mask); - dbgln<debug_bmp>("BMP alpha mask: {:#08x}", mask); + dbgln<BMP_DEBUG>("BMP alpha mask: {:#08x}", mask); } } else { streamer.drop_bytes(4); @@ -745,7 +745,7 @@ static bool decode_bmp_v4_dib(BMPLoadingContext& context, Streamer& streamer) v4.blue_endpoint = { streamer.read_i32(), streamer.read_i32(), streamer.read_i32() }; v4.gamma_endpoint = { streamer.read_u32(), streamer.read_u32(), streamer.read_u32() }; - if constexpr (debug_bmp) { + if constexpr (BMP_DEBUG) { dbgln("BMP color space: {}", v4.color_space); dbgln("BMP red endpoint: {}", v4.red_endpoint); dbgln("BMP green endpoint: {}", v4.green_endpoint); @@ -766,7 +766,7 @@ static bool decode_bmp_v5_dib(BMPLoadingContext& context, Streamer& streamer) v5.profile_data = streamer.read_u32(); v5.profile_size = streamer.read_u32(); - if constexpr (debug_bmp) { + if constexpr (BMP_DEBUG) { dbgln("BMP intent: {}", v5.intent); dbgln("BMP profile data: {}", v5.profile_data); dbgln("BMP profile size: {}", v5.profile_size); @@ -801,7 +801,7 @@ static bool decode_bmp_dib(BMPLoadingContext& context) streamer = Streamer(context.file_bytes + bmp_header_size + 4, context.data_offset - bmp_header_size - 4); - dbgln<debug_bmp>("BMP dib size: {}", dib_size); + dbgln<BMP_DEBUG>("BMP dib size: {}", dib_size); bool error = false; @@ -931,7 +931,7 @@ static bool uncompress_bmp_rle_data(BMPLoadingContext& context, ByteBuffer& buff { // RLE-compressed images cannot be stored top-down if (context.dib.core.height < 0) { - dbgln<debug_bmp>("BMP is top-down and RLE compressed"); + dbgln<BMP_DEBUG>("BMP is top-down and RLE compressed"); context.state = BMPLoadingContext::State::Error; return false; } diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp index 0418244d93..76d2b0adcd 100644 --- a/Userland/Libraries/LibGfx/GIFLoader.cpp +++ b/Userland/Libraries/LibGfx/GIFLoader.cpp @@ -212,13 +212,13 @@ public: } if (m_current_code > m_code_table.size()) { - dbgln<debug_gif>("Corrupted LZW stream, invalid code: {} at bit index {}, code table size: {}", + dbgln<GIF_DEBUG>("Corrupted LZW stream, invalid code: {} at bit index {}, code table size: {}", m_current_code, m_current_bit_index, m_code_table.size()); return {}; } else if (m_current_code == m_code_table.size() && m_output.is_empty()) { - dbgln<debug_gif>("Corrupted LZW stream, valid new code but output buffer is empty: {} at bit index {}, code table size: {}", + dbgln<GIF_DEBUG>("Corrupted LZW stream, valid new code but output buffer is empty: {} at bit index {}, code table size: {}", m_current_code, m_current_bit_index, m_code_table.size()); @@ -527,12 +527,12 @@ static bool load_gif_frame_descriptors(GIFLoadingContext& context) if (extension_type == 0xFF) { if (sub_block.size() != 14) { - dbgln<debug_gif>("Unexpected application extension size: {}", sub_block.size()); + dbgln<GIF_DEBUG>("Unexpected application extension size: {}", sub_block.size()); continue; } if (sub_block[11] != 1) { - dbgln<debug_gif>("Unexpected application extension format"); + dbgln<GIF_DEBUG>("Unexpected application extension format"); continue; } diff --git a/Userland/Libraries/LibGfx/JPGLoader.cpp b/Userland/Libraries/LibGfx/JPGLoader.cpp index 33f03daeeb..8de60841db 100644 --- a/Userland/Libraries/LibGfx/JPGLoader.cpp +++ b/Userland/Libraries/LibGfx/JPGLoader.cpp @@ -230,13 +230,13 @@ static void generate_huffman_codes(HuffmanTableSpec& table) static Optional<size_t> read_huffman_bits(HuffmanStreamState& hstream, size_t count = 1) { if (count > (8 * sizeof(size_t))) { - dbgln<debug_jpg>("Can't read {} bits at once!", count); + dbgln<JPG_DEBUG>("Can't read {} bits at once!", count); return {}; } size_t value = 0; while (count--) { if (hstream.byte_offset >= hstream.stream.size()) { - dbgln<debug_jpg>("Huffman stream exhausted. This could be an error!"); + dbgln<JPG_DEBUG>("Huffman stream exhausted. This could be an error!"); return {}; } u8 current_byte = hstream.stream[hstream.byte_offset]; @@ -313,7 +313,7 @@ static bool build_macroblocks(JPGLoadingContext& context, Vector<Macroblock>& ma // For DC coefficients, symbol encodes the length of the coefficient. auto dc_length = symbol_or_error.release_value(); if (dc_length > 11) { - dbgln<debug_jpg>("DC coefficient too long: {}!", dc_length); + dbgln<JPG_DEBUG>("DC coefficient too long: {}!", dc_length); return false; } @@ -350,13 +350,13 @@ static bool build_macroblocks(JPGLoadingContext& context, Vector<Macroblock>& ma j += run_length; if (j >= 64) { - dbgln<debug_jpg>("Run-length exceeded boundaries. Cursor: {}, Skipping: {}!", j, run_length); + dbgln<JPG_DEBUG>("Run-length exceeded boundaries. Cursor: {}, Skipping: {}!", j, run_length); return false; } u8 coeff_length = ac_symbol & 0x0F; if (coeff_length > 10) { - dbgln<debug_jpg>("AC coefficient too long: {}!", coeff_length); + dbgln<JPG_DEBUG>("AC coefficient too long: {}!", coeff_length); return false; } @@ -383,7 +383,7 @@ static Optional<Vector<Macroblock>> decode_huffman_stream(JPGLoadingContext& con Vector<Macroblock> macroblocks; macroblocks.resize(context.mblock_meta.padded_total); - if constexpr (debug_jpg) { + if constexpr (JPG_DEBUG) { dbgln("Image width: {}", context.frame.width); dbgln("Image height: {}", context.frame.height); dbgln("Macroblocks in a row: {}", context.mblock_meta.hpadded_count); @@ -422,7 +422,7 @@ static Optional<Vector<Macroblock>> decode_huffman_stream(JPGLoadingContext& con } if (!build_macroblocks(context, macroblocks, hcursor, vcursor)) { - if constexpr (debug_jpg) { + if constexpr (JPG_DEBUG) { dbgln("Failed to build Macroblock {}", i); dbgln("Huffman stream byte offset {}", context.huffman_stream.byte_offset); dbgln("Huffman stream bit offset {}", context.huffman_stream.bit_offset); @@ -445,7 +445,7 @@ static inline bool is_valid_marker(const Marker marker) if (marker >= JPG_APPN0 && marker <= JPG_APPNF) { if (marker != JPG_APPN0) - dbgln<debug_jpg>("{:#04x} not supported yet. The decoder may fail!", marker); + dbgln<JPG_DEBUG>("{:#04x} not supported yet. The decoder may fail!", marker); return true; } if (marker >= JPG_RESERVED1 && marker <= JPG_RESERVEDD) @@ -467,7 +467,7 @@ static inline bool is_valid_marker(const Marker marker) if (marker >= 0xFFC0 && marker <= 0xFFCF) { if (marker != 0xFFC4 && marker != 0xFFC8 && marker != 0xFFCC) { - dbgln<debug_jpg>("Decoding this frame-type (SOF{}) is not currently supported. Decoder will fail!", marker & 0xf); + dbgln<JPG_DEBUG>("Decoding this frame-type (SOF{}) is not currently supported. Decoder will fail!", marker & 0xf); return false; } } @@ -504,7 +504,7 @@ static inline Marker read_marker_at_cursor(InputMemoryStream& stream) static bool read_start_of_scan(InputMemoryStream& stream, JPGLoadingContext& context) { if (context.state < JPGLoadingContext::State::FrameDecoded) { - dbgln<debug_jpg>("{}: SOS found before reading a SOF!", stream.offset()); + dbgln<JPG_DEBUG>("{}: SOS found before reading a SOF!", stream.offset()); return false; } @@ -519,7 +519,7 @@ static bool read_start_of_scan(InputMemoryStream& stream, JPGLoadingContext& con if (stream.handle_any_error()) return false; if (component_count != context.component_count) { - dbgln<debug_jpg>("{}: Unsupported number of components: {}!", stream.offset(), component_count); + dbgln<JPG_DEBUG>("{}: Unsupported number of components: {}!", stream.offset(), component_count); return false; } @@ -538,7 +538,7 @@ static bool read_start_of_scan(InputMemoryStream& stream, JPGLoadingContext& con return false; } } else { - dbgln<debug_jpg>("{}: Unsupported component id: {}!", stream.offset(), component_id); + dbgln<JPG_DEBUG>("{}: Unsupported component id: {}!", stream.offset(), component_id); return false; } @@ -551,17 +551,17 @@ static bool read_start_of_scan(InputMemoryStream& stream, JPGLoadingContext& con component->ac_destination_id = table_ids & 0x0F; if (context.dc_tables.size() != context.ac_tables.size()) { - dbgln<debug_jpg>("{}: DC & AC table count mismatch!", stream.offset()); + dbgln<JPG_DEBUG>("{}: DC & AC table count mismatch!", stream.offset()); return false; } if (!context.dc_tables.contains(component->dc_destination_id)) { - dbgln<debug_jpg>("DC table (id: {}) does not exist!", component->dc_destination_id); + dbgln<JPG_DEBUG>("DC table (id: {}) does not exist!", component->dc_destination_id); return false; } if (!context.ac_tables.contains(component->ac_destination_id)) { - dbgln<debug_jpg>("AC table (id: {}) does not exist!", component->ac_destination_id); + dbgln<JPG_DEBUG>("AC table (id: {}) does not exist!", component->ac_destination_id); return false; } } @@ -580,7 +580,7 @@ static bool read_start_of_scan(InputMemoryStream& stream, JPGLoadingContext& con return false; // The three values should be fixed for baseline JPEGs utilizing sequential DCT. if (spectral_selection_start != 0 || spectral_selection_end != 63 || successive_approximation != 0) { - dbgln<debug_jpg>("{}: ERROR! Start of Selection: {}, End of Selection: {}, Successive Approximation: {}!", + dbgln<JPG_DEBUG>("{}: ERROR! Start of Selection: {}, End of Selection: {}, Successive Approximation: {}!", stream.offset(), spectral_selection_start, spectral_selection_end, @@ -597,7 +597,7 @@ static bool read_reset_marker(InputMemoryStream& stream, JPGLoadingContext& cont return false; bytes_to_read -= 2; if (bytes_to_read != 2) { - dbgln<debug_jpg>("{}: Malformed reset marker found!", stream.offset()); + dbgln<JPG_DEBUG>("{}: Malformed reset marker found!", stream.offset()); return false; } context.dc_reset_interval = read_be_word(stream); @@ -623,11 +623,11 @@ static bool read_huffman_table(InputMemoryStream& stream, JPGLoadingContext& con u8 table_type = table_info >> 4; u8 table_destination_id = table_info & 0x0F; if (table_type > 1) { - dbgln<debug_jpg>("{}: Unrecognized huffman table: {}!", stream.offset(), table_type); + dbgln<JPG_DEBUG>("{}: Unrecognized huffman table: {}!", stream.offset(), table_type); return false; } if (table_destination_id > 1) { - dbgln<debug_jpg>("{}: Invalid huffman table destination id: {}!", stream.offset(), table_destination_id); + dbgln<JPG_DEBUG>("{}: Invalid huffman table destination id: {}!", stream.offset(), table_destination_id); return false; } @@ -667,7 +667,7 @@ static bool read_huffman_table(InputMemoryStream& stream, JPGLoadingContext& con } if (bytes_to_read != 0) { - dbgln<debug_jpg>("{}: Extra bytes detected in huffman header!", stream.offset()); + dbgln<JPG_DEBUG>("{}: Extra bytes detected in huffman header!", stream.offset()); return false; } return true; @@ -683,7 +683,7 @@ static inline bool validate_luma_and_modify_context(const ComponentSpec& luma, J context.hsample_factor = luma.hsample_factor; context.vsample_factor = luma.vsample_factor; - if constexpr (debug_jpg) { + if constexpr (JPG_DEBUG) { dbgln("Horizontal Subsampling Factor: {}", luma.hsample_factor); dbgln("Vertical Subsampling Factor: {}", luma.vsample_factor); } @@ -705,7 +705,7 @@ static inline void set_macroblock_metadata(JPGLoadingContext& context) static bool read_start_of_frame(InputMemoryStream& stream, JPGLoadingContext& context) { if (context.state == JPGLoadingContext::FrameDecoded) { - dbgln<debug_jpg>("{}: SOF repeated!", stream.offset()); + dbgln<JPG_DEBUG>("{}: SOF repeated!", stream.offset()); return false; } @@ -721,7 +721,7 @@ static bool read_start_of_frame(InputMemoryStream& stream, JPGLoadingContext& co if (stream.handle_any_error()) return false; if (context.frame.precision != 8) { - dbgln<debug_jpg>("{}: SOF precision != 8!", stream.offset()); + dbgln<JPG_DEBUG>("{}: SOF precision != 8!", stream.offset()); return false; } @@ -732,7 +732,7 @@ static bool read_start_of_frame(InputMemoryStream& stream, JPGLoadingContext& co if (stream.handle_any_error()) return false; if (!context.frame.width || !context.frame.height) { - dbgln<debug_jpg>("{}: ERROR! Image height: {}, Image width: {}!", stream.offset(), context.frame.height, context.frame.width); + dbgln<JPG_DEBUG>("{}: ERROR! Image height: {}, Image width: {}!", stream.offset(), context.frame.height, context.frame.width); return false; } @@ -747,7 +747,7 @@ static bool read_start_of_frame(InputMemoryStream& stream, JPGLoadingContext& co if (stream.handle_any_error()) return false; if (context.component_count != 1 && context.component_count != 3) { - dbgln<debug_jpg>("{}: Unsupported number of components in SOF: {}!", stream.offset(), context.component_count); + dbgln<JPG_DEBUG>("{}: Unsupported number of components in SOF: {}!", stream.offset(), context.component_count); return false; } @@ -770,7 +770,7 @@ static bool read_start_of_frame(InputMemoryStream& stream, JPGLoadingContext& co // By convention, downsampling is applied only on chroma components. So we should // hope to see the maximum sampling factor in the luma component. if (!validate_luma_and_modify_context(component, context)) { - dbgln<debug_jpg>("{}: Unsupported luma subsampling factors: horizontal: {}, vertical: {}", + dbgln<JPG_DEBUG>("{}: Unsupported luma subsampling factors: horizontal: {}, vertical: {}", stream.offset(), component.hsample_factor, component.vsample_factor); @@ -778,7 +778,7 @@ static bool read_start_of_frame(InputMemoryStream& stream, JPGLoadingContext& co } } else { if (component.hsample_factor != 1 || component.vsample_factor != 1) { - dbgln<debug_jpg>("{}: Unsupported chroma subsampling factors: horizontal: {}, vertical: {}", + dbgln<JPG_DEBUG>("{}: Unsupported chroma subsampling factors: horizontal: {}, vertical: {}", stream.offset(), component.hsample_factor, component.vsample_factor); @@ -790,7 +790,7 @@ static bool read_start_of_frame(InputMemoryStream& stream, JPGLoadingContext& co if (stream.handle_any_error()) return false; if (component.qtable_id > 1) { - dbgln<debug_jpg>("{}: Unsupported quantization table id: {}!", stream.offset(), component.qtable_id); + dbgln<JPG_DEBUG>("{}: Unsupported quantization table id: {}!", stream.offset(), component.qtable_id); return false; } @@ -815,12 +815,12 @@ static bool read_quantization_table(InputMemoryStream& stream, JPGLoadingContext return false; u8 element_unit_hint = info_byte >> 4; if (element_unit_hint > 1) { - dbgln<debug_jpg>("{}: Unsupported unit hint in quantization table: {}!", stream.offset(), element_unit_hint); + dbgln<JPG_DEBUG>("{}: Unsupported unit hint in quantization table: {}!", stream.offset(), element_unit_hint); return false; } u8 table_id = info_byte & 0x0F; if (table_id > 1) { - dbgln<debug_jpg>("{}: Unsupported quantization table id: {}!", stream.offset(), table_id); + dbgln<JPG_DEBUG>("{}: Unsupported quantization table id: {}!", stream.offset(), table_id); return false; } u32* table = table_id == 0 ? context.luma_table : context.chroma_table; @@ -843,7 +843,7 @@ static bool read_quantization_table(InputMemoryStream& stream, JPGLoadingContext bytes_to_read -= 1 + (element_unit_hint == 0 ? 64 : 128); } if (bytes_to_read != 0) { - dbgln<debug_jpg>("{}: Invalid length for one or more quantization tables!", stream.offset()); + dbgln<JPG_DEBUG>("{}: Invalid length for one or more quantization tables!", stream.offset()); return false; } @@ -1109,7 +1109,7 @@ static bool parse_header(InputMemoryStream& stream, JPGLoadingContext& context) if (stream.handle_any_error()) return false; if (marker != JPG_SOI) { - dbgln<debug_jpg>("{}: SOI not found: {:x}!", stream.offset(), marker); + dbgln<JPG_DEBUG>("{}: SOI not found: {:x}!", stream.offset(), marker); return false; } for (;;) { @@ -1137,7 +1137,7 @@ static bool parse_header(InputMemoryStream& stream, JPGLoadingContext& context) case JPG_RST7: case JPG_SOI: case JPG_EOI: - dbgln<debug_jpg>("{}: Unexpected marker {:x}!", stream.offset(), marker); + dbgln<JPG_DEBUG>("{}: Unexpected marker {:x}!", stream.offset(), marker); return false; case JPG_SOF0: if (!read_start_of_frame(stream, context)) @@ -1160,7 +1160,7 @@ static bool parse_header(InputMemoryStream& stream, JPGLoadingContext& context) return read_start_of_scan(stream, context); default: if (!skip_marker_with_length(stream)) { - dbgln<debug_jpg>("{}: Error skipping marker: {:x}!", stream.offset(), marker); + dbgln<JPG_DEBUG>("{}: Error skipping marker: {:x}!", stream.offset(), marker); return false; } break; @@ -1182,7 +1182,7 @@ static bool scan_huffman_stream(InputMemoryStream& stream, JPGLoadingContext& co last_byte = current_byte; stream >> current_byte; if (stream.handle_any_error()) { - dbgln<debug_jpg>("{}: EOI not found!", stream.offset()); + dbgln<JPG_DEBUG>("{}: EOI not found!", stream.offset()); return false; } @@ -1206,7 +1206,7 @@ static bool scan_huffman_stream(InputMemoryStream& stream, JPGLoadingContext& co return false; continue; } - dbgln<debug_jpg>("{}: Invalid marker: {:x}!", stream.offset(), marker); + dbgln<JPG_DEBUG>("{}: Invalid marker: {:x}!", stream.offset(), marker); return false; } else { context.huffman_stream.stream.append(last_byte); @@ -1227,7 +1227,7 @@ static bool decode_jpg(JPGLoadingContext& context) auto result = decode_huffman_stream(context); if (!result.has_value()) { - dbgln<debug_jpg>("{}: Failed to decode Macroblocks!", stream.offset()); + dbgln<JPG_DEBUG>("{}: Failed to decode Macroblocks!", stream.offset()); return false; } diff --git a/Userland/Libraries/LibGfx/PNGLoader.cpp b/Userland/Libraries/LibGfx/PNGLoader.cpp index 868cf1f0ab..904f51e109 100644 --- a/Userland/Libraries/LibGfx/PNGLoader.cpp +++ b/Userland/Libraries/LibGfx/PNGLoader.cpp @@ -613,7 +613,7 @@ static bool decode_png_bitmap_simple(PNGLoadingContext& context) } if (filter > 4) { - dbgln<debug_png>("Invalid PNG filter: {}", filter); + dbgln<PNG_DEBUG>("Invalid PNG filter: {}", filter); context.state = PNGLoadingContext::State::Error; return false; } @@ -715,7 +715,7 @@ static bool decode_adam7_pass(PNGLoadingContext& context, Streamer& streamer, in } if (filter > 4) { - dbgln<debug_png>("Invalid PNG filter: {}", filter); + dbgln<PNG_DEBUG>("Invalid PNG filter: {}", filter); context.state = PNGLoadingContext::State::Error; return false; } diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp index b38eb1b4eb..e1fe64c78e 100644 --- a/Userland/Libraries/LibGfx/Painter.cpp +++ b/Userland/Libraries/LibGfx/Painter.cpp @@ -925,7 +925,7 @@ void Painter::draw_glyph_or_emoji(const IntPoint& point, u32 code_point, const F // Perhaps it's an emoji? auto* emoji = Emoji::emoji_for_code_point(code_point); if (emoji == nullptr) { - dbgln<debug_emoji>("Failed to find an emoji for code_point {}", code_point); + dbgln<EMOJI_DEBUG>("Failed to find an emoji for code_point {}", code_point); draw_glyph(point, '?', font, color); return; } @@ -1639,7 +1639,7 @@ void Painter::fill_path(Path& path, Color color, WindingRule winding_rule) // The points between this segment and the previous are // inside the shape - dbgln<debug_fill_path>("y={}: {} at {}: {} -- {}", scanline, winding_number, i, from, to); + dbgln<FILL_PATH_DEBUG>("y={}: {} at {}: {} -- {}", scanline, winding_number, i, from, to); draw_line(from, to, color, 1); } diff --git a/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h b/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h index 4417d053a7..dc6f3b3826 100644 --- a/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h +++ b/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h @@ -104,14 +104,14 @@ static bool read_magic_number(TContext& context, Streamer& streamer) if (!context.data || context.data_size < 2) { context.state = TContext::State::Error; - dbgln<debug_portable_image_loader>("There is no enough data for {}", TContext::image_type); + dbgln<PORTABLE_IMAGE_LOADER_DEBUG>("There is no enough data for {}", TContext::image_type); return false; } u8 magic_number[2] {}; if (!streamer.read_bytes(magic_number, 2)) { context.state = TContext::State::Error; - dbgln<debug_portable_image_loader>("We can't read magic number for {}", TContext::image_type); + dbgln<PORTABLE_IMAGE_LOADER_DEBUG>("We can't read magic number for {}", TContext::image_type); return false; } @@ -128,7 +128,7 @@ static bool read_magic_number(TContext& context, Streamer& streamer) } context.state = TContext::State::Error; - dbgln<debug_portable_image_loader>("Magic number is not valid for {}{}{}", magic_number[0], magic_number[1], TContext::image_type); + dbgln<PORTABLE_IMAGE_LOADER_DEBUG>("Magic number is not valid for {}{}{}", magic_number[0], magic_number[1], TContext::image_type); return false; } @@ -186,7 +186,7 @@ static bool read_max_val(TContext& context, Streamer& streamer) } if (context.max_val > 255) { - dbgln<debug_portable_image_loader>("We can't parse 2 byte color for {}", TContext::image_type); + dbgln<PORTABLE_IMAGE_LOADER_DEBUG>("We can't parse 2 byte color for {}", TContext::image_type); context.state = TContext::Error; return false; } diff --git a/Userland/Libraries/LibHTTP/Job.cpp b/Userland/Libraries/LibHTTP/Job.cpp index 0c69848dab..eb5164daa3 100644 --- a/Userland/Libraries/LibHTTP/Job.cpp +++ b/Userland/Libraries/LibHTTP/Job.cpp @@ -36,14 +36,14 @@ namespace HTTP { static ByteBuffer handle_content_encoding(const ByteBuffer& buf, const String& content_encoding) { - dbgln<debug_job>("Job::handle_content_encoding: buf has content_encoding={}", content_encoding); + dbgln<JOB_DEBUG>("Job::handle_content_encoding: buf has content_encoding={}", content_encoding); if (content_encoding == "gzip") { if (!Core::Gzip::is_compressed(buf)) { dbgln("Job::handle_content_encoding: buf is not gzip compressed!"); } - dbgln<debug_job>("Job::handle_content_encoding: buf is gzip compressed!"); + dbgln<JOB_DEBUG>("Job::handle_content_encoding: buf is gzip compressed!"); auto uncompressed = Core::Gzip::decompress(buf); if (!uncompressed.has_value()) { @@ -51,7 +51,7 @@ static ByteBuffer handle_content_encoding(const ByteBuffer& buf, const String& c return buf; } - if constexpr (debug_job) { + if constexpr (JOB_DEBUG) { dbgln("Job::handle_content_encoding: Gzip::decompress() successful."); dbgln(" Input size: {}", buf.size()); dbgln(" Output size: {}", uncompressed.value().size()); @@ -77,7 +77,7 @@ void Job::flush_received_buffers() { if (!m_can_stream_response || m_buffered_size == 0) return; - dbgln<debug_job>("Job: Flushing received buffers: have {} bytes in {} buffers", m_buffered_size, m_received_buffers.size()); + dbgln<JOB_DEBUG>("Job: Flushing received buffers: have {} bytes in {} buffers", m_buffered_size, m_received_buffers.size()); for (size_t i = 0; i < m_received_buffers.size(); ++i) { auto& payload = m_received_buffers[i]; auto written = do_write(payload); @@ -92,7 +92,7 @@ void Job::flush_received_buffers() payload = payload.slice(written, payload.size() - written); break; } - dbgln<debug_job>("Job: Flushing received buffers done: have {} bytes in {} buffers", m_buffered_size, m_received_buffers.size()); + dbgln<JOB_DEBUG>("Job: Flushing received buffers done: have {} bytes in {} buffers", m_buffered_size, m_received_buffers.size()); } void Job::on_socket_connected() @@ -103,7 +103,7 @@ void Job::on_socket_connected() m_sent_data = true; auto raw_request = m_request.to_raw_request(); - if constexpr (debug_job) { + if constexpr (JOB_DEBUG) { dbgln("Job: raw_request:"); dbgln("{}", String::copy(raw_request)); } @@ -198,10 +198,10 @@ void Job::on_socket_connected() m_headers.set(name, value); if (name.equals_ignoring_case("Content-Encoding")) { // Assume that any content-encoding means that we can't decode it as a stream :( - dbgln<debug_job>("Content-Encoding {} detected, cannot stream output :(", value); + dbgln<JOB_DEBUG>("Content-Encoding {} detected, cannot stream output :(", value); m_can_stream_response = false; } - dbgln<debug_job>("Job: [{}] = '{}'", name, value); + dbgln<JOB_DEBUG>("Job: [{}] = '{}'", name, value); return; } ASSERT(m_state == State::InBody); @@ -216,7 +216,7 @@ void Job::on_socket_connected() // read size auto size_data = read_line(PAGE_SIZE); auto size_lines = size_data.view().lines(); - dbgln<debug_job>("Job: Received a chunk with size '{}'", size_data); + dbgln<JOB_DEBUG>("Job: Received a chunk with size '{}'", size_data); if (size_lines.size() == 0) { dbgln("Job: Reached end of stream"); finish_up(); @@ -239,26 +239,26 @@ void Job::on_socket_connected() m_current_chunk_total_size = 0; m_current_chunk_remaining_size = 0; - dbgln<debug_job>("Job: Received the last chunk with extensions '{}'", size_string.substring_view(1, size_string.length() - 1)); + dbgln<JOB_DEBUG>("Job: Received the last chunk with extensions '{}'", size_string.substring_view(1, size_string.length() - 1)); } else { m_current_chunk_total_size = size; m_current_chunk_remaining_size = size; read_size = size; - dbgln<debug_job>("Job: Chunk of size '{}' started", size); + dbgln<JOB_DEBUG>("Job: Chunk of size '{}' started", size); } } } else { read_size = remaining; - dbgln<debug_job>("Job: Resuming chunk with '{}' bytes left over", remaining); + dbgln<JOB_DEBUG>("Job: Resuming chunk with '{}' bytes left over", remaining); } } else { auto transfer_encoding = m_headers.get("Transfer-Encoding"); if (transfer_encoding.has_value()) { auto encoding = transfer_encoding.value(); - dbgln<debug_job>("Job: This content has transfer encoding '{}'", encoding); + dbgln<JOB_DEBUG>("Job: This content has transfer encoding '{}'", encoding); if (encoding.equals_ignoring_case("chunked")) { m_current_chunk_remaining_size = -1; goto read_chunk_size; @@ -289,9 +289,9 @@ void Job::on_socket_connected() if (m_current_chunk_remaining_size.has_value()) { auto size = m_current_chunk_remaining_size.value() - payload.size(); - dbgln<debug_job>("Job: We have {} bytes left over in this chunk", size); + dbgln<JOB_DEBUG>("Job: We have {} bytes left over in this chunk", size); if (size == 0) { - dbgln<debug_job>("Job: Finished a chunk of {} bytes", m_current_chunk_total_size.value()); + dbgln<JOB_DEBUG>("Job: Finished a chunk of {} bytes", m_current_chunk_total_size.value()); if (m_current_chunk_total_size.value() == 0) { m_state = State::Trailers; @@ -302,7 +302,7 @@ void Job::on_socket_connected() size = -1; [[maybe_unused]] auto line = read_line(PAGE_SIZE); - if constexpr (debug_job) + if constexpr (JOB_DEBUG) dbgln("Line following (should be empty): '{}'", line); } m_current_chunk_remaining_size = size; diff --git a/Userland/Libraries/LibMarkdown/Table.cpp b/Userland/Libraries/LibMarkdown/Table.cpp index 81bd1c5360..6cf0ef2bd6 100644 --- a/Userland/Libraries/LibMarkdown/Table.cpp +++ b/Userland/Libraries/LibMarkdown/Table.cpp @@ -182,7 +182,7 @@ OwnPtr<Table> Table::parse(Vector<StringView>::ConstIterator& lines) size_t relative_width = delimiter.length(); for (auto ch : delimiter) { if (ch != '-') { - dbgln<debug_markdown>("Invalid character _{}_ in table heading delimiter (ignored)", ch); + dbgln<MARKDOWN_DEBUG>("Invalid character _{}_ in table heading delimiter (ignored)", ch); --relative_width; } } diff --git a/Userland/Libraries/LibRegex/RegexByteCode.cpp b/Userland/Libraries/LibRegex/RegexByteCode.cpp index 5f124b3468..b996c4b7ca 100644 --- a/Userland/Libraries/LibRegex/RegexByteCode.cpp +++ b/Userland/Libraries/LibRegex/RegexByteCode.cpp @@ -370,7 +370,7 @@ ALWAYS_INLINE ExecutionResult OpCode_SaveRightNamedCaptureGroup::execute(const M auto& map = output.named_capture_group_matches.at(input.match_index); - if constexpr (debug_regex) { + if constexpr (REGEX_DEBUG) { ASSERT(start_position + length <= input.view.length()); dbgln("Save named capture group with name={} and content='{}'", capture_group_name, input.view.substring_view(start_position, length)); } diff --git a/Userland/Libraries/LibRegex/RegexMatcher.cpp b/Userland/Libraries/LibRegex/RegexMatcher.cpp index cadc74fece..16a6662351 100644 --- a/Userland/Libraries/LibRegex/RegexMatcher.cpp +++ b/Userland/Libraries/LibRegex/RegexMatcher.cpp @@ -148,7 +148,7 @@ RegexResult Matcher<Parser>::match(const Vector<RegexStringView> views, Optional for (auto& view : views) { input.view = view; - dbgln<debug_regex>("[match] Starting match with view ({}): _{}_", view.length(), view); + dbgln<REGEX_DEBUG>("[match] Starting match with view ({}): _{}_", view.length(), view); auto view_length = view.length(); size_t view_index = m_pattern.start_offset; @@ -214,7 +214,7 @@ RegexResult Matcher<Parser>::match(const Vector<RegexStringView> views, Optional continue; } - if constexpr (debug_regex) { + if constexpr (REGEX_DEBUG) { dbgln("state.string_position={}, view_index={}", state.string_position, view_index); dbgln("[match] Found a match (length={}): '{}'", state.string_position - view_index, input.view.substring_view(view_index, state.string_position - view_index)); } diff --git a/Userland/Libraries/LibTLS/ClientHandshake.cpp b/Userland/Libraries/LibTLS/ClientHandshake.cpp index 99ebc72822..60498e7366 100644 --- a/Userland/Libraries/LibTLS/ClientHandshake.cpp +++ b/Userland/Libraries/LibTLS/ClientHandshake.cpp @@ -112,7 +112,7 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe return (i8)Error::NoCommonCipher; } m_context.cipher = cipher; - dbgln<debug_tls>("Cipher: {}", (u16)cipher); + dbgln<TLS_DEBUG>("Cipher: {}", (u16)cipher); // The handshake hash function is _always_ SHA256 m_context.handshake_hash.initialize(Crypto::Hash::HashKind::SHA256); @@ -146,7 +146,7 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe u16 extension_length = AK::convert_between_host_and_network_endian(*(const u16*)buffer.offset_pointer(res)); res += 2; - dbgln<debug_tls>("extension {} with length {}", (u16)extension_type, extension_length); + dbgln<TLS_DEBUG>("extension {} with length {}", (u16)extension_type, extension_length); if (extension_length) { if (buffer.size() - res < extension_length) { @@ -218,12 +218,12 @@ ssize_t TLSv12::handle_finished(ReadonlyBytes buffer, WritePacketStage& write_pa u32 size = buffer[0] * 0x10000 + buffer[1] * 0x100 + buffer[2]; if (size < 12) { - dbgln<debug_tls>("finished packet smaller than minimum size: {}", size); + dbgln<TLS_DEBUG>("finished packet smaller than minimum size: {}", size); return (i8)Error::BrokenPacket; } if (size < buffer.size() - index) { - dbgln<debug_tls>("not enough data after length: {} > {}", size, buffer.size() - index); + dbgln<TLS_DEBUG>("not enough data after length: {} > {}", size, buffer.size() - index); return (i8)Error::NeedMoreData; } @@ -324,7 +324,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) auto type = buffer[0]; auto write_packets { WritePacketStage::Initial }; size_t payload_size = buffer[1] * 0x10000 + buffer[2] * 0x100 + buffer[3] + 3; - dbgln<debug_tls>("payload size: {} buffer length: {}", payload_size, buffer_length); + dbgln<TLS_DEBUG>("payload size: {} buffer length: {}", payload_size, buffer_length); if (payload_size + 1 > buffer_length) return (i8)Error::NeedMoreData; diff --git a/Userland/Libraries/LibTLS/Record.cpp b/Userland/Libraries/LibTLS/Record.cpp index 5cdb816fa9..be3e136681 100644 --- a/Userland/Libraries/LibTLS/Record.cpp +++ b/Userland/Libraries/LibTLS/Record.cpp @@ -39,12 +39,12 @@ void TLSv12::write_packet(ByteBuffer& packet) m_context.tls_buffer.append(packet.data(), packet.size()); if (m_context.connection_status > ConnectionStatus::Disconnected) { if (!m_has_scheduled_write_flush) { - dbgln<debug_tls>("Scheduling write of {}", m_context.tls_buffer.size()); + dbgln<TLS_DEBUG>("Scheduling write of {}", m_context.tls_buffer.size()); deferred_invoke([this](auto&) { write_into_socket(); }); m_has_scheduled_write_flush = true; } else { // multiple packet are available, let's flush some out - dbgln<debug_tls>("Flushing scheduled write of {}", m_context.tls_buffer.size()); + dbgln<TLS_DEBUG>("Flushing scheduled write of {}", m_context.tls_buffer.size()); write_into_socket(); // the deferred invoke is still in place m_has_scheduled_write_flush = true; @@ -216,7 +216,7 @@ ByteBuffer TLSv12::hmac_message(const ReadonlyBytes& buf, const Optional<Readonl auto digest = hmac.digest(); auto mac = ByteBuffer::copy(digest.immutable_data(), digest.data_length()); - if constexpr (debug_tls) { + if constexpr (TLS_DEBUG) { dbgln("HMAC of the block for sequence number {}", sequence_number); print_buffer(mac); } @@ -230,7 +230,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) size_t header_size = res; ssize_t payload_res = 0; - dbgln<debug_tls>("buffer size: {}", buffer.size()); + dbgln<TLS_DEBUG>("buffer size: {}", buffer.size()); if (buffer.size() < 5) { return (i8)Error::NeedMoreData; @@ -241,7 +241,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) // FIXME: Read the version and verify it - if constexpr (debug_tls) { + if constexpr (TLS_DEBUG) { auto version = (Version) * (const u16*)buffer.offset_pointer(buffer_position); dbgln("type={}, version={}", (u8)type, (u16)version); } @@ -249,21 +249,21 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) buffer_position += 2; auto length = AK::convert_between_host_and_network_endian(*(const u16*)buffer.offset_pointer(buffer_position)); - dbgln<debug_tls>("record length: {} at offset: {}", length, buffer_position); + dbgln<TLS_DEBUG>("record length: {} at offset: {}", length, buffer_position); buffer_position += 2; if (buffer_position + length > buffer.size()) { - dbgln<debug_tls>("record length more than what we have: {}", buffer.size()); + dbgln<TLS_DEBUG>("record length more than what we have: {}", buffer.size()); return (i8)Error::NeedMoreData; } - dbgln<debug_tls>("message type: {}, length: {}", (u8)type, length); + dbgln<TLS_DEBUG>("message type: {}, length: {}", (u8)type, length); auto plain = buffer.slice(buffer_position, buffer.size() - buffer_position); ByteBuffer decrypted; if (m_context.cipher_spec_set && type != MessageType::ChangeCipher) { - if constexpr (debug_tls) { + if constexpr (TLS_DEBUG) { dbgln("Encrypted: "); print_buffer(buffer.slice(header_size, length)); } @@ -389,7 +389,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) auto packet = build_alert(true, (u8)AlertDescription::UnexpectedMessage); write_packet(packet); } else { - dbgln<debug_tls>("application data message of size {}", plain.size()); + dbgln<TLS_DEBUG>("application data message of size {}", plain.size()); m_context.application_buffer.append(plain.data(), plain.size()); } @@ -414,9 +414,9 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) } break; case MessageType::Alert: - dbgln<debug_tls>("alert message of length {}", length); + dbgln<TLS_DEBUG>("alert message of length {}", length); if (length >= 2) { - if constexpr (debug_tls) + if constexpr (TLS_DEBUG) print_buffer(plain); auto level = plain[0]; diff --git a/Userland/Libraries/LibTLS/Socket.cpp b/Userland/Libraries/LibTLS/Socket.cpp index 93b58064de..a8757cfb1b 100644 --- a/Userland/Libraries/LibTLS/Socket.cpp +++ b/Userland/Libraries/LibTLS/Socket.cpp @@ -174,7 +174,7 @@ void TLSv12::read_from_socket() void TLSv12::write_into_socket() { - dbgln<debug_tls>("Flushing cached records: {} established? {}", m_context.tls_buffer.size(), is_established()); + dbgln<TLS_DEBUG>("Flushing cached records: {} established? {}", m_context.tls_buffer.size(), is_established()); m_has_scheduled_write_flush = false; if (!check_connection_state(false)) @@ -199,7 +199,7 @@ bool TLSv12::check_connection_state(bool read) m_context.connection_finished = true; } if (m_context.critical_error) { - dbgln<debug_tls>("CRITICAL ERROR {} :(", m_context.critical_error); + dbgln<TLS_DEBUG>("CRITICAL ERROR {} :(", m_context.critical_error); if (on_tls_error) on_tls_error((AlertDescription)m_context.critical_error); @@ -211,7 +211,7 @@ bool TLSv12::check_connection_state(bool read) on_tls_finished(); } if (m_context.tls_buffer.size()) { - dbgln<debug_tls>("connection closed without finishing data transfer, {} bytes still in buffer and {} bytes in application buffer", + dbgln<TLS_DEBUG>("connection closed without finishing data transfer, {} bytes still in buffer and {} bytes in application buffer", m_context.tls_buffer.size(), m_context.application_buffer.size()); } else { @@ -247,7 +247,7 @@ bool TLSv12::flush() } if (m_context.send_retries++ == 10) { // drop the records, we can't send - dbgln<debug_tls>("Dropping {} bytes worth of TLS records as max retries has been reached", write_buffer().size()); + dbgln<TLS_DEBUG>("Dropping {} bytes worth of TLS records as max retries has been reached", write_buffer().size()); write_buffer().clear(); m_context.send_retries = 0; } diff --git a/Userland/Libraries/LibTLS/TLSv12.cpp b/Userland/Libraries/LibTLS/TLSv12.cpp index 62534771dc..b94f6d47b0 100644 --- a/Userland/Libraries/LibTLS/TLSv12.cpp +++ b/Userland/Libraries/LibTLS/TLSv12.cpp @@ -406,7 +406,7 @@ static ssize_t _parse_asn1(const Context& context, Certificate& cert, const u8* hash.initialize(Crypto::Hash::HashKind::SHA512); break; default: - dbgln<debug_tls>("Unsupported hash mode {}", (u32)cert.key_algorithm); + dbgln<TLS_DEBUG>("Unsupported hash mode {}", (u32)cert.key_algorithm); // fallback to md5, it will fail later hash.initialize(Crypto::Hash::HashKind::MD5); break; @@ -436,7 +436,7 @@ Optional<Certificate> TLSv12::parse_asn1(ReadonlyBytes buffer, bool) const _parse_asn1(m_context, cert, buffer.data(), buffer.size(), 1, fields, nullptr, 0, nullptr, nullptr); - dbgln<debug_tls>("Certificate issued for {} by {}", cert.subject, cert.issuer_subject); + dbgln<TLS_DEBUG>("Certificate issued for {} by {}", cert.subject, cert.issuer_subject); return cert; } @@ -454,7 +454,7 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer) u32 certificate_total_length = buffer[0] * 0x10000 + buffer[1] * 0x100 + buffer[2]; - dbgln<debug_tls>("total length: {}", certificate_total_length); + dbgln<TLS_DEBUG>("total length: {}", certificate_total_length); if (certificate_total_length <= 4) return 3 * certificate_total_length; @@ -549,7 +549,7 @@ void TLSv12::consume(ReadonlyBytes record) return; } - dbgln<debug_tls>("Consuming {} bytes", record.size()); + dbgln<TLS_DEBUG>("Consuming {} bytes", record.size()); m_context.message_buffer.append(record.data(), record.size()); @@ -559,17 +559,17 @@ void TLSv12::consume(ReadonlyBytes record) size_t size_offset { 3 }; // read the common record header size_t header_size { 5 }; - dbgln<debug_tls>("message buffer length {}", buffer_length); + dbgln<TLS_DEBUG>("message buffer length {}", buffer_length); while (buffer_length >= 5) { auto length = AK::convert_between_host_and_network_endian(*(u16*)m_context.message_buffer.offset_pointer(index + size_offset)) + header_size; if (length > buffer_length) { - dbgln<debug_tls>("Need more data: {} > {}", length, buffer_length); + dbgln<TLS_DEBUG>("Need more data: {} > {}", length, buffer_length); break; } auto consumed = handle_message(m_context.message_buffer.bytes().slice(index, length)); - if constexpr (debug_tls) { + if constexpr (TLS_DEBUG) { if (consumed > 0) dbgln("consumed {} bytes", consumed); else diff --git a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp index f817c323cc..7588af66f0 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp @@ -406,7 +406,7 @@ int main(int argc, char** argv) interface->fully_qualified_name = interface->name; } - if constexpr (debug_wrapper_generator) { + if constexpr (WRAPPER_GENERATOR_DEBUG) { dbgln("Attributes:"); for (auto& attribute : interface->attributes) { dbgln(" {}{}{} {}", diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp index 4c1a6555cf..fff01fba46 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp @@ -141,7 +141,7 @@ void HTMLDocumentParser::run(const URL& url) break; auto& token = optional_token.value(); - dbgln<debug_parser>("[{}] {}", insertion_mode_name(), token.to_string()); + dbgln<PARSER_DEBUG>("[{}] {}", insertion_mode_name(), token.to_string()); // FIXME: If the adjusted current node is a MathML text integration point and the token is a start tag whose tag name is neither "mglyph" nor "malignmark" // FIXME: If the adjusted current node is a MathML text integration point and the token is a character token @@ -157,7 +157,7 @@ void HTMLDocumentParser::run(const URL& url) } if (m_stop_parsing) { - dbgln<debug_parser>("Stop parsing{}! :^)", m_parsing_fragment ? " fragment" : ""); + dbgln<PARSER_DEBUG>("Stop parsing{}! :^)", m_parsing_fragment ? " fragment" : ""); break; } } diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp index 2ea70af30c..c0d3bf6a67 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp @@ -36,10 +36,10 @@ namespace Web::HTML { #pragma GCC diagnostic ignored "-Wunused-label" -#if TOKENIZER_TRACE -# define PARSE_ERROR() \ - do { \ - dbgln("Parse error (tokenization) {} @ {}", __PRETTY_FUNCTION__, __LINE__) \ +#if TOKENIZER_TRACE_DEBUG +# define PARSE_ERROR() \ + do { \ + dbgln("Parse error (tokenization) {} @ {}", __PRETTY_FUNCTION__, __LINE__); \ } while (0) #else # define PARSE_ERROR() @@ -221,7 +221,7 @@ Optional<u32> HTMLTokenizer::next_code_point() return {}; m_prev_utf8_iterator = m_utf8_iterator; ++m_utf8_iterator; - dbgln<debug_trace_tokenizer>("(Tokenizer) Next code_point: {}", (char)*m_prev_utf8_iterator); + dbgln<TOKENIZER_TRACE_DEBUG>("(Tokenizer) Next code_point: {}", (char)*m_prev_utf8_iterator); return *m_prev_utf8_iterator; } @@ -2618,17 +2618,17 @@ HTMLTokenizer::HTMLTokenizer(const StringView& input, const String& encoding) void HTMLTokenizer::will_switch_to([[maybe_unused]] State new_state) { - dbgln<debug_trace_tokenizer>("[{}] Switch to {}", state_name(m_state), state_name(new_state)); + dbgln<TOKENIZER_TRACE_DEBUG>("[{}] Switch to {}", state_name(m_state), state_name(new_state)); } void HTMLTokenizer::will_reconsume_in([[maybe_unused]] State new_state) { - dbgln<debug_trace_tokenizer>("[{}] Reconsume in {}", state_name(m_state), state_name(new_state)); + dbgln<TOKENIZER_TRACE_DEBUG>("[{}] Reconsume in {}", state_name(m_state), state_name(new_state)); } void HTMLTokenizer::switch_to(Badge<HTMLDocumentParser>, State new_state) { - dbgln<debug_trace_tokenizer>("[{}] Parser switches tokenizer state to {}", state_name(m_state), state_name(new_state)); + dbgln<TOKENIZER_TRACE_DEBUG>("[{}] Parser switches tokenizer state to {}", state_name(m_state), state_name(new_state)); m_state = new_state; } diff --git a/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp b/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp index ad4901587e..72b3bb3eb6 100644 --- a/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/ImageLoader.cpp @@ -72,7 +72,7 @@ void ImageLoader::resource_did_load() m_loading_state = LoadingState::Loaded; - if constexpr (debug_image_loader) { + if constexpr (IMAGE_LOADER_DEBUG) { if (!resource()->has_encoded_data()) { dbgln("ImageLoader: Resource did load, no encoded data. URL: {}", resource()->url()); } else { diff --git a/Userland/Libraries/LibWeb/Loader/Resource.cpp b/Userland/Libraries/LibWeb/Loader/Resource.cpp index 666654a05f..c7ef689235 100644 --- a/Userland/Libraries/LibWeb/Loader/Resource.cpp +++ b/Userland/Libraries/LibWeb/Loader/Resource.cpp @@ -100,7 +100,7 @@ void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, const HashMap m_encoding = encoding_from_content_type(content_type.value()); m_mime_type = mime_type_from_content_type(content_type.value()); } else if (url().protocol() == "data" && !url().data_mime_type().is_empty()) { - dbgln<debug_resource>("This is a data URL with mime-type _{}_", url().data_mime_type()); + dbgln<RESOURCE_DEBUG>("This is a data URL with mime-type _{}_", url().data_mime_type()); m_encoding = "utf-8"; // FIXME: This doesn't seem nice. m_mime_type = url().data_mime_type(); } else { diff --git a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp index ab39743fd8..41d0adf8f4 100644 --- a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp @@ -86,7 +86,7 @@ RefPtr<Resource> ResourceLoader::load_resource(Resource::Type type, const LoadRe if (it->value->type() != type) { dbgln("FIXME: Not using cached resource for {} since there's a type mismatch.", request.url()); } else { - dbgln<debug_cache>("Reusing cached resource for: {}", request.url()); + dbgln<CACHE_DEBUG>("Reusing cached resource for: {}", request.url()); return it->value; } } diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp index a11ac8c7fd..35657ece06 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp @@ -38,7 +38,7 @@ namespace Web::SVG { static void print_instruction(const PathInstruction& instruction) { - ASSERT(debug_path); + ASSERT(PATH_DEBUG); auto& data = instruction.data; @@ -463,7 +463,7 @@ Gfx::Path& SVGPathElement::get_path() auto& absolute = instruction.absolute; auto& data = instruction.data; - if constexpr (debug_path) { + if constexpr (PATH_DEBUG) { print_instruction(instruction); } diff --git a/Userland/Libraries/LibWeb/WebContentClient.cpp b/Userland/Libraries/LibWeb/WebContentClient.cpp index 22f818f5e2..dd40e426be 100644 --- a/Userland/Libraries/LibWeb/WebContentClient.cpp +++ b/Userland/Libraries/LibWeb/WebContentClient.cpp @@ -56,7 +56,7 @@ void WebContentClient::handle([[maybe_unused]] const Messages::WebContentClient: void WebContentClient::handle(const Messages::WebContentClient::DidInvalidateContentRect& message) { - dbgln<debug_spam>("handle: WebContentClient::DidInvalidateContentRect! content_rect={}", message.content_rect()); + dbgln<SPAM_DEBUG>("handle: WebContentClient::DidInvalidateContentRect! content_rect={}", message.content_rect()); // FIXME: Figure out a way to coalesce these messages to reduce unnecessary painting m_view.notify_server_did_invalidate_content_rect({}, message.content_rect()); @@ -72,25 +72,25 @@ void WebContentClient::handle(const Messages::WebContentClient::DidChangeSelecti void WebContentClient::handle(const Messages::WebContentClient::DidLayout& message) { - dbgln<debug_spam>("handle: WebContentClient::DidLayout! content_size={}", message.content_size()); + dbgln<SPAM_DEBUG>("handle: WebContentClient::DidLayout! content_size={}", message.content_size()); m_view.notify_server_did_layout({}, message.content_size()); } void WebContentClient::handle(const Messages::WebContentClient::DidChangeTitle& message) { - dbgln<debug_spam>("handle: WebContentClient::DidChangeTitle! title={}", message.title()); + dbgln<SPAM_DEBUG>("handle: WebContentClient::DidChangeTitle! title={}", message.title()); m_view.notify_server_did_change_title({}, message.title()); } void WebContentClient::handle(const Messages::WebContentClient::DidRequestScrollIntoView& message) { - dbgln<debug_spam>("handle: WebContentClient::DidRequestScrollIntoView! rect={}", message.rect()); + dbgln<SPAM_DEBUG>("handle: WebContentClient::DidRequestScrollIntoView! rect={}", message.rect()); m_view.notify_server_did_request_scroll_into_view({}, message.rect()); } void WebContentClient::handle(const Messages::WebContentClient::DidHoverLink& message) { - dbgln<debug_spam>("handle: WebContentClient::DidHoverLink! url={}", message.url()); + dbgln<SPAM_DEBUG>("handle: WebContentClient::DidHoverLink! url={}", message.url()); m_view.notify_server_did_hover_link({}, message.url()); } diff --git a/Userland/Services/DHCPClient/DHCPv4.cpp b/Userland/Services/DHCPClient/DHCPv4.cpp index 0d2041405e..b164028df2 100644 --- a/Userland/Services/DHCPClient/DHCPv4.cpp +++ b/Userland/Services/DHCPClient/DHCPv4.cpp @@ -44,7 +44,7 @@ ParsedDHCPv4Options DHCPv4Packet::parse_options() const dbgln("Bogus option length {} assuming forgotten END", length); break; } - dbgln<debug_dhcpv4>("DHCP Option {} with length {}", (u8)opt_name, length); + dbgln<DHCPV4_DEBUG>("DHCP Option {} with length {}", (u8)opt_name, length); ++index; options.options.set(opt_name, { length, &m_options[index] }); index += length - 1; diff --git a/Userland/Services/DHCPClient/DHCPv4Client.cpp b/Userland/Services/DHCPClient/DHCPv4Client.cpp index 59b1668266..6d2a3f3415 100644 --- a/Userland/Services/DHCPClient/DHCPv4Client.cpp +++ b/Userland/Services/DHCPClient/DHCPv4Client.cpp @@ -156,7 +156,7 @@ void DHCPv4Client::handle_offer(const DHCPv4Packet& packet, const ParsedDHCPv4Op void DHCPv4Client::handle_ack(const DHCPv4Packet& packet, const ParsedDHCPv4Options& options) { - if constexpr (debug_dhcpv4_client) { + if constexpr (DHCPV4CLIENT_DEBUG) { dbgln("The DHCP server handed us {}", packet.yiaddr().to_string()); dbgln("Here are the options: {}", options.to_string()); } @@ -207,7 +207,7 @@ void DHCPv4Client::process_incoming(const DHCPv4Packet& packet) { auto options = packet.parse_options(); - dbgln<debug_dhcpv4_client>("Here are the options: {}", options.to_string()); + dbgln<DHCPV4CLIENT_DEBUG>("Here are the options: {}", options.to_string()); auto value = options.get<DHCPMessageType>(DHCPOption::DHCPMessageType).value(); switch (value) { @@ -239,7 +239,7 @@ void DHCPv4Client::dhcp_discover(const InterfaceDescriptor& iface, IPv4Address p { auto transaction_id = rand(); - if constexpr (debug_dhcpv4_client) { + if constexpr (DHCPV4CLIENT_DEBUG) { dbgln("Trying to lease an IP for {} with ID {}", iface.m_ifname, transaction_id); if (!previous.is_zero()) dbgln("going to request the server to hand us {}", previous.to_string()); diff --git a/Userland/Services/SystemMenu/main.cpp b/Userland/Services/SystemMenu/main.cpp index 7c193cf3f6..d5897d3c60 100644 --- a/Userland/Services/SystemMenu/main.cpp +++ b/Userland/Services/SystemMenu/main.cpp @@ -142,7 +142,7 @@ NonnullRefPtr<GUI::Menu> build_system_menu() for (const auto& app : g_apps) { auto icon = GUI::FileIconProvider::icon_for_executable(app.executable).bitmap_for_size(16); - if constexpr (debug_system_menu) { + if constexpr (SYSTEM_MENU_DEBUG) { if (icon) dbgln("App {} has icon with size {}", app.name, icon->size()); } diff --git a/Userland/Services/SystemServer/Service.cpp b/Userland/Services/SystemServer/Service.cpp index a24f10f87b..b59629ac71 100644 --- a/Userland/Services/SystemServer/Service.cpp +++ b/Userland/Services/SystemServer/Service.cpp @@ -115,7 +115,7 @@ void Service::setup_notifier() void Service::handle_socket_connection() { - dbgln<debug_service>("Ready to read on behalf of {}", name()); + dbgln<SERVICE_DEBUG>("Ready to read on behalf of {}", name()); if (m_accept_socket_connections) { int accepted_fd = accept(m_socket_fd, nullptr, nullptr); @@ -144,7 +144,7 @@ void Service::activate() void Service::spawn(int socket_fd) { - dbgln<debug_service>("Spawning {}", name()); + dbgln<SERVICE_DEBUG>("Spawning {}", name()); m_run_timer.start(); pid_t pid = fork(); diff --git a/Userland/Services/SystemServer/main.cpp b/Userland/Services/SystemServer/main.cpp index a112b996e4..535cbacdc4 100644 --- a/Userland/Services/SystemServer/main.cpp +++ b/Userland/Services/SystemServer/main.cpp @@ -54,7 +54,7 @@ static void sigchld_handler(int) if (pid == 0) break; - dbgln<debug_system_server>("Reaped child with pid {}, exit status {}", pid, status); + dbgln<SYSTEMSERVER_DEBUG>("Reaped child with pid {}, exit status {}", pid, status); Service* service = Service::find_by_pid(pid); if (service == nullptr) { diff --git a/Userland/Services/WebContent/ClientConnection.cpp b/Userland/Services/WebContent/ClientConnection.cpp index f1865b21d9..08af4b921e 100644 --- a/Userland/Services/WebContent/ClientConnection.cpp +++ b/Userland/Services/WebContent/ClientConnection.cpp @@ -80,19 +80,19 @@ void ClientConnection::handle(const Messages::WebContentServer::UpdateSystemThem void ClientConnection::handle(const Messages::WebContentServer::LoadURL& message) { - dbgln<debug_spam>("handle: WebContentServer::LoadURL: url={}", message.url()); + dbgln<SPAM_DEBUG>("handle: WebContentServer::LoadURL: url={}", message.url()); page().load(message.url()); } void ClientConnection::handle(const Messages::WebContentServer::LoadHTML& message) { - dbgln<debug_spam>("handle: WebContentServer::LoadHTML: html={}, url={}", message.html(), message.url()); + dbgln<SPAM_DEBUG>("handle: WebContentServer::LoadHTML: html={}, url={}", message.html(), message.url()); page().load_html(message.html(), message.url()); } void ClientConnection::handle(const Messages::WebContentServer::SetViewportRect& message) { - dbgln<debug_spam>("handle: WebContentServer::SetViewportRect: rect={}", message.rect()); + dbgln<SPAM_DEBUG>("handle: WebContentServer::SetViewportRect: rect={}", message.rect()); m_page_host->set_viewport_rect(message.rect()); } diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp index b9beeaec47..af57c53fbd 100644 --- a/Userland/Services/WindowServer/Compositor.cpp +++ b/Userland/Services/WindowServer/Compositor.cpp @@ -194,7 +194,7 @@ void Compositor::compose() if (m_custom_background_color.has_value()) background_color = m_custom_background_color.value(); - if constexpr (debug_compose) { + if constexpr (COMPOSE_DEBUG) { dbgln("COMPOSE: invalidated: window: {} cursor: {}, any: {}", m_invalidated_window, m_invalidated_cursor, m_invalidated_any); for (auto& r : dirty_screen_rects.rects()) dbgln("dirty screen: {}", r); @@ -215,7 +215,7 @@ void Compositor::compose() }; auto prepare_rect = [&](const Gfx::IntRect& rect) { - dbgln<debug_compose>(" -> flush opaque: {}", rect); + dbgln<COMPOSE_DEBUG>(" -> flush opaque: {}", rect); ASSERT(!flush_rects.intersects(rect)); ASSERT(!flush_transparent_rects.intersects(rect)); flush_rects.add(rect); @@ -223,7 +223,7 @@ void Compositor::compose() }; auto prepare_transparency_rect = [&](const Gfx::IntRect& rect) { - dbgln<debug_compose>(" -> flush transparent: {}", rect); + dbgln<COMPOSE_DEBUG>(" -> flush transparent: {}", rect); ASSERT(!flush_rects.intersects(rect)); bool have_rect = false; for (auto& r : flush_transparent_rects.rects()) { @@ -270,7 +270,7 @@ void Compositor::compose() }; m_opaque_wallpaper_rects.for_each_intersected(dirty_screen_rects, [&](const Gfx::IntRect& render_rect) { - dbgln<debug_compose>(" render wallpaper opaque: {}", render_rect); + dbgln<COMPOSE_DEBUG>(" render wallpaper opaque: {}", render_rect); prepare_rect(render_rect); paint_wallpaper(back_painter, render_rect); return IterationDecision::Continue; @@ -282,7 +282,7 @@ void Compositor::compose() return IterationDecision::Continue; auto frame_rects = frame_rect.shatter(window.rect()); - dbgln<debug_compose>(" window {} frame rect: {}", window.title(), frame_rect); + dbgln<COMPOSE_DEBUG>(" window {} frame rect: {}", window.title(), frame_rect); RefPtr<Gfx::Bitmap> backing_store = window.backing_store(); auto compose_window_rect = [&](Gfx::Painter& painter, const Gfx::IntRect& rect) { @@ -291,7 +291,7 @@ void Compositor::compose() // TODO: Should optimize this to use a backing buffer Gfx::PainterStateSaver saver(painter); painter.add_clip_rect(intersected_rect); - dbgln<debug_compose>(" render frame: {}", intersected_rect); + dbgln<COMPOSE_DEBUG>(" render frame: {}", intersected_rect); window.frame().paint(painter); return IterationDecision::Continue; }); @@ -360,7 +360,7 @@ void Compositor::compose() auto& dirty_rects = window.dirty_rects(); - if constexpr (debug_compose) { + if constexpr (COMPOSE_DEBUG) { for (auto& dirty_rect : dirty_rects.rects()) dbgln(" dirty: {}", dirty_rect); for (auto& r : window.opaque_rects().rects()) @@ -373,7 +373,7 @@ void Compositor::compose() auto& opaque_rects = window.opaque_rects(); if (!opaque_rects.is_empty()) { opaque_rects.for_each_intersected(dirty_rects, [&](const Gfx::IntRect& render_rect) { - dbgln<debug_compose>(" render opaque: {}", render_rect); + dbgln<COMPOSE_DEBUG>(" render opaque: {}", render_rect); prepare_rect(render_rect); Gfx::PainterStateSaver saver(back_painter); @@ -388,7 +388,7 @@ void Compositor::compose() auto& transparency_wallpaper_rects = window.transparency_wallpaper_rects(); if (!transparency_wallpaper_rects.is_empty()) { transparency_wallpaper_rects.for_each_intersected(dirty_rects, [&](const Gfx::IntRect& render_rect) { - dbgln<debug_compose>(" render wallpaper: {}", render_rect); + dbgln<COMPOSE_DEBUG>(" render wallpaper: {}", render_rect); prepare_transparency_rect(render_rect); paint_wallpaper(temp_painter, render_rect); @@ -398,7 +398,7 @@ void Compositor::compose() auto& transparency_rects = window.transparency_rects(); if (!transparency_rects.is_empty()) { transparency_rects.for_each_intersected(dirty_rects, [&](const Gfx::IntRect& render_rect) { - dbgln<debug_compose>(" render transparent: {}", render_rect); + dbgln<COMPOSE_DEBUG>(" render transparent: {}", render_rect); prepare_transparency_rect(render_rect); Gfx::PainterStateSaver saver(temp_painter); @@ -671,7 +671,7 @@ void Compositor::run_animations(Gfx::DisjointRectSet& flush_rects) from_rect.height() - (int)(height_delta_per_step * animation_index) }; - dbgln<debug_minimize_animation>("Minimize animation from {} to {} frame# {} {}", from_rect, to_rect, animation_index, rect); + dbgln<MINIMIZE_ANIMATION_DEBUG>("Minimize animation from {} to {} frame# {} {}", from_rect, to_rect, animation_index, rect); painter.draw_rect(rect, Color::Transparent); // Color doesn't matter, we draw inverted flush_rects.add(rect); @@ -1001,7 +1001,7 @@ void Compositor::recompute_occlusions() m_opaque_wallpaper_rects = move(visible_rects); } - if constexpr (debug_occlusions) { + if constexpr (OCCLUSIONS_DEBUG) { for (auto& r : m_opaque_wallpaper_rects.rects()) dbgln(" wallpaper opaque: {}", r); } @@ -1011,7 +1011,7 @@ void Compositor::recompute_occlusions() if (w.is_minimized() || window_frame_rect.is_empty()) return IterationDecision::Continue; - if constexpr (debug_occlusions) { + if constexpr (OCCLUSIONS_DEBUG) { dbgln(" Window {} frame rect: {}", w.title(), window_frame_rect); for (auto& r : w.opaque_rects().rects()) dbgln(" opaque: {}", r); diff --git a/Userland/Services/WindowServer/MenuManager.cpp b/Userland/Services/WindowServer/MenuManager.cpp index b50cb800b4..8069383abf 100644 --- a/Userland/Services/WindowServer/MenuManager.cpp +++ b/Userland/Services/WindowServer/MenuManager.cpp @@ -459,7 +459,7 @@ void MenuManager::set_current_menubar(MenuBar* menubar) else m_current_menubar = nullptr; - dbgln<debug_menus>("[WM] Current menubar is now {}", menubar); + dbgln<MENUS_DEBUG>("[WM] Current menubar is now {}", menubar); Gfx::IntPoint next_menu_location { MenuManager::menubar_menu_margin() / 2, 0 }; for_each_active_menubar_menu([&](Menu& menu) { diff --git a/Userland/Services/WindowServer/Screen.cpp b/Userland/Services/WindowServer/Screen.cpp index a10ab03d60..1ed3e0bbc7 100644 --- a/Userland/Services/WindowServer/Screen.cpp +++ b/Userland/Services/WindowServer/Screen.cpp @@ -82,7 +82,7 @@ bool Screen::set_resolution(int width, int height, int new_scale_factor) FBResolution physical_resolution { 0, (unsigned)new_physical_width, (unsigned)new_physical_height }; int rc = fb_set_resolution(m_framebuffer_fd, &physical_resolution); - dbgln<debug_wsscreen>("fb_set_resolution() - return code {}", rc); + dbgln<WSSCREEN_DEBUG>("fb_set_resolution() - return code {}", rc); if (rc == 0) { on_change_resolution(physical_resolution.pitch, physical_resolution.width, physical_resolution.height, new_scale_factor); diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index 3e2cfeca05..3a445e8542 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -343,7 +343,7 @@ void WindowManager::notify_title_changed(Window& window) if (window.type() != WindowType::Normal) return; - dbgln<debug_window_manager>("[WM] Window({}) title set to '{}'", &window, window.title()); + dbgln<WINDOWMANAGER_DEBUG>("[WM] Window({}) title set to '{}'", &window, window.title()); if (m_switcher.is_visible()) m_switcher.refresh(); @@ -356,7 +356,7 @@ void WindowManager::notify_modal_unparented(Window& window) if (window.type() != WindowType::Normal) return; - dbgln<debug_window_manager>("[WM] Window({}) was unparented", &window); + dbgln<WINDOWMANAGER_DEBUG>("[WM] Window({}) was unparented", &window); if (m_switcher.is_visible()) m_switcher.refresh(); @@ -366,7 +366,7 @@ void WindowManager::notify_modal_unparented(Window& window) void WindowManager::notify_rect_changed(Window& window, const Gfx::IntRect& old_rect, const Gfx::IntRect& new_rect) { - dbgln<debug_resize>("[WM] Window({}) rect changed {} -> {}", &window, old_rect, new_rect); + dbgln<RESIZE_DEBUG>("[WM] Window({}) rect changed {} -> {}", &window, old_rect, new_rect); if (m_switcher.is_visible() && window.type() != WindowType::WindowSwitcher) m_switcher.refresh(); @@ -431,7 +431,7 @@ bool WindowManager::pick_new_active_window(Window* previous_active) void WindowManager::start_window_move(Window& window, const MouseEvent& event) { - dbgln<debug_move>("[WM] Begin moving Window({})", &window); + dbgln<MOVE_DEBUG>("[WM] Begin moving Window({})", &window); move_to_front_and_make_active(window); m_move_window = window; @@ -464,7 +464,7 @@ void WindowManager::start_window_resize(Window& window, const Gfx::IntPoint& pos return; } - dbgln<debug_resize>("[WM] Begin resizing Window({})", &window); + dbgln<RESIZE_DEBUG>("[WM] Begin resizing Window({})", &window); m_resizing_mouse_button = button; m_resize_window = window; @@ -491,7 +491,7 @@ bool WindowManager::process_ongoing_window_move(MouseEvent& event, Window*& hove return false; if (event.type() == Event::MouseUp && event.button() == MouseButton::Left) { - dbgln<debug_move>("[WM] Finish moving Window({})", m_move_window); + dbgln<MOVE_DEBUG>("[WM] Finish moving Window({})", m_move_window); m_move_window->invalidate(); if (m_move_window->rect().contains(event.position())) @@ -509,7 +509,7 @@ bool WindowManager::process_ongoing_window_move(MouseEvent& event, Window*& hove return true; } if (event.type() == Event::MouseMove) { - if constexpr (debug_move) { + if constexpr (MOVE_DEBUG) { dbgln("[WM] Moving, origin: {}, now: {}", m_move_origin, event.position()); if (m_move_window->is_maximized()) dbgln(" [!] The window is still maximized. Not moving yet."); @@ -575,7 +575,7 @@ bool WindowManager::process_ongoing_window_resize(const MouseEvent& event, Windo return false; if (event.type() == Event::MouseUp && event.button() == m_resizing_mouse_button) { - dbgln<debug_resize>("[WM] Finish resizing Window({})", m_resize_window); + dbgln<RESIZE_DEBUG>("[WM] Finish resizing Window({})", m_resize_window); Core::EventLoop::current().post_event(*m_resize_window, make<ResizeEvent>(m_resize_window->rect())); m_resize_window->invalidate(); @@ -683,7 +683,7 @@ bool WindowManager::process_ongoing_window_resize(const MouseEvent& event, Windo if (m_resize_window->rect() == new_rect) return true; - dbgln<debug_resize>("[WM] Resizing, original: {}, now: {}", m_resize_window_original_rect, new_rect); + dbgln<RESIZE_DEBUG>("[WM] Resizing, original: {}, now: {}", m_resize_window_original_rect, new_rect); m_resize_window->set_rect(new_rect); Core::EventLoop::current().post_event(*m_resize_window, make<ResizeEvent>(new_rect)); @@ -805,7 +805,7 @@ void WindowManager::start_menu_doubleclick(Window& window, const MouseEvent& eve // we either haven't clicked anywhere, or we haven't clicked on this // window. set the current click window, and reset the timers. - dbgln<debug_double_click>("Initial mousedown on Window({}) for menus (previous was {})", &window, m_double_click_info.m_clicked_window); + dbgln<DOUBLECLICK_DEBUG>("Initial mousedown on Window({}) for menus (previous was {})", &window, m_double_click_info.m_clicked_window); m_double_click_info.m_clicked_window = window; m_double_click_info.reset(); @@ -837,7 +837,7 @@ void WindowManager::process_event_for_doubleclick(Window& window, MouseEvent& ev if (&window != m_double_click_info.m_clicked_window) { // we either haven't clicked anywhere, or we haven't clicked on this // window. set the current click window, and reset the timers. - dbgln<debug_double_click>("Initial mouseup on Window({}) for menus (previous was {})", &window, m_double_click_info.m_clicked_window); + dbgln<DOUBLECLICK_DEBUG>("Initial mouseup on Window({}) for menus (previous was {})", &window, m_double_click_info.m_clicked_window); m_double_click_info.m_clicked_window = window; m_double_click_info.reset(); @@ -852,7 +852,7 @@ void WindowManager::process_event_for_doubleclick(Window& window, MouseEvent& ev // clock metadata.clock.start(); } else { - dbgln<debug_double_click>("Transforming MouseUp to MouseDoubleClick ({} < {})!", metadata.clock.elapsed(), m_double_click_speed); + dbgln<DOUBLECLICK_DEBUG>("Transforming MouseUp to MouseDoubleClick ({} < {})!", metadata.clock.elapsed(), m_double_click_speed); event = MouseEvent(Event::MouseDoubleClick, event.position(), event.buttons(), event.button(), event.modifiers(), event.wheel_delta()); // invalidate this now we've delivered a doubleclick, otherwise diff --git a/Userland/Utilities/disasm.cpp b/Userland/Utilities/disasm.cpp index 70d1983893..5f65c484be 100644 --- a/Userland/Utilities/disasm.cpp +++ b/Userland/Utilities/disasm.cpp @@ -99,7 +99,7 @@ int main(int argc, char** argv) return a.size < b.size; return a.name < b.name; }); - if constexpr (debug_disasm_dump) { + if constexpr (DISASM_DUMP_DEBUG) { for (size_t i = 0; i < symbols.size(); ++i) dbgln("{}: {:p}, {}", symbols[i].name, symbols[i].value, symbols[i].size); } |