From 192c6f9689da4808d8e768332872372df7dd7145 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Thu, 3 Nov 2011 12:21:06 +0000 Subject: [PATCH] Add command line argument to specify usage of the CLI rather than the GUI. Not used yet. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43158 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/debugger/Debugger.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/apps/debugger/Debugger.cpp b/src/apps/debugger/Debugger.cpp index b52efe7a04..a0ba0bddf0 100644 --- a/src/apps/debugger/Debugger.cpp +++ b/src/apps/debugger/Debugger.cpp @@ -54,6 +54,7 @@ static const char* kUsage = "\n" "Options:\n" " -h, --help - Print this usage info and exit.\n" + " -c, --cli - Use command line user interface (not yet implemented)\n" ; @@ -71,13 +72,15 @@ struct Options { const char* const* commandLineArgv; team_id team; thread_id thread; + bool useCLI; Options() : commandLineArgc(0), commandLineArgv(NULL), team(-1), - thread(-1) + thread(-1), + useCLI(false) { } }; @@ -94,16 +97,21 @@ parse_arguments(int argc, const char* const* argv, bool noOutput, { "help", no_argument, 0, 'h' }, { "team", required_argument, 0, 't' }, { "thread", required_argument, 0, 'T' }, + { "cli", no_argument, 0, 'c' }, { 0, 0, 0, 0 } }; opterr = 0; // don't print errors - int c = getopt_long(argc, (char**)argv, "+h", sLongOptions, NULL); + int c = getopt_long(argc, (char**)argv, "+ch", sLongOptions, NULL); if (c == -1) break; switch (c) { + case 'c': + options.useCLI = true; + break; + case 'h': if (noOutput) return false; @@ -324,6 +332,10 @@ Debugger::ArgvReceived(int32 argc, char** argv) stopInMain = true; } + // no parameters given, prompt the user to attach to a team + if (team < 0 && thread < 0) + return; + // If we've got if (team < 0) { printf("no team yet, getting thread info...\n"); @@ -430,7 +442,8 @@ Debugger::_FindTeamDebugger(team_id teamID) const TeamDebugger* -Debugger::_StartTeamDebugger(team_id teamID, thread_id threadID, bool stopInMain) +Debugger::_StartTeamDebugger(team_id teamID, thread_id threadID, + bool stopInMain) { if (teamID < 0) return NULL;