mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 01:57:44 +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
663a6141d8
commit
5356aae3cc
5 changed files with 57 additions and 71 deletions
24
AK/Debug.h
24
AK/Debug.h
|
@ -69,3 +69,27 @@ constexpr bool debug_bmp = true;
|
||||||
#else
|
#else
|
||||||
constexpr bool debug_bmp = false;
|
constexpr bool debug_bmp = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WAITBLOCK_DEBUG
|
||||||
|
constexpr bool debug_waitblock = true;
|
||||||
|
#else
|
||||||
|
constexpr bool debug_waitblock = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WAITQUEUE_DEBUG
|
||||||
|
constexpr bool debug_waitqueue = true;
|
||||||
|
#else
|
||||||
|
constexpr bool debug_waitqueue = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MULTIPROCESSOR_DEBUG
|
||||||
|
constexpr bool debug_multiprocessor = true;
|
||||||
|
#else
|
||||||
|
constexpr bool debug_multiprocessor = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ACPI_DEBUG
|
||||||
|
constexpr bool debug_acpi = true;
|
||||||
|
#else
|
||||||
|
constexpr bool debug_acpi = false;
|
||||||
|
#endif
|
||||||
|
|
|
@ -25,6 +25,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/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <Kernel/ACPI/MultiProcessorParser.h>
|
#include <Kernel/ACPI/MultiProcessorParser.h>
|
||||||
#include <Kernel/Arch/PC/BIOS.h>
|
#include <Kernel/Arch/PC/BIOS.h>
|
||||||
|
@ -68,9 +69,7 @@ void MultiProcessorParser::parse_configuration_table()
|
||||||
size_t entry_count = config_table->entry_count;
|
size_t entry_count = config_table->entry_count;
|
||||||
auto* entry = config_table->entries;
|
auto* entry = config_table->entries;
|
||||||
while (entry_count > 0) {
|
while (entry_count > 0) {
|
||||||
#ifdef MULTIPROCESSOR_DEBUG
|
dbgln<debug_multiprocessor>("MultiProcessor: Entry Type {} detected.", entry->entry_type);
|
||||||
dbg() << "MultiProcessor: Entry Type " << entry->entry_type << " detected.";
|
|
||||||
#endif
|
|
||||||
switch (entry->entry_type) {
|
switch (entry->entry_type) {
|
||||||
case ((u8)MultiProcessor::ConfigurationTableEntryType::Processor):
|
case ((u8)MultiProcessor::ConfigurationTableEntryType::Processor):
|
||||||
entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::ProcessorEntry);
|
entry = (MultiProcessor::EntryHeader*)(FlatPtr)entry + sizeof(MultiProcessor::ProcessorEntry);
|
||||||
|
|
|
@ -25,6 +25,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/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <Kernel/ACPI/Parser.h>
|
#include <Kernel/ACPI/Parser.h>
|
||||||
#include <Kernel/Arch/PC/BIOS.h>
|
#include <Kernel/Arch/PC/BIOS.h>
|
||||||
|
@ -65,18 +66,12 @@ void Parser::locate_static_data()
|
||||||
|
|
||||||
PhysicalAddress Parser::find_table(const StringView& signature)
|
PhysicalAddress Parser::find_table(const StringView& signature)
|
||||||
{
|
{
|
||||||
#ifdef ACPI_DEBUG
|
dbgln<debug_acpi>("ACPI: Calling Find Table method!");
|
||||||
dbgln("ACPI: Calling Find Table method!");
|
|
||||||
#endif
|
|
||||||
for (auto p_sdt : m_sdt_pointers) {
|
for (auto p_sdt : m_sdt_pointers) {
|
||||||
auto sdt = map_typed<Structures::SDTHeader>(p_sdt);
|
auto sdt = map_typed<Structures::SDTHeader>(p_sdt);
|
||||||
#ifdef ACPI_DEBUG
|
dbgln<debug_acpi>("ACPI: Examining Table @ {}", p_sdt);
|
||||||
dbg() << "ACPI: Examining Table @ P " << p_sdt;
|
|
||||||
#endif
|
|
||||||
if (!strncmp(sdt->sig, signature.characters_without_null_termination(), 4)) {
|
if (!strncmp(sdt->sig, signature.characters_without_null_termination(), 4)) {
|
||||||
#ifdef ACPI_DEBUG
|
dbgln<debug_acpi>("ACPI: Found Table @ {}", p_sdt);
|
||||||
dbg() << "ACPI: Found Table @ P " << p_sdt;
|
|
||||||
#endif
|
|
||||||
return p_sdt;
|
return p_sdt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,9 +93,8 @@ void Parser::init_fadt()
|
||||||
|
|
||||||
auto sdt = map_typed<Structures::FADT>(m_fadt);
|
auto sdt = map_typed<Structures::FADT>(m_fadt);
|
||||||
|
|
||||||
#ifdef ACPI_DEBUG
|
dbgln<debug_acpi>("ACPI: FADT @ V{}, {}", &sdt, m_fadt);
|
||||||
dbg() << "ACPI: FADT @ V " << &sdt << ", P " << (void*)m_fadt.as_ptr();
|
|
||||||
#endif
|
|
||||||
klog() << "ACPI: Fixed ACPI data, Revision " << sdt->h.revision << ", Length " << sdt->h.length << " bytes";
|
klog() << "ACPI: Fixed ACPI data, Revision " << sdt->h.revision << ", Length " << sdt->h.length << " bytes";
|
||||||
klog() << "ACPI: DSDT " << PhysicalAddress(sdt->dsdt_ptr);
|
klog() << "ACPI: DSDT " << PhysicalAddress(sdt->dsdt_ptr);
|
||||||
m_x86_specific_flags.cmos_rtc_not_present = (sdt->ia_pc_boot_arch_flags & (u8)FADTFlags::IA_PC_Flags::CMOS_RTC_Not_Present);
|
m_x86_specific_flags.cmos_rtc_not_present = (sdt->ia_pc_boot_arch_flags & (u8)FADTFlags::IA_PC_Flags::CMOS_RTC_Not_Present);
|
||||||
|
@ -225,9 +219,7 @@ void Parser::try_acpi_reboot()
|
||||||
klog() << "ACPI: Reboot, Not supported!";
|
klog() << "ACPI: Reboot, Not supported!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef ACPI_DEBUG
|
dbgln<debug_acpi>("ACPI: Rebooting, Probing FADT ({})", m_fadt);
|
||||||
dbg() << "ACPI: Rebooting, Probing FADT (" << m_fadt << ")";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
auto fadt = map_typed<Structures::FADT>(m_fadt);
|
auto fadt = map_typed<Structures::FADT>(m_fadt);
|
||||||
ASSERT(validate_reset_register());
|
ASSERT(validate_reset_register());
|
||||||
|
@ -275,26 +267,18 @@ void Parser::initialize_main_system_description_table()
|
||||||
auto& xsdt = (const Structures::XSDT&)*sdt;
|
auto& xsdt = (const Structures::XSDT&)*sdt;
|
||||||
klog() << "ACPI: Using XSDT, Enumerating tables @ " << m_main_system_description_table;
|
klog() << "ACPI: Using XSDT, Enumerating tables @ " << m_main_system_description_table;
|
||||||
klog() << "ACPI: XSDT Revision " << revision << ", Total length - " << length;
|
klog() << "ACPI: XSDT Revision " << revision << ", Total length - " << length;
|
||||||
#ifdef ACPI_DEBUG
|
dbgln<debug_acpi>("ACPI: XSDT pointer @ V{}", &xsdt);
|
||||||
dbg() << "ACPI: XSDT pointer @ V " << &xsdt;
|
|
||||||
#endif
|
|
||||||
for (u32 i = 0; i < ((length - sizeof(Structures::SDTHeader)) / sizeof(u64)); i++) {
|
for (u32 i = 0; i < ((length - sizeof(Structures::SDTHeader)) / sizeof(u64)); i++) {
|
||||||
#ifdef ACPI_DEBUG
|
dbgln<debug_acpi>("ACPI: Found new table [{0}], @ V{1:p} - P{1:p}", i, &xsdt.table_ptrs[i]);
|
||||||
dbg() << "ACPI: Found new table [" << i << "], @ V " << String::format("%p", &xsdt.table_ptrs[i]) << " - P 0x" << String::format("%llx", xsdt.table_ptrs[i]);
|
|
||||||
#endif
|
|
||||||
m_sdt_pointers.append(PhysicalAddress(xsdt.table_ptrs[i]));
|
m_sdt_pointers.append(PhysicalAddress(xsdt.table_ptrs[i]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto& rsdt = (const Structures::RSDT&)*sdt;
|
auto& rsdt = (const Structures::RSDT&)*sdt;
|
||||||
klog() << "ACPI: Using RSDT, Enumerating tables @ " << m_main_system_description_table;
|
klog() << "ACPI: Using RSDT, Enumerating tables @ " << m_main_system_description_table;
|
||||||
klog() << "ACPI: RSDT Revision " << revision << ", Total length - " << length;
|
klog() << "ACPI: RSDT Revision " << revision << ", Total length - " << length;
|
||||||
#ifdef ACPI_DEBUG
|
dbgln<debug_acpi>("ACPI: RSDT pointer @ V{}", &rsdt);
|
||||||
dbg() << "ACPI: RSDT pointer @ V " << &rsdt;
|
|
||||||
#endif
|
|
||||||
for (u32 i = 0; i < ((length - sizeof(Structures::SDTHeader)) / sizeof(u32)); i++) {
|
for (u32 i = 0; i < ((length - sizeof(Structures::SDTHeader)) / sizeof(u32)); i++) {
|
||||||
#ifdef ACPI_DEBUG
|
dbgln<debug_acpi>("ACPI: Found new table [{0}], @ V{1:p} - P{1:p}", i, &rsdt.table_ptrs[i]);
|
||||||
dbg() << "ACPI: Found new table [" << i << "], @ V " << String::format("%p", &rsdt.table_ptrs[i]) << " - P 0x" << String::format("%x", rsdt.table_ptrs[i]);
|
|
||||||
#endif
|
|
||||||
m_sdt_pointers.append(PhysicalAddress(rsdt.table_ptrs[i]));
|
m_sdt_pointers.append(PhysicalAddress(rsdt.table_ptrs[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 <Kernel/FileSystem/FileDescription.h>
|
#include <Kernel/FileSystem/FileDescription.h>
|
||||||
#include <Kernel/Net/Socket.h>
|
#include <Kernel/Net/Socket.h>
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
|
@ -463,13 +464,9 @@ void Thread::WaitBlockCondition::try_unblock(Thread::WaitBlocker& blocker)
|
||||||
if (blocker.is_wait()) {
|
if (blocker.is_wait()) {
|
||||||
if (info.flags == Thread::WaitBlocker::UnblockFlags::Terminated) {
|
if (info.flags == Thread::WaitBlocker::UnblockFlags::Terminated) {
|
||||||
m_processes.remove(i);
|
m_processes.remove(i);
|
||||||
#ifdef WAITBLOCK_DEBUG
|
dbgln<debug_waitblock>("WaitBlockCondition[{}] terminated, remove {}", m_process, *info.process);
|
||||||
dbg() << "WaitBlockCondition[" << m_process << "] terminated, remove " << *info.process;
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
#ifdef WAITBLOCK_DEBUG
|
dbgln<debug_waitblock>("WaitBlockCondition[{}] terminated, mark as waited {}", m_process, *info.process);
|
||||||
dbg() << "WaitBlockCondition[" << m_process << "] terminated, mark as waited " << *info.process;
|
|
||||||
#endif
|
|
||||||
info.was_waited = true;
|
info.was_waited = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -493,9 +490,7 @@ void Thread::WaitBlockCondition::disowned_by_waiter(Process& process)
|
||||||
ASSERT(did_unblock); // disowning must unblock everyone
|
ASSERT(did_unblock); // disowning must unblock everyone
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
#ifdef WAITBLOCK_DEBUG
|
dbgln<debug_waitblock>("WaitBlockCondition[{}] disowned {}", m_process, *info.process);
|
||||||
dbg() << "WaitBlockCondition[" << m_process << "] disowned " << *info.process;
|
|
||||||
#endif
|
|
||||||
m_processes.remove(i);
|
m_processes.remove(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -548,17 +543,13 @@ bool Thread::WaitBlockCondition::unblock(Process& process, WaitBlocker::UnblockF
|
||||||
info.flags = flags;
|
info.flags = flags;
|
||||||
info.signal = signal;
|
info.signal = signal;
|
||||||
info.was_waited = did_wait;
|
info.was_waited = did_wait;
|
||||||
#ifdef WAITBLOCK_DEBUG
|
dbgln<debug_waitblock>("WaitBlockCondition[{}] update {} flags={}, waited={}", m_process, process, (int)flags, info.was_waited);
|
||||||
dbg() << "WaitBlockCondition[" << m_process << "] update " << process << " flags: " << (int)flags << " mark as waited: " << info.was_waited;
|
|
||||||
#endif
|
|
||||||
updated_existing = true;
|
updated_existing = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!updated_existing) {
|
if (!updated_existing) {
|
||||||
#ifdef WAITBLOCK_DEBUG
|
dbgln<debug_waitblock>("WaitBlockCondition[{}] add {} flags: {}", m_process, process, (int)flags);
|
||||||
dbg() << "WaitBlockCondition[" << m_process << "] add " << process << " flags: " << (int)flags;
|
|
||||||
#endif
|
|
||||||
m_processes.append(ProcessBlockInfo(process, flags, signal));
|
m_processes.append(ProcessBlockInfo(process, flags, signal));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,10 @@
|
||||||
* 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/Thread.h>
|
#include <Kernel/Thread.h>
|
||||||
#include <Kernel/WaitQueue.h>
|
#include <Kernel/WaitQueue.h>
|
||||||
|
|
||||||
//#define WAITQUEUE_DEBUG
|
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
bool WaitQueue::should_add_blocker(Thread::Blocker& b, void* data)
|
bool WaitQueue::should_add_blocker(Thread::Blocker& b, void* data)
|
||||||
|
@ -38,30 +37,22 @@ bool WaitQueue::should_add_blocker(Thread::Blocker& b, void* data)
|
||||||
ASSERT(b.blocker_type() == Thread::Blocker::Type::Queue);
|
ASSERT(b.blocker_type() == Thread::Blocker::Type::Queue);
|
||||||
if (m_wake_requested) {
|
if (m_wake_requested) {
|
||||||
m_wake_requested = false;
|
m_wake_requested = false;
|
||||||
#ifdef WAITQUEUE_DEBUG
|
dbgln<debug_waitqueue>("WaitQueue @ {}: do not block thread {}, wake was pending", this, data);
|
||||||
dbg() << "WaitQueue @ " << this << ": do not block thread " << *static_cast<Thread*>(data) << ", wake was pending";
|
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef WAITQUEUE_DEBUG
|
dbgln<debug_waitqueue>("WaitQueue @ {}: should block thread {}", this, data);
|
||||||
dbg() << "WaitQueue @ " << this << ": should block thread " << *static_cast<Thread*>(data);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaitQueue::wake_one()
|
void WaitQueue::wake_one()
|
||||||
{
|
{
|
||||||
ScopedSpinLock lock(m_lock);
|
ScopedSpinLock lock(m_lock);
|
||||||
#ifdef WAITQUEUE_DEBUG
|
dbgln<debug_waitqueue>("WaitQueue @ {}: wake_one", this);
|
||||||
dbg() << "WaitQueue @ " << this << ": wake_one";
|
|
||||||
#endif
|
|
||||||
bool did_unblock_one = do_unblock([&](Thread::Blocker& b, void* data, bool& stop_iterating) {
|
bool did_unblock_one = do_unblock([&](Thread::Blocker& b, void* data, bool& stop_iterating) {
|
||||||
ASSERT(data);
|
ASSERT(data);
|
||||||
ASSERT(b.blocker_type() == Thread::Blocker::Type::Queue);
|
ASSERT(b.blocker_type() == Thread::Blocker::Type::Queue);
|
||||||
auto& blocker = static_cast<Thread::QueueBlocker&>(b);
|
auto& blocker = static_cast<Thread::QueueBlocker&>(b);
|
||||||
#ifdef WAITQUEUE_DEBUG
|
dbgln<debug_waitqueue>("WaitQueue @ {}: wake_one unblocking {}", this, data);
|
||||||
dbg() << "WaitQueue @ " << this << ": wake_one unblocking " << *static_cast<Thread*>(data);
|
|
||||||
#endif
|
|
||||||
if (blocker.unblock()) {
|
if (blocker.unblock()) {
|
||||||
stop_iterating = true;
|
stop_iterating = true;
|
||||||
return true;
|
return true;
|
||||||
|
@ -76,17 +67,14 @@ u32 WaitQueue::wake_n(u32 wake_count)
|
||||||
if (wake_count == 0)
|
if (wake_count == 0)
|
||||||
return 0; // should we assert instead?
|
return 0; // should we assert instead?
|
||||||
ScopedSpinLock lock(m_lock);
|
ScopedSpinLock lock(m_lock);
|
||||||
#ifdef WAITQUEUE_DEBUG
|
dbgln<debug_waitqueue>("WaitQueue @ {}: wake_n({})", this, wake_count);
|
||||||
dbg() << "WaitQueue @ " << this << ": wake_n(" << wake_count << ")";
|
|
||||||
#endif
|
|
||||||
u32 did_wake = 0;
|
u32 did_wake = 0;
|
||||||
|
|
||||||
bool did_unblock_some = do_unblock([&](Thread::Blocker& b, void* data, bool& stop_iterating) {
|
bool did_unblock_some = do_unblock([&](Thread::Blocker& b, void* data, bool& stop_iterating) {
|
||||||
ASSERT(data);
|
ASSERT(data);
|
||||||
ASSERT(b.blocker_type() == Thread::Blocker::Type::Queue);
|
ASSERT(b.blocker_type() == Thread::Blocker::Type::Queue);
|
||||||
auto& blocker = static_cast<Thread::QueueBlocker&>(b);
|
auto& blocker = static_cast<Thread::QueueBlocker&>(b);
|
||||||
#ifdef WAITQUEUE_DEBUG
|
dbgln<debug_waitqueue>("WaitQueue @ {}: wake_n unblocking {}", this, data);
|
||||||
dbg() << "WaitQueue @ " << this << ": wake_n unblocking " << *static_cast<Thread*>(data);
|
|
||||||
#endif
|
|
||||||
ASSERT(did_wake < wake_count);
|
ASSERT(did_wake < wake_count);
|
||||||
if (blocker.unblock()) {
|
if (blocker.unblock()) {
|
||||||
if (++did_wake >= wake_count)
|
if (++did_wake >= wake_count)
|
||||||
|
@ -102,17 +90,17 @@ u32 WaitQueue::wake_n(u32 wake_count)
|
||||||
u32 WaitQueue::wake_all()
|
u32 WaitQueue::wake_all()
|
||||||
{
|
{
|
||||||
ScopedSpinLock lock(m_lock);
|
ScopedSpinLock lock(m_lock);
|
||||||
#ifdef WAITQUEUE_DEBUG
|
|
||||||
dbg() << "WaitQueue @ " << this << ": wake_all";
|
dbgln<debug_waitqueue>("WaitQueue @ {}: wake_all", this);
|
||||||
#endif
|
|
||||||
u32 did_wake = 0;
|
u32 did_wake = 0;
|
||||||
|
|
||||||
bool did_unblock_any = do_unblock([&](Thread::Blocker& b, void* data, bool&) {
|
bool did_unblock_any = do_unblock([&](Thread::Blocker& b, void* data, bool&) {
|
||||||
ASSERT(data);
|
ASSERT(data);
|
||||||
ASSERT(b.blocker_type() == Thread::Blocker::Type::Queue);
|
ASSERT(b.blocker_type() == Thread::Blocker::Type::Queue);
|
||||||
auto& blocker = static_cast<Thread::QueueBlocker&>(b);
|
auto& blocker = static_cast<Thread::QueueBlocker&>(b);
|
||||||
#ifdef WAITQUEUE_DEBUG
|
|
||||||
dbg() << "WaitQueue @ " << this << ": wake_all unblocking " << *static_cast<Thread*>(data);
|
dbgln<debug_waitqueue>("WaitQueue @ {}: wake_all unblocking {}", this, data);
|
||||||
#endif
|
|
||||||
if (blocker.unblock()) {
|
if (blocker.unblock()) {
|
||||||
did_wake++;
|
did_wake++;
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue