1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:28:10 +00:00

Everywhere: Debug macros instead of constexpr.

This was done with the following script:

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/dbgln<debug_([a-z_]+)>/dbgln<\U\1_DEBUG>/' {} \;

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/if constexpr \(debug_([a-z0-9_]+)/if constexpr \(\U\1_DEBUG/' {} \;
This commit is contained in:
asynts 2021-01-23 23:59:27 +01:00 committed by Andreas Kling
parent bb483f7ef4
commit 8465683dcf
98 changed files with 414 additions and 972 deletions

View file

@ -59,7 +59,7 @@ Thread::Thread(NonnullRefPtr<Process> process)
} else {
m_tid = Process::allocate_pid().value();
}
if constexpr (debug_thread)
if constexpr (THREAD_DEBUG)
dbgln("Created new thread {}({}:{})", m_process->name(), m_process->pid().value(), m_tid.value());
set_default_signal_dispositions();
m_fpu_state = (FPUState*)kmalloc_aligned<16>(sizeof(FPUState));
@ -370,7 +370,7 @@ void Thread::finalize()
{
ScopedSpinLock lock(g_scheduler_lock);
dbgln<debug_thread>("Finalizing thread {}", *this);
dbgln<THREAD_DEBUG>("Finalizing thread {}", *this);
set_state(Thread::State::Dead);
m_join_condition.thread_finalizing();
}
@ -476,11 +476,11 @@ void Thread::send_signal(u8 signal, [[maybe_unused]] Process* sender)
// FIXME: Figure out what to do for masked signals. Should we also ignore them here?
if (should_ignore_signal(signal)) {
dbgln<debug_signal>("Signal {} was ignored by {}", signal, process());
dbgln<SIGNAL_DEBUG>("Signal {} was ignored by {}", signal, process());
return;
}
if constexpr (debug_signal) {
if constexpr (SIGNAL_DEBUG) {
if (sender)
dbgln("Signal: {} sent {} to {}", *sender, signal, process());
else
@ -493,12 +493,12 @@ void Thread::send_signal(u8 signal, [[maybe_unused]] Process* sender)
if (m_state == Stopped) {
ScopedSpinLock lock(m_lock);
if (pending_signals_for_state()) {
dbgln<debug_signal>("Signal: Resuming stopped {} to deliver signal {}", *this, signal);
dbgln<SIGNAL_DEBUG>("Signal: Resuming stopped {} to deliver signal {}", *this, signal);
resume_from_stopped();
}
} else {
ScopedSpinLock block_lock(m_block_lock);
dbgln<debug_signal>("Signal: Unblocking {} to deliver signal {}", *this, signal);
dbgln<SIGNAL_DEBUG>("Signal: Unblocking {} to deliver signal {}", *this, signal);
unblock(signal);
}
}
@ -710,7 +710,7 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal)
auto& process = this->process();
auto tracer = process.tracer();
if (signal == SIGSTOP || (tracer && default_signal_action(signal) == DefaultSignalAction::DumpCore)) {
dbgln<debug_signal>("signal: signal {} sopping thread {}", signal, *this);
dbgln<SIGNAL_DEBUG>("signal: signal {} sopping thread {}", signal, *this);
set_state(State::Stopped, signal);
return DispatchSignalResult::Yield;
}
@ -873,13 +873,13 @@ void Thread::set_state(State new_state, u8 stop_signal)
if (previous_state == Invalid) {
// If we were *just* created, we may have already pending signals
if (has_unmasked_pending_signals()) {
dbgln<debug_thread>("Dispatch pending signals to new thread {}", *this);
dbgln<THREAD_DEBUG>("Dispatch pending signals to new thread {}", *this);
dispatch_one_pending_signal();
}
}
m_state = new_state;
dbgln<debug_thread>("Set thread {} state to {}", *this, state_string());
dbgln<THREAD_DEBUG>("Set thread {} state to {}", *this, state_string());
}
if (m_process->pid() != 0) {
@ -894,7 +894,7 @@ void Thread::set_state(State new_state, u8 stop_signal)
process.for_each_thread([&](auto& thread) {
if (&thread == this || !thread.is_stopped())
return IterationDecision::Continue;
dbgln<debug_thread>("Resuming peer thread {}", thread);
dbgln<THREAD_DEBUG>("Resuming peer thread {}", thread);
thread.resume_from_stopped();
return IterationDecision::Continue;
});
@ -910,7 +910,7 @@ void Thread::set_state(State new_state, u8 stop_signal)
process.for_each_thread([&](auto& thread) {
if (&thread == this || thread.is_stopped())
return IterationDecision::Continue;
dbgln<debug_thread>("Stopping peer thread {}", thread);
dbgln<THREAD_DEBUG>("Stopping peer thread {}", thread);
thread.set_state(Stopped, stop_signal);
return IterationDecision::Continue;
});