mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:07: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
|
@ -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 <Kernel/Process.h>
|
||||
#include <Kernel/TTY/TTY.h>
|
||||
|
@ -304,19 +305,19 @@ void TTY::flush_input()
|
|||
void TTY::set_termios(const termios& t)
|
||||
{
|
||||
m_termios = t;
|
||||
#ifdef TTY_DEBUG
|
||||
dbg() << tty_name() << " set_termios: "
|
||||
<< "ECHO=" << should_echo_input()
|
||||
<< ", ISIG=" << should_generate_signals()
|
||||
<< ", ICANON=" << in_canonical_mode()
|
||||
<< ", ECHOE=" << ((m_termios.c_lflag & ECHOE) != 0)
|
||||
<< ", ECHOK=" << ((m_termios.c_lflag & ECHOK) != 0)
|
||||
<< ", ECHONL=" << ((m_termios.c_lflag & ECHONL) != 0)
|
||||
<< ", ISTRIP=" << ((m_termios.c_iflag & ISTRIP) != 0)
|
||||
<< ", ICRNL=" << ((m_termios.c_iflag & ICRNL) != 0)
|
||||
<< ", INLCR=" << ((m_termios.c_iflag & INLCR) != 0)
|
||||
<< ", IGNCR=" << ((m_termios.c_iflag & IGNCR) != 0);
|
||||
#endif
|
||||
|
||||
dbgln<debug_tty>("{} set_termios: ECHO={}, ISIG={}, ICANON={}, ECHOE={}, ECHOK={}, ECHONL={}, ISTRIP={}, ICRNL={}, INLCR={}, IGNCR={}",
|
||||
tty_name(),
|
||||
should_echo_input(),
|
||||
should_generate_signals(),
|
||||
in_canonical_mode(),
|
||||
((m_termios.c_lflag & ECHOE) != 0),
|
||||
((m_termios.c_lflag & ECHOK) != 0),
|
||||
((m_termios.c_lflag & ECHONL) != 0),
|
||||
((m_termios.c_iflag & ISTRIP) != 0),
|
||||
((m_termios.c_iflag & ICRNL) != 0),
|
||||
((m_termios.c_iflag & INLCR) != 0),
|
||||
((m_termios.c_iflag & IGNCR) != 0));
|
||||
}
|
||||
|
||||
int TTY::ioctl(FileDescription&, unsigned request, FlatPtr arg)
|
||||
|
|
|
@ -24,14 +24,12 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/VM/AnonymousVMObject.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/VM/PhysicalPage.h>
|
||||
|
||||
//#define COMMIT_DEBUG
|
||||
//#define PAGE_FAULT_DEBUG
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
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);
|
||||
#ifdef PAGE_FAULT_DEBUG
|
||||
dbg() << " >> COW " << page->paddr() << " <- " << page_slot->paddr();
|
||||
#endif
|
||||
dbgln<debug_page_fault>(" >> COW {} <- {}", page->paddr(), page_slot->paddr());
|
||||
{
|
||||
SmapDisabler disabler;
|
||||
void* fault_at;
|
||||
|
|
|
@ -24,14 +24,13 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <Kernel/VM/ContiguousVMObject.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/VM/PhysicalPage.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
//#define CONTIGUOUS_VMOBJECT_DEBUG
|
||||
|
||||
NonnullRefPtr<ContiguousVMObject> ContiguousVMObject::create_with_size(size_t 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);
|
||||
for (size_t i = 0; i < page_count(); i++) {
|
||||
physical_pages()[i] = contiguous_physical_pages[i];
|
||||
#ifdef CONTIGUOUS_VMOBJECT_DEBUG
|
||||
dbg() << "Contiguous page[" << i << "]: " << physical_pages()[i]->paddr();
|
||||
#endif
|
||||
dbgln<debug_contiguous_vmobject>("Contiguous page[{}]: {}", i, physical_pages()[i]->paddr());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
*/
|
||||
|
||||
#include <AK/BinarySearch.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <Kernel/Random.h>
|
||||
#include <Kernel/Thread.h>
|
||||
#include <Kernel/VM/RangeAllocator.h>
|
||||
|
||||
//#define VRA_DEBUG
|
||||
#define VM_GUARD_PAGES
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -78,11 +78,18 @@ Vector<Range, 2> Range::carve(const Range& taken)
|
|||
parts.append({ base(), taken.base().get() - base().get() });
|
||||
if (taken.end() < end())
|
||||
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);
|
||||
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);
|
||||
#endif
|
||||
|
||||
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)
|
||||
dbgln(" {:x}-{:x}", parts[i].base().get(), parts[i].end().get() - 1);
|
||||
}
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
|
@ -122,17 +129,15 @@ Range RangeAllocator::allocate_anywhere(size_t size, size_t alignment)
|
|||
|
||||
Range allocated_range(VirtualAddress(aligned_base), size);
|
||||
if (available_range == allocated_range) {
|
||||
#ifdef VRA_DEBUG
|
||||
dbg() << "VRA: Allocated perfect-fit anywhere(" << String::format("%zu", size) << ", " << String::format("%zu", alignment) << "): " << String::format("%x", allocated_range.base().get());
|
||||
#endif
|
||||
dbgln<debug_vra>("VRA: Allocated perfect-fit anywhere({}, {}): {}", size, alignment, allocated_range.base().get());
|
||||
m_available_ranges.remove(i);
|
||||
return allocated_range;
|
||||
}
|
||||
carve_at_index(i, allocated_range);
|
||||
#ifdef VRA_DEBUG
|
||||
dbg() << "VRA: Allocated anywhere(" << String::format("%zu", size) << ", " << String::format("%zu", alignment) << "): " << String::format("%x", allocated_range.base().get());
|
||||
dump();
|
||||
#endif
|
||||
if constexpr (debug_vra) {
|
||||
dbgln<debug_vra>("VRA: Allocated anywhere({}, {}): {}", size, alignment, allocated_range.base().get());
|
||||
dump();
|
||||
}
|
||||
return allocated_range;
|
||||
}
|
||||
klog() << "VRA: Failed to allocate anywhere: " << size << ", " << alignment;
|
||||
|
@ -155,10 +160,12 @@ Range RangeAllocator::allocate_specific(VirtualAddress base, size_t size)
|
|||
return allocated_range;
|
||||
}
|
||||
carve_at_index(i, allocated_range);
|
||||
#ifdef VRA_DEBUG
|
||||
dbg() << "VRA: Allocated specific(" << size << "): " << String::format("%x", available_range.base().get());
|
||||
dump();
|
||||
#endif
|
||||
|
||||
if constexpr (debug_vra) {
|
||||
dbgln("VRA: Allocated specific({}): {}", size, available_range.base().get());
|
||||
dump();
|
||||
}
|
||||
|
||||
return allocated_range;
|
||||
}
|
||||
dbgln("VRA: Failed to allocate specific range: {}({})", base, size);
|
||||
|
@ -172,10 +179,10 @@ void RangeAllocator::deallocate(Range range)
|
|||
ASSERT(range.size());
|
||||
ASSERT(range.base() < range.end());
|
||||
|
||||
#ifdef VRA_DEBUG
|
||||
dbg() << "VRA: Deallocate: " << String::format("%x", range.base().get()) << "(" << range.size() << ")";
|
||||
dump();
|
||||
#endif
|
||||
if constexpr (debug_vra) {
|
||||
dbgln("VRA: Deallocate: {}({})", range.base().get(), range.size());
|
||||
dump();
|
||||
}
|
||||
|
||||
ASSERT(!m_available_ranges.is_empty());
|
||||
|
||||
|
|
|
@ -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/Inode.h>
|
||||
|
@ -35,8 +36,6 @@
|
|||
#include <Kernel/VM/Region.h>
|
||||
#include <Kernel/VM/SharedInodeVMObject.h>
|
||||
|
||||
//#define PAGE_FAULT_DEBUG
|
||||
|
||||
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)
|
||||
|
@ -411,9 +410,7 @@ PageFaultResponse Region::handle_fault(const PageFault& fault)
|
|||
return PageFaultResponse::ShouldCrash;
|
||||
}
|
||||
if (vmobject().is_inode()) {
|
||||
#ifdef PAGE_FAULT_DEBUG
|
||||
dbg() << "NP(inode) fault in Region{" << this << "}[" << page_index_in_region << "]";
|
||||
#endif
|
||||
dbgln<debug_page_fault>("NP(inode) fault in Region({})[{}]", this, 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);
|
||||
if (fault.access() == PageFault::Access::Write && is_writable() && should_cow(page_index_in_region)) {
|
||||
#ifdef PAGE_FAULT_DEBUG
|
||||
dbg() << "PV(cow) fault in Region{" << this << "}[" << page_index_in_region << "] at " << fault.vaddr();
|
||||
#endif
|
||||
dbgln<debug_page_fault>("PV(cow) fault in Region({})[{}] at {}", this, page_index_in_region, fault.vaddr());
|
||||
auto* phys_page = physical_page(page_index_in_region);
|
||||
if (phys_page->is_shared_zero_page() || phys_page->is_lazy_committed_page()) {
|
||||
#ifdef PAGE_FAULT_DEBUG
|
||||
dbg() << "NP(zero) fault in Region{" << this << "}[" << page_index_in_region << "] at " << fault.vaddr();
|
||||
#endif
|
||||
dbgln<debug_page_fault>("NP(zero) fault in Region({})[{}] at {}", this, page_index_in_region, fault.vaddr());
|
||||
return handle_zero_fault(page_index_in_region);
|
||||
}
|
||||
return handle_cow_fault(page_index_in_region);
|
||||
|
@ -479,18 +472,14 @@ PageFaultResponse Region::handle_zero_fault(size_t page_index_in_region)
|
|||
|
||||
if (page_slot->is_lazy_committed_page()) {
|
||||
page_slot = static_cast<AnonymousVMObject&>(*m_vmobject).allocate_committed_page(page_index_in_vmobject);
|
||||
#ifdef PAGE_FAULT_DEBUG
|
||||
dbg() << " >> ALLOCATED COMMITTED " << page_slot->paddr();
|
||||
#endif
|
||||
dbgln<debug_page_fault>(" >> ALLOCATED COMMITTED {}", page_slot->paddr());
|
||||
} else {
|
||||
page_slot = MM.allocate_user_physical_page(MemoryManager::ShouldZeroFill::Yes);
|
||||
if (page_slot.is_null()) {
|
||||
klog() << "MM: handle_zero_fault was unable to allocate a physical page";
|
||||
return PageFaultResponse::OutOfMemory;
|
||||
}
|
||||
#ifdef PAGE_FAULT_DEBUG
|
||||
dbg() << " >> ALLOCATED " << page_slot->paddr();
|
||||
#endif
|
||||
dbgln<debug_page_fault>(" >> ALLOCATED {}", page_slot->paddr());
|
||||
}
|
||||
|
||||
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& vmobject_physical_page_entry = inode_vmobject.physical_pages()[page_index_in_vmobject];
|
||||
|
||||
#ifdef PAGE_FAULT_DEBUG
|
||||
dbg() << "Inode fault in " << name() << " page index: " << page_index_in_region;
|
||||
#endif
|
||||
dbgln<debug_page_fault>("Inode fault in {} page index: {}", name(), page_index_in_region);
|
||||
|
||||
if (!vmobject_physical_page_entry.is_null()) {
|
||||
#ifdef PAGE_FAULT_DEBUG
|
||||
dbg() << ("MM: page_in_from_inode() but page already present. Fine with me!");
|
||||
#endif
|
||||
dbgln<debug_page_fault>("MM: page_in_from_inode() but page already present. Fine with me!");
|
||||
if (!remap_vmobject_page(page_index_in_vmobject))
|
||||
return PageFaultResponse::OutOfMemory;
|
||||
return PageFaultResponse::Continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue