From 968922055bae8321e59f70ac0c015b6fa6fc2e65 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 31 Mar 2014 20:07:35 +0100 Subject: [PATCH] debug command now serves as a frontend to get debug informations --- src/commands.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/commands.cc b/src/commands.cc index a77c8dbb..316c4bc2 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -2,6 +2,7 @@ #include "buffer.hh" #include "buffer_manager.hh" +#include "client.hh" #include "client_manager.hh" #include "color_registry.hh" #include "command_manager.hh" @@ -12,11 +13,11 @@ #include "file.hh" #include "highlighter.hh" #include "highlighters.hh" -#include "client.hh" #include "option_manager.hh" #include "option_types.hh" #include "parameters_parser.hh" #include "register_manager.hh" +#include "remote.hh" #include "shell_manager.hh" #include "string.hh" #include "user_interface.hh" @@ -703,16 +704,19 @@ const CommandDesc echo_cmd = { const CommandDesc debug_cmd = { "debug", nullptr, - "debug ...: write given parameters in the debug buffer", - ParameterDesc{ SwitchMap{}, ParameterDesc::Flags::SwitchesOnlyAtStart }, + "debug ...: write debug informations in debug buffer", + ParameterDesc{ SwitchMap{}, ParameterDesc::Flags::SwitchesOnlyAtStart, 1 }, CommandFlags::None, CommandCompleter{}, [](const ParametersParser& parser, Context&) { - String message; - for (auto& param : parser) - message += param + " "; - write_debug(message); + if (parser[0] == "info") + { + write_debug("pid: " + to_string(getpid())); + write_debug("session: " + Server::instance().session()); + } + else + throw runtime_error("unknown debug command '" + parser[0] + "'"); } };