Add CLI command for saving debug reports.
This commit is contained in:
parent
53342f94c9
commit
bb7d146c64
@ -192,6 +192,7 @@ Application Debugger :
|
||||
CliCommand.cpp
|
||||
CliContext.cpp
|
||||
CliContinueCommand.cpp
|
||||
CliDebugReportCommand.cpp
|
||||
CliStackTraceCommand.cpp
|
||||
CliStopCommand.cpp
|
||||
CliThreadCommand.cpp
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2012, Rene Gollent, rene@gollent.com.
|
||||
* 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);
|
||||
}
|
20
src/apps/debugger/user_interface/cli/CliDebugReportCommand.h
Normal file
20
src/apps/debugger/user_interface/cli/CliDebugReportCommand.h
Normal file
@ -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
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user