mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 11:12:45 +00:00 
			
		
		
		
	Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
This commit is contained in:
		
							parent
							
								
									7b0a1a98d9
								
							
						
					
					
						commit
						27bc48e06c
					
				
					 11 changed files with 116 additions and 109 deletions
				
			
		
							
								
								
									
										42
									
								
								AK/Debug.h
									
										
									
									
									
								
							
							
						
						
									
										42
									
								
								AK/Debug.h
									
										
									
									
									
								
							|  | @ -255,3 +255,45 @@ constexpr bool debug_ptmx = true; | ||||||
| #else | #else | ||||||
| constexpr bool debug_ptmx = false; | constexpr bool debug_ptmx = false; | ||||||
| #endif | #endif | ||||||
|  | 
 | ||||||
|  | #ifdef TTY_DEBUG | ||||||
|  | constexpr bool debug_tty = true; | ||||||
|  | #else | ||||||
|  | constexpr bool debug_tty = false; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #ifdef CONTIGUOUS_VMOBJECT_DEBUG | ||||||
|  | constexpr bool debug_contiguous_vmobject = true; | ||||||
|  | #else | ||||||
|  | constexpr bool debug_contiguous_vmobject = false; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #ifdef VRA_DEBUG | ||||||
|  | constexpr bool debug_vra = true; | ||||||
|  | #else | ||||||
|  | constexpr bool debug_vra = false; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #ifdef COPY_DEBUG | ||||||
|  | constexpr bool debug_copy = true; | ||||||
|  | #else | ||||||
|  | constexpr bool debug_copy = false; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #ifdef DEBUG_CURSOR_TOOL | ||||||
|  | constexpr bool debug_cursor_tool = true; | ||||||
|  | #else | ||||||
|  | constexpr bool debug_cursor_tool = false; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #ifdef DEBUG_FILE_CONTENT | ||||||
|  | constexpr bool debug_file_content = true; | ||||||
|  | #else | ||||||
|  | constexpr bool debug_file_content = false; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #ifdef DEBUG_GZIP | ||||||
|  | constexpr bool debug_gzip = true; | ||||||
|  | #else | ||||||
|  | constexpr bool debug_gzip = false; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | @ -24,6 +24,7 @@ | ||||||
|  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | #include <AK/Debug.h> | ||||||
| #include <AK/ScopeGuard.h> | #include <AK/ScopeGuard.h> | ||||||
| #include <Kernel/Process.h> | #include <Kernel/Process.h> | ||||||
| #include <Kernel/TTY/TTY.h> | #include <Kernel/TTY/TTY.h> | ||||||
|  | @ -304,19 +305,19 @@ void TTY::flush_input() | ||||||
| void TTY::set_termios(const termios& t) | void TTY::set_termios(const termios& t) | ||||||
| { | { | ||||||
|     m_termios = t; |     m_termios = t; | ||||||
| #ifdef TTY_DEBUG | 
 | ||||||
|     dbg() << tty_name() << " set_termios: " |     dbgln<debug_tty>("{} set_termios: ECHO={}, ISIG={}, ICANON={}, ECHOE={}, ECHOK={}, ECHONL={}, ISTRIP={}, ICRNL={}, INLCR={}, IGNCR={}", | ||||||
|           << "ECHO=" << should_echo_input() |         tty_name(), | ||||||
|           << ", ISIG=" << should_generate_signals() |         should_echo_input(), | ||||||
|           << ", ICANON=" << in_canonical_mode() |         should_generate_signals(), | ||||||
|           << ", ECHOE=" << ((m_termios.c_lflag & ECHOE) != 0) |         in_canonical_mode(), | ||||||
|           << ", ECHOK=" << ((m_termios.c_lflag & ECHOK) != 0) |         ((m_termios.c_lflag & ECHOE) != 0), | ||||||
|           << ", ECHONL=" << ((m_termios.c_lflag & ECHONL) != 0) |         ((m_termios.c_lflag & ECHOK) != 0), | ||||||
|           << ", ISTRIP=" << ((m_termios.c_iflag & ISTRIP) != 0) |         ((m_termios.c_lflag & ECHONL) != 0), | ||||||
|           << ", ICRNL=" << ((m_termios.c_iflag & ICRNL) != 0) |         ((m_termios.c_iflag & ISTRIP) != 0), | ||||||
|           << ", INLCR=" << ((m_termios.c_iflag & INLCR) != 0) |         ((m_termios.c_iflag & ICRNL) != 0), | ||||||
|           << ", IGNCR=" << ((m_termios.c_iflag & IGNCR) != 0); |         ((m_termios.c_iflag & INLCR) != 0), | ||||||
| #endif |         ((m_termios.c_iflag & IGNCR) != 0)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int TTY::ioctl(FileDescription&, unsigned request, FlatPtr arg) | int TTY::ioctl(FileDescription&, unsigned request, FlatPtr arg) | ||||||
|  |  | ||||||
|  | @ -24,14 +24,12 @@ | ||||||
|  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | #include <AK/Debug.h> | ||||||
| #include <Kernel/Process.h> | #include <Kernel/Process.h> | ||||||
| #include <Kernel/VM/AnonymousVMObject.h> | #include <Kernel/VM/AnonymousVMObject.h> | ||||||
| #include <Kernel/VM/MemoryManager.h> | #include <Kernel/VM/MemoryManager.h> | ||||||
| #include <Kernel/VM/PhysicalPage.h> | #include <Kernel/VM/PhysicalPage.h> | ||||||
| 
 | 
 | ||||||
| //#define COMMIT_DEBUG
 |  | ||||||
| //#define PAGE_FAULT_DEBUG
 |  | ||||||
| 
 |  | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
| 
 | 
 | ||||||
| RefPtr<VMObject> AnonymousVMObject::clone() | RefPtr<VMObject> AnonymousVMObject::clone() | ||||||
|  | @ -474,9 +472,7 @@ PageFaultResponse AnonymousVMObject::handle_cow_fault(size_t page_index, Virtual | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     u8* dest_ptr = MM.quickmap_page(*page); |     u8* dest_ptr = MM.quickmap_page(*page); | ||||||
| #ifdef PAGE_FAULT_DEBUG |     dbgln<debug_page_fault>("      >> COW {} <- {}", page->paddr(), page_slot->paddr()); | ||||||
|     dbg() << "      >> COW " << page->paddr() << " <- " << page_slot->paddr(); |  | ||||||
| #endif |  | ||||||
|     { |     { | ||||||
|         SmapDisabler disabler; |         SmapDisabler disabler; | ||||||
|         void* fault_at; |         void* fault_at; | ||||||
|  |  | ||||||
|  | @ -24,14 +24,13 @@ | ||||||
|  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | #include <AK/Debug.h> | ||||||
| #include <Kernel/VM/ContiguousVMObject.h> | #include <Kernel/VM/ContiguousVMObject.h> | ||||||
| #include <Kernel/VM/MemoryManager.h> | #include <Kernel/VM/MemoryManager.h> | ||||||
| #include <Kernel/VM/PhysicalPage.h> | #include <Kernel/VM/PhysicalPage.h> | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
| 
 | 
 | ||||||
| //#define CONTIGUOUS_VMOBJECT_DEBUG
 |  | ||||||
| 
 |  | ||||||
| NonnullRefPtr<ContiguousVMObject> ContiguousVMObject::create_with_size(size_t size) | NonnullRefPtr<ContiguousVMObject> ContiguousVMObject::create_with_size(size_t size) | ||||||
| { | { | ||||||
|     return adopt(*new ContiguousVMObject(size)); |     return adopt(*new ContiguousVMObject(size)); | ||||||
|  | @ -43,9 +42,7 @@ ContiguousVMObject::ContiguousVMObject(size_t size) | ||||||
|     auto contiguous_physical_pages = MM.allocate_contiguous_supervisor_physical_pages(size); |     auto contiguous_physical_pages = MM.allocate_contiguous_supervisor_physical_pages(size); | ||||||
|     for (size_t i = 0; i < page_count(); i++) { |     for (size_t i = 0; i < page_count(); i++) { | ||||||
|         physical_pages()[i] = contiguous_physical_pages[i]; |         physical_pages()[i] = contiguous_physical_pages[i]; | ||||||
| #ifdef CONTIGUOUS_VMOBJECT_DEBUG |         dbgln<debug_contiguous_vmobject>("Contiguous page[{}]: {}", i, physical_pages()[i]->paddr()); | ||||||
|         dbg() << "Contiguous page[" << i << "]: " << physical_pages()[i]->paddr(); |  | ||||||
| #endif |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -25,12 +25,12 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <AK/BinarySearch.h> | #include <AK/BinarySearch.h> | ||||||
|  | #include <AK/Debug.h> | ||||||
| #include <AK/QuickSort.h> | #include <AK/QuickSort.h> | ||||||
| #include <Kernel/Random.h> | #include <Kernel/Random.h> | ||||||
| #include <Kernel/Thread.h> | #include <Kernel/Thread.h> | ||||||
| #include <Kernel/VM/RangeAllocator.h> | #include <Kernel/VM/RangeAllocator.h> | ||||||
| 
 | 
 | ||||||
| //#define VRA_DEBUG
 |  | ||||||
| #define VM_GUARD_PAGES | #define VM_GUARD_PAGES | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
|  | @ -78,11 +78,18 @@ Vector<Range, 2> Range::carve(const Range& taken) | ||||||
|         parts.append({ base(), taken.base().get() - base().get() }); |         parts.append({ base(), taken.base().get() - base().get() }); | ||||||
|     if (taken.end() < end()) |     if (taken.end() < end()) | ||||||
|         parts.append({ taken.end(), end().get() - taken.end().get() }); |         parts.append({ taken.end(), end().get() - taken.end().get() }); | ||||||
| #ifdef VRA_DEBUG | 
 | ||||||
|     dbg() << "VRA: carve: take " << String::format("%x", taken.base().get()) << "-" << String::format("%x", taken.end().get() - 1) << " from " << String::format("%x", base().get()) << "-" << String::format("%x", end().get() - 1); |     if constexpr (debug_vra) { | ||||||
|  |         dbgln("VRA: carve: take {:x}-{:x} from {:x}-{:x}", | ||||||
|  |             taken.base().get(), | ||||||
|  |             taken.end().get() - 1, | ||||||
|  |             base().get(), | ||||||
|  |             end().get() - 1); | ||||||
|  | 
 | ||||||
|         for (size_t i = 0; i < parts.size(); ++i) |         for (size_t i = 0; i < parts.size(); ++i) | ||||||
|         dbg() << "        " << String::format("%x", parts[i].base().get()) << "-" << String::format("%x", parts[i].end().get() - 1); |             dbgln("        {:x}-{:x}", parts[i].base().get(), parts[i].end().get() - 1); | ||||||
| #endif |     } | ||||||
|  | 
 | ||||||
|     return parts; |     return parts; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -122,17 +129,15 @@ Range RangeAllocator::allocate_anywhere(size_t size, size_t alignment) | ||||||
| 
 | 
 | ||||||
|         Range allocated_range(VirtualAddress(aligned_base), size); |         Range allocated_range(VirtualAddress(aligned_base), size); | ||||||
|         if (available_range == allocated_range) { |         if (available_range == allocated_range) { | ||||||
| #ifdef VRA_DEBUG |             dbgln<debug_vra>("VRA: Allocated perfect-fit anywhere({}, {}): {}", size, alignment, allocated_range.base().get()); | ||||||
|             dbg() << "VRA: Allocated perfect-fit anywhere(" << String::format("%zu", size) << ", " << String::format("%zu", alignment) << "): " << String::format("%x", allocated_range.base().get()); |  | ||||||
| #endif |  | ||||||
|             m_available_ranges.remove(i); |             m_available_ranges.remove(i); | ||||||
|             return allocated_range; |             return allocated_range; | ||||||
|         } |         } | ||||||
|         carve_at_index(i, allocated_range); |         carve_at_index(i, allocated_range); | ||||||
| #ifdef VRA_DEBUG |         if constexpr (debug_vra) { | ||||||
|         dbg() << "VRA: Allocated anywhere(" << String::format("%zu", size) << ", " << String::format("%zu", alignment) << "): " << String::format("%x", allocated_range.base().get()); |             dbgln<debug_vra>("VRA: Allocated anywhere({}, {}): {}", size, alignment, allocated_range.base().get()); | ||||||
|             dump(); |             dump(); | ||||||
| #endif |         } | ||||||
|         return allocated_range; |         return allocated_range; | ||||||
|     } |     } | ||||||
|     klog() << "VRA: Failed to allocate anywhere: " << size << ", " << alignment; |     klog() << "VRA: Failed to allocate anywhere: " << size << ", " << alignment; | ||||||
|  | @ -155,10 +160,12 @@ Range RangeAllocator::allocate_specific(VirtualAddress base, size_t size) | ||||||
|             return allocated_range; |             return allocated_range; | ||||||
|         } |         } | ||||||
|         carve_at_index(i, allocated_range); |         carve_at_index(i, allocated_range); | ||||||
| #ifdef VRA_DEBUG | 
 | ||||||
|         dbg() << "VRA: Allocated specific(" << size << "): " << String::format("%x", available_range.base().get()); |         if constexpr (debug_vra) { | ||||||
|  |             dbgln("VRA: Allocated specific({}): {}", size, available_range.base().get()); | ||||||
|             dump(); |             dump(); | ||||||
| #endif |         } | ||||||
|  | 
 | ||||||
|         return allocated_range; |         return allocated_range; | ||||||
|     } |     } | ||||||
|     dbgln("VRA: Failed to allocate specific range: {}({})", base, size); |     dbgln("VRA: Failed to allocate specific range: {}({})", base, size); | ||||||
|  | @ -172,10 +179,10 @@ void RangeAllocator::deallocate(Range range) | ||||||
|     ASSERT(range.size()); |     ASSERT(range.size()); | ||||||
|     ASSERT(range.base() < range.end()); |     ASSERT(range.base() < range.end()); | ||||||
| 
 | 
 | ||||||
| #ifdef VRA_DEBUG |     if constexpr (debug_vra) { | ||||||
|     dbg() << "VRA: Deallocate: " << String::format("%x", range.base().get()) << "(" << range.size() << ")"; |         dbgln("VRA: Deallocate: {}({})", range.base().get(), range.size()); | ||||||
|         dump(); |         dump(); | ||||||
| #endif |     } | ||||||
| 
 | 
 | ||||||
|     ASSERT(!m_available_ranges.is_empty()); |     ASSERT(!m_available_ranges.is_empty()); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -24,6 +24,7 @@ | ||||||
|  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | #include <AK/Debug.h> | ||||||
| #include <AK/Memory.h> | #include <AK/Memory.h> | ||||||
| #include <AK/StringView.h> | #include <AK/StringView.h> | ||||||
| #include <Kernel/FileSystem/Inode.h> | #include <Kernel/FileSystem/Inode.h> | ||||||
|  | @ -35,8 +36,6 @@ | ||||||
| #include <Kernel/VM/Region.h> | #include <Kernel/VM/Region.h> | ||||||
| #include <Kernel/VM/SharedInodeVMObject.h> | #include <Kernel/VM/SharedInodeVMObject.h> | ||||||
| 
 | 
 | ||||||
| //#define PAGE_FAULT_DEBUG
 |  | ||||||
| 
 |  | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
| 
 | 
 | ||||||
| Region::Region(const Range& range, NonnullRefPtr<VMObject> vmobject, size_t offset_in_vmobject, const String& name, u8 access, bool cacheable, bool kernel, bool shared) | Region::Region(const Range& range, NonnullRefPtr<VMObject> vmobject, size_t offset_in_vmobject, const String& name, u8 access, bool cacheable, bool kernel, bool shared) | ||||||
|  | @ -411,9 +410,7 @@ PageFaultResponse Region::handle_fault(const PageFault& fault) | ||||||
|             return PageFaultResponse::ShouldCrash; |             return PageFaultResponse::ShouldCrash; | ||||||
|         } |         } | ||||||
|         if (vmobject().is_inode()) { |         if (vmobject().is_inode()) { | ||||||
| #ifdef PAGE_FAULT_DEBUG |             dbgln<debug_page_fault>("NP(inode) fault in Region({})[{}]", this, page_index_in_region); | ||||||
|             dbg() << "NP(inode) fault in Region{" << this << "}[" << page_index_in_region << "]"; |  | ||||||
| #endif |  | ||||||
|             return handle_inode_fault(page_index_in_region); |             return handle_inode_fault(page_index_in_region); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | @ -438,14 +435,10 @@ PageFaultResponse Region::handle_fault(const PageFault& fault) | ||||||
|     } |     } | ||||||
|     ASSERT(fault.type() == PageFault::Type::ProtectionViolation); |     ASSERT(fault.type() == PageFault::Type::ProtectionViolation); | ||||||
|     if (fault.access() == PageFault::Access::Write && is_writable() && should_cow(page_index_in_region)) { |     if (fault.access() == PageFault::Access::Write && is_writable() && should_cow(page_index_in_region)) { | ||||||
| #ifdef PAGE_FAULT_DEBUG |         dbgln<debug_page_fault>("PV(cow) fault in Region({})[{}] at {}", this, page_index_in_region, fault.vaddr()); | ||||||
|         dbg() << "PV(cow) fault in Region{" << this << "}[" << page_index_in_region << "] at " << fault.vaddr(); |  | ||||||
| #endif |  | ||||||
|         auto* phys_page = physical_page(page_index_in_region); |         auto* phys_page = physical_page(page_index_in_region); | ||||||
|         if (phys_page->is_shared_zero_page() || phys_page->is_lazy_committed_page()) { |         if (phys_page->is_shared_zero_page() || phys_page->is_lazy_committed_page()) { | ||||||
| #ifdef PAGE_FAULT_DEBUG |             dbgln<debug_page_fault>("NP(zero) fault in Region({})[{}] at {}", this, page_index_in_region, fault.vaddr()); | ||||||
|             dbg() << "NP(zero) fault in Region{" << this << "}[" << page_index_in_region << "] at " << fault.vaddr(); |  | ||||||
| #endif |  | ||||||
|             return handle_zero_fault(page_index_in_region); |             return handle_zero_fault(page_index_in_region); | ||||||
|         } |         } | ||||||
|         return handle_cow_fault(page_index_in_region); |         return handle_cow_fault(page_index_in_region); | ||||||
|  | @ -479,18 +472,14 @@ PageFaultResponse Region::handle_zero_fault(size_t page_index_in_region) | ||||||
| 
 | 
 | ||||||
|     if (page_slot->is_lazy_committed_page()) { |     if (page_slot->is_lazy_committed_page()) { | ||||||
|         page_slot = static_cast<AnonymousVMObject&>(*m_vmobject).allocate_committed_page(page_index_in_vmobject); |         page_slot = static_cast<AnonymousVMObject&>(*m_vmobject).allocate_committed_page(page_index_in_vmobject); | ||||||
| #ifdef PAGE_FAULT_DEBUG |         dbgln<debug_page_fault>("      >> ALLOCATED COMMITTED {}", page_slot->paddr()); | ||||||
|         dbg() << "      >> ALLOCATED COMMITTED " << page_slot->paddr(); |  | ||||||
| #endif |  | ||||||
|     } else { |     } else { | ||||||
|         page_slot = MM.allocate_user_physical_page(MemoryManager::ShouldZeroFill::Yes); |         page_slot = MM.allocate_user_physical_page(MemoryManager::ShouldZeroFill::Yes); | ||||||
|         if (page_slot.is_null()) { |         if (page_slot.is_null()) { | ||||||
|             klog() << "MM: handle_zero_fault was unable to allocate a physical page"; |             klog() << "MM: handle_zero_fault was unable to allocate a physical page"; | ||||||
|             return PageFaultResponse::OutOfMemory; |             return PageFaultResponse::OutOfMemory; | ||||||
|         } |         } | ||||||
| #ifdef PAGE_FAULT_DEBUG |         dbgln<debug_page_fault>("      >> ALLOCATED {}", page_slot->paddr()); | ||||||
|         dbg() << "      >> ALLOCATED " << page_slot->paddr(); |  | ||||||
| #endif |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (!remap_vmobject_page(page_index_in_vmobject)) { |     if (!remap_vmobject_page(page_index_in_vmobject)) { | ||||||
|  | @ -529,14 +518,10 @@ PageFaultResponse Region::handle_inode_fault(size_t page_index_in_region) | ||||||
|     auto page_index_in_vmobject = translate_to_vmobject_page(page_index_in_region); |     auto page_index_in_vmobject = translate_to_vmobject_page(page_index_in_region); | ||||||
|     auto& vmobject_physical_page_entry = inode_vmobject.physical_pages()[page_index_in_vmobject]; |     auto& vmobject_physical_page_entry = inode_vmobject.physical_pages()[page_index_in_vmobject]; | ||||||
| 
 | 
 | ||||||
| #ifdef PAGE_FAULT_DEBUG |     dbgln<debug_page_fault>("Inode fault in {} page index: {}", name(), page_index_in_region); | ||||||
|     dbg() << "Inode fault in " << name() << " page index: " << page_index_in_region; |  | ||||||
| #endif |  | ||||||
| 
 | 
 | ||||||
|     if (!vmobject_physical_page_entry.is_null()) { |     if (!vmobject_physical_page_entry.is_null()) { | ||||||
| #ifdef PAGE_FAULT_DEBUG |         dbgln<debug_page_fault>("MM: page_in_from_inode() but page already present. Fine with me!"); | ||||||
|         dbg() << ("MM: page_in_from_inode() but page already present. Fine with me!"); |  | ||||||
| #endif |  | ||||||
|         if (!remap_vmobject_page(page_index_in_vmobject)) |         if (!remap_vmobject_page(page_index_in_vmobject)) | ||||||
|             return PageFaultResponse::OutOfMemory; |             return PageFaultResponse::OutOfMemory; | ||||||
|         return PageFaultResponse::Continue; |         return PageFaultResponse::Continue; | ||||||
|  |  | ||||||
|  | @ -28,6 +28,7 @@ | ||||||
| #include "JSIntegration.h" | #include "JSIntegration.h" | ||||||
| #include "Workbook.h" | #include "Workbook.h" | ||||||
| #include <AK/ByteBuffer.h> | #include <AK/ByteBuffer.h> | ||||||
|  | #include <AK/Debug.h> | ||||||
| #include <AK/GenericLexer.h> | #include <AK/GenericLexer.h> | ||||||
| #include <AK/JsonArray.h> | #include <AK/JsonArray.h> | ||||||
| #include <AK/JsonObject.h> | #include <AK/JsonObject.h> | ||||||
|  | @ -354,9 +355,7 @@ void Sheet::copy_cells(Vector<Position> from, Vector<Position> to, Optional<Posi | ||||||
|         auto& target = to.first(); |         auto& target = to.first(); | ||||||
| 
 | 
 | ||||||
|         for (auto& position : from) { |         for (auto& position : from) { | ||||||
| #ifdef COPY_DEBUG |             dbgln<debug_copy>("Paste from '{}' to '{}'", position.to_url(), target.to_url()); | ||||||
|             dbg() << "Paste from '" << position.to_url() << "' to '" << target.to_url() << "'"; |  | ||||||
| #endif |  | ||||||
|             copy_to(position, resolve_relative_to.has_value() ? offset_relative_to(target, position, resolve_relative_to.value()) : target); |             copy_to(position, resolve_relative_to.has_value() ? offset_relative_to(target, position, resolve_relative_to.value()) : target); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | @ -367,9 +366,7 @@ void Sheet::copy_cells(Vector<Position> from, Vector<Position> to, Optional<Posi | ||||||
|         // Fill the target selection with the single cell.
 |         // Fill the target selection with the single cell.
 | ||||||
|         auto& source = from.first(); |         auto& source = from.first(); | ||||||
|         for (auto& position : to) { |         for (auto& position : to) { | ||||||
| #ifdef COPY_DEBUG |             dbgln<debug_copy>("Paste from '{}' to '{}'", source.to_url(), position.to_url()); | ||||||
|             dbg() << "Paste from '" << source.to_url() << "' to '" << position.to_url() << "'"; |  | ||||||
| #endif |  | ||||||
|             copy_to(source, resolve_relative_to.has_value() ? offset_relative_to(position, source, resolve_relative_to.value()) : position); |             copy_to(source, resolve_relative_to.has_value() ? offset_relative_to(position, source, resolve_relative_to.value()) : position); | ||||||
|         } |         } | ||||||
|         return; |         return; | ||||||
|  |  | ||||||
|  | @ -28,11 +28,10 @@ | ||||||
| #include "FormEditorWidget.h" | #include "FormEditorWidget.h" | ||||||
| #include "FormWidget.h" | #include "FormWidget.h" | ||||||
| #include "WidgetTreeModel.h" | #include "WidgetTreeModel.h" | ||||||
|  | #include <AK/Debug.h> | ||||||
| #include <AK/LogStream.h> | #include <AK/LogStream.h> | ||||||
| #include <LibGfx/Palette.h> | #include <LibGfx/Palette.h> | ||||||
| 
 | 
 | ||||||
| //#define DEBUG_CURSOR_TOOL
 |  | ||||||
| 
 |  | ||||||
| namespace HackStudio { | namespace HackStudio { | ||||||
| 
 | 
 | ||||||
| void CursorTool::on_mousedown(GUI::MouseEvent& event) | void CursorTool::on_mousedown(GUI::MouseEvent& event) | ||||||
|  | @ -49,9 +48,7 @@ void CursorTool::on_mousedown(GUI::MouseEvent& event) | ||||||
|                 m_editor.selection().toggle(*result.widget); |                 m_editor.selection().toggle(*result.widget); | ||||||
|             } else if (!event.modifiers()) { |             } else if (!event.modifiers()) { | ||||||
|                 if (!m_editor.selection().contains(*result.widget)) { |                 if (!m_editor.selection().contains(*result.widget)) { | ||||||
| #ifdef DEBUG_CURSOR_TOOL |                     dbgln<debug_cursor_tool>("Selection didn't contain {}, making it the only selected one", *result.widget); | ||||||
|                     dbg() << "Selection didn't contain " << *result.widget << ", making it the only selected one"; |  | ||||||
| #endif |  | ||||||
|                     m_editor.selection().set(*result.widget); |                     m_editor.selection().set(*result.widget); | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -26,13 +26,11 @@ | ||||||
| 
 | 
 | ||||||
| #include "ClientConnection.h" | #include "ClientConnection.h" | ||||||
| #include "AutoComplete.h" | #include "AutoComplete.h" | ||||||
|  | #include <AK/Debug.h> | ||||||
| #include <AK/HashMap.h> | #include <AK/HashMap.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/File.h> | ||||||
| #include <LibGUI/TextDocument.h> | #include <LibGUI/TextDocument.h> | ||||||
| 
 | 
 | ||||||
| // #define DEBUG_CPP_LANGUAGE_SERVER
 |  | ||||||
| // #define DEBUG_FILE_CONTENT
 |  | ||||||
| 
 |  | ||||||
| namespace LanguageServers::Cpp { | namespace LanguageServers::Cpp { | ||||||
| 
 | 
 | ||||||
| static HashMap<int, RefPtr<ClientConnection>> s_connections; | static HashMap<int, RefPtr<ClientConnection>> s_connections; | ||||||
|  | @ -89,9 +87,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileOpened& messag | ||||||
|     auto document = GUI::TextDocument::create(&s_default_document_client); |     auto document = GUI::TextDocument::create(&s_default_document_client); | ||||||
|     document->set_text(content_view); |     document->set_text(content_view); | ||||||
|     m_open_files.set(message.file_name(), document); |     m_open_files.set(message.file_name(), document); | ||||||
| #ifdef DEBUG_FILE_CONTENT |     dbgln<debug_file_content>("{}", document->text()); | ||||||
|     dbg() << document->text(); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText& message) | void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText& message) | ||||||
|  |  | ||||||
|  | @ -26,13 +26,11 @@ | ||||||
| 
 | 
 | ||||||
| #include "ClientConnection.h" | #include "ClientConnection.h" | ||||||
| #include "AutoComplete.h" | #include "AutoComplete.h" | ||||||
|  | #include <AK/Debug.h> | ||||||
| #include <AK/HashMap.h> | #include <AK/HashMap.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/File.h> | ||||||
| #include <LibGUI/TextDocument.h> | #include <LibGUI/TextDocument.h> | ||||||
| 
 | 
 | ||||||
| // #define DEBUG_SH_LANGUAGE_SERVER
 |  | ||||||
| // #define DEBUG_FILE_CONTENT
 |  | ||||||
| 
 |  | ||||||
| namespace LanguageServers::Shell { | namespace LanguageServers::Shell { | ||||||
| 
 | 
 | ||||||
| static HashMap<int, RefPtr<ClientConnection>> s_connections; | static HashMap<int, RefPtr<ClientConnection>> s_connections; | ||||||
|  | @ -89,9 +87,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileOpened& messag | ||||||
|     auto document = GUI::TextDocument::create(&s_default_document_client); |     auto document = GUI::TextDocument::create(&s_default_document_client); | ||||||
|     document->set_text(content_view); |     document->set_text(content_view); | ||||||
|     m_open_files.set(message.file_name(), document); |     m_open_files.set(message.file_name(), document); | ||||||
| #ifdef DEBUG_FILE_CONTENT |     dbgln<debug_file_content>("{}", document->text()); | ||||||
|     dbg() << document->text(); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText& message) | void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText& message) | ||||||
|  | @ -133,9 +129,7 @@ void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     document->remove(range); |     document->remove(range); | ||||||
| #ifdef DEBUG_FILE_CONTENT |     dbgln<debug_file_content>("{}", document->text()); | ||||||
|     dbg() << document->text(); |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ClientConnection::handle(const Messages::LanguageServer::AutoCompleteSuggestions& message) | void ClientConnection::handle(const Messages::LanguageServer::AutoCompleteSuggestions& message) | ||||||
|  |  | ||||||
|  | @ -25,14 +25,13 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <AK/ByteBuffer.h> | #include <AK/ByteBuffer.h> | ||||||
|  | #include <AK/Debug.h> | ||||||
| #include <AK/Optional.h> | #include <AK/Optional.h> | ||||||
| #include <LibCore/Gzip.h> | #include <LibCore/Gzip.h> | ||||||
| #include <LibCore/puff.h> | #include <LibCore/puff.h> | ||||||
| #include <limits.h> | #include <limits.h> | ||||||
| #include <stddef.h> | #include <stddef.h> | ||||||
| 
 | 
 | ||||||
| //#define DEBUG_GZIP
 |  | ||||||
| 
 |  | ||||||
| namespace Core { | namespace Core { | ||||||
| 
 | 
 | ||||||
| bool Gzip::is_compressed(const ByteBuffer& data) | bool Gzip::is_compressed(const ByteBuffer& data) | ||||||
|  | @ -103,9 +102,7 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     auto new_size = data.size() - current; |     auto new_size = data.size() - current; | ||||||
| #ifdef DEBUG_GZIP |     dbgln<debug_gzip>("get_gzip_payload: Returning slice from {} with size {}", current, new_size); | ||||||
|     dbg() << "get_gzip_payload: Returning slice from " << current << " with size " << new_size; |  | ||||||
| #endif |  | ||||||
|     return data.slice(current, new_size); |     return data.slice(current, new_size); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -113,9 +110,7 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data) | ||||||
| { | { | ||||||
|     ASSERT(is_compressed(data)); |     ASSERT(is_compressed(data)); | ||||||
| 
 | 
 | ||||||
| #ifdef DEBUG_GZIP |     dbgln<debug_gzip>("Gzip::decompress: Decompressing gzip compressed data. size={}", data.size()); | ||||||
|     dbg() << "Gzip::decompress: Decompressing gzip compressed data. Size = " << data.size(); |  | ||||||
| #endif |  | ||||||
|     auto optional_payload = get_gzip_payload(data); |     auto optional_payload = get_gzip_payload(data); | ||||||
|     if (!optional_payload.has_value()) { |     if (!optional_payload.has_value()) { | ||||||
|         return Optional<ByteBuffer>(); |         return Optional<ByteBuffer>(); | ||||||
|  | @ -127,13 +122,13 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data) | ||||||
|     while (true) { |     while (true) { | ||||||
|         unsigned long destination_len = destination.size(); |         unsigned long destination_len = destination.size(); | ||||||
| 
 | 
 | ||||||
| #ifdef DEBUG_GZIP |         if constexpr (debug_gzip) { | ||||||
|         dbg() << "Gzip::decompress: Calling puff()\n" |             dbgln("Gzip::decompress: Calling puff()"); | ||||||
|               << "  destination_data = " << destination.data() << "\n" |             dbgln("  destination_data = {}", destination.data()); | ||||||
|               << "  destination_len = " << destination_len << "\n" |             dbgln("  destination_len = {}", destination_len); | ||||||
|               << "  source_data = " << source.data() << "\n" |             dbgln("  source_data = {}", source.data()); | ||||||
|               << "  source_len = " << source_len; |             dbgln("  source_len = {}", source_len); | ||||||
| #endif |         } | ||||||
| 
 | 
 | ||||||
|         auto puff_ret = puff( |         auto puff_ret = puff( | ||||||
|             destination.data(), &destination_len, |             destination.data(), &destination_len, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 asynts
						asynts