From bb38130bb8e2b8ec17cb6347173af435c5ceef18 Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Mon, 12 Dec 2022 12:48:38 -0600 Subject: Implement gdbstub monitor --- tb/top/conspiracion.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'tb/top') diff --git a/tb/top/conspiracion.cpp b/tb/top/conspiracion.cpp index bdda56c..5e16505 100644 --- a/tb/top/conspiracion.cpp +++ b/tb/top/conspiracion.cpp @@ -8,6 +8,8 @@ #include #include +#include + #include #include @@ -268,10 +270,15 @@ int main(int argc, char **argv) } FILE *ctrl = stdout; - if(*control_fd != -1 && (ctrl = fdopen(*control_fd, "r+")) == nullptr) + if(*control_fd != -1) { - std::perror("fdopen()"); - return EXIT_FAILURE; + if((ctrl = fdopen(*control_fd, "r+")) == nullptr) + { + std::perror("fdopen()"); + return EXIT_FAILURE; + } + + dup2(*control_fd, STDERR_FILENO); } Vconspiracion top; -- cgit v1.2.3