Merge remote-tracking branch 'lenormf/debug-commands'
This commit is contained in:
commit
9d4f5a49e0
|
@ -9,6 +9,7 @@
|
||||||
#include "utils.hh"
|
#include "utils.hh"
|
||||||
#include "optional.hh"
|
#include "optional.hh"
|
||||||
#include "containers.hh"
|
#include "containers.hh"
|
||||||
|
#include "buffer_utils.hh"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
@ -443,6 +444,16 @@ void CommandManager::execute_single_command(CommandParameters params,
|
||||||
if (command_it == m_commands.end())
|
if (command_it == m_commands.end())
|
||||||
throw command_not_found(params[0]);
|
throw command_not_found(params[0]);
|
||||||
|
|
||||||
|
const DebugFlags debug_flags = context.options()["debug"].get<DebugFlags>();
|
||||||
|
if (debug_flags & DebugFlags::Commands)
|
||||||
|
{
|
||||||
|
String repr_parameters;
|
||||||
|
|
||||||
|
for (auto repr_param : param_view)
|
||||||
|
repr_parameters += " " + repr_param;
|
||||||
|
write_to_debug_buffer(format("command {}{}", params[0], repr_parameters));
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ParametersParser parameter_parser(param_view,
|
ParametersParser parameter_parser(param_view,
|
||||||
|
|
|
@ -1115,7 +1115,7 @@ const CommandDesc debug_cmd = {
|
||||||
"debug",
|
"debug",
|
||||||
nullptr,
|
nullptr,
|
||||||
"debug <command>: write some debug informations in the debug buffer\n"
|
"debug <command>: write some debug informations in the debug buffer\n"
|
||||||
"existing commands: info, buffers, options, memory, shared-strings",
|
"existing commands: info, buffers, options, memory, shared-strings, profile-hash-maps",
|
||||||
ParameterDesc{{}, ParameterDesc::Flags::SwitchesOnlyAtStart, 1},
|
ParameterDesc{{}, ParameterDesc::Flags::SwitchesOnlyAtStart, 1},
|
||||||
CommandFlags::None,
|
CommandFlags::None,
|
||||||
CommandHelper{},
|
CommandHelper{},
|
||||||
|
|
|
@ -36,22 +36,24 @@ using TimestampedList = PrefixedList<size_t, T>;
|
||||||
|
|
||||||
enum class DebugFlags
|
enum class DebugFlags
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
Hooks = 1 << 0,
|
Hooks = 1 << 0,
|
||||||
Shell = 1 << 1,
|
Shell = 1 << 1,
|
||||||
Profile = 1 << 2,
|
Profile = 1 << 2,
|
||||||
Keys = 1 << 3,
|
Keys = 1 << 3,
|
||||||
|
Commands = 1 << 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr bool with_bit_ops(Meta::Type<DebugFlags>) { return true; }
|
constexpr bool with_bit_ops(Meta::Type<DebugFlags>) { return true; }
|
||||||
|
|
||||||
constexpr Array<EnumDesc<DebugFlags>, 4> enum_desc(Meta::Type<DebugFlags>)
|
constexpr Array<EnumDesc<DebugFlags>, 5> enum_desc(Meta::Type<DebugFlags>)
|
||||||
{
|
{
|
||||||
return { {
|
return { {
|
||||||
{ DebugFlags::Hooks, "hooks" },
|
{ DebugFlags::Hooks, "hooks" },
|
||||||
{ DebugFlags::Shell, "shell" },
|
{ DebugFlags::Shell, "shell" },
|
||||||
{ DebugFlags::Profile, "profile" },
|
{ DebugFlags::Profile, "profile" },
|
||||||
{ DebugFlags::Keys, "keys" }
|
{ DebugFlags::Keys, "keys" },
|
||||||
|
{ DebugFlags::Commands, "commands" },
|
||||||
} };
|
} };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user