mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 06:12:43 +00:00 
			
		
		
		
	Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.Everything:
The modifications in this commit were automatically made using the
following command:
    find . -name '*.cpp' -exec sed -i -E 's/dbg\(\) << ("[^"{]*");/dbgln\(\1\);/' {} \;
			
			
This commit is contained in:
		
							parent
							
								
									40b8e21115
								
							
						
					
					
						commit
						938e5c7719
					
				
					 95 changed files with 331 additions and 331 deletions
				
			
		|  | @ -66,7 +66,7 @@ void Parser::locate_static_data() | ||||||
| PhysicalAddress Parser::find_table(const StringView& signature) | PhysicalAddress Parser::find_table(const StringView& signature) | ||||||
| { | { | ||||||
| #ifdef ACPI_DEBUG | #ifdef ACPI_DEBUG | ||||||
|     dbg() << "ACPI: Calling Find Table method!"; |     dbgln("ACPI: Calling Find Table method!"); | ||||||
| #endif | #endif | ||||||
|     for (auto p_sdt : m_sdt_pointers) { |     for (auto p_sdt : m_sdt_pointers) { | ||||||
|         auto sdt = map_typed<Structures::SDTHeader>(p_sdt); |         auto sdt = map_typed<Structures::SDTHeader>(p_sdt); | ||||||
|  | @ -244,7 +244,7 @@ size_t Parser::get_table_size(PhysicalAddress table_header) | ||||||
| { | { | ||||||
|     InterruptDisabler disabler; |     InterruptDisabler disabler; | ||||||
| #ifdef ACPI_DEBUG | #ifdef ACPI_DEBUG | ||||||
|     dbg() << "ACPI: Checking SDT Length"; |     dbgln("ACPI: Checking SDT Length"); | ||||||
| #endif | #endif | ||||||
|     return map_typed<Structures::SDTHeader>(table_header)->length; |     return map_typed<Structures::SDTHeader>(table_header)->length; | ||||||
| } | } | ||||||
|  | @ -253,7 +253,7 @@ u8 Parser::get_table_revision(PhysicalAddress table_header) | ||||||
| { | { | ||||||
|     InterruptDisabler disabler; |     InterruptDisabler disabler; | ||||||
| #ifdef ACPI_DEBUG | #ifdef ACPI_DEBUG | ||||||
|     dbg() << "ACPI: Checking SDT Revision"; |     dbgln("ACPI: Checking SDT Revision"); | ||||||
| #endif | #endif | ||||||
|     return map_typed<Structures::SDTHeader>(table_header)->revision; |     return map_typed<Structures::SDTHeader>(table_header)->revision; | ||||||
| } | } | ||||||
|  | @ -261,7 +261,7 @@ u8 Parser::get_table_revision(PhysicalAddress table_header) | ||||||
| void Parser::initialize_main_system_description_table() | void Parser::initialize_main_system_description_table() | ||||||
| { | { | ||||||
| #ifdef ACPI_DEBUG | #ifdef ACPI_DEBUG | ||||||
|     dbg() << "ACPI: Checking Main SDT Length to choose the correct mapping size"; |     dbgln("ACPI: Checking Main SDT Length to choose the correct mapping size"); | ||||||
| #endif | #endif | ||||||
|     ASSERT(!m_main_system_description_table.is_null()); |     ASSERT(!m_main_system_description_table.is_null()); | ||||||
|     auto length = get_table_size(m_main_system_description_table); |     auto length = get_table_size(m_main_system_description_table); | ||||||
|  |  | ||||||
|  | @ -471,7 +471,7 @@ void page_fault_handler(TrapFrame* trap) | ||||||
|         handle_crash(regs, "Page Fault", SIGSEGV, response == PageFaultResponse::OutOfMemory); |         handle_crash(regs, "Page Fault", SIGSEGV, response == PageFaultResponse::OutOfMemory); | ||||||
|     } else if (response == PageFaultResponse::Continue) { |     } else if (response == PageFaultResponse::Continue) { | ||||||
| #ifdef PAGE_FAULT_DEBUG | #ifdef PAGE_FAULT_DEBUG | ||||||
|         dbg() << "Continuing after resolved page fault"; |         dbgln("Continuing after resolved page fault"); | ||||||
| #endif | #endif | ||||||
|     } else { |     } else { | ||||||
|         ASSERT_NOT_REACHED(); |         ASSERT_NOT_REACHED(); | ||||||
|  | @ -605,7 +605,7 @@ void unregister_generic_interrupt_handler(u8 interrupt_number, GenericInterruptH | ||||||
| { | { | ||||||
|     ASSERT(s_interrupt_handler[interrupt_number] != nullptr); |     ASSERT(s_interrupt_handler[interrupt_number] != nullptr); | ||||||
|     if (s_interrupt_handler[interrupt_number]->type() == HandlerType::UnhandledInterruptHandler) { |     if (s_interrupt_handler[interrupt_number]->type() == HandlerType::UnhandledInterruptHandler) { | ||||||
|         dbg() << "Trying to unregister unused handler (?)"; |         dbgln("Trying to unregister unused handler (?)"); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     if (s_interrupt_handler[interrupt_number]->is_shared_handler() && !s_interrupt_handler[interrupt_number]->is_sharing_with_others()) { |     if (s_interrupt_handler[interrupt_number]->is_shared_handler() && !s_interrupt_handler[interrupt_number]->is_sharing_with_others()) { | ||||||
|  | @ -844,7 +844,7 @@ static void idt_init() | ||||||
|     register_interrupt_handler(0xfe, interrupt_254_asm_entry); |     register_interrupt_handler(0xfe, interrupt_254_asm_entry); | ||||||
|     register_interrupt_handler(0xff, interrupt_255_asm_entry); |     register_interrupt_handler(0xff, interrupt_255_asm_entry); | ||||||
| 
 | 
 | ||||||
|     dbg() << "Installing Unhandled Handlers"; |     dbgln("Installing Unhandled Handlers"); | ||||||
| 
 | 
 | ||||||
|     for (u8 i = 0; i < GENERIC_INTERRUPT_HANDLERS_COUNT; ++i) { |     for (u8 i = 0; i < GENERIC_INTERRUPT_HANDLERS_COUNT; ++i) { | ||||||
|         new UnhandledInterruptHandler(i); |         new UnhandledInterruptHandler(i); | ||||||
|  |  | ||||||
|  | @ -76,7 +76,7 @@ I8042Controller::I8042Controller() | ||||||
|             do_wait_then_write(I8042_STATUS, 0x60); |             do_wait_then_write(I8042_STATUS, 0x60); | ||||||
|             do_wait_then_write(I8042_BUFFER, configuration); |             do_wait_then_write(I8042_BUFFER, configuration); | ||||||
|         } else { |         } else { | ||||||
|             dbg() << "I8042: Controller self test failed"; |             dbgln("I8042: Controller self test failed"); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         // Test ports and enable them if available
 |         // Test ports and enable them if available
 | ||||||
|  | @ -88,7 +88,7 @@ I8042Controller::I8042Controller() | ||||||
|             configuration |= 1; |             configuration |= 1; | ||||||
|             configuration &= ~(1 << 4); |             configuration &= ~(1 << 4); | ||||||
|         } else { |         } else { | ||||||
|             dbg() << "I8042: Keyboard port not available"; |             dbgln("I8042: Keyboard port not available"); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (m_is_dual_channel) { |         if (m_is_dual_channel) { | ||||||
|  | @ -99,7 +99,7 @@ I8042Controller::I8042Controller() | ||||||
|                 configuration |= 2; |                 configuration |= 2; | ||||||
|                 configuration &= ~(1 << 5); |                 configuration &= ~(1 << 5); | ||||||
|             } else { |             } else { | ||||||
|                 dbg() << "I8042: Mouse port not available"; |                 dbgln("I8042: Mouse port not available"); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | @ -116,7 +116,7 @@ I8042Controller::I8042Controller() | ||||||
|         if (KeyboardDevice::the().initialize()) { |         if (KeyboardDevice::the().initialize()) { | ||||||
|             m_devices[0].device = &KeyboardDevice::the(); |             m_devices[0].device = &KeyboardDevice::the(); | ||||||
|         } else { |         } else { | ||||||
|             dbg() << "I8042: Keyboard device failed to initialize, disable"; |             dbgln("I8042: Keyboard device failed to initialize, disable"); | ||||||
|             m_devices[0].available = false; |             m_devices[0].available = false; | ||||||
|             configuration &= ~1; |             configuration &= ~1; | ||||||
|             configuration |= 1 << 4; |             configuration |= 1 << 4; | ||||||
|  | @ -129,7 +129,7 @@ I8042Controller::I8042Controller() | ||||||
|         if (PS2MouseDevice::the().initialize()) { |         if (PS2MouseDevice::the().initialize()) { | ||||||
|             m_devices[1].device = &PS2MouseDevice::the(); |             m_devices[1].device = &PS2MouseDevice::the(); | ||||||
|         } else { |         } else { | ||||||
|             dbg() << "I8042: Mouse device failed to initialize, disable"; |             dbgln("I8042: Mouse device failed to initialize, disable"); | ||||||
|             m_devices[1].available = false; |             m_devices[1].available = false; | ||||||
|             configuration |= 1 << 5; |             configuration |= 1 << 5; | ||||||
|             ScopedSpinLock lock(m_lock); |             ScopedSpinLock lock(m_lock); | ||||||
|  | @ -223,7 +223,7 @@ u8 I8042Controller::do_write_to_device(Device device, u8 data) | ||||||
|         response = do_wait_then_read(I8042_BUFFER); |         response = do_wait_then_read(I8042_BUFFER); | ||||||
|     } while (response == I8042_RESEND && ++attempts < 3); |     } while (response == I8042_RESEND && ++attempts < 3); | ||||||
|     if (attempts >= 3) |     if (attempts >= 3) | ||||||
|         dbg() << "Failed to write byte to device, gave up"; |         dbgln("Failed to write byte to device, gave up"); | ||||||
|     return response; |     return response; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -356,7 +356,7 @@ KeyboardDevice::~KeyboardDevice() | ||||||
| bool KeyboardDevice::initialize() | bool KeyboardDevice::initialize() | ||||||
| { | { | ||||||
|     if (!m_controller.reset_device(I8042Controller::Device::Keyboard)) { |     if (!m_controller.reset_device(I8042Controller::Device::Keyboard)) { | ||||||
|         dbg() << "KeyboardDevice: I8042 controller failed to reset device"; |         dbgln("KeyboardDevice: I8042 controller failed to reset device"); | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
|     return true; |     return true; | ||||||
|  |  | ||||||
|  | @ -118,7 +118,7 @@ void PS2MouseDevice::irq_handle_byte_read(u8 byte) | ||||||
|     switch (m_data_state) { |     switch (m_data_state) { | ||||||
|     case 0: |     case 0: | ||||||
|         if (!(byte & 0x08)) { |         if (!(byte & 0x08)) { | ||||||
|             dbg() << "PS2Mouse: Stream out of sync."; |             dbgln("PS2Mouse: Stream out of sync."); | ||||||
|             break; |             break; | ||||||
|         } |         } | ||||||
|         ++m_data_state; |         ++m_data_state; | ||||||
|  | @ -223,7 +223,7 @@ void PS2MouseDevice::set_sample_rate(u8 rate) | ||||||
| bool PS2MouseDevice::initialize() | bool PS2MouseDevice::initialize() | ||||||
| { | { | ||||||
|     if (!m_controller.reset_device(I8042Controller::Device::Mouse)) { |     if (!m_controller.reset_device(I8042Controller::Device::Mouse)) { | ||||||
|         dbg() << "PS2MouseDevice: I8042 controller failed to reset device"; |         dbgln("PS2MouseDevice: I8042 controller failed to reset device"); | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -284,7 +284,7 @@ KResultOr<size_t> PS2MouseDevice::read(FileDescription&, size_t, UserOrKernelBuf | ||||||
| #ifdef PS2MOUSE_DEBUG | #ifdef PS2MOUSE_DEBUG | ||||||
|         dbg() << "PS2 Mouse Read: Buttons " << String::format("%x", packet.buttons); |         dbg() << "PS2 Mouse Read: Buttons " << String::format("%x", packet.buttons); | ||||||
|         dbg() << "PS2 Mouse: X " << packet.x << ", Y " << packet.y << ", Z " << packet.z << " Relative " << packet.buttons; |         dbg() << "PS2 Mouse: X " << packet.x << ", Y " << packet.y << ", Z " << packet.z << " Relative " << packet.buttons; | ||||||
|         dbg() << "PS2 Mouse Read: Filter packets"; |         dbgln("PS2 Mouse Read: Filter packets"); | ||||||
| #endif | #endif | ||||||
|         size_t bytes_read_from_packet = min(remaining_space_in_buffer, sizeof(MousePacket)); |         size_t bytes_read_from_packet = min(remaining_space_in_buffer, sizeof(MousePacket)); | ||||||
|         if (!buffer.write(&packet, nread, bytes_read_from_packet)) |         if (!buffer.write(&packet, nread, bytes_read_from_packet)) | ||||||
|  |  | ||||||
|  | @ -302,7 +302,7 @@ KResultOr<NonnullRefPtr<Inode>> DevFSRootDirectoryInode::create_child(const Stri | ||||||
|             if (link.name() == name) |             if (link.name() == name) | ||||||
|                 return KResult(-EEXIST); |                 return KResult(-EEXIST); | ||||||
|         } |         } | ||||||
|         dbg() << "DevFS: Success on create new symlink"; |         dbgln("DevFS: Success on create new symlink"); | ||||||
|         auto new_link_inode = adopt(*new DevFSLinkInode(m_parent_fs, name)); |         auto new_link_inode = adopt(*new DevFSLinkInode(m_parent_fs, name)); | ||||||
|         m_links.append(new_link_inode); |         m_links.append(new_link_inode); | ||||||
|         m_parent_fs.m_nodes.append(new_link_inode); |         m_parent_fs.m_nodes.append(new_link_inode); | ||||||
|  |  | ||||||
|  | @ -215,7 +215,7 @@ Ext2FS::BlockListShape Ext2FS::compute_block_list_shape(unsigned blocks) const | ||||||
|     if (!blocks_remaining) |     if (!blocks_remaining) | ||||||
|         return shape; |         return shape; | ||||||
| 
 | 
 | ||||||
|     dbg() << "we don't know how to compute tind ext2fs blocks yet!"; |     dbgln("we don't know how to compute tind ext2fs blocks yet!"); | ||||||
|     ASSERT_NOT_REACHED(); |     ASSERT_NOT_REACHED(); | ||||||
| 
 | 
 | ||||||
|     shape.triply_indirect_blocks = min(blocks_remaining, entries_per_block * entries_per_block * entries_per_block); |     shape.triply_indirect_blocks = min(blocks_remaining, entries_per_block * entries_per_block * entries_per_block); | ||||||
|  | @ -420,7 +420,7 @@ bool Ext2FS::write_block_list_for_inode(InodeIndex inode_index, ext2_inode& e2in | ||||||
|         return true; |         return true; | ||||||
| 
 | 
 | ||||||
|     // FIXME: Implement!
 |     // FIXME: Implement!
 | ||||||
|     dbg() << "we don't know how to write tind ext2fs blocks yet!"; |     dbgln("we don't know how to write tind ext2fs blocks yet!"); | ||||||
|     ASSERT_NOT_REACHED(); |     ASSERT_NOT_REACHED(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1137,7 +1137,7 @@ Vector<Ext2FS::BlockIndex> Ext2FS::allocate_blocks(GroupIndex preferred_group_in | ||||||
| 
 | 
 | ||||||
|     Vector<BlockIndex> blocks; |     Vector<BlockIndex> blocks; | ||||||
| #ifdef EXT2_DEBUG | #ifdef EXT2_DEBUG | ||||||
|     dbg() << "Ext2FS: allocate_blocks:"; |     dbgln("Ext2FS: allocate_blocks:"); | ||||||
| #endif | #endif | ||||||
|     blocks.ensure_capacity(count); |     blocks.ensure_capacity(count); | ||||||
| 
 | 
 | ||||||
|  | @ -1474,7 +1474,7 @@ KResultOr<NonnullRefPtr<Inode>> Ext2FS::create_inode(InodeIdentifier parent_id, | ||||||
| 
 | 
 | ||||||
|     size_t needed_blocks = ceil_div(static_cast<size_t>(size), block_size()); |     size_t needed_blocks = ceil_div(static_cast<size_t>(size), block_size()); | ||||||
|     if ((size_t)needed_blocks > super_block().s_free_blocks_count) { |     if ((size_t)needed_blocks > super_block().s_free_blocks_count) { | ||||||
|         dbg() << "Ext2FS: create_inode: not enough free blocks"; |         dbgln("Ext2FS: create_inode: not enough free blocks"); | ||||||
|         return KResult(-ENOSPC); |         return KResult(-ENOSPC); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -246,7 +246,7 @@ bool Plan9FS::initialize() | ||||||
| 
 | 
 | ||||||
|     result = post_message_and_wait_for_a_reply(attach_message); |     result = post_message_and_wait_for_a_reply(attach_message); | ||||||
|     if (result.is_error()) { |     if (result.is_error()) { | ||||||
|         dbg() << "Attaching failed"; |         dbgln("Attaching failed"); | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -663,7 +663,7 @@ ssize_t Plan9FS::adjust_buffer_size(ssize_t size) const | ||||||
| 
 | 
 | ||||||
| void Plan9FS::thread_main() | void Plan9FS::thread_main() | ||||||
| { | { | ||||||
|     dbg() << "Plan9FS: Thread running"; |     dbgln("Plan9FS: Thread running"); | ||||||
|     do { |     do { | ||||||
|         auto result = read_and_dispatch_one_message(); |         auto result = read_and_dispatch_one_message(); | ||||||
|         if (result.is_error()) { |         if (result.is_error()) { | ||||||
|  | @ -676,11 +676,11 @@ void Plan9FS::thread_main() | ||||||
|             } |             } | ||||||
|             m_completions.clear(); |             m_completions.clear(); | ||||||
|             m_completion_blocker.unblock_all(); |             m_completion_blocker.unblock_all(); | ||||||
|             dbg() << "Plan9FS: Thread terminating, error reading"; |             dbgln("Plan9FS: Thread terminating, error reading"); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|     } while (!m_thread_shutdown); |     } while (!m_thread_shutdown); | ||||||
|     dbg() << "Plan9FS: Thread terminating"; |     dbgln("Plan9FS: Thread terminating"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Plan9FS::ensure_thread() | void Plan9FS::ensure_thread() | ||||||
|  |  | ||||||
|  | @ -1296,7 +1296,7 @@ ssize_t ProcFSInode::read_bytes(off_t offset, ssize_t count, UserOrKernelBuffer& | ||||||
|         return -EIO; |         return -EIO; | ||||||
|     if (!description->data()) { |     if (!description->data()) { | ||||||
| #ifdef PROCFS_DEBUG | #ifdef PROCFS_DEBUG | ||||||
|         dbg() << "ProcFS: Do not have cached data!"; |         dbgln("ProcFS: Do not have cached data!"); | ||||||
| #endif | #endif | ||||||
|         return -EIO; |         return -EIO; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -119,7 +119,7 @@ KResult VFS::unmount(Inode& guest_inode) | ||||||
|         if (&mount.guest() == &guest_inode) { |         if (&mount.guest() == &guest_inode) { | ||||||
|             auto result = mount.guest_fs().prepare_to_unmount(); |             auto result = mount.guest_fs().prepare_to_unmount(); | ||||||
|             if (result.is_error()) { |             if (result.is_error()) { | ||||||
|                 dbg() << "VFS: Failed to unmount!"; |                 dbgln("VFS: Failed to unmount!"); | ||||||
|                 return result; |                 return result; | ||||||
|             } |             } | ||||||
|             dbg() << "VFS: found fs " << mount.guest_fs().fsid() << " at mount index " << i << "! Unmounting..."; |             dbg() << "VFS: found fs " << mount.guest_fs().fsid() << " at mount index " << i << "! Unmounting..."; | ||||||
|  |  | ||||||
|  | @ -414,7 +414,7 @@ void APIC::boot_aps() | ||||||
|     Processor::smp_enable(); |     Processor::smp_enable(); | ||||||
| 
 | 
 | ||||||
| #ifdef APIC_DEBUG | #ifdef APIC_DEBUG | ||||||
|     dbg() << "All processors initialized and waiting, trigger all to continue"; |     dbgln("All processors initialized and waiting, trigger all to continue"); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|     // Now trigger all APs to continue execution (need to do this after
 |     // Now trigger all APs to continue execution (need to do this after
 | ||||||
|  |  | ||||||
|  | @ -127,7 +127,7 @@ RefPtr<IRQController> InterruptManagement::get_responsible_irq_controller(u8 int | ||||||
| 
 | 
 | ||||||
| PhysicalAddress InterruptManagement::search_for_madt() | PhysicalAddress InterruptManagement::search_for_madt() | ||||||
| { | { | ||||||
|     dbg() << "Early access to ACPI tables for interrupt setup"; |     dbgln("Early access to ACPI tables for interrupt setup"); | ||||||
|     auto rsdp = ACPI::StaticParsing::find_rsdp(); |     auto rsdp = ACPI::StaticParsing::find_rsdp(); | ||||||
|     if (!rsdp.has_value()) |     if (!rsdp.has_value()) | ||||||
|         return {}; |         return {}; | ||||||
|  | @ -165,7 +165,7 @@ void InterruptManagement::switch_to_ioapic_mode() | ||||||
|     InterruptDisabler disabler; |     InterruptDisabler disabler; | ||||||
| 
 | 
 | ||||||
|     if (m_madt.is_null()) { |     if (m_madt.is_null()) { | ||||||
|         dbg() << "Interrupts: ACPI MADT is not available, reverting to PIC mode"; |         dbgln("Interrupts: ACPI MADT is not available, reverting to PIC mode"); | ||||||
|         switch_to_pic_mode(); |         switch_to_pic_mode(); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -188,7 +188,7 @@ KResult Socket::getsockopt(FileDescription&, int level, int option, Userspace<vo | ||||||
|     case SO_ERROR: { |     case SO_ERROR: { | ||||||
|         if (size < sizeof(int)) |         if (size < sizeof(int)) | ||||||
|             return KResult(-EINVAL); |             return KResult(-EINVAL); | ||||||
|         dbg() << "getsockopt(SO_ERROR): FIXME!"; |         dbgln("getsockopt(SO_ERROR): FIXME!"); | ||||||
|         int errno = 0; |         int errno = 0; | ||||||
|         if (!copy_to_user(static_ptr_cast<int*>(value), &errno)) |         if (!copy_to_user(static_ptr_cast<int*>(value), &errno)) | ||||||
|             return KResult(-EFAULT); |             return KResult(-EFAULT); | ||||||
|  |  | ||||||
|  | @ -460,7 +460,7 @@ void TCPSocket::shut_down_for_writing() | ||||||
| { | { | ||||||
|     if (state() == State::Established) { |     if (state() == State::Established) { | ||||||
| #ifdef TCP_SOCKET_DEBUG | #ifdef TCP_SOCKET_DEBUG | ||||||
|         dbg() << " Sending FIN/ACK from Established and moving into FinWait1"; |         dbgln(" Sending FIN/ACK from Established and moving into FinWait1"); | ||||||
| #endif | #endif | ||||||
|         [[maybe_unused]] auto rc = send_tcp_packet(TCPFlags::FIN | TCPFlags::ACK); |         [[maybe_unused]] auto rc = send_tcp_packet(TCPFlags::FIN | TCPFlags::ACK); | ||||||
|         set_state(State::FinWait1); |         set_state(State::FinWait1); | ||||||
|  | @ -475,7 +475,7 @@ KResult TCPSocket::close() | ||||||
|     auto result = IPv4Socket::close(); |     auto result = IPv4Socket::close(); | ||||||
|     if (state() == State::CloseWait) { |     if (state() == State::CloseWait) { | ||||||
| #ifdef TCP_SOCKET_DEBUG | #ifdef TCP_SOCKET_DEBUG | ||||||
|         dbg() << " Sending FIN from CloseWait and moving into LastAck"; |         dbgln(" Sending FIN from CloseWait and moving into LastAck"); | ||||||
| #endif | #endif | ||||||
|         [[maybe_unused]] auto rc = send_tcp_packet(TCPFlags::FIN | TCPFlags::ACK); |         [[maybe_unused]] auto rc = send_tcp_packet(TCPFlags::FIN | TCPFlags::ACK); | ||||||
|         set_state(State::LastAck); |         set_state(State::LastAck); | ||||||
|  |  | ||||||
|  | @ -37,7 +37,7 @@ void IOAccess::initialize() | ||||||
|     if (!Access::is_initialized()) { |     if (!Access::is_initialized()) { | ||||||
|         new IOAccess(); |         new IOAccess(); | ||||||
| #ifdef PCI_DEBUG | #ifdef PCI_DEBUG | ||||||
|         dbg() << "PCI: IO access initialised."; |         dbgln("PCI: IO access initialised."); | ||||||
| #endif | #endif | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -102,7 +102,7 @@ void IOAccess::write32_field(Address address, u32 field, u32 value) | ||||||
| void IOAccess::enumerate_hardware(Function<void(Address, ID)> callback) | void IOAccess::enumerate_hardware(Function<void(Address, ID)> callback) | ||||||
| { | { | ||||||
| #ifdef PCI_DEBUG | #ifdef PCI_DEBUG | ||||||
|     dbg() << "PCI: IO enumerating hardware"; |     dbgln("PCI: IO enumerating hardware"); | ||||||
| #endif | #endif | ||||||
|     // Single PCI host controller.
 |     // Single PCI host controller.
 | ||||||
|     if ((read8_field(Address(), PCI_HEADER_TYPE) & 0x80) == 0) { |     if ((read8_field(Address(), PCI_HEADER_TYPE) & 0x80) == 0) { | ||||||
|  |  | ||||||
|  | @ -85,7 +85,7 @@ void MMIOAccess::initialize(PhysicalAddress mcfg) | ||||||
|     if (!Access::is_initialized()) { |     if (!Access::is_initialized()) { | ||||||
|         new MMIOAccess(mcfg); |         new MMIOAccess(mcfg); | ||||||
| #ifdef PCI_DEBUG | #ifdef PCI_DEBUG | ||||||
|         dbg() << "PCI: MMIO access initialised."; |         dbgln("PCI: MMIO access initialised."); | ||||||
| #endif | #endif | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -97,7 +97,7 @@ MMIOAccess::MMIOAccess(PhysicalAddress p_mcfg) | ||||||
| 
 | 
 | ||||||
|     auto checkup_region = MM.allocate_kernel_region(p_mcfg.page_base(), (PAGE_SIZE * 2), "PCI MCFG Checkup", Region::Access::Read | Region::Access::Write); |     auto checkup_region = MM.allocate_kernel_region(p_mcfg.page_base(), (PAGE_SIZE * 2), "PCI MCFG Checkup", Region::Access::Read | Region::Access::Write); | ||||||
| #ifdef PCI_DEBUG | #ifdef PCI_DEBUG | ||||||
|     dbg() << "PCI: Checking MCFG Table length to choose the correct mapping size"; |     dbgln("PCI: Checking MCFG Table length to choose the correct mapping size"); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|     auto* sdt = (ACPI::Structures::SDTHeader*)checkup_region->vaddr().offset(p_mcfg.offset_in_page()).as_ptr(); |     auto* sdt = (ACPI::Structures::SDTHeader*)checkup_region->vaddr().offset(p_mcfg.offset_in_page()).as_ptr(); | ||||||
|  |  | ||||||
|  | @ -147,7 +147,7 @@ void IDEChannel::start_request(AsyncBlockDeviceRequest& request, bool use_dma, b | ||||||
| { | { | ||||||
|     ScopedSpinLock lock(m_request_lock); |     ScopedSpinLock lock(m_request_lock); | ||||||
| #ifdef PATA_DEBUG | #ifdef PATA_DEBUG | ||||||
|     dbg() << "IDEChannel::start_request"; |     dbgln("IDEChannel::start_request"); | ||||||
| #endif | #endif | ||||||
|     m_current_request = &request; |     m_current_request = &request; | ||||||
|     m_current_request_block_index = 0; |     m_current_request_block_index = 0; | ||||||
|  | @ -246,7 +246,7 @@ void IDEChannel::handle_irq(const RegisterState&) | ||||||
| 
 | 
 | ||||||
|     if (!m_current_request) { |     if (!m_current_request) { | ||||||
| #ifdef PATA_DEBUG | #ifdef PATA_DEBUG | ||||||
|         dbg() << "IDEChannel: IRQ but no pending request!"; |         dbgln("IDEChannel: IRQ but no pending request!"); | ||||||
| #endif | #endif | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  | @ -444,7 +444,7 @@ void IDEChannel::ata_read_sectors(bool slave_request) | ||||||
|     auto& request = *m_current_request; |     auto& request = *m_current_request; | ||||||
|     ASSERT(request.block_count() <= 256); |     ASSERT(request.block_count() <= 256); | ||||||
| #ifdef PATA_DEBUG | #ifdef PATA_DEBUG | ||||||
|     dbg() << "IDEChannel::ata_read_sectors"; |     dbgln("IDEChannel::ata_read_sectors"); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|     while (m_io_group.io_base().offset(ATA_REG_STATUS).in<u8>() & ATA_SR_BSY) |     while (m_io_group.io_base().offset(ATA_REG_STATUS).in<u8>() & ATA_SR_BSY) | ||||||
|  |  | ||||||
|  | @ -90,7 +90,7 @@ pid_t Process::sys$fork(RegisterState& regs) | ||||||
| #endif | #endif | ||||||
|             auto region_clone = region.clone(*child); |             auto region_clone = region.clone(*child); | ||||||
|             if (!region_clone) { |             if (!region_clone) { | ||||||
|                 dbg() << "fork: Cannot clone region, insufficient memory"; |                 dbgln("fork: Cannot clone region, insufficient memory"); | ||||||
|                 // TODO: tear down new process?
 |                 // TODO: tear down new process?
 | ||||||
|                 return -ENOMEM; |                 return -ENOMEM; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  | @ -128,7 +128,7 @@ int Process::sys$module_load(Userspace<const char*> user_path, size_t path_lengt | ||||||
| 
 | 
 | ||||||
|     auto* text_base = section_storage_by_name.get(".text").value_or(nullptr); |     auto* text_base = section_storage_by_name.get(".text").value_or(nullptr); | ||||||
|     if (!text_base) { |     if (!text_base) { | ||||||
|         dbg() << "No .text section found in module!"; |         dbgln("No .text section found in module!"); | ||||||
|         return -EINVAL; |         return -EINVAL; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -89,7 +89,7 @@ int Process::sys$mount(Userspace<const Syscall::SC_mount_params*> user_params) | ||||||
|         if (description.is_null()) |         if (description.is_null()) | ||||||
|             return -EBADF; |             return -EBADF; | ||||||
|         if (!description->file().is_seekable()) { |         if (!description->file().is_seekable()) { | ||||||
|             dbg() << "mount: this is not a seekable file"; |             dbgln("mount: this is not a seekable file"); | ||||||
|             return -ENODEV; |             return -ENODEV; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -104,7 +104,7 @@ int Process::sys$select(const Syscall::SC_select_params* user_params) | ||||||
| 
 | 
 | ||||||
|     if (current_thread->block<Thread::SelectBlocker>(timeout, fds_info).was_interrupted()) { |     if (current_thread->block<Thread::SelectBlocker>(timeout, fds_info).was_interrupted()) { | ||||||
| #ifdef DEBUG_POLL_SELECT | #ifdef DEBUG_POLL_SELECT | ||||||
|         dbg() << "select was interrupted"; |         dbgln("select was interrupted"); | ||||||
| #endif | #endif | ||||||
|         return -EINTR; |         return -EINTR; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -38,14 +38,14 @@ int Process::sys$reboot() | ||||||
| 
 | 
 | ||||||
|     REQUIRE_NO_PROMISES; |     REQUIRE_NO_PROMISES; | ||||||
| 
 | 
 | ||||||
|     dbg() << "acquiring FS locks..."; |     dbgln("acquiring FS locks..."); | ||||||
|     FS::lock_all(); |     FS::lock_all(); | ||||||
|     dbg() << "syncing mounted filesystems..."; |     dbgln("syncing mounted filesystems..."); | ||||||
|     FS::sync(); |     FS::sync(); | ||||||
|     dbg() << "attempting reboot via ACPI"; |     dbgln("attempting reboot via ACPI"); | ||||||
|     if (ACPI::is_enabled()) |     if (ACPI::is_enabled()) | ||||||
|         ACPI::Parser::the()->try_acpi_reboot(); |         ACPI::Parser::the()->try_acpi_reboot(); | ||||||
|     dbg() << "attempting reboot via KB Controller..."; |     dbgln("attempting reboot via KB Controller..."); | ||||||
|     IO::out8(0x64, 0xFE); |     IO::out8(0x64, 0xFE); | ||||||
| 
 | 
 | ||||||
|     return 0; |     return 0; | ||||||
|  | @ -58,18 +58,18 @@ int Process::sys$halt() | ||||||
| 
 | 
 | ||||||
|     REQUIRE_NO_PROMISES; |     REQUIRE_NO_PROMISES; | ||||||
| 
 | 
 | ||||||
|     dbg() << "acquiring FS locks..."; |     dbgln("acquiring FS locks..."); | ||||||
|     FS::lock_all(); |     FS::lock_all(); | ||||||
|     dbg() << "syncing mounted filesystems..."; |     dbgln("syncing mounted filesystems..."); | ||||||
|     FS::sync(); |     FS::sync(); | ||||||
|     dbg() << "attempting system shutdown..."; |     dbgln("attempting system shutdown..."); | ||||||
|     // QEMU Shutdown
 |     // QEMU Shutdown
 | ||||||
|     IO::out16(0x604, 0x2000); |     IO::out16(0x604, 0x2000); | ||||||
|     // If we're here, the shutdown failed. Try VirtualBox shutdown.
 |     // If we're here, the shutdown failed. Try VirtualBox shutdown.
 | ||||||
|     IO::out16(0x4004, 0x3400); |     IO::out16(0x4004, 0x3400); | ||||||
|     // VirtualBox shutdown failed. Try Bochs/Old QEMU shutdown.
 |     // VirtualBox shutdown failed. Try Bochs/Old QEMU shutdown.
 | ||||||
|     IO::out16(0xb004, 0x2000); |     IO::out16(0xb004, 0x2000); | ||||||
|     dbg() << "shutdown attempts failed, applications will stop responding."; |     dbgln("shutdown attempts failed, applications will stop responding."); | ||||||
| 
 | 
 | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -140,7 +140,7 @@ int Process::sys$join_thread(pid_t tid, Userspace<void**> exit_value) | ||||||
|         } |         } | ||||||
|         if (result == Thread::BlockResult::InterruptedByDeath) |         if (result == Thread::BlockResult::InterruptedByDeath) | ||||||
|             break; |             break; | ||||||
|         dbg() << "join_thread: retrying"; |         dbgln("join_thread: retrying"); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (exit_value && !copy_to_user(exit_value, &joinee_exit_value)) |     if (exit_value && !copy_to_user(exit_value, &joinee_exit_value)) | ||||||
|  |  | ||||||
|  | @ -95,7 +95,7 @@ void VirtualConsole::switch_to(unsigned index) | ||||||
|         // can set the video mode on our own. Just stop anyone from trying for
 |         // can set the video mode on our own. Just stop anyone from trying for
 | ||||||
|         // now.
 |         // now.
 | ||||||
|         if (active_console->is_graphical()) { |         if (active_console->is_graphical()) { | ||||||
|             dbg() << "Cannot switch away from graphical console yet :("; |             dbgln("Cannot switch away from graphical console yet :("); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         active_console->set_active(false); |         active_console->set_active(false); | ||||||
|  | @ -305,7 +305,7 @@ void VirtualConsole::flush_dirty_lines() | ||||||
| void VirtualConsole::beep() | void VirtualConsole::beep() | ||||||
| { | { | ||||||
|     // TODO
 |     // TODO
 | ||||||
|     dbg() << "Beep!1"; |     dbgln("Beep!1"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void VirtualConsole::set_window_title(const StringView&) | void VirtualConsole::set_window_title(const StringView&) | ||||||
|  |  | ||||||
|  | @ -35,7 +35,7 @@ void SyncTask::spawn() | ||||||
| { | { | ||||||
|     RefPtr<Thread> syncd_thread; |     RefPtr<Thread> syncd_thread; | ||||||
|     Process::create_kernel_process(syncd_thread, "SyncTask", [] { |     Process::create_kernel_process(syncd_thread, "SyncTask", [] { | ||||||
|         dbg() << "SyncTask is running"; |         dbgln("SyncTask is running"); | ||||||
|         for (;;) { |         for (;;) { | ||||||
|             VFS::the().sync(); |             VFS::the().sync(); | ||||||
|             Thread::current()->sleep({ 1, 0 }); |             Thread::current()->sleep({ 1, 0 }); | ||||||
|  |  | ||||||
|  | @ -147,7 +147,7 @@ bool HPET::test_and_initialize() | ||||||
| 
 | 
 | ||||||
|     if (TimeManagement::is_hpet_periodic_mode_allowed()) { |     if (TimeManagement::is_hpet_periodic_mode_allowed()) { | ||||||
|         if (!check_for_exisiting_periodic_timers()) { |         if (!check_for_exisiting_periodic_timers()) { | ||||||
|             dbg() << "HPET: No periodic capable timers"; |             dbgln("HPET: No periodic capable timers"); | ||||||
|             return false; |             return false; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -90,7 +90,7 @@ size_t HPETComparator::ticks_per_second() const | ||||||
| 
 | 
 | ||||||
| void HPETComparator::reset_to_default_ticks_per_second() | void HPETComparator::reset_to_default_ticks_per_second() | ||||||
| { | { | ||||||
|     dbg() << "reset_to_default_ticks_per_second"; |     dbgln("reset_to_default_ticks_per_second"); | ||||||
|     m_frequency = OPTIMAL_TICKS_PER_SECOND_RATE; |     m_frequency = OPTIMAL_TICKS_PER_SECOND_RATE; | ||||||
|     if (!is_periodic()) |     if (!is_periodic()) | ||||||
|         set_new_countdown(); |         set_new_countdown(); | ||||||
|  |  | ||||||
|  | @ -224,7 +224,7 @@ timeval TimeManagement::now_as_timeval() | ||||||
| Vector<HardwareTimerBase*> TimeManagement::scan_and_initialize_periodic_timers() | Vector<HardwareTimerBase*> TimeManagement::scan_and_initialize_periodic_timers() | ||||||
| { | { | ||||||
|     bool should_enable = is_hpet_periodic_mode_allowed(); |     bool should_enable = is_hpet_periodic_mode_allowed(); | ||||||
|     dbg() << "Time: Scanning for periodic timers"; |     dbgln("Time: Scanning for periodic timers"); | ||||||
|     Vector<HardwareTimerBase*> timers; |     Vector<HardwareTimerBase*> timers; | ||||||
|     for (auto& hardware_timer : m_hardware_timers) { |     for (auto& hardware_timer : m_hardware_timers) { | ||||||
|         if (hardware_timer.is_periodic_capable()) { |         if (hardware_timer.is_periodic_capable()) { | ||||||
|  | @ -238,7 +238,7 @@ Vector<HardwareTimerBase*> TimeManagement::scan_and_initialize_periodic_timers() | ||||||
| 
 | 
 | ||||||
| Vector<HardwareTimerBase*> TimeManagement::scan_for_non_periodic_timers() | Vector<HardwareTimerBase*> TimeManagement::scan_for_non_periodic_timers() | ||||||
| { | { | ||||||
|     dbg() << "Time: Scanning for non-periodic timers"; |     dbgln("Time: Scanning for non-periodic timers"); | ||||||
|     Vector<HardwareTimerBase*> timers; |     Vector<HardwareTimerBase*> timers; | ||||||
|     for (auto& hardware_timer : m_hardware_timers) { |     for (auto& hardware_timer : m_hardware_timers) { | ||||||
|         if (!hardware_timer.is_periodic_capable()) |         if (!hardware_timer.is_periodic_capable()) | ||||||
|  | @ -264,10 +264,10 @@ bool TimeManagement::probe_and_set_non_legacy_hardware_timers() | ||||||
|     if (!HPET::test_and_initialize()) |     if (!HPET::test_and_initialize()) | ||||||
|         return false; |         return false; | ||||||
|     if (!HPET::the().comparators().size()) { |     if (!HPET::the().comparators().size()) { | ||||||
|         dbg() << "HPET initialization aborted."; |         dbgln("HPET initialization aborted."); | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
|     dbg() << "HPET: Setting appropriate functions to timers."; |     dbgln("HPET: Setting appropriate functions to timers."); | ||||||
| 
 | 
 | ||||||
|     for (auto& hpet_comparator : HPET::the().comparators()) |     for (auto& hpet_comparator : HPET::the().comparators()) | ||||||
|         m_hardware_timers.append(hpet_comparator); |         m_hardware_timers.append(hpet_comparator); | ||||||
|  | @ -315,10 +315,10 @@ bool TimeManagement::probe_and_set_legacy_hardware_timers() | ||||||
| { | { | ||||||
|     if (ACPI::is_enabled()) { |     if (ACPI::is_enabled()) { | ||||||
|         if (ACPI::Parser::the()->x86_specific_flags().cmos_rtc_not_present) { |         if (ACPI::Parser::the()->x86_specific_flags().cmos_rtc_not_present) { | ||||||
|             dbg() << "ACPI: CMOS RTC Not Present"; |             dbgln("ACPI: CMOS RTC Not Present"); | ||||||
|             return false; |             return false; | ||||||
|         } else { |         } else { | ||||||
|             dbg() << "ACPI: CMOS RTC Present"; |             dbgln("ACPI: CMOS RTC Present"); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -446,7 +446,7 @@ PageFaultResponse AnonymousVMObject::handle_cow_fault(size_t page_index, Virtual | ||||||
|     bool have_committed = m_shared_committed_cow_pages && is_nonvolatile(page_index); |     bool have_committed = m_shared_committed_cow_pages && is_nonvolatile(page_index); | ||||||
|     if (page_slot->ref_count() == 1) { |     if (page_slot->ref_count() == 1) { | ||||||
| #ifdef PAGE_FAULT_DEBUG | #ifdef PAGE_FAULT_DEBUG | ||||||
|         dbg() << "    >> It's a COW page but nobody is sharing it anymore. Remap r/w"; |         dbgln("    >> It's a COW page but nobody is sharing it anymore. Remap r/w"); | ||||||
| #endif | #endif | ||||||
|         set_should_cow(page_index, false); |         set_should_cow(page_index, false); | ||||||
|         if (have_committed) { |         if (have_committed) { | ||||||
|  | @ -459,12 +459,12 @@ PageFaultResponse AnonymousVMObject::handle_cow_fault(size_t page_index, Virtual | ||||||
|     RefPtr<PhysicalPage> page; |     RefPtr<PhysicalPage> page; | ||||||
|     if (have_committed) { |     if (have_committed) { | ||||||
| #ifdef PAGE_FAULT_DEBUG | #ifdef PAGE_FAULT_DEBUG | ||||||
|         dbg() << "    >> It's a committed COW page and it's time to COW!"; |         dbgln("    >> It's a committed COW page and it's time to COW!"); | ||||||
| #endif | #endif | ||||||
|         page = m_shared_committed_cow_pages->allocate_one(); |         page = m_shared_committed_cow_pages->allocate_one(); | ||||||
|     } else { |     } else { | ||||||
| #ifdef PAGE_FAULT_DEBUG | #ifdef PAGE_FAULT_DEBUG | ||||||
|         dbg() << "    >> It's a COW page and it's time to COW!"; |         dbgln("    >> It's a COW page and it's time to COW!"); | ||||||
| #endif | #endif | ||||||
|         page = MM.allocate_user_physical_page(MemoryManager::ShouldZeroFill::No); |         page = MM.allocate_user_physical_page(MemoryManager::ShouldZeroFill::No); | ||||||
|         if (page.is_null()) { |         if (page.is_null()) { | ||||||
|  |  | ||||||
|  | @ -209,7 +209,7 @@ void RangeAllocator::deallocate(Range range) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| #ifdef VRA_DEBUG | #ifdef VRA_DEBUG | ||||||
|     dbg() << "VRA: After deallocate"; |     dbgln("VRA: After deallocate"); | ||||||
|     dump(); |     dump(); | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -500,7 +500,7 @@ PageFaultResponse Region::handle_zero_fault(size_t page_index_in_region) | ||||||
| 
 | 
 | ||||||
|     if (!page_slot.is_null() && !page_slot->is_shared_zero_page() && !page_slot->is_lazy_committed_page()) { |     if (!page_slot.is_null() && !page_slot->is_shared_zero_page() && !page_slot->is_lazy_committed_page()) { | ||||||
| #ifdef PAGE_FAULT_DEBUG | #ifdef PAGE_FAULT_DEBUG | ||||||
|         dbg() << "MM: zero_page() but page already present. Fine with me!"; |         dbgln("MM: zero_page() but page already present. Fine with me!"); | ||||||
| #endif | #endif | ||||||
|         if (!remap_vmobject_page(page_index_in_vmobject)) |         if (!remap_vmobject_page(page_index_in_vmobject)) | ||||||
|             return PageFaultResponse::OutOfMemory; |             return PageFaultResponse::OutOfMemory; | ||||||
|  | @ -581,7 +581,7 @@ PageFaultResponse Region::handle_inode_fault(size_t page_index_in_region) | ||||||
|         current_thread->did_inode_fault(); |         current_thread->did_inode_fault(); | ||||||
| 
 | 
 | ||||||
| #ifdef MM_DEBUG | #ifdef MM_DEBUG | ||||||
|     dbg() << "MM: page_in_from_inode ready to read from inode"; |     dbgln("MM: page_in_from_inode ready to read from inode"); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|     u8 page_buffer[PAGE_SIZE]; |     u8 page_buffer[PAGE_SIZE]; | ||||||
|  |  | ||||||
|  | @ -624,7 +624,7 @@ int feof(FILE* stream) | ||||||
| int fflush(FILE* stream) | int fflush(FILE* stream) | ||||||
| { | { | ||||||
|     if (!stream) { |     if (!stream) { | ||||||
|         dbg() << "FIXME: fflush(nullptr) should flush all open streams"; |         dbgln("FIXME: fflush(nullptr) should flush all open streams"); | ||||||
|         return 0; |         return 0; | ||||||
|     } |     } | ||||||
|     return stream->flush() ? 0 : EOF; |     return stream->flush() ? 0 : EOF; | ||||||
|  |  | ||||||
|  | @ -39,7 +39,7 @@ long ulimit([[maybe_unused]] int cmd, [[maybe_unused]] long newlimit) | ||||||
| 
 | 
 | ||||||
| int getrusage([[maybe_unused]] int who, [[maybe_unused]] struct rusage* usage) | int getrusage([[maybe_unused]] int who, [[maybe_unused]] struct rusage* usage) | ||||||
| { | { | ||||||
|     dbg() << "LibC: getrusage is not implemented"; |     dbgln("LibC: getrusage is not implemented"); | ||||||
|     return -1; |     return -1; | ||||||
| } | } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -138,7 +138,7 @@ int execvpe(const char* filename, char* const argv[], char* const envp[]) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     errno_rollback.set_override_rollback_value(ENOENT); |     errno_rollback.set_override_rollback_value(ENOENT); | ||||||
|     dbg() << "execvpe() leaving :("; |     dbgln("execvpe() leaving :("); | ||||||
|     return -1; |     return -1; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -55,12 +55,12 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data) | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
| #ifdef DEBUG_GZIP | #ifdef DEBUG_GZIP | ||||||
|     dbg() << "get_gzip_payload: Skipping over gzip header."; |     dbgln("get_gzip_payload: Skipping over gzip header."); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|     // Magic Header
 |     // Magic Header
 | ||||||
|     if (read_byte() != 0x1F || read_byte() != 0x8B) { |     if (read_byte() != 0x1F || read_byte() != 0x8B) { | ||||||
|         dbg() << "get_gzip_payload: Wrong magic number."; |         dbgln("get_gzip_payload: Wrong magic number."); | ||||||
|         return Optional<ByteBuffer>(); |         return Optional<ByteBuffer>(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -85,21 +85,21 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data) | ||||||
| 
 | 
 | ||||||
|     // FNAME
 |     // FNAME
 | ||||||
|     if (flags & 8) { |     if (flags & 8) { | ||||||
|         dbg() << "get_gzip_payload: Header has FNAME flag set."; |         dbgln("get_gzip_payload: Header has FNAME flag set."); | ||||||
|         while (read_byte() != '\0') |         while (read_byte() != '\0') | ||||||
|             ; |             ; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // FCOMMENT
 |     // FCOMMENT
 | ||||||
|     if (flags & 16) { |     if (flags & 16) { | ||||||
|         dbg() << "get_gzip_payload: Header has FCOMMENT flag set."; |         dbgln("get_gzip_payload: Header has FCOMMENT flag set."); | ||||||
|         while (read_byte() != '\0') |         while (read_byte() != '\0') | ||||||
|             ; |             ; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // FHCRC
 |     // FHCRC
 | ||||||
|     if (flags & 2) { |     if (flags & 2) { | ||||||
|         dbg() << "get_gzip_payload: Header has FHCRC flag set."; |         dbgln("get_gzip_payload: Header has FHCRC flag set."); | ||||||
|         current += 2; |         current += 2; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -142,7 +142,7 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data) | ||||||
| 
 | 
 | ||||||
|         if (puff_ret == 0) { |         if (puff_ret == 0) { | ||||||
| #ifdef DEBUG_GZIP | #ifdef DEBUG_GZIP | ||||||
|             dbg() << "Gzip::decompress: Decompression success."; |             dbgln("Gzip::decompress: Decompression success."); | ||||||
| #endif | #endif | ||||||
|             destination.trim(destination_len); |             destination.trim(destination_len); | ||||||
|             break; |             break; | ||||||
|  | @ -151,7 +151,7 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data) | ||||||
|         if (puff_ret == 1) { |         if (puff_ret == 1) { | ||||||
|             // FIXME: Find a better way of decompressing without needing to try over and over again.
 |             // FIXME: Find a better way of decompressing without needing to try over and over again.
 | ||||||
| #ifdef DEBUG_GZIP | #ifdef DEBUG_GZIP | ||||||
|             dbg() << "Gzip::decompress: Output buffer exhausted. Growing."; |             dbgln("Gzip::decompress: Output buffer exhausted. Growing."); | ||||||
| #endif | #endif | ||||||
|             destination.grow(destination.size() * 2); |             destination.grow(destination.size() * 2); | ||||||
|         } else { |         } else { | ||||||
|  |  | ||||||
|  | @ -78,11 +78,11 @@ bool LocalServer::take_over_from_system_server() | ||||||
|         } else { |         } else { | ||||||
|             if (rc != 0) |             if (rc != 0) | ||||||
|                 perror("fstat"); |                 perror("fstat"); | ||||||
|             dbg() << "It's not a socket, what the heck??"; |             dbgln("It's not a socket, what the heck??"); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     dbg() << "Failed to take the socket over from SystemServer"; |     dbgln("Failed to take the socket over from SystemServer"); | ||||||
| 
 | 
 | ||||||
|     return false; |     return false; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -88,7 +88,7 @@ RefPtr<LocalSocket> LocalSocket::take_over_accepted_socket_from_system_server() | ||||||
|     if (rc < 0 || !S_ISSOCK(stat.st_mode)) { |     if (rc < 0 || !S_ISSOCK(stat.st_mode)) { | ||||||
|         if (rc != 0) |         if (rc != 0) | ||||||
|             perror("fstat"); |             perror("fstat"); | ||||||
|         dbg() << "ERROR: The fd we got from SystemServer is not a socket"; |         dbgln("ERROR: The fd we got from SystemServer is not a socket"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -221,7 +221,7 @@ UnsignedBigInteger LCM(const UnsignedBigInteger& a, const UnsignedBigInteger& b) | ||||||
|     GCD_without_allocation(a, b, temp_a, temp_b, temp_1, temp_2, temp_3, temp_4, temp_quotient, temp_remainder, gcd_output); |     GCD_without_allocation(a, b, temp_a, temp_b, temp_1, temp_2, temp_3, temp_4, temp_quotient, temp_remainder, gcd_output); | ||||||
|     if (gcd_output == 0) { |     if (gcd_output == 0) { | ||||||
| #ifdef NT_DEBUG | #ifdef NT_DEBUG | ||||||
|         dbg() << "GCD is zero"; |         dbgln("GCD is zero"); | ||||||
| #endif | #endif | ||||||
|         return output; |         return output; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -85,7 +85,7 @@ RSA::KeyPairType RSA::parse_rsa_key(ReadonlyBytes in) | ||||||
|             ASN1::Kind::Integer, 1, &n)) { |             ASN1::Kind::Integer, 1, &n)) { | ||||||
|         // that's no key
 |         // that's no key
 | ||||||
|         // that's a death star
 |         // that's a death star
 | ||||||
|         dbg() << "that's a death star"; |         dbgln("that's a death star"); | ||||||
|         return keypair; |         return keypair; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -105,7 +105,7 @@ RSA::KeyPairType RSA::parse_rsa_key(ReadonlyBytes in) | ||||||
|     } |     } | ||||||
|     if (n == 1) { |     if (n == 1) { | ||||||
|         // multiprime key, we don't know how to deal with this
 |         // multiprime key, we don't know how to deal with this
 | ||||||
|         dbg() << "Unsupported key type"; |         dbgln("Unsupported key type"); | ||||||
|         return keypair; |         return keypair; | ||||||
|     } |     } | ||||||
|     // it's a broken public key
 |     // it's a broken public key
 | ||||||
|  | @ -120,7 +120,7 @@ void RSA::encrypt(ReadonlyBytes in, Bytes& out) | ||||||
| #endif | #endif | ||||||
|     auto in_integer = UnsignedBigInteger::import_data(in.data(), in.size()); |     auto in_integer = UnsignedBigInteger::import_data(in.data(), in.size()); | ||||||
|     if (!(in_integer < m_public_key.modulus())) { |     if (!(in_integer < m_public_key.modulus())) { | ||||||
|         dbg() << "value too large for key"; |         dbgln("value too large for key"); | ||||||
|         out = {}; |         out = {}; | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  | @ -175,7 +175,7 @@ void RSA::import_private_key(ReadonlyBytes bytes, bool pem) | ||||||
| 
 | 
 | ||||||
|     auto key = parse_rsa_key(bytes); |     auto key = parse_rsa_key(bytes); | ||||||
|     if (!key.private_key.length()) { |     if (!key.private_key.length()) { | ||||||
|         dbg() << "We expected to see a private key, but we found none"; |         dbgln("We expected to see a private key, but we found none"); | ||||||
|         ASSERT_NOT_REACHED(); |         ASSERT_NOT_REACHED(); | ||||||
|     } |     } | ||||||
|     m_private_key = key.private_key; |     m_private_key = key.private_key; | ||||||
|  | @ -191,7 +191,7 @@ void RSA::import_public_key(ReadonlyBytes bytes, bool pem) | ||||||
| 
 | 
 | ||||||
|     auto key = parse_rsa_key(bytes); |     auto key = parse_rsa_key(bytes); | ||||||
|     if (!key.public_key.length()) { |     if (!key.public_key.length()) { | ||||||
|         dbg() << "We expected to see a public key, but we found none"; |         dbgln("We expected to see a public key, but we found none"); | ||||||
|         ASSERT_NOT_REACHED(); |         ASSERT_NOT_REACHED(); | ||||||
|     } |     } | ||||||
|     m_public_key = key.public_key; |     m_public_key = key.public_key; | ||||||
|  | @ -235,12 +235,12 @@ void RSA_PKCS1_EME::encrypt(ReadonlyBytes in, Bytes& out) | ||||||
|     dbg() << "key size: " << mod_len; |     dbg() << "key size: " << mod_len; | ||||||
| #endif | #endif | ||||||
|     if (in.size() > mod_len - 11) { |     if (in.size() > mod_len - 11) { | ||||||
|         dbg() << "message too long :("; |         dbgln("message too long :("); | ||||||
|         out = out.trim(0); |         out = out.trim(0); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     if (out.size() < mod_len) { |     if (out.size() < mod_len) { | ||||||
|         dbg() << "output buffer too small"; |         dbgln("output buffer too small"); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -303,14 +303,14 @@ void RSA_PKCS1_EME::decrypt(ReadonlyBytes in, Bytes& out) | ||||||
|         ++offset; |         ++offset; | ||||||
| 
 | 
 | ||||||
|     if (offset == out.size()) { |     if (offset == out.size()) { | ||||||
|         dbg() << "garbage data, no zero to split padding"; |         dbgln("garbage data, no zero to split padding"); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     ++offset; |     ++offset; | ||||||
| 
 | 
 | ||||||
|     if (offset - 3 < 8) { |     if (offset - 3 < 8) { | ||||||
|         dbg() << "PS too small"; |         dbgln("PS too small"); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -319,11 +319,11 @@ void RSA_PKCS1_EME::decrypt(ReadonlyBytes in, Bytes& out) | ||||||
| 
 | 
 | ||||||
| void RSA_PKCS1_EME::sign(ReadonlyBytes, Bytes&) | void RSA_PKCS1_EME::sign(ReadonlyBytes, Bytes&) | ||||||
| { | { | ||||||
|     dbg() << "FIXME: RSA_PKCS_EME::sign"; |     dbgln("FIXME: RSA_PKCS_EME::sign"); | ||||||
| } | } | ||||||
| void RSA_PKCS1_EME::verify(ReadonlyBytes, Bytes&) | void RSA_PKCS1_EME::verify(ReadonlyBytes, Bytes&) | ||||||
| { | { | ||||||
|     dbg() << "FIXME: RSA_PKCS_EME::verify"; |     dbgln("FIXME: RSA_PKCS_EME::verify"); | ||||||
| } | } | ||||||
| } | } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -80,14 +80,14 @@ Vector<Hunk> parse_hunks(const String& diff) | ||||||
| 
 | 
 | ||||||
| #ifdef DEBUG_HUNKS | #ifdef DEBUG_HUNKS | ||||||
|     for (const auto& hunk : hunks) { |     for (const auto& hunk : hunks) { | ||||||
|         dbg() << "Hunk location:"; |         dbgln("Hunk location:"); | ||||||
|         dbg() << "orig: " << hunk.original_start_line; |         dbg() << "orig: " << hunk.original_start_line; | ||||||
|         dbg() << "target: " << hunk.target_start_line; |         dbg() << "target: " << hunk.target_start_line; | ||||||
|         dbg() << "removed:"; |         dbgln("removed:"); | ||||||
|         for (const auto& line : hunk.removed_lines) { |         for (const auto& line : hunk.removed_lines) { | ||||||
|             dbg() << "- " << line; |             dbg() << "- " << line; | ||||||
|         } |         } | ||||||
|         dbg() << "added:"; |         dbgln("added:"); | ||||||
|         for (const auto& line : hunk.added_lines) { |         for (const auto& line : hunk.added_lines) { | ||||||
|             dbg() << "+ " << line; |             dbg() << "+ " << line; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -308,7 +308,7 @@ void AbstractView::mousemove_event(MouseEvent& event) | ||||||
|     // Prevent this by just ignoring later drag initiations (until the current drag operation ends).
 |     // Prevent this by just ignoring later drag initiations (until the current drag operation ends).
 | ||||||
|     TemporaryChange dragging { m_is_dragging, true }; |     TemporaryChange dragging { m_is_dragging, true }; | ||||||
| 
 | 
 | ||||||
|     dbg() << "Initiate drag!"; |     dbgln("Initiate drag!"); | ||||||
|     auto drag_operation = DragOperation::construct(); |     auto drag_operation = DragOperation::construct(); | ||||||
| 
 | 
 | ||||||
|     drag_operation->set_mime_data(m_model->mime_data(m_selection)); |     drag_operation->set_mime_data(m_model->mime_data(m_selection)); | ||||||
|  | @ -317,10 +317,10 @@ void AbstractView::mousemove_event(MouseEvent& event) | ||||||
| 
 | 
 | ||||||
|     switch (outcome) { |     switch (outcome) { | ||||||
|     case DragOperation::Outcome::Accepted: |     case DragOperation::Outcome::Accepted: | ||||||
|         dbg() << "Drag was accepted!"; |         dbgln("Drag was accepted!"); | ||||||
|         break; |         break; | ||||||
|     case DragOperation::Outcome::Cancelled: |     case DragOperation::Outcome::Cancelled: | ||||||
|         dbg() << "Drag was cancelled!"; |         dbgln("Drag was cancelled!"); | ||||||
|         break; |         break; | ||||||
|     default: |     default: | ||||||
|         ASSERT_NOT_REACHED(); |         ASSERT_NOT_REACHED(); | ||||||
|  |  | ||||||
|  | @ -192,7 +192,7 @@ void ColumnsView::push_column(const ModelIndex& parent_index) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // Add the new column.
 |     // Add the new column.
 | ||||||
|     dbg() << "Adding a new column"; |     dbgln("Adding a new column"); | ||||||
|     m_columns.append({ parent_index, 0 }); |     m_columns.append({ parent_index, 0 }); | ||||||
|     update_column_sizes(); |     update_column_sizes(); | ||||||
|     update(); |     update(); | ||||||
|  | @ -278,7 +278,7 @@ void ColumnsView::model_did_update(unsigned flags) | ||||||
|     AbstractView::model_did_update(flags); |     AbstractView::model_did_update(flags); | ||||||
| 
 | 
 | ||||||
|     // FIXME: Don't drop the columns on minor updates.
 |     // FIXME: Don't drop the columns on minor updates.
 | ||||||
|     dbg() << "Model was updated; dropping columns :("; |     dbgln("Model was updated; dropping columns :("); | ||||||
|     m_columns.clear(); |     m_columns.clear(); | ||||||
|     m_columns.append({ {}, 0 }); |     m_columns.append({ {}, 0 }); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -968,14 +968,14 @@ bool Widget::load_from_json(const JsonObject& json) | ||||||
| 
 | 
 | ||||||
|     auto layout_value = json.get("layout"); |     auto layout_value = json.get("layout"); | ||||||
|     if (!layout_value.is_null() && !layout_value.is_object()) { |     if (!layout_value.is_null() && !layout_value.is_object()) { | ||||||
|         dbg() << "layout is not an object"; |         dbgln("layout is not an object"); | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
|     if (layout_value.is_object()) { |     if (layout_value.is_object()) { | ||||||
|         auto& layout = layout_value.as_object(); |         auto& layout = layout_value.as_object(); | ||||||
|         auto class_name = layout.get("class"); |         auto class_name = layout.get("class"); | ||||||
|         if (class_name.is_null()) { |         if (class_name.is_null()) { | ||||||
|             dbg() << "Invalid layout class name"; |             dbgln("Invalid layout class name"); | ||||||
|             return false; |             return false; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | @ -1001,7 +1001,7 @@ bool Widget::load_from_json(const JsonObject& json) | ||||||
|             auto& child_json = child_json_value.as_object(); |             auto& child_json = child_json_value.as_object(); | ||||||
|             auto class_name = child_json.get("class"); |             auto class_name = child_json.get("class"); | ||||||
|             if (!class_name.is_string()) { |             if (!class_name.is_string()) { | ||||||
|                 dbg() << "No class name in entry"; |                 dbgln("No class name in entry"); | ||||||
|                 return false; |                 return false; | ||||||
|             } |             } | ||||||
|             auto* registration = WidgetClassRegistration::find(class_name.as_string()); |             auto* registration = WidgetClassRegistration::find(class_name.as_string()); | ||||||
|  |  | ||||||
|  | @ -42,7 +42,7 @@ void GeminiJob::start() | ||||||
|     m_socket->set_root_certificates(m_override_ca_certificates ? *m_override_ca_certificates : DefaultRootCACertificates::the().certificates()); |     m_socket->set_root_certificates(m_override_ca_certificates ? *m_override_ca_certificates : DefaultRootCACertificates::the().certificates()); | ||||||
|     m_socket->on_tls_connected = [this] { |     m_socket->on_tls_connected = [this] { | ||||||
| #ifdef GEMINIJOB_DEBUG | #ifdef GEMINIJOB_DEBUG | ||||||
|         dbg() << "GeminiJob: on_connected callback"; |         dbgln("GeminiJob: on_connected callback"); | ||||||
| #endif | #endif | ||||||
|         on_socket_connected(); |         on_socket_connected(); | ||||||
|     }; |     }; | ||||||
|  | @ -97,7 +97,7 @@ void GeminiJob::read_while_data_available(Function<IterationDecision()> read) | ||||||
| void GeminiJob::set_certificate(String certificate, String private_key) | void GeminiJob::set_certificate(String certificate, String private_key) | ||||||
| { | { | ||||||
|     if (!m_socket->add_client_key(certificate.bytes(), private_key.bytes())) { |     if (!m_socket->add_client_key(certificate.bytes(), private_key.bytes())) { | ||||||
|         dbg() << "LibGemini: Failed to set a client certificate"; |         dbgln("LibGemini: Failed to set a client certificate"); | ||||||
|         // FIXME: Do something about this failure
 |         // FIXME: Do something about this failure
 | ||||||
|         ASSERT_NOT_REACHED(); |         ASSERT_NOT_REACHED(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -68,7 +68,7 @@ void Job::on_socket_connected() | ||||||
|         m_sent_data = true; |         m_sent_data = true; | ||||||
|         auto raw_request = m_request.to_raw_request(); |         auto raw_request = m_request.to_raw_request(); | ||||||
| #ifdef JOB_DEBUG | #ifdef JOB_DEBUG | ||||||
|         dbg() << "Job: raw_request:"; |         dbgln("Job: raw_request:"); | ||||||
|         dbg() << String::copy(raw_request).characters(); |         dbg() << String::copy(raw_request).characters(); | ||||||
| #endif | #endif | ||||||
|         bool success = write(raw_request); |         bool success = write(raw_request); | ||||||
|  | @ -153,7 +153,7 @@ void Job::on_socket_connected() | ||||||
| 
 | 
 | ||||||
|         if (!is_established()) { |         if (!is_established()) { | ||||||
| #ifdef JOB_DEBUG | #ifdef JOB_DEBUG | ||||||
|             dbg() << "Connection appears to have closed, finishing up"; |             dbgln("Connection appears to have closed, finishing up"); | ||||||
| #endif | #endif | ||||||
|             finish_up(); |             finish_up(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -357,7 +357,7 @@ static bool decode_frame(GIFLoadingContext& context, size_t frame_index) | ||||||
|             Optional<u16> code = decoder.next_code(); |             Optional<u16> code = decoder.next_code(); | ||||||
|             if (!code.has_value()) { |             if (!code.has_value()) { | ||||||
| #ifdef GIF_DEBUG | #ifdef GIF_DEBUG | ||||||
|                 dbg() << "Unexpectedly reached end of gif frame data"; |                 dbgln("Unexpectedly reached end of gif frame data"); | ||||||
| #endif | #endif | ||||||
|                 return false; |                 return false; | ||||||
|             } |             } | ||||||
|  | @ -506,7 +506,7 @@ static bool load_gif_frame_descriptors(GIFLoadingContext& context) | ||||||
|             if (extension_type == 0xF9) { |             if (extension_type == 0xF9) { | ||||||
|                 if (sub_block.size() != 4) { |                 if (sub_block.size() != 4) { | ||||||
| #ifdef GIF_DEBUG | #ifdef GIF_DEBUG | ||||||
|                     dbg() << "Unexpected graphic control size"; |                     dbgln("Unexpected graphic control size"); | ||||||
| #endif | #endif | ||||||
|                     continue; |                     continue; | ||||||
|                 } |                 } | ||||||
|  | @ -536,7 +536,7 @@ static bool load_gif_frame_descriptors(GIFLoadingContext& context) | ||||||
| 
 | 
 | ||||||
|                 if (sub_block[11] != 1) { |                 if (sub_block[11] != 1) { | ||||||
| #ifdef GIF_DEBUG | #ifdef GIF_DEBUG | ||||||
|                     dbg() << "Unexpected application extension format"; |                     dbgln("Unexpected application extension format"); | ||||||
| #endif | #endif | ||||||
|                     continue; |                     continue; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|  | @ -273,7 +273,7 @@ static Optional<u8> get_next_symbol(HuffmanStreamState& hstream, const HuffmanTa | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| #ifdef JPG_DEBUG | #ifdef JPG_DEBUG | ||||||
|     dbg() << "If you're seeing this...the jpeg decoder needs to support more kinds of JPEGs!"; |     dbgln("If you're seeing this...the jpeg decoder needs to support more kinds of JPEGs!"); | ||||||
| #endif | #endif | ||||||
|     return {}; |     return {}; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -528,7 +528,7 @@ static bool decode_png_header(PNGLoadingContext& context) | ||||||
| 
 | 
 | ||||||
|     if (!context.data || context.data_size < sizeof(png_header)) { |     if (!context.data || context.data_size < sizeof(png_header)) { | ||||||
| #ifdef PNG_DEBUG | #ifdef PNG_DEBUG | ||||||
|         dbg() << "Missing PNG header"; |         dbgln("Missing PNG header"); | ||||||
| #endif | #endif | ||||||
|         context.state = PNGLoadingContext::State::Error; |         context.state = PNGLoadingContext::State::Error; | ||||||
|         return false; |         return false; | ||||||
|  | @ -536,7 +536,7 @@ static bool decode_png_header(PNGLoadingContext& context) | ||||||
| 
 | 
 | ||||||
|     if (memcmp(context.data, png_header, sizeof(png_header)) != 0) { |     if (memcmp(context.data, png_header, sizeof(png_header)) != 0) { | ||||||
| #ifdef PNG_DEBUG | #ifdef PNG_DEBUG | ||||||
|         dbg() << "Invalid PNG header"; |         dbgln("Invalid PNG header"); | ||||||
| #endif | #endif | ||||||
|         context.state = PNGLoadingContext::State::Error; |         context.state = PNGLoadingContext::State::Error; | ||||||
|         return false; |         return false; | ||||||
|  |  | ||||||
|  | @ -40,7 +40,7 @@ void HttpJob::start() | ||||||
|     m_socket = Core::TCPSocket::construct(this); |     m_socket = Core::TCPSocket::construct(this); | ||||||
|     m_socket->on_connected = [this] { |     m_socket->on_connected = [this] { | ||||||
| #ifdef CHTTPJOB_DEBUG | #ifdef CHTTPJOB_DEBUG | ||||||
|         dbg() << "HttpJob: on_connected callback"; |         dbgln("HttpJob: on_connected callback"); | ||||||
| #endif | #endif | ||||||
|         on_socket_connected(); |         on_socket_connected(); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | @ -43,7 +43,7 @@ void HttpsJob::start() | ||||||
|     m_socket->set_root_certificates(m_override_ca_certificates ? *m_override_ca_certificates : DefaultRootCACertificates::the().certificates()); |     m_socket->set_root_certificates(m_override_ca_certificates ? *m_override_ca_certificates : DefaultRootCACertificates::the().certificates()); | ||||||
|     m_socket->on_tls_connected = [this] { |     m_socket->on_tls_connected = [this] { | ||||||
| #ifdef HTTPSJOB_DEBUG | #ifdef HTTPSJOB_DEBUG | ||||||
|         dbg() << "HttpsJob: on_connected callback"; |         dbgln("HttpsJob: on_connected callback"); | ||||||
| #endif | #endif | ||||||
|         on_socket_connected(); |         on_socket_connected(); | ||||||
|     }; |     }; | ||||||
|  | @ -90,7 +90,7 @@ void HttpsJob::shutdown() | ||||||
| void HttpsJob::set_certificate(String certificate, String private_key) | void HttpsJob::set_certificate(String certificate, String private_key) | ||||||
| { | { | ||||||
|     if (!m_socket->add_client_key(certificate.bytes(), private_key.bytes())) { |     if (!m_socket->add_client_key(certificate.bytes(), private_key.bytes())) { | ||||||
|         dbg() << "LibHTTP: Failed to set a client certificate"; |         dbgln("LibHTTP: Failed to set a client certificate"); | ||||||
|         // FIXME: Do something about this failure
 |         // FIXME: Do something about this failure
 | ||||||
|         ASSERT_NOT_REACHED(); |         ASSERT_NOT_REACHED(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -43,16 +43,16 @@ static ByteBuffer handle_content_encoding(const ByteBuffer& buf, const String& c | ||||||
| 
 | 
 | ||||||
|     if (content_encoding == "gzip") { |     if (content_encoding == "gzip") { | ||||||
|         if (!Core::Gzip::is_compressed(buf)) { |         if (!Core::Gzip::is_compressed(buf)) { | ||||||
|             dbg() << "Job::handle_content_encoding: buf is not gzip compressed!"; |             dbgln("Job::handle_content_encoding: buf is not gzip compressed!"); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| #ifdef JOB_DEBUG | #ifdef JOB_DEBUG | ||||||
|         dbg() << "Job::handle_content_encoding: buf is gzip compressed!"; |         dbgln("Job::handle_content_encoding: buf is gzip compressed!"); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|         auto uncompressed = Core::Gzip::decompress(buf); |         auto uncompressed = Core::Gzip::decompress(buf); | ||||||
|         if (!uncompressed.has_value()) { |         if (!uncompressed.has_value()) { | ||||||
|             dbg() << "Job::handle_content_encoding: Gzip::decompress() failed. Returning original buffer."; |             dbgln("Job::handle_content_encoding: Gzip::decompress() failed. Returning original buffer."); | ||||||
|             return buf; |             return buf; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | @ -115,7 +115,7 @@ void Job::on_socket_connected() | ||||||
|         m_sent_data = true; |         m_sent_data = true; | ||||||
|         auto raw_request = m_request.to_raw_request(); |         auto raw_request = m_request.to_raw_request(); | ||||||
| #ifdef JOB_DEBUG | #ifdef JOB_DEBUG | ||||||
|         dbg() << "Job: raw_request:"; |         dbgln("Job: raw_request:"); | ||||||
|         dbg() << String::copy(raw_request).characters(); |         dbg() << String::copy(raw_request).characters(); | ||||||
| #endif | #endif | ||||||
|         bool success = write(raw_request); |         bool success = write(raw_request); | ||||||
|  | @ -234,7 +234,7 @@ void Job::on_socket_connected() | ||||||
|                     dbg() << "Job: Received a chunk with size _" << size_data << "_"; |                     dbg() << "Job: Received a chunk with size _" << size_data << "_"; | ||||||
| #endif | #endif | ||||||
|                     if (size_lines.size() == 0) { |                     if (size_lines.size() == 0) { | ||||||
|                         dbg() << "Job: Reached end of stream"; |                         dbgln("Job: Reached end of stream"); | ||||||
|                         finish_up(); |                         finish_up(); | ||||||
|                         return IterationDecision::Break; |                         return IterationDecision::Break; | ||||||
|                     } else { |                     } else { | ||||||
|  | @ -355,7 +355,7 @@ void Job::on_socket_connected() | ||||||
| 
 | 
 | ||||||
|         if (!is_established()) { |         if (!is_established()) { | ||||||
| #ifdef JOB_DEBUG | #ifdef JOB_DEBUG | ||||||
|             dbg() << "Connection appears to have closed, finishing up"; |             dbgln("Connection appears to have closed, finishing up"); | ||||||
| #endif | #endif | ||||||
|             finish_up(); |             finish_up(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -53,7 +53,7 @@ RefPtr<Gfx::Bitmap> Client::decode_image(const ByteBuffer& encoded_data) | ||||||
| 
 | 
 | ||||||
|     auto encoded_buffer = SharedBuffer::create_with_size(encoded_data.size()); |     auto encoded_buffer = SharedBuffer::create_with_size(encoded_data.size()); | ||||||
|     if (!encoded_buffer) { |     if (!encoded_buffer) { | ||||||
|         dbg() << "Could not allocate encoded shbuf"; |         dbgln("Could not allocate encoded shbuf"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -66,13 +66,13 @@ RefPtr<Gfx::Bitmap> Client::decode_image(const ByteBuffer& encoded_data) | ||||||
|     auto bitmap_format = (Gfx::BitmapFormat)response->bitmap_format(); |     auto bitmap_format = (Gfx::BitmapFormat)response->bitmap_format(); | ||||||
|     if (bitmap_format == Gfx::BitmapFormat::Invalid) { |     if (bitmap_format == Gfx::BitmapFormat::Invalid) { | ||||||
| #ifdef IMAGE_DECODER_CLIENT_DEBUG | #ifdef IMAGE_DECODER_CLIENT_DEBUG | ||||||
|         dbg() << "Response image was invalid"; |         dbgln("Response image was invalid"); | ||||||
| #endif | #endif | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (response->size().is_empty()) { |     if (response->size().is_empty()) { | ||||||
|         dbg() << "Response image was empty"; |         dbgln("Response image was empty"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1548,7 +1548,7 @@ Vector<size_t, 2> Editor::vt_dsr() | ||||||
|         if (nread == 0) { |         if (nread == 0) { | ||||||
|             m_input_error = Error::Empty; |             m_input_error = Error::Empty; | ||||||
|             finish(); |             finish(); | ||||||
|             dbg() << "Terminal DSR issue; received no response"; |             dbgln("Terminal DSR issue; received no response"); | ||||||
|             return { 1, 1 }; |             return { 1, 1 }; | ||||||
|         } |         } | ||||||
|         length += nread; |         length += nread; | ||||||
|  | @ -1559,13 +1559,13 @@ Vector<size_t, 2> Editor::vt_dsr() | ||||||
|         auto parts = StringView(buf + 2, length - 3).split_view(';'); |         auto parts = StringView(buf + 2, length - 3).split_view(';'); | ||||||
|         auto row_opt = parts[0].to_int(); |         auto row_opt = parts[0].to_int(); | ||||||
|         if (!row_opt.has_value()) { |         if (!row_opt.has_value()) { | ||||||
|             dbg() << "Terminal DSR issue; received garbage row"; |             dbgln("Terminal DSR issue; received garbage row"); | ||||||
|         } else { |         } else { | ||||||
|             row = row_opt.value(); |             row = row_opt.value(); | ||||||
|         } |         } | ||||||
|         auto col_opt = parts[1].to_int(); |         auto col_opt = parts[1].to_int(); | ||||||
|         if (!col_opt.has_value()) { |         if (!col_opt.has_value()) { | ||||||
|             dbg() << "Terminal DSR issue; received garbage col"; |             dbgln("Terminal DSR issue; received garbage col"); | ||||||
|         } else { |         } else { | ||||||
|             col = col_opt.value(); |             col = col_opt.value(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -245,14 +245,14 @@ Optional<Text> Text::parse(const StringView& str) | ||||||
|         case '[': |         case '[': | ||||||
| #ifdef DEBUG_MARKDOWN | #ifdef DEBUG_MARKDOWN | ||||||
|             if (first_span_in_the_current_link != -1) |             if (first_span_in_the_current_link != -1) | ||||||
|                 dbg() << "Dropping the outer link"; |                 dbgln("Dropping the outer link"); | ||||||
| #endif | #endif | ||||||
|             first_span_in_the_current_link = spans.size(); |             first_span_in_the_current_link = spans.size(); | ||||||
|             break; |             break; | ||||||
|         case ']': { |         case ']': { | ||||||
|             if (first_span_in_the_current_link == -1) { |             if (first_span_in_the_current_link == -1) { | ||||||
| #ifdef DEBUG_MARKDOWN | #ifdef DEBUG_MARKDOWN | ||||||
|                 dbg() << "Unmatched ]"; |                 dbgln("Unmatched ]"); | ||||||
| #endif | #endif | ||||||
|                 continue; |                 continue; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  | @ -135,7 +135,7 @@ void Download::did_request_certificates(Badge<Client>) | ||||||
|     if (on_certificate_requested) { |     if (on_certificate_requested) { | ||||||
|         auto result = on_certificate_requested(); |         auto result = on_certificate_requested(); | ||||||
|         if (!m_client->set_certificate({}, *this, result.certificate, result.key)) { |         if (!m_client->set_certificate({}, *this, result.certificate, result.key)) { | ||||||
|             dbg() << "Download: set_certificate failed"; |             dbgln("Download: set_certificate failed"); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -310,7 +310,7 @@ Optional<bool> Matcher<Parser>::execute(const MatchInput& input, MatchState& sta | ||||||
|         auto* opcode = bytecode.get_opcode(state); |         auto* opcode = bytecode.get_opcode(state); | ||||||
| 
 | 
 | ||||||
|         if (!opcode) { |         if (!opcode) { | ||||||
|             dbg() << "Wrong opcode... failed!"; |             dbgln("Wrong opcode... failed!"); | ||||||
|             return {}; |             return {}; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -507,12 +507,12 @@ TEST_CASE(ECMA262_parse) | ||||||
|         Regex<ECMA262> re(test.pattern); |         Regex<ECMA262> re(test.pattern); | ||||||
|         EXPECT_EQ(re.parser_result.error, test.expected_error); |         EXPECT_EQ(re.parser_result.error, test.expected_error); | ||||||
| #ifdef REGEX_DEBUG | #ifdef REGEX_DEBUG | ||||||
|         dbg() << "\n"; |         dbgln("\n"); | ||||||
|         RegexDebug regex_dbg(stderr); |         RegexDebug regex_dbg(stderr); | ||||||
|         regex_dbg.print_raw_bytecode(re); |         regex_dbg.print_raw_bytecode(re); | ||||||
|         regex_dbg.print_header(); |         regex_dbg.print_header(); | ||||||
|         regex_dbg.print_bytecode(re); |         regex_dbg.print_bytecode(re); | ||||||
|         dbg() << "\n"; |         dbgln("\n"); | ||||||
| #endif | #endif | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -552,12 +552,12 @@ TEST_CASE(ECMA262_match) | ||||||
|     for (auto& test : tests) { |     for (auto& test : tests) { | ||||||
|         Regex<ECMA262> re(test.pattern, test.options); |         Regex<ECMA262> re(test.pattern, test.options); | ||||||
| #ifdef REGEX_DEBUG | #ifdef REGEX_DEBUG | ||||||
|         dbg() << "\n"; |         dbgln("\n"); | ||||||
|         RegexDebug regex_dbg(stderr); |         RegexDebug regex_dbg(stderr); | ||||||
|         regex_dbg.print_raw_bytecode(re); |         regex_dbg.print_raw_bytecode(re); | ||||||
|         regex_dbg.print_header(); |         regex_dbg.print_header(); | ||||||
|         regex_dbg.print_bytecode(re); |         regex_dbg.print_bytecode(re); | ||||||
|         dbg() << "\n"; |         dbgln("\n"); | ||||||
| #endif | #endif | ||||||
|         EXPECT_EQ(re.parser_result.error, Error::NoError); |         EXPECT_EQ(re.parser_result.error, Error::NoError); | ||||||
|         EXPECT_EQ(re.match(test.subject).success, test.matches); |         EXPECT_EQ(re.match(test.subject).success, test.matches); | ||||||
|  | @ -585,12 +585,12 @@ TEST_CASE(replace) | ||||||
|     for (auto& test : tests) { |     for (auto& test : tests) { | ||||||
|         Regex<ECMA262> re(test.pattern, test.options); |         Regex<ECMA262> re(test.pattern, test.options); | ||||||
| #ifdef REGEX_DEBUG | #ifdef REGEX_DEBUG | ||||||
|         dbg() << "\n"; |         dbgln("\n"); | ||||||
|         RegexDebug regex_dbg(stderr); |         RegexDebug regex_dbg(stderr); | ||||||
|         regex_dbg.print_raw_bytecode(re); |         regex_dbg.print_raw_bytecode(re); | ||||||
|         regex_dbg.print_header(); |         regex_dbg.print_header(); | ||||||
|         regex_dbg.print_bytecode(re); |         regex_dbg.print_bytecode(re); | ||||||
|         dbg() << "\n"; |         dbgln("\n"); | ||||||
| #endif | #endif | ||||||
|         EXPECT_EQ(re.parser_result.error, Error::NoError); |         EXPECT_EQ(re.parser_result.error, Error::NoError); | ||||||
|         EXPECT_EQ(re.replace(test.subject, test.replacement), test.expected); |         EXPECT_EQ(re.replace(test.subject, test.replacement), test.expected); | ||||||
|  |  | ||||||
|  | @ -51,14 +51,14 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe | ||||||
| { | { | ||||||
|     write_packets = WritePacketStage::Initial; |     write_packets = WritePacketStage::Initial; | ||||||
|     if (m_context.connection_status != ConnectionStatus::Disconnected && m_context.connection_status != ConnectionStatus::Renegotiating) { |     if (m_context.connection_status != ConnectionStatus::Disconnected && m_context.connection_status != ConnectionStatus::Renegotiating) { | ||||||
|         dbg() << "unexpected hello message"; |         dbgln("unexpected hello message"); | ||||||
|         return (i8)Error::UnexpectedMessage; |         return (i8)Error::UnexpectedMessage; | ||||||
|     } |     } | ||||||
|     ssize_t res = 0; |     ssize_t res = 0; | ||||||
|     size_t min_hello_size = 41; |     size_t min_hello_size = 41; | ||||||
| 
 | 
 | ||||||
|     if (min_hello_size > buffer.size()) { |     if (min_hello_size > buffer.size()) { | ||||||
|         dbg() << "need more data"; |         dbgln("need more data"); | ||||||
|         return (i8)Error::NeedMoreData; |         return (i8)Error::NeedMoreData; | ||||||
|     } |     } | ||||||
|     size_t following_bytes = buffer[0] * 0x10000 + buffer[1] * 0x100 + buffer[2]; |     size_t following_bytes = buffer[0] * 0x10000 + buffer[1] * 0x100 + buffer[2]; | ||||||
|  | @ -69,7 +69,7 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (buffer.size() - res < 2) { |     if (buffer.size() - res < 2) { | ||||||
|         dbg() << "not enough data for version"; |         dbgln("not enough data for version"); | ||||||
|         return (i8)Error::NeedMoreData; |         return (i8)Error::NeedMoreData; | ||||||
|     } |     } | ||||||
|     auto version = (Version)AK::convert_between_host_and_network_endian(*(const u16*)buffer.offset_pointer(res)); |     auto version = (Version)AK::convert_between_host_and_network_endian(*(const u16*)buffer.offset_pointer(res)); | ||||||
|  | @ -83,7 +83,7 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe | ||||||
| 
 | 
 | ||||||
|     u8 session_length = buffer[res++]; |     u8 session_length = buffer[res++]; | ||||||
|     if (buffer.size() - res < session_length) { |     if (buffer.size() - res < session_length) { | ||||||
|         dbg() << "not enough data for session id"; |         dbgln("not enough data for session id"); | ||||||
|         return (i8)Error::NeedMoreData; |         return (i8)Error::NeedMoreData; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -91,7 +91,7 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe | ||||||
|         memcpy(m_context.session_id, buffer.offset_pointer(res), session_length); |         memcpy(m_context.session_id, buffer.offset_pointer(res), session_length); | ||||||
|         m_context.session_id_size = session_length; |         m_context.session_id_size = session_length; | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|         dbg() << "Remote session ID:"; |         dbgln("Remote session ID:"); | ||||||
|         print_buffer(ReadonlyBytes { m_context.session_id, session_length }); |         print_buffer(ReadonlyBytes { m_context.session_id, session_length }); | ||||||
| #endif | #endif | ||||||
|     } else { |     } else { | ||||||
|  | @ -100,14 +100,14 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe | ||||||
|     res += session_length; |     res += session_length; | ||||||
| 
 | 
 | ||||||
|     if (buffer.size() - res < 2) { |     if (buffer.size() - res < 2) { | ||||||
|         dbg() << "not enough data for cipher suite listing"; |         dbgln("not enough data for cipher suite listing"); | ||||||
|         return (i8)Error::NeedMoreData; |         return (i8)Error::NeedMoreData; | ||||||
|     } |     } | ||||||
|     auto cipher = (CipherSuite)AK::convert_between_host_and_network_endian(*(const u16*)buffer.offset_pointer(res)); |     auto cipher = (CipherSuite)AK::convert_between_host_and_network_endian(*(const u16*)buffer.offset_pointer(res)); | ||||||
|     res += 2; |     res += 2; | ||||||
|     if (!supports_cipher(cipher)) { |     if (!supports_cipher(cipher)) { | ||||||
|         m_context.cipher = CipherSuite::Invalid; |         m_context.cipher = CipherSuite::Invalid; | ||||||
|         dbg() << "No supported cipher could be agreed upon"; |         dbgln("No supported cipher could be agreed upon"); | ||||||
|         return (i8)Error::NoCommonCipher; |         return (i8)Error::NoCommonCipher; | ||||||
|     } |     } | ||||||
|     m_context.cipher = cipher; |     m_context.cipher = cipher; | ||||||
|  | @ -119,12 +119,12 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe | ||||||
|     m_context.handshake_hash.initialize(Crypto::Hash::HashKind::SHA256); |     m_context.handshake_hash.initialize(Crypto::Hash::HashKind::SHA256); | ||||||
| 
 | 
 | ||||||
|     if (buffer.size() - res < 1) { |     if (buffer.size() - res < 1) { | ||||||
|         dbg() << "not enough data for compression spec"; |         dbgln("not enough data for compression spec"); | ||||||
|         return (i8)Error::NeedMoreData; |         return (i8)Error::NeedMoreData; | ||||||
|     } |     } | ||||||
|     u8 compression = buffer[res++]; |     u8 compression = buffer[res++]; | ||||||
|     if (compression != 0) { |     if (compression != 0) { | ||||||
|         dbg() << "Server told us to compress, we will not!"; |         dbgln("Server told us to compress, we will not!"); | ||||||
|         return (i8)Error::CompressionNotSupported; |         return (i8)Error::CompressionNotSupported; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -132,7 +132,7 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe | ||||||
|         if (m_context.connection_status != ConnectionStatus::Renegotiating) |         if (m_context.connection_status != ConnectionStatus::Renegotiating) | ||||||
|             m_context.connection_status = ConnectionStatus::Negotiating; |             m_context.connection_status = ConnectionStatus::Negotiating; | ||||||
|         if (m_context.is_server) { |         if (m_context.is_server) { | ||||||
|             dbg() << "unsupported: server mode"; |             dbgln("unsupported: server mode"); | ||||||
|             write_packets = WritePacketStage::ServerHandshake; |             write_packets = WritePacketStage::ServerHandshake; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | @ -152,7 +152,7 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe | ||||||
| #endif | #endif | ||||||
|         if (extension_length) { |         if (extension_length) { | ||||||
|             if (buffer.size() - res < extension_length) { |             if (buffer.size() - res < extension_length) { | ||||||
|                 dbg() << "not enough data for extension"; |                 dbgln("not enough data for extension"); | ||||||
|                 return (i8)Error::NeedMoreData; |                 return (i8)Error::NeedMoreData; | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|  | @ -191,7 +191,7 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } else if (extension_type == HandshakeExtension::SignatureAlgorithms) { |             } else if (extension_type == HandshakeExtension::SignatureAlgorithms) { | ||||||
|                 dbg() << "supported signatures: "; |                 dbgln("supported signatures: "); | ||||||
|                 print_buffer(buffer.slice(res, extension_length)); |                 print_buffer(buffer.slice(res, extension_length)); | ||||||
|                 // FIXME: what are we supposed to do here?
 |                 // FIXME: what are we supposed to do here?
 | ||||||
|             } |             } | ||||||
|  | @ -205,7 +205,7 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe | ||||||
| ssize_t TLSv12::handle_finished(ReadonlyBytes buffer, WritePacketStage& write_packets) | ssize_t TLSv12::handle_finished(ReadonlyBytes buffer, WritePacketStage& write_packets) | ||||||
| { | { | ||||||
|     if (m_context.connection_status < ConnectionStatus::KeyExchange || m_context.connection_status == ConnectionStatus::Established) { |     if (m_context.connection_status < ConnectionStatus::KeyExchange || m_context.connection_status == ConnectionStatus::Established) { | ||||||
|         dbg() << "unexpected finished message"; |         dbgln("unexpected finished message"); | ||||||
|         return (i8)Error::UnexpectedMessage; |         return (i8)Error::UnexpectedMessage; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -235,7 +235,7 @@ ssize_t TLSv12::handle_finished(ReadonlyBytes buffer, WritePacketStage& write_pa | ||||||
| 
 | 
 | ||||||
| // TODO: Compare Hashes
 | // TODO: Compare Hashes
 | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|     dbg() << "FIXME: handle_finished :: Check message validity"; |     dbgln("FIXME: handle_finished :: Check message validity"); | ||||||
| #endif | #endif | ||||||
|     m_context.connection_status = ConnectionStatus::Established; |     m_context.connection_status = ConnectionStatus::Established; | ||||||
| 
 | 
 | ||||||
|  | @ -266,7 +266,7 @@ void TLSv12::build_random(PacketBuilder& builder) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (m_context.is_server) { |     if (m_context.is_server) { | ||||||
|         dbg() << "Server mode not supported"; |         dbgln("Server mode not supported"); | ||||||
|         return; |         return; | ||||||
|     } else { |     } else { | ||||||
|         *(u16*)random_bytes = AK::convert_between_host_and_network_endian((u16)Version::V12); |         *(u16*)random_bytes = AK::convert_between_host_and_network_endian((u16)Version::V12); | ||||||
|  | @ -276,14 +276,14 @@ void TLSv12::build_random(PacketBuilder& builder) | ||||||
| 
 | 
 | ||||||
|     const auto& certificate_option = verify_chain_and_get_matching_certificate(m_context.SNI); // if the SNI is empty, we'll make a special case and match *a* leaf certificate.
 |     const auto& certificate_option = verify_chain_and_get_matching_certificate(m_context.SNI); // if the SNI is empty, we'll make a special case and match *a* leaf certificate.
 | ||||||
|     if (!certificate_option.has_value()) { |     if (!certificate_option.has_value()) { | ||||||
|         dbg() << "certificate verification failed :("; |         dbgln("certificate verification failed :("); | ||||||
|         alert(AlertLevel::Critical, AlertDescription::BadCertificate); |         alert(AlertLevel::Critical, AlertDescription::BadCertificate); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     auto& certificate = m_context.certificates[certificate_option.value()]; |     auto& certificate = m_context.certificates[certificate_option.value()]; | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|     dbg() << "PreMaster secret"; |     dbgln("PreMaster secret"); | ||||||
|     print_buffer(m_context.premaster_key); |     print_buffer(m_context.premaster_key); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | @ -294,12 +294,12 @@ void TLSv12::build_random(PacketBuilder& builder) | ||||||
|     rsa.encrypt(m_context.premaster_key, outbuf); |     rsa.encrypt(m_context.premaster_key, outbuf); | ||||||
| 
 | 
 | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|     dbg() << "Encrypted: "; |     dbgln("Encrypted: "); | ||||||
|     print_buffer(outbuf); |     print_buffer(outbuf); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|     if (!compute_master_secret(bytes)) { |     if (!compute_master_secret(bytes)) { | ||||||
|         dbg() << "oh noes we could not derive a master key :("; |         dbgln("oh noes we could not derive a master key :("); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -312,7 +312,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) | ||||||
| { | { | ||||||
|     if (m_context.connection_status == ConnectionStatus::Established) { |     if (m_context.connection_status == ConnectionStatus::Established) { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|         dbg() << "Renegotiation attempt ignored"; |         dbgln("Renegotiation attempt ignored"); | ||||||
| #endif | #endif | ||||||
|         // FIXME: We should properly say "NoRenegotiation", but that causes a handshake failure
 |         // FIXME: We should properly say "NoRenegotiation", but that causes a handshake failure
 | ||||||
|         //        so we just roll with it and pretend that we _did_ renegotiate
 |         //        so we just roll with it and pretend that we _did_ renegotiate
 | ||||||
|  | @ -339,12 +339,12 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) | ||||||
|         switch (type) { |         switch (type) { | ||||||
|         case HelloRequest: |         case HelloRequest: | ||||||
|             if (m_context.handshake_messages[0] >= 1) { |             if (m_context.handshake_messages[0] >= 1) { | ||||||
|                 dbg() << "unexpected hello request message"; |                 dbgln("unexpected hello request message"); | ||||||
|                 payload_res = (i8)Error::UnexpectedMessage; |                 payload_res = (i8)Error::UnexpectedMessage; | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|             ++m_context.handshake_messages[0]; |             ++m_context.handshake_messages[0]; | ||||||
|             dbg() << "hello request (renegotiation?)"; |             dbgln("hello request (renegotiation?)"); | ||||||
|             if (m_context.connection_status == ConnectionStatus::Established) { |             if (m_context.connection_status == ConnectionStatus::Established) { | ||||||
|                 // renegotiation
 |                 // renegotiation
 | ||||||
|                 payload_res = (i8)Error::NoRenegotiation; |                 payload_res = (i8)Error::NoRenegotiation; | ||||||
|  | @ -362,38 +362,38 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) | ||||||
|             break; |             break; | ||||||
|         case ServerHello: |         case ServerHello: | ||||||
|             if (m_context.handshake_messages[2] >= 1) { |             if (m_context.handshake_messages[2] >= 1) { | ||||||
|                 dbg() << "unexpected server hello message"; |                 dbgln("unexpected server hello message"); | ||||||
|                 payload_res = (i8)Error::UnexpectedMessage; |                 payload_res = (i8)Error::UnexpectedMessage; | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|             ++m_context.handshake_messages[2]; |             ++m_context.handshake_messages[2]; | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|             dbg() << "server hello"; |             dbgln("server hello"); | ||||||
| #endif | #endif | ||||||
|             if (m_context.is_server) { |             if (m_context.is_server) { | ||||||
|                 dbg() << "unsupported: server mode"; |                 dbgln("unsupported: server mode"); | ||||||
|                 ASSERT_NOT_REACHED(); |                 ASSERT_NOT_REACHED(); | ||||||
|             } else { |             } else { | ||||||
|                 payload_res = handle_hello(buffer.slice(1, payload_size), write_packets); |                 payload_res = handle_hello(buffer.slice(1, payload_size), write_packets); | ||||||
|             } |             } | ||||||
|             break; |             break; | ||||||
|         case HelloVerifyRequest: |         case HelloVerifyRequest: | ||||||
|             dbg() << "unsupported: DTLS"; |             dbgln("unsupported: DTLS"); | ||||||
|             payload_res = (i8)Error::UnexpectedMessage; |             payload_res = (i8)Error::UnexpectedMessage; | ||||||
|             break; |             break; | ||||||
|         case CertificateMessage: |         case CertificateMessage: | ||||||
|             if (m_context.handshake_messages[4] >= 1) { |             if (m_context.handshake_messages[4] >= 1) { | ||||||
|                 dbg() << "unexpected certificate message"; |                 dbgln("unexpected certificate message"); | ||||||
|                 payload_res = (i8)Error::UnexpectedMessage; |                 payload_res = (i8)Error::UnexpectedMessage; | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|             ++m_context.handshake_messages[4]; |             ++m_context.handshake_messages[4]; | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|             dbg() << "certificate"; |             dbgln("certificate"); | ||||||
| #endif | #endif | ||||||
|             if (m_context.connection_status == ConnectionStatus::Negotiating) { |             if (m_context.connection_status == ConnectionStatus::Negotiating) { | ||||||
|                 if (m_context.is_server) { |                 if (m_context.is_server) { | ||||||
|                     dbg() << "unsupported: server mode"; |                     dbgln("unsupported: server mode"); | ||||||
|                     ASSERT_NOT_REACHED(); |                     ASSERT_NOT_REACHED(); | ||||||
|                 } |                 } | ||||||
|                 payload_res = handle_certificate(buffer.slice(1, payload_size)); |                 payload_res = handle_certificate(buffer.slice(1, payload_size)); | ||||||
|  | @ -402,7 +402,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) | ||||||
| 
 | 
 | ||||||
|                     if (it.is_end()) { |                     if (it.is_end()) { | ||||||
|                         // no valid certificates
 |                         // no valid certificates
 | ||||||
|                         dbg() << "No valid certificates found"; |                         dbgln("No valid certificates found"); | ||||||
|                         payload_res = (i8)Error::BadCertificate; |                         payload_res = (i8)Error::BadCertificate; | ||||||
|                         m_context.critical_error = payload_res; |                         m_context.critical_error = payload_res; | ||||||
|                         break; |                         break; | ||||||
|  | @ -418,16 +418,16 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) | ||||||
|             break; |             break; | ||||||
|         case ServerKeyExchange: |         case ServerKeyExchange: | ||||||
|             if (m_context.handshake_messages[5] >= 1) { |             if (m_context.handshake_messages[5] >= 1) { | ||||||
|                 dbg() << "unexpected server key exchange message"; |                 dbgln("unexpected server key exchange message"); | ||||||
|                 payload_res = (i8)Error::UnexpectedMessage; |                 payload_res = (i8)Error::UnexpectedMessage; | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|             ++m_context.handshake_messages[5]; |             ++m_context.handshake_messages[5]; | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|             dbg() << "server key exchange"; |             dbgln("server key exchange"); | ||||||
| #endif | #endif | ||||||
|             if (m_context.is_server) { |             if (m_context.is_server) { | ||||||
|                 dbg() << "unsupported: server mode"; |                 dbgln("unsupported: server mode"); | ||||||
|                 ASSERT_NOT_REACHED(); |                 ASSERT_NOT_REACHED(); | ||||||
|             } else { |             } else { | ||||||
|                 payload_res = handle_server_key_exchange(buffer.slice(1, payload_size)); |                 payload_res = handle_server_key_exchange(buffer.slice(1, payload_size)); | ||||||
|  | @ -435,18 +435,18 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) | ||||||
|             break; |             break; | ||||||
|         case CertificateRequest: |         case CertificateRequest: | ||||||
|             if (m_context.handshake_messages[6] >= 1) { |             if (m_context.handshake_messages[6] >= 1) { | ||||||
|                 dbg() << "unexpected certificate request message"; |                 dbgln("unexpected certificate request message"); | ||||||
|                 payload_res = (i8)Error::UnexpectedMessage; |                 payload_res = (i8)Error::UnexpectedMessage; | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|             ++m_context.handshake_messages[6]; |             ++m_context.handshake_messages[6]; | ||||||
|             if (m_context.is_server) { |             if (m_context.is_server) { | ||||||
|                 dbg() << "invalid request"; |                 dbgln("invalid request"); | ||||||
|                 dbg() << "unsupported: server mode"; |                 dbgln("unsupported: server mode"); | ||||||
|                 ASSERT_NOT_REACHED(); |                 ASSERT_NOT_REACHED(); | ||||||
|             } else { |             } else { | ||||||
|                 // we do not support "certificate request"
 |                 // we do not support "certificate request"
 | ||||||
|                 dbg() << "certificate request"; |                 dbgln("certificate request"); | ||||||
|                 if (on_tls_certificate_request) |                 if (on_tls_certificate_request) | ||||||
|                     on_tls_certificate_request(*this); |                     on_tls_certificate_request(*this); | ||||||
|                 m_context.client_verified = VerificationNeeded; |                 m_context.client_verified = VerificationNeeded; | ||||||
|  | @ -454,16 +454,16 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) | ||||||
|             break; |             break; | ||||||
|         case ServerHelloDone: |         case ServerHelloDone: | ||||||
|             if (m_context.handshake_messages[7] >= 1) { |             if (m_context.handshake_messages[7] >= 1) { | ||||||
|                 dbg() << "unexpected server hello done message"; |                 dbgln("unexpected server hello done message"); | ||||||
|                 payload_res = (i8)Error::UnexpectedMessage; |                 payload_res = (i8)Error::UnexpectedMessage; | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|             ++m_context.handshake_messages[7]; |             ++m_context.handshake_messages[7]; | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|             dbg() << "server hello done"; |             dbgln("server hello done"); | ||||||
| #endif | #endif | ||||||
|             if (m_context.is_server) { |             if (m_context.is_server) { | ||||||
|                 dbg() << "unsupported: server mode"; |                 dbgln("unsupported: server mode"); | ||||||
|                 ASSERT_NOT_REACHED(); |                 ASSERT_NOT_REACHED(); | ||||||
|             } else { |             } else { | ||||||
|                 payload_res = handle_server_hello_done(buffer.slice(1, payload_size)); |                 payload_res = handle_server_hello_done(buffer.slice(1, payload_size)); | ||||||
|  | @ -473,13 +473,13 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) | ||||||
|             break; |             break; | ||||||
|         case CertificateVerify: |         case CertificateVerify: | ||||||
|             if (m_context.handshake_messages[8] >= 1) { |             if (m_context.handshake_messages[8] >= 1) { | ||||||
|                 dbg() << "unexpected certificate verify message"; |                 dbgln("unexpected certificate verify message"); | ||||||
|                 payload_res = (i8)Error::UnexpectedMessage; |                 payload_res = (i8)Error::UnexpectedMessage; | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|             ++m_context.handshake_messages[8]; |             ++m_context.handshake_messages[8]; | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|             dbg() << "certificate verify"; |             dbgln("certificate verify"); | ||||||
| #endif | #endif | ||||||
|             if (m_context.connection_status == ConnectionStatus::KeyExchange) { |             if (m_context.connection_status == ConnectionStatus::KeyExchange) { | ||||||
|                 payload_res = handle_verify(buffer.slice(1, payload_size)); |                 payload_res = handle_verify(buffer.slice(1, payload_size)); | ||||||
|  | @ -489,16 +489,16 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) | ||||||
|             break; |             break; | ||||||
|         case ClientKeyExchange: |         case ClientKeyExchange: | ||||||
|             if (m_context.handshake_messages[9] >= 1) { |             if (m_context.handshake_messages[9] >= 1) { | ||||||
|                 dbg() << "unexpected client key exchange message"; |                 dbgln("unexpected client key exchange message"); | ||||||
|                 payload_res = (i8)Error::UnexpectedMessage; |                 payload_res = (i8)Error::UnexpectedMessage; | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|             ++m_context.handshake_messages[9]; |             ++m_context.handshake_messages[9]; | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|             dbg() << "client key exchange"; |             dbgln("client key exchange"); | ||||||
| #endif | #endif | ||||||
|             if (m_context.is_server) { |             if (m_context.is_server) { | ||||||
|                 dbg() << "unsupported: server mode"; |                 dbgln("unsupported: server mode"); | ||||||
|                 ASSERT_NOT_REACHED(); |                 ASSERT_NOT_REACHED(); | ||||||
|             } else { |             } else { | ||||||
|                 payload_res = (i8)Error::UnexpectedMessage; |                 payload_res = (i8)Error::UnexpectedMessage; | ||||||
|  | @ -509,13 +509,13 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) | ||||||
|                 m_context.cached_handshake.clear(); |                 m_context.cached_handshake.clear(); | ||||||
|             } |             } | ||||||
|             if (m_context.handshake_messages[10] >= 1) { |             if (m_context.handshake_messages[10] >= 1) { | ||||||
|                 dbg() << "unexpected finished message"; |                 dbgln("unexpected finished message"); | ||||||
|                 payload_res = (i8)Error::UnexpectedMessage; |                 payload_res = (i8)Error::UnexpectedMessage; | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|             ++m_context.handshake_messages[10]; |             ++m_context.handshake_messages[10]; | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|             dbg() << "finished"; |             dbgln("finished"); | ||||||
| #endif | #endif | ||||||
|             payload_res = handle_finished(buffer.slice(1, payload_size), write_packets); |             payload_res = handle_finished(buffer.slice(1, payload_size), write_packets); | ||||||
|             if (payload_res > 0) { |             if (payload_res > 0) { | ||||||
|  | @ -602,7 +602,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) | ||||||
|         case WritePacketStage::ClientHandshake: |         case WritePacketStage::ClientHandshake: | ||||||
|             if (m_context.client_verified == VerificationNeeded) { |             if (m_context.client_verified == VerificationNeeded) { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|                 dbg() << "> Client Certificate"; |                 dbgln("> Client Certificate"); | ||||||
| #endif | #endif | ||||||
|                 auto packet = build_certificate(); |                 auto packet = build_certificate(); | ||||||
|                 write_packet(packet); |                 write_packet(packet); | ||||||
|  | @ -610,14 +610,14 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) | ||||||
|             } |             } | ||||||
|             { |             { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|                 dbg() << "> Key exchange"; |                 dbgln("> Key exchange"); | ||||||
| #endif | #endif | ||||||
|                 auto packet = build_client_key_exchange(); |                 auto packet = build_client_key_exchange(); | ||||||
|                 write_packet(packet); |                 write_packet(packet); | ||||||
|             } |             } | ||||||
|             { |             { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|                 dbg() << "> change cipher spec"; |                 dbgln("> change cipher spec"); | ||||||
| #endif | #endif | ||||||
|                 auto packet = build_change_cipher_spec(); |                 auto packet = build_change_cipher_spec(); | ||||||
|                 write_packet(packet); |                 write_packet(packet); | ||||||
|  | @ -626,7 +626,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) | ||||||
|             m_context.local_sequence_number = 0; |             m_context.local_sequence_number = 0; | ||||||
|             { |             { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|                 dbg() << "> client finished"; |                 dbgln("> client finished"); | ||||||
| #endif | #endif | ||||||
|                 auto packet = build_finished(); |                 auto packet = build_finished(); | ||||||
|                 write_packet(packet); |                 write_packet(packet); | ||||||
|  | @ -635,21 +635,21 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) | ||||||
|             break; |             break; | ||||||
|         case WritePacketStage::ServerHandshake: |         case WritePacketStage::ServerHandshake: | ||||||
|             // server handshake
 |             // server handshake
 | ||||||
|             dbg() << "UNSUPPORTED: Server mode"; |             dbgln("UNSUPPORTED: Server mode"); | ||||||
|             ASSERT_NOT_REACHED(); |             ASSERT_NOT_REACHED(); | ||||||
|             break; |             break; | ||||||
|         case WritePacketStage::Finished: |         case WritePacketStage::Finished: | ||||||
|             // finished
 |             // finished
 | ||||||
|             { |             { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|                 dbg() << "> change cipher spec"; |                 dbgln("> change cipher spec"); | ||||||
| #endif | #endif | ||||||
|                 auto packet = build_change_cipher_spec(); |                 auto packet = build_change_cipher_spec(); | ||||||
|                 write_packet(packet); |                 write_packet(packet); | ||||||
|             } |             } | ||||||
|             { |             { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|                 dbg() << "> client finished"; |                 dbgln("> client finished"); | ||||||
| #endif | #endif | ||||||
|                 auto packet = build_finished(); |                 auto packet = build_finished(); | ||||||
|                 write_packet(packet); |                 write_packet(packet); | ||||||
|  |  | ||||||
|  | @ -38,7 +38,7 @@ bool TLSv12::expand_key() | ||||||
|     auto is_aead = this->is_aead(); |     auto is_aead = this->is_aead(); | ||||||
| 
 | 
 | ||||||
|     if (m_context.master_key.size() == 0) { |     if (m_context.master_key.size() == 0) { | ||||||
|         dbg() << "expand_key() with empty master key"; |         dbgln("expand_key() with empty master key"); | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -73,18 +73,18 @@ bool TLSv12::expand_key() | ||||||
|     offset += iv_size; |     offset += iv_size; | ||||||
| 
 | 
 | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|     dbg() << "client key"; |     dbgln("client key"); | ||||||
|     print_buffer(client_key, key_size); |     print_buffer(client_key, key_size); | ||||||
|     dbg() << "server key"; |     dbgln("server key"); | ||||||
|     print_buffer(server_key, key_size); |     print_buffer(server_key, key_size); | ||||||
|     dbg() << "client iv"; |     dbgln("client iv"); | ||||||
|     print_buffer(client_iv, iv_size); |     print_buffer(client_iv, iv_size); | ||||||
|     dbg() << "server iv"; |     dbgln("server iv"); | ||||||
|     print_buffer(server_iv, iv_size); |     print_buffer(server_iv, iv_size); | ||||||
|     if (!is_aead) { |     if (!is_aead) { | ||||||
|         dbg() << "client mac key"; |         dbgln("client mac key"); | ||||||
|         print_buffer(m_context.crypto.local_mac, mac_size); |         print_buffer(m_context.crypto.local_mac, mac_size); | ||||||
|         dbg() << "server mac key"; |         dbgln("server mac key"); | ||||||
|         print_buffer(m_context.crypto.remote_mac, mac_size); |         print_buffer(m_context.crypto.remote_mac, mac_size); | ||||||
|     } |     } | ||||||
| #endif | #endif | ||||||
|  | @ -111,7 +111,7 @@ bool TLSv12::expand_key() | ||||||
| void TLSv12::pseudorandom_function(Bytes output, ReadonlyBytes secret, const u8* label, size_t label_length, ReadonlyBytes seed, ReadonlyBytes seed_b) | void TLSv12::pseudorandom_function(Bytes output, ReadonlyBytes secret, const u8* label, size_t label_length, ReadonlyBytes seed, ReadonlyBytes seed_b) | ||||||
| { | { | ||||||
|     if (!secret.size()) { |     if (!secret.size()) { | ||||||
|         dbg() << "null secret"; |         dbgln("null secret"); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -155,7 +155,7 @@ void TLSv12::pseudorandom_function(Bytes output, ReadonlyBytes secret, const u8* | ||||||
| bool TLSv12::compute_master_secret(size_t length) | bool TLSv12::compute_master_secret(size_t length) | ||||||
| { | { | ||||||
|     if (m_context.premaster_key.size() == 0 || length < 48) { |     if (m_context.premaster_key.size() == 0 || length < 48) { | ||||||
|         dbg() << "there's no way I can make a master secret like this"; |         dbgln("there's no way I can make a master secret like this"); | ||||||
|         dbg() << "I'd like to talk to your manager about this length of " << length; |         dbg() << "I'd like to talk to your manager about this length of " << length; | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
|  | @ -172,7 +172,7 @@ bool TLSv12::compute_master_secret(size_t length) | ||||||
| 
 | 
 | ||||||
|     m_context.premaster_key.clear(); |     m_context.premaster_key.clear(); | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|     dbg() << "master key:"; |     dbgln("master key:"); | ||||||
|     print_buffer(m_context.master_key); |     print_buffer(m_context.master_key); | ||||||
| #endif | #endif | ||||||
|     expand_key(); |     expand_key(); | ||||||
|  | @ -187,7 +187,7 @@ ByteBuffer TLSv12::build_certificate() | ||||||
|     Vector<Certificate>* local_certificates = nullptr; |     Vector<Certificate>* local_certificates = nullptr; | ||||||
| 
 | 
 | ||||||
|     if (m_context.is_server) { |     if (m_context.is_server) { | ||||||
|         dbg() << "Unsupported: Server mode"; |         dbgln("Unsupported: Server mode"); | ||||||
|         ASSERT_NOT_REACHED(); |         ASSERT_NOT_REACHED(); | ||||||
|     } else { |     } else { | ||||||
|         local_certificates = &m_context.client_certificates; |         local_certificates = &m_context.client_certificates; | ||||||
|  | @ -214,7 +214,7 @@ ByteBuffer TLSv12::build_certificate() | ||||||
| 
 | 
 | ||||||
|     if (!total_certificate_size) { |     if (!total_certificate_size) { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|         dbg() << "No certificates, sending empty certificate message"; |         dbgln("No certificates, sending empty certificate message"); | ||||||
| #endif | #endif | ||||||
|         builder.append_u24(certificate_vector_header_size); |         builder.append_u24(certificate_vector_header_size); | ||||||
|         builder.append_u24(total_certificate_size); |         builder.append_u24(total_certificate_size); | ||||||
|  | @ -246,7 +246,7 @@ ByteBuffer TLSv12::build_change_cipher_spec() | ||||||
| 
 | 
 | ||||||
| ByteBuffer TLSv12::build_server_key_exchange() | ByteBuffer TLSv12::build_server_key_exchange() | ||||||
| { | { | ||||||
|     dbg() << "FIXME: build_server_key_exchange"; |     dbgln("FIXME: build_server_key_exchange"); | ||||||
|     return {}; |     return {}; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -267,13 +267,13 @@ ByteBuffer TLSv12::build_client_key_exchange() | ||||||
| 
 | 
 | ||||||
| ssize_t TLSv12::handle_server_key_exchange(ReadonlyBytes) | ssize_t TLSv12::handle_server_key_exchange(ReadonlyBytes) | ||||||
| { | { | ||||||
|     dbg() << "FIXME: parse_server_key_exchange"; |     dbgln("FIXME: parse_server_key_exchange"); | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ssize_t TLSv12::handle_verify(ReadonlyBytes) | ssize_t TLSv12::handle_verify(ReadonlyBytes) | ||||||
| { | { | ||||||
|     dbg() << "FIXME: parse_verify"; |     dbgln("FIXME: parse_verify"); | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -205,12 +205,12 @@ ByteBuffer TLSv12::hmac_message(const ReadonlyBytes& buf, const Optional<Readonl | ||||||
|     ensure_hmac(mac_length, local); |     ensure_hmac(mac_length, local); | ||||||
|     auto& hmac = local ? *m_hmac_local : *m_hmac_remote; |     auto& hmac = local ? *m_hmac_local : *m_hmac_remote; | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|     dbg() << "========================= PACKET DATA =========================="; |     dbgln("========================= PACKET DATA =========================="); | ||||||
|     print_buffer((const u8*)&sequence_number, sizeof(u64)); |     print_buffer((const u8*)&sequence_number, sizeof(u64)); | ||||||
|     print_buffer(buf.data(), buf.size()); |     print_buffer(buf.data(), buf.size()); | ||||||
|     if (buf2.has_value()) |     if (buf2.has_value()) | ||||||
|         print_buffer(buf2.value().data(), buf2.value().size()); |         print_buffer(buf2.value().data(), buf2.value().size()); | ||||||
|     dbg() << "========================= PACKET DATA =========================="; |     dbgln("========================= PACKET DATA =========================="); | ||||||
| #endif | #endif | ||||||
|     hmac.update((const u8*)&sequence_number, sizeof(u64)); |     hmac.update((const u8*)&sequence_number, sizeof(u64)); | ||||||
|     hmac.update(buf); |     hmac.update(buf); | ||||||
|  | @ -271,7 +271,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) | ||||||
| 
 | 
 | ||||||
|     if (m_context.cipher_spec_set && type != MessageType::ChangeCipher) { |     if (m_context.cipher_spec_set && type != MessageType::ChangeCipher) { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|         dbg() << "Encrypted: "; |         dbgln("Encrypted: "); | ||||||
|         print_buffer(buffer.slice(header_size, length)); |         print_buffer(buffer.slice(header_size, length)); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | @ -279,7 +279,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) | ||||||
|             ASSERT(m_aes_remote.gcm); |             ASSERT(m_aes_remote.gcm); | ||||||
| 
 | 
 | ||||||
|             if (length < 24) { |             if (length < 24) { | ||||||
|                 dbg() << "Invalid packet length"; |                 dbgln("Invalid packet length"); | ||||||
|                 auto packet = build_alert(true, (u8)AlertDescription::DecryptError); |                 auto packet = build_alert(true, (u8)AlertDescription::DecryptError); | ||||||
|                 write_packet(packet); |                 write_packet(packet); | ||||||
|                 return (i8)Error::BrokenPacket; |                 return (i8)Error::BrokenPacket; | ||||||
|  | @ -352,13 +352,13 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) | ||||||
|             length = decrypted_span.size(); |             length = decrypted_span.size(); | ||||||
| 
 | 
 | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|             dbg() << "Decrypted: "; |             dbgln("Decrypted: "); | ||||||
|             print_buffer(decrypted); |             print_buffer(decrypted); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|             auto mac_size = mac_length(); |             auto mac_size = mac_length(); | ||||||
|             if (length < mac_size) { |             if (length < mac_size) { | ||||||
|                 dbg() << "broken packet"; |                 dbgln("broken packet"); | ||||||
|                 auto packet = build_alert(true, (u8)AlertDescription::DecryptError); |                 auto packet = build_alert(true, (u8)AlertDescription::DecryptError); | ||||||
|                 write_packet(packet); |                 write_packet(packet); | ||||||
|                 return (i8)Error::BrokenPacket; |                 return (i8)Error::BrokenPacket; | ||||||
|  | @ -374,9 +374,9 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) | ||||||
|             auto message_mac = ReadonlyBytes { message_hmac, mac_size }; |             auto message_mac = ReadonlyBytes { message_hmac, mac_size }; | ||||||
|             if (hmac != message_mac) { |             if (hmac != message_mac) { | ||||||
|                 dbg() << "integrity check failed (mac length " << mac_size << ")"; |                 dbg() << "integrity check failed (mac length " << mac_size << ")"; | ||||||
|                 dbg() << "mac received:"; |                 dbgln("mac received:"); | ||||||
|                 print_buffer(message_mac); |                 print_buffer(message_mac); | ||||||
|                 dbg() << "mac computed:"; |                 dbgln("mac computed:"); | ||||||
|                 print_buffer(hmac); |                 print_buffer(hmac); | ||||||
|                 auto packet = build_alert(true, (u8)AlertDescription::BadRecordMAC); |                 auto packet = build_alert(true, (u8)AlertDescription::BadRecordMAC); | ||||||
|                 write_packet(packet); |                 write_packet(packet); | ||||||
|  | @ -391,7 +391,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) | ||||||
|     switch (type) { |     switch (type) { | ||||||
|     case MessageType::ApplicationData: |     case MessageType::ApplicationData: | ||||||
|         if (m_context.connection_status != ConnectionStatus::Established) { |         if (m_context.connection_status != ConnectionStatus::Established) { | ||||||
|             dbg() << "unexpected application data"; |             dbgln("unexpected application data"); | ||||||
|             payload_res = (i8)Error::UnexpectedMessage; |             payload_res = (i8)Error::UnexpectedMessage; | ||||||
|             auto packet = build_alert(true, (u8)AlertDescription::UnexpectedMessage); |             auto packet = build_alert(true, (u8)AlertDescription::UnexpectedMessage); | ||||||
|             write_packet(packet); |             write_packet(packet); | ||||||
|  | @ -405,18 +405,18 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) | ||||||
|         break; |         break; | ||||||
|     case MessageType::Handshake: |     case MessageType::Handshake: | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|         dbg() << "tls handshake message"; |         dbgln("tls handshake message"); | ||||||
| #endif | #endif | ||||||
|         payload_res = handle_payload(plain); |         payload_res = handle_payload(plain); | ||||||
|         break; |         break; | ||||||
|     case MessageType::ChangeCipher: |     case MessageType::ChangeCipher: | ||||||
|         if (m_context.connection_status != ConnectionStatus::KeyExchange) { |         if (m_context.connection_status != ConnectionStatus::KeyExchange) { | ||||||
|             dbg() << "unexpected change cipher message"; |             dbgln("unexpected change cipher message"); | ||||||
|             auto packet = build_alert(true, (u8)AlertDescription::UnexpectedMessage); |             auto packet = build_alert(true, (u8)AlertDescription::UnexpectedMessage); | ||||||
|             payload_res = (i8)Error::UnexpectedMessage; |             payload_res = (i8)Error::UnexpectedMessage; | ||||||
|         } else { |         } else { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|             dbg() << "change cipher spec message"; |             dbgln("change cipher spec message"); | ||||||
| #endif | #endif | ||||||
|             m_context.cipher_spec_set = true; |             m_context.cipher_spec_set = true; | ||||||
|             m_context.remote_sequence_number = 0; |             m_context.remote_sequence_number = 0; | ||||||
|  | @ -447,7 +447,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) | ||||||
|                 m_context.connection_finished = true; |                 m_context.connection_finished = true; | ||||||
|                 if (!m_context.cipher_spec_set) { |                 if (!m_context.cipher_spec_set) { | ||||||
|                     // AWS CloudFront hits this.
 |                     // AWS CloudFront hits this.
 | ||||||
|                     dbg() << "Server sent a close notify and we haven't agreed on a cipher suite. Treating it as a handshake failure."; |                     dbgln("Server sent a close notify and we haven't agreed on a cipher suite. Treating it as a handshake failure."); | ||||||
|                     m_context.critical_error = (u8)AlertDescription::HandshakeFailure; |                     m_context.critical_error = (u8)AlertDescription::HandshakeFailure; | ||||||
|                     try_disambiguate_error(); |                     try_disambiguate_error(); | ||||||
|                 } |                 } | ||||||
|  | @ -456,7 +456,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) | ||||||
|         } |         } | ||||||
|         break; |         break; | ||||||
|     default: |     default: | ||||||
|         dbg() << "message not understood"; |         dbgln("message not understood"); | ||||||
|         return (i8)Error::NotUnderstood; |         return (i8)Error::NotUnderstood; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -77,7 +77,7 @@ bool TLSv12::write(ReadonlyBytes buffer) | ||||||
| { | { | ||||||
|     if (m_context.connection_status != ConnectionStatus::Established) { |     if (m_context.connection_status != ConnectionStatus::Established) { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|         dbg() << "write request while not connected"; |         dbgln("write request while not connected"); | ||||||
| #endif | #endif | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
|  | @ -194,7 +194,7 @@ bool TLSv12::check_connection_state(bool read) | ||||||
|     if (!Core::Socket::is_open() || !Core::Socket::is_connected() || Core::Socket::eof()) { |     if (!Core::Socket::is_open() || !Core::Socket::is_connected() || Core::Socket::eof()) { | ||||||
|         // an abrupt closure (the server is a jerk)
 |         // an abrupt closure (the server is a jerk)
 | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|         dbg() << "Socket not open, assuming abrupt closure"; |         dbgln("Socket not open, assuming abrupt closure"); | ||||||
| #endif | #endif | ||||||
|         m_context.connection_finished = true; |         m_context.connection_finished = true; | ||||||
|     } |     } | ||||||
|  | @ -218,7 +218,7 @@ bool TLSv12::check_connection_state(bool read) | ||||||
|         } else { |         } else { | ||||||
|             m_context.connection_finished = false; |             m_context.connection_finished = false; | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|             dbg() << "FINISHED"; |             dbgln("FINISHED"); | ||||||
| #endif | #endif | ||||||
|         } |         } | ||||||
|         if (!m_context.application_buffer.size()) { |         if (!m_context.application_buffer.size()) { | ||||||
|  | @ -239,7 +239,7 @@ bool TLSv12::flush() | ||||||
|         return true; |         return true; | ||||||
| 
 | 
 | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|     dbg() << "SENDING..."; |     dbgln("SENDING..."); | ||||||
|     print_buffer(out_buffer, out_buffer_length); |     print_buffer(out_buffer, out_buffer_length); | ||||||
| #endif | #endif | ||||||
|     if (Core::Socket::write(&out_buffer[out_buffer_index], out_buffer_length)) { |     if (Core::Socket::write(&out_buffer[out_buffer_index], out_buffer_length)) { | ||||||
|  |  | ||||||
|  | @ -96,7 +96,7 @@ static bool _set_algorithm(CertificateKeyAlgorithm& algorithm, const u8* value, | ||||||
| { | { | ||||||
|     if (length == 7) { |     if (length == 7) { | ||||||
|         // Elliptic Curve pubkey
 |         // Elliptic Curve pubkey
 | ||||||
|         dbg() << "Cert.algorithm: EC, unsupported"; |         dbgln("Cert.algorithm: EC, unsupported"); | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -113,7 +113,7 @@ static bool _set_algorithm(CertificateKeyAlgorithm& algorithm, const u8* value, | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (length != 9) { |     if (length != 9) { | ||||||
|         dbg() << "Invalid certificate algorithm"; |         dbgln("Invalid certificate algorithm"); | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -193,7 +193,7 @@ static ssize_t _parse_asn1(const Context& context, Certificate& cert, const u8* | ||||||
|     while (position < size) { |     while (position < size) { | ||||||
|         size_t start_position = position; |         size_t start_position = position; | ||||||
|         if (size - position < 2) { |         if (size - position < 2) { | ||||||
|             dbg() << "not enough data for certificate size"; |             dbgln("not enough data for certificate size"); | ||||||
|             return (i8)Error::NeedMoreData; |             return (i8)Error::NeedMoreData; | ||||||
|         } |         } | ||||||
|         u8 first = buffer[position++]; |         u8 first = buffer[position++]; | ||||||
|  | @ -210,7 +210,7 @@ static ssize_t _parse_asn1(const Context& context, Certificate& cert, const u8* | ||||||
| 
 | 
 | ||||||
|         if (octets > 4 || octets > size - position) { |         if (octets > 4 || octets > size - position) { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|             dbg() << "could not read the certificate"; |             dbgln("could not read the certificate"); | ||||||
| #endif | #endif | ||||||
|             return position; |             return position; | ||||||
|         } |         } | ||||||
|  | @ -218,7 +218,7 @@ static ssize_t _parse_asn1(const Context& context, Certificate& cert, const u8* | ||||||
|         position += octets; |         position += octets; | ||||||
|         if (size - position < length) { |         if (size - position < length) { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|             dbg() << "not enough data for sequence"; |             dbgln("not enough data for sequence"); | ||||||
| #endif | #endif | ||||||
|             return (i8)Error::NeedMoreData; |             return (i8)Error::NeedMoreData; | ||||||
|         } |         } | ||||||
|  | @ -420,7 +420,7 @@ static ssize_t _parse_asn1(const Context& context, Certificate& cert, const u8* | ||||||
|         cert.fingerprint.grow(fingerprint.data_length()); |         cert.fingerprint.grow(fingerprint.data_length()); | ||||||
|         cert.fingerprint.overwrite(0, fingerprint.immutable_data(), fingerprint.data_length()); |         cert.fingerprint.overwrite(0, fingerprint.immutable_data(), fingerprint.data_length()); | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|         dbg() << "Certificate fingerprint:"; |         dbgln("Certificate fingerprint:"); | ||||||
|         print_buffer(cert.fingerprint); |         print_buffer(cert.fingerprint); | ||||||
| #endif | #endif | ||||||
|     } |     } | ||||||
|  | @ -453,7 +453,7 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer) | ||||||
| 
 | 
 | ||||||
|     if (buffer.size() < 3) { |     if (buffer.size() < 3) { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|         dbg() << "not enough certificate header data"; |         dbgln("not enough certificate header data"); | ||||||
| #endif | #endif | ||||||
|         return (i8)Error::NeedMoreData; |         return (i8)Error::NeedMoreData; | ||||||
|     } |     } | ||||||
|  | @ -471,7 +471,7 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer) | ||||||
| 
 | 
 | ||||||
|     if (certificate_total_length > buffer.size() - res) { |     if (certificate_total_length > buffer.size() - res) { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|         dbg() << "not enough data for claimed total cert length"; |         dbgln("not enough data for claimed total cert length"); | ||||||
| #endif | #endif | ||||||
|         return (i8)Error::NeedMoreData; |         return (i8)Error::NeedMoreData; | ||||||
|     } |     } | ||||||
|  | @ -484,7 +484,7 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer) | ||||||
|         ++index; |         ++index; | ||||||
|         if (buffer.size() - res < 3) { |         if (buffer.size() - res < 3) { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|             dbg() << "not enough data for certificate length"; |             dbgln("not enough data for certificate length"); | ||||||
| #endif | #endif | ||||||
|             return (i8)Error::NeedMoreData; |             return (i8)Error::NeedMoreData; | ||||||
|         } |         } | ||||||
|  | @ -493,7 +493,7 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer) | ||||||
| 
 | 
 | ||||||
|         if (buffer.size() - res < certificate_size) { |         if (buffer.size() - res < certificate_size) { | ||||||
| #ifdef TLS_DEBUG | #ifdef TLS_DEBUG | ||||||
|             dbg() << "not enough data for certificate body"; |             dbgln("not enough data for certificate body"); | ||||||
| #endif | #endif | ||||||
|             return (i8)Error::NeedMoreData; |             return (i8)Error::NeedMoreData; | ||||||
|         } |         } | ||||||
|  | @ -504,7 +504,7 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer) | ||||||
| 
 | 
 | ||||||
|         do { |         do { | ||||||
|             if (remaining <= 3) { |             if (remaining <= 3) { | ||||||
|                 dbg() << "Ran out of data"; |                 dbgln("Ran out of data"); | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|             ++certificates_in_chain; |             ++certificates_in_chain; | ||||||
|  | @ -603,7 +603,7 @@ void TLSv12::consume(ReadonlyBytes record) | ||||||
|         index += length; |         index += length; | ||||||
|         buffer_length -= length; |         buffer_length -= length; | ||||||
|         if (m_context.critical_error) { |         if (m_context.critical_error) { | ||||||
|             dbg() << "Broken connection"; |             dbgln("Broken connection"); | ||||||
|             m_context.error_code = Error::BrokenConnection; |             m_context.error_code = Error::BrokenConnection; | ||||||
|             break; |             break; | ||||||
|         } |         } | ||||||
|  | @ -674,61 +674,61 @@ bool Certificate::is_valid() const | ||||||
| 
 | 
 | ||||||
| void TLSv12::try_disambiguate_error() const | void TLSv12::try_disambiguate_error() const | ||||||
| { | { | ||||||
|     dbg() << "Possible failure cause(s): "; |     dbgln("Possible failure cause(s): "); | ||||||
|     switch ((AlertDescription)m_context.critical_error) { |     switch ((AlertDescription)m_context.critical_error) { | ||||||
|     case AlertDescription::HandshakeFailure: |     case AlertDescription::HandshakeFailure: | ||||||
|         if (!m_context.cipher_spec_set) { |         if (!m_context.cipher_spec_set) { | ||||||
|             dbg() << "- No cipher suite in common with " << m_context.SNI; |             dbg() << "- No cipher suite in common with " << m_context.SNI; | ||||||
|         } else { |         } else { | ||||||
|             dbg() << "- Unknown internal issue"; |             dbgln("- Unknown internal issue"); | ||||||
|         } |         } | ||||||
|         break; |         break; | ||||||
|     case AlertDescription::InsufficientSecurity: |     case AlertDescription::InsufficientSecurity: | ||||||
|         dbg() << "- No cipher suite in common with " << m_context.SNI << " (the server is oh so secure)"; |         dbg() << "- No cipher suite in common with " << m_context.SNI << " (the server is oh so secure)"; | ||||||
|         break; |         break; | ||||||
|     case AlertDescription::ProtocolVersion: |     case AlertDescription::ProtocolVersion: | ||||||
|         dbg() << "- The server refused to negotiate with TLS 1.2 :("; |         dbgln("- The server refused to negotiate with TLS 1.2 :("); | ||||||
|         break; |         break; | ||||||
|     case AlertDescription::UnexpectedMessage: |     case AlertDescription::UnexpectedMessage: | ||||||
|         dbg() << "- We sent an invalid message for the state we're in."; |         dbgln("- We sent an invalid message for the state we're in."); | ||||||
|         break; |         break; | ||||||
|     case AlertDescription::BadRecordMAC: |     case AlertDescription::BadRecordMAC: | ||||||
|         dbg() << "- Bad MAC record from our side."; |         dbgln("- Bad MAC record from our side."); | ||||||
|         dbg() << "- Ciphertext wasn't an even multiple of the block length."; |         dbgln("- Ciphertext wasn't an even multiple of the block length."); | ||||||
|         dbg() << "- Bad block cipher padding."; |         dbgln("- Bad block cipher padding."); | ||||||
|         dbg() << "- If both sides are compliant, the only cause is messages being corrupted in the network."; |         dbgln("- If both sides are compliant, the only cause is messages being corrupted in the network."); | ||||||
|         break; |         break; | ||||||
|     case AlertDescription::RecordOverflow: |     case AlertDescription::RecordOverflow: | ||||||
|         dbg() << "- Sent a ciphertext record which has a length bigger than 18432 bytes."; |         dbgln("- Sent a ciphertext record which has a length bigger than 18432 bytes."); | ||||||
|         dbg() << "- Sent record decrypted to a compressed record that has a length bigger than 18432 bytes."; |         dbgln("- Sent record decrypted to a compressed record that has a length bigger than 18432 bytes."); | ||||||
|         dbg() << "- If both sides are compliant, the only cause is messages being corrupted in the network."; |         dbgln("- If both sides are compliant, the only cause is messages being corrupted in the network."); | ||||||
|         break; |         break; | ||||||
|     case AlertDescription::DecompressionFailure: |     case AlertDescription::DecompressionFailure: | ||||||
|         dbg() << "- We sent invalid input for decompression (e.g. data that would expand to excessive length)"; |         dbgln("- We sent invalid input for decompression (e.g. data that would expand to excessive length)"); | ||||||
|         break; |         break; | ||||||
|     case AlertDescription::IllegalParameter: |     case AlertDescription::IllegalParameter: | ||||||
|         dbg() << "- We sent a parameter in the handshake that is out of range or inconsistent with the other parameters."; |         dbgln("- We sent a parameter in the handshake that is out of range or inconsistent with the other parameters."); | ||||||
|         break; |         break; | ||||||
|     case AlertDescription::DecodeError: |     case AlertDescription::DecodeError: | ||||||
|         dbg() << "- The message we sent cannot be decoded because a field was out of range or the length was incorrect."; |         dbgln("- The message we sent cannot be decoded because a field was out of range or the length was incorrect."); | ||||||
|         dbg() << "- If both sides are compliant, the only cause is messages being corrupted in the network."; |         dbgln("- If both sides are compliant, the only cause is messages being corrupted in the network."); | ||||||
|         break; |         break; | ||||||
|     case AlertDescription::DecryptError: |     case AlertDescription::DecryptError: | ||||||
|         dbg() << "- A handshake crypto operation failed. This includes signature verification and validating Finished."; |         dbgln("- A handshake crypto operation failed. This includes signature verification and validating Finished."); | ||||||
|         break; |         break; | ||||||
|     case AlertDescription::AccessDenied: |     case AlertDescription::AccessDenied: | ||||||
|         dbg() << "- The certificate is valid, but once access control was applied, the sender decided to stop negotiation."; |         dbgln("- The certificate is valid, but once access control was applied, the sender decided to stop negotiation."); | ||||||
|         break; |         break; | ||||||
|     case AlertDescription::InternalError: |     case AlertDescription::InternalError: | ||||||
|         dbg() << "- No one knows, but it isn't a protocol failure."; |         dbgln("- No one knows, but it isn't a protocol failure."); | ||||||
|         break; |         break; | ||||||
|     case AlertDescription::DecryptionFailed: |     case AlertDescription::DecryptionFailed: | ||||||
|     case AlertDescription::NoCertificate: |     case AlertDescription::NoCertificate: | ||||||
|     case AlertDescription::ExportRestriction: |     case AlertDescription::ExportRestriction: | ||||||
|         dbg() << "- No one knows, the server sent a non-compliant alert."; |         dbgln("- No one knows, the server sent a non-compliant alert."); | ||||||
|         break; |         break; | ||||||
|     default: |     default: | ||||||
|         dbg() << "- No one knows."; |         dbgln("- No one knows."); | ||||||
|         break; |         break; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -736,7 +736,7 @@ void TLSv12::try_disambiguate_error() const | ||||||
| void TLSv12::set_root_certificates(Vector<Certificate> certificates) | void TLSv12::set_root_certificates(Vector<Certificate> certificates) | ||||||
| { | { | ||||||
|     if (!m_context.root_ceritificates.is_empty()) |     if (!m_context.root_ceritificates.is_empty()) | ||||||
|         dbg() << "TLS warn: resetting root certificates!"; |         dbgln("TLS warn: resetting root certificates!"); | ||||||
| 
 | 
 | ||||||
|     for (auto& cert : certificates) { |     for (auto& cert : certificates) { | ||||||
|         if (!cert.is_valid()) |         if (!cert.is_valid()) | ||||||
|  | @ -750,7 +750,7 @@ bool Context::verify_chain() const | ||||||
| { | { | ||||||
|     const Vector<Certificate>* local_chain = nullptr; |     const Vector<Certificate>* local_chain = nullptr; | ||||||
|     if (is_server) { |     if (is_server) { | ||||||
|         dbg() << "Unsupported: Server mode"; |         dbgln("Unsupported: Server mode"); | ||||||
|         TODO(); |         TODO(); | ||||||
|     } else { |     } else { | ||||||
|         local_chain = &certificates; |         local_chain = &certificates; | ||||||
|  | @ -853,13 +853,13 @@ bool TLSv12::add_client_key(ReadonlyBytes certificate_pem_buffer, ReadonlyBytes | ||||||
|     } |     } | ||||||
|     auto decoded_certificate = Crypto::decode_pem(certificate_pem_buffer, 0); |     auto decoded_certificate = Crypto::decode_pem(certificate_pem_buffer, 0); | ||||||
|     if (decoded_certificate.is_empty()) { |     if (decoded_certificate.is_empty()) { | ||||||
|         dbg() << "Certificate not PEM"; |         dbgln("Certificate not PEM"); | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     auto maybe_certificate = parse_asn1(decoded_certificate); |     auto maybe_certificate = parse_asn1(decoded_certificate); | ||||||
|     if (!maybe_certificate.has_value()) { |     if (!maybe_certificate.has_value()) { | ||||||
|         dbg() << "Invalid certificate"; |         dbgln("Invalid certificate"); | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -204,7 +204,7 @@ RefPtr<Font> Font::load_from_file(const StringView& path, unsigned index) | ||||||
|     } |     } | ||||||
|     auto file = file_or_error.value(); |     auto file = file_or_error.value(); | ||||||
|     if (!file->open(Core::IODevice::ReadOnly)) { |     if (!file->open(Core::IODevice::ReadOnly)) { | ||||||
|         dbg() << "Could not open file"; |         dbgln("Could not open file"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     auto buffer = file->read_all(); |     auto buffer = file->read_all(); | ||||||
|  | @ -214,25 +214,25 @@ RefPtr<Font> Font::load_from_file(const StringView& path, unsigned index) | ||||||
| RefPtr<Font> Font::load_from_memory(ByteBuffer& buffer, unsigned index) | RefPtr<Font> Font::load_from_memory(ByteBuffer& buffer, unsigned index) | ||||||
| { | { | ||||||
|     if (buffer.size() < 4) { |     if (buffer.size() < 4) { | ||||||
|         dbg() << "Font file too small"; |         dbgln("Font file too small"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     u32 tag = be_u32(buffer.data()); |     u32 tag = be_u32(buffer.data()); | ||||||
|     if (tag == tag_from_str("ttcf")) { |     if (tag == tag_from_str("ttcf")) { | ||||||
|         // It's a font collection
 |         // It's a font collection
 | ||||||
|         if (buffer.size() < (u32)Sizes::TTCHeaderV1 + sizeof(u32) * (index + 1)) { |         if (buffer.size() < (u32)Sizes::TTCHeaderV1 + sizeof(u32) * (index + 1)) { | ||||||
|             dbg() << "Font file too small"; |             dbgln("Font file too small"); | ||||||
|             return nullptr; |             return nullptr; | ||||||
|         } |         } | ||||||
|         u32 offset = be_u32(buffer.offset_pointer((u32)Sizes::TTCHeaderV1 + sizeof(u32) * index)); |         u32 offset = be_u32(buffer.offset_pointer((u32)Sizes::TTCHeaderV1 + sizeof(u32) * index)); | ||||||
|         return load_from_offset(move(buffer), offset); |         return load_from_offset(move(buffer), offset); | ||||||
|     } |     } | ||||||
|     if (tag == tag_from_str("OTTO")) { |     if (tag == tag_from_str("OTTO")) { | ||||||
|         dbg() << "CFF fonts not supported yet"; |         dbgln("CFF fonts not supported yet"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     if (tag != 0x00010000) { |     if (tag != 0x00010000) { | ||||||
|         dbg() << "Not a valid font"; |         dbgln("Not a valid font"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     return load_from_offset(move(buffer), 0); |     return load_from_offset(move(buffer), 0); | ||||||
|  | @ -242,7 +242,7 @@ RefPtr<Font> Font::load_from_memory(ByteBuffer& buffer, unsigned index) | ||||||
| RefPtr<Font> Font::load_from_offset(ByteBuffer&& buffer, u32 offset) | RefPtr<Font> Font::load_from_offset(ByteBuffer&& buffer, u32 offset) | ||||||
| { | { | ||||||
|     if (buffer.size() < offset + (u32)Sizes::OffsetTable) { |     if (buffer.size() < offset + (u32)Sizes::OffsetTable) { | ||||||
|         dbg() << "Font file too small"; |         dbgln("Font file too small"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -263,7 +263,7 @@ RefPtr<Font> Font::load_from_offset(ByteBuffer&& buffer, u32 offset) | ||||||
| 
 | 
 | ||||||
|     auto num_tables = be_u16(buffer.offset_pointer(offset + (u32)Offsets::NumTables)); |     auto num_tables = be_u16(buffer.offset_pointer(offset + (u32)Offsets::NumTables)); | ||||||
|     if (buffer.size() < offset + (u32)Sizes::OffsetTable + num_tables * (u32)Sizes::TableRecord) { |     if (buffer.size() < offset + (u32)Sizes::OffsetTable + num_tables * (u32)Sizes::TableRecord) { | ||||||
|         dbg() << "Font file too small"; |         dbgln("Font file too small"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -279,7 +279,7 @@ RefPtr<Font> Font::load_from_offset(ByteBuffer&& buffer, u32 offset) | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (buffer.size() < table_offset + table_length) { |         if (buffer.size() < table_offset + table_length) { | ||||||
|             dbg() << "Font file too small"; |             dbgln("Font file too small"); | ||||||
|             return nullptr; |             return nullptr; | ||||||
|         } |         } | ||||||
|         auto buffer_here = ReadonlyBytes(buffer.offset_pointer(table_offset), table_length); |         auto buffer_here = ReadonlyBytes(buffer.offset_pointer(table_offset), table_length); | ||||||
|  | @ -303,43 +303,43 @@ RefPtr<Font> Font::load_from_offset(ByteBuffer&& buffer, u32 offset) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (!opt_head_slice.has_value() || !(opt_head = Head::from_slice(opt_head_slice.value())).has_value()) { |     if (!opt_head_slice.has_value() || !(opt_head = Head::from_slice(opt_head_slice.value())).has_value()) { | ||||||
|         dbg() << "Could not load Head"; |         dbgln("Could not load Head"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     auto head = opt_head.value(); |     auto head = opt_head.value(); | ||||||
| 
 | 
 | ||||||
|     if (!opt_hhea_slice.has_value() || !(opt_hhea = Hhea::from_slice(opt_hhea_slice.value())).has_value()) { |     if (!opt_hhea_slice.has_value() || !(opt_hhea = Hhea::from_slice(opt_hhea_slice.value())).has_value()) { | ||||||
|         dbg() << "Could not load Hhea"; |         dbgln("Could not load Hhea"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     auto hhea = opt_hhea.value(); |     auto hhea = opt_hhea.value(); | ||||||
| 
 | 
 | ||||||
|     if (!opt_maxp_slice.has_value() || !(opt_maxp = Maxp::from_slice(opt_maxp_slice.value())).has_value()) { |     if (!opt_maxp_slice.has_value() || !(opt_maxp = Maxp::from_slice(opt_maxp_slice.value())).has_value()) { | ||||||
|         dbg() << "Could not load Maxp"; |         dbgln("Could not load Maxp"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     auto maxp = opt_maxp.value(); |     auto maxp = opt_maxp.value(); | ||||||
| 
 | 
 | ||||||
|     if (!opt_hmtx_slice.has_value() || !(opt_hmtx = Hmtx::from_slice(opt_hmtx_slice.value(), maxp.num_glyphs(), hhea.number_of_h_metrics())).has_value()) { |     if (!opt_hmtx_slice.has_value() || !(opt_hmtx = Hmtx::from_slice(opt_hmtx_slice.value(), maxp.num_glyphs(), hhea.number_of_h_metrics())).has_value()) { | ||||||
|         dbg() << "Could not load Hmtx"; |         dbgln("Could not load Hmtx"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     auto hmtx = opt_hmtx.value(); |     auto hmtx = opt_hmtx.value(); | ||||||
| 
 | 
 | ||||||
|     if (!opt_cmap_slice.has_value() || !(opt_cmap = Cmap::from_slice(opt_cmap_slice.value())).has_value()) { |     if (!opt_cmap_slice.has_value() || !(opt_cmap = Cmap::from_slice(opt_cmap_slice.value())).has_value()) { | ||||||
|         dbg() << "Could not load Cmap"; |         dbgln("Could not load Cmap"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     auto cmap = opt_cmap.value(); |     auto cmap = opt_cmap.value(); | ||||||
| 
 | 
 | ||||||
|     if (!opt_loca_slice.has_value() || !(opt_loca = Loca::from_slice(opt_loca_slice.value(), maxp.num_glyphs(), head.index_to_loc_format())).has_value()) { |     if (!opt_loca_slice.has_value() || !(opt_loca = Loca::from_slice(opt_loca_slice.value(), maxp.num_glyphs(), head.index_to_loc_format())).has_value()) { | ||||||
|         dbg() << "Could not load Loca"; |         dbgln("Could not load Loca"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     auto loca = opt_loca.value(); |     auto loca = opt_loca.value(); | ||||||
| 
 | 
 | ||||||
|     if (!opt_glyf_slice.has_value()) { |     if (!opt_glyf_slice.has_value()) { | ||||||
|         dbg() << "Could not load Glyf"; |         dbgln("Could not load Glyf"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     auto glyf = Glyf(opt_glyf_slice.value()); |     auto glyf = Glyf(opt_glyf_slice.value()); | ||||||
|  |  | ||||||
|  | @ -565,7 +565,7 @@ void Terminal::execute_xterm_command() | ||||||
|     m_final = '@'; |     m_final = '@'; | ||||||
| 
 | 
 | ||||||
|     if (numeric_params.is_empty()) { |     if (numeric_params.is_empty()) { | ||||||
|         dbg() << "Empty Xterm params?"; |         dbgln("Empty Xterm params?"); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -820,7 +820,7 @@ void Terminal::DSR(const ParamVector& params) | ||||||
|         // Cursor position query
 |         // Cursor position query
 | ||||||
|         emit_string(String::format("\033[%d;%dR", m_cursor_row + 1, m_cursor_column + 1)); |         emit_string(String::format("\033[%d;%dR", m_cursor_row + 1, m_cursor_column + 1)); | ||||||
|     } else { |     } else { | ||||||
|         dbg() << "Unknown DSR"; |         dbgln("Unknown DSR"); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -41,9 +41,9 @@ | ||||||
|         ASSERT_NOT_REACHED();                                             \ |         ASSERT_NOT_REACHED();                                             \ | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| #define PARSE_ERROR()               \ | #define PARSE_ERROR()             \ | ||||||
|     do {                            \ |     do {                          \ | ||||||
|         dbg() << "CSS parse error"; \ |         dbgln("CSS parse error"); \ | ||||||
|     } while (0) |     } while (0) | ||||||
| 
 | 
 | ||||||
| namespace Web { | namespace Web { | ||||||
|  |  | ||||||
|  | @ -356,14 +356,14 @@ int main(int argc, char** argv) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| #if 0 | #if 0 | ||||||
|     dbg() << "Attributes:"; |     dbgln("Attributes:"); | ||||||
|     for (auto& attribute : interface->attributes) { |     for (auto& attribute : interface->attributes) { | ||||||
|         dbg() << "  " << (attribute.readonly ? "Readonly " : "") |         dbg() << "  " << (attribute.readonly ? "Readonly " : "") | ||||||
|               << attribute.type.name << (attribute.type.nullable ? "?" : "") |               << attribute.type.name << (attribute.type.nullable ? "?" : "") | ||||||
|               << " " << attribute.name; |               << " " << attribute.name; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     dbg() << "Functions:"; |     dbgln("Functions:"); | ||||||
|     for (auto& function : interface->functions) { |     for (auto& function : interface->functions) { | ||||||
|         dbg() << "  " << function.return_type.name << (function.return_type.nullable ? "?" : "") |         dbg() << "  " << function.return_type.name << (function.return_type.nullable ? "?" : "") | ||||||
|               << " " << function.name; |               << " " << function.name; | ||||||
|  |  | ||||||
|  | @ -190,7 +190,7 @@ RefPtr<Node> Node::insert_before(NonnullRefPtr<Node> node, RefPtr<Node> child, b | ||||||
|     if (!child) |     if (!child) | ||||||
|         return append_child(move(node), notify); |         return append_child(move(node), notify); | ||||||
|     if (child->parent_node() != this) { |     if (child->parent_node() != this) { | ||||||
|         dbg() << "FIXME: Trying to insert_before() a bogus child"; |         dbgln("FIXME: Trying to insert_before() a bogus child"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     if (&node->document() != &document()) |     if (&node->document() != &document()) | ||||||
|  |  | ||||||
|  | @ -207,7 +207,7 @@ void CanvasRenderingContext2D::fill(const String& fill_rule) | ||||||
| RefPtr<ImageData> CanvasRenderingContext2D::create_image_data(int width, int height) const | RefPtr<ImageData> CanvasRenderingContext2D::create_image_data(int width, int height) const | ||||||
| { | { | ||||||
|     if (!wrapper()) { |     if (!wrapper()) { | ||||||
|         dbg() << "Hmm! Attempted to create ImageData for wrapper-less CRC2D."; |         dbgln("Hmm! Attempted to create ImageData for wrapper-less CRC2D."); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     return ImageData::create_with_size(wrapper()->global_object(), width, height); |     return ImageData::create_with_size(wrapper()->global_object(), width, height); | ||||||
|  |  | ||||||
|  | @ -106,7 +106,7 @@ void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, const HashMap | ||||||
|         m_mime_type = url().data_mime_type(); |         m_mime_type = url().data_mime_type(); | ||||||
|     } else { |     } else { | ||||||
| #ifdef RESOURCE_DEBUG | #ifdef RESOURCE_DEBUG | ||||||
|         dbg() << "No Content-Type header to go on! Guessing based on filename..."; |         dbgln("No Content-Type header to go on! Guessing based on filename..."); | ||||||
| #endif | #endif | ||||||
|         m_encoding = "utf-8"; // FIXME: This doesn't seem nice.
 |         m_encoding = "utf-8"; // FIXME: This doesn't seem nice.
 | ||||||
|         m_mime_type = Core::guess_mime_type_based_on_filename(url().path()); |         m_mime_type = Core::guess_mime_type_based_on_filename(url().path()); | ||||||
|  |  | ||||||
|  | @ -92,7 +92,7 @@ static void print_instruction(const PathInstruction& instruction) | ||||||
|             dbg() << "    (rx=" << data[i] << ", ry=" << data[i + 1] << ") x-axis-rotation=" << data[i + 2] << ", large-arc-flag=" << data[i + 3] << ", sweep-flag=" << data[i + 4] << ", (x=" << data[i + 5] << ", y=" << data[i + 6] << ")"; |             dbg() << "    (rx=" << data[i] << ", ry=" << data[i + 1] << ") x-axis-rotation=" << data[i + 2] << ", large-arc-flag=" << data[i + 3] << ", sweep-flag=" << data[i + 4] << ", (x=" << data[i + 5] << ", y=" << data[i + 6] << ")"; | ||||||
|         break; |         break; | ||||||
|     case PathInstructionType::Invalid: |     case PathInstructionType::Invalid: | ||||||
|         dbg() << "Invalid"; |         dbgln("Invalid"); | ||||||
|         break; |         break; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -70,7 +70,7 @@ void WebContentClient::handle(const Messages::WebContentClient::DidInvalidateCon | ||||||
| void WebContentClient::handle(const Messages::WebContentClient::DidChangeSelection&) | void WebContentClient::handle(const Messages::WebContentClient::DidChangeSelection&) | ||||||
| { | { | ||||||
| #ifdef DEBUG_SPAM | #ifdef DEBUG_SPAM | ||||||
|     dbg() << "handle: WebContentClient::DidChangeSelection!"; |     dbgln("handle: WebContentClient::DidChangeSelection!"); | ||||||
| #endif | #endif | ||||||
|     m_view.notify_server_did_change_selection({}); |     m_view.notify_server_did_change_selection({}); | ||||||
| } | } | ||||||
|  | @ -110,7 +110,7 @@ void WebContentClient::handle(const Messages::WebContentClient::DidHoverLink& me | ||||||
| void WebContentClient::handle(const Messages::WebContentClient::DidUnhoverLink&) | void WebContentClient::handle(const Messages::WebContentClient::DidUnhoverLink&) | ||||||
| { | { | ||||||
| #ifdef DEBUG_SPAM | #ifdef DEBUG_SPAM | ||||||
|     dbg() << "handle: WebContentClient::DidUnhoverLink!"; |     dbgln("handle: WebContentClient::DidUnhoverLink!"); | ||||||
| #endif | #endif | ||||||
|     m_view.notify_server_did_unhover_link({}); |     m_view.notify_server_did_unhover_link({}); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -178,7 +178,7 @@ JS_DEFINE_NATIVE_FUNCTION(TestRunnerGlobalObject::fuzzilli) | ||||||
|     } else if (operation == "FUZZILLI_PRINT") { |     } else if (operation == "FUZZILLI_PRINT") { | ||||||
|         static FILE* fzliout = fdopen(REPRL_DWFD, "w"); |         static FILE* fzliout = fdopen(REPRL_DWFD, "w"); | ||||||
|         if (!fzliout) { |         if (!fzliout) { | ||||||
|             dbg() << "Fuzzer output not available"; |             dbgln("Fuzzer output not available"); | ||||||
|             fzliout = stdout; |             fzliout = stdout; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -33,7 +33,7 @@ int main(int, char**) | ||||||
|     Core::EventLoop event_loop; |     Core::EventLoop event_loop; | ||||||
| 
 | 
 | ||||||
|     auto timer = Core::Timer::construct(100, [&] { |     auto timer = Core::Timer::construct(100, [&] { | ||||||
|         dbg() << "Timer fired, good-bye! :^)"; |         dbgln("Timer fired, good-bye! :^)"); | ||||||
|         event_loop.quit(0); |         event_loop.quit(0); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -44,7 +44,7 @@ int main(int, char**) | ||||||
|     server->on_ready_to_accept = [&] { |     server->on_ready_to_accept = [&] { | ||||||
|         auto client_socket = server->accept(); |         auto client_socket = server->accept(); | ||||||
|         if (!client_socket) { |         if (!client_socket) { | ||||||
|             dbg() << "AudioServer: accept failed."; |             dbgln("AudioServer: accept failed."); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         static int s_next_client_id = 0; |         static int s_next_client_id = 0; | ||||||
|  |  | ||||||
|  | @ -58,7 +58,7 @@ int main(int, char**) | ||||||
|     server->on_ready_to_accept = [&] { |     server->on_ready_to_accept = [&] { | ||||||
|         auto client_socket = server->accept(); |         auto client_socket = server->accept(); | ||||||
|         if (!client_socket) { |         if (!client_socket) { | ||||||
|             dbg() << "Clipboard: accept failed."; |             dbgln("Clipboard: accept failed."); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         static int s_next_client_id = 0; |         static int s_next_client_id = 0; | ||||||
|  |  | ||||||
|  | @ -74,7 +74,7 @@ static void set_params(const InterfaceDescriptor& iface, const IPv4Address& ipv4 | ||||||
| 
 | 
 | ||||||
|     bool fits = iface.m_ifname.copy_characters_to_buffer(ifr.ifr_name, IFNAMSIZ); |     bool fits = iface.m_ifname.copy_characters_to_buffer(ifr.ifr_name, IFNAMSIZ); | ||||||
|     if (!fits) { |     if (!fits) { | ||||||
|         dbg() << "Interface name doesn't fit into IFNAMSIZ!"; |         dbgln("Interface name doesn't fit into IFNAMSIZ!"); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -123,7 +123,7 @@ DHCPv4Client::DHCPv4Client(Vector<InterfaceDescriptor> ifnames) | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     if (!m_server->bind({}, 68)) { |     if (!m_server->bind({}, 68)) { | ||||||
|         dbg() << "The server we just created somehow came already bound, refusing to continue"; |         dbgln("The server we just created somehow came already bound, refusing to continue"); | ||||||
|         ASSERT_NOT_REACHED(); |         ASSERT_NOT_REACHED(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -63,14 +63,14 @@ OwnPtr<Messages::ImageDecoderServer::DecodeImageResponse> ClientConnection::hand | ||||||
|     auto encoded_buffer = SharedBuffer::create_from_shbuf_id(message.encoded_shbuf_id()); |     auto encoded_buffer = SharedBuffer::create_from_shbuf_id(message.encoded_shbuf_id()); | ||||||
|     if (!encoded_buffer) { |     if (!encoded_buffer) { | ||||||
| #ifdef IMAGE_DECODER_DEBUG | #ifdef IMAGE_DECODER_DEBUG | ||||||
|         dbg() << "Could not map encoded data buffer"; |         dbgln("Could not map encoded data buffer"); | ||||||
| #endif | #endif | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (message.encoded_size() > (size_t)encoded_buffer->size()) { |     if (message.encoded_size() > (size_t)encoded_buffer->size()) { | ||||||
| #ifdef IMAGE_DECODER_DEBUG | #ifdef IMAGE_DECODER_DEBUG | ||||||
|         dbg() << "Encoded buffer is smaller than encoded size"; |         dbgln("Encoded buffer is smaller than encoded size"); | ||||||
| #endif | #endif | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|  | @ -84,7 +84,7 @@ OwnPtr<Messages::ImageDecoderServer::DecodeImageResponse> ClientConnection::hand | ||||||
| 
 | 
 | ||||||
|     if (!bitmap) { |     if (!bitmap) { | ||||||
| #ifdef IMAGE_DECODER_DEBUG | #ifdef IMAGE_DECODER_DEBUG | ||||||
|         dbg() << "Could not decode image from encoded data"; |         dbgln("Could not decode image from encoded data"); | ||||||
| #endif | #endif | ||||||
|         return make<Messages::ImageDecoderServer::DecodeImageResponse>(-1, Gfx::IntSize(), (i32)Gfx::BitmapFormat::Invalid, Vector<u32>()); |         return make<Messages::ImageDecoderServer::DecodeImageResponse>(-1, Gfx::IntSize(), (i32)Gfx::BitmapFormat::Invalid, Vector<u32>()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -52,12 +52,12 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv) | ||||||
|     server->on_ready_to_accept = [&] { |     server->on_ready_to_accept = [&] { | ||||||
|         auto client_socket = server->accept(); |         auto client_socket = server->accept(); | ||||||
|         if (!client_socket) { |         if (!client_socket) { | ||||||
|             dbg() << "LaunchServer: accept failed."; |             dbgln("LaunchServer: accept failed."); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         static int s_next_client_id = 0; |         static int s_next_client_id = 0; | ||||||
|         int client_id = ++s_next_client_id; |         int client_id = ++s_next_client_id; | ||||||
|         dbg() << "Received connection"; |         dbgln("Received connection"); | ||||||
|         IPC::new_client_connection<LaunchServer::ClientConnection>(client_socket.release_nonnull(), client_id); |         IPC::new_client_connection<LaunchServer::ClientConnection>(client_socket.release_nonnull(), client_id); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -48,7 +48,7 @@ int main(int argc, char** argv) | ||||||
|     server->on_ready_to_accept = [&] { |     server->on_ready_to_accept = [&] { | ||||||
|         auto client_socket = server->accept(); |         auto client_socket = server->accept(); | ||||||
|         if (!client_socket) { |         if (!client_socket) { | ||||||
|             dbg() << "NotificationServer: accept failed."; |             dbgln("NotificationServer: accept failed."); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         static int s_next_client_id = 0; |         static int s_next_client_id = 0; | ||||||
|  |  | ||||||
|  | @ -255,10 +255,10 @@ void Service::did_exit(int exit_code) | ||||||
|     if (!exited_successfully && run_time_in_msec < 1000) { |     if (!exited_successfully && run_time_in_msec < 1000) { | ||||||
|         switch (m_restart_attempts) { |         switch (m_restart_attempts) { | ||||||
|         case 0: |         case 0: | ||||||
|             dbg() << "Trying again"; |             dbgln("Trying again"); | ||||||
|             break; |             break; | ||||||
|         case 1: |         case 1: | ||||||
|             dbg() << "Third time's a charm?"; |             dbgln("Third time's a charm?"); | ||||||
|             break; |             break; | ||||||
|         default: |         default: | ||||||
|             dbg() << "Giving up on " << name() << ". Good luck!"; |             dbg() << "Giving up on " << name() << ". Good luck!"; | ||||||
|  |  | ||||||
|  | @ -165,7 +165,7 @@ static void prepare_devfs() | ||||||
| 
 | 
 | ||||||
| static void mount_all_filesystems() | static void mount_all_filesystems() | ||||||
| { | { | ||||||
|     dbg() << "Spawning mount -a to mount all filesystems."; |     dbgln("Spawning mount -a to mount all filesystems."); | ||||||
|     pid_t pid = fork(); |     pid_t pid = fork(); | ||||||
| 
 | 
 | ||||||
|     if (pid < 0) { |     if (pid < 0) { | ||||||
|  |  | ||||||
|  | @ -75,7 +75,7 @@ void ClientConnection::handle(const Messages::WebContentServer::UpdateSystemThem | ||||||
| { | { | ||||||
|     auto shared_buffer = SharedBuffer::create_from_shbuf_id(message.shbuf_id()); |     auto shared_buffer = SharedBuffer::create_from_shbuf_id(message.shbuf_id()); | ||||||
|     if (!shared_buffer) { |     if (!shared_buffer) { | ||||||
|         dbg() << "WebContentServer::UpdateSystemTheme: SharedBuffer already gone! Ignoring :^)"; |         dbgln("WebContentServer::UpdateSystemTheme: SharedBuffer already gone! Ignoring :^)"); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     Gfx::set_system_theme(*shared_buffer); |     Gfx::set_system_theme(*shared_buffer); | ||||||
|  | @ -123,7 +123,7 @@ void ClientConnection::handle(const Messages::WebContentServer::Paint& message) | ||||||
|     auto shared_buffer = SharedBuffer::create_from_shbuf_id(message.shbuf_id()); |     auto shared_buffer = SharedBuffer::create_from_shbuf_id(message.shbuf_id()); | ||||||
|     if (!shared_buffer) { |     if (!shared_buffer) { | ||||||
| #ifdef DEBUG_SPAM | #ifdef DEBUG_SPAM | ||||||
|         dbg() << "WebContentServer::Paint: SharedBuffer already gone! Ignoring :^)"; |         dbgln("WebContentServer::Paint: SharedBuffer already gone! Ignoring :^)"); | ||||||
| #endif | #endif | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -404,7 +404,7 @@ OwnPtr<Messages::WindowServer::SetWindowRectResponse> ClientConnection::handle(c | ||||||
|     } |     } | ||||||
|     auto& window = *(*it).value; |     auto& window = *(*it).value; | ||||||
|     if (window.is_fullscreen()) { |     if (window.is_fullscreen()) { | ||||||
|         dbg() << "ClientConnection: Ignoring SetWindowRect request for fullscreen window"; |         dbgln("ClientConnection: Ignoring SetWindowRect request for fullscreen window"); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -874,7 +874,7 @@ void Compositor::recompute_occlusions() | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
| #ifdef OCCLUSIONS_DEBUG | #ifdef OCCLUSIONS_DEBUG | ||||||
|     dbg() << "OCCLUSIONS:"; |     dbgln("OCCLUSIONS:"); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|     auto screen_rect = Screen::the().rect(); |     auto screen_rect = Screen::the().rect(); | ||||||
|  |  | ||||||
|  | @ -34,7 +34,7 @@ CursorParams CursorParams::parse_from_file_name(const StringView& cursor_path, c | ||||||
| { | { | ||||||
|     LexicalPath path(cursor_path); |     LexicalPath path(cursor_path); | ||||||
|     if (!path.is_valid()) { |     if (!path.is_valid()) { | ||||||
|         dbg() << "Cannot parse invalid cursor path, use default cursor params"; |         dbgln("Cannot parse invalid cursor path, use default cursor params"); | ||||||
|         return { default_hotspot }; |         return { default_hotspot }; | ||||||
|     } |     } | ||||||
|     auto file_title = path.title(); |     auto file_title = path.title(); | ||||||
|  | @ -86,7 +86,7 @@ CursorParams CursorParams::parse_from_file_name(const StringView& cursor_path, c | ||||||
|             if (value.value() >= 100 && value.value() <= 1000) |             if (value.value() >= 100 && value.value() <= 1000) | ||||||
|                 params.m_frame_ms = value.value(); |                 params.m_frame_ms = value.value(); | ||||||
|             else |             else | ||||||
|                 dbg() << "Cursor frame rate outside of valid range (100-1000ms)"; |                 dbgln("Cursor frame rate outside of valid range (100-1000ms)"); | ||||||
|             break; |             break; | ||||||
|         default: |         default: | ||||||
|             dbg() << "Ignore unknown property '" << property << "' with value " << value.value() << " parsed from cursor path: " << cursor_path; |             dbg() << "Ignore unknown property '" << property << "' with value " << value.value() << " parsed from cursor path: " << cursor_path; | ||||||
|  |  | ||||||
|  | @ -58,7 +58,7 @@ EventLoop::EventLoop() | ||||||
|     m_server->on_ready_to_accept = [this] { |     m_server->on_ready_to_accept = [this] { | ||||||
|         auto client_socket = m_server->accept(); |         auto client_socket = m_server->accept(); | ||||||
|         if (!client_socket) { |         if (!client_socket) { | ||||||
|             dbg() << "WindowServer: accept failed."; |             dbgln("WindowServer: accept failed."); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         static int s_next_client_id = 0; |         static int s_next_client_id = 0; | ||||||
|  |  | ||||||
|  | @ -525,7 +525,7 @@ void Menu::popup(const Gfx::IntPoint& position) | ||||||
| void Menu::do_popup(const Gfx::IntPoint& position, bool make_input) | void Menu::do_popup(const Gfx::IntPoint& position, bool make_input) | ||||||
| { | { | ||||||
|     if (is_empty()) { |     if (is_empty()) { | ||||||
|         dbg() << "Menu: Empty menu popup"; |         dbgln("Menu: Empty menu popup"); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -217,7 +217,7 @@ void MenuManager::handle_mouse_event(MouseEvent& mouse_event) | ||||||
|         ASSERT(topmost_menu); |         ASSERT(topmost_menu); | ||||||
|         auto* window = topmost_menu->menu_window(); |         auto* window = topmost_menu->menu_window(); | ||||||
|         if (!window) { |         if (!window) { | ||||||
|             dbg() << "MenuManager::handle_mouse_event: No menu window"; |             dbgln("MenuManager::handle_mouse_event: No menu window"); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         ASSERT(window->is_visible()); |         ASSERT(window->is_visible()); | ||||||
|  |  | ||||||
|  | @ -515,7 +515,7 @@ bool WindowManager::process_ongoing_window_move(MouseEvent& event, Window*& hove | ||||||
|             process_event_for_doubleclick(*m_move_window, event); |             process_event_for_doubleclick(*m_move_window, event); | ||||||
|             if (event.type() == Event::MouseDoubleClick) { |             if (event.type() == Event::MouseDoubleClick) { | ||||||
| #if defined(DOUBLECLICK_DEBUG) | #if defined(DOUBLECLICK_DEBUG) | ||||||
|                 dbg() << "[WM] Click up became doubleclick!"; |                 dbgln("[WM] Click up became doubleclick!"); | ||||||
| #endif | #endif | ||||||
|                 m_move_window->set_maximized(!m_move_window->is_maximized()); |                 m_move_window->set_maximized(!m_move_window->is_maximized()); | ||||||
|             } |             } | ||||||
|  | @ -528,7 +528,7 @@ bool WindowManager::process_ongoing_window_move(MouseEvent& event, Window*& hove | ||||||
| #ifdef MOVE_DEBUG | #ifdef MOVE_DEBUG | ||||||
|         dbg() << "[WM] Moving, origin: " << m_move_origin << ", now: " << event.position(); |         dbg() << "[WM] Moving, origin: " << m_move_origin << ", now: " << event.position(); | ||||||
|         if (m_move_window->is_maximized()) { |         if (m_move_window->is_maximized()) { | ||||||
|             dbg() << "  [!] The window is still maximized. Not moving yet."; |             dbgln("  [!] The window is still maximized. Not moving yet."); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
|  | @ -540,7 +540,7 @@ bool WindowManager::process_ongoing_window_move(MouseEvent& event, Window*& hove | ||||||
|             auto pixels_moved_from_start = event.position().pixels_moved(m_move_origin); |             auto pixels_moved_from_start = event.position().pixels_moved(m_move_origin); | ||||||
|             // dbg() << "[WM] " << pixels_moved_from_start << " moved since start of window move";
 |             // dbg() << "[WM] " << pixels_moved_from_start << " moved since start of window move";
 | ||||||
|             if (pixels_moved_from_start > 5) { |             if (pixels_moved_from_start > 5) { | ||||||
|                 // dbg() << "[WM] de-maximizing window";
 |                 // dbgln("[WM] de-maximizing window");
 | ||||||
|                 m_move_origin = event.position(); |                 m_move_origin = event.position(); | ||||||
|                 if (m_move_origin.y() <= secondary_deadzone) |                 if (m_move_origin.y() <= secondary_deadzone) | ||||||
|                     return true; |                     return true; | ||||||
|  |  | ||||||
|  | @ -113,7 +113,7 @@ int main(int, char**) | ||||||
|         return 1; |         return 1; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     dbg() << "Entering WindowServer main loop"; |     dbgln("Entering WindowServer main loop"); | ||||||
|     loop.exec(); |     loop.exec(); | ||||||
|     ASSERT_NOT_REACHED(); |     ASSERT_NOT_REACHED(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -30,7 +30,7 @@ | ||||||
| extern "C" { | extern "C" { | ||||||
| const char* __cxa_demangle(const char*, void*, void*, int*) | const char* __cxa_demangle(const char*, void*, void*, int*) | ||||||
| { | { | ||||||
|     dbg() << "WARNING: __cxa_demangle not supported"; |     dbgln("WARNING: __cxa_demangle not supported"); | ||||||
|     return ""; |     return ""; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -68,7 +68,7 @@ static void fork_into(void(fn)()) | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     fn(); |     fn(); | ||||||
|     dbg() << "child finished (?)"; |     dbgln("child finished (?)"); | ||||||
|     exit(1); |     exit(1); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -108,12 +108,12 @@ int main(int, char**) | ||||||
|     // This entire function is the entirety of process PX.
 |     // This entire function is the entirety of process PX.
 | ||||||
| 
 | 
 | ||||||
|     // Time 0: PX forks into PZ (mnemonic: Zombie)
 |     // Time 0: PX forks into PZ (mnemonic: Zombie)
 | ||||||
|     dbg() << "PX forks into PZ"; |     dbgln("PX forks into PZ"); | ||||||
|     fork_into(run_pz); |     fork_into(run_pz); | ||||||
|     sleep_steps(4); |     sleep_steps(4); | ||||||
| 
 | 
 | ||||||
|     // Time 4:
 |     // Time 4:
 | ||||||
|     dbg() << "Let's hope everything went fine!"; |     dbgln("Let's hope everything went fine!"); | ||||||
|     pid_t guessed_pid = getpid() + 1; |     pid_t guessed_pid = getpid() + 1; | ||||||
|     pid_t guessed_tid = guessed_pid + 1; |     pid_t guessed_tid = guessed_pid + 1; | ||||||
|     printf("About to kill PID %d, TID %d.\n", guessed_pid, guessed_tid); |     printf("About to kill PID %d, TID %d.\n", guessed_pid, guessed_tid); | ||||||
|  | @ -136,12 +136,12 @@ static void run_pz() | ||||||
|     sleep_steps(1); |     sleep_steps(1); | ||||||
| 
 | 
 | ||||||
|     // Time 1: PZ's main thread T1 creates a new thread T2
 |     // Time 1: PZ's main thread T1 creates a new thread T2
 | ||||||
|     dbg() << "PZ calls pthread_create"; |     dbgln("PZ calls pthread_create"); | ||||||
|     thread_into(run_pz_t2_wrap); |     thread_into(run_pz_t2_wrap); | ||||||
|     sleep_steps(2); |     sleep_steps(2); | ||||||
| 
 | 
 | ||||||
|     // Time 3: T1 calls thread_exit()
 |     // Time 3: T1 calls thread_exit()
 | ||||||
|     dbg() << "PZ(T1) calls thread_exit"; |     dbgln("PZ(T1) calls thread_exit"); | ||||||
|     pthread_exit(nullptr); |     pthread_exit(nullptr); | ||||||
|     ASSERT_NOT_REACHED(); |     ASSERT_NOT_REACHED(); | ||||||
| } | } | ||||||
|  | @ -160,7 +160,7 @@ static void run_pz_t2() | ||||||
|     // Time 2: Nothing
 |     // Time 2: Nothing
 | ||||||
|     // FIXME: For some reason, both printf() and dbg() crash.
 |     // FIXME: For some reason, both printf() and dbg() crash.
 | ||||||
|     // This also prevents us from using a pipe to communicate to PX both process and thread ID
 |     // This also prevents us from using a pipe to communicate to PX both process and thread ID
 | ||||||
|     // dbg() << "T2: I'm alive and well.";
 |     // dbgln("T2: I'm alive and well.");
 | ||||||
|     sleep_steps(18); |     sleep_steps(18); | ||||||
| 
 | 
 | ||||||
|     // Time 20: Cleanup
 |     // Time 20: Cleanup
 | ||||||
|  |  | ||||||
|  | @ -113,7 +113,7 @@ static bool mount_all() | ||||||
|         int flags = parts.size() >= 4 ? parse_options(parts[3]) : 0; |         int flags = parts.size() >= 4 ? parse_options(parts[3]) : 0; | ||||||
| 
 | 
 | ||||||
|         if (strcmp(mountpoint, "/") == 0) { |         if (strcmp(mountpoint, "/") == 0) { | ||||||
|             dbg() << "Skipping mounting root"; |             dbgln("Skipping mounting root"); | ||||||
|             continue; |             continue; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1994,7 +1994,7 @@ nrDlBQpuxz7bwSyQO7UCIHrYMnDohgNbwtA5ZpW3H1cKKQQvueWm6sxW9P5sUrZ3 | ||||||
| static void rsa_test_encrypt_decrypt() | static void rsa_test_encrypt_decrypt() | ||||||
| { | { | ||||||
|     I_TEST((RSA | Encrypt)); |     I_TEST((RSA | Encrypt)); | ||||||
|     dbg() << " creating rsa object"; |     dbgln(" creating rsa object"); | ||||||
|     Crypto::PK::RSA rsa( |     Crypto::PK::RSA rsa( | ||||||
|         "9527497237087650398000977129550904920919162360737979403539302312977329868395261515707123424679295515888026193056908173564681660256268221509339074678416049"_bigint, |         "9527497237087650398000977129550904920919162360737979403539302312977329868395261515707123424679295515888026193056908173564681660256268221509339074678416049"_bigint, | ||||||
|         "39542231845947188736992321577701849924317746648774438832456325878966594812143638244746284968851807975097653255909707366086606867657273809465195392910913"_bigint, |         "39542231845947188736992321577701849924317746648774438832456325878966594812143638244746284968851807975097653255909707366086606867657273809465195392910913"_bigint, | ||||||
|  |  | ||||||
|  | @ -177,7 +177,7 @@ static void cleanup_and_exit() | ||||||
| #if 0 | #if 0 | ||||||
| static void handle_sigabrt(int) | static void handle_sigabrt(int) | ||||||
| { | { | ||||||
|     dbg() << "test-web: SIGABRT received, cleaning up."; |     dbgln("test-web: SIGABRT received, cleaning up."); | ||||||
|     cleanup_and_exit(); |     cleanup_and_exit(); | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 asynts
						asynts