diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index a1a1ddbe13..4eb12819dd 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -192,6 +192,7 @@ Application Debugger : CliCommand.cpp CliContext.cpp CliContinueCommand.cpp + CliDebugReportCommand.cpp CliStackTraceCommand.cpp CliStopCommand.cpp CliThreadCommand.cpp diff --git a/src/apps/debugger/user_interface/cli/CliDebugReportCommand.cpp b/src/apps/debugger/user_interface/cli/CliDebugReportCommand.cpp new file mode 100644 index 0000000000..213b5f774d --- /dev/null +++ b/src/apps/debugger/user_interface/cli/CliDebugReportCommand.cpp @@ -0,0 +1,39 @@ +/* + * Copyright 2012, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ + + +#include "CliDebugReportCommand.h" + +#include +#include +#include +#include + +#include "CliContext.h" +#include "UiUtils.h" +#include "UserInterface.h" + + +CliDebugReportCommand::CliDebugReportCommand() + : + CliCommand("save debug report", + "%s\n" + "Saves a debug information report for the current team.") +{ +} + + +void +CliDebugReportCommand::Execute(int argc, const char* const* argv, CliContext& context) +{ + char buffer[B_FILE_NAME_LENGTH]; + UiUtils::ReportNameForTeam(context.GetTeam(), buffer, sizeof(buffer)); + BPath path; + find_directory(B_DESKTOP_DIRECTORY, &path); + path.Append(buffer); + entry_ref ref; + if (get_ref_for_path(path.Path(), &ref) == B_OK) + context.GetUserInterfaceListener()->DebugReportRequested(&ref); +} diff --git a/src/apps/debugger/user_interface/cli/CliDebugReportCommand.h b/src/apps/debugger/user_interface/cli/CliDebugReportCommand.h new file mode 100644 index 0000000000..ffe423c213 --- /dev/null +++ b/src/apps/debugger/user_interface/cli/CliDebugReportCommand.h @@ -0,0 +1,20 @@ +/* + * Copyright 2012, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ +#ifndef CLI_DEBUG_REPORT_COMMAND_H +#define CLI_DEBUG_REPORT_COMMAND_H + + +#include "CliCommand.h" + + +class CliDebugReportCommand : public CliCommand { +public: + CliDebugReportCommand(); + virtual void Execute(int argc, const char* const* argv, + CliContext& context); +}; + + +#endif // CLI_DEBUG_REPORT_COMMAND_H diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp index 1871c45b51..bbd0f86366 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Rene Gollent, rene@gollent.com. + * Copyright 2011-2012, Rene Gollent, rene@gollent.com. * Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ @@ -17,6 +17,7 @@ #include "CliContext.h" #include "CliContinueCommand.h" +#include "CliDebugReportCommand.h" #include "CliQuitCommand.h" #include "CliStackTraceCommand.h" #include "CliStopCommand.h" @@ -284,7 +285,9 @@ CommandLineUserInterface::_RegisterCommands() _RegisterCommand("sc", stackTraceCommandReference2.Detach()) && _RegisterCommand("stop", new(std::nothrow) CliStopCommand) && _RegisterCommand("thread", new(std::nothrow) CliThreadCommand) && - _RegisterCommand("threads", new(std::nothrow) CliThreadsCommand)) { + _RegisterCommand("threads", new(std::nothrow) CliThreadsCommand) && + _RegisterCommand("save-report", + new(std::nothrow) CliDebugReportCommand)) { return B_OK; }