1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:57:46 +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:
asynts 2021-01-15 00:18:55 +01:00 committed by Andreas Kling
parent a348ab55b0
commit 7b0a1a98d9
12 changed files with 81 additions and 71 deletions

View file

@ -24,13 +24,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <Kernel/FileSystem/Custody.h>
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/Process.h>
#include <Kernel/VM/Region.h>
//#define FORK_DEBUG
namespace Kernel {
pid_t Process::sys$fork(RegisterState& regs)
@ -51,9 +50,7 @@ pid_t Process::sys$fork(RegisterState& regs)
child->m_pg = m_pg;
child->m_umask = m_umask;
#ifdef FORK_DEBUG
dbg() << "fork: child=" << child;
#endif
dbgln<debug_fork>("fork: child={}", child);
child->m_extra_gids = m_extra_gids;
@ -82,9 +79,7 @@ pid_t Process::sys$fork(RegisterState& regs)
{
ScopedSpinLock lock(m_lock);
for (auto& region : m_regions) {
#ifdef FORK_DEBUG
dbg() << "fork: cloning Region{" << &region << "} '" << region.name() << "' @ " << region.vaddr();
#endif
dbgln<debug_fork>("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

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <Kernel/FileSystem/Custody.h>
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/FileSystem/VirtualFileSystem.h>
@ -61,9 +62,8 @@ int Process::sys$open(Userspace<const Syscall::SC_open_params*> user_params)
auto path = get_syscall_path_argument(params.path);
if (path.is_error())
return path.error();
#ifdef DEBUG_IO
dbg() << "sys$open(dirfd=" << dirfd << ", path=\"" << path.value() << "\", options=" << options << ", mode=" << mode << ")";
#endif
dbgln<debug_io>("sys$open(dirfd={}, path='{}', options={}, mode={})", dirfd, path.value(), options, mode);
int fd = alloc_fd();
if (fd < 0)
return fd;
@ -99,9 +99,7 @@ int Process::sys$close(int fd)
{
REQUIRE_PROMISE(stdio);
auto description = file_description(fd);
#ifdef DEBUG_IO
dbg() << "sys$close(" << fd << ") " << description.ptr();
#endif
dbgln<debug_io>("sys$close({}) {}", fd, description.ptr());
if (!description)
return -EBADF;
int rc = description->close();

View file

@ -24,11 +24,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/Process.h>
//#define DEBUG_IO
namespace Kernel {
ssize_t Process::sys$read(int fd, Userspace<u8*> buffer, ssize_t size)
@ -38,9 +37,7 @@ ssize_t Process::sys$read(int fd, Userspace<u8*> buffer, ssize_t size)
return -EINVAL;
if (size == 0)
return 0;
#ifdef DEBUG_IO
dbg() << "sys$read(" << fd << ", " << (const void*)buffer.ptr() << ", " << size << ")";
#endif
dbgln<debug_io>("sys$read({}, {}, {})", fd, buffer.ptr(), size);
auto description = file_description(fd);
if (!description)
return -EBADF;

View file

@ -24,14 +24,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/ScopeGuard.h>
#include <AK/Time.h>
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/Process.h>
//#define DEBUG_IO
//#define DEBUG_POLL_SELECT
namespace Kernel {
int Process::sys$select(const Syscall::SC_select_params* user_params)
@ -97,14 +95,11 @@ int Process::sys$select(const Syscall::SC_select_params* user_params)
fds.append(fd);
}
#if defined(DEBUG_IO) || defined(DEBUG_POLL_SELECT)
dbg() << "selecting on " << fds_info.size() << " fds, timeout=" << params.timeout;
#endif
if constexpr (debug_io || debug_poll_select)
dbgln("selecting on {} fds, timeout={}", fds_info.size(), params.timeout);
if (current_thread->block<Thread::SelectBlocker>(timeout, fds_info).was_interrupted()) {
#ifdef DEBUG_POLL_SELECT
dbgln("select was interrupted");
#endif
dbgln<debug_poll_select>("select was interrupted");
return -EINTR;
}
@ -203,9 +198,8 @@ int Process::sys$poll(Userspace<const Syscall::SC_poll_params*> user_params)
current_thread->update_signal_mask(previous_signal_mask);
});
#if defined(DEBUG_IO) || defined(DEBUG_POLL_SELECT)
dbg() << "polling on " << fds_info.size() << " fds, timeout=" << params.timeout;
#endif
if constexpr (debug_io || debug_poll_select)
dbgln("polling on {} fds, timeout={}", fds_info.size(), params.timeout);
if (current_thread->block<Thread::SelectBlocker>(timeout, fds_info).was_interrupted())
return -EINTR;

View file

@ -24,10 +24,9 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <Kernel/Process.h>
//#define PROCESS_DEBUG
namespace Kernel {
KResultOr<siginfo_t> Process::do_waitid(idtype_t idtype, int id, int options)
@ -56,9 +55,7 @@ pid_t Process::sys$waitid(Userspace<const Syscall::SC_waitid_params*> user_param
if (!copy_from_user(&params, user_params))
return -EFAULT;
#ifdef PROCESS_DEBUG
dbg() << "sys$waitid(" << params.idtype << ", " << params.id << ", " << params.infop << ", " << params.options << ")";
#endif
dbgln<debug_process>("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

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <AK/Debug.h>
#include <AK/NumericLimits.h>
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/Process.h>
@ -124,9 +125,7 @@ ssize_t Process::sys$write(int fd, const u8* data, ssize_t size)
if (size == 0)
return 0;
#ifdef DEBUG_IO
dbg() << "sys$write(" << fd << ", " << (const void*)(data) << ", " << size << ")";
#endif
dbgln<debug_io>("sys$write({}, {}, {})", fd, data, size);
auto description = file_description(fd);
if (!description)
return -EBADF;