mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:28:12 +00:00
Everywhere: Hook up remaining debug macros to Debug.h.
This commit is contained in:
parent
da69de1f1b
commit
eea72b9b5c
63 changed files with 458 additions and 287 deletions
|
@ -27,6 +27,7 @@
|
|||
#include "Shell.h"
|
||||
#include "Execution.h"
|
||||
#include "Formatter.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
|
@ -68,7 +69,7 @@ void Shell::setup_signals()
|
|||
{
|
||||
if (m_should_reinstall_signal_handlers) {
|
||||
Core::EventLoop::register_signal(SIGCHLD, [this](int) {
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("SIGCHLD!");
|
||||
#endif
|
||||
notify_child_event();
|
||||
|
@ -506,7 +507,7 @@ String Shell::format(const StringView& source, ssize_t& cursor) const
|
|||
Shell::Frame Shell::push_frame(String name)
|
||||
{
|
||||
m_local_frames.append(make<LocalFrame>(name, decltype(LocalFrame::local_variables) {}));
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("New frame '{}' at {:p}", name, &m_local_frames.last());
|
||||
#endif
|
||||
return { m_local_frames, m_local_frames.last() };
|
||||
|
@ -572,7 +573,7 @@ int Shell::run_command(const StringView& cmd, Optional<SourcePosition> source_po
|
|||
if (!command)
|
||||
return 0;
|
||||
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("Command follows");
|
||||
command->dump(0);
|
||||
#endif
|
||||
|
@ -669,7 +670,7 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
|
|||
auto apply_rewirings = [&] {
|
||||
for (auto& rewiring : rewirings) {
|
||||
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("in {}<{}>, dup2({}, {})", command.argv.is_empty() ? "(<Empty>)" : command.argv[0].characters(), getpid(), rewiring.old_fd, rewiring.new_fd);
|
||||
#endif
|
||||
int rc = dup2(rewiring.old_fd, rewiring.new_fd);
|
||||
|
@ -784,7 +785,7 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("Synced up with parent, we're good to exec()");
|
||||
#endif
|
||||
|
||||
|
@ -982,7 +983,7 @@ NonnullRefPtrVector<Job> Shell::run_commands(Vector<AST::Command>& commands)
|
|||
NonnullRefPtrVector<Job> spawned_jobs;
|
||||
|
||||
for (auto& command : commands) {
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("Command");
|
||||
for (auto& arg : command.argv)
|
||||
dbgln("argv: {}", arg);
|
||||
|
@ -1626,11 +1627,11 @@ void Shell::notify_child_event()
|
|||
#endif
|
||||
|
||||
int wstatus = 0;
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("waitpid({}) = ...", job.pid());
|
||||
#endif
|
||||
auto child_pid = waitpid(job.pid(), &wstatus, WNOHANG | WUNTRACED);
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("... = {} - {}", child_pid, wstatus);
|
||||
#endif
|
||||
|
||||
|
@ -1786,7 +1787,7 @@ void Shell::stop_all_jobs()
|
|||
printf("Killing active jobs\n");
|
||||
for (auto& entry : jobs) {
|
||||
if (entry.value->is_suspended()) {
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("Job {} is suspended", entry.value->pid());
|
||||
#endif
|
||||
kill_job(entry.value, SIGCONT);
|
||||
|
@ -1798,7 +1799,7 @@ void Shell::stop_all_jobs()
|
|||
usleep(10000); // Wait for a bit before killing the job
|
||||
|
||||
for (auto& entry : jobs) {
|
||||
#ifdef SH_DEBUG
|
||||
#if SH_DEBUG
|
||||
dbgln("Actively killing {} ({})", entry.value->pid(), entry.value->cmd());
|
||||
#endif
|
||||
kill_job(entry.value, SIGKILL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue