Add CLI command for saving debug reports.
This commit is contained in:
@@ -192,6 +192,7 @@ Application Debugger :
|
|||||||
CliCommand.cpp
|
CliCommand.cpp
|
||||||
CliContext.cpp
|
CliContext.cpp
|
||||||
CliContinueCommand.cpp
|
CliContinueCommand.cpp
|
||||||
|
CliDebugReportCommand.cpp
|
||||||
CliStackTraceCommand.cpp
|
CliStackTraceCommand.cpp
|
||||||
CliStopCommand.cpp
|
CliStopCommand.cpp
|
||||||
CliThreadCommand.cpp
|
CliThreadCommand.cpp
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012, Rene Gollent, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "CliDebugReportCommand.h"
|
||||||
|
|
||||||
|
#include <Entry.h>
|
||||||
|
#include <FindDirectory.h>
|
||||||
|
#include <Path.h>
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
|
#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);
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012, Rene Gollent, [email protected].
|
||||||
|
* 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
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2011, Rene Gollent, [email protected].
|
* Copyright 2011-2012, Rene Gollent, [email protected].
|
||||||
* Copyright 2012, Ingo Weinhold, [email protected].
|
* Copyright 2012, Ingo Weinhold, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "CliContext.h"
|
#include "CliContext.h"
|
||||||
#include "CliContinueCommand.h"
|
#include "CliContinueCommand.h"
|
||||||
|
#include "CliDebugReportCommand.h"
|
||||||
#include "CliQuitCommand.h"
|
#include "CliQuitCommand.h"
|
||||||
#include "CliStackTraceCommand.h"
|
#include "CliStackTraceCommand.h"
|
||||||
#include "CliStopCommand.h"
|
#include "CliStopCommand.h"
|
||||||
@@ -284,7 +285,9 @@ CommandLineUserInterface::_RegisterCommands()
|
|||||||
_RegisterCommand("sc", stackTraceCommandReference2.Detach()) &&
|
_RegisterCommand("sc", stackTraceCommandReference2.Detach()) &&
|
||||||
_RegisterCommand("stop", new(std::nothrow) CliStopCommand) &&
|
_RegisterCommand("stop", new(std::nothrow) CliStopCommand) &&
|
||||||
_RegisterCommand("thread", new(std::nothrow) CliThreadCommand) &&
|
_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;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user