[Lldb-commits] [lldb] r106265 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj source/Commands/CommandObjectProcess.cpp source/Commands/CommandObjectStatus.cpp source/Commands/CommandObjectStatus.h source/Interpreter/CommandInterpreter.cpp tools/driver/Driver.cpp
Jim Ingham
jingham at apple.com
Thu Jun 17 18:23:09 PDT 2010
Author: jingham
Date: Thu Jun 17 20:23:09 2010
New Revision: 106265
URL: http://llvm.org/viewvc/llvm-project?rev=106265&view=rev
Log:
Move the "status" command to "process status" since that's where it belongs. Also make it print "running" if invoked
when the current process is running.
Removed:
lldb/trunk/source/Commands/CommandObjectStatus.cpp
lldb/trunk/source/Commands/CommandObjectStatus.h
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/tools/driver/Driver.cpp
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=106265&r1=106264&r2=106265&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Jun 17 20:23:09 2010
@@ -97,7 +97,6 @@
26D5B08711B07550009A862E /* CommandObjectShow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4110F1B84700F91463 /* CommandObjectShow.cpp */; };
26D5B08811B07550009A862E /* CommandObjectSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4210F1B84700F91463 /* CommandObjectSource.cpp */; };
26D5B08911B07550009A862E /* CommandObjectSourceFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4310F1B84700F91463 /* CommandObjectSourceFile.cpp */; };
- 26D5B08A11B07550009A862E /* CommandObjectStatus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4410F1B84700F91463 /* CommandObjectStatus.cpp */; };
26D5B08B11B07550009A862E /* CommandObjectSyntax.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4510F1B84700F91463 /* CommandObjectSyntax.cpp */; };
26D5B08C11B07550009A862E /* CommandObjectThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4610F1B84700F91463 /* CommandObjectThread.cpp */; };
26D5B08D11B07550009A862E /* CommandObjectVariable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4810F1B84700F91463 /* CommandObjectVariable.cpp */; };
@@ -617,7 +616,6 @@
26BC7D2810F1B76300F91463 /* CommandObjectShow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectShow.h; path = source/Commands/CommandObjectShow.h; sourceTree = "<group>"; };
26BC7D2910F1B76300F91463 /* CommandObjectSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSource.h; path = source/Commands/CommandObjectSource.h; sourceTree = "<group>"; };
26BC7D2A10F1B76300F91463 /* CommandObjectSourceFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSourceFile.h; path = source/Commands/CommandObjectSourceFile.h; sourceTree = "<group>"; };
- 26BC7D2B10F1B76300F91463 /* CommandObjectStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectStatus.h; path = source/Commands/CommandObjectStatus.h; sourceTree = "<group>"; };
26BC7D2C10F1B76300F91463 /* CommandObjectSyntax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSyntax.h; path = source/Commands/CommandObjectSyntax.h; sourceTree = "<group>"; };
26BC7D2D10F1B76300F91463 /* CommandObjectThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectThread.h; path = source/Commands/CommandObjectThread.h; sourceTree = "<group>"; };
26BC7D2E10F1B76300F91463 /* CommandObjectTranslate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectTranslate.h; path = source/Commands/CommandObjectTranslate.h; sourceTree = "<group>"; };
@@ -740,7 +738,6 @@
26BC7E4110F1B84700F91463 /* CommandObjectShow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectShow.cpp; path = source/Commands/CommandObjectShow.cpp; sourceTree = "<group>"; };
26BC7E4210F1B84700F91463 /* CommandObjectSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSource.cpp; path = source/Commands/CommandObjectSource.cpp; sourceTree = "<group>"; };
26BC7E4310F1B84700F91463 /* CommandObjectSourceFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSourceFile.cpp; path = source/Commands/CommandObjectSourceFile.cpp; sourceTree = "<group>"; };
- 26BC7E4410F1B84700F91463 /* CommandObjectStatus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectStatus.cpp; path = source/Commands/CommandObjectStatus.cpp; sourceTree = "<group>"; };
26BC7E4510F1B84700F91463 /* CommandObjectSyntax.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSyntax.cpp; path = source/Commands/CommandObjectSyntax.cpp; sourceTree = "<group>"; };
26BC7E4610F1B84700F91463 /* CommandObjectThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectThread.cpp; path = source/Commands/CommandObjectThread.cpp; sourceTree = "<group>"; };
26BC7E4710F1B84700F91463 /* CommandObjectTranslate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectTranslate.cpp; path = source/Commands/CommandObjectTranslate.cpp; sourceTree = "<group>"; };
@@ -1815,8 +1812,6 @@
26BC7E4210F1B84700F91463 /* CommandObjectSource.cpp */,
26BC7D2A10F1B76300F91463 /* CommandObjectSourceFile.h */,
26BC7E4310F1B84700F91463 /* CommandObjectSourceFile.cpp */,
- 26BC7D2B10F1B76300F91463 /* CommandObjectStatus.h */,
- 26BC7E4410F1B84700F91463 /* CommandObjectStatus.cpp */,
26BC7D2C10F1B76300F91463 /* CommandObjectSyntax.h */,
26BC7E4510F1B84700F91463 /* CommandObjectSyntax.cpp */,
269416AE119A024800FF2715 /* CommandObjectTarget.h */,
@@ -2409,7 +2404,6 @@
26D5B08711B07550009A862E /* CommandObjectShow.cpp in Sources */,
26D5B08811B07550009A862E /* CommandObjectSource.cpp in Sources */,
26D5B08911B07550009A862E /* CommandObjectSourceFile.cpp in Sources */,
- 26D5B08A11B07550009A862E /* CommandObjectStatus.cpp in Sources */,
26D5B08B11B07550009A862E /* CommandObjectSyntax.cpp in Sources */,
26D5B08C11B07550009A862E /* CommandObjectThread.cpp in Sources */,
26D5B08D11B07550009A862E /* CommandObjectVariable.cpp in Sources */,
Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=106265&r1=106264&r2=106265&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Thu Jun 17 20:23:09 2010
@@ -18,6 +18,7 @@
#include "lldb/Core/State.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
+#include "./CommandObjectThread.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
@@ -810,6 +811,83 @@
};
//-------------------------------------------------------------------------
+// CommandObjectProcessStatus
+//-------------------------------------------------------------------------
+class CommandObjectProcessStatus : public CommandObject
+{
+public:
+ CommandObjectProcessStatus () :
+ CommandObject ("status",
+ "Shows the current status and location of executing process.",
+ "status",
+ 0)
+ {
+ }
+
+ ~CommandObjectProcessStatus()
+ {
+ }
+
+
+ bool
+ Execute
+ (
+ Args& command,
+ CommandContext *context,
+ CommandInterpreter *interpreter,
+ CommandReturnObject &result
+ )
+ {
+ StreamString &output_stream = result.GetOutputStream();
+ result.SetStatus (eReturnStatusSuccessFinishNoResult);
+ ExecutionContext exe_ctx(context->GetExecutionContext());
+ if (exe_ctx.process)
+ {
+ const StateType state = exe_ctx.process->GetState();
+ if (StateIsStoppedState(state))
+ {
+ if (state == eStateExited)
+ {
+ int exit_status = exe_ctx.process->GetExitStatus();
+ const char *exit_description = exe_ctx.process->GetExitDescription();
+ output_stream.Printf ("Process %d exited with status = %i (0x%8.8x) %s\n",
+ exe_ctx.process->GetID(),
+ exit_status,
+ exit_status,
+ exit_description ? exit_description : "");
+ }
+ else
+ {
+ output_stream.Printf ("Process %d %s\n", exe_ctx.process->GetID(), StateAsCString (state));
+ if (exe_ctx.thread == NULL)
+ exe_ctx.thread = exe_ctx.process->GetThreadList().GetThreadAtIndex(0).get();
+ if (exe_ctx.thread != NULL)
+ {
+ DisplayThreadsInfo (interpreter, &exe_ctx, result, true, true);
+ }
+ else
+ {
+ result.AppendError ("No valid thread found in current process.");
+ result.SetStatus (eReturnStatusFailed);
+ }
+ }
+ }
+ else
+ {
+ output_stream.Printf ("Process %d is running.\n",
+ exe_ctx.process->GetID());
+ }
+ }
+ else
+ {
+ result.AppendError ("No current location or status available.");
+ result.SetStatus (eReturnStatusFailed);
+ }
+ return result.Succeeded();
+ }
+};
+
+//-------------------------------------------------------------------------
// CommandObjectMultiwordProcess
//-------------------------------------------------------------------------
@@ -823,6 +901,7 @@
LoadSubCommand (CommandObjectSP (new CommandObjectProcessContinue ()), "continue", interpreter);
LoadSubCommand (CommandObjectSP (new CommandObjectProcessDetach ()), "detach", interpreter);
LoadSubCommand (CommandObjectSP (new CommandObjectProcessSignal ()), "signal", interpreter);
+ LoadSubCommand (CommandObjectSP (new CommandObjectProcessStatus ()), "status", interpreter);
LoadSubCommand (CommandObjectSP (new CommandObjectProcessInterrupt ()), "interrupt", interpreter);
LoadSubCommand (CommandObjectSP (new CommandObjectProcessKill ()), "kill", interpreter);
}
Removed: lldb/trunk/source/Commands/CommandObjectStatus.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectStatus.cpp?rev=106264&view=auto
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectStatus.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectStatus.cpp (removed)
@@ -1,97 +0,0 @@
-//===-- CommandObjectStatus.cpp ---------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "CommandObjectStatus.h"
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "CommandObjectThread.h"
-
-#include "lldb/Core/State.h"
-
-#include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/CommandReturnObject.h"
-
-#include "lldb/Target/Process.h"
-#include "lldb/Target/Thread.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-//-------------------------------------------------------------------------
-// CommandObjectStatus
-//-------------------------------------------------------------------------
-
-CommandObjectStatus::CommandObjectStatus () :
- CommandObject ("status",
- "Shows the current status and location of executing process.",
- "status",
- 0)
-{
-}
-
-CommandObjectStatus::~CommandObjectStatus()
-{
-}
-
-
-bool
-CommandObjectStatus::Execute
-(
- Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result
-)
-{
- StreamString &output_stream = result.GetOutputStream();
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
- ExecutionContext exe_ctx(context->GetExecutionContext());
- if (exe_ctx.process)
- {
- const StateType state = exe_ctx.process->GetState();
- if (StateIsStoppedState(state))
- {
- if (state == eStateExited)
- {
- int exit_status = exe_ctx.process->GetExitStatus();
- const char *exit_description = exe_ctx.process->GetExitDescription();
- output_stream.Printf ("Process %d exited with status = %i (0x%8.8x) %s\n",
- exe_ctx.process->GetID(),
- exit_status,
- exit_status,
- exit_description ? exit_description : "");
- }
- else
- {
- output_stream.Printf ("Process %d %s\n", exe_ctx.process->GetID(), StateAsCString (state));
- if (exe_ctx.thread == NULL)
- exe_ctx.thread = exe_ctx.process->GetThreadList().GetThreadAtIndex(0).get();
- if (exe_ctx.thread != NULL)
- {
- DisplayThreadsInfo (interpreter, &exe_ctx, result, true, true);
- }
- else
- {
- result.AppendError ("No valid thread found in current process.");
- result.SetStatus (eReturnStatusFailed);
- }
- }
- }
- }
- else
- {
- result.AppendError ("No current location or status available.");
- result.SetStatus (eReturnStatusFailed);
- }
- return result.Succeeded();
-}
-
Removed: lldb/trunk/source/Commands/CommandObjectStatus.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectStatus.h?rev=106264&view=auto
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectStatus.h (original)
+++ lldb/trunk/source/Commands/CommandObjectStatus.h (removed)
@@ -1,44 +0,0 @@
-//===-- CommandObjectStatus.h -----------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_CommandObjectStatus_h_
-#define liblldb_CommandObjectStatus_h_
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Interpreter/CommandObject.h"
-
-namespace lldb_private {
-
-//-------------------------------------------------------------------------
-// CommandObjectStatus
-//-------------------------------------------------------------------------
-
-class CommandObjectStatus : public CommandObject
-{
-public:
-
- CommandObjectStatus ();
-
- ~CommandObjectStatus ();
-
- virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result);
-
-
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_CommandObjectStatus_h_
Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=106265&r1=106264&r2=106265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Thu Jun 17 20:23:09 2010
@@ -237,7 +237,6 @@
m_command_dict["source"] = CommandObjectSP (new CommandObjectSource ());
m_command_dict["source-file"] = CommandObjectSP (new CommandObjectSourceFile ());
//m_command_dict["syntax"] = CommandObjectSP (new CommandObjectSyntax ());
- m_command_dict["status"] = CommandObjectSP (new CommandObjectStatus ());
m_command_dict["target"] = CommandObjectSP (new CommandObjectMultiwordTarget (this));
m_command_dict["thread"] = CommandObjectSP (new CommandObjectMultiwordThread (this));
//m_command_dict["translate"] = CommandObjectSP (new CommandObjectTranslate ());
Modified: lldb/trunk/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=106265&r1=106264&r2=106265&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Thu Jun 17 20:23:09 2010
@@ -775,7 +775,7 @@
break;
case eStateExited:
- SBDebugger::HandleCommand("status");
+ SBDebugger::HandleCommand("process status");
m_io_channel_ap->RefreshPrompt();
break;
@@ -794,7 +794,7 @@
else
{
UpdateCurrentThread ();
- SBDebugger::HandleCommand("status");
+ SBDebugger::HandleCommand("process status");
m_io_channel_ap->RefreshPrompt();
}
break;
More information about the lldb-commits
mailing list