1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:17:35 +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

@ -33,7 +33,7 @@ namespace Kernel {
int Process::sys$fcntl(int fd, int cmd, u32 arg)
{
REQUIRE_PROMISE(stdio);
dbgln<debug_io>("sys$fcntl: fd={}, cmd={}, arg={}", fd, cmd, arg);
dbgln<IO_DEBUG>("sys$fcntl: fd={}, cmd={}, arg={}", fd, cmd, arg);
auto description = file_description(fd);
if (!description)
return -EBADF;

View file

@ -50,7 +50,7 @@ pid_t Process::sys$fork(RegisterState& regs)
child->m_pg = m_pg;
child->m_umask = m_umask;
dbgln<debug_fork>("fork: child={}", child);
dbgln<FORK_DEBUG>("fork: child={}", child);
child->m_extra_gids = m_extra_gids;
@ -79,7 +79,7 @@ pid_t Process::sys$fork(RegisterState& regs)
{
ScopedSpinLock lock(m_lock);
for (auto& region : m_regions) {
dbgln<debug_fork>("fork: cloning Region({}) '{}' @ {}", &region, region.name(), region.vaddr());
dbgln<FORK_DEBUG>("fork: cloning Region({}) '{}' @ {}", &region, region.name(), region.vaddr());
auto region_clone = region.clone(*child);
if (!region_clone) {
dbgln("fork: Cannot clone region, insufficient memory");

View file

@ -39,7 +39,7 @@ FutexQueue::FutexQueue(FlatPtr user_address_or_offset, VMObject* vmobject)
: m_user_address_or_offset(user_address_or_offset)
, m_is_global(vmobject != nullptr)
{
dbgln<debug_futex>("Futex @ {}{}",
dbgln<FUTEX_DEBUG>("Futex @ {}{}",
this,
m_is_global ? " (global)" : " (local)");
@ -56,7 +56,7 @@ FutexQueue::~FutexQueue()
if (auto vmobject = m_vmobject.strong_ref())
vmobject->unregister_on_deleted_handler(*this);
}
dbgln<debug_futex>("~Futex @ {}{}",
dbgln<FUTEX_DEBUG>("~Futex @ {}{}",
this,
m_is_global ? " (global)" : " (local)");
}
@ -68,7 +68,7 @@ void FutexQueue::vmobject_deleted(VMObject& vmobject)
// to make sure we have at last a reference until we're done
NonnullRefPtr<FutexQueue> own_ref(*this);
dbgln<debug_futex>("Futex::vmobject_deleted @ {}{}",
dbgln<FUTEX_DEBUG>("Futex::vmobject_deleted @ {}{}",
this,
m_is_global ? " (global)" : " (local)");
@ -84,7 +84,7 @@ void FutexQueue::vmobject_deleted(VMObject& vmobject)
bool did_wake_all;
auto wake_count = wake_all(did_wake_all);
if constexpr (debug_futex) {
if constexpr (FUTEX_DEBUG) {
if (wake_count > 0)
dbgln("Futex @ {} unblocked {} waiters due to vmobject free", this, wake_count);
}

View file

@ -63,7 +63,7 @@ int Process::sys$open(Userspace<const Syscall::SC_open_params*> user_params)
if (path.is_error())
return path.error();
dbgln<debug_io>("sys$open(dirfd={}, path='{}', options={}, mode={})", dirfd, path.value(), options, mode);
dbgln<IO_DEBUG>("sys$open(dirfd={}, path='{}', options={}, mode={})", dirfd, path.value(), options, mode);
int fd = alloc_fd();
if (fd < 0)
return fd;
@ -99,7 +99,7 @@ int Process::sys$close(int fd)
{
REQUIRE_PROMISE(stdio);
auto description = file_description(fd);
dbgln<debug_io>("sys$close({}) {}", fd, description.ptr());
dbgln<IO_DEBUG>("sys$close({}) {}", fd, description.ptr());
if (!description)
return -EBADF;
int rc = description->close();

View file

@ -37,7 +37,7 @@ ssize_t Process::sys$read(int fd, Userspace<u8*> buffer, ssize_t size)
return -EINVAL;
if (size == 0)
return 0;
dbgln<debug_io>("sys$read({}, {}, {})", fd, buffer.ptr(), size);
dbgln<IO_DEBUG>("sys$read({}, {}, {})", fd, buffer.ptr(), size);
auto description = file_description(fd);
if (!description)
return -EBADF;

View file

@ -95,11 +95,11 @@ int Process::sys$select(const Syscall::SC_select_params* user_params)
fds.append(fd);
}
if constexpr (debug_io || debug_poll_select)
if constexpr (IO_DEBUG || POLL_SELECT_DEBUG)
dbgln("selecting on {} fds, timeout={}", fds_info.size(), params.timeout);
if (current_thread->block<Thread::SelectBlocker>(timeout, fds_info).was_interrupted()) {
dbgln<debug_poll_select>("select was interrupted");
dbgln<POLL_SELECT_DEBUG>("select was interrupted");
return -EINTR;
}
@ -198,7 +198,7 @@ int Process::sys$poll(Userspace<const Syscall::SC_poll_params*> user_params)
current_thread->update_signal_mask(previous_signal_mask);
});
if constexpr (debug_io || debug_poll_select)
if constexpr (IO_DEBUG || POLL_SELECT_DEBUG)
dbgln("polling on {} fds, timeout={}", fds_info.size(), params.timeout);
if (current_thread->block<Thread::SelectBlocker>(timeout, fds_info).was_interrupted())

View file

@ -55,7 +55,7 @@ pid_t Process::sys$waitid(Userspace<const Syscall::SC_waitid_params*> user_param
if (!copy_from_user(&params, user_params))
return -EFAULT;
dbgln<debug_process>("sys$waitid({}, {}, {}, {})", params.idtype, params.id, params.infop, params.options);
dbgln<PROCESS_DEBUG>("sys$waitid({}, {}, {}, {})", params.idtype, params.id, params.infop, params.options);
auto siginfo_or_error = do_waitid(static_cast<idtype_t>(params.idtype), params.id, params.options);
if (siginfo_or_error.is_error())

View file

@ -125,7 +125,7 @@ ssize_t Process::sys$write(int fd, const u8* data, ssize_t size)
if (size == 0)
return 0;
dbgln<debug_io>("sys$write({}, {}, {})", fd, data, size);
dbgln<IO_DEBUG>("sys$write({}, {}, {})", fd, data, size);
auto description = file_description(fd);
if (!description)
return -EBADF;