Everywhere: Hook up remaining debug macros to Debug.h.

This commit is contained in:
asynts 2021-01-24 15:28:26 +01:00 committed by Andreas Kling
parent da69de1f1b
commit eea72b9b5c
63 changed files with 458 additions and 287 deletions

View file

@ -119,3 +119,72 @@
#cmakedefine01 LOCK_RESTORE_DEBUG
#cmakedefine01 FUTEXQUEUE_DEBUG
#cmakedefine01 FUTEX_DEBUG
#cmakedefine01 UHCI_DEBUG
#cmakedefine01 APIC_DEBUG
#cmakedefine01 APIC_SMP_DEBUG
#cmakedefine01 ARP_DEBUG
#cmakedefine01 AWAVLOADER_DEBUG
#cmakedefine01 BBFS_DEBUG
#cmakedefine01 CALLBACK_MACHINE_DEBUG
#cmakedefine01 CHTTPJOB_DEBUG
#cmakedefine01 COMMIT_DEBUG
#cmakedefine01 AUTOCOMPLETE_DEBUG
#cmakedefine01 CPP_LANGUAGE_SERVER_DEBUG
#cmakedefine01 DIFF_DEBUG
#cmakedefine01 HIGHLIGHT_FOCUSED_FRAME_DEBUG
#cmakedefine01 ITEM_RECTS_DEBUG
#cmakedefine01 SH_LANGUAGE_SERVER_DEBUG
#cmakedefine01 STRINGIMPL_DEBUG
#cmakedefine01 TEXTEDITOR_DEBUG
#cmakedefine01 DEFERRED_INVOKE_DEBUG
#cmakedefine01 DYNAMIC_LOAD_DEBUG
#cmakedefine01 EDITOR_DEBUG
#cmakedefine01 ELF_IMAGE_DEBUG
#cmakedefine01 ETHERNET_DEBUG
#cmakedefine01 ETHERNET_VERY_DEBUG
#cmakedefine01 EVENT_DEBUG
#cmakedefine01 EVENTLOOP_DEBUG
#cmakedefine01 EXEC_DEBUG
#cmakedefine01 EXT2_DEBUG
#cmakedefine01 EXT2_VERY_DEBUG
#cmakedefine01 FIFO_DEBUG
#cmakedefine01 GEMINI_DEBUG
#cmakedefine01 GEMINIJOB_DEBUG
#cmakedefine01 GENERATE_DEBUG_CODE
#cmakedefine01 GLOBAL_DTORS_DEBUG
#cmakedefine01 GMENU_DEBUG
#cmakedefine01 HEAP_DEBUG
#cmakedefine01 HEX_DEBUG
#cmakedefine01 HTTPSJOB_DEBUG
#cmakedefine01 ICMP_DEBUG
#cmakedefine01 ICO_DEBUG
#cmakedefine01 IPV4_DEBUG
#cmakedefine01 IRC_DEBUG
#cmakedefine01 KEYBOARD_DEBUG
#cmakedefine01 KMALLOC_DEBUG_LARGE_ALLOCATIONS
#cmakedefine01 LEXER_DEBUG
#cmakedefine01 LOOKUPSERVER_DEBUG
#cmakedefine01 MALLOC_DEBUG
#cmakedefine01 MBR_DEBUG
#cmakedefine01 MEMORY_DEBUG
#cmakedefine01 MENU_DEBUG
#cmakedefine01 NETWORK_TASK_DEBUG
#cmakedefine01 OBJECT_DEBUG
#cmakedefine01 OFFD_DEBUG
#cmakedefine01 PTHREAD_DEBUG
#cmakedefine01 REACHABLE_DEBUG
#cmakedefine01 ROUTING_DEBUG
#cmakedefine01 RTL8139_DEBUG
#cmakedefine01 SB16_DEBUG
#cmakedefine01 SH_DEBUG
#cmakedefine01 STORAGE_DEVICE_DEBUG
#cmakedefine01 TCP_DEBUG
#cmakedefine01 TERMCAP_DEBUG
#cmakedefine01 TERMINAL_DEBUG
#cmakedefine01 UCI_DEBUG
#cmakedefine01 UDP_DEBUG
#cmakedefine01 UHCI_VERBOSE_DEBUG
#cmakedefine01 UPDATE_COALESCING_DEBUG
#cmakedefine01 VOLATILE_PAGE_RANGES_DEBUG
#cmakedefine01 WSMESSAGELOOP_DEBUG
#cmakedefine01 GPT_DEBUG

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/FlyString.h>
#include <AK/HashTable.h>
#include <AK/Memory.h>
@ -31,7 +32,7 @@
#include <AK/StringImpl.h>
#include <AK/kmalloc.h>
#ifdef DEBUG_STRINGIMPL
#if STRINGIMPL_DEBUG
unsigned g_stringimpl_count;
static HashTable<StringImpl*>* g_all_live_stringimpls;
@ -62,7 +63,7 @@ StringImpl& StringImpl::the_empty_stringimpl()
StringImpl::StringImpl(ConstructWithInlineBufferTag, size_t length)
: m_length(length)
{
#ifdef DEBUG_STRINGIMPL
#if STRINGIMPL_DEBUG
if (!g_all_live_stringimpls)
g_all_live_stringimpls = new HashTable<StringImpl*>;
++g_stringimpl_count;
@ -74,7 +75,7 @@ StringImpl::~StringImpl()
{
if (m_fly)
FlyString::did_destroy_impl({}, *this);
#ifdef DEBUG_STRINGIMPL
#if STRINGIMPL_DEBUG
--g_stringimpl_count;
g_all_live_stringimpls->remove(this);
#endif

View file

@ -35,10 +35,6 @@
# include <Kernel/Arch/i386/CPU.h>
#endif
#ifndef WEAKABLE_DEBUG
# define WEAKABLE_DEBUG
#endif
namespace AK {
template<typename T>

View file

@ -26,6 +26,7 @@
#include <AK/Assertions.h>
#include <AK/ByteBuffer.h>
#include <AK/Debug.h>
#include <AK/Singleton.h>
#include <AK/StringView.h>
#include <AK/Types.h>
@ -293,7 +294,7 @@ void KeyboardDevice::irq_handle_byte_read(u8 byte)
return;
}
#ifdef KEYBOARD_DEBUG
#if KEYBOARD_DEBUG
dbgln("Keyboard::irq_handle_byte_read: {:#02x} {}", ch, (pressed ? "down" : "up"));
#endif
switch (ch) {

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/Memory.h>
#include <AK/Singleton.h>
#include <AK/StringView.h>
@ -241,7 +242,7 @@ KResultOr<size_t> SB16::write(FileDescription&, size_t, const UserOrKernelBuffer
return ENOMEM;
}
#ifdef SB16_DEBUG
#if SB16_DEBUG
klog() << "SB16: Writing buffer of " << length << " bytes";
#endif
ASSERT(length <= PAGE_SIZE);

View file

@ -25,6 +25,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <Kernel/Devices/USB/UHCIController.h>
#include <Kernel/Process.h>
#include <Kernel/StdLib.h>
@ -194,7 +195,7 @@ void UHCIController::create_structures()
transfer_descriptor->set_isochronous();
transfer_descriptor->link_queue_head(m_interrupt_transfer_queue->paddr());
#ifdef UHCI_VERBOSE_DEBUG
#if UHCI_VERBOSE_DEBUG
transfer_descriptor->print();
#endif
}
@ -212,13 +213,13 @@ void UHCIController::create_structures()
// access the raw descriptor (that we later send to the controller)
m_free_td_pool.at(i) = new (placement_addr) Kernel::USB::TransferDescriptor(paddr);
#ifdef UHCI_VERBOSE_DEBUG
#if UHCI_VERBOSE_DEBUG
auto transfer_descriptor = m_free_td_pool.at(i);
transfer_descriptor->print();
#endif
}
#ifdef UHCI_DEBUG
#if UHCI_DEBUG
klog() << "UHCI: Pool information:";
klog() << "\tqh_pool: " << PhysicalAddress(m_qh_pool->physical_page(0)->paddr()) << ", length: " << m_qh_pool->range().size();
klog() << "\ttd_pool: " << PhysicalAddress(m_td_pool->physical_page(0)->paddr()) << ", length: " << m_td_pool->range().size();
@ -290,7 +291,7 @@ QueueHead* UHCIController::allocate_queue_head() const
for (QueueHead* queue_head : m_free_qh_pool) {
if (!queue_head->in_use()) {
queue_head->set_in_use(true);
#ifdef UHCI_DEBUG
#if UHCI_DEBUG
klog() << "UHCI: Allocated a new Queue Head! Located @ " << VirtualAddress(queue_head) << "(" << PhysicalAddress(queue_head->paddr()) << ")";
#endif
return queue_head;
@ -306,7 +307,7 @@ TransferDescriptor* UHCIController::allocate_transfer_descriptor() const
for (TransferDescriptor* transfer_descriptor : m_free_td_pool) {
if (!transfer_descriptor->in_use()) {
transfer_descriptor->set_in_use(true);
#ifdef UHCI_DEBUG
#if UHCI_DEBUG
klog() << "UHCI: Allocated a new Transfer Descriptor! Located @ " << VirtualAddress(transfer_descriptor) << "(" << PhysicalAddress(transfer_descriptor->paddr()) << ")";
#endif
return transfer_descriptor;
@ -460,7 +461,7 @@ void UHCIController::handle_irq(const RegisterState&)
if (!read_usbsts())
return;
#ifdef UHCI_DEBUG
#if UHCI_DEBUG
klog() << "UHCI: Interrupt happened!";
klog() << "Value of USBSTS: " << read_usbsts();
#endif

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/IntrusiveList.h>
#include <Kernel/FileSystem/BlockBasedFileSystem.h>
#include <Kernel/Process.h>
@ -144,7 +145,7 @@ KResult BlockBasedFS::write_block(unsigned index, const UserOrKernelBuffer& data
{
ASSERT(m_logical_block_size);
ASSERT(offset + count <= block_size());
#ifdef BBFS_DEBUG
#if BBFS_DEBUG
klog() << "BlockBasedFileSystem::write_block " << index << ", size=" << count;
#endif
@ -217,7 +218,7 @@ bool BlockBasedFS::raw_write_blocks(unsigned index, size_t count, const UserOrKe
KResult BlockBasedFS::write_blocks(unsigned index, unsigned count, const UserOrKernelBuffer& data, bool allow_cache)
{
ASSERT(m_logical_block_size);
#ifdef BBFS_DEBUG
#if BBFS_DEBUG
klog() << "BlockBasedFileSystem::write_blocks " << index << " x" << count;
#endif
for (unsigned i = 0; i < count; ++i) {
@ -232,7 +233,7 @@ KResult BlockBasedFS::read_block(unsigned index, UserOrKernelBuffer* buffer, siz
{
ASSERT(m_logical_block_size);
ASSERT(offset + count <= block_size());
#ifdef BBFS_DEBUG
#if BBFS_DEBUG
klog() << "BlockBasedFileSystem::read_block " << index;
#endif

View file

@ -25,6 +25,7 @@
*/
#include <AK/Bitmap.h>
#include <AK/Debug.h>
#include <AK/HashMap.h>
#include <AK/MemoryStream.h>
#include <AK/StdLibExtras.h>
@ -108,13 +109,13 @@ bool Ext2FS::initialize()
ASSERT(success);
auto& super_block = this->super_block();
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
klog() << "ext2fs: super block magic: " << String::format("%x", super_block.s_magic) << " (super block size: " << sizeof(ext2_super_block) << ")";
#endif
if (super_block.s_magic != EXT2_SUPER_MAGIC)
return false;
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
klog() << "ext2fs: " << super_block.s_inodes_count << " inodes, " << super_block.s_blocks_count << " blocks";
klog() << "ext2fs: block size = " << EXT2_BLOCK_SIZE(&super_block);
klog() << "ext2fs: first data block = " << super_block.s_first_data_block;
@ -151,7 +152,7 @@ bool Ext2FS::initialize()
return false;
}
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
for (unsigned i = 1; i <= m_block_group_count; ++i) {
auto& group = group_descriptor(i);
klog() << "ext2fs: group[" << i << "] { block_bitmap: " << group.bg_block_bitmap << ", inode_bitmap: " << group.bg_inode_bitmap << ", inode_table: " << group.bg_inode_table << " }";
@ -266,7 +267,7 @@ KResult Ext2FS::write_block_list_for_inode(InodeIndex inode_index, ext2_inode& e
--remaining_blocks;
}
if (inode_dirty) {
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: Writing {} direct block(s) to i_block array of inode {}", min((size_t)EXT2_NDIR_BLOCKS, blocks.size()), inode_index);
for (size_t i = 0; i < min((size_t)EXT2_NDIR_BLOCKS, blocks.size()); ++i)
dbgln(" + {}", blocks[i]);
@ -287,7 +288,7 @@ KResult Ext2FS::write_block_list_for_inode(InodeIndex inode_index, ext2_inode& e
inode_dirty = true;
e2inode.i_block[EXT2_IND_BLOCK] = new_indirect_block;
if (inode_dirty) {
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: Adding the indirect block to i_block array of inode {}", inode_index);
#endif
write_ext2_inode(inode_index, e2inode);
@ -329,7 +330,7 @@ KResult Ext2FS::write_block_list_for_inode(InodeIndex inode_index, ext2_inode& e
inode_dirty = true;
e2inode.i_block[EXT2_DIND_BLOCK] = new_dindirect_block;
if (inode_dirty) {
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: Adding the doubly-indirect block to i_block array of inode {}", inode_index);
#endif
write_ext2_inode(inode_index, e2inode);
@ -458,7 +459,7 @@ Vector<Ext2FS::BlockIndex> Ext2FS::block_list_for_inode_impl(const ext2_inode& e
if (is_symlink(e2inode.i_mode) && e2inode.i_blocks == 0)
block_count = 0;
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS::block_list_for_inode(): i_size={}, i_blocks={}, block_count={}", e2inode.i_size, e2inode.i_blocks, block_count);
#endif
@ -542,7 +543,7 @@ void Ext2FS::free_inode(Ext2FSInode& inode)
{
LOCKER(m_lock);
ASSERT(inode.m_raw_inode.i_links_count == 0);
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: Inode {} has no more links, time to delete!", inode.index());
#endif
@ -601,7 +602,7 @@ void Ext2FS::flush_writes()
dbgln("Ext2FS: flush_writes() had error {}", result.error());
}
cached_bitmap->dirty = false;
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Flushed bitmap block {}", cached_bitmap->bitmap_block_index);
#endif
}
@ -668,7 +669,7 @@ InodeMetadata Ext2FSInode::metadata() const
void Ext2FSInode::flush_metadata()
{
LOCKER(m_lock);
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: flush_metadata for inode {}", index());
#endif
fs().write_ext2_inode(index(), m_raw_inode);
@ -755,7 +756,7 @@ ssize_t Ext2FSInode::read_bytes(off_t offset, ssize_t count, UserOrKernelBuffer&
ssize_t nread = 0;
size_t remaining_count = min((off_t)count, (off_t)size() - offset);
#ifdef EXT2_VERY_DEBUG
#if EXT2_VERY_DEBUG
dbgln("Ext2FS: Reading up to {} bytes, {} bytes into inode {} to {}", count, offset, index(), buffer.user_or_kernel_ptr());
#endif
@ -787,7 +788,7 @@ KResult Ext2FSInode::resize(u64 new_size)
size_t blocks_needed_before = ceil_div(old_size, block_size);
size_t blocks_needed_after = ceil_div(new_size, block_size);
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FSInode::resize(): blocks needed before (size was {}): {}", old_size, blocks_needed_before);
dbgln("Ext2FSInode::resize(): blocks needed after (size is {}): {}", new_size, blocks_needed_after);
#endif
@ -808,7 +809,7 @@ KResult Ext2FSInode::resize(u64 new_size)
auto new_blocks = fs().allocate_blocks(fs().group_index_from_inode(index()), blocks_needed_after - blocks_needed_before);
block_list.append(move(new_blocks));
} else if (blocks_needed_after < blocks_needed_before) {
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: Shrinking inode {}. Old block list is {} entries:", index(), block_list.size());
for (auto block_index : block_list) {
dbgln(" # {}", block_index);
@ -865,7 +866,7 @@ ssize_t Ext2FSInode::write_bytes(off_t offset, ssize_t count, const UserOrKernel
if (is_symlink()) {
ASSERT(offset == 0);
if (max((size_t)(offset + count), (size_t)m_raw_inode.i_size) < max_inline_symlink_length) {
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: write_bytes poking into i_block array for inline symlink '{}' ({} bytes)", data.copy_into_string(count), count);
#endif
if (!data.read(((u8*)m_raw_inode.i_block) + offset, (size_t)count))
@ -905,14 +906,14 @@ ssize_t Ext2FSInode::write_bytes(off_t offset, ssize_t count, const UserOrKernel
ssize_t nwritten = 0;
size_t remaining_count = min((off_t)count, (off_t)new_size - offset);
#ifdef EXT2_VERY_DEBUG
#if EXT2_VERY_DEBUG
dbgln("Ext2FS: Writing {} bytes, {} bytes into inode {} from {}", count, offset, index(), data.user_or_kernel_ptr());
#endif
for (size_t bi = first_block_logical_index; remaining_count && bi <= last_block_logical_index; ++bi) {
size_t offset_into_block = (bi == first_block_logical_index) ? offset_into_first_block : 0;
size_t num_bytes_to_copy = min(block_size - offset_into_block, remaining_count);
#ifdef EXT2_VERY_DEBUG
#if EXT2_VERY_DEBUG
dbgln("Ext2FS: Writing block {} (offset_into_block: {})", m_block_list[bi], offset_into_block);
#endif
auto result = fs().write_block(m_block_list[bi], data.offset(nwritten), num_bytes_to_copy, offset_into_block, allow_cache);
@ -924,7 +925,7 @@ ssize_t Ext2FSInode::write_bytes(off_t offset, ssize_t count, const UserOrKernel
nwritten += num_bytes_to_copy;
}
#ifdef EXT2_VERY_DEBUG
#if EXT2_VERY_DEBUG
dbgln("Ext2FS: After write, i_size={}, i_blocks={} ({} blocks in list)", m_raw_inode.i_size, m_raw_inode.i_blocks, m_block_list.size());
#endif
@ -961,7 +962,7 @@ KResult Ext2FSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntr
LOCKER(m_lock);
ASSERT(is_directory());
#ifdef EXT2_VERY_DEBUG
#if EXT2_VERY_DEBUG
dbgln("Ext2FS: Traversing as directory: {}", index());
#endif
@ -974,7 +975,7 @@ KResult Ext2FSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntr
while (entry < buffer.end_pointer()) {
if (entry->inode != 0) {
#ifdef EXT2_VERY_DEBUG
#if EXT2_VERY_DEBUG
dbgln("Ext2Inode::traverse_as_directory: {}, name_len: {}, rec_len: {}, file_type: {}, name: {}", entry->inode, entry->name_len, entry->rec_len, entry->file_type, StringView(entry->name, entry->name_len));
#endif
if (!callback({ { entry->name, entry->name_len }, { fsid(), entry->inode }, entry->file_type }))
@ -999,7 +1000,7 @@ bool Ext2FSInode::write_directory(const Vector<Ext2FSDirectoryEntry>& entries)
int blocks_needed = ceil_div(static_cast<size_t>(directory_size), block_size);
int occupied_size = blocks_needed * block_size;
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: New directory inode {} contents to write (size {}, occupied {}):", index(), directory_size, occupied_size);
#endif
@ -1013,7 +1014,7 @@ bool Ext2FSInode::write_directory(const Vector<Ext2FSDirectoryEntry>& entries)
if (i == entries.size() - 1)
record_length += occupied_size - directory_size;
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("* Inode: {}, name_len: {}, rec_len: {}, file_type: {}, name: {}", entry.inode.index(), u16(entry.name.length()), u16(record_length), u8(entry.file_type), entry.name);
#endif
@ -1053,7 +1054,7 @@ KResult Ext2FSInode::add_child(Inode& child, const StringView& name, mode_t mode
if (name.length() > EXT2_NAME_LEN)
return ENAMETOOLONG;
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FSInode::add_child: Adding inode {} with name '{}' and mode {:o} to directory {}", child.index(), name, mode, index());
#endif
@ -1092,7 +1093,7 @@ KResult Ext2FSInode::add_child(Inode& child, const StringView& name, mode_t mode
KResult Ext2FSInode::remove_child(const StringView& name)
{
LOCKER(m_lock);
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FSInode::remove_child('{}') in inode {}", name, index());
#endif
ASSERT(is_directory());
@ -1104,7 +1105,7 @@ KResult Ext2FSInode::remove_child(const StringView& name)
InodeIdentifier child_id { fsid(), child_inode_index };
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FSInode::remove_child(): Removing '{}' in directory {}", name, index());
#endif
@ -1167,14 +1168,14 @@ bool Ext2FS::write_ext2_inode(unsigned inode, const ext2_inode& e2inode)
Vector<Ext2FS::BlockIndex> Ext2FS::allocate_blocks(GroupIndex preferred_group_index, size_t count)
{
LOCKER(m_lock);
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: allocate_blocks(preferred group: {}, count {})", preferred_group_index, count);
#endif
if (count == 0)
return {};
Vector<BlockIndex> blocks;
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: allocate_blocks:");
#endif
blocks.ensure_capacity(count);
@ -1212,14 +1213,14 @@ Vector<Ext2FS::BlockIndex> Ext2FS::allocate_blocks(GroupIndex preferred_group_in
size_t free_region_size = 0;
auto first_unset_bit_index = block_bitmap.find_longest_range_of_unset_bits(count - blocks.size(), free_region_size);
ASSERT(first_unset_bit_index.has_value());
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: allocating free region of size: {} [{}]", free_region_size, group_index);
#endif
for (size_t i = 0; i < free_region_size; ++i) {
BlockIndex block_index = (first_unset_bit_index.value() + i) + first_block_in_group;
set_block_allocation_state(block_index, true);
blocks.unchecked_append(block_index);
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln(" allocated > {}", block_index);
#endif
}
@ -1234,13 +1235,13 @@ unsigned Ext2FS::find_a_free_inode(GroupIndex preferred_group, off_t expected_si
ASSERT(expected_size >= 0);
LOCKER(m_lock);
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: find_a_free_inode(preferred_group: {}, expected_size: {})", preferred_group, expected_size);
#endif
unsigned needed_blocks = ceil_div(static_cast<size_t>(expected_size), block_size());
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: minimum needed blocks: {}", needed_blocks);
#endif
@ -1267,7 +1268,7 @@ unsigned Ext2FS::find_a_free_inode(GroupIndex preferred_group, off_t expected_si
return 0;
}
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: find_a_free_inode: found suitable group [{}] for new inode with {} blocks needed :^)", group_index, needed_blocks);
#endif
@ -1292,7 +1293,7 @@ unsigned Ext2FS::find_a_free_inode(GroupIndex preferred_group, off_t expected_si
}
unsigned inode = first_free_inode_in_group;
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: found suitable inode {}", inode);
#endif
@ -1339,7 +1340,7 @@ bool Ext2FS::set_inode_allocation_state(InodeIndex inode_index, bool new_state)
auto& cached_bitmap = get_bitmap_block(bgd.bg_inode_bitmap);
bool current_state = cached_bitmap.bitmap(inodes_per_group()).get(bit_index);
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: set_inode_allocation_state({}) {} -> {}", inode_index, current_state, new_state);
#endif
@ -1402,7 +1403,7 @@ bool Ext2FS::set_block_allocation_state(BlockIndex block_index, bool new_state)
auto& cached_bitmap = get_bitmap_block(bgd.bg_block_bitmap);
bool current_state = cached_bitmap.bitmap(blocks_per_group()).get(bit_index);
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: block {} state: {} -> {} (in bitmap block {})", block_index, current_state, new_state, bgd.bg_block_bitmap);
#endif
@ -1446,7 +1447,7 @@ KResult Ext2FS::create_directory(InodeIdentifier parent_id, const String& name,
auto& inode = inode_or_error.value();
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: create_directory: created new directory named '{} with inode {}", name, inode->index());
#endif
@ -1483,7 +1484,7 @@ KResultOr<NonnullRefPtr<Inode>> Ext2FS::create_inode(InodeIdentifier parent_id,
if (name.length() > EXT2_NAME_LEN)
return ENAMETOOLONG;
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: Adding inode '{}' (mode {:o}) to parent directory {}", name, mode, parent_inode->index());
#endif
@ -1532,7 +1533,7 @@ KResultOr<NonnullRefPtr<Inode>> Ext2FS::create_inode(InodeIdentifier parent_id,
if (result.is_error())
return result;
#ifdef EXT2_DEBUG
#if EXT2_DEBUG
dbgln("Ext2FS: writing initial metadata for inode {}", inode_id);
#endif
e2inode.i_flags = 0;

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/HashTable.h>
#include <AK/Singleton.h>
#include <AK/StdLibExtras.h>
@ -114,12 +115,12 @@ void FIFO::attach(Direction direction)
{
if (direction == Direction::Reader) {
++m_readers;
#ifdef FIFO_DEBUG
#if FIFO_DEBUG
klog() << "open reader (" << m_readers << ")";
#endif
} else if (direction == Direction::Writer) {
++m_writers;
#ifdef FIFO_DEBUG
#if FIFO_DEBUG
klog() << "open writer (" << m_writers << ")";
#endif
}
@ -130,13 +131,13 @@ void FIFO::attach(Direction direction)
void FIFO::detach(Direction direction)
{
if (direction == Direction::Reader) {
#ifdef FIFO_DEBUG
#if FIFO_DEBUG
klog() << "close reader (" << m_readers << " - 1)";
#endif
ASSERT(m_readers);
--m_readers;
} else if (direction == Direction::Writer) {
#ifdef FIFO_DEBUG
#if FIFO_DEBUG
klog() << "close writer (" << m_writers << " - 1)";
#endif
ASSERT(m_writers);

View file

@ -26,6 +26,7 @@
#pragma once
#include <AK/Debug.h>
#include <AK/Types.h>
#define KMALLOC_SCRUB_BYTE 0xbb
@ -54,7 +55,7 @@ inline void* operator new[](size_t, void* p) { return p; }
[[gnu::malloc, gnu::returns_nonnull, gnu::alloc_size(1)]] ALWAYS_INLINE void* kmalloc(size_t size)
{
#ifdef KMALLOC_DEBUG_LARGE_ALLOCATIONS
#if KMALLOC_DEBUG_LARGE_ALLOCATIONS
// Any kernel allocation >= 1M is 99.9% a bug.
if (size >= 1048576)
asm volatile("cli;hlt");

View file

@ -25,6 +25,7 @@
*/
#include <AK/Assertions.h>
#include <AK/Debug.h>
#include <AK/Memory.h>
#include <AK/Singleton.h>
#include <AK/StringView.h>
@ -244,7 +245,7 @@ bool APIC::init_bsp()
return false;
PhysicalAddress apic_base = get_base();
#ifdef APIC_DEBUG
#if APIC_DEBUG
klog() << "Initializing APIC, base: " << apic_base;
#endif
set_base(apic_base);
@ -274,7 +275,7 @@ bool APIC::init_bsp()
size_t entry_length = madt_entry->length;
if (madt_entry->type == (u8)ACPI::Structures::MADTEntryType::LocalAPIC) {
auto* plapic_entry = (const ACPI::Structures::MADTEntries::ProcessorLocalAPIC*)madt_entry;
#ifdef APIC_DEBUG
#if APIC_DEBUG
klog() << "APIC: AP found @ MADT entry " << entry_index << ", Processor Id: " << String::format("%02x", plapic_entry->acpi_processor_id)
<< " APIC Id: " << String::format("%02x", plapic_entry->apic_id) << " Flags: " << String::format("%08x", plapic_entry->flags);
#endif
@ -327,7 +328,7 @@ void APIC::do_boot_aps()
ASSERT(aps_to_enable == apic_ap_stacks.size());
for (size_t i = 0; i < aps_to_enable; i++) {
ap_stack_array[i] = apic_ap_stacks[i]->vaddr().get() + Thread::default_kernel_stack_size;
#ifdef APIC_DEBUG
#if APIC_DEBUG
klog() << "APIC: CPU[" << (i + 1) << "] stack at " << VirtualAddress(ap_stack_array[i]);
#endif
}
@ -339,7 +340,7 @@ void APIC::do_boot_aps()
auto ap_processor_info_array = &ap_stack_array[aps_to_enable];
for (size_t i = 0; i < aps_to_enable; i++) {
ap_processor_info_array[i] = FlatPtr(m_ap_processor_info[i].ptr());
#ifdef APIC_DEBUG
#if APIC_DEBUG
klog() << "APIC: CPU[" << (i + 1) << "] Processor at " << VirtualAddress(ap_processor_info_array[i]);
#endif
}
@ -366,7 +367,7 @@ void APIC::do_boot_aps()
for (u32 i = 0; i < aps_to_enable; i++)
m_ap_idle_threads[i] = Scheduler::create_ap_idle_thread(i + 1);
#ifdef APIC_DEBUG
#if APIC_DEBUG
klog() << "APIC: Starting " << aps_to_enable << " AP(s)";
#endif
@ -384,7 +385,7 @@ void APIC::do_boot_aps()
// Now wait until the ap_cpu_init_pending variable dropped to 0, which means all APs are initialized and no longer need these special mappings
if (m_apic_ap_count.load(AK::MemoryOrder::memory_order_consume) != aps_to_enable) {
#ifdef APIC_DEBUG
#if APIC_DEBUG
klog() << "APIC: Waiting for " << aps_to_enable << " AP(s) to finish initialization...";
#endif
do {
@ -393,7 +394,7 @@ void APIC::do_boot_aps()
} while (m_apic_ap_count.load(AK::MemoryOrder::memory_order_consume) != aps_to_enable);
}
#ifdef APIC_DEBUG
#if APIC_DEBUG
klog() << "APIC: " << m_processor_enabled_cnt << " processors are initialized and running";
#endif
}
@ -410,7 +411,7 @@ void APIC::boot_aps()
// Enable SMP, which means IPIs may now be sent
Processor::smp_enable();
#ifdef APIC_DEBUG
#if APIC_DEBUG
dbgln("All processors initialized and waiting, trigger all to continue");
#endif
@ -435,7 +436,7 @@ void APIC::enable(u32 cpu)
apic_id = read_register(APIC_REG_LD) >> 24;
Processor::current().info().set_apic_id(apic_id);
#ifdef APIC_DEBUG
#if APIC_DEBUG
klog() << "Enabling local APIC for cpu #" << cpu << " apic id: " << apic_id;
#endif
@ -482,7 +483,7 @@ void APIC::init_finished(u32 cpu)
// Notify the BSP that we are done initializing. It will unmap the startup data at P8000
m_apic_ap_count.fetch_add(1, AK::MemoryOrder::memory_order_acq_rel);
#ifdef APIC_DEBUG
#if APIC_DEBUG
klog() << "APIC: cpu #" << cpu << " initialized, waiting for all others";
#endif
@ -493,7 +494,7 @@ void APIC::init_finished(u32 cpu)
IO::delay(200);
}
#ifdef APIC_DEBUG
#if APIC_DEBUG
klog() << "APIC: cpu #" << cpu << " continues, all others are initialized";
#endif
@ -506,7 +507,7 @@ void APIC::init_finished(u32 cpu)
void APIC::broadcast_ipi()
{
#ifdef APIC_SMP_DEBUG
#if APIC_SMP_DEBUG
klog() << "SMP: Broadcast IPI from cpu #" << Processor::current().id();
#endif
wait_for_pending_icr();
@ -516,7 +517,7 @@ void APIC::broadcast_ipi()
void APIC::send_ipi(u32 cpu)
{
auto& proc = Processor::current();
#ifdef APIC_SMP_DEBUG
#if APIC_SMP_DEBUG
klog() << "SMP: Send IPI from cpu #" << proc.id() << " to cpu #" << cpu;
#endif
ASSERT(cpu != proc.id());
@ -603,14 +604,14 @@ u32 APIC::get_timer_divisor()
void APICIPIInterruptHandler::handle_interrupt(const RegisterState&)
{
#ifdef APIC_SMP_DEBUG
#if APIC_SMP_DEBUG
klog() << "APIC IPI on cpu #" << Processor::current().id();
#endif
}
bool APICIPIInterruptHandler::eoi()
{
#ifdef APIC_SMP_DEBUG
#if APIC_SMP_DEBUG
klog() << "SMP: IPI eoi";
#endif
APIC::the().eoi();

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <Kernel/Lock.h>
#include <Kernel/Net/ARP.h>
#include <Kernel/Net/EtherType.h>
@ -89,7 +90,7 @@ void NetworkTask_main(void*)
return;
packet_size = adapter.dequeue_packet(buffer, buffer_size, packet_timestamp);
pending_packets--;
#ifdef NETWORK_TASK_DEBUG
#if NETWORK_TASK_DEBUG
klog() << "NetworkTask: Dequeued packet from " << adapter.name().characters() << " (" << packet_size << " bytes)";
#endif
});
@ -113,11 +114,11 @@ void NetworkTask_main(void*)
continue;
}
auto& eth = *(const EthernetFrameHeader*)buffer;
#ifdef ETHERNET_DEBUG
#if ETHERNET_DEBUG
dbgln("NetworkTask: From {} to {}, ether_type={:#04x}, packet_size={}", eth.source().to_string(), eth.destination().to_string(), eth.ether_type(), packet_size);
#endif
#ifdef ETHERNET_VERY_DEBUG
#if ETHERNET_VERY_DEBUG
for (size_t i = 0; i < packet_size; i++) {
klog() << String::format("%#02x", buffer[i]);
@ -170,7 +171,7 @@ void handle_arp(const EthernetFrameHeader& eth, size_t frame_size)
return;
}
#ifdef ARP_DEBUG
#if ARP_DEBUG
dbgln("handle_arp: operation={:#04x}, sender={}/{}, target={}/{}",
packet.operation(),
packet.sender_hardware_address().to_string(),
@ -224,7 +225,7 @@ void handle_ipv4(const EthernetFrameHeader& eth, size_t frame_size, const timeva
return;
}
#ifdef IPV4_DEBUG
#if IPV4_DEBUG
klog() << "handle_ipv4: source=" << packet.source().to_string().characters() << ", target=" << packet.destination().to_string().characters();
#endif
@ -244,7 +245,7 @@ void handle_ipv4(const EthernetFrameHeader& eth, size_t frame_size, const timeva
void handle_icmp(const EthernetFrameHeader& eth, const IPv4Packet& ipv4_packet, const timeval& packet_timestamp)
{
auto& icmp_header = *static_cast<const ICMPHeader*>(ipv4_packet.payload());
#ifdef ICMP_DEBUG
#if ICMP_DEBUG
dbgln("handle_icmp: source={}, destination={}, type={:#02x}, code={:#02x}", ipv4_packet.source().to_string(), ipv4_packet.destination().to_string(), icmp_header.type(), icmp_header.code());
#endif
@ -299,7 +300,7 @@ void handle_udp(const IPv4Packet& ipv4_packet, const timeval& packet_timestamp)
}
auto& udp_packet = *static_cast<const UDPPacket*>(ipv4_packet.payload());
#ifdef UDP_DEBUG
#if UDP_DEBUG
klog() << "handle_udp: source=" << ipv4_packet.source().to_string().characters() << ":" << udp_packet.source_port() << ", destination=" << ipv4_packet.destination().to_string().characters() << ":" << udp_packet.destination_port() << " length=" << udp_packet.length();
#endif
@ -336,7 +337,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const timeval& packet_timestamp)
size_t payload_size = ipv4_packet.payload_size() - tcp_packet.header_size();
#ifdef TCP_DEBUG
#if TCP_DEBUG
dbgln("handle_tcp: source={}:{}, destination={}:{}, seq_no={}, ack_no={}, flags={:#04x} ({}{}{}{}), window_size={}, payload_size={}",
ipv4_packet.source().to_string(),
tcp_packet.source_port(),
@ -361,7 +362,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const timeval& packet_timestamp)
IPv4SocketTuple tuple(ipv4_packet.destination(), tcp_packet.destination_port(), ipv4_packet.source(), tcp_packet.source_port());
#ifdef TCP_DEBUG
#if TCP_DEBUG
klog() << "handle_tcp: looking for socket; tuple=" << tuple.to_string().characters();
#endif
@ -389,7 +390,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const timeval& packet_timestamp)
ASSERT(socket->type() == SOCK_STREAM);
ASSERT(socket->local_port() == tcp_packet.destination_port());
#ifdef TCP_DEBUG
#if TCP_DEBUG
klog() << "handle_tcp: got socket; state=" << socket->tuple().to_string().characters() << " " << TCPSocket::to_string(socket->state());
#endif
@ -409,7 +410,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const timeval& packet_timestamp)
case TCPSocket::State::Listen:
switch (tcp_packet.flags()) {
case TCPFlags::SYN: {
#ifdef TCP_DEBUG
#if TCP_DEBUG
klog() << "handle_tcp: incoming connection";
#endif
auto& local_address = ipv4_packet.destination();
@ -420,7 +421,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const timeval& packet_timestamp)
return;
}
LOCKER(client->lock());
#ifdef TCP_DEBUG
#if TCP_DEBUG
klog() << "handle_tcp: created new client socket with tuple " << client->tuple().to_string().characters();
#endif
client->set_sequence_number(1000);
@ -584,7 +585,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const timeval& packet_timestamp)
socket->set_ack_number(tcp_packet.sequence_number() + payload_size);
#ifdef TCP_DEBUG
#if TCP_DEBUG
klog() << "Got packet with ack_no=" << tcp_packet.ack_number() << ", seq_no=" << tcp_packet.sequence_number() << ", payload_size=" << payload_size << ", acking it with new ack_no=" << socket->ack_number() << ", seq_no=" << socket->sequence_number();
#endif

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/MACAddress.h>
#include <Kernel/IO.h>
#include <Kernel/Net/RTL8139NetworkAdapter.h>
@ -185,7 +186,7 @@ void RTL8139NetworkAdapter::handle_irq(const RegisterState&)
m_entropy_source.add_random_event(status);
#ifdef RTL8139_DEBUG
#if RTL8139_DEBUG
klog() << "RTL8139NetworkAdapter::handle_irq status=0x" << String::format("%x", status);
#endif
@ -193,7 +194,7 @@ void RTL8139NetworkAdapter::handle_irq(const RegisterState&)
break;
if (status & INT_RXOK) {
#ifdef RTL8139_DEBUG
#if RTL8139_DEBUG
klog() << "RTL8139NetworkAdapter: rx ready";
#endif
receive();
@ -203,7 +204,7 @@ void RTL8139NetworkAdapter::handle_irq(const RegisterState&)
reset();
}
if (status & INT_TXOK) {
#ifdef RTL8139_DEBUG
#if RTL8139_DEBUG
klog() << "RTL8139NetworkAdapter: tx complete";
#endif
}
@ -291,7 +292,7 @@ void RTL8139NetworkAdapter::read_mac_address()
void RTL8139NetworkAdapter::send_raw(ReadonlyBytes payload)
{
#ifdef RTL8139_DEBUG
#if RTL8139_DEBUG
klog() << "RTL8139NetworkAdapter::send_raw length=" << payload.size();
#endif
@ -315,7 +316,7 @@ void RTL8139NetworkAdapter::send_raw(ReadonlyBytes payload)
klog() << "RTL8139NetworkAdapter: hardware buffers full; discarding packet";
return;
} else {
#ifdef RTL8139_DEBUG
#if RTL8139_DEBUG
klog() << "RTL8139NetworkAdapter: chose buffer " << hw_buffer << " @ " << PhysicalAddress(m_tx_buffers[hw_buffer]);
#endif
m_tx_next_buffer = (hw_buffer + 1) % 4;
@ -330,7 +331,7 @@ void RTL8139NetworkAdapter::send_raw(ReadonlyBytes payload)
// 60 bytes if necessary to make sure the whole thing is large enough.
auto length = payload.size();
if (length < 60) {
#ifdef RTL8139_DEBUG
#if RTL8139_DEBUG
klog() << "RTL8139NetworkAdapter: adjusting payload size from " << length << " to 60";
#endif
length = 60;
@ -346,7 +347,7 @@ void RTL8139NetworkAdapter::receive()
u16 status = *(const u16*)(start_of_packet + 0);
u16 length = *(const u16*)(start_of_packet + 2);
#ifdef RTL8139_DEBUG
#if RTL8139_DEBUG
klog() << "RTL8139NetworkAdapter::receive status=0x" << String::format("%x", status) << " length=" << length << " offset=" << m_rx_buffer_offset;
#endif

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/HashMap.h>
#include <AK/Singleton.h>
#include <Kernel/Net/LoopbackAdapter.h>
@ -179,7 +180,7 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c
return { local_adapter, local_adapter->mac_address() };
if (!local_adapter && !gateway_adapter) {
#ifdef ROUTING_DEBUG
#if ROUTING_DEBUG
klog() << "Routing: Couldn't find a suitable adapter for route to " << target.to_string().characters();
#endif
return { nullptr, {} };
@ -189,13 +190,13 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c
IPv4Address next_hop_ip;
if (local_adapter) {
#ifdef ROUTING_DEBUG
#if ROUTING_DEBUG
klog() << "Routing: Got adapter for route (direct): " << local_adapter->name().characters() << " (" << local_adapter->ipv4_address().to_string().characters() << "/" << local_adapter->ipv4_netmask().to_string().characters() << ") for " << target.to_string().characters();
#endif
adapter = local_adapter;
next_hop_ip = target;
} else if (gateway_adapter) {
#ifdef ROUTING_DEBUG
#if ROUTING_DEBUG
klog() << "Routing: Got adapter for route (using gateway " << gateway_adapter->ipv4_gateway().to_string().characters() << "): " << gateway_adapter->name().characters() << " (" << gateway_adapter->ipv4_address().to_string().characters() << "/" << gateway_adapter->ipv4_netmask().to_string().characters() << ") for " << target.to_string().characters();
#endif
adapter = gateway_adapter;
@ -208,14 +209,14 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c
LOCKER(arp_table().lock());
auto addr = arp_table().resource().get(next_hop_ip);
if (addr.has_value()) {
#ifdef ROUTING_DEBUG
#if ROUTING_DEBUG
klog() << "Routing: Using cached ARP entry for " << next_hop_ip.to_string().characters() << " (" << addr.value().to_string().characters() << ")";
#endif
return { adapter, addr.value() };
}
}
#ifdef ROUTING_DEBUG
#if ROUTING_DEBUG
klog() << "Routing: Sending ARP request via adapter " << adapter->name().characters() << " for IPv4 address " << next_hop_ip.to_string().characters();
#endif
@ -230,14 +231,14 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c
Optional<MACAddress> addr;
if (!Thread::current()->block<ARPTableBlocker>({}, next_hop_ip, addr).was_interrupted()) {
if (addr.has_value()) {
#ifdef ROUTING_DEBUG
#if ROUTING_DEBUG
klog() << "Routing: Got ARP response using adapter " << adapter->name().characters() << " for " << next_hop_ip.to_string().characters() << " (" << addr.value().to_string().characters() << ")";
#endif
return { adapter, addr.value() };
}
}
#ifdef ROUTING_DEBUG
#if ROUTING_DEBUG
klog() << "Routing: Couldn't find route using adapter " << adapter->name().characters() << " for " << target.to_string().characters();
#endif

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/Storage/Partition/DiskPartition.h>
@ -60,7 +61,7 @@ KResultOr<size_t> DiskPartition::read(FileDescription& fd, size_t offset, UserOr
{
unsigned adjust = m_metadata.start_block() * block_size();
#ifdef OFFD_DEBUG
#if OFFD_DEBUG
klog() << "DiskPartition::read offset=" << fd.offset() << " adjust=" << adjust << " len=" << len;
#endif
@ -71,7 +72,7 @@ bool DiskPartition::can_read(const FileDescription& fd, size_t offset) const
{
unsigned adjust = m_metadata.start_block() * block_size();
#ifdef OFFD_DEBUG
#if OFFD_DEBUG
klog() << "DiskPartition::can_read offset=" << offset << " adjust=" << adjust;
#endif
@ -82,7 +83,7 @@ KResultOr<size_t> DiskPartition::write(FileDescription& fd, size_t offset, const
{
unsigned adjust = m_metadata.start_block() * block_size();
#ifdef OFFD_DEBUG
#if OFFD_DEBUG
klog() << "DiskPartition::write offset=" << offset << " adjust=" << adjust << " len=" << len;
#endif
@ -93,7 +94,7 @@ bool DiskPartition::can_write(const FileDescription& fd, size_t offset) const
{
unsigned adjust = m_metadata.start_block() * block_size();
#ifdef OFFD_DEBUG
#if OFFD_DEBUG
klog() << "DiskPartition::can_write offset=" << offset << " adjust=" << adjust;
#endif

View file

@ -27,10 +27,6 @@
#include <AK/ByteBuffer.h>
#include <Kernel/Storage/Partition/EBRPartitionTable.h>
#ifndef EBR_DEBUG
# define EBR_DEBUG
#endif
namespace Kernel {
Result<NonnullOwnPtr<EBRPartitionTable>, PartitionTable::Error> EBRPartitionTable::try_to_initialize(const StorageDevice& device)

View file

@ -26,12 +26,9 @@
#include <AK/AllOf.h>
#include <AK/Array.h>
#include <AK/Debug.h>
#include <Kernel/Storage/Partition/GUIDPartitionTable.h>
#ifndef GPT_DEBUG
# define GPT_DEBUG
#endif
namespace Kernel {
#define GPT_SIGNATURE2 0x54524150
@ -103,7 +100,7 @@ bool GUIDPartitionTable::initialize()
return false;
}
#ifdef GPT_DEBUG
#if GPT_DEBUG
klog() << "GUIDPartitionTable: signature - 0x" << String::format("%x", header().sig[1]) << String::format("%x", header().sig[0]);
#endif

View file

@ -25,12 +25,9 @@
*/
#include <AK/ByteBuffer.h>
#include <AK/Debug.h>
#include <Kernel/Storage/Partition/MBRPartitionTable.h>
#ifndef MBR_DEBUG
# define MBR_DEBUG
#endif
namespace Kernel {
#define MBR_SIGNATURE 0xaa55
@ -123,7 +120,7 @@ const MBRPartitionTable::Header& MBRPartitionTable::header() const
bool MBRPartitionTable::initialize()
{
auto& header = this->header();
#ifdef MBR_DEBUG
#if MBR_DEBUG
klog() << "Master Boot Record: mbr_signature=0x" << String::format("%x", header.mbr_signature);

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/Memory.h>
#include <AK/StringView.h>
#include <Kernel/FileSystem/FileDescription.h>
@ -63,7 +64,7 @@ KResultOr<size_t> StorageDevice::read(FileDescription&, size_t offset, UserOrKer
remaining = 0;
}
#ifdef STORAGE_DEVICE_DEBUG
#if STORAGE_DEVICE_DEBUG
klog() << "StorageDevice::read() index=" << index << " whole_blocks=" << whole_blocks << " remaining=" << remaining;
#endif
@ -130,7 +131,7 @@ KResultOr<size_t> StorageDevice::write(FileDescription&, size_t offset, const Us
remaining = 0;
}
#ifdef STORAGE_DEVICE_DEBUG
#if STORAGE_DEVICE_DEBUG
klog() << "StorageDevice::write() index=" << index << " whole_blocks=" << whole_blocks << " remaining=" << remaining;
#endif

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/LexicalPath.h>
#include <AK/ScopeGuard.h>
#include <AK/TemporaryChange.h>
@ -446,7 +447,7 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
ASSERT(is_user_process());
ASSERT(!Processor::current().in_critical());
auto path = main_program_description->absolute_path();
#ifdef EXEC_DEBUG
#if EXEC_DEBUG
dbgln("do_exec({})", path);
#endif
@ -511,7 +512,7 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
kill_threads_except_self();
#ifdef EXEC_DEBUG
#if EXEC_DEBUG
dbgln("Memory layout after ELF load:");
dump_regions();
#endif
@ -703,7 +704,7 @@ KResultOr<RefPtr<FileDescription>> Process::find_elf_interpreter_for_executable(
if (!interpreter_path.is_empty()) {
#ifdef EXEC_DEBUG
#if EXEC_DEBUG
dbgln("exec({}): Using program interpreter {}", path, interpreter_path);
#endif
auto interp_result = VFS::the().open(interpreter_path, O_EXEC, 0, current_directory());

View file

@ -50,7 +50,7 @@ RefPtr<VMObject> AnonymousVMObject::clone()
});
}
#ifdef COMMIT_DEBUG
#if COMMIT_DEBUG
klog() << "Cloning " << this << ", need " << need_cow_pages << " committed cow pages";
#endif
if (!MM.commit_user_physical_pages(need_cow_pages))
@ -311,7 +311,7 @@ void AnonymousVMObject::range_made_volatile(const VolatilePageRange& range)
// Return those committed pages back to the system
if (uncommit_page_count > 0) {
#ifdef COMMIT_DEBUG
#if COMMIT_DEBUG
klog() << "Uncommit " << uncommit_page_count << " lazy-commit pages from " << this;
#endif
MM.uncommit_user_physical_pages(uncommit_page_count);
@ -364,7 +364,7 @@ size_t AnonymousVMObject::mark_committed_pages_for_nonvolatile_range(const Volat
}
}
#ifdef COMMIT_DEBUG
#if COMMIT_DEBUG
klog() << "Added " << pages_updated << " lazy-commit pages to " << this;
#endif
m_unused_committed_pages += pages_updated;

View file

@ -25,6 +25,7 @@
*/
#include <AK/BinarySearch.h>
#include <AK/Debug.h>
#include <AK/ScopeGuard.h>
#include <Kernel/Process.h>
#include <Kernel/VM/AnonymousVMObject.h>
@ -34,7 +35,7 @@
namespace Kernel {
#ifdef VOLATILE_PAGE_RANGES_DEBUG
#if VOLATILE_PAGE_RANGES_DEBUG
inline LogStream& operator<<(const LogStream& stream, const VolatilePageRange& range)
{
stream << "{" << range.base << " (" << range.count << ") purged: " << range.was_purged << "}";
@ -65,7 +66,7 @@ bool VolatilePageRanges::add(const VolatilePageRange& range)
return false;
add_range.was_purged = range.was_purged;
#ifdef VOLATILE_PAGE_RANGES_DEBUG
#if VOLATILE_PAGE_RANGES_DEBUG
klog() << "ADD " << range << " (total range: " << m_total_range << ") -->";
dump_volatile_page_ranges(m_ranges);
ScopeGuard debug_guard([&]() {
@ -139,7 +140,7 @@ bool VolatilePageRanges::remove(const VolatilePageRange& range, bool& was_purged
if (remove_range.is_empty())
return false;
#ifdef VOLATILE_PAGE_RANGES_DEBUG
#if VOLATILE_PAGE_RANGES_DEBUG
klog() << "REMOVE " << range << " (total range: " << m_total_range << ") -->";
dump_volatile_page_ranges(m_ranges);
ScopeGuard debug_guard([&]() {

View file

@ -90,7 +90,79 @@ set(LOCK_TRACE_DEBUG ON)
set(LOCK_RESTORE_DEBUG ON)
set(FUTEXQUEUE_DEBUG ON)
set(FUTEX_DEBUG ON)
set(UHCI_DEBUG ON)
set(APIC_DEBUG ON)
set(APIC_SMP_DEBUG ON)
set(ARP_DEBUG ON)
set(AWAVLOADER_DEBUG ON)
set(BBFS_DEBUG ON)
set(CALLBACK_MACHINE_DEBUG ON)
set(CHTTPJOB_DEBUG ON)
set(COMMIT_DEBUG ON)
set(AUTOCOMPLETE_DEBUG ON)
set(CPP_LANGUAGE_SERVER_DEBUG ON)
set(DIFF_DEBUG ON)
set(HIGHLIGHT_FOCUSED_FRAME_DEBUG ON)
set(ITEM_RECTS_DEBUG ON)
set(SH_LANGUAGE_SERVER_DEBUG ON)
set(STRINGIMPL_DEBUG ON)
set(TEXTEDITOR_DEBUG ON)
set(DEFERRED_INVOKE_DEBUG ON)
set(DYNAMIC_LOAD_DEBUG ON)
set(EDITOR_DEBUG ON)
set(ELF_IMAGE_DEBUG ON)
set(ETHERNET_DEBUG ON)
set(ETHERNET_VERY_DEBUG ON)
set(EVENT_DEBUG ON)
set(EVENTLOOP_DEBUG ON)
set(EXEC_DEBUG ON)
set(EXT2_DEBUG ON)
set(EXT2_VERY_DEBUG ON)
set(FIFO_DEBUG ON)
set(GEMINI_DEBUG ON)
set(GEMINIJOB_DEBUG ON)
set(GENERATE_DEBUG_CODE ON)
set(GLOBAL_DTORS_DEBUG ON)
set(GMENU_DEBUG ON)
set(HEAP_DEBUG ON)
set(HEX_DEBUG ON)
set(HTTPSJOB_DEBUG ON)
set(ICMP_DEBUG ON)
set(ICO_DEBUG ON)
set(IPV4_DEBUG ON)
set(IRC_DEBUG ON)
set(KEYBOARD_DEBUG ON)
set(KMALLOC_DEBUG_LARGE_ALLOCATIONS ON)
set(LEXER_DEBUG ON)
set(LOOKUPSERVER_DEBUG ON)
set(MALLOC_DEBUG ON)
set(MBR_DEBUG ON)
set(MEMORY_DEBUG ON)
set(MENU_DEBUG ON)
set(NETWORK_TASK_DEBUG ON)
set(OBJECT_DEBUG ON)
set(OFFD_DEBUG ON)
set(PTHREAD_DEBUG ON)
set(REACHABLE_DEBUG ON)
set(ROUTING_DEBUG ON)
set(RTL8139_DEBUG ON)
set(SB16_DEBUG ON)
set(SH_DEBUG ON)
set(STORAGE_DEVICE_DEBUG ON)
set(TCP_DEBUG ON)
set(TERMCAP_DEBUG ON)
set(TERMINAL_DEBUG ON)
set(UCI_DEBUG ON)
set(UDP_DEBUG ON)
set(UHCI_VERBOSE_DEBUG ON)
set(UPDATE_COALESCING_DEBUG ON)
set(VOLATILE_PAGE_RANGES_DEBUG ON)
set(WSMESSAGELOOP_DEBUG ON)
set(GPT_DEBUG ON)
# False positive: DEBUG is a flag but it works differently.
# set(DEBUG ON)
# False positive: LOG_DEBUG is a flag, but for a bitset, not a feature.
# add_compile_definitions("LOG_DEBUG=ON")
# set(LOG_DEBUG ON)
# Clogs up build: The WrapperGenerator stuff is run at compile time.
# add_compile_definitions("WRAPPER_GERNERATOR_DEBUG=ON")
# set(WRAPPER_GENERATOR_DEBUG ON)

View file

@ -25,6 +25,7 @@
*/
#include "HexEditor.h"
#include <AK/Debug.h>
#include <AK/StringBuilder.h>
#include <LibGUI/Action.h>
#include <LibGUI/Clipboard.h>
@ -222,7 +223,7 @@ void HexEditor::mousedown_event(GUI::MouseEvent& event)
if (offset < 0 || offset >= static_cast<int>(m_buffer.size()))
return;
#ifdef HEX_DEBUG
#if HEX_DEBUG
outln("HexEditor::mousedown_event(hex): offset={}", offset);
#endif
@ -244,7 +245,7 @@ void HexEditor::mousedown_event(GUI::MouseEvent& event)
if (offset < 0 || offset >= static_cast<int>(m_buffer.size()))
return;
#ifdef HEX_DEBUG
#if HEX_DEBUG
outln("HexEditor::mousedown_event(text): offset={}", offset);
#endif
@ -344,7 +345,7 @@ void HexEditor::scroll_position_into_view(int position)
void HexEditor::keydown_event(GUI::KeyEvent& event)
{
#ifdef HEX_DEBUG
#if HEX_DEBUG
outln("HexEditor::keydown_event key={}", static_cast<u8>(event.key()));
#endif

View file

@ -31,6 +31,7 @@
#include "IRCQuery.h"
#include "IRCWindow.h"
#include "IRCWindowListModel.h"
#include <AK/Debug.h>
#include <AK/QuickSort.h>
#include <AK/StringBuilder.h>
#include <LibCore/DateTime.h>
@ -39,10 +40,6 @@
#include <stdio.h>
#include <strings.h>
#ifndef IRC_DEBUG
# define IRC_DEBUG
#endif
enum IRCNumeric {
RPL_WELCOME = 1,
RPL_WHOISUSER = 311,
@ -255,7 +252,7 @@ void IRCClient::send_whois(const String& nick)
void IRCClient::handle(const Message& msg)
{
#ifdef IRC_DEBUG
#if IRC_DEBUG
outln("IRCClient::execute: prefix='{}', command='{}', arguments={}",
msg.prefix,
msg.command,
@ -486,7 +483,7 @@ void IRCClient::handle_privmsg_or_notice(const Message& msg, PrivmsgOrNotice typ
bool is_ctcp = has_ctcp_payload(msg.arguments[1]);
#ifdef IRC_DEBUG
#if IRC_DEBUG
outln("handle_privmsg_or_notice: type='{}'{}, sender_nick='{}', target='{}'",
type == PrivmsgOrNotice::Privmsg ? "privmsg" : "notice",
is_ctcp ? " (ctcp)" : "",

View file

@ -30,6 +30,7 @@
#include "HackStudio.h"
#include "Language.h"
#include <AK/ByteBuffer.h>
#include <AK/Debug.h>
#include <AK/LexicalPath.h>
#include <LibCore/DirIterator.h>
#include <LibCore/File.h>
@ -153,7 +154,7 @@ void Editor::show_documentation_tooltip_if_available(const String& hovered_token
{
auto it = man_paths().find(hovered_token);
if (it == man_paths().end()) {
#ifdef EDITOR_DEBUG
#if EDITOR_DEBUG
dbgln("no man path for {}", hovered_token);
#endif
m_documentation_tooltip_window->hide();
@ -164,7 +165,7 @@ void Editor::show_documentation_tooltip_if_available(const String& hovered_token
return;
}
#ifdef EDITOR_DEBUG
#if EDITOR_DEBUG
dbgln("opening {}", it->value);
#endif
auto file = Core::File::construct(it->value);
@ -235,7 +236,7 @@ void Editor::mousemove_event(GUI::MouseEvent& event)
auto end_line_length = document().line(span.range.end().line()).length();
adjusted_range.end().set_column(min(end_line_length, adjusted_range.end().column() + 1));
auto hovered_span_text = document().text_in_range(adjusted_range);
#ifdef EDITOR_DEBUG
#if EDITOR_DEBUG
dbgln("Hovering: {} \"{}\"", adjusted_range, hovered_span_text);
#endif
@ -301,7 +302,7 @@ void Editor::mousedown_event(GUI::MouseEvent& event)
adjusted_range.end().set_column(adjusted_range.end().column() + 1);
auto span_text = document().text_in_range(adjusted_range);
auto header_path = span_text.substring(1, span_text.length() - 2);
#ifdef EDITOR_DEBUG
#if EDITOR_DEBUG
dbgln("Ctrl+click: {} \"{}\"", adjusted_range, header_path);
#endif
navigate_to_include_if_available(header_path);
@ -333,7 +334,7 @@ static HashMap<String, String>& include_paths()
auto path = it.next_full_path();
if (!Core::File::is_directory(path)) {
auto key = path.substring(base.length() + 1, path.length() - base.length() - 1);
#ifdef EDITOR_DEBUG
#if EDITOR_DEBUG
dbgln("Adding header \"{}\" in path \"{}\"", key, path);
#endif
paths.set(key, path);
@ -357,7 +358,7 @@ void Editor::navigate_to_include_if_available(String path)
{
auto it = include_paths().find(path);
if (it == include_paths().end()) {
#ifdef EDITOR_DEBUG
#if EDITOR_DEBUG
dbgln("no header {} found.", path);
#endif
return;

View file

@ -25,6 +25,7 @@
*/
#include "DiffViewer.h"
#include <AK/Debug.h>
#include <LibDiff/Hunks.h>
#include <LibGUI/AbstractView.h>
#include <LibGUI/Painter.h>
@ -159,7 +160,7 @@ void DiffViewer::set_content(const String& original, const String& diff)
m_original_lines = split_to_lines(original);
m_hunks = Diff::parse_hunks(diff);
#ifdef DEBUG_DIFF
#if DIFF_DEBUG
for (size_t i = 0; i < m_original_lines.size(); ++i)
dbgln("{}:{}", i, m_original_lines[i]);
#endif

View file

@ -25,6 +25,7 @@
*/
#include "AutoComplete.h"
#include <AK/Debug.h>
#include <AK/HashTable.h>
#include <LibCpp/Lexer.h>
@ -42,7 +43,7 @@ Vector<GUI::AutocompleteProvider::Entry> AutoComplete::get_suggestions(const Str
auto suggestions = identifier_prefixes(lines, tokens, index_of_target_token.value());
#ifdef DEBUG_AUTOCOMPLETE
#if AUTOCOMPLETE_DEBUG
for (auto& suggestion : suggestions) {
dbgln("suggestion: {}", suggestion.completion);
}

View file

@ -92,7 +92,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileOpened& messag
void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText& message)
{
#ifdef DEBUG_CPP_LANGUAGE_SERVER
#if CPP_LANGUAGE_SERVER_DEBUG
dbgln("InsertText for file: {}", message.file_name());
dbgln("Text: {}", message.text());
dbgln("[{}:{}]", message.start_line(), message.start_column());
@ -111,7 +111,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText
void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText& message)
{
#ifdef DEBUG_CPP_LANGUAGE_SERVER
#if CPP_LANGUAGE_SERVER_DEBUG
dbgln("RemoveText for file: {}", message.file_name());
dbgln("[{}:{} - {}:{}]", message.start_line(), message.start_column(), message.end_line(), message.end_column());
#endif
@ -136,7 +136,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText
void ClientConnection::handle(const Messages::LanguageServer::AutoCompleteSuggestions& message)
{
#ifdef DEBUG_CPP_LANGUAGE_SERVER
#if CPP_LANGUAGE_SERVER_DEBUG
dbgln("AutoCompleteSuggestions for: {} {}:{}", message.file_name(), message.cursor_line(), message.cursor_column());
#endif

View file

@ -40,7 +40,7 @@ Vector<GUI::AutocompleteProvider::Entry> AutoComplete::get_suggestions(const Str
if (!ast)
return {};
#ifdef DEBUG_AUTOCOMPLETE
#if AUTOCOMPLETE_DEBUG
dbgln("Complete '{}'", code);
ast->dump(1);
dbgln("At offset {}", offset);
@ -49,7 +49,7 @@ Vector<GUI::AutocompleteProvider::Entry> AutoComplete::get_suggestions(const Str
auto result = ast->complete_for_editor(m_shell, offset);
Vector<GUI::AutocompleteProvider::Entry> completions;
for (auto& entry : result) {
#ifdef DEBUG_AUTOCOMPLETE
#if AUTOCOMPLETE_DEBUG
dbgln("Suggestion: '{}' starting at {}", entry.text_string, entry.input_offset);
#endif
completions.append({ entry.text_string, entry.input_offset });

View file

@ -92,7 +92,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileOpened& messag
void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText& message)
{
#ifdef DEBUG_SH_LANGUAGE_SERVER
#if SH_LANGUAGE_SERVER_DEBUG
dbgln("InsertText for file: {}", message.file_name());
dbgln("Text: {}", message.text());
dbgln("[{}:{}]", message.start_line(), message.start_column());
@ -111,7 +111,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText
void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText& message)
{
#ifdef DEBUG_SH_LANGUAGE_SERVER
#if SH_LANGUAGE_SERVER_DEBUG
dbgln("RemoveText for file: {}", message.file_name());
dbgln("[{}:{} - {}:{}]", message.start_line(), message.start_column(), message.end_line(), message.end_column());
#endif
@ -134,7 +134,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText
void ClientConnection::handle(const Messages::LanguageServer::AutoCompleteSuggestions& message)
{
#ifdef DEBUG_SH_LANGUAGE_SERVER
#if SH_LANGUAGE_SERVER_DEBUG
dbgln("AutoCompleteSuggestions for: {} {}:{}", message.file_name(), message.cursor_line(), message.cursor_column());
#endif

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/Function.h>
#include <AK/GenericLexer.h>
#include <AK/HashMap.h>
@ -443,7 +444,7 @@ public:
stream >> message_endpoint_magic;
if (stream.handle_any_error()) {
)~~~");
#ifdef GENERATE_DEBUG_CODE
#if GENERATE_DEBUG_CODE
endpoint_generator.append(R"~~~(
dbgln("Failed to read message endpoint magic");
)~~~");
@ -454,7 +455,7 @@ public:
if (message_endpoint_magic != @endpoint.magic@) {
)~~~");
#ifdef GENERATE_DEBUG_CODE
#if GENERATE_DEBUG_CODE
endpoint_generator.append(R"~~~(
dbgln("Endpoint magic number message_endpoint_magic != @endpoint.magic@");
)~~~");
@ -467,7 +468,7 @@ public:
stream >> message_id;
if (stream.handle_any_error()) {
)~~~");
#ifdef GENERATE_DEBUG_CODE
#if GENERATE_DEBUG_CODE
endpoint_generator.append(R"~~~(
dbgln("Failed to read message ID");
)~~~");
@ -501,7 +502,7 @@ public:
endpoint_generator.append(R"~~~(
default:
)~~~");
#ifdef GENERATE_DEBUG_CODE
#if GENERATE_DEBUG_CODE
endpoint_generator.append(R"~~~(
dbgln("Failed to decode @endpoint.name@.({})", message_id);
)~~~");
@ -512,7 +513,7 @@ public:
if (stream.handle_any_error()) {
)~~~");
#ifdef GENERATE_DEBUG_CODE
#if GENERATE_DEBUG_CODE
endpoint_generator.append(R"~~~(
dbgln("Failed to read the message");
)~~~");

View file

@ -27,6 +27,7 @@
#include "MallocTracer.h"
#include "Emulator.h"
#include "MmapRegion.h"
#include <AK/Debug.h>
#include <AK/LogStream.h>
#include <AK/TemporaryChange.h>
#include <mallocdefs.h>
@ -309,7 +310,7 @@ bool MallocTracer::is_reachable(const Mallocation& mallocation) const
for (size_t i = 0; i < pointers_in_mallocation; ++i) {
auto value = m_emulator.mmu().read32({ 0x23, other_mallocation.address + i * sizeof(u32) });
if (value.value() == mallocation.address && !value.is_uninitialized()) {
#ifdef REACHABLE_DEBUG
#if REACHABLE_DEBUG
reportln("mallocation {:p} is reachable from other mallocation {:p}", mallocation.address, other_mallocation.address);
#endif
reachable = true;
@ -339,7 +340,7 @@ bool MallocTracer::is_reachable(const Mallocation& mallocation) const
for (size_t i = 0; i < pointers_in_region; ++i) {
auto value = region.read32(i * sizeof(u32));
if (value.value() == mallocation.address && !value.is_uninitialized()) {
#ifdef REACHABLE_DEBUG
#if REACHABLE_DEBUG
reportln("mallocation {:p} is reachable from region {:p}-{:p}", mallocation.address, region.base(), region.end() - 1);
#endif
reachable = true;

View file

@ -27,6 +27,7 @@
#include "SoftCPU.h"
#include "Emulator.h"
#include <AK/Assertions.h>
#include <AK/Debug.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
@ -147,7 +148,7 @@ ValueWithShadow<u8> SoftCPU::read_memory8(X86::LogicalAddress address)
{
ASSERT(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b);
auto value = m_emulator.mmu().read8(address);
#ifdef MEMORY_DEBUG
#if MEMORY_DEBUG
outln("\033[36;1mread_memory8: @{:04x}:{:08x} -> {:02x} ({:02x})\033[0m", address.selector(), address.offset(), value, value.shadow());
#endif
return value;
@ -157,7 +158,7 @@ ValueWithShadow<u16> SoftCPU::read_memory16(X86::LogicalAddress address)
{
ASSERT(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b);
auto value = m_emulator.mmu().read16(address);
#ifdef MEMORY_DEBUG
#if MEMORY_DEBUG
outln("\033[36;1mread_memory16: @{:04x}:{:08x} -> {:04x} ({:04x})\033[0m", address.selector(), address.offset(), value, value.shadow());
#endif
return value;
@ -167,7 +168,7 @@ ValueWithShadow<u32> SoftCPU::read_memory32(X86::LogicalAddress address)
{
ASSERT(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b);
auto value = m_emulator.mmu().read32(address);
#ifdef MEMORY_DEBUG
#if MEMORY_DEBUG
outln("\033[36;1mread_memory32: @{:04x}:{:08x} -> {:08x} ({:08x})\033[0m", address.selector(), address.offset(), value, value.shadow());
#endif
return value;
@ -177,7 +178,7 @@ ValueWithShadow<u64> SoftCPU::read_memory64(X86::LogicalAddress address)
{
ASSERT(address.selector() == 0x1b || address.selector() == 0x23 || address.selector() == 0x2b);
auto value = m_emulator.mmu().read64(address);
#ifdef MEMORY_DEBUG
#if MEMORY_DEBUG
outln("\033[36;1mread_memory64: @{:04x}:{:08x} -> {:016x} ({:016x})\033[0m", address.selector(), address.offset(), value, value.shadow());
#endif
return value;
@ -186,7 +187,7 @@ ValueWithShadow<u64> SoftCPU::read_memory64(X86::LogicalAddress address)
void SoftCPU::write_memory8(X86::LogicalAddress address, ValueWithShadow<u8> value)
{
ASSERT(address.selector() == 0x23 || address.selector() == 0x2b);
#ifdef MEMORY_DEBUG
#if MEMORY_DEBUG
outln("\033[36;1mwrite_memory8: @{:04x}:{:08x} <- {:02x} ({:02x})\033[0m", address.selector(), address.offset(), value, value.shadow());
#endif
m_emulator.mmu().write8(address, value);
@ -195,7 +196,7 @@ void SoftCPU::write_memory8(X86::LogicalAddress address, ValueWithShadow<u8> val
void SoftCPU::write_memory16(X86::LogicalAddress address, ValueWithShadow<u16> value)
{
ASSERT(address.selector() == 0x23 || address.selector() == 0x2b);
#ifdef MEMORY_DEBUG
#if MEMORY_DEBUG
outln("\033[36;1mwrite_memory16: @{:04x}:{:08x} <- {:04x} ({:04x})\033[0m", address.selector(), address.offset(), value, value.shadow());
#endif
m_emulator.mmu().write16(address, value);
@ -204,7 +205,7 @@ void SoftCPU::write_memory16(X86::LogicalAddress address, ValueWithShadow<u16> v
void SoftCPU::write_memory32(X86::LogicalAddress address, ValueWithShadow<u32> value)
{
ASSERT(address.selector() == 0x23 || address.selector() == 0x2b);
#ifdef MEMORY_DEBUG
#if MEMORY_DEBUG
outln("\033[36;1mwrite_memory32: @{:04x}:{:08x} <- {:08x} ({:08x})\033[0m", address.selector(), address.offset(), value, value.shadow());
#endif
m_emulator.mmu().write32(address, value);
@ -213,7 +214,7 @@ void SoftCPU::write_memory32(X86::LogicalAddress address, ValueWithShadow<u32> v
void SoftCPU::write_memory64(X86::LogicalAddress address, ValueWithShadow<u64> value)
{
ASSERT(address.selector() == 0x23 || address.selector() == 0x2b);
#ifdef MEMORY_DEBUG
#if MEMORY_DEBUG
outln("\033[36;1mwrite_memory64: @{:04x}:{:08x} <- {:016x} ({:016x})\033[0m", address.selector(), address.offset(), value, value.shadow());
#endif
m_emulator.mmu().write64(address, value);

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/NumericLimits.h>
#include <AK/OwnPtr.h>
#include <LibAudio/Buffer.h>
@ -70,7 +71,7 @@ bool WavLoaderPlugin::sniff()
RefPtr<Buffer> WavLoaderPlugin::get_more_samples(size_t max_bytes_to_read_from_input)
{
#ifdef AWAVLOADER_DEBUG
#if AWAVLOADER_DEBUG
dbgln("Read WAV of format PCM with num_channels {} sample rate {}, bits per sample {}", m_num_channels, m_sample_rate, m_bits_per_sample);
#endif
size_t samples_to_read = static_cast<int>(max_bytes_to_read_from_input) / (m_num_channels * (m_bits_per_sample / 8));

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@ -62,7 +63,7 @@ void __cxa_finalize(void* dso_handle)
int entry_index = __exit_entry_count;
#ifdef GLOBAL_DTORS_DEBUG
#if GLOBAL_DTORS_DEBUG
dbgprintf("__cxa_finalize: %d entries in the finalizer list\n", entry_index);
#endif
@ -70,7 +71,7 @@ void __cxa_finalize(void* dso_handle)
auto& exit_entry = __exit_entries[entry_index];
bool needs_calling = !exit_entry.has_been_called && (!dso_handle || dso_handle == exit_entry.dso_handle);
if (needs_calling) {
#ifdef GLOBAL_DTORS_DEBUG
#if GLOBAL_DTORS_DEBUG
dbgprintf("__cxa_finalize: calling entry[%d] %p(%p) dso: %p\n", entry_index, exit_entry.method, exit_entry.parameter, exit_entry.dso_handle);
#endif
exit_entry.method(exit_entry.parameter);

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/InlineLinkedList.h>
#include <AK/LogStream.h>
#include <AK/ScopedValueRollback.h>
@ -257,13 +258,13 @@ static void* malloc_impl(size_t size)
block->m_freelist = block->m_freelist->next;
if (block->is_full()) {
g_malloc_stats.number_of_blocks_full++;
#ifdef MALLOC_DEBUG
#if MALLOC_DEBUG
dbgprintf("Block %p is now full in size class %zu\n", block, good_size);
#endif
allocator->usable_blocks.remove(block);
allocator->full_blocks.append(block);
}
#ifdef MALLOC_DEBUG
#if MALLOC_DEBUG
dbgprintf("LibC: allocated %p (chunk in block %p, size %zu)\n", ptr, block, block->bytes_per_chunk());
#endif
@ -316,7 +317,7 @@ static void free_impl(void* ptr)
assert(magic == MAGIC_PAGE_HEADER);
auto* block = (ChunkedBlock*)block_base;
#ifdef MALLOC_DEBUG
#if MALLOC_DEBUG
dbgprintf("LibC: freeing %p in allocator %p (size=%zu, used=%zu)\n", ptr, block, block->bytes_per_chunk(), block->used_chunks());
#endif
@ -330,7 +331,7 @@ static void free_impl(void* ptr)
if (block->is_full()) {
size_t good_size;
auto* allocator = allocator_for_size(block->m_size, good_size);
#ifdef MALLOC_DEBUG
#if MALLOC_DEBUG
dbgprintf("Block %p no longer full in size class %zu\n", block, good_size);
#endif
g_malloc_stats.number_of_freed_full_blocks++;
@ -344,7 +345,7 @@ static void free_impl(void* ptr)
size_t good_size;
auto* allocator = allocator_for_size(block->m_size, good_size);
if (allocator->block_count < number_of_chunked_blocks_to_keep_around_per_size_class) {
#ifdef MALLOC_DEBUG
#if MALLOC_DEBUG
dbgprintf("Keeping block %p around for size class %zu\n", block, good_size);
#endif
g_malloc_stats.number_of_keeps++;
@ -354,7 +355,7 @@ static void free_impl(void* ptr)
madvise(block, ChunkedBlock::block_size, MADV_SET_VOLATILE);
return;
}
#ifdef MALLOC_DEBUG
#if MALLOC_DEBUG
dbgprintf("Releasing block %p for size class %zu\n", block, good_size);
#endif
g_malloc_stats.number_of_frees++;

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/HashMap.h>
#include <AK/String.h>
#include <AK/Vector.h>
@ -40,7 +41,7 @@ char* BC;
int tgetent([[maybe_unused]] char* bp, [[maybe_unused]] const char* name)
{
#ifdef TERMCAP_DEBUG
#if TERMCAP_DEBUG
fprintf(stderr, "tgetent: bp=%p, name='%s'\n", bp, name);
#endif
PC = '\0';
@ -100,7 +101,7 @@ static void ensure_caps()
char* tgetstr(const char* id, char** area)
{
ensure_caps();
#ifdef TERMCAP_DEBUG
#if TERMCAP_DEBUG
fprintf(stderr, "tgetstr: id='%s'\n", id);
#endif
auto it = caps->find(id);
@ -119,7 +120,7 @@ char* tgetstr(const char* id, char** area)
int tgetflag([[maybe_unused]] const char* id)
{
#ifdef TERMCAP_DEBUG
#if TERMCAP_DEBUG
fprintf(stderr, "tgetflag: '%s'\n", id);
#endif
auto it = caps->find(id);
@ -130,7 +131,7 @@ int tgetflag([[maybe_unused]] const char* id)
int tgetnum(const char* id)
{
#ifdef TERMCAP_DEBUG
#if TERMCAP_DEBUG
fprintf(stderr, "tgetnum: '%s'\n", id);
#endif
auto it = caps->find(id);

View file

@ -26,6 +26,7 @@
#include "UCIEndpoint.h"
#include <AK/ByteBuffer.h>
#include <AK/Debug.h>
#include <AK/String.h>
#include <LibCore/EventLoop.h>
#include <LibCore/File.h>
@ -42,7 +43,7 @@ Endpoint::Endpoint(NonnullRefPtr<Core::IODevice> in, NonnullRefPtr<Core::IODevic
void Endpoint::send_command(const Command& command)
{
#ifdef UCI_DEBUG
#if UCI_DEBUG
dbgln("{} Sent UCI Command: {}", class_name(), String(command.to_string().characters(), Chomp));
#endif
m_out->write(command.to_string());
@ -93,7 +94,7 @@ NonnullOwnPtr<Command> Endpoint::read_command()
{
String line(ReadonlyBytes(m_in->read_line(4096).bytes()), Chomp);
#ifdef UCI_DEBUG
#if UCI_DEBUG
dbgln("{} Received UCI Command: {}", class_name(), line);
#endif

View file

@ -26,6 +26,7 @@
#include <AK/Badge.h>
#include <AK/ByteBuffer.h>
#include <AK/Debug.h>
#include <AK/IDAllocator.h>
#include <AK/JsonObject.h>
#include <AK/JsonValue.h>
@ -306,7 +307,7 @@ EventLoop::EventLoop()
#endif
}
#ifdef EVENTLOOP_DEBUG
#if EVENTLOOP_DEBUG
dbgln("{} Core::EventLoop constructed :)", getpid());
#endif
}
@ -344,7 +345,7 @@ EventLoop& EventLoop::current()
void EventLoop::quit(int code)
{
#ifdef EVENTLOOP_DEBUG
#if EVENTLOOP_DEBUG
dbgln("Core::EventLoop::quit({})", code);
#endif
m_exit_requested = true;
@ -353,7 +354,7 @@ void EventLoop::quit(int code)
void EventLoop::unquit()
{
#ifdef EVENTLOOP_DEBUG
#if EVENTLOOP_DEBUG
dbgln("Core::EventLoop::unquit()");
#endif
m_exit_requested = false;
@ -407,7 +408,7 @@ void EventLoop::pump(WaitMode mode)
auto& queued_event = events.at(i);
auto receiver = queued_event.receiver.strong_ref();
auto& event = *queued_event.event;
#ifdef EVENTLOOP_DEBUG
#if EVENTLOOP_DEBUG
if (receiver)
dbgln("Core::EventLoop: {} event {}", *receiver, event.type());
#endif
@ -417,13 +418,13 @@ void EventLoop::pump(WaitMode mode)
ASSERT_NOT_REACHED();
return;
default:
#ifdef EVENTLOOP_DEBUG
#if EVENTLOOP_DEBUG
dbgln("Event type {} with no receiver :(", event.type());
#endif
break;
}
} else if (event.type() == Event::Type::DeferredInvoke) {
#ifdef DEFERRED_INVOKE_DEBUG
#if DEFERRED_INVOKE_DEBUG
dbgln("DeferredInvoke: receiver = {}", *receiver);
#endif
static_cast<DeferredInvocationEvent&>(event).m_invokee(*receiver);
@ -434,7 +435,7 @@ void EventLoop::pump(WaitMode mode)
if (m_exit_requested) {
LOCKER(m_private->lock);
#ifdef EVENTLOOP_DEBUG
#if EVENTLOOP_DEBUG
dbgln("Core::EventLoop: Exit requested. Rejigging {} events.", events.size() - i);
#endif
decltype(m_queued_events) new_event_queue;
@ -451,7 +452,7 @@ void EventLoop::pump(WaitMode mode)
void EventLoop::post_event(Object& receiver, NonnullOwnPtr<Event>&& event)
{
LOCKER(m_private->lock);
#ifdef EVENTLOOP_DEBUG
#if EVENTLOOP_DEBUG
dbgln("Core::EventLoop::post_event: ({}) << receivier={}, event={}", m_queued_events.size(), receiver, event);
#endif
m_queued_events.empend(receiver, move(event));
@ -461,14 +462,14 @@ SignalHandlers::SignalHandlers(int signo, void (*handle_signal)(int))
: m_signo(signo)
, m_original_handler(signal(signo, handle_signal))
{
#ifdef EVENTLOOP_DEBUG
#if EVENTLOOP_DEBUG
dbgln("Core::EventLoop: Registered handler for signal {}", m_signo);
#endif
}
SignalHandlers::~SignalHandlers()
{
#ifdef EVENTLOOP_DEBUG
#if EVENTLOOP_DEBUG
dbgln("Core::EventLoop: Unregistering handler for signal {}", m_signo);
#endif
signal(m_signo, m_original_handler);
@ -534,7 +535,7 @@ void EventLoop::dispatch_signal(int signo)
// This allows a handler to unregister/register while the handlers
// are being called!
auto handler = handlers->value;
#ifdef EVENTLOOP_DEBUG
#if EVENTLOOP_DEBUG
dbgln("Core::EventLoop: dispatching signal {}", signo);
#endif
handler->dispatch();
@ -676,7 +677,7 @@ try_select_again:
return;
goto try_select_again;
}
#ifdef EVENTLOOP_DEBUG
#if EVENTLOOP_DEBUG
dbgln("Core::EventLoop::wait_for_event: {} ({}: {})", marked_fd_count, saved_errno, strerror(saved_errno));
#endif
// Blow up, similar to Core::safe_syscall.
@ -719,7 +720,7 @@ try_select_again:
&& owner && !owner->is_visible_for_timer_purposes()) {
continue;
}
#ifdef EVENTLOOP_DEBUG
#if EVENTLOOP_DEBUG
dbgln("Core::EventLoop: Timer {} has expired, sending Core::TimerEvent to {}", timer.timer_id, *owner);
#endif
if (owner)

View file

@ -25,6 +25,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/StringBuilder.h>
#include <LibELF/DynamicLoader.h>
#include <LibELF/Validation.h>
@ -36,10 +37,6 @@
#include <string.h>
#include <sys/mman.h>
#ifndef DYNAMIC_LOAD_DEBUG
# define DYNAMIC_LOAD_DEBUG
#endif
#ifdef DYNAMIC_LOAD_VERBOSE
# define VERBOSE(fmt, ...) dbgprintf(fmt, ##__VA_ARGS__)
#else
@ -173,7 +170,7 @@ bool DynamicLoader::load_stage_2(unsigned flags, size_t total_tls_size)
{
ASSERT(flags & RTLD_GLOBAL);
#ifdef DYNAMIC_LOAD_DEBUG
#if DYNAMIC_LOAD_DEBUG
m_dynamic_object->dump();
#endif

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/Demangle.h>
#include <AK/Memory.h>
#include <AK/QuickSort.h>
@ -51,7 +52,7 @@ Image::~Image()
{
}
#ifdef ELF_IMAGE_DEBUG
#if ELF_IMAGE_DEBUG
static const char* object_file_type_to_string(Elf32_Half type)
{
switch (type) {
@ -91,7 +92,7 @@ unsigned Image::symbol_count() const
void Image::dump() const
{
#ifdef ELF_IMAGE_DEBUG
#if ELF_IMAGE_DEBUG
dbgln("ELF::Image({:p}) {{", this);
dbgln(" is_valid: {}", is_valid());
@ -293,7 +294,7 @@ const Image::RelocationSection Image::Section::relocations() const
if (relocation_section.type() != SHT_REL)
return static_cast<const RelocationSection>(m_image.section(0));
#ifdef ELF_IMAGE_DEBUG
#if ELF_IMAGE_DEBUG
dbgln("Found relocations for {} in {}", name(), relocation_section.name());
#endif
return static_cast<const RelocationSection>(relocation_section);

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/HashMap.h>
#include <LibGUI/Action.h>
#include <LibGUI/ActionGroup.h>
@ -68,7 +69,7 @@ void Menu::set_icon(const Gfx::Bitmap* icon)
void Menu::add_action(NonnullRefPtr<Action> action)
{
m_items.append(make<MenuItem>(m_menu_id, move(action)));
#ifdef GMENU_DEBUG
#if GMENU_DEBUG
dbgln("GUI::Menu::add_action(): MenuItem Menu ID: {}", m_menu_id);
#endif
}
@ -109,7 +110,7 @@ int Menu::realize_menu(RefPtr<Action> default_action)
unrealize_menu();
m_menu_id = WindowServerConnection::the().send_sync<Messages::WindowServer::CreateMenu>(m_name)->menu_id();
#ifdef MENU_DEBUG
#if MENU_DEBUG
dbgln("GUI::Menu::realize_menu(): New menu ID: {}", m_menu_id);
#endif
ASSERT(m_menu_id > 0);

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/ScopeGuard.h>
#include <AK/StringBuilder.h>
#include <AK/TemporaryChange.h>
@ -478,7 +479,7 @@ void TextEditor::paint_event(PaintEvent& event)
for_each_visual_line(line_index, [&](const Gfx::IntRect& visual_line_rect, auto& visual_line_text, size_t start_of_visual_line, [[maybe_unused]] bool is_last_visual_line) {
if (is_multi_line() && line_index == m_cursor.line())
painter.fill_rect(visual_line_rect, widget_background_color.darkened(0.9f));
#ifdef DEBUG_TEXTEDITOR
#if TEXTEDITOR_DEBUG
painter.draw_rect(visual_line_rect, Color::Cyan);
#endif

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <LibGUI/HeaderView.h>
#include <LibGUI/Model.h>
#include <LibGUI/Painter.h>
@ -257,7 +258,7 @@ void TreeView::paint_event(PaintEvent& event)
auto rect = a_rect.translated(0, y_offset);
auto toggle_rect = a_toggle_rect.translated(0, y_offset);
#ifdef DEBUG_ITEM_RECTS
#if ITEM_RECTS_DEBUG
painter.fill_rect(rect, Color::WarmGray);
#endif

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/HashMap.h>
#include <AK/JsonObject.h>
#include <AK/NeverDestroyed.h>
@ -558,7 +559,7 @@ void Window::update(const Gfx::IntRect& a_rect)
for (auto& pending_rect : m_pending_paint_event_rects) {
if (pending_rect.contains(a_rect)) {
#ifdef UPDATE_COALESCING_DEBUG
#if UPDATE_COALESCING_DEBUG
dbgln("Ignoring {} since it's contained by pending rect {}", a_rect, pending_rect);
#endif
return;

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <LibCore/EventLoop.h>
#include <LibGemini/GeminiJob.h>
#include <LibGemini/GeminiResponse.h>
@ -39,7 +40,7 @@ void GeminiJob::start()
m_socket = TLS::TLSv12::construct(this);
m_socket->set_root_certificates(m_override_ca_certificates ? *m_override_ca_certificates : DefaultRootCACertificates::the().certificates());
m_socket->on_tls_connected = [this] {
#ifdef GEMINIJOB_DEBUG
#if GEMINIJOB_DEBUG
dbgln("GeminiJob: on_connected callback");
#endif
on_socket_connected();

View file

@ -25,6 +25,7 @@
*/
#include <AK/ByteBuffer.h>
#include <AK/Debug.h>
#include <AK/LexicalPath.h>
#include <AK/MappedFile.h>
#include <AK/MemoryStream.h>
@ -188,7 +189,7 @@ static bool load_ico_directory(ICOLoadingContext& context)
for (size_t i = 0; i < image_count.value(); ++i) {
auto maybe_desc = decode_ico_direntry(stream);
if (!maybe_desc.has_value()) {
#ifdef ICO_DEBUG
#if ICO_DEBUG
printf("load_ico_directory: error loading entry: %lu\n", i);
#endif
return false;
@ -197,13 +198,13 @@ static bool load_ico_directory(ICOLoadingContext& context)
auto& desc = maybe_desc.value();
if (desc.offset + desc.size < desc.offset // detect integer overflow
|| (desc.offset + desc.size) > context.data_size) {
#ifdef ICO_DEBUG
#if ICO_DEBUG
printf("load_ico_directory: offset: %lu size: %lu doesn't fit in ICO size: %lu\n",
desc.offset, desc.size, context.data_size);
#endif
return false;
}
#ifdef ICO_DEBUG
#if ICO_DEBUG
printf("load_ico_directory: index %zu width: %u height: %u offset: %lu size: %lu\n",
i, desc.width, desc.height, desc.offset, desc.size);
#endif
@ -222,14 +223,14 @@ static bool load_ico_bmp(ICOLoadingContext& context, ImageDescriptor& desc)
memcpy(&info, context.data + desc.offset, sizeof(info));
if (info.size != sizeof(info)) {
#ifdef ICO_DEBUG
#if ICO_DEBUG
printf("load_ico_bmp: info size: %u, expected: %lu\n", info.size, sizeof(info));
#endif
return false;
}
if (info.width < 0) {
#ifdef ICO_DEBUG
#if ICO_DEBUG
printf("load_ico_bmp: width %d < 0\n", info.width);
#endif
return false;
@ -241,26 +242,26 @@ static bool load_ico_bmp(ICOLoadingContext& context, ImageDescriptor& desc)
}
if (info.planes != 1) {
#ifdef ICO_DEBUG
#if ICO_DEBUG
printf("load_ico_bmp: planes: %d != 1", info.planes);
#endif
return false;
}
if (info.bpp != 32) {
#ifdef ICO_DEBUG
#if ICO_DEBUG
printf("load_ico_bmp: unsupported bpp: %u\n", info.bpp);
#endif
return false;
}
#ifdef ICO_DEBUG
#if ICO_DEBUG
printf("load_ico_bmp: width: %d height: %d direction: %s bpp: %d size_image: %u\n",
info.width, info.height, topdown ? "TopDown" : "BottomUp", info.bpp, info.size_image);
#endif
if (info.compression != 0 || info.palette_size != 0 || info.important_colors != 0) {
#ifdef ICO_DEBUG
#if ICO_DEBUG
printf("load_ico_bmp: following fields must be 0: compression: %u palette_size: %u important_colors: %u\n",
info.compression, info.palette_size, info.important_colors);
#endif
@ -268,7 +269,7 @@ static bool load_ico_bmp(ICOLoadingContext& context, ImageDescriptor& desc)
}
if (info.width != desc.width || info.height != 2 * desc.height) {
#ifdef ICO_DEBUG
#if ICO_DEBUG
printf("load_ico_bmp: size mismatch: ico %dx%d, bmp %dx%d\n",
desc.width, desc.height, info.width, info.height);
#endif
@ -280,7 +281,7 @@ static bool load_ico_bmp(ICOLoadingContext& context, ImageDescriptor& desc)
size_t required_len = desc.height * (desc.width * sizeof(BMP_ARGB) + mask_row_len);
size_t available_len = desc.size - sizeof(info);
if (required_len > available_len) {
#ifdef ICO_DEBUG
#if ICO_DEBUG
printf("load_ico_bmp: required_len: %lu > available_len: %lu\n",
required_len, available_len);
#endif
@ -329,7 +330,7 @@ static bool load_ico_bitmap(ICOLoadingContext& context, Optional<size_t> index)
if (png_decoder.sniff()) {
desc.bitmap = png_decoder.bitmap();
if (!desc.bitmap) {
#ifdef ICO_DEBUG
#if ICO_DEBUG
printf("load_ico_bitmap: failed to load PNG encoded image index: %lu\n", real_index);
#endif
return false;
@ -337,7 +338,7 @@ static bool load_ico_bitmap(ICOLoadingContext& context, Optional<size_t> index)
return true;
} else {
if (!load_ico_bmp(context, desc)) {
#ifdef ICO_DEBUG
#if ICO_DEBUG
printf("load_ico_bitmap: failed to load BMP encoded image index: %lu\n", real_index);
#endif
return false;

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <LibCore/Gzip.h>
#include <LibCore/TCPSocket.h>
#include <LibHTTP/HttpJob.h>
@ -37,7 +38,7 @@ void HttpJob::start()
ASSERT(!m_socket);
m_socket = Core::TCPSocket::construct(this);
m_socket->on_connected = [this] {
#ifdef CHTTPJOB_DEBUG
#if CHTTPJOB_DEBUG
dbgln("HttpJob: on_connected callback");
#endif
on_socket_connected();

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <LibCore/EventLoop.h>
#include <LibCore/Gzip.h>
#include <LibHTTP/HttpResponse.h>
@ -40,7 +41,7 @@ void HttpsJob::start()
m_socket = TLS::TLSv12::construct(this);
m_socket->set_root_certificates(m_override_ca_certificates ? *m_override_ca_certificates : DefaultRootCACertificates::the().certificates());
m_socket->on_tls_connected = [this] {
#ifdef HTTPSJOB_DEBUG
#if HTTPSJOB_DEBUG
dbgln("HttpsJob: on_connected callback");
#endif
on_socket_connected();

View file

@ -25,6 +25,7 @@
*/
#include <AK/Badge.h>
#include <AK/Debug.h>
#include <AK/HashTable.h>
#include <AK/StackInfo.h>
#include <AK/TemporaryChange.h>
@ -115,7 +116,7 @@ void Heap::gather_roots(HashTable<Cell*>& roots)
}
}
#ifdef HEAP_DEBUG
#if HEAP_DEBUG
dbgln("gather_roots:");
for (auto* root : roots)
dbgln(" + {}", root);
@ -126,7 +127,7 @@ __attribute__((no_sanitize("address"))) void Heap::gather_conservative_roots(Has
{
FlatPtr dummy;
#ifdef HEAP_DEBUG
#if HEAP_DEBUG
dbgln("gather_conservative_roots:");
#endif
@ -157,19 +158,19 @@ __attribute__((no_sanitize("address"))) void Heap::gather_conservative_roots(Has
for (auto possible_pointer : possible_pointers) {
if (!possible_pointer)
continue;
#ifdef HEAP_DEBUG
#if HEAP_DEBUG
dbgln(" ? {}", (const void*)possible_pointer);
#endif
auto* possible_heap_block = HeapBlock::from_cell(reinterpret_cast<const Cell*>(possible_pointer));
if (all_live_heap_blocks.contains(possible_heap_block)) {
if (auto* cell = possible_heap_block->cell_from_possible_pointer(possible_pointer)) {
if (cell->is_live()) {
#ifdef HEAP_DEBUG
#if HEAP_DEBUG
dbgln(" ?-> {}", (const void*)cell);
#endif
roots.set(cell);
} else {
#ifdef HEAP_DEBUG
#if HEAP_DEBUG
dbgln(" #-> {}", (const void*)cell);
#endif
}
@ -186,7 +187,7 @@ public:
{
if (cell->is_marked())
return;
#ifdef HEAP_DEBUG
#if HEAP_DEBUG
dbgln(" ! {}", cell);
#endif
cell->set_marked(true);
@ -196,7 +197,7 @@ public:
void Heap::mark_live_cells(const HashTable<Cell*>& roots)
{
#ifdef HEAP_DEBUG
#if HEAP_DEBUG
dbgln("mark_live_cells:");
#endif
MarkingVisitor visitor;
@ -206,7 +207,7 @@ void Heap::mark_live_cells(const HashTable<Cell*>& roots)
void Heap::sweep_dead_cells(bool print_report, const Core::ElapsedTimer& measurement_timer)
{
#ifdef HEAP_DEBUG
#if HEAP_DEBUG
dbgln("sweep_dead_cells:");
#endif
Vector<HeapBlock*, 32> empty_blocks;
@ -223,7 +224,7 @@ void Heap::sweep_dead_cells(bool print_report, const Core::ElapsedTimer& measure
block.for_each_cell([&](Cell* cell) {
if (cell->is_live()) {
if (!cell->is_marked()) {
#ifdef HEAP_DEBUG
#if HEAP_DEBUG
dbgln(" ~ {}", cell);
#endif
block.deallocate(cell);
@ -245,20 +246,20 @@ void Heap::sweep_dead_cells(bool print_report, const Core::ElapsedTimer& measure
});
for (auto* block : empty_blocks) {
#ifdef HEAP_DEBUG
#if HEAP_DEBUG
dbgln(" - HeapBlock empty @ {}: cell_size={}", block, block->cell_size());
#endif
allocator_for_size(block->cell_size()).block_did_become_empty({}, *block);
}
for (auto* block : full_blocks_that_became_usable) {
#ifdef HEAP_DEBUG
#if HEAP_DEBUG
dbgln(" - HeapBlock usable again @ {}: cell_size={}", block, block->cell_size());
#endif
allocator_for_size(block->cell_size()).block_did_become_usable({}, *block);
}
#ifdef HEAP_DEBUG
#if HEAP_DEBUG
for_each_block([&](auto& block) {
dbgln(" > Live HeapBlock @ {}: cell_size={}", &block, block.cell_size());
return IterationDecision::Continue;

View file

@ -26,6 +26,7 @@
*/
#include "Lexer.h"
#include <AK/Debug.h>
#include <AK/HashMap.h>
#include <AK/StringBuilder.h>
#include <ctype.h>
@ -169,7 +170,7 @@ void Lexer::consume()
return;
if (is_line_terminator()) {
#ifdef LEXER_DEBUG
#if LEXER_DEBUG
String type;
if (m_current_char == '\n')
type = "LINE FEED";
@ -198,7 +199,7 @@ void Lexer::consume()
if (!second_char_of_crlf) {
m_line_number++;
m_line_column = 1;
#ifdef LEXER_DEBUG
#if LEXER_DEBUG
dbgln("Incremented line number, now at: line {}, column 1", m_line_number);
} else {
dbgln("Previous was CR, this is LF - not incrementing line number again.");
@ -638,7 +639,7 @@ Token Lexer::next()
value_start_line_number,
value_start_column_number);
#ifdef LEXER_DEBUG
#if LEXER_DEBUG
dbgln("------------------------------");
dbgln("Token: {}", m_current_token.name());
dbgln("Trivia: _{}_", m_current_token.trivia());

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/String.h>
#include <AK/TemporaryChange.h>
#include <LibJS/Heap/Heap.h>
@ -397,7 +398,7 @@ bool Object::define_property(const StringOrSymbol& property_name, const Object&
return false;
}
#ifdef OBJECT_DEBUG
#if OBJECT_DEBUG
dbgln("Defining new property {} with accessor descriptor {{ attributes={}, getter={}, setter={} }}", property_name.to_display_string(), attributes, getter, setter);
#endif
@ -417,7 +418,7 @@ bool Object::define_property(const StringOrSymbol& property_name, const Object&
if (vm.exception())
return {};
#ifdef OBJECT_DEBUG
#if OBJECT_DEBUG
dbgln("Defining new property {} with data descriptor {{ attributes={}, value={} }}", property_name.to_display_string(), attributes, value);
#endif
@ -497,7 +498,7 @@ bool Object::put_own_property(Object& this_object, const StringOrSymbol& propert
bool new_property = !metadata.has_value();
if (!is_extensible() && new_property) {
#ifdef OBJECT_DEBUG
#if OBJECT_DEBUG
dbgln("Disallow define_property of non-extensible object");
#endif
if (throw_exceptions && vm().in_strict_mode())
@ -526,7 +527,7 @@ bool Object::put_own_property(Object& this_object, const StringOrSymbol& propert
}
if (!new_property && mode == PutOwnPropertyMode::DefineProperty && !metadata.value().attributes.is_configurable() && attributes != metadata.value().attributes) {
#ifdef OBJECT_DEBUG
#if OBJECT_DEBUG
dbgln("Disallow reconfig of non-configurable property");
#endif
if (throw_exceptions)
@ -542,14 +543,14 @@ bool Object::put_own_property(Object& this_object, const StringOrSymbol& propert
}
metadata = shape().lookup(property_name);
#ifdef OBJECT_DEBUG
#if OBJECT_DEBUG
dbgln("Reconfigured property {}, new shape says offset is {} and my storage capacity is {}", property_name.to_display_string(), metadata.value().offset, m_storage.size());
#endif
}
auto value_here = m_storage[metadata.value().offset];
if (!new_property && mode == PutOwnPropertyMode::Put && !value_here.is_accessor() && !metadata.value().attributes.is_writable()) {
#ifdef OBJECT_DEBUG
#if OBJECT_DEBUG
dbgln("Disallow write to non-writable property");
#endif
return false;
@ -574,7 +575,7 @@ bool Object::put_own_property_by_index(Object& this_object, u32 property_index,
auto new_property = !existing_property.has_value();
if (!is_extensible() && new_property) {
#ifdef OBJECT_DEBUG
#if OBJECT_DEBUG
dbgln("Disallow define_property of non-extensible object");
#endif
if (throw_exceptions && vm().in_strict_mode())
@ -593,7 +594,7 @@ bool Object::put_own_property_by_index(Object& this_object, u32 property_index,
PropertyAttributes existing_attributes = new_property ? 0 : existing_property.value().attributes;
if (!new_property && mode == PutOwnPropertyMode::DefineProperty && !existing_attributes.is_configurable() && attributes != existing_attributes) {
#ifdef OBJECT_DEBUG
#if OBJECT_DEBUG
dbgln("Disallow reconfig of non-configurable property");
#endif
if (throw_exceptions)
@ -603,7 +604,7 @@ bool Object::put_own_property_by_index(Object& this_object, u32 property_index,
auto value_here = new_property ? Value() : existing_property.value().value;
if (!new_property && mode == PutOwnPropertyMode::Put && !value_here.is_accessor() && !existing_attributes.is_writable()) {
#ifdef OBJECT_DEBUG
#if OBJECT_DEBUG
dbgln("Disallow write to non-writable property");
#endif
return false;

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <LibLine/Editor.h>
namespace {
@ -39,7 +40,7 @@ void KeyCallbackMachine::register_key_input_callback(Vector<Key> keys, Function<
void KeyCallbackMachine::key_pressed(Editor& editor, Key key)
{
#ifdef CALLBACK_MACHINE_DEBUG
#if CALLBACK_MACHINE_DEBUG
dbgln("Key<{}, {}> pressed, seq_length={}, {} things in the matching vector", key.key, key.modifiers, m_sequence_length, m_current_matching_keys.size());
#endif
if (m_sequence_length == 0) {
@ -80,7 +81,7 @@ void KeyCallbackMachine::key_pressed(Editor& editor, Key key)
return;
}
#ifdef CALLBACK_MACHINE_DEBUG
#if CALLBACK_MACHINE_DEBUG
dbgln("seq_length={}, matching vector:", m_sequence_length);
for (auto& key : m_current_matching_keys) {
for (auto& k : key)

View file

@ -26,6 +26,7 @@
#include <AK/Assertions.h>
#include <AK/Atomic.h>
#include <AK/Debug.h>
#include <AK/StdLibExtras.h>
#include <Kernel/API/Syscall.h>
#include <limits.h>
@ -130,7 +131,7 @@ int pthread_create(pthread_t* thread, pthread_attr_t* attributes, void* (*start_
return -1;
}
#ifdef PTHREAD_DEBUG
#if PTHREAD_DEBUG
dbgprintf("pthread_create: Creating thread with attributes at %p, detach state %s, priority %d, guard page size %d, stack size %d, stack location %p\n",
used_attributes,
(PTHREAD_CREATE_JOINABLE == used_attributes->m_detach_state) ? "joinable" : "detached",
@ -254,7 +255,7 @@ int pthread_attr_init(pthread_attr_t* attributes)
auto* impl = new PthreadAttrImpl {};
*attributes = impl;
#ifdef PTHREAD_DEBUG
#if PTHREAD_DEBUG
dbgprintf("pthread_attr_init: New thread attributes at %p, detach state %s, priority %d, guard page size %d, stack size %d, stack location %p\n",
impl,
(PTHREAD_CREATE_JOINABLE == impl->m_detach_state) ? "joinable" : "detached",
@ -297,7 +298,7 @@ int pthread_attr_setdetachstate(pthread_attr_t* attributes, int detach_state)
attributes_impl->m_detach_state = detach_state;
#ifdef PTHREAD_DEBUG
#if PTHREAD_DEBUG
dbgprintf("pthread_attr_setdetachstate: Thread attributes at %p, detach state %s, priority %d, guard page size %d, stack size %d, stack location %p\n",
attributes_impl,
(PTHREAD_CREATE_JOINABLE == attributes_impl->m_detach_state) ? "joinable" : "detached",
@ -341,7 +342,7 @@ int pthread_attr_setguardsize(pthread_attr_t* attributes, size_t guard_size)
attributes_impl->m_guard_page_size = actual_guard_size;
attributes_impl->m_reported_guard_page_size = guard_size; // POSIX, why?
#ifdef PTHREAD_DEBUG
#if PTHREAD_DEBUG
dbgprintf("pthread_attr_setguardsize: Thread attributes at %p, detach state %s, priority %d, guard page size %d, stack size %d, stack location %p\n",
attributes_impl,
(PTHREAD_CREATE_JOINABLE == attributes_impl->m_detach_state) ? "joinable" : "detached",
@ -376,7 +377,7 @@ int pthread_attr_setschedparam(pthread_attr_t* attributes, const struct sched_pa
attributes_impl->m_schedule_priority = p_sched_param->sched_priority;
#ifdef PTHREAD_DEBUG
#if PTHREAD_DEBUG
dbgprintf("pthread_attr_setschedparam: Thread attributes at %p, detach state %s, priority %d, guard page size %d, stack size %d, stack location %p\n",
attributes_impl,
(PTHREAD_CREATE_JOINABLE == attributes_impl->m_detach_state) ? "joinable" : "detached",
@ -421,7 +422,7 @@ int pthread_attr_setstack(pthread_attr_t* attributes, void* p_stack, size_t stac
attributes_impl->m_stack_size = stack_size;
attributes_impl->m_stack_location = p_stack;
#ifdef PTHREAD_DEBUG
#if PTHREAD_DEBUG
dbgprintf("pthread_attr_setstack: Thread attributes at %p, detach state %s, priority %d, guard page size %d, stack size %d, stack location %p\n",
attributes_impl,
(PTHREAD_CREATE_JOINABLE == attributes_impl->m_detach_state) ? "joinable" : "detached",
@ -457,7 +458,7 @@ int pthread_attr_setstacksize(pthread_attr_t* attributes, size_t stack_size)
attributes_impl->m_stack_size = stack_size;
#ifdef PTHREAD_DEBUG
#if PTHREAD_DEBUG
dbgprintf("pthread_attr_setstacksize: Thread attributes at %p, detach state %s, priority %d, guard page size %d, stack size %d, stack location %p\n",
attributes_impl,
(PTHREAD_CREATE_JOINABLE == attributes_impl->m_detach_state) ? "joinable" : "detached",

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/StringBuilder.h>
#include <AK/StringView.h>
#include <LibVT/Terminal.h>
@ -822,7 +823,7 @@ void Terminal::ICH(const ParamVector& params)
void Terminal::on_input(u8 ch)
{
#ifdef TERMINAL_DEBUG
#if TERMINAL_DEBUG
dbgln("Terminal::on_input: {:#02x} ({:c}), fg={}, bg={}\n", ch, ch, m_current_attribute.foreground_color, m_current_attribute.background_color);
#endif

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <LibGUI/Painter.h>
#include <LibGUI/ScrollBar.h>
#include <LibGUI/Widget.h>
@ -81,7 +82,7 @@ void FrameBox::paint(PaintContext& context, PaintPhase phase)
context.set_viewport_rect(old_viewport_rect);
context.painter().restore();
#ifdef DEBUG_HIGHLIGHT_FOCUSED_FRAME
#if HIGHLIGHT_FOCUSED_FRAME_DEBUG
if (dom_node().content_frame()->is_focused_frame()) {
context.painter().draw_rect(absolute_rect().to<int>(), Color::Cyan);
}

View file

@ -120,7 +120,7 @@ static bool build_gemini_document(DOM::Document& document, const ByteBuffer& dat
auto gemini_document = Gemini::Document::parse(gemini_data, document.url());
String html_data = gemini_document->render_to_html();
#ifdef GEMINI_DEBUG
#if GEMINI_DEBUG
dbgln("Gemini data:\n\"\"\"{}\"\"\"", gemini_data);
dbgln("Converted to HTML:\n\"\"\"{}\"\"\"", html_data);
#endif

View file

@ -27,6 +27,7 @@
#include "DNSResponse.h"
#include "DNSPacket.h"
#include "DNSRequest.h"
#include <AK/Debug.h>
#include <AK/IPv4Address.h>
#include <AK/StringBuilder.h>
@ -61,7 +62,7 @@ Optional<DNSResponse> DNSResponse::from_raw_response(const u8* raw_data, size_t
}
auto& response_header = *(const DNSPacket*)(raw_data);
#ifdef LOOKUPSERVER_DEBUG
#if LOOKUPSERVER_DEBUG
dbgln("Got response (ID: {})", response_header.id());
dbgln(" Question count: {}", response_header.question_count());
dbgln(" Answer count: {}", response_header.answer_count());
@ -87,7 +88,7 @@ Optional<DNSResponse> DNSResponse::from_raw_response(const u8* raw_data, size_t
auto& record_and_class = *(const RawDNSAnswerQuestion*)&raw_data[offset];
response.m_questions.empend(name, record_and_class.record_type, record_and_class.class_code);
offset += 4;
#ifdef LOOKUPSERVER_DEBUG
#if LOOKUPSERVER_DEBUG
auto& question = response.m_questions.last();
dbgln("Question #{}: name=_{}_, type={}, class={}", i, question.name(), question.record_type(), question.class_code());
#endif
@ -111,7 +112,7 @@ Optional<DNSResponse> DNSResponse::from_raw_response(const u8* raw_data, size_t
// FIXME: Parse some other record types perhaps?
dbgln("data=(unimplemented record type {})", record.type());
}
#ifdef LOOKUPSERVER_DEBUG
#if LOOKUPSERVER_DEBUG
dbgln("Answer #{}: name=_{}_, type={}, ttl={}, length={}, data=_{}_", i, name, record.type(), record.ttl(), record.data_length(), data);
#endif
response.m_answers.empend(name, record.type(), record.record_class(), record.ttl(), data);

View file

@ -28,6 +28,7 @@
#include "DNSRequest.h"
#include "DNSResponse.h"
#include <AK/ByteBuffer.h>
#include <AK/Debug.h>
#include <AK/HashMap.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
@ -113,7 +114,7 @@ void LookupServer::service_client(RefPtr<Core::LocalSocket> socket)
return;
}
auto hostname = String((const char*)client_buffer + 1, nrecv - 1, Chomp);
#ifdef LOOKUPSERVER_DEBUG
#if LOOKUPSERVER_DEBUG
dbgln("Got request for '{}'", hostname);
#endif
@ -123,7 +124,7 @@ void LookupServer::service_client(RefPtr<Core::LocalSocket> socket)
responses.append(known_host.value());
} else if (!hostname.is_empty()) {
for (auto& nameserver : m_nameservers) {
#ifdef LOOKUPSERVER_DEBUG
#if LOOKUPSERVER_DEBUG
dbgln("Doing lookup using nameserver '{}'", nameserver);
#endif
bool did_get_response = false;
@ -174,7 +175,7 @@ Vector<String> LookupServer::lookup(const String& hostname, const String& namese
if (cached_lookup.question.record_type() == record_type) {
Vector<String> responses;
for (auto& cached_answer : cached_lookup.answers) {
#ifdef LOOKUPSERVER_DEBUG
#if LOOKUPSERVER_DEBUG
dbgln("Cache hit: {} -> {}, expired: {}", hostname, cached_answer.record_data(), cached_answer.has_expired());
#endif
if (!cached_answer.has_expired())

View file

@ -26,6 +26,7 @@
#include "TaskbarWindow.h"
#include "TaskbarButton.h"
#include <AK/Debug.h>
#include <LibCore/ConfigFile.h>
#include <LibCore/StandardPaths.h>
#include <LibDesktop/AppFile.h>
@ -228,7 +229,7 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event)
WindowIdentifier identifier { event.client_id(), event.window_id() };
switch (event.type()) {
case GUI::Event::WM_WindowRemoved: {
#ifdef EVENT_DEBUG
#if EVENT_DEBUG
auto& removed_event = static_cast<GUI::WMWindowRemovedEvent&>(event);
dbgln("WM_WindowRemoved: client_id={}, window_id={}",
removed_event.client_id(),
@ -241,7 +242,7 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event)
break;
}
case GUI::Event::WM_WindowRectChanged: {
#ifdef EVENT_DEBUG
#if EVENT_DEBUG
auto& changed_event = static_cast<GUI::WMWindowRectChangedEvent&>(event);
dbgln("WM_WindowRectChanged: client_id={}, window_id={}, rect={}",
changed_event.client_id(),
@ -262,7 +263,7 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event)
case GUI::Event::WM_WindowStateChanged: {
auto& changed_event = static_cast<GUI::WMWindowStateChangedEvent&>(event);
#ifdef EVENT_DEBUG
#if EVENT_DEBUG
dbgln("WM_WindowStateChanged: client_id={}, window_id={}, title={}, rect={}, is_active={}, is_minimized={}",
changed_event.client_id(),
changed_event.window_id(),

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <Kernel/API/MousePacket.h>
#include <LibCore/LocalSocket.h>
#include <LibCore/Object.h>
@ -101,7 +102,7 @@ void EventLoop::drain_mouse()
return;
for (size_t i = 0; i < npackets; ++i) {
auto& packet = packets[i];
#ifdef WSMESSAGELOOP_DEBUG
#if WSMESSAGELOOP_DEBUG
dbgln("EventLoop: Mouse X {}, Y {}, Z {}, relative={}", packet.x, packet.y, packet.z, packet.is_relative);
#endif
buttons = packet.buttons;
@ -119,7 +120,7 @@ void EventLoop::drain_mouse()
if (buttons != state.buttons) {
state.buttons = buttons;
#ifdef WSMESSAGELOOP_DEBUG
#if WSMESSAGELOOP_DEBUG
dbgln("EventLoop: Mouse Button Event");
#endif
screen.on_receive_mouse_data(state);

View file

@ -27,6 +27,7 @@
#include "Shell.h"
#include "Execution.h"
#include "Formatter.h"
#include <AK/Debug.h>
#include <AK/Function.h>
#include <AK/LexicalPath.h>
#include <AK/ScopeGuard.h>
@ -68,7 +69,7 @@ void Shell::setup_signals()
{
if (m_should_reinstall_signal_handlers) {
Core::EventLoop::register_signal(SIGCHLD, [this](int) {
#ifdef SH_DEBUG
#if SH_DEBUG
dbgln("SIGCHLD!");
#endif
notify_child_event();
@ -506,7 +507,7 @@ String Shell::format(const StringView& source, ssize_t& cursor) const
Shell::Frame Shell::push_frame(String name)
{
m_local_frames.append(make<LocalFrame>(name, decltype(LocalFrame::local_variables) {}));
#ifdef SH_DEBUG
#if SH_DEBUG
dbgln("New frame '{}' at {:p}", name, &m_local_frames.last());
#endif
return { m_local_frames, m_local_frames.last() };
@ -572,7 +573,7 @@ int Shell::run_command(const StringView& cmd, Optional<SourcePosition> source_po
if (!command)
return 0;
#ifdef SH_DEBUG
#if SH_DEBUG
dbgln("Command follows");
command->dump(0);
#endif
@ -669,7 +670,7 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
auto apply_rewirings = [&] {
for (auto& rewiring : rewirings) {
#ifdef SH_DEBUG
#if SH_DEBUG
dbgln("in {}<{}>, dup2({}, {})", command.argv.is_empty() ? "(<Empty>)" : command.argv[0].characters(), getpid(), rewiring.old_fd, rewiring.new_fd);
#endif
int rc = dup2(rewiring.old_fd, rewiring.new_fd);
@ -784,7 +785,7 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
}
}
#ifdef SH_DEBUG
#if SH_DEBUG
dbgln("Synced up with parent, we're good to exec()");
#endif
@ -982,7 +983,7 @@ NonnullRefPtrVector<Job> Shell::run_commands(Vector<AST::Command>& commands)
NonnullRefPtrVector<Job> spawned_jobs;
for (auto& command : commands) {
#ifdef SH_DEBUG
#if SH_DEBUG
dbgln("Command");
for (auto& arg : command.argv)
dbgln("argv: {}", arg);
@ -1626,11 +1627,11 @@ void Shell::notify_child_event()
#endif
int wstatus = 0;
#ifdef SH_DEBUG
#if SH_DEBUG
dbgln("waitpid({}) = ...", job.pid());
#endif
auto child_pid = waitpid(job.pid(), &wstatus, WNOHANG | WUNTRACED);
#ifdef SH_DEBUG
#if SH_DEBUG
dbgln("... = {} - {}", child_pid, wstatus);
#endif
@ -1786,7 +1787,7 @@ void Shell::stop_all_jobs()
printf("Killing active jobs\n");
for (auto& entry : jobs) {
if (entry.value->is_suspended()) {
#ifdef SH_DEBUG
#if SH_DEBUG
dbgln("Job {} is suspended", entry.value->pid());
#endif
kill_job(entry.value, SIGCONT);
@ -1798,7 +1799,7 @@ void Shell::stop_all_jobs()
usleep(10000); // Wait for a bit before killing the job
for (auto& entry : jobs) {
#ifdef SH_DEBUG
#if SH_DEBUG
dbgln("Actively killing {} ({})", entry.value->pid(), entry.value->cmd());
#endif
kill_job(entry.value, SIGKILL);