[Lldb-commits] [lldb] r106615 - in /lldb/trunk: include/lldb/ include/lldb/API/ include/lldb/Breakpoint/ include/lldb/Core/ include/lldb/Interpreter/ include/lldb/Target/ lldb.xcodeproj/ source/API/ source/Breakpoint/ source/Commands/ source/Core/ source/Interpreter/ source/Plugins/Process/gdb-remote/ source/Target/ tools/driver/
Greg Clayton
gclayton at apple.com
Tue Jun 22 18:19:30 PDT 2010
Author: gclayton
Date: Tue Jun 22 20:19:29 2010
New Revision: 106615
URL: http://llvm.org/viewvc/llvm-project?rev=106615&view=rev
Log:
Very large changes that were needed in order to allow multiple connections
to the debugger from GUI windows. Previously there was one global debugger
instance that could be accessed that had its own command interpreter and
current state (current target/process/thread/frame). When a GUI debugger
was attached, if it opened more than one window that each had a console
window, there were issues where the last one to setup the global debugger
object won and got control of the debugger.
To avoid this we now create instances of the lldb_private::Debugger that each
has its own state:
- target list for targets the debugger instance owns
- current process/thread/frame
- its own command interpreter
- its own input, output and error file handles to avoid conflicts
- its own input reader stack
So now clients should call:
SBDebugger::Initialize(); // (static function)
SBDebugger debugger (SBDebugger::Create());
// Use which ever file handles you wish
debugger.SetErrorFileHandle (stderr, false);
debugger.SetOutputFileHandle (stdout, false);
debugger.SetInputFileHandle (stdin, true);
// main loop
SBDebugger::Terminate(); // (static function)
SBDebugger::Initialize() and SBDebugger::Terminate() are ref counted to
ensure nothing gets destroyed too early when multiple clients might be
attached.
Cleaned up the command interpreter and the CommandObject and all subclasses
to take more appropriate arguments.
Removed:
lldb/trunk/include/lldb/Interpreter/CommandContext.h
lldb/trunk/source/Commands/CommandObjectAdd.cpp
lldb/trunk/source/Commands/CommandObjectAdd.h
lldb/trunk/source/Commands/CommandObjectRemove.cpp
lldb/trunk/source/Commands/CommandObjectRemove.h
lldb/trunk/source/Commands/CommandObjectTranslate.cpp
lldb/trunk/source/Commands/CommandObjectTranslate.h
lldb/trunk/source/Interpreter/CommandContext.cpp
Modified:
lldb/trunk/include/lldb/API/SBAddress.h
lldb/trunk/include/lldb/API/SBBlock.h
lldb/trunk/include/lldb/API/SBBreakpoint.h
lldb/trunk/include/lldb/API/SBBreakpointLocation.h
lldb/trunk/include/lldb/API/SBBroadcaster.h
lldb/trunk/include/lldb/API/SBCommandContext.h
lldb/trunk/include/lldb/API/SBCommandInterpreter.h
lldb/trunk/include/lldb/API/SBCommandReturnObject.h
lldb/trunk/include/lldb/API/SBCommunication.h
lldb/trunk/include/lldb/API/SBCompileUnit.h
lldb/trunk/include/lldb/API/SBDebugger.h
lldb/trunk/include/lldb/API/SBError.h
lldb/trunk/include/lldb/API/SBEvent.h
lldb/trunk/include/lldb/API/SBFileSpec.h
lldb/trunk/include/lldb/API/SBFrame.h
lldb/trunk/include/lldb/API/SBFunction.h
lldb/trunk/include/lldb/API/SBInputReader.h
lldb/trunk/include/lldb/API/SBInstruction.h
lldb/trunk/include/lldb/API/SBLineEntry.h
lldb/trunk/include/lldb/API/SBListener.h
lldb/trunk/include/lldb/API/SBModule.h
lldb/trunk/include/lldb/API/SBProcess.h
lldb/trunk/include/lldb/API/SBSourceManager.h
lldb/trunk/include/lldb/API/SBStringList.h
lldb/trunk/include/lldb/API/SBSymbol.h
lldb/trunk/include/lldb/API/SBSymbolContext.h
lldb/trunk/include/lldb/API/SBTarget.h
lldb/trunk/include/lldb/API/SBThread.h
lldb/trunk/include/lldb/API/SBValue.h
lldb/trunk/include/lldb/API/SBValueList.h
lldb/trunk/include/lldb/Breakpoint/StoppointCallbackContext.h
lldb/trunk/include/lldb/Core/Debugger.h
lldb/trunk/include/lldb/Core/Disassembler.h
lldb/trunk/include/lldb/Core/InputReader.h
lldb/trunk/include/lldb/Interpreter/CommandCompletions.h
lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
lldb/trunk/include/lldb/Interpreter/CommandObject.h
lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h
lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h
lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h
lldb/trunk/include/lldb/Interpreter/Options.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreterNone.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/include/lldb/Target/TargetList.h
lldb/trunk/include/lldb/lldb-forward-rtti.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/API/SBAddress.cpp
lldb/trunk/source/API/SBBlock.cpp
lldb/trunk/source/API/SBBreakpoint.cpp
lldb/trunk/source/API/SBBreakpointLocation.cpp
lldb/trunk/source/API/SBBroadcaster.cpp
lldb/trunk/source/API/SBCommandContext.cpp
lldb/trunk/source/API/SBCommandInterpreter.cpp
lldb/trunk/source/API/SBCommandReturnObject.cpp
lldb/trunk/source/API/SBCommunication.cpp
lldb/trunk/source/API/SBCompileUnit.cpp
lldb/trunk/source/API/SBDebugger.cpp
lldb/trunk/source/API/SBError.cpp
lldb/trunk/source/API/SBEvent.cpp
lldb/trunk/source/API/SBFileSpec.cpp
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/API/SBFunction.cpp
lldb/trunk/source/API/SBInputReader.cpp
lldb/trunk/source/API/SBInstruction.cpp
lldb/trunk/source/API/SBLineEntry.cpp
lldb/trunk/source/API/SBListener.cpp
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/API/SBProcess.cpp
lldb/trunk/source/API/SBSourceManager.cpp
lldb/trunk/source/API/SBStringList.cpp
lldb/trunk/source/API/SBSymbol.cpp
lldb/trunk/source/API/SBSymbolContext.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/API/SBThread.cpp
lldb/trunk/source/API/SBValue.cpp
lldb/trunk/source/API/SBValueList.cpp
lldb/trunk/source/Breakpoint/StoppointCallbackContext.cpp
lldb/trunk/source/Commands/CommandCompletions.cpp
lldb/trunk/source/Commands/CommandObjectAlias.cpp
lldb/trunk/source/Commands/CommandObjectAlias.h
lldb/trunk/source/Commands/CommandObjectAppend.cpp
lldb/trunk/source/Commands/CommandObjectAppend.h
lldb/trunk/source/Commands/CommandObjectApropos.cpp
lldb/trunk/source/Commands/CommandObjectApropos.h
lldb/trunk/source/Commands/CommandObjectArgs.cpp
lldb/trunk/source/Commands/CommandObjectArgs.h
lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
lldb/trunk/source/Commands/CommandObjectBreakpoint.h
lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h
lldb/trunk/source/Commands/CommandObjectCall.cpp
lldb/trunk/source/Commands/CommandObjectCall.h
lldb/trunk/source/Commands/CommandObjectCrossref.cpp
lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
lldb/trunk/source/Commands/CommandObjectDisassemble.h
lldb/trunk/source/Commands/CommandObjectExpression.cpp
lldb/trunk/source/Commands/CommandObjectExpression.h
lldb/trunk/source/Commands/CommandObjectFile.cpp
lldb/trunk/source/Commands/CommandObjectFile.h
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Commands/CommandObjectFrame.h
lldb/trunk/source/Commands/CommandObjectHelp.cpp
lldb/trunk/source/Commands/CommandObjectHelp.h
lldb/trunk/source/Commands/CommandObjectImage.cpp
lldb/trunk/source/Commands/CommandObjectImage.h
lldb/trunk/source/Commands/CommandObjectLog.cpp
lldb/trunk/source/Commands/CommandObjectLog.h
lldb/trunk/source/Commands/CommandObjectMemory.cpp
lldb/trunk/source/Commands/CommandObjectMemory.h
lldb/trunk/source/Commands/CommandObjectMultiword.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Commands/CommandObjectProcess.h
lldb/trunk/source/Commands/CommandObjectQuit.cpp
lldb/trunk/source/Commands/CommandObjectQuit.h
lldb/trunk/source/Commands/CommandObjectRegister.cpp
lldb/trunk/source/Commands/CommandObjectRegister.h
lldb/trunk/source/Commands/CommandObjectSet.cpp
lldb/trunk/source/Commands/CommandObjectSet.h
lldb/trunk/source/Commands/CommandObjectSettings.cpp
lldb/trunk/source/Commands/CommandObjectSettings.h
lldb/trunk/source/Commands/CommandObjectShow.cpp
lldb/trunk/source/Commands/CommandObjectShow.h
lldb/trunk/source/Commands/CommandObjectSource.cpp
lldb/trunk/source/Commands/CommandObjectSource.h
lldb/trunk/source/Commands/CommandObjectSourceFile.cpp
lldb/trunk/source/Commands/CommandObjectSourceFile.h
lldb/trunk/source/Commands/CommandObjectSyntax.cpp
lldb/trunk/source/Commands/CommandObjectSyntax.h
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Commands/CommandObjectTarget.h
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Commands/CommandObjectThread.h
lldb/trunk/source/Commands/CommandObjectUnalias.cpp
lldb/trunk/source/Commands/CommandObjectUnalias.h
lldb/trunk/source/Commands/CommandObjectVariable.cpp
lldb/trunk/source/Commands/CommandObjectVariable.h
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/Disassembler.cpp
lldb/trunk/source/Core/InputReader.cpp
lldb/trunk/source/Core/Log.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Interpreter/CommandObject.cpp
lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp
lldb/trunk/source/Interpreter/CommandObjectScript.cpp
lldb/trunk/source/Interpreter/CommandObjectScript.h
lldb/trunk/source/Interpreter/Options.cpp
lldb/trunk/source/Interpreter/ScriptInterpreterNone.cpp
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/StackFrame.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/TargetList.cpp
lldb/trunk/tools/driver/Driver.cpp
lldb/trunk/tools/driver/Driver.h
lldb/trunk/tools/driver/IOChannel.cpp
Modified: lldb/trunk/include/lldb/API/SBAddress.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBAddress.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBAddress.h (original)
+++ lldb/trunk/include/lldb/API/SBAddress.h Tue Jun 22 20:19:29 2010
@@ -66,7 +66,7 @@
private:
- std::auto_ptr<lldb_private::Address> m_lldb_object_ap;
+ std::auto_ptr<lldb_private::Address> m_opaque_ap;
};
Modified: lldb/trunk/include/lldb/API/SBBlock.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBlock.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBlock.h (original)
+++ lldb/trunk/include/lldb/API/SBBlock.h Tue Jun 22 20:19:29 2010
@@ -35,7 +35,7 @@
SBBlock (lldb_private::Block *lldb_object_ptr);
- lldb_private::Block *m_lldb_object_ptr;
+ lldb_private::Block *m_opaque_ptr;
};
Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpoint.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBreakpoint.h (original)
+++ lldb/trunk/include/lldb/API/SBBreakpoint.h Tue Jun 22 20:19:29 2010
@@ -140,7 +140,7 @@
lldb::user_id_t break_id,
lldb::user_id_t break_loc_id);
- lldb::BreakpointSP m_break_sp;
+ lldb::BreakpointSP m_opaque_sp;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBBreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpointLocation.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/API/SBBreakpointLocation.h Tue Jun 22 20:19:29 2010
@@ -82,7 +82,7 @@
void
SetLocation (const lldb::BreakpointLocationSP &break_loc_sp);
- lldb::BreakpointLocationSP m_break_loc_sp;
+ lldb::BreakpointLocationSP m_opaque_sp;
};
Modified: lldb/trunk/include/lldb/API/SBBroadcaster.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBroadcaster.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBroadcaster.h (original)
+++ lldb/trunk/include/lldb/API/SBBroadcaster.h Tue Jun 22 20:19:29 2010
@@ -66,16 +66,20 @@
SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns);
+#ifndef SWIG
+
lldb_private::Broadcaster *
- GetLLDBObjectPtr () const;
+ get () const;
void
- SetLLDBObjectPtr (lldb_private::Broadcaster *broadcaster, bool owns);
+ reset (lldb_private::Broadcaster *broadcaster, bool owns);
+
+#endif
private:
- lldb_private::Broadcaster *m_lldb_object;
- bool m_lldb_object_owned;
+ lldb_private::Broadcaster *m_opaque;
+ bool m_opaque_owned;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBCommandContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommandContext.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCommandContext.h (original)
+++ lldb/trunk/include/lldb/API/SBCommandContext.h Tue Jun 22 20:19:29 2010
@@ -19,7 +19,7 @@
{
public:
- SBCommandContext (lldb_private::CommandContext *lldb_object);
+ SBCommandContext (lldb_private::Debugger *lldb_object);
~SBCommandContext ();
@@ -28,7 +28,7 @@
private:
- lldb_private::CommandContext *m_lldb_object;
+ lldb_private::Debugger *m_opaque;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBCommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommandInterpreter.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/API/SBCommandInterpreter.h Tue Jun 22 20:19:29 2010
@@ -28,6 +28,9 @@
~SBCommandInterpreter ();
bool
+ IsValid() const;
+
+ bool
CommandExists (const char *cmd);
bool
@@ -86,17 +89,20 @@
protected:
lldb_private::CommandInterpreter &
- GetLLDBObjectRef ();
+ ref ();
lldb_private::CommandInterpreter *
- GetLLDBObjectPtr ();
+ get ();
+ void
+ reset (lldb_private::CommandInterpreter *);
private:
friend class SBDebugger;
- SBCommandInterpreter (lldb_private::CommandInterpreter &interpreter_ptr); // Access using SBDebugger::GetSharedInstance().GetCommandInterpreter();
+ SBCommandInterpreter (lldb_private::CommandInterpreter *interpreter_ptr = NULL); // Access using SBDebugger::GetCommandInterpreter();
- lldb_private::CommandInterpreter &m_interpreter;
+
+ lldb_private::CommandInterpreter *m_opaque_ptr;
};
Modified: lldb/trunk/include/lldb/API/SBCommandReturnObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommandReturnObject.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCommandReturnObject.h (original)
+++ lldb/trunk/include/lldb/API/SBCommandReturnObject.h Tue Jun 22 20:19:29 2010
@@ -62,17 +62,27 @@
friend class SBCommandInterpreter;
friend class SBOptions;
+
+#ifndef SWIG
+
+ lldb_private::CommandReturnObject *
+ operator->() const;
+
lldb_private::CommandReturnObject *
- GetLLDBObjectPtr();
+ get() const;
+
+ lldb_private::CommandReturnObject &
+ operator*() const;
lldb_private::CommandReturnObject &
- GetLLDBObjectRef();
+ ref() const;
+#endif
void
SetLLDBObjectPtr (lldb_private::CommandReturnObject *ptr);
private:
- std::auto_ptr<lldb_private::CommandReturnObject> m_return_object_ap;
+ std::auto_ptr<lldb_private::CommandReturnObject> m_opaque_ap;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBCommunication.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommunication.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCommunication.h (original)
+++ lldb/trunk/include/lldb/API/SBCommunication.h Tue Jun 22 20:19:29 2010
@@ -87,8 +87,8 @@
// void
// CreateIfNeeded ();
- lldb_private::Communication *m_lldb_object;
- bool m_lldb_object_owned;
+ lldb_private::Communication *m_opaque;
+ bool m_opaque_owned;
};
Modified: lldb/trunk/include/lldb/API/SBCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCompileUnit.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCompileUnit.h (original)
+++ lldb/trunk/include/lldb/API/SBCompileUnit.h Tue Jun 22 20:19:29 2010
@@ -66,7 +66,7 @@
#endif
- lldb_private::CompileUnit *m_lldb_object_ptr;
+ lldb_private::CompileUnit *m_opaque_ptr;
};
Modified: lldb/trunk/include/lldb/API/SBDebugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDebugger.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBDebugger.h (original)
+++ lldb/trunk/include/lldb/API/SBDebugger.h Tue Jun 22 20:19:29 2010
@@ -25,95 +25,90 @@
static void
Terminate();
- static void
- SetAsync (bool b);
+ static SBDebugger
+ Create();
- static void
- SetInputFile (const char *tty_name); // DEPRECATED: will be removed in next submission
+ ~SBDebugger();
- static void
- SetOutputFile (const char *tty_name); // DEPRECATED: will be removed in next submission
+ bool
+ IsValid() const;
- static void
- SetErrorFile (const char *tty_name); // DEPRECATED: will be removed in next submission
+ void
+ SetAsync (bool b);
- static void
+ void
SetInputFileHandle (FILE *f, bool transfer_ownership);
- static void
+ void
SetOutputFileHandle (FILE *f, bool transfer_ownership);
- static void
+ void
SetErrorFileHandle (FILE *f, bool transfer_ownership);
- static FILE *
+ FILE *
GetInputFileHandle ();
- static FILE *
+ FILE *
GetOutputFileHandle ();
- static FILE *
+ FILE *
GetErrorFileHandle ();
- static lldb::SBCommandInterpreter
+ lldb::SBCommandInterpreter
GetCommandInterpreter ();
- static void
+ void
HandleCommand (const char *command);
- static lldb::SBListener
+ lldb::SBListener
GetListener ();
- static void
+ void
HandleProcessEvent (const lldb::SBProcess &process,
const lldb::SBEvent &event,
FILE *out,
FILE *err);
- static lldb::SBTarget
+ lldb::SBTarget
CreateTargetWithFileAndTargetTriple (const char *filename,
const char *target_triple);
- static lldb::SBTarget
+ lldb::SBTarget
CreateTargetWithFileAndArch (const char *filename,
const char *archname);
- static lldb::SBTarget
+ lldb::SBTarget
CreateTarget (const char *filename);
- static lldb::SBTarget
+ lldb::SBTarget
GetTargetAtIndex (uint32_t idx);
- static lldb::SBTarget
+ lldb::SBTarget
FindTargetWithProcessID (pid_t pid);
- static lldb::SBTarget
+ lldb::SBTarget
FindTargetWithFileAndArch (const char *filename,
const char *arch);
- static uint32_t
+ uint32_t
GetNumTargets ();
- static lldb::SBTarget
+ lldb::SBTarget
GetCurrentTarget ();
- static void
+ void
UpdateCurrentThread (lldb::SBProcess &process);
- static void
- ReportCurrentLocation (FILE *out = stdout,
- FILE *err = stderr);
-
- static lldb::SBSourceManager &
+ lldb::SBSourceManager &
GetSourceManager ();
- static bool
+ bool
GetDefaultArchitecture (char *arch_name, size_t arch_name_len);
- static bool
+ bool
SetDefaultArchitecture (const char *arch_name);
- static lldb::ScriptLanguage
+ lldb::ScriptLanguage
GetScriptingLanguage (const char *script_language_name);
static const char *
@@ -128,19 +123,39 @@
static bool
StateIsStoppedState (lldb::StateType state);
- static void
+ void
DispatchInput (void *baton, const void *data, size_t data_len);
- static void
+ void
PushInputReader (lldb::SBInputReader &reader);
private:
+
+ // Use the static function: SBDebugger::Create();
+ SBDebugger();
+
#ifndef SWIG
- friend class SBProcess;
- static lldb::SBTarget
+ friend class SBInputReader;
+ friend class SBProcess;
+ friend class SBTarget;
+
+ lldb::SBTarget
FindTargetWithLLDBProcess (const lldb::ProcessSP &processSP);
+
+ void
+ reset (const lldb::DebuggerSP &debugger_sp);
+
+ lldb_private::Debugger *
+ get () const;
+
+ lldb_private::Debugger &
+ ref () const;
+
#endif
+
+ lldb::DebuggerSP m_opaque_sp;
+
}; // class SBDebugger
Modified: lldb/trunk/include/lldb/API/SBError.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBError.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBError.h (original)
+++ lldb/trunk/include/lldb/API/SBError.h Tue Jun 22 20:19:29 2010
@@ -90,7 +90,7 @@
SetError (const lldb_private::Error &lldb_error);
private:
- std::auto_ptr<lldb_private::Error> m_lldb_object_ap;
+ std::auto_ptr<lldb_private::Error> m_opaque_ap;
void
CreateIfNeeded ();
Modified: lldb/trunk/include/lldb/API/SBEvent.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBEvent.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBEvent.h (original)
+++ lldb/trunk/include/lldb/API/SBEvent.h Tue Jun 22 20:19:29 2010
@@ -64,25 +64,26 @@
SBEvent (lldb::EventSP &event_sp);
+#ifndef SWIG
+
lldb::EventSP &
- GetSharedPtr () const;
+ GetSP () const;
void
- SetEventSP (lldb::EventSP &event_sp);
+ reset (lldb::EventSP &event_sp);
void
- SetLLDBObjectPtr (lldb_private::Event* event);
+ reset (lldb_private::Event* event);
lldb_private::Event *
- GetLLDBObjectPtr ();
+ get () const;
- const lldb_private::Event *
- GetLLDBObjectPtr () const;
+#endif
private:
mutable lldb::EventSP m_event_sp;
- mutable lldb_private::Event *m_lldb_object;
+ mutable lldb_private::Event *m_opaque;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBFileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFileSpec.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBFileSpec.h (original)
+++ lldb/trunk/include/lldb/API/SBFileSpec.h Tue Jun 22 20:19:29 2010
@@ -54,6 +54,7 @@
friend class SBHostOS;
friend class SBModule;
friend class SBSourceManager;
+ friend class SBThread;
friend class SBTarget;
void
@@ -74,7 +75,7 @@
#endif
- std::auto_ptr <lldb_private::FileSpec> m_lldb_object_ap;
+ std::auto_ptr <lldb_private::FileSpec> m_opaque_ap;
};
Modified: lldb/trunk/include/lldb/API/SBFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFrame.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBFrame.h (original)
+++ lldb/trunk/include/lldb/API/SBFrame.h Tue Jun 22 20:19:29 2010
@@ -122,7 +122,7 @@
void
SetFrame (const lldb::StackFrameSP &lldb_object_sp);
- lldb::StackFrameSP m_lldb_object_sp;
+ lldb::StackFrameSP m_opaque_sp;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBFunction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFunction.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBFunction.h (original)
+++ lldb/trunk/include/lldb/API/SBFunction.h Tue Jun 22 20:19:29 2010
@@ -46,7 +46,7 @@
SBFunction (lldb_private::Function *lldb_object_ptr);
- lldb_private::Function *m_lldb_object_ptr;
+ lldb_private::Function *m_opaque_ptr;
};
Modified: lldb/trunk/include/lldb/API/SBInputReader.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBInputReader.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBInputReader.h (original)
+++ lldb/trunk/include/lldb/API/SBInputReader.h Tue Jun 22 20:19:29 2010
@@ -36,7 +36,8 @@
SBError
- Initialize (Callback callback,
+ Initialize (SBDebugger &debugger,
+ Callback callback,
void *callback_baton,
lldb::InputReaderGranularity granularity,
const char *end_token,
@@ -76,21 +77,26 @@
const lldb::InputReaderSP &
operator *() const;
-#endif
lldb_private::InputReader *
get() const;
+ lldb_private::InputReader &
+ ref() const;
+
+#endif
+
+
private:
static size_t
PrivateCallback (void *baton,
- lldb_private::InputReader *reader,
+ lldb_private::InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len);
- lldb::InputReaderSP m_reader_sp;
+ lldb::InputReaderSP m_opaque_sp;
Callback m_callback_function;
void *m_callback_baton;
};
Modified: lldb/trunk/include/lldb/API/SBInstruction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBInstruction.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBInstruction.h (original)
+++ lldb/trunk/include/lldb/API/SBInstruction.h Tue Jun 22 20:19:29 2010
@@ -48,7 +48,7 @@
private:
- //lldb_private::Disassembler::Instruction::SharedPtr m_lldb_object_sp;
+ //lldb_private::Disassembler::Instruction::SharedPtr m_opaque_sp;
};
Modified: lldb/trunk/include/lldb/API/SBLineEntry.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBLineEntry.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBLineEntry.h (original)
+++ lldb/trunk/include/lldb/API/SBLineEntry.h Tue Jun 22 20:19:29 2010
@@ -79,7 +79,7 @@
void
SetLineEntry (const lldb_private::LineEntry &lldb_object_ref);
- std::auto_ptr<lldb_private::LineEntry> m_lldb_object_ap;
+ std::auto_ptr<lldb_private::LineEntry> m_opaque_ap;
};
Modified: lldb/trunk/include/lldb/API/SBListener.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBListener.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBListener.h (original)
+++ lldb/trunk/include/lldb/API/SBListener.h Tue Jun 22 20:19:29 2010
@@ -106,12 +106,15 @@
const lldb_private::Listener &
operator *() const;
+ void
+ reset(lldb_private::Listener *listener, bool transfer_ownership);
+
#endif
- lldb_private::Listener *m_lldb_object_ptr;
- bool m_lldb_object_ptr_owned;
+ lldb_private::Listener *m_opaque_ptr;
+ bool m_opaque_ptr_owned;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBModule.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBModule.h (original)
+++ lldb/trunk/include/lldb/API/SBModule.h Tue Jun 22 20:19:29 2010
@@ -70,7 +70,7 @@
#endif
- lldb::ModuleSP m_lldb_object_sp;
+ lldb::ModuleSP m_opaque_sp;
};
Modified: lldb/trunk/include/lldb/API/SBProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBProcess.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBProcess.h (original)
+++ lldb/trunk/include/lldb/API/SBProcess.h Tue Jun 22 20:19:29 2010
@@ -106,12 +106,6 @@
SBError
Destroy ();
- void
- DisplayThreadsInfo (FILE *out = NULL, FILE *err = NULL, bool only_threads_with_stop_reason = true);
-
- void
- ListThreads ();
-
bool
WaitUntilProcessHasStopped (lldb::SBCommandReturnObject &result);
@@ -139,9 +133,6 @@
SBError
Signal (int signal);
- void
- Backtrace (bool all_threads = false, uint32_t num_frames = 0);
-
size_t
ReadMemory (addr_t addr, void *buf, size_t size, SBError &error);
@@ -188,7 +179,7 @@
void
SetProcess (const lldb::ProcessSP &process_sp);
- lldb::ProcessSP m_lldb_object_sp;
+ lldb::ProcessSP m_opaque_sp;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBSourceManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSourceManager.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBSourceManager.h (original)
+++ lldb/trunk/include/lldb/API/SBSourceManager.h Tue Jun 22 20:19:29 2010
@@ -41,7 +41,7 @@
private:
- lldb_private::SourceManager &m_source_manager;
+ lldb_private::SourceManager &m_opaque_ref;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBStringList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBStringList.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBStringList.h (original)
+++ lldb/trunk/include/lldb/API/SBStringList.h Tue Jun 22 20:19:29 2010
@@ -62,7 +62,7 @@
private:
- std::auto_ptr<lldb_private::StringList> m_lldb_object_ap;
+ std::auto_ptr<lldb_private::StringList> m_opaque_ap;
};
Modified: lldb/trunk/include/lldb/API/SBSymbol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSymbol.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBSymbol.h (original)
+++ lldb/trunk/include/lldb/API/SBSymbol.h Tue Jun 22 20:19:29 2010
@@ -46,7 +46,7 @@
SBSymbol (lldb_private::Symbol *lldb_object_ptr);
- lldb_private::Symbol *m_lldb_object_ptr;
+ lldb_private::Symbol *m_opaque_ptr;
};
Modified: lldb/trunk/include/lldb/API/SBSymbolContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSymbolContext.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBSymbolContext.h (original)
+++ lldb/trunk/include/lldb/API/SBSymbolContext.h Tue Jun 22 20:19:29 2010
@@ -64,7 +64,7 @@
SetSymbolContext (const lldb_private::SymbolContext *sc_ptr);
private:
- std::auto_ptr<lldb_private::SymbolContext> m_lldb_object_ap;
+ std::auto_ptr<lldb_private::SymbolContext> m_opaque_ap;
};
Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Tue Jun 22 20:19:29 2010
@@ -70,6 +70,9 @@
lldb::SBModule
GetModuleAtIndex (uint32_t idx);
+ lldb::SBDebugger
+ GetDebugger() const;
+
lldb::SBModule
FindModule (const lldb::SBFileSpec &file_spec);
@@ -146,20 +149,20 @@
SBTarget (const lldb::TargetSP& target_sp);
void
- SetLLBDTarget (const lldb::TargetSP& target_sp);
+ reset (const lldb::TargetSP& target_sp);
lldb_private::Target *
- GetLLDBObjectPtr();
+ operator ->() const;
- const lldb_private::Target *
- GetLLDBObjectPtr() const;
+ lldb_private::Target *
+ get() const;
private:
//------------------------------------------------------------------
// For Target only
//------------------------------------------------------------------
- lldb::TargetSP m_target_sp;
+ lldb::TargetSP m_opaque_sp;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBThread.h (original)
+++ lldb/trunk/include/lldb/API/SBThread.h Tue Jun 22 20:19:29 2010
@@ -82,9 +82,6 @@
void
RunToAddress (lldb::addr_t addr);
- void
- Backtrace (uint32_t num_frames = 0);
-
uint32_t
GetNumFrames ();
@@ -146,7 +143,7 @@
// Classes that inherit from Thread can see and modify these
//------------------------------------------------------------------
- lldb::ThreadSP m_lldb_object_sp;
+ lldb::ThreadSP m_opaque_sp;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Tue Jun 22 20:19:29 2010
@@ -112,11 +112,11 @@
#endif
private:
-
- lldb_private::ExecutionContext
- GetCurrentExecutionContext ();
-
- lldb::ValueObjectSP m_lldb_object_sp;
+//
+// lldb_private::ExecutionContext
+// GetCurrentExecutionContext ();
+//
+ lldb::ValueObjectSP m_opaque_sp;
};
} // namespace lldb
Modified: lldb/trunk/include/lldb/API/SBValueList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValueList.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValueList.h (original)
+++ lldb/trunk/include/lldb/API/SBValueList.h Tue Jun 22 20:19:29 2010
@@ -68,7 +68,7 @@
void
CreateIfNeeded ();
- std::auto_ptr<lldb_private::ValueObjectList> m_lldb_object_ap;
+ std::auto_ptr<lldb_private::ValueObjectList> m_opaque_ap;
};
Modified: lldb/trunk/include/lldb/Breakpoint/StoppointCallbackContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/StoppointCallbackContext.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/StoppointCallbackContext.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/StoppointCallbackContext.h Tue Jun 22 20:19:29 2010
@@ -48,7 +48,7 @@
//------------------------------------------------------------------
Event *event; // This is the event, the callback can modify this to indicate
// the meaning of the breakpoint hit
- ExecutionContext context; // This tells us where we have stopped, what thread.
+ ExecutionContext exe_ctx; // This tells us where we have stopped, what thread.
bool is_synchronous; // Is the callback being executed synchronously with the breakpoint,
// or asynchronously as the event is retrieved?
};
Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Tue Jun 22 20:19:29 2010
@@ -17,11 +17,11 @@
#include <stack>
-#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Core/Communication.h"
#include "lldb/Core/Listener.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/SourceManager.h"
+#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/TargetList.h"
namespace lldb_private {
@@ -36,17 +36,23 @@
{
public:
+ static lldb::DebuggerSP
+ CreateInstance ();
+
+ static lldb::TargetSP
+ FindTargetWithProcessID (lldb::pid_t pid);
+
static void
Initialize ();
static void
Terminate ();
- static Debugger &
- GetSharedInstance ();
-
~Debugger ();
+ lldb::DebuggerSP
+ GetSP ();
+
bool
GetAsyncExecution ();
@@ -123,6 +129,16 @@
bool
PopInputReader (const lldb::InputReaderSP& reader_sp);
+ ExecutionContext &
+ GetExecutionContext()
+ {
+ return m_exe_ctx;
+ }
+
+
+ void
+ UpdateExecutionContext (ExecutionContext *override_context);
+
protected:
static void
@@ -137,7 +153,6 @@
void
DisconnectInput();
- bool m_async_execution;
Communication m_input_comm;
StreamFile m_input_file;
StreamFile m_output_file;
@@ -145,21 +160,19 @@
TargetList m_target_list;
Listener m_listener;
SourceManager m_source_manager;
- CommandInterpreter m_command_interpreter;
+ std::auto_ptr<CommandInterpreter> m_command_interpreter_ap;
+ ExecutionContext m_exe_ctx;
std::stack<lldb::InputReaderSP> m_input_readers;
std::string m_input_reader_data;
- typedef lldb::SharedPtr<Debugger>::Type DebuggerSP;
+private:
+
+ // Use Debugger::CreateInstance() to get a shared pointer to a new
+ // debugger object
+ Debugger ();
- static DebuggerSP &
- GetDebuggerSP();
-
- static int g_shared_debugger_refcount;
- static bool g_in_terminate;
-private:
- Debugger (); // Access the single global instance of this class using Debugger::GetSharedInstance();
DISALLOW_COPY_AND_ASSIGN (Debugger);
};
Modified: lldb/trunk/include/lldb/Core/Disassembler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Disassembler.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Disassembler.h (original)
+++ lldb/trunk/include/lldb/Core/Disassembler.h Tue Jun 22 20:19:29 2010
@@ -86,7 +86,8 @@
FindPlugin (const ArchSpec &arch);
static bool
- Disassemble (const ArchSpec &arch,
+ Disassemble (Debugger &debugger,
+ const ArchSpec &arch,
const ExecutionContext &exe_ctx,
uint32_t mixed_context_lines,
Stream &strm);
Modified: lldb/trunk/include/lldb/Core/InputReader.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/InputReader.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/InputReader.h (original)
+++ lldb/trunk/include/lldb/Core/InputReader.h Tue Jun 22 20:19:29 2010
@@ -24,12 +24,12 @@
public:
typedef size_t (*Callback) (void *baton,
- InputReader *reader,
+ InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len);
- InputReader ();
+ InputReader (Debugger &debugger);
virtual
~InputReader ();
@@ -71,11 +71,11 @@
virtual size_t
HandleRawBytes (const char *bytes, size_t bytes_len);
- FILE *
- GetInputFileHandle ();
-
- FILE *
- GetOutputFileHandle ();
+ Debugger &
+ GetDebugger()
+ {
+ return m_debugger;
+ }
bool
IsActive () const
@@ -95,6 +95,7 @@
void
Notify (lldb::InputReaderAction notification);
+ Debugger &m_debugger;
Callback m_callback;
void *m_callback_baton;
std::string m_end_token;
Modified: lldb/trunk/include/lldb/Interpreter/CommandCompletions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandCompletions.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandCompletions.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandCompletions.h Tue Jun 22 20:19:29 2010
@@ -29,12 +29,12 @@
// This is the command completion callback that is used to complete the argument of the option
// it is bound to (in the OptionDefinition table below). Return the total number of matches.
//----------------------------------------------------------------------
- typedef int (*CompletionCallback) (const char *completion_str, // This is the argument we are completing
- int match_start_point, // This is the point in the list of matches that you should start returning elements
- int max_return_elements, // This is the number of matches requested.
- lldb_private::CommandInterpreter *interpreter, // The command interpreter running this command.
- lldb_private::SearchFilter *searcher, // A search filter to limit the search...
- lldb_private::StringList &matches); // The array of matches we return.
+ typedef int (*CompletionCallback) (CommandInterpreter &interpreter,
+ const char *completion_str, // This is the argument we are completing
+ int match_start_point, // This is the point in the list of matches that you should start returning elements
+ int max_return_elements, // This is the number of matches requested.
+ lldb_private::SearchFilter *searcher,// A search filter to limit the search...
+ lldb_private::StringList &matches); // The array of matches we return.
typedef enum
{
eNoCompletion = 0,
@@ -54,41 +54,41 @@
CompletionCallback callback;
};
- static bool InvokeCommonCompletionCallbacks (uint32_t completion_mask,
- const char *completion_str,
- int match_start_point,
- int max_return_elements,
- lldb_private::CommandInterpreter *interpreter,
- SearchFilter *searcher,
- StringList &matches);
-
+ static bool InvokeCommonCompletionCallbacks (CommandInterpreter &interpreter,
+ uint32_t completion_mask,
+ const char *completion_str,
+ int match_start_point,
+ int max_return_elements,
+ SearchFilter *searcher,
+ StringList &matches);
+
//----------------------------------------------------------------------
// These are the generic completer functions:
//----------------------------------------------------------------------
static int
- SourceFiles (const char *partial_file_name,
- int match_start_point,
- int max_return_elements,
- CommandInterpreter *interpreter,
- SearchFilter *searcher,
- StringList &matches);
-
+ SourceFiles (CommandInterpreter &interpreter,
+ const char *partial_file_name,
+ int match_start_point,
+ int max_return_elements,
+ SearchFilter *searcher,
+ StringList &matches);
+
static int
- Modules (const char *partial_file_name,
- int match_start_point,
- int max_return_elements,
- lldb_private::CommandInterpreter *interpreter,
- SearchFilter *searcher,
- lldb_private::StringList &matches);
-
+ Modules (CommandInterpreter &interpreter,
+ const char *partial_file_name,
+ int match_start_point,
+ int max_return_elements,
+ SearchFilter *searcher,
+ lldb_private::StringList &matches);
+
static int
- Symbols (const char *partial_file_name,
- int match_start_point,
- int max_return_elements,
- lldb_private::CommandInterpreter *interpreter,
- SearchFilter *searcher,
- lldb_private::StringList &matches);
-
+ Symbols (CommandInterpreter &interpreter,
+ const char *partial_file_name,
+ int match_start_point,
+ int max_return_elements,
+ SearchFilter *searcher,
+ lldb_private::StringList &matches);
+
//----------------------------------------------------------------------
// The Completer class is a convenient base class for building searchers
// that go along with the SearchFilter passed to the standard Completer
@@ -97,10 +97,10 @@
class Completer : public Searcher
{
public:
- Completer (const char *completion_str,
+ Completer (CommandInterpreter &interpreter,
+ const char *completion_str,
int match_start_point,
int max_return_elements,
- CommandInterpreter *interpreter,
StringList &matches);
virtual ~Completer ();
@@ -118,10 +118,10 @@
DoCompletion (SearchFilter *filter) = 0;
protected:
+ CommandInterpreter &m_interpreter;
std::string m_completion_str;
int m_match_start_point;
int m_max_return_elements;
- CommandInterpreter *m_interpreter;
StringList &m_matches;
private:
DISALLOW_COPY_AND_ASSIGN (Completer);
@@ -134,13 +134,13 @@
{
public:
- SourceFileCompleter (bool include_support_files,
- const char *completion_str,
- int match_start_point,
- int max_return_elements,
- CommandInterpreter *interpreter,
- StringList &matches);
-
+ SourceFileCompleter (CommandInterpreter &interpreter,
+ bool include_support_files,
+ const char *completion_str,
+ int match_start_point,
+ int max_return_elements,
+ StringList &matches);
+
virtual Searcher::Depth GetDepth ();
virtual Searcher::CallbackReturn
@@ -168,12 +168,12 @@
{
public:
- ModuleCompleter (const char *completion_str,
- int match_start_point,
- int max_return_elements,
- CommandInterpreter *interpreter,
- StringList &matches);
-
+ ModuleCompleter (CommandInterpreter &interpreter,
+ const char *completion_str,
+ int match_start_point,
+ int max_return_elements,
+ StringList &matches);
+
virtual Searcher::Depth GetDepth ();
virtual Searcher::CallbackReturn
@@ -199,12 +199,12 @@
{
public:
- SymbolCompleter (const char *completion_str,
- int match_start_point,
- int max_return_elements,
- CommandInterpreter *interpreter,
- StringList &matches);
-
+ SymbolCompleter (CommandInterpreter &interpreter,
+ const char *completion_str,
+ int match_start_point,
+ int max_return_elements,
+ StringList &matches);
+
virtual Searcher::Depth GetDepth ();
virtual Searcher::CallbackReturn
@@ -217,15 +217,15 @@
DoCompletion (SearchFilter *filter);
private:
- struct NameCmp {
- bool operator() (const ConstString& lhs, const ConstString& rhs) const
- {
- return lhs < rhs;
- }
- };
+// struct NameCmp {
+// bool operator() (const ConstString& lhs, const ConstString& rhs) const
+// {
+// return lhs < rhs;
+// }
+// };
RegularExpression m_regex;
- typedef std::set<ConstString, NameCmp> collection;
+ typedef std::set<ConstString> collection;
collection m_match_set;
DISALLOW_COPY_AND_ASSIGN (SymbolCompleter);
Removed: lldb/trunk/include/lldb/Interpreter/CommandContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandContext.h?rev=106614&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandContext.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandContext.h (removed)
@@ -1,43 +0,0 @@
-//===-- CommandContext.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_CommandContext_h_
-#define liblldb_CommandContext_h_
-
-#include "lldb/lldb-private.h"
-#include "lldb/Core/ArchSpec.h"
-#include "lldb/Target/ExecutionContext.h"
-#include "lldb/Core/FileSpec.h"
-#include "lldb/Core/ValueObjectList.h"
-
-namespace lldb_private {
-
-class CommandContext
-{
-public:
- CommandContext ();
-
- ~CommandContext ();
-
- void
- Update (ExecutionContext *override_context = NULL);
-
- Target *
- GetTarget();
-
- ExecutionContext &
- GetExecutionContext();
-
-private:
- ExecutionContext m_exe_ctx;
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_CommandContext_h_
Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Tue Jun 22 20:19:29 2010
@@ -16,8 +16,8 @@
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/Broadcaster.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Core/Log.h"
-#include "lldb/Interpreter/CommandContext.h"
#include "lldb/Interpreter/CommandObject.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
#include "lldb/Interpreter/StateVariable.h"
@@ -43,10 +43,9 @@
void
SourceInitFile (bool in_cwd, CommandReturnObject &result);
- CommandInterpreter (lldb::ScriptLanguage script_language,
- bool synchronous_execution,
- Listener *listener, // In case this is asked to create or attach to a process
- SourceManager& source_manager);
+ CommandInterpreter (Debugger &debugger,
+ lldb::ScriptLanguage script_language,
+ bool synchronous_execution);
virtual
~CommandInterpreter ();
@@ -88,7 +87,9 @@
AddOrReplaceAliasOptions (const char *alias_name, OptionArgVectorSP &option_arg_vector_sp);
bool
- HandleCommand (const char *command_line, bool add_to_history, CommandReturnObject &result,
+ HandleCommand (const char *command_line,
+ bool add_to_history,
+ CommandReturnObject &result,
ExecutionContext *override_context = NULL);
// This handles command line completion. You are given a pointer to the command string buffer, to the current cursor,
@@ -147,8 +148,11 @@
void
ShowVariableHelp (CommandReturnObject &result);
- CommandContext *
- Context();
+ Debugger &
+ GetDebugger ()
+ {
+ return m_debugger;
+ }
const Args *
GetProgramArguments ();
@@ -159,12 +163,6 @@
const char *
ProcessEmbeddedScriptCommands (const char *arg);
- Listener *
- GetListener ();
-
- SourceManager &
- GetSourceManager ();
-
const char *
GetPrompt ();
@@ -244,12 +242,9 @@
private:
+ Debugger &m_debugger; // The debugger session that this interpreter is associated with
lldb::ScriptLanguage m_script_language;
- CommandContext m_current_context;
bool m_synchronous_execution;
- Listener *m_listener;
- SourceManager& m_source_manager;
-
CommandObject::CommandMap m_command_dict; // Stores basic built-in commands (they cannot be deleted, removed or overwritten).
CommandObject::CommandMap m_alias_dict; // Stores user aliases/abbreviations for commands
CommandObject::CommandMap m_user_dict; // Stores user-defined commands
Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObject.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandObject.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObject.h Tue Jun 22 20:19:29 2010
@@ -83,26 +83,23 @@
// Do not override this
bool
- ExecuteCommandString (const char *command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ ExecuteCommandString (CommandInterpreter &interpreter,
+ const char *command,
CommandReturnObject &result);
bool
- ParseOptions(Args& args,
- CommandInterpreter *interpreter,
- CommandReturnObject &result);
+ ParseOptions (CommandInterpreter &interpreter,
+ Args& args,
+ CommandReturnObject &result);
bool
- ExecuteWithOptions (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ ExecuteWithOptions (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
virtual bool
- ExecuteRawCommandString (const char *command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ ExecuteRawCommandString (CommandInterpreter &interpreter,
+ const char *command,
CommandReturnObject &result)
{
return false;
@@ -110,9 +107,8 @@
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result) = 0;
void
@@ -134,12 +130,12 @@
// Don't override this method, override HandleArgumentCompletion instead unless
// you have special reasons.
virtual int
- HandleCompletion (Args &input,
+ HandleCompletion (CommandInterpreter &interpreter,
+ Args &input,
int &cursor_index,
int &cursor_char_position,
int match_start_point,
int max_return_elements,
- CommandInterpreter *interpreter,
StringList &matches);
// The input array contains a parsed version of the line. The insertion
@@ -149,16 +145,18 @@
// helpful for the completion.
virtual int
- HandleArgumentCompletion (Args &input,
- int &cursor_index,
- int &cursor_char_position,
- OptionElementVector &opt_element_vector,
- int match_start_point,
- int max_return_elements,
- CommandInterpreter *interpreter,
- StringList &matches);
-
-
+ HandleArgumentCompletion (CommandInterpreter &interpreter,
+ Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ OptionElementVector &opt_element_vector,
+ int match_start_point,
+ int max_return_elements,
+ StringList &matches)
+ {
+ return 0;
+ }
+
bool
HelpTextContainsWord (const char *search_word);
Modified: lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h Tue Jun 22 20:19:29 2010
@@ -37,9 +37,8 @@
GenerateHelpText (CommandReturnObject &result);
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
virtual bool
Modified: lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h Tue Jun 22 20:19:29 2010
@@ -28,10 +28,10 @@
{
public:
CommandObjectMultiword (const char *name,
- const char *help = NULL,
- const char *syntax = NULL,
- uint32_t flags = 0);
-
+ const char *help = NULL,
+ const char *syntax = NULL,
+ uint32_t flags = 0);
+
virtual
~CommandObjectMultiword ();
@@ -39,10 +39,12 @@
IsMultiwordObject () { return true; }
bool
- LoadSubCommand (lldb::CommandObjectSP command_obj, const char *cmd_name, CommandInterpreter *interpreter);
+ LoadSubCommand (CommandInterpreter &interpreter,
+ const char *cmd_name,
+ const lldb::CommandObjectSP& command_obj);
void
- GenerateHelpText (CommandReturnObject &result, CommandInterpreter *interpreter);
+ GenerateHelpText (CommandInterpreter &interpreter, CommandReturnObject &result);
lldb::CommandObjectSP
GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL);
@@ -51,18 +53,17 @@
GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL);
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
virtual int
- HandleCompletion (Args &input,
+ HandleCompletion (CommandInterpreter &interpreter,
+ Args &input,
int &cursor_index,
int &cursor_char_position,
int match_start_point,
int max_return_elements,
- CommandInterpreter *interpreter,
StringList &matches);
CommandObject::CommandMap m_subcommand_dict;
Modified: lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h Tue Jun 22 20:19:29 2010
@@ -35,18 +35,16 @@
~CommandObjectRegexCommand ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
virtual bool
WantsRawCommandString() { return true; }
virtual bool
- ExecuteRawCommandString (const char *command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ ExecuteRawCommandString (CommandInterpreter &interpreter,
+ const char *command,
CommandReturnObject &result);
Modified: lldb/trunk/include/lldb/Interpreter/Options.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Options.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/Options.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Options.h Tue Jun 22 20:19:29 2010
@@ -218,13 +218,13 @@
/// \btrue if we were in an option, \bfalse otherwise.
//------------------------------------------------------------------
bool
- HandleOptionCompletion (Args &input,
+ HandleOptionCompletion (CommandInterpreter &interpreter,
+ Args &input,
OptionElementVector &option_map,
int cursor_index,
int char_pos,
int match_start_point,
int max_return_elements,
- lldb_private::CommandInterpreter *interpreter,
lldb_private::StringList &matches);
//------------------------------------------------------------------
@@ -263,16 +263,16 @@
/// \btrue if we were in an option, \bfalse otherwise.
//------------------------------------------------------------------
virtual bool
- HandleOptionArgumentCompletion (Args &input,
- int cursor_index,
- int char_pos,
- OptionElementVector &opt_element_vector,
- int opt_element_index,
- int match_start_point,
- int max_return_elements,
- CommandInterpreter *interpreter,
- StringList &matches);
-
+ HandleOptionArgumentCompletion (CommandInterpreter &interpreter,
+ Args &input,
+ int cursor_index,
+ int char_pos,
+ OptionElementVector &opt_element_vector,
+ int opt_element_index,
+ int match_start_point,
+ int max_return_elements,
+ StringList &matches);
+
protected:
// This is a set of options expressed as indexes into the options table for this Option.
typedef std::set<char> OptionSet;
Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Tue Jun 22 20:19:29 2010
@@ -43,10 +43,10 @@
virtual ~ScriptInterpreter ();
virtual void
- ExecuteOneLine (const std::string&, FILE *, FILE *) = 0;
+ ExecuteOneLine (CommandInterpreter &interpreter, const char *command) = 0;
virtual void
- ExecuteInterpreterLoop (FILE *, FILE *) = 0;
+ ExecuteInterpreterLoop (CommandInterpreter &interpreter) = 0;
virtual bool
ExecuteOneLineWithReturn (const char *in_string, ReturnType return_type, void *ret_value)
Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreterNone.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreterNone.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreterNone.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreterNone.h Tue Jun 22 20:19:29 2010
@@ -18,15 +18,15 @@
{
public:
- ScriptInterpreterNone ();
+ ScriptInterpreterNone (CommandInterpreter &interpreter);
~ScriptInterpreterNone ();
virtual void
- ExecuteOneLine (const std::string &line, FILE *out, FILE *err);
+ ExecuteOneLine (CommandInterpreter &interpreter, const char *command);
virtual void
- ExecuteInterpreterLoop (FILE *out, FILE *err);
+ ExecuteInterpreterLoop (CommandInterpreter &interpreter);
};
Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h Tue Jun 22 20:19:29 2010
@@ -20,15 +20,15 @@
{
public:
- ScriptInterpreterPython ();
+ ScriptInterpreterPython (CommandInterpreter &interpreter);
~ScriptInterpreterPython ();
void
- ExecuteOneLine (const std::string &line, FILE *out, FILE *err);
+ ExecuteOneLine (CommandInterpreter &interpreter, const char *command);
void
- ExecuteInterpreterLoop (FILE *out, FILE *err);
+ ExecuteInterpreterLoop (CommandInterpreter &interpreter);
bool
ExecuteOneLineWithReturn (const char *in_string,
@@ -46,7 +46,7 @@
static size_t
GenerateBreakpointOptionsCommandCallback (void *baton,
- InputReader *reader,
+ InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len);
@@ -58,7 +58,8 @@
lldb::user_id_t break_loc_id);
void
- CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options,
+ CollectDataForBreakpointCommandCallback (CommandInterpreter &interpreter,
+ BreakpointOptions *bp_options,
CommandReturnObject &result);
StringList
@@ -68,7 +69,7 @@
static size_t
InputReaderCallback (void *baton,
- InputReader *reader,
+ InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len);
Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Tue Jun 22 20:19:29 2010
@@ -64,7 +64,7 @@
///
/// @see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
//------------------------------------------------------------------
- Target();
+ Target(Debugger &debugger);
public:
~Target();
@@ -253,6 +253,12 @@
ArchSpec
GetArchitecture () const;
+ Debugger &
+ GetDebugger ()
+ {
+ return m_debugger;
+ }
+
bool
GetTargetTriple (ConstString &target_triple);
@@ -294,6 +300,7 @@
//------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
+ Debugger & m_debugger;
ModuleList m_images; ///< The list of images for this process (shared libraries and anything dynamically loaded).
BreakpointList m_breakpoint_list;
BreakpointList m_internal_breakpoint_list;
Modified: lldb/trunk/include/lldb/Target/TargetList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/TargetList.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/TargetList.h (original)
+++ lldb/trunk/include/lldb/Target/TargetList.h Tue Jun 22 20:19:29 2010
@@ -79,7 +79,8 @@
/// A shared pointer to a target object.
//------------------------------------------------------------------
Error
- CreateTarget (const FileSpec& file_spec,
+ CreateTarget (Debugger &debugger,
+ const FileSpec& file_spec,
const ArchSpec& arch,
const UUID *uuid_ptr,
bool get_dependent_files,
Modified: lldb/trunk/include/lldb/lldb-forward-rtti.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward-rtti.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward-rtti.h (original)
+++ lldb/trunk/include/lldb/lldb-forward-rtti.h Tue Jun 22 20:19:29 2010
@@ -33,6 +33,7 @@
typedef SharedPtr<lldb_private::Communication>::Type CommunicationSP;
typedef SharedPtr<lldb_private::CompileUnit>::Type CompUnitSP;
typedef SharedPtr<lldb_private::DataBuffer>::Type DataBufferSP;
+ typedef SharedPtr<lldb_private::Debugger>::Type DebuggerSP;
typedef SharedPtr<lldb_private::DynamicLoader>::Type DynamicLoaderSP;
typedef SharedPtr<lldb_private::Event>::Type EventSP;
typedef SharedPtr<lldb_private::Function>::Type FunctionSP;
Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Tue Jun 22 20:19:29 2010
@@ -42,7 +42,7 @@
class ClangExpression;
class ClangExpressionDeclMap;
class ClangExpressionVariableList;
-class CommandContext;
+class Debugger;
class CommandInterpreter;
class CommandObject;
class CommandReturnObject;
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Jun 22 20:19:29 2010
@@ -160,7 +160,6 @@
26D5B0C711B07550009A862E /* CFCMutableDictionary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7EF310F1B8AD00F91463 /* CFCMutableDictionary.cpp */; };
26D5B0C811B07550009A862E /* CFCMutableSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7EF510F1B8AD00F91463 /* CFCMutableSet.cpp */; };
26D5B0C911B07550009A862E /* CFCString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7EF810F1B8AD00F91463 /* CFCString.cpp */; };
- 26D5B0CA11B07550009A862E /* CommandContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7F0710F1B8DD00F91463 /* CommandContext.cpp */; };
26D5B0CB11B07550009A862E /* CommandInterpreter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7F0810F1B8DD00F91463 /* CommandInterpreter.cpp */; };
26D5B0CC11B07550009A862E /* CommandObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7F0910F1B8DD00F91463 /* CommandObject.cpp */; };
26D5B0CD11B07550009A862E /* CommandReturnObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7F0A10F1B8DD00F91463 /* CommandReturnObject.cpp */; };
@@ -336,7 +335,6 @@
4C08CDE811C81EF8001610A8 /* ThreadSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C08CDE711C81EF8001610A8 /* ThreadSpec.cpp */; };
4C08CDEC11C81F1E001610A8 /* ThreadSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C08CDEB11C81F1E001610A8 /* ThreadSpec.h */; };
4CA9637B11B6E99A00780E28 /* CommandObjectApropos.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CA9637911B6E99A00780E28 /* CommandObjectApropos.cpp */; };
- 4CA9637C11B6E99A00780E28 /* CommandObjectApropos.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CA9637A11B6E99A00780E28 /* CommandObjectApropos.h */; };
9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A19A6A51163BB7E00E0D453 /* SBValue.h */; settings = {ATTRIBUTES = (Public, ); }; };
9A19A6B01163BBB300E0D453 /* SBValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A19A6AD1163BB9800E0D453 /* SBValue.cpp */; };
9A357583116CFDEE00E8ED2F /* SBValueList.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A357582116CFDEE00E8ED2F /* SBValueList.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -590,7 +588,6 @@
26BC7CFA10F1B71400F91463 /* Stoppoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Stoppoint.h; path = include/lldb/Breakpoint/Stoppoint.h; sourceTree = "<group>"; };
26BC7CFB10F1B71400F91463 /* StoppointLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StoppointLocation.h; path = include/lldb/Breakpoint/StoppointLocation.h; sourceTree = "<group>"; };
26BC7CFC10F1B71400F91463 /* WatchpointLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WatchpointLocation.h; path = include/lldb/Breakpoint/WatchpointLocation.h; sourceTree = "<group>"; };
- 26BC7D1010F1B76300F91463 /* CommandObjectAdd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectAdd.h; path = source/Commands/CommandObjectAdd.h; sourceTree = "<group>"; };
26BC7D1110F1B76300F91463 /* CommandObjectAlias.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectAlias.h; path = source/Commands/CommandObjectAlias.h; sourceTree = "<group>"; };
26BC7D1210F1B76300F91463 /* CommandObjectAppend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectAppend.h; path = source/Commands/CommandObjectAppend.h; sourceTree = "<group>"; };
26BC7D1410F1B76300F91463 /* CommandObjectBreakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectBreakpoint.h; path = source/Commands/CommandObjectBreakpoint.h; sourceTree = "<group>"; };
@@ -605,7 +602,6 @@
26BC7D1F10F1B76300F91463 /* CommandObjectProcess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectProcess.h; path = source/Commands/CommandObjectProcess.h; sourceTree = "<group>"; };
26BC7D2010F1B76300F91463 /* CommandObjectQuit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectQuit.h; path = source/Commands/CommandObjectQuit.h; sourceTree = "<group>"; };
26BC7D2210F1B76300F91463 /* CommandObjectRegister.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectRegister.h; path = source/Commands/CommandObjectRegister.h; sourceTree = "<group>"; };
- 26BC7D2310F1B76300F91463 /* CommandObjectRemove.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectRemove.h; path = source/Commands/CommandObjectRemove.h; sourceTree = "<group>"; };
26BC7D2410F1B76300F91463 /* CommandObjectScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectScript.h; path = source/Interpreter/CommandObjectScript.h; sourceTree = "<group>"; };
26BC7D2510F1B76300F91463 /* CommandObjectSelect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSelect.h; path = source/Commands/CommandObjectSelect.h; sourceTree = "<group>"; };
26BC7D2610F1B76300F91463 /* CommandObjectSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSet.h; path = source/Commands/CommandObjectSet.h; sourceTree = "<group>"; };
@@ -615,7 +611,6 @@
26BC7D2A10F1B76300F91463 /* CommandObjectSourceFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSourceFile.h; path = source/Commands/CommandObjectSourceFile.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>"; };
26BC7D2F10F1B76300F91463 /* CommandObjectVariable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectVariable.h; path = source/Commands/CommandObjectVariable.h; sourceTree = "<group>"; };
26BC7D5010F1B77400F91463 /* Address.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Address.h; path = include/lldb/Core/Address.h; sourceTree = "<group>"; };
26BC7D5110F1B77400F91463 /* AddressRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AddressRange.h; path = include/lldb/Core/AddressRange.h; sourceTree = "<group>"; };
@@ -677,7 +672,6 @@
26BC7DD410F1B7D500F91463 /* Host.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Host.h; path = include/lldb/Host/Host.h; sourceTree = "<group>"; };
26BC7DD510F1B7D500F91463 /* Mutex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Mutex.h; path = include/lldb/Host/Mutex.h; sourceTree = "<group>"; };
26BC7DD610F1B7D500F91463 /* Predicate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Predicate.h; path = include/lldb/Host/Predicate.h; sourceTree = "<group>"; };
- 26BC7DE110F1B7F900F91463 /* CommandContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandContext.h; path = include/lldb/Interpreter/CommandContext.h; sourceTree = "<group>"; };
26BC7DE210F1B7F900F91463 /* CommandInterpreter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandInterpreter.h; path = include/lldb/Interpreter/CommandInterpreter.h; sourceTree = "<group>"; };
26BC7DE310F1B7F900F91463 /* CommandObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObject.h; path = include/lldb/Interpreter/CommandObject.h; sourceTree = "<group>"; };
26BC7DE410F1B7F900F91463 /* CommandReturnObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandReturnObject.h; path = include/lldb/Interpreter/CommandReturnObject.h; sourceTree = "<group>"; };
@@ -712,7 +706,6 @@
26BC7E1610F1B83100F91463 /* Stoppoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Stoppoint.cpp; path = source/Breakpoint/Stoppoint.cpp; sourceTree = "<group>"; };
26BC7E1710F1B83100F91463 /* StoppointLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StoppointLocation.cpp; path = source/Breakpoint/StoppointLocation.cpp; sourceTree = "<group>"; };
26BC7E1810F1B83100F91463 /* WatchpointLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WatchpointLocation.cpp; path = source/Breakpoint/WatchpointLocation.cpp; sourceTree = "<group>"; };
- 26BC7E2910F1B84700F91463 /* CommandObjectAdd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectAdd.cpp; path = source/Commands/CommandObjectAdd.cpp; sourceTree = "<group>"; };
26BC7E2A10F1B84700F91463 /* CommandObjectAlias.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectAlias.cpp; path = source/Commands/CommandObjectAlias.cpp; sourceTree = "<group>"; };
26BC7E2B10F1B84700F91463 /* CommandObjectAppend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectAppend.cpp; path = source/Commands/CommandObjectAppend.cpp; sourceTree = "<group>"; };
26BC7E2D10F1B84700F91463 /* CommandObjectBreakpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectBreakpoint.cpp; path = source/Commands/CommandObjectBreakpoint.cpp; sourceTree = "<group>"; };
@@ -727,7 +720,6 @@
26BC7E3810F1B84700F91463 /* CommandObjectProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectProcess.cpp; path = source/Commands/CommandObjectProcess.cpp; sourceTree = "<group>"; };
26BC7E3910F1B84700F91463 /* CommandObjectQuit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectQuit.cpp; path = source/Commands/CommandObjectQuit.cpp; sourceTree = "<group>"; };
26BC7E3B10F1B84700F91463 /* CommandObjectRegister.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectRegister.cpp; path = source/Commands/CommandObjectRegister.cpp; sourceTree = "<group>"; };
- 26BC7E3C10F1B84700F91463 /* CommandObjectRemove.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectRemove.cpp; path = source/Commands/CommandObjectRemove.cpp; sourceTree = "<group>"; };
26BC7E3D10F1B84700F91463 /* CommandObjectScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectScript.cpp; path = source/Interpreter/CommandObjectScript.cpp; sourceTree = "<group>"; };
26BC7E3E10F1B84700F91463 /* CommandObjectSelect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSelect.cpp; path = source/Commands/CommandObjectSelect.cpp; sourceTree = "<group>"; };
26BC7E3F10F1B84700F91463 /* CommandObjectSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSet.cpp; path = source/Commands/CommandObjectSet.cpp; sourceTree = "<group>"; };
@@ -737,7 +729,6 @@
26BC7E4310F1B84700F91463 /* CommandObjectSourceFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSourceFile.cpp; path = source/Commands/CommandObjectSourceFile.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>"; };
26BC7E4810F1B84700F91463 /* CommandObjectVariable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectVariable.cpp; path = source/Commands/CommandObjectVariable.cpp; sourceTree = "<group>"; };
26BC7E6910F1B85900F91463 /* Address.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Address.cpp; path = source/Core/Address.cpp; sourceTree = "<group>"; };
26BC7E6A10F1B85900F91463 /* AddressRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AddressRange.cpp; path = source/Core/AddressRange.cpp; sourceTree = "<group>"; };
@@ -806,7 +797,6 @@
26BC7EF710F1B8AD00F91463 /* CFCReleaser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CFCReleaser.h; path = source/Host/macosx/cfcpp/CFCReleaser.h; sourceTree = "<group>"; };
26BC7EF810F1B8AD00F91463 /* CFCString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CFCString.cpp; path = source/Host/macosx/cfcpp/CFCString.cpp; sourceTree = "<group>"; };
26BC7EF910F1B8AD00F91463 /* CFCString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CFCString.h; path = source/Host/macosx/cfcpp/CFCString.h; sourceTree = "<group>"; };
- 26BC7F0710F1B8DD00F91463 /* CommandContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandContext.cpp; path = source/Interpreter/CommandContext.cpp; sourceTree = "<group>"; };
26BC7F0810F1B8DD00F91463 /* CommandInterpreter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandInterpreter.cpp; path = source/Interpreter/CommandInterpreter.cpp; sourceTree = "<group>"; };
26BC7F0910F1B8DD00F91463 /* CommandObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObject.cpp; path = source/Interpreter/CommandObject.cpp; sourceTree = "<group>"; };
26BC7F0A10F1B8DD00F91463 /* CommandReturnObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandReturnObject.cpp; path = source/Interpreter/CommandReturnObject.cpp; sourceTree = "<group>"; };
@@ -1751,8 +1741,6 @@
26BC7D0D10F1B71D00F91463 /* Commands */ = {
isa = PBXGroup;
children = (
- 26BC7D1010F1B76300F91463 /* CommandObjectAdd.h */,
- 26BC7E2910F1B84700F91463 /* CommandObjectAdd.cpp */,
26BC7D1110F1B76300F91463 /* CommandObjectAlias.h */,
26BC7E2A10F1B84700F91463 /* CommandObjectAlias.cpp */,
26BC7D1210F1B76300F91463 /* CommandObjectAppend.h */,
@@ -1793,8 +1781,6 @@
26BC7E3910F1B84700F91463 /* CommandObjectQuit.cpp */,
26BC7D2210F1B76300F91463 /* CommandObjectRegister.h */,
26BC7E3B10F1B84700F91463 /* CommandObjectRegister.cpp */,
- 26BC7D2310F1B76300F91463 /* CommandObjectRemove.h */,
- 26BC7E3C10F1B84700F91463 /* CommandObjectRemove.cpp */,
26BC7D2410F1B76300F91463 /* CommandObjectScript.h */,
26BC7E3D10F1B84700F91463 /* CommandObjectScript.cpp */,
26BC7D2510F1B76300F91463 /* CommandObjectSelect.h */,
@@ -1815,8 +1801,6 @@
269416AD119A024800FF2715 /* CommandObjectTarget.cpp */,
26BC7D2D10F1B76300F91463 /* CommandObjectThread.h */,
26BC7E4610F1B84700F91463 /* CommandObjectThread.cpp */,
- 26BC7D2E10F1B76300F91463 /* CommandObjectTranslate.h */,
- 26BC7E4710F1B84700F91463 /* CommandObjectTranslate.cpp */,
9A8B4EA210FD515000C68FF2 /* CommandObjectUnalias.h */,
9A8B4EA310FD516400C68FF2 /* CommandObjectUnalias.cpp */,
26BC7D2F10F1B76300F91463 /* CommandObjectVariable.h */,
@@ -1872,8 +1856,6 @@
26A4EEB511682AAC007A372A /* LLDBWrapPython.cpp */,
4C09CB73116BD98B00C7A725 /* CommandCompletions.h */,
4C09CB74116BD98B00C7A725 /* CommandCompletions.cpp */,
- 26BC7DE110F1B7F900F91463 /* CommandContext.h */,
- 26BC7F0710F1B8DD00F91463 /* CommandContext.cpp */,
26BC7DE210F1B7F900F91463 /* CommandInterpreter.h */,
26BC7F0810F1B8DD00F91463 /* CommandInterpreter.cpp */,
26BC7DE310F1B7F900F91463 /* CommandObject.h */,
@@ -2193,7 +2175,6 @@
9AA69DAF118A023300D753A0 /* SBInputReader.h in Headers */,
49F1A74A11B338AE003ED505 /* ClangExpressionDeclMap.h in Headers */,
49D7072711B5AD03001AD875 /* ClangASTSource.h in Headers */,
- 4CA9637C11B6E99A00780E28 /* CommandObjectApropos.h in Headers */,
261B5A5511C3F2AD00AABD0A /* SharingPtr.h in Headers */,
4C08CDEC11C81F1E001610A8 /* ThreadSpec.h in Headers */,
);
@@ -2462,7 +2443,6 @@
26D5B0C711B07550009A862E /* CFCMutableDictionary.cpp in Sources */,
26D5B0C811B07550009A862E /* CFCMutableSet.cpp in Sources */,
26D5B0C911B07550009A862E /* CFCString.cpp in Sources */,
- 26D5B0CA11B07550009A862E /* CommandContext.cpp in Sources */,
26D5B0CB11B07550009A862E /* CommandInterpreter.cpp in Sources */,
26D5B0CC11B07550009A862E /* CommandObject.cpp in Sources */,
26D5B0CD11B07550009A862E /* CommandReturnObject.cpp in Sources */,
Modified: lldb/trunk/source/API/SBAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBAddress.cpp (original)
+++ lldb/trunk/source/API/SBAddress.cpp Tue Jun 22 20:19:29 2010
@@ -15,22 +15,22 @@
SBAddress::SBAddress () :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
}
SBAddress::SBAddress (const lldb_private::Address *lldb_object_ptr) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (lldb_object_ptr)
- m_lldb_object_ap.reset (new lldb_private::Address(*lldb_object_ptr));
+ m_opaque_ap.reset (new lldb_private::Address(*lldb_object_ptr));
}
SBAddress::SBAddress (const SBAddress &rhs) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::Address(*rhs.m_lldb_object_ap.get()));
+ m_opaque_ap.reset (new lldb_private::Address(*rhs.m_opaque_ap.get()));
}
SBAddress::~SBAddress ()
@@ -43,7 +43,7 @@
if (this != &rhs)
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::Address(*rhs.m_lldb_object_ap.get()));
+ m_opaque_ap.reset (new lldb_private::Address(*rhs.m_opaque_ap.get()));
}
return *this;
}
@@ -51,7 +51,7 @@
bool
SBAddress::IsValid () const
{
- return m_lldb_object_ap.get() != NULL && m_lldb_object_ap->IsValid();
+ return m_opaque_ap.get() != NULL && m_opaque_ap->IsValid();
}
void
@@ -59,21 +59,21 @@
{
if (lldb_object_ptr)
{
- if (m_lldb_object_ap.get())
- *m_lldb_object_ap = *lldb_object_ptr;
+ if (m_opaque_ap.get())
+ *m_opaque_ap = *lldb_object_ptr;
else
- m_lldb_object_ap.reset (new lldb_private::Address(*lldb_object_ptr));
+ m_opaque_ap.reset (new lldb_private::Address(*lldb_object_ptr));
return;
}
- if (m_lldb_object_ap.get())
- m_lldb_object_ap->Clear();
+ if (m_opaque_ap.get())
+ m_opaque_ap->Clear();
}
lldb::addr_t
SBAddress::GetFileAddress () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->GetFileAddress();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetFileAddress();
else
return LLDB_INVALID_ADDRESS;
}
@@ -81,8 +81,8 @@
lldb::addr_t
SBAddress::GetLoadAddress (const SBProcess &process) const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->GetLoadAddress(process.get());
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetLoadAddress(process.get());
else
return LLDB_INVALID_ADDRESS;
}
@@ -90,12 +90,12 @@
bool
SBAddress::OffsetAddress (addr_t offset)
{
- if (m_lldb_object_ap.get())
+ if (m_opaque_ap.get())
{
- addr_t addr_offset = m_lldb_object_ap->GetOffset();
+ addr_t addr_offset = m_opaque_ap->GetOffset();
if (addr_offset != LLDB_INVALID_ADDRESS)
{
- m_lldb_object_ap->SetOffset(addr_offset + offset);
+ m_opaque_ap->SetOffset(addr_offset + offset);
return true;
}
}
@@ -106,13 +106,13 @@
const lldb_private::Address *
SBAddress::operator->() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
const lldb_private::Address &
SBAddress::operator*() const
{
- return *m_lldb_object_ap;
+ return *m_opaque_ap;
}
Modified: lldb/trunk/source/API/SBBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBlock.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBlock.cpp (original)
+++ lldb/trunk/source/API/SBBlock.cpp Tue Jun 22 20:19:29 2010
@@ -14,24 +14,24 @@
SBBlock::SBBlock () :
- m_lldb_object_ptr (NULL)
+ m_opaque_ptr (NULL)
{
}
SBBlock::SBBlock (lldb_private::Block *lldb_object_ptr) :
- m_lldb_object_ptr (lldb_object_ptr)
+ m_opaque_ptr (lldb_object_ptr)
{
}
SBBlock::~SBBlock ()
{
- m_lldb_object_ptr = NULL;
+ m_opaque_ptr = NULL;
}
bool
SBBlock::IsValid () const
{
- return m_lldb_object_ptr != NULL;
+ return m_opaque_ptr != NULL;
}
void
@@ -39,7 +39,7 @@
{
if (IsValid())
{
- m_lldb_object_ptr->AppendVariables (can_create, get_parent_variables, var_list);
+ m_opaque_ptr->AppendVariables (can_create, get_parent_variables, var_list);
}
}
Modified: lldb/trunk/source/API/SBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpoint.cpp (original)
+++ lldb/trunk/source/API/SBBreakpoint.cpp Tue Jun 22 20:19:29 2010
@@ -62,18 +62,18 @@
SBBreakpoint::SBBreakpoint () :
- m_break_sp ()
+ m_opaque_sp ()
{
}
SBBreakpoint::SBBreakpoint (const SBBreakpoint& rhs) :
- m_break_sp (rhs.m_break_sp)
+ m_opaque_sp (rhs.m_opaque_sp)
{
}
SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp) :
- m_break_sp (bp_sp)
+ m_opaque_sp (bp_sp)
{
}
@@ -86,7 +86,7 @@
{
if (this != &rhs)
{
- m_break_sp = rhs.m_break_sp;
+ m_opaque_sp = rhs.m_opaque_sp;
}
return *this;
}
@@ -94,8 +94,8 @@
break_id_t
SBBreakpoint::GetID () const
{
- if (m_break_sp)
- return m_break_sp->GetID();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetID();
return LLDB_INVALID_BREAK_ID;
}
@@ -103,28 +103,24 @@
bool
SBBreakpoint::IsValid() const
{
- return m_break_sp;
+ return m_opaque_sp;
}
void
SBBreakpoint::Dump (FILE *f)
{
- if (m_break_sp)
+ if (m_opaque_sp && f)
{
- if (f == NULL)
- f = SBDebugger::GetOutputFileHandle();
- if (f == NULL)
- return;
lldb_private::StreamFile str (f);
- m_break_sp->Dump (&str);
+ m_opaque_sp->Dump (&str);
}
}
void
SBBreakpoint::ClearAllBreakpointSites ()
{
- if (m_break_sp)
- m_break_sp->ClearAllBreakpointSites ();
+ if (m_opaque_sp)
+ m_opaque_sp->ClearAllBreakpointSites ();
}
SBBreakpointLocation
@@ -132,18 +128,18 @@
{
SBBreakpointLocation sb_bp_location;
- if (m_break_sp)
+ if (m_opaque_sp)
{
if (vm_addr != LLDB_INVALID_ADDRESS)
{
Address address;
- Process *sb_process = m_break_sp->GetTarget().GetProcessSP().get();
+ Process *sb_process = m_opaque_sp->GetTarget().GetProcessSP().get();
if (sb_process == NULL || sb_process->ResolveLoadAddress (vm_addr, address) == false)
{
address.SetSection (NULL);
address.SetOffset (vm_addr);
}
- sb_bp_location.SetLocation (m_break_sp->FindLocationByAddress (address));
+ sb_bp_location.SetLocation (m_opaque_sp->FindLocationByAddress (address));
}
}
return sb_bp_location;
@@ -154,18 +150,18 @@
{
break_id_t lldb_id = (break_id_t) 0;
- if (m_break_sp)
+ if (m_opaque_sp)
{
if (vm_addr != LLDB_INVALID_ADDRESS)
{
Address address;
- Process *sb_process = m_break_sp->GetTarget().GetProcessSP().get();
+ Process *sb_process = m_opaque_sp->GetTarget().GetProcessSP().get();
if (sb_process == NULL || sb_process->ResolveLoadAddress (vm_addr, address) == false)
{
address.SetSection (NULL);
address.SetOffset (vm_addr);
}
- lldb_id = m_break_sp->FindLocationIDByAddress (address);
+ lldb_id = m_opaque_sp->FindLocationIDByAddress (address);
}
}
@@ -177,8 +173,8 @@
{
SBBreakpointLocation sb_bp_location;
- if (m_break_sp)
- sb_bp_location.SetLocation (m_break_sp->FindLocationByID (bp_loc_id));
+ if (m_opaque_sp)
+ sb_bp_location.SetLocation (m_opaque_sp->FindLocationByID (bp_loc_id));
return sb_bp_location;
}
@@ -188,8 +184,8 @@
{
SBBreakpointLocation sb_bp_location;
- if (m_break_sp)
- sb_bp_location.SetLocation (m_break_sp->GetLocationAtIndex (index));
+ if (m_opaque_sp)
+ sb_bp_location.SetLocation (m_opaque_sp->GetLocationAtIndex (index));
return sb_bp_location;
}
@@ -197,13 +193,7 @@
void
SBBreakpoint::ListLocations (FILE* f, const char *description_level)
{
- if (f == NULL)
- f = SBDebugger::GetOutputFileHandle();
-
- if (f == NULL)
- return;
-
- if (m_break_sp)
+ if (m_opaque_sp && f)
{
DescriptionLevel level;
if (strcmp (description_level, "brief") == 0)
@@ -218,10 +208,10 @@
StreamFile str (f);
str.IndentMore();
- int num_locs = m_break_sp->GetNumLocations();
+ int num_locs = m_opaque_sp->GetNumLocations();
for (int i = 0; i < num_locs; ++i)
{
- BreakpointLocation *loc = m_break_sp->GetLocationAtIndex (i).get();
+ BreakpointLocation *loc = m_opaque_sp->GetLocationAtIndex (i).get();
loc->GetDescription (&str, level);
str.EOL();
}
@@ -231,15 +221,15 @@
void
SBBreakpoint::SetEnabled (bool enable)
{
- if (m_break_sp)
- m_break_sp->SetEnabled (enable);
+ if (m_opaque_sp)
+ m_opaque_sp->SetEnabled (enable);
}
bool
SBBreakpoint::IsEnabled ()
{
- if (m_break_sp)
- return m_break_sp->IsEnabled();
+ if (m_opaque_sp)
+ return m_opaque_sp->IsEnabled();
else
return false;
}
@@ -247,15 +237,15 @@
void
SBBreakpoint::SetIgnoreCount (int32_t count)
{
- if (m_break_sp)
- m_break_sp->SetIgnoreCount (count);
+ if (m_opaque_sp)
+ m_opaque_sp->SetIgnoreCount (count);
}
int32_t
SBBreakpoint::GetIgnoreCount () const
{
- if (m_break_sp)
- return m_break_sp->GetIgnoreCount();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetIgnoreCount();
else
return 0;
}
@@ -263,16 +253,16 @@
void
SBBreakpoint::SetThreadID (tid_t sb_thread_id)
{
- if (m_break_sp)
- m_break_sp->SetThreadID (sb_thread_id);
+ if (m_opaque_sp)
+ m_opaque_sp->SetThreadID (sb_thread_id);
}
tid_t
SBBreakpoint::GetThreadID ()
{
tid_t lldb_thread_id = LLDB_INVALID_THREAD_ID;
- if (m_break_sp)
- lldb_thread_id = m_break_sp->GetThreadID();
+ if (m_opaque_sp)
+ lldb_thread_id = m_opaque_sp->GetThreadID();
return lldb_thread_id;
}
@@ -280,16 +270,16 @@
void
SBBreakpoint::SetThreadIndex (uint32_t index)
{
- if (m_break_sp)
- m_break_sp->GetOptions()->GetThreadSpec()->SetIndex (index);
+ if (m_opaque_sp)
+ m_opaque_sp->GetOptions()->GetThreadSpec()->SetIndex (index);
}
uint32_t
SBBreakpoint::GetThreadIndex() const
{
- if (m_break_sp)
+ if (m_opaque_sp)
{
- const ThreadSpec *thread_spec = m_break_sp->GetOptions()->GetThreadSpec();
+ const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec();
if (thread_spec == NULL)
return 0;
else
@@ -302,16 +292,16 @@
void
SBBreakpoint::SetThreadName (const char *thread_name)
{
- if (m_break_sp)
- m_break_sp->GetOptions()->GetThreadSpec()->SetName (thread_name);
+ if (m_opaque_sp)
+ m_opaque_sp->GetOptions()->GetThreadSpec()->SetName (thread_name);
}
const char *
SBBreakpoint::GetThreadName () const
{
- if (m_break_sp)
+ if (m_opaque_sp)
{
- const ThreadSpec *thread_spec = m_break_sp->GetOptions()->GetThreadSpec();
+ const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec();
if (thread_spec == NULL)
return NULL;
else
@@ -323,16 +313,16 @@
void
SBBreakpoint::SetQueueName (const char *queue_name)
{
- if (m_break_sp)
- m_break_sp->GetOptions()->GetThreadSpec()->SetQueueName (queue_name);
+ if (m_opaque_sp)
+ m_opaque_sp->GetOptions()->GetThreadSpec()->SetQueueName (queue_name);
}
const char *
SBBreakpoint::GetQueueName () const
{
- if (m_break_sp)
+ if (m_opaque_sp)
{
- const ThreadSpec *thread_spec = m_break_sp->GetOptions()->GetThreadSpec();
+ const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec();
if (thread_spec == NULL)
return NULL;
else
@@ -344,8 +334,8 @@
size_t
SBBreakpoint::GetNumResolvedLocations() const
{
- if (m_break_sp)
- return m_break_sp->GetNumResolvedLocations();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetNumResolvedLocations();
else
return 0;
}
@@ -353,8 +343,8 @@
size_t
SBBreakpoint::GetNumLocations() const
{
- if (m_break_sp)
- return m_break_sp->GetNumLocations();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetNumLocations();
else
return 0;
}
@@ -365,7 +355,7 @@
if (f == NULL)
return;
- if (m_break_sp)
+ if (m_opaque_sp)
{
DescriptionLevel level;
if (strcmp (description_level, "brief") == 0)
@@ -379,15 +369,15 @@
StreamFile str (f);
- m_break_sp->GetDescription (&str, level);
+ m_opaque_sp->GetDescription (&str, level);
str.EOL();
if (describe_locations)
{
//str.IndentMore();
- // int num_locs = m_break_sp->GetNumLocations();
+ // int num_locs = m_opaque_sp->GetNumLocations();
// for (int i = 0; i < num_locs; ++i)
// {
- // BreakpointLocation *loc = m_break_sp->FindLocationByIndex (i);
+ // BreakpointLocation *loc = m_opaque_sp->FindLocationByIndex (i);
// loc->GetDescription (&str, level);
// str.EOL();
// }
@@ -405,22 +395,22 @@
lldb::user_id_t break_loc_id
)
{
- BreakpointSP bp_sp(ctx->context.target->GetBreakpointList().FindBreakpointByID(break_id));
+ BreakpointSP bp_sp(ctx->exe_ctx.target->GetBreakpointList().FindBreakpointByID(break_id));
if (baton && bp_sp)
{
CallbackData *data = (CallbackData *)baton;
lldb_private::Breakpoint *bp = bp_sp.get();
if (bp && data->callback)
{
- if (ctx->context.process)
+ if (ctx->exe_ctx.process)
{
- SBProcess sb_process (ctx->context.process->GetSP());
+ SBProcess sb_process (ctx->exe_ctx.process->GetSP());
SBThread sb_thread;
SBBreakpointLocation sb_location;
assert (bp_sp);
sb_location.SetLocation (bp_sp->FindLocationByID (break_loc_id));
- if (ctx->context.thread)
- sb_thread.SetThread(ctx->context.thread->GetSP());
+ if (ctx->exe_ctx.thread)
+ sb_thread.SetThread(ctx->exe_ctx.thread->GetSP());
return data->callback (data->callback_baton,
sb_process,
@@ -435,10 +425,10 @@
void
SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton)
{
- if (m_break_sp.get())
+ if (m_opaque_sp.get())
{
BatonSP baton_sp(new SBBreakpointCallbackBaton (callback, baton));
- m_break_sp->SetCallback (SBBreakpoint::PrivateBreakpointHitCallback, baton_sp, false);
+ m_opaque_sp->SetCallback (SBBreakpoint::PrivateBreakpointHitCallback, baton_sp, false);
}
}
@@ -446,24 +436,24 @@
lldb_private::Breakpoint *
SBBreakpoint::operator->() const
{
- return m_break_sp.get();
+ return m_opaque_sp.get();
}
lldb_private::Breakpoint *
SBBreakpoint::get() const
{
- return m_break_sp.get();
+ return m_opaque_sp.get();
}
lldb::BreakpointSP &
SBBreakpoint::operator *()
{
- return m_break_sp;
+ return m_opaque_sp;
}
const lldb::BreakpointSP &
SBBreakpoint::operator *() const
{
- return m_break_sp;
+ return m_opaque_sp;
}
Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpointLocation.cpp (original)
+++ lldb/trunk/source/API/SBBreakpointLocation.cpp Tue Jun 22 20:19:29 2010
@@ -31,7 +31,7 @@
}
SBBreakpointLocation::SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp) :
- m_break_loc_sp (break_loc_sp)
+ m_opaque_sp (break_loc_sp)
{
}
@@ -42,7 +42,7 @@
bool
SBBreakpointLocation::IsValid() const
{
- return m_break_loc_sp.get() != NULL;
+ return m_opaque_sp.get() != NULL;
}
addr_t
@@ -50,9 +50,9 @@
{
addr_t ret_addr = LLDB_INVALID_ADDRESS;
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
- ret_addr = m_break_loc_sp->GetLoadAddress();
+ ret_addr = m_opaque_sp->GetLoadAddress();
}
return ret_addr;
@@ -61,17 +61,17 @@
void
SBBreakpointLocation::SetEnabled (bool enabled)
{
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
- m_break_loc_sp->SetEnabled (enabled);
+ m_opaque_sp->SetEnabled (enabled);
}
}
bool
SBBreakpointLocation::IsEnabled ()
{
- if (m_break_loc_sp)
- return m_break_loc_sp->IsEnabled();
+ if (m_opaque_sp)
+ return m_opaque_sp->IsEnabled();
else
return false;
}
@@ -79,8 +79,8 @@
int32_t
SBBreakpointLocation::GetIgnoreCount ()
{
- if (m_break_loc_sp)
- return m_break_loc_sp->GetIgnoreCount();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetIgnoreCount();
else
return 0;
}
@@ -88,40 +88,39 @@
void
SBBreakpointLocation::SetIgnoreCount (int32_t n)
{
- if (m_break_loc_sp)
- m_break_loc_sp->SetIgnoreCount (n);
+ if (m_opaque_sp)
+ m_opaque_sp->SetIgnoreCount (n);
}
void
SBBreakpointLocation::SetThreadID (tid_t thread_id)
{
- if (m_break_loc_sp)
- m_break_loc_sp->SetThreadID (thread_id);
+ if (m_opaque_sp)
+ m_opaque_sp->SetThreadID (thread_id);
}
tid_t
SBBreakpointLocation::GetThreadID ()
{
tid_t sb_thread_id = (lldb::tid_t) LLDB_INVALID_THREAD_ID;
- if (m_break_loc_sp)
- sb_thread_id = m_break_loc_sp->GetLocationOptions()->GetThreadSpecNoCreate()->GetTID();
-
+ if (m_opaque_sp)
+ sb_thread_id = m_opaque_sp->GetLocationOptions()->GetThreadSpecNoCreate()->GetTID();
return sb_thread_id;
}
void
SBBreakpointLocation::SetThreadIndex (uint32_t index)
{
- if (m_break_loc_sp)
- m_break_loc_sp->GetLocationOptions()->GetThreadSpec()->SetIndex (index);
+ if (m_opaque_sp)
+ m_opaque_sp->GetLocationOptions()->GetThreadSpec()->SetIndex (index);
}
uint32_t
SBBreakpointLocation::GetThreadIndex() const
{
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
- const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
+ const ThreadSpec *thread_spec = m_opaque_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
if (thread_spec == NULL)
return 0;
else
@@ -134,16 +133,16 @@
void
SBBreakpointLocation::SetThreadName (const char *thread_name)
{
- if (m_break_loc_sp)
- m_break_loc_sp->GetLocationOptions()->GetThreadSpec()->SetName (thread_name);
+ if (m_opaque_sp)
+ m_opaque_sp->GetLocationOptions()->GetThreadSpec()->SetName (thread_name);
}
const char *
SBBreakpointLocation::GetThreadName () const
{
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
- const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
+ const ThreadSpec *thread_spec = m_opaque_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
if (thread_spec == NULL)
return NULL;
else
@@ -155,16 +154,16 @@
void
SBBreakpointLocation::SetQueueName (const char *queue_name)
{
- if (m_break_loc_sp)
- m_break_loc_sp->GetLocationOptions()->GetThreadSpec()->SetQueueName (queue_name);
+ if (m_opaque_sp)
+ m_opaque_sp->GetLocationOptions()->GetThreadSpec()->SetQueueName (queue_name);
}
const char *
SBBreakpointLocation::GetQueueName () const
{
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
- const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
+ const ThreadSpec *thread_spec = m_opaque_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
if (thread_spec == NULL)
return NULL;
else
@@ -176,8 +175,8 @@
bool
SBBreakpointLocation::IsResolved ()
{
- if (m_break_loc_sp)
- return m_break_loc_sp->IsResolved();
+ if (m_opaque_sp)
+ return m_opaque_sp->IsResolved();
else
return false;
}
@@ -185,11 +184,11 @@
void
SBBreakpointLocation::SetLocation (const lldb::BreakpointLocationSP &break_loc_sp)
{
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
// Uninstall the callbacks?
}
- m_break_loc_sp = break_loc_sp;
+ m_opaque_sp = break_loc_sp;
}
void
@@ -198,7 +197,7 @@
if (f == NULL)
return;
- if (m_break_loc_sp)
+ if (m_opaque_sp)
{
DescriptionLevel level;
if (strcmp (description_level, "brief") == 0)
@@ -212,7 +211,7 @@
StreamFile str (f);
- m_break_loc_sp->GetDescription (&str, level);
+ m_opaque_sp->GetDescription (&str, level);
str.EOL();
}
}
@@ -221,8 +220,8 @@
SBBreakpointLocation::GetBreakpoint ()
{
SBBreakpoint sb_bp;
- if (m_break_loc_sp)
- *sb_bp = m_break_loc_sp->GetBreakpoint ().GetSP();
+ if (m_opaque_sp)
+ *sb_bp = m_opaque_sp->GetBreakpoint ().GetSP();
return sb_bp;
}
Modified: lldb/trunk/source/API/SBBroadcaster.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBroadcaster.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBroadcaster.cpp (original)
+++ lldb/trunk/source/API/SBBroadcaster.cpp Tue Jun 22 20:19:29 2010
@@ -19,124 +19,124 @@
SBBroadcaster::SBBroadcaster () :
- m_lldb_object (NULL),
- m_lldb_object_owned (false)
+ m_opaque (NULL),
+ m_opaque_owned (false)
{
}
SBBroadcaster::SBBroadcaster (const char *name) :
- m_lldb_object (new Broadcaster (name)),
- m_lldb_object_owned (true)
+ m_opaque (new Broadcaster (name)),
+ m_opaque_owned (true)
{
}
SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns) :
- m_lldb_object (broadcaster),
- m_lldb_object_owned (owns)
+ m_opaque (broadcaster),
+ m_opaque_owned (owns)
{
}
SBBroadcaster::~SBBroadcaster()
{
- SetLLDBObjectPtr (NULL, false);
+ reset (NULL, false);
}
void
SBBroadcaster::BroadcastEventByType (uint32_t event_type, bool unique)
{
- if (m_lldb_object == NULL)
+ if (m_opaque == NULL)
return;
if (unique)
- m_lldb_object->BroadcastEventIfUnique (event_type);
+ m_opaque->BroadcastEventIfUnique (event_type);
else
- m_lldb_object->BroadcastEvent (event_type);
+ m_opaque->BroadcastEvent (event_type);
}
void
SBBroadcaster::BroadcastEvent (const SBEvent &event, bool unique)
{
- if (m_lldb_object == NULL)
+ if (m_opaque == NULL)
return;
- EventSP event_sp = event.GetSharedPtr ();
+ EventSP event_sp = event.GetSP ();
if (unique)
- m_lldb_object->BroadcastEventIfUnique (event_sp);
+ m_opaque->BroadcastEventIfUnique (event_sp);
else
- m_lldb_object->BroadcastEvent (event_sp);
+ m_opaque->BroadcastEvent (event_sp);
}
void
SBBroadcaster::AddInitialEventsToListener (const SBListener &listener, uint32_t requested_events)
{
- if (m_lldb_object)
- m_lldb_object->AddInitialEventsToListener (listener.get(), requested_events);
+ if (m_opaque)
+ m_opaque->AddInitialEventsToListener (listener.get(), requested_events);
}
uint32_t
SBBroadcaster::AddListener (const SBListener &listener, uint32_t event_mask)
{
- if (m_lldb_object)
- return m_lldb_object->AddListener (listener.get(), event_mask);
+ if (m_opaque)
+ return m_opaque->AddListener (listener.get(), event_mask);
return 0;
}
const char *
SBBroadcaster::GetName ()
{
- if (m_lldb_object)
- return m_lldb_object->GetBroadcasterName().AsCString();
+ if (m_opaque)
+ return m_opaque->GetBroadcasterName().AsCString();
return NULL;
}
bool
SBBroadcaster::EventTypeHasListeners (uint32_t event_type)
{
- if (m_lldb_object)
- return m_lldb_object->EventTypeHasListeners (event_type);
+ if (m_opaque)
+ return m_opaque->EventTypeHasListeners (event_type);
return false;
}
bool
SBBroadcaster::RemoveListener (const SBListener &listener, uint32_t event_mask)
{
- if (m_lldb_object)
- return m_lldb_object->RemoveListener (listener.get(), event_mask);
+ if (m_opaque)
+ return m_opaque->RemoveListener (listener.get(), event_mask);
return false;
}
Broadcaster *
-SBBroadcaster::GetLLDBObjectPtr () const
+SBBroadcaster::get () const
{
- return m_lldb_object;
+ return m_opaque;
}
void
-SBBroadcaster::SetLLDBObjectPtr (Broadcaster *broadcaster, bool owns)
+SBBroadcaster::reset (Broadcaster *broadcaster, bool owns)
{
- if (m_lldb_object && m_lldb_object_owned)
- delete m_lldb_object;
- m_lldb_object = broadcaster;
- m_lldb_object_owned = owns;
+ if (m_opaque && m_opaque_owned)
+ delete m_opaque;
+ m_opaque = broadcaster;
+ m_opaque_owned = owns;
}
bool
SBBroadcaster::IsValid () const
{
- return m_lldb_object != NULL;
+ return m_opaque != NULL;
}
bool
SBBroadcaster::operator == (const SBBroadcaster &rhs) const
{
- return m_lldb_object == rhs.m_lldb_object;
+ return m_opaque == rhs.m_opaque;
}
bool
SBBroadcaster::operator != (const SBBroadcaster &rhs) const
{
- return m_lldb_object != rhs.m_lldb_object;
+ return m_opaque != rhs.m_opaque;
}
Modified: lldb/trunk/source/API/SBCommandContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandContext.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandContext.cpp (original)
+++ lldb/trunk/source/API/SBCommandContext.cpp Tue Jun 22 20:19:29 2010
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/Interpreter/CommandContext.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/API/SBCommandContext.h"
@@ -17,8 +17,8 @@
using namespace lldb_private;
-SBCommandContext::SBCommandContext (CommandContext *lldb_object) :
- m_lldb_object (lldb_object)
+SBCommandContext::SBCommandContext (Debugger *lldb_object) :
+ m_opaque (lldb_object)
{
}
@@ -29,6 +29,6 @@
bool
SBCommandContext::IsValid () const
{
- return m_lldb_object != NULL;
+ return m_opaque != NULL;
}
Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp Tue Jun 22 20:19:29 2010
@@ -30,8 +30,8 @@
using namespace lldb_private;
-SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter &interpreter) :
- m_interpreter (interpreter)
+SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) :
+ m_opaque_ptr (interpreter)
{
}
@@ -40,28 +40,49 @@
}
bool
+SBCommandInterpreter::IsValid() const
+{
+ return m_opaque_ptr != NULL;
+}
+
+
+bool
SBCommandInterpreter::CommandExists (const char *cmd)
{
- return m_interpreter.CommandExists (cmd);
+ if (m_opaque_ptr)
+ return m_opaque_ptr->CommandExists (cmd);
+ return false;
}
bool
SBCommandInterpreter::AliasExists (const char *cmd)
{
- return m_interpreter.AliasExists (cmd);
+ if (m_opaque_ptr)
+ return m_opaque_ptr->AliasExists (cmd);
+ return false;
}
bool
SBCommandInterpreter::UserCommandExists (const char *cmd)
{
- return m_interpreter.UserCommandExists (cmd);
+ if (m_opaque_ptr)
+ return m_opaque_ptr->UserCommandExists (cmd);
+ return false;
}
lldb::ReturnStatus
SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnObject &result, bool add_to_history)
{
result.Clear();
- m_interpreter.HandleCommand (command_line, add_to_history, result.GetLLDBObjectRef());
+ if (m_opaque_ptr)
+ {
+ m_opaque_ptr->HandleCommand (command_line, add_to_history, result.ref());
+ }
+ else
+ {
+ result->AppendError ("SBCommandInterpreter is not valid");
+ result->SetStatus (eReturnStatusFailed);
+ }
return result.GetStatus();
}
@@ -73,64 +94,79 @@
int max_return_elements,
SBStringList &matches)
{
- int num_completions;
- lldb_private::StringList lldb_matches;
- num_completions = m_interpreter.HandleCompletion (current_line, cursor, last_char, match_start_point,
- max_return_elements, lldb_matches);
-
- SBStringList temp_list (&lldb_matches);
- matches.AppendList (temp_list);
+ int num_completions = 0;
+ if (m_opaque_ptr)
+ {
+ lldb_private::StringList lldb_matches;
+ num_completions = m_opaque_ptr->HandleCompletion (current_line, cursor, last_char, match_start_point,
+ max_return_elements, lldb_matches);
+ SBStringList temp_list (&lldb_matches);
+ matches.AppendList (temp_list);
+ }
return num_completions;
}
const char **
SBCommandInterpreter::GetEnvironmentVariables ()
{
- const Args *env_vars = m_interpreter.GetEnvironmentVariables();
- if (env_vars)
- return env_vars->GetConstArgumentVector ();
+ if (m_opaque_ptr)
+ {
+ const Args *env_vars = m_opaque_ptr->GetEnvironmentVariables();
+ if (env_vars)
+ return env_vars->GetConstArgumentVector ();
+ }
return NULL;
}
bool
SBCommandInterpreter::HasCommands ()
{
- return m_interpreter.HasCommands();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->HasCommands();
+ return false;
}
bool
SBCommandInterpreter::HasAliases ()
{
- return m_interpreter.HasAliases();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->HasAliases();
+ return false;
}
bool
SBCommandInterpreter::HasUserCommands ()
{
- return m_interpreter.HasUserCommands ();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->HasUserCommands ();
+ return false;
}
bool
SBCommandInterpreter::HasAliasOptions ()
{
- return m_interpreter.HasAliasOptions ();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->HasAliasOptions ();
+ return false;
}
bool
SBCommandInterpreter::HasInterpreterVariables ()
{
- return m_interpreter.HasInterpreterVariables ();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->HasInterpreterVariables ();
+ return false;
}
SBProcess
SBCommandInterpreter::GetProcess ()
{
SBProcess process;
- CommandContext *context = m_interpreter.Context();
- if (context)
+ if (m_opaque_ptr)
{
- Target *target = context->GetTarget();
+ Debugger &debugger = m_opaque_ptr->GetDebugger();
+ Target *target = debugger.GetCurrentTarget().get();
if (target)
process.SetProcess(target->GetProcessSP());
}
@@ -140,7 +176,7 @@
ssize_t
SBCommandInterpreter::WriteToScriptInterpreter (const char *src)
{
- if (src)
+ if (m_opaque_ptr && src && src[0])
return WriteToScriptInterpreter (src, strlen(src));
return 0;
}
@@ -148,9 +184,9 @@
ssize_t
SBCommandInterpreter::WriteToScriptInterpreter (const char *src, size_t src_len)
{
- if (src && src[0])
+ if (m_opaque_ptr && src && src[0])
{
- ScriptInterpreter *script_interpreter = m_interpreter.GetScriptInterpreter();
+ ScriptInterpreter *script_interpreter = m_opaque_ptr->GetScriptInterpreter();
if (script_interpreter)
return ::write (script_interpreter->GetMasterFileDescriptor(), src, src_len);
}
@@ -159,35 +195,58 @@
CommandInterpreter *
-SBCommandInterpreter::GetLLDBObjectPtr ()
+SBCommandInterpreter::get ()
{
- return &m_interpreter;
+ return m_opaque_ptr;
}
CommandInterpreter &
-SBCommandInterpreter::GetLLDBObjectRef ()
+SBCommandInterpreter::ref ()
{
- return m_interpreter;
+ assert (m_opaque_ptr);
+ return *m_opaque_ptr;
+}
+
+void
+SBCommandInterpreter::reset (lldb_private::CommandInterpreter *interpreter)
+{
+ m_opaque_ptr = interpreter;
}
void
SBCommandInterpreter::SourceInitFileInHomeDirectory (SBCommandReturnObject &result)
{
result.Clear();
- m_interpreter.SourceInitFile (false, result.GetLLDBObjectRef());
+ if (m_opaque_ptr)
+ {
+ m_opaque_ptr->SourceInitFile (false, result.ref());
+ }
+ else
+ {
+ result->AppendError ("SBCommandInterpreter is not valid");
+ result->SetStatus (eReturnStatusFailed);
+ }
}
void
SBCommandInterpreter::SourceInitFileInCurrentWorkingDirectory (SBCommandReturnObject &result)
{
result.Clear();
- m_interpreter.SourceInitFile (true, result.GetLLDBObjectRef());
+ if (m_opaque_ptr)
+ {
+ m_opaque_ptr->SourceInitFile (true, result.ref());
+ }
+ else
+ {
+ result->AppendError ("SBCommandInterpreter is not valid");
+ result->SetStatus (eReturnStatusFailed);
+ }
}
SBBroadcaster
SBCommandInterpreter::GetBroadcaster ()
{
- SBBroadcaster broadcaster (&m_interpreter, false);
+ SBBroadcaster broadcaster (m_opaque_ptr, false);
return broadcaster;
}
Modified: lldb/trunk/source/API/SBCommandReturnObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandReturnObject.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandReturnObject.cpp (original)
+++ lldb/trunk/source/API/SBCommandReturnObject.cpp Tue Jun 22 20:19:29 2010
@@ -12,53 +12,54 @@
#include "lldb/API/SBCommandReturnObject.h"
using namespace lldb;
+using namespace lldb_private;
SBCommandReturnObject::SBCommandReturnObject () :
- m_return_object_ap (new lldb_private::CommandReturnObject ())
+ m_opaque_ap (new CommandReturnObject ())
{
}
SBCommandReturnObject::~SBCommandReturnObject ()
{
- // m_return_object_ap will automatically delete any pointer it owns
+ // m_opaque_ap will automatically delete any pointer it owns
}
bool
SBCommandReturnObject::IsValid() const
{
- return m_return_object_ap.get() != NULL;
+ return m_opaque_ap.get() != NULL;
}
const char *
SBCommandReturnObject::GetOutput ()
{
- if (m_return_object_ap.get())
- return m_return_object_ap->GetOutputStream().GetData();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetOutputStream().GetData();
return NULL;
}
const char *
SBCommandReturnObject::GetError ()
{
- if (m_return_object_ap.get())
- return m_return_object_ap->GetErrorStream().GetData();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetErrorStream().GetData();
return NULL;
}
size_t
SBCommandReturnObject::GetOutputSize ()
{
- if (m_return_object_ap.get())
- return m_return_object_ap->GetOutputStream().GetSize();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetOutputStream().GetSize();
return 0;
}
size_t
SBCommandReturnObject::GetErrorSize ()
{
- if (m_return_object_ap.get())
- return m_return_object_ap->GetErrorStream().GetSize();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetErrorStream().GetSize();
return 0;
}
@@ -89,60 +90,73 @@
void
SBCommandReturnObject::Clear()
{
- if (m_return_object_ap.get())
- m_return_object_ap->Clear();
+ if (m_opaque_ap.get())
+ m_opaque_ap->Clear();
}
lldb::ReturnStatus
SBCommandReturnObject::GetStatus()
{
- if (m_return_object_ap.get())
- return m_return_object_ap->GetStatus();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetStatus();
return lldb::eReturnStatusInvalid;
}
bool
SBCommandReturnObject::Succeeded ()
{
- if (m_return_object_ap.get())
- return m_return_object_ap->Succeeded();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->Succeeded();
return false;
}
bool
SBCommandReturnObject::HasResult ()
{
- if (m_return_object_ap.get())
- return m_return_object_ap->HasResult();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->HasResult();
return false;
}
void
SBCommandReturnObject::AppendMessage (const char *message)
{
- if (m_return_object_ap.get())
- m_return_object_ap->AppendMessage (message);
+ if (m_opaque_ap.get())
+ m_opaque_ap->AppendMessage (message);
}
-lldb_private::CommandReturnObject *
-SBCommandReturnObject::GetLLDBObjectPtr()
+CommandReturnObject *
+SBCommandReturnObject::operator ->() const
{
- return m_return_object_ap.get();
+ return m_opaque_ap.get();
+}
+
+CommandReturnObject *
+SBCommandReturnObject::get() const
+{
+ return m_opaque_ap.get();
+}
+
+CommandReturnObject &
+SBCommandReturnObject::operator *() const
+{
+ assert(m_opaque_ap.get());
+ return *(m_opaque_ap.get());
}
-lldb_private::CommandReturnObject &
-SBCommandReturnObject::GetLLDBObjectRef()
+CommandReturnObject &
+SBCommandReturnObject::ref() const
{
- assert(m_return_object_ap.get());
- return *(m_return_object_ap.get());
+ assert(m_opaque_ap.get());
+ return *(m_opaque_ap.get());
}
void
-SBCommandReturnObject::SetLLDBObjectPtr (lldb_private::CommandReturnObject *ptr)
+SBCommandReturnObject::SetLLDBObjectPtr (CommandReturnObject *ptr)
{
- if (m_return_object_ap.get())
- m_return_object_ap.reset (ptr);
+ if (m_opaque_ap.get())
+ m_opaque_ap.reset (ptr);
}
Modified: lldb/trunk/source/API/SBCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommunication.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommunication.cpp (original)
+++ lldb/trunk/source/API/SBCommunication.cpp Tue Jun 22 20:19:29 2010
@@ -18,57 +18,57 @@
SBCommunication::SBCommunication() :
- m_lldb_object (NULL),
- m_lldb_object_owned (false)
+ m_opaque (NULL),
+ m_opaque_owned (false)
{
}
SBCommunication::SBCommunication(const char * broadcaster_name) :
- m_lldb_object (new Communication (broadcaster_name)),
- m_lldb_object_owned (true)
+ m_opaque (new Communication (broadcaster_name)),
+ m_opaque_owned (true)
{
}
SBCommunication::~SBCommunication()
{
- if (m_lldb_object && m_lldb_object_owned)
- delete m_lldb_object;
- m_lldb_object = NULL;
- m_lldb_object_owned = false;
+ if (m_opaque && m_opaque_owned)
+ delete m_opaque;
+ m_opaque = NULL;
+ m_opaque_owned = false;
}
ConnectionStatus
SBCommunication::CheckIfBytesAvailable ()
{
- if (m_lldb_object)
- return m_lldb_object->BytesAvailable (0, NULL);
+ if (m_opaque)
+ return m_opaque->BytesAvailable (0, NULL);
return eConnectionStatusNoConnection;
}
ConnectionStatus
SBCommunication::WaitForBytesAvailableInfinite ()
{
- if (m_lldb_object)
- return m_lldb_object->BytesAvailable (UINT32_MAX, NULL);
+ if (m_opaque)
+ return m_opaque->BytesAvailable (UINT32_MAX, NULL);
return eConnectionStatusNoConnection;
}
ConnectionStatus
SBCommunication::WaitForBytesAvailableWithTimeout (uint32_t timeout_usec)
{
- if (m_lldb_object)
- return m_lldb_object->BytesAvailable (timeout_usec, NULL);
+ if (m_opaque)
+ return m_opaque->BytesAvailable (timeout_usec, NULL);
return eConnectionStatusNoConnection;
}
ConnectionStatus
SBCommunication::Connect (const char *url)
{
- if (m_lldb_object)
+ if (m_opaque)
{
- if (!m_lldb_object->HasConnection ())
- m_lldb_object->SetConnection (new ConnectionFileDescriptor());
- return m_lldb_object->Connect (url, NULL);
+ if (!m_opaque->HasConnection ())
+ m_opaque->SetConnection (new ConnectionFileDescriptor());
+ return m_opaque->Connect (url, NULL);
}
return eConnectionStatusNoConnection;
}
@@ -76,15 +76,15 @@
ConnectionStatus
SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd)
{
- if (m_lldb_object)
+ if (m_opaque)
{
- if (m_lldb_object->HasConnection ())
+ if (m_opaque->HasConnection ())
{
- if (m_lldb_object->IsConnected())
- m_lldb_object->Disconnect ();
+ if (m_opaque->IsConnected())
+ m_opaque->Disconnect ();
}
- m_lldb_object->SetConnection (new ConnectionFileDescriptor (fd, owns_fd));
- if (m_lldb_object->IsConnected())
+ m_opaque->SetConnection (new ConnectionFileDescriptor (fd, owns_fd));
+ if (m_opaque->IsConnected())
return eConnectionStatusSuccess;
else
return eConnectionStatusLostConnection;
@@ -96,24 +96,24 @@
ConnectionStatus
SBCommunication::Disconnect ()
{
- if (m_lldb_object)
- return m_lldb_object->Disconnect ();
+ if (m_opaque)
+ return m_opaque->Disconnect ();
return eConnectionStatusNoConnection;
}
bool
SBCommunication::IsConnected () const
{
- if (m_lldb_object)
- return m_lldb_object->IsConnected ();
+ if (m_opaque)
+ return m_opaque->IsConnected ();
return false;
}
size_t
SBCommunication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, ConnectionStatus &status)
{
- if (m_lldb_object)
- return m_lldb_object->Read (dst, dst_len, timeout_usec, status, NULL);
+ if (m_opaque)
+ return m_opaque->Read (dst, dst_len, timeout_usec, status, NULL);
status = eConnectionStatusNoConnection;
return 0;
}
@@ -122,8 +122,8 @@
size_t
SBCommunication::Write (const void *src, size_t src_len, ConnectionStatus &status)
{
- if (m_lldb_object)
- return m_lldb_object->Write (src, src_len, status, NULL);
+ if (m_opaque)
+ return m_opaque->Write (src, src_len, status, NULL);
status = eConnectionStatusNoConnection;
return 0;
}
@@ -131,8 +131,8 @@
bool
SBCommunication::ReadThreadStart ()
{
- if (m_lldb_object)
- return m_lldb_object->StartReadThread ();
+ if (m_opaque)
+ return m_opaque->StartReadThread ();
return false;
}
@@ -140,16 +140,16 @@
bool
SBCommunication::ReadThreadStop ()
{
- if (m_lldb_object)
- return m_lldb_object->StopReadThread ();
+ if (m_opaque)
+ return m_opaque->StopReadThread ();
return false;
}
bool
SBCommunication::ReadThreadIsRunning ()
{
- if (m_lldb_object)
- return m_lldb_object->ReadThreadIsRunning ();
+ if (m_opaque)
+ return m_opaque->ReadThreadIsRunning ();
return false;
}
@@ -160,9 +160,9 @@
void *callback_baton
)
{
- if (m_lldb_object)
+ if (m_opaque)
{
- m_lldb_object->SetReadThreadBytesReceivedCallback (callback, callback_baton);
+ m_opaque->SetReadThreadBytesReceivedCallback (callback, callback_baton);
return true;
}
return false;
@@ -171,7 +171,7 @@
SBBroadcaster
SBCommunication::GetBroadcaster ()
{
- SBBroadcaster broadcaster (m_lldb_object, false);
+ SBBroadcaster broadcaster (m_opaque, false);
return broadcaster;
}
@@ -180,15 +180,15 @@
//void
//SBCommunication::CreateIfNeeded ()
//{
-// if (m_lldb_object == NULL)
+// if (m_opaque == NULL)
// {
// static uint32_t g_broadcaster_num;
// char broadcaster_name[256];
// ::snprintf (name, broadcaster_name, "%p SBCommunication", this);
-// m_lldb_object = new Communication (broadcaster_name);
-// m_lldb_object_owned = true;
+// m_opaque = new Communication (broadcaster_name);
+// m_opaque_owned = true;
// }
-// assert (m_lldb_object);
+// assert (m_opaque);
//}
//
//
Modified: lldb/trunk/source/API/SBCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCompileUnit.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCompileUnit.cpp (original)
+++ lldb/trunk/source/API/SBCompileUnit.cpp Tue Jun 22 20:19:29 2010
@@ -18,35 +18,35 @@
SBCompileUnit::SBCompileUnit () :
- m_lldb_object_ptr (NULL)
+ m_opaque_ptr (NULL)
{
}
SBCompileUnit::SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr) :
- m_lldb_object_ptr (lldb_object_ptr)
+ m_opaque_ptr (lldb_object_ptr)
{
}
SBCompileUnit::~SBCompileUnit ()
{
- m_lldb_object_ptr = NULL;
+ m_opaque_ptr = NULL;
}
SBFileSpec
SBCompileUnit::GetFileSpec () const
{
SBFileSpec file_spec;
- if (m_lldb_object_ptr)
- file_spec.SetFileSpec(*m_lldb_object_ptr);
+ if (m_opaque_ptr)
+ file_spec.SetFileSpec(*m_opaque_ptr);
return file_spec;
}
uint32_t
SBCompileUnit::GetNumLineEntries () const
{
- if (m_lldb_object_ptr)
+ if (m_opaque_ptr)
{
- LineTable *line_table = m_lldb_object_ptr->GetLineTable ();
+ LineTable *line_table = m_opaque_ptr->GetLineTable ();
if (line_table)
return line_table->GetSize();
}
@@ -57,9 +57,9 @@
SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const
{
SBLineEntry sb_line_entry;
- if (m_lldb_object_ptr)
+ if (m_opaque_ptr)
{
- LineTable *line_table = m_lldb_object_ptr->GetLineTable ();
+ LineTable *line_table = m_opaque_ptr->GetLineTable ();
if (line_table)
{
LineEntry line_entry;
@@ -73,15 +73,15 @@
uint32_t
SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec *inline_file_spec) const
{
- if (m_lldb_object_ptr)
+ if (m_opaque_ptr)
{
FileSpec file_spec;
if (inline_file_spec && inline_file_spec->IsValid())
file_spec = inline_file_spec->ref();
else
- file_spec = *m_lldb_object_ptr;
+ file_spec = *m_opaque_ptr;
- return m_lldb_object_ptr->FindLineEntry (start_idx,
+ return m_opaque_ptr->FindLineEntry (start_idx,
line,
inline_file_spec ? inline_file_spec->get() : NULL,
NULL);
@@ -92,29 +92,29 @@
bool
SBCompileUnit::IsValid () const
{
- return m_lldb_object_ptr != NULL;
+ return m_opaque_ptr != NULL;
}
bool
SBCompileUnit::operator == (const SBCompileUnit &rhs) const
{
- return m_lldb_object_ptr == rhs.m_lldb_object_ptr;
+ return m_opaque_ptr == rhs.m_opaque_ptr;
}
bool
SBCompileUnit::operator != (const SBCompileUnit &rhs) const
{
- return m_lldb_object_ptr != rhs.m_lldb_object_ptr;
+ return m_opaque_ptr != rhs.m_opaque_ptr;
}
const lldb_private::CompileUnit *
SBCompileUnit::operator->() const
{
- return m_lldb_object_ptr;
+ return m_opaque_ptr;
}
const lldb_private::CompileUnit &
SBCompileUnit::operator*() const
{
- return *m_lldb_object_ptr;
+ return *m_opaque_ptr;
}
Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Tue Jun 22 20:19:29 2010
@@ -43,112 +43,121 @@
Debugger::Terminate();
}
-void
-SBDebugger::SetAsync (bool b)
+SBDebugger
+SBDebugger::Create()
{
- static bool value_set_once = false;
+ SBDebugger debugger;
+ debugger.reset(Debugger::CreateInstance());
+ return debugger;
+}
- if (!value_set_once)
- {
- value_set_once = true;
- Debugger::GetSharedInstance().SetAsyncExecution(b);
- }
+
+SBDebugger::SBDebugger () :
+ m_opaque_sp ()
+{
}
-void
-SBDebugger::SetInputFile (const char *tty_name)
+SBDebugger::~SBDebugger ()
{
- // DEPRECATED: will be removed in next submission
- FILE *fh = ::fopen (tty_name, "r");
- SetInputFileHandle (fh, true);
}
-void
-SBDebugger::SetOutputFile (const char *tty_name)
+bool
+SBDebugger::IsValid() const
{
- // DEPRECATED: will be removed in next submission
- FILE *fh = ::fopen (tty_name, "w");
- SetOutputFileHandle (fh, true);
- SetErrorFileHandle (fh, false);
+ return m_opaque_sp.get() != NULL;
}
+
void
-SBDebugger::SetErrorFile (const char *tty_name)
+SBDebugger::SetAsync (bool b)
{
- // DEPRECATED: will be removed in next submission
+ if (m_opaque_sp)
+ m_opaque_sp->SetAsyncExecution(b);
}
-
// Shouldn't really be settable after initialization as this could cause lots of problems; don't want users
// trying to switch modes in the middle of a debugging session.
void
SBDebugger::SetInputFileHandle (FILE *fh, bool transfer_ownership)
{
- Debugger::GetSharedInstance().SetInputFileHandle (fh, transfer_ownership);
+ if (m_opaque_sp)
+ m_opaque_sp->SetInputFileHandle (fh, transfer_ownership);
}
void
SBDebugger::SetOutputFileHandle (FILE *fh, bool transfer_ownership)
{
- Debugger::GetSharedInstance().SetOutputFileHandle (fh, transfer_ownership);
+ if (m_opaque_sp)
+ m_opaque_sp->SetOutputFileHandle (fh, transfer_ownership);
}
void
SBDebugger::SetErrorFileHandle (FILE *fh, bool transfer_ownership)
{
- Debugger::GetSharedInstance().SetErrorFileHandle (fh, transfer_ownership);
+ if (m_opaque_sp)
+ m_opaque_sp->SetErrorFileHandle (fh, transfer_ownership);
}
FILE *
SBDebugger::GetInputFileHandle ()
{
- return Debugger::GetSharedInstance().GetInputFileHandle();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetInputFileHandle();
+ return NULL;
}
FILE *
SBDebugger::GetOutputFileHandle ()
{
- return Debugger::GetSharedInstance().GetOutputFileHandle();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetOutputFileHandle();
+ return NULL;
}
FILE *
SBDebugger::GetErrorFileHandle ()
{
- return Debugger::GetSharedInstance().GetErrorFileHandle();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetErrorFileHandle();
+ return NULL;
}
SBCommandInterpreter
SBDebugger::GetCommandInterpreter ()
{
- SBCommandInterpreter sb_interpreter(Debugger::GetSharedInstance().GetCommandInterpreter());
+ SBCommandInterpreter sb_interpreter;
+ if (m_opaque_sp)
+ sb_interpreter.reset (&m_opaque_sp->GetCommandInterpreter());
return sb_interpreter;
}
void
SBDebugger::HandleCommand (const char *command)
{
- SBProcess process;
- SBCommandInterpreter sb_interpreter(Debugger::GetSharedInstance().GetCommandInterpreter());
- SBCommandReturnObject result;
-
- sb_interpreter.HandleCommand (command, result, false);
-
- if (GetErrorFileHandle() != NULL)
- result.PutError (GetErrorFileHandle());
- if (GetOutputFileHandle() != NULL)
- result.PutOutput (GetOutputFileHandle());
-
- if (Debugger::GetSharedInstance().GetAsyncExecution() == false)
+ if (m_opaque_sp)
{
- process = GetCommandInterpreter().GetProcess ();
- if (process.IsValid())
+ SBCommandInterpreter sb_interpreter(GetCommandInterpreter ());
+ SBCommandReturnObject result;
+
+ sb_interpreter.HandleCommand (command, result, false);
+
+ if (GetErrorFileHandle() != NULL)
+ result.PutError (GetErrorFileHandle());
+ if (GetOutputFileHandle() != NULL)
+ result.PutOutput (GetOutputFileHandle());
+
+ if (m_opaque_sp->GetAsyncExecution() == false)
{
- EventSP event_sp;
- Listener &lldb_listener = Debugger::GetSharedInstance().GetListener();
- while (lldb_listener.GetNextEventForBroadcaster (process.get(), event_sp))
+ SBProcess process(GetCommandInterpreter().GetProcess ());
+ if (process.IsValid())
{
- SBEvent event(event_sp);
- HandleProcessEvent (process, event, GetOutputFileHandle(), GetErrorFileHandle());
+ EventSP event_sp;
+ Listener &lldb_listener = m_opaque_sp->GetListener();
+ while (lldb_listener.GetNextEventForBroadcaster (process.get(), event_sp))
+ {
+ SBEvent event(event_sp);
+ HandleProcessEvent (process, event, GetOutputFileHandle(), GetErrorFileHandle());
+ }
}
}
}
@@ -157,7 +166,9 @@
SBListener
SBDebugger::GetListener ()
{
- SBListener sb_listener(Debugger::GetSharedInstance().GetListener());
+ SBListener sb_listener;
+ if (m_opaque_sp)
+ sb_listener.reset(&m_opaque_sp->GetListener(), false);
return sb_listener;
}
@@ -271,53 +282,6 @@
}
}
-void
-SBDebugger::ReportCurrentLocation (FILE *out, FILE *err)
-{
- if ((out == NULL) || (err == NULL))
- return;
-
- SBTarget sb_target (GetCurrentTarget());
- if (!sb_target.IsValid())
- {
- fprintf (out, "no target\n");
- return;
- }
-
- SBProcess process = sb_target.GetProcess ();
- if (process.IsValid())
- {
- StateType state = process.GetState();
-
- if (StateIsStoppedState (state))
- {
- if (state == eStateExited)
- {
- int exit_status = process.GetExitStatus();
- const char *exit_description = process.GetExitDescription();
- ::fprintf (out, "Process %d exited with status = %i (0x%8.8x) %s\n",
- process.GetProcessID(),
- exit_status,
- exit_status,
- exit_description ? exit_description : "");
- }
- else
- {
- fprintf (out, "Process %d %s\n", process.GetProcessID(), StateAsCString (state));
- SBThread current_thread = process.GetThreadAtIndex (0);
- if (current_thread.IsValid())
- {
- process.DisplayThreadsInfo (out, err, true);
- }
- else
- fprintf (out, "No valid thread found in current process\n");
- }
- }
- else
- fprintf (out, "No current location or status available\n");
- }
-}
-
SBSourceManager &
SBDebugger::GetSourceManager ()
{
@@ -367,38 +331,6 @@
eScriptLanguageDefault,
NULL);
}
-//pid_t
-/*
-SBDebugger::AttachByName (const char *process_name, const char *filename)
-{
- SBTarget *temp_target = GetCurrentTarget();
- SBTarget sb_target;
- pid_t return_pid = (pid_t) LLDB_INVALID_PROCESS_ID;
-
- if (temp_target == NULL)
- {
- if (filename != NULL)
- {
- sb_target = CreateWithFile (filename);
- sb_target.SetArch (LLDB_ARCH_DEFAULT);
- }
- }
- else
- {
- sb_target = *temp_target;
- }
-
- if (sb_target.IsValid())
- {
- SBProcess process = sb_target.GetProcess ();
- if (process.IsValid())
- {
- return_pid = process.AttachByName (process_name);
- }
- }
- return return_pid;
-}
-*/
const char *
SBDebugger::GetVersionString ()
@@ -429,34 +361,77 @@
SBDebugger::CreateTargetWithFileAndTargetTriple (const char *filename,
const char *target_triple)
{
- ArchSpec arch;
- FileSpec file_spec (filename);
- arch.SetArchFromTargetTriple(target_triple);
- TargetSP target_sp;
- Error error (Debugger::GetSharedInstance().GetTargetList().CreateTarget (file_spec, arch, NULL, true, target_sp));
- SBTarget target(target_sp);
+ SBTarget target;
+ if (m_opaque_sp)
+ {
+ ArchSpec arch;
+ FileSpec file_spec (filename);
+ arch.SetArchFromTargetTriple(target_triple);
+ TargetSP target_sp;
+ Error error (m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file_spec, arch, NULL, true, target_sp));
+ target.reset (target_sp);
+ }
return target;
}
SBTarget
SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archname)
{
- FileSpec file (filename);
- ArchSpec arch = lldb_private::GetDefaultArchitecture();
- TargetSP target_sp;
- Error error;
-
- if (archname != NULL)
+ SBTarget target;
+ if (m_opaque_sp)
{
- ArchSpec arch2 (archname);
- error = Debugger::GetSharedInstance().GetTargetList().CreateTarget (file, arch2, NULL, true, target_sp);
+ FileSpec file (filename);
+ ArchSpec arch = lldb_private::GetDefaultArchitecture();
+ TargetSP target_sp;
+ Error error;
+
+ if (archname != NULL)
+ {
+ ArchSpec arch2 (archname);
+ error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch2, NULL, true, target_sp);
+ }
+ else
+ {
+ if (!arch.IsValid())
+ arch = LLDB_ARCH_DEFAULT;
+
+ error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
+
+ if (error.Fail())
+ {
+ if (arch == LLDB_ARCH_DEFAULT_32BIT)
+ arch = LLDB_ARCH_DEFAULT_64BIT;
+ else
+ arch = LLDB_ARCH_DEFAULT_32BIT;
+
+ error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
+ }
+ }
+
+ if (error.Success())
+ {
+ m_opaque_sp->GetTargetList().SetCurrentTarget (target_sp.get());
+ target.reset(target_sp);
+ }
}
- else
+ return target;
+}
+
+SBTarget
+SBDebugger::CreateTarget (const char *filename)
+{
+ SBTarget target;
+ if (m_opaque_sp)
{
+ FileSpec file (filename);
+ ArchSpec arch = lldb_private::GetDefaultArchitecture();
+ TargetSP target_sp;
+ Error error;
+
if (!arch.IsValid())
arch = LLDB_ARCH_DEFAULT;
- error = Debugger::GetSharedInstance().GetTargetList().CreateTarget (file, arch, NULL, true, target_sp);
+ error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
if (error.Fail())
{
@@ -465,77 +440,57 @@
else
arch = LLDB_ARCH_DEFAULT_32BIT;
- error = Debugger::GetSharedInstance().GetTargetList().CreateTarget (file, arch, NULL, true, target_sp);
+ error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
}
- }
-
- if (error.Success())
- Debugger::GetSharedInstance().GetTargetList().SetCurrentTarget (target_sp.get());
- else
- target_sp.reset();
-
- SBTarget sb_target (target_sp);
- return sb_target;
-}
-
-SBTarget
-SBDebugger::CreateTarget (const char *filename)
-{
- FileSpec file (filename);
- ArchSpec arch = lldb_private::GetDefaultArchitecture();
- TargetSP target_sp;
- Error error;
-
- if (!arch.IsValid())
- arch = LLDB_ARCH_DEFAULT;
-
- error = Debugger::GetSharedInstance().GetTargetList().CreateTarget (file, arch, NULL, true, target_sp);
- if (error.Fail())
- {
- if (arch == LLDB_ARCH_DEFAULT_32BIT)
- arch = LLDB_ARCH_DEFAULT_64BIT;
- else
- arch = LLDB_ARCH_DEFAULT_32BIT;
-
- error = Debugger::GetSharedInstance().GetTargetList().CreateTarget (file, arch, NULL, true, target_sp);
+ if (error.Success())
+ {
+ m_opaque_sp->GetTargetList().SetCurrentTarget (target_sp.get());
+ target.reset (target_sp);
+ }
}
-
- if (!error.Fail())
- Debugger::GetSharedInstance().GetTargetList().SetCurrentTarget (target_sp.get());
-
- SBTarget sb_target (target_sp);
- return sb_target;
+ return target;
}
SBTarget
SBDebugger::GetTargetAtIndex (uint32_t idx)
{
- SBTarget sb_target (Debugger::GetSharedInstance().GetTargetList().GetTargetAtIndex (idx));
+ SBTarget sb_target;
+ if (m_opaque_sp)
+ sb_target.reset(m_opaque_sp->GetTargetList().GetTargetAtIndex (idx));
return sb_target;
}
SBTarget
SBDebugger::FindTargetWithProcessID (pid_t pid)
{
- SBTarget sb_target(Debugger::GetSharedInstance().GetTargetList().FindTargetWithProcessID (pid));
+ SBTarget sb_target;
+ if (m_opaque_sp)
+ sb_target.reset(m_opaque_sp->GetTargetList().FindTargetWithProcessID (pid));
return sb_target;
}
SBTarget
SBDebugger::FindTargetWithFileAndArch (const char *filename, const char *arch_name)
{
- ArchSpec arch;
- if (arch_name)
- arch.SetArch(arch_name);
- return SBTarget (Debugger::GetSharedInstance().GetTargetList().FindTargetWithExecutableAndArchitecture (FileSpec(filename),
- arch_name ? &arch : NULL));
+ SBTarget sb_target;
+ if (m_opaque_sp && filename && filename[0])
+ {
+ ArchSpec arch;
+ if (arch_name)
+ arch.SetArch(arch_name);
+ TargetSP target_sp (m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture (FileSpec(filename), arch_name ? &arch : NULL));
+ sb_target.reset(target_sp);
+ }
+ return sb_target;
}
SBTarget
SBDebugger::FindTargetWithLLDBProcess (const lldb::ProcessSP &process_sp)
{
- SBTarget sb_target(Debugger::GetSharedInstance().GetTargetList().FindTargetWithProcess (process_sp.get()));
+ SBTarget sb_target;
+ if (m_opaque_sp)
+ sb_target.reset(m_opaque_sp->GetTargetList().FindTargetWithProcess (process_sp.get()));
return sb_target;
}
@@ -543,27 +498,54 @@
uint32_t
SBDebugger::GetNumTargets ()
{
- return Debugger::GetSharedInstance().GetTargetList().GetNumTargets ();}
+ if (m_opaque_sp)
+ return m_opaque_sp->GetTargetList().GetNumTargets ();
+ return 0;
+}
SBTarget
SBDebugger::GetCurrentTarget ()
{
- SBTarget sb_target(Debugger::GetSharedInstance().GetTargetList().GetCurrentTarget ());
+ SBTarget sb_target;
+ if (m_opaque_sp)
+ sb_target.reset(m_opaque_sp->GetTargetList().GetCurrentTarget ());
return sb_target;
}
void
SBDebugger::DispatchInput (void *baton, const void *data, size_t data_len)
{
- Debugger::GetSharedInstance().DispatchInput ((const char *) data, data_len);
+ if (m_opaque_sp)
+ m_opaque_sp->DispatchInput ((const char *) data, data_len);
}
void
SBDebugger::PushInputReader (SBInputReader &reader)
{
- if (reader.IsValid())
+ if (m_opaque_sp && reader.IsValid())
{
InputReaderSP reader_sp(*reader);
- Debugger::GetSharedInstance().PushInputReader (reader_sp);
+ m_opaque_sp->PushInputReader (reader_sp);
}
}
+
+void
+SBDebugger::reset (const lldb::DebuggerSP &debugger_sp)
+{
+ m_opaque_sp = debugger_sp;
+}
+
+Debugger *
+SBDebugger::get () const
+{
+ return m_opaque_sp.get();
+}
+
+Debugger &
+SBDebugger::ref () const
+{
+ assert (m_opaque_sp.get());
+ return *m_opaque_sp;
+}
+
+
Modified: lldb/trunk/source/API/SBError.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBError.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBError.cpp (original)
+++ lldb/trunk/source/API/SBError.cpp Tue Jun 22 20:19:29 2010
@@ -16,15 +16,15 @@
SBError::SBError () :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
}
SBError::SBError (const SBError &rhs) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new Error(*rhs));
+ m_opaque_ap.reset (new Error(*rhs));
}
@@ -37,14 +37,14 @@
{
if (rhs.IsValid())
{
- if (m_lldb_object_ap.get())
- *m_lldb_object_ap = *rhs;
+ if (m_opaque_ap.get())
+ *m_opaque_ap = *rhs;
else
- m_lldb_object_ap.reset (new Error(*rhs));
+ m_opaque_ap.reset (new Error(*rhs));
}
else
{
- m_lldb_object_ap.reset();
+ m_opaque_ap.reset();
}
return *this;
}
@@ -53,47 +53,47 @@
const char *
SBError::GetCString () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->AsCString();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->AsCString();
return NULL;
}
void
SBError::Clear ()
{
- if (m_lldb_object_ap.get())
- m_lldb_object_ap->Clear();
+ if (m_opaque_ap.get())
+ m_opaque_ap->Clear();
}
bool
SBError::Fail () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->Fail();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->Fail();
return false;
}
bool
SBError::Success () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->Success();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->Success();
return false;
}
uint32_t
SBError::GetError () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->GetError();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetError();
return true;
}
ErrorType
SBError::GetType () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->GetType();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetType();
return eErrorTypeInvalid;
}
@@ -101,14 +101,14 @@
SBError::SetError (uint32_t err, ErrorType type)
{
CreateIfNeeded ();
- m_lldb_object_ap->SetError (err, type);
+ m_opaque_ap->SetError (err, type);
}
void
SBError::SetError (const Error &lldb_error)
{
CreateIfNeeded ();
- *m_lldb_object_ap = lldb_error;
+ *m_opaque_ap = lldb_error;
}
@@ -116,21 +116,21 @@
SBError::SetErrorToErrno ()
{
CreateIfNeeded ();
- m_lldb_object_ap->SetErrorToErrno ();
+ m_opaque_ap->SetErrorToErrno ();
}
void
SBError::SetErrorToGenericError ()
{
CreateIfNeeded ();
- m_lldb_object_ap->SetErrorToErrno ();
+ m_opaque_ap->SetErrorToErrno ();
}
void
SBError::SetErrorString (const char *err_str)
{
CreateIfNeeded ();
- m_lldb_object_ap->SetErrorString (err_str);
+ m_opaque_ap->SetErrorString (err_str);
}
int
@@ -139,7 +139,7 @@
CreateIfNeeded ();
va_list args;
va_start (args, format);
- int num_chars = m_lldb_object_ap->SetErrorStringWithVarArg (format, args);
+ int num_chars = m_opaque_ap->SetErrorStringWithVarArg (format, args);
va_end (args);
return num_chars;
}
@@ -147,27 +147,27 @@
bool
SBError::IsValid () const
{
- return m_lldb_object_ap.get() != NULL;
+ return m_opaque_ap.get() != NULL;
}
void
SBError::CreateIfNeeded ()
{
- if (m_lldb_object_ap.get() == NULL)
- m_lldb_object_ap.reset(new Error ());
+ if (m_opaque_ap.get() == NULL)
+ m_opaque_ap.reset(new Error ());
}
lldb_private::Error *
SBError::operator->()
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
lldb_private::Error *
SBError::get()
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
@@ -175,6 +175,6 @@
SBError::operator*() const
{
// Be sure to call "IsValid()" before calling this function or it will crash
- return *m_lldb_object_ap;
+ return *m_opaque_ap;
}
Modified: lldb/trunk/source/API/SBEvent.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBEvent.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBEvent.cpp (original)
+++ lldb/trunk/source/API/SBEvent.cpp Tue Jun 22 20:19:29 2010
@@ -24,19 +24,19 @@
SBEvent::SBEvent () :
m_event_sp (),
- m_lldb_object (NULL)
+ m_opaque (NULL)
{
}
SBEvent::SBEvent (uint32_t event_type, const char *cstr, uint32_t cstr_len) :
m_event_sp (new Event (event_type, new EventDataBytes (cstr, cstr_len))),
- m_lldb_object (m_event_sp.get())
+ m_opaque (m_event_sp.get())
{
}
SBEvent::SBEvent (EventSP &event_sp) :
m_event_sp (event_sp),
- m_lldb_object (event_sp.get())
+ m_opaque (event_sp.get())
{
}
@@ -47,7 +47,7 @@
void
SBEvent::Dump (FILE *f) const
{
- const Event *lldb_event = GetLLDBObjectPtr();
+ const Event *lldb_event = get();
if (lldb_event)
{
StreamFile str(f);
@@ -58,7 +58,7 @@
const char *
SBEvent::GetDataFlavor ()
{
- Event *lldb_event = SBEvent::GetLLDBObjectPtr();
+ Event *lldb_event = get();
if (lldb_event)
return lldb_event->GetData()->GetFlavor().AsCString();
return NULL;
@@ -67,7 +67,7 @@
uint32_t
SBEvent::GetType () const
{
- const Event *lldb_event = SBEvent::GetLLDBObjectPtr();
+ const Event *lldb_event = get();
if (lldb_event)
return lldb_event->GetType();
return 0;
@@ -77,9 +77,9 @@
SBEvent::GetBroadcaster () const
{
SBBroadcaster broadcaster;
- const Event *lldb_event = SBEvent::GetLLDBObjectPtr();
+ const Event *lldb_event = get();
if (lldb_event)
- broadcaster.SetLLDBObjectPtr (lldb_event->GetBroadcaster(), false);
+ broadcaster.reset (lldb_event->GetBroadcaster(), false);
return broadcaster;
}
@@ -88,9 +88,9 @@
{
if (broadcaster)
{
- Event *lldb_event = SBEvent::GetLLDBObjectPtr();
+ Event *lldb_event = get();
if (lldb_event)
- return lldb_event->BroadcasterIs (broadcaster->GetLLDBObjectPtr ());
+ return lldb_event->BroadcasterIs (broadcaster->get());
}
return false;
}
@@ -98,79 +98,66 @@
bool
SBEvent::BroadcasterMatchesRef (const SBBroadcaster &broadcaster)
{
- Event *lldb_event = SBEvent::GetLLDBObjectPtr();
+ Event *lldb_event = get();
if (lldb_event)
- return lldb_event->BroadcasterIs (broadcaster.GetLLDBObjectPtr ());
+ return lldb_event->BroadcasterIs (broadcaster.get());
return false;
}
void
SBEvent::Clear()
{
- Event *lldb_event = SBEvent::GetLLDBObjectPtr();
+ Event *lldb_event = get();
if (lldb_event)
lldb_event->Clear();
}
EventSP &
-SBEvent::GetSharedPtr () const
+SBEvent::GetSP () const
{
return m_event_sp;
}
Event *
-SBEvent::GetLLDBObjectPtr ()
+SBEvent::get() const
{
// There is a dangerous accessor call GetSharedPtr which can be used, so if
// we have anything valid in m_event_sp, we must use that since if it gets
// used by a function that puts something in there, then it won't update
- // m_lldb_object...
+ // m_opaque...
if (m_event_sp)
- m_lldb_object = m_event_sp.get();
+ m_opaque = m_event_sp.get();
- return m_lldb_object;
-}
-
-const Event *
-SBEvent::GetLLDBObjectPtr () const
-{
- // There is a dangerous accessor call GetSharedPtr which can be used, so if
- // we have anything valid in m_event_sp, we must use that since if it gets
- // used by a function that puts something in there, then it won't update
- // m_lldb_object...
- if (m_event_sp)
- m_lldb_object = m_event_sp.get();
-
- return m_lldb_object;
+ return m_opaque;
}
void
-SBEvent::SetEventSP (EventSP &event_sp)
+SBEvent::reset (EventSP &event_sp)
{
m_event_sp = event_sp;
- m_lldb_object = m_event_sp.get();
+ m_opaque = m_event_sp.get();
}
void
-SBEvent::SetLLDBObjectPtr (Event* event_ptr)
+SBEvent::reset (Event* event_ptr)
{
- m_lldb_object = event_ptr;
+ m_opaque = event_ptr;
m_event_sp.reset();
}
bool
SBEvent::IsValid() const
{
- // Do NOT use m_lldb_object directly!!! Must use the SBEvent::GetLLDBObjectPtr()
- // accessor. See comments in SBEvent::GetLLDBObjectPtr()....
- return SBEvent::GetLLDBObjectPtr() != NULL;
+ // Do NOT use m_opaque directly!!! Must use the SBEvent::get()
+ // accessor. See comments in SBEvent::get()....
+ return SBEvent::get() != NULL;
}
const char *
SBEvent::GetCStringFromEvent (const SBEvent &event)
{
- return reinterpret_cast<const char *>(EventDataBytes::GetBytesFromEvent (event.GetLLDBObjectPtr()));
+ return reinterpret_cast<const char *>(EventDataBytes::GetBytesFromEvent (event.get()));
}
Modified: lldb/trunk/source/API/SBFileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFileSpec.cpp (original)
+++ lldb/trunk/source/API/SBFileSpec.cpp Tue Jun 22 20:19:29 2010
@@ -16,19 +16,19 @@
SBFileSpec::SBFileSpec () :
- m_lldb_object_ap()
+ m_opaque_ap()
{
}
SBFileSpec::SBFileSpec (const SBFileSpec &rhs) :
- m_lldb_object_ap()
+ m_opaque_ap()
{
- if (rhs.m_lldb_object_ap.get())
- m_lldb_object_ap.reset (new FileSpec (*m_lldb_object_ap));
+ if (rhs.m_opaque_ap.get())
+ m_opaque_ap.reset (new FileSpec (*m_opaque_ap));
}
SBFileSpec::SBFileSpec (const char *path) :
- m_lldb_object_ap(new FileSpec (path))
+ m_opaque_ap(new FileSpec (path))
{
}
@@ -42,7 +42,7 @@
if (this != &rhs)
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::FileSpec(*rhs.m_lldb_object_ap.get()));
+ m_opaque_ap.reset (new lldb_private::FileSpec(*rhs.m_opaque_ap.get()));
}
return *this;
}
@@ -50,14 +50,14 @@
bool
SBFileSpec::IsValid() const
{
- return m_lldb_object_ap.get() != NULL;
+ return m_opaque_ap.get() != NULL;
}
bool
SBFileSpec::Exists () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->Exists();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->Exists();
return false;
}
@@ -71,24 +71,24 @@
const char *
SBFileSpec::GetFileName() const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->GetFilename().AsCString();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetFilename().AsCString();
return NULL;
}
const char *
SBFileSpec::GetDirectory() const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->GetDirectory().AsCString();
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetDirectory().AsCString();
return NULL;
}
uint32_t
SBFileSpec::GetPath (char *dst_path, size_t dst_len) const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->GetPath (dst_path, dst_len);
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetPath (dst_path, dst_len);
if (dst_path && dst_len)
*dst_path = '\0';
@@ -99,35 +99,35 @@
const lldb_private::FileSpec *
SBFileSpec::operator->() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
const lldb_private::FileSpec *
SBFileSpec::get() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
const lldb_private::FileSpec &
SBFileSpec::operator*() const
{
- return *m_lldb_object_ap.get();
+ return *m_opaque_ap.get();
}
const lldb_private::FileSpec &
SBFileSpec::ref() const
{
- return *m_lldb_object_ap.get();
+ return *m_opaque_ap.get();
}
void
SBFileSpec::SetFileSpec (const lldb_private::FileSpec& fs)
{
- if (m_lldb_object_ap.get())
- *m_lldb_object_ap = fs;
+ if (m_opaque_ap.get())
+ *m_opaque_ap = fs;
else
- m_lldb_object_ap.reset (new FileSpec (fs));
+ m_opaque_ap.reset (new FileSpec (fs));
}
Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Tue Jun 22 20:19:29 2010
@@ -41,12 +41,12 @@
using namespace lldb_private;
SBFrame::SBFrame () :
- m_lldb_object_sp ()
+ m_opaque_sp ()
{
}
SBFrame::SBFrame (const lldb::StackFrameSP &lldb_object_sp) :
- m_lldb_object_sp (lldb_object_sp)
+ m_opaque_sp (lldb_object_sp)
{
}
@@ -58,65 +58,65 @@
void
SBFrame::SetFrame (const lldb::StackFrameSP &lldb_object_sp)
{
- m_lldb_object_sp = lldb_object_sp;
+ m_opaque_sp = lldb_object_sp;
}
bool
SBFrame::IsValid() const
{
- return (m_lldb_object_sp.get() != NULL);
+ return (m_opaque_sp.get() != NULL);
}
SBSymbolContext
SBFrame::GetSymbolContext (uint32_t resolve_scope) const
{
SBSymbolContext sb_sym_ctx;
- if (m_lldb_object_sp)
- sb_sym_ctx.SetSymbolContext(&m_lldb_object_sp->GetSymbolContext (resolve_scope));
+ if (m_opaque_sp)
+ sb_sym_ctx.SetSymbolContext(&m_opaque_sp->GetSymbolContext (resolve_scope));
return sb_sym_ctx;
}
SBModule
SBFrame::GetModule () const
{
- SBModule sb_module (m_lldb_object_sp->GetSymbolContext (eSymbolContextModule).module_sp);
+ SBModule sb_module (m_opaque_sp->GetSymbolContext (eSymbolContextModule).module_sp);
return sb_module;
}
SBCompileUnit
SBFrame::GetCompileUnit () const
{
- SBCompileUnit sb_comp_unit(m_lldb_object_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit);
+ SBCompileUnit sb_comp_unit(m_opaque_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit);
return sb_comp_unit;
}
SBFunction
SBFrame::GetFunction () const
{
- SBFunction sb_function(m_lldb_object_sp->GetSymbolContext (eSymbolContextFunction).function);
+ SBFunction sb_function(m_opaque_sp->GetSymbolContext (eSymbolContextFunction).function);
return sb_function;
}
SBBlock
SBFrame::GetBlock () const
{
- SBBlock sb_block(m_lldb_object_sp->GetSymbolContext (eSymbolContextBlock).block);
+ SBBlock sb_block(m_opaque_sp->GetSymbolContext (eSymbolContextBlock).block);
return sb_block;
}
SBLineEntry
SBFrame::GetLineEntry () const
{
- SBLineEntry sb_line_entry(&m_lldb_object_sp->GetSymbolContext (eSymbolContextLineEntry).line_entry);
+ SBLineEntry sb_line_entry(&m_opaque_sp->GetSymbolContext (eSymbolContextLineEntry).line_entry);
return sb_line_entry;
}
uint32_t
SBFrame::GetFrameID () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetID();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetID();
else
return UINT32_MAX;
}
@@ -125,24 +125,24 @@
lldb::addr_t
SBFrame::GetPC () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetPC().GetLoadAddress (&m_lldb_object_sp->GetThread().GetProcess());
+ if (m_opaque_sp)
+ return m_opaque_sp->GetPC().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess());
return LLDB_INVALID_ADDRESS;
}
bool
SBFrame::SetPC (lldb::addr_t new_pc)
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetRegisterContext()->SetPC (new_pc);
+ if (m_opaque_sp)
+ return m_opaque_sp->GetRegisterContext()->SetPC (new_pc);
return false;
}
lldb::addr_t
SBFrame::GetSP () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetRegisterContext()->GetSP();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetRegisterContext()->GetSP();
return LLDB_INVALID_ADDRESS;
}
@@ -150,8 +150,8 @@
lldb::addr_t
SBFrame::GetFP () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetRegisterContext()->GetFP();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetRegisterContext()->GetFP();
return LLDB_INVALID_ADDRESS;
}
@@ -160,15 +160,15 @@
SBFrame::GetPCAddress () const
{
SBAddress sb_addr;
- if (m_lldb_object_sp)
- sb_addr.SetAddress (&m_lldb_object_sp->GetPC());
+ if (m_opaque_sp)
+ sb_addr.SetAddress (&m_opaque_sp->GetPC());
return sb_addr;
}
void
SBFrame::Clear()
{
- m_lldb_object_sp.reset();
+ m_opaque_sp.reset();
}
SBValue
@@ -250,40 +250,40 @@
bool
SBFrame::operator == (const SBFrame &rhs) const
{
- return m_lldb_object_sp.get() == rhs.m_lldb_object_sp.get();
+ return m_opaque_sp.get() == rhs.m_opaque_sp.get();
}
bool
SBFrame::operator != (const SBFrame &rhs) const
{
- return m_lldb_object_sp.get() != rhs.m_lldb_object_sp.get();
+ return m_opaque_sp.get() != rhs.m_opaque_sp.get();
}
lldb_private::StackFrame *
SBFrame::operator->() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
lldb_private::StackFrame *
SBFrame::get() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
SBThread
SBFrame::GetThread () const
{
- SBThread sb_thread (m_lldb_object_sp->GetThread().GetSP());
+ SBThread sb_thread (m_opaque_sp->GetThread().GetSP());
return sb_thread;
}
const char *
SBFrame::Disassemble () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->Disassemble();
+ if (m_opaque_sp)
+ return m_opaque_sp->Disassemble();
return NULL;
}
@@ -292,7 +292,7 @@
lldb_private::StackFrame *
SBFrame::GetLLDBObjectPtr ()
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
SBValueList
@@ -302,10 +302,10 @@
bool in_scope_only)
{
SBValueList value_list;
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
size_t i;
- VariableList *variable_list = m_lldb_object_sp->GetVariableList();
+ VariableList *variable_list = m_opaque_sp->GetVariableList();
if (variable_list)
{
const size_t num_variables = variable_list->GetSize();
@@ -334,7 +334,7 @@
}
if (add_variable)
{
- if (in_scope_only && !variable_sp->IsInScope(m_lldb_object_sp.get()))
+ if (in_scope_only && !variable_sp->IsInScope(m_opaque_sp.get()))
continue;
value_list.Append(ValueObjectSP (new ValueObjectVariable (variable_sp)));
@@ -346,7 +346,7 @@
if (statics)
{
- CompileUnit *frame_comp_unit = m_lldb_object_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit;
+ CompileUnit *frame_comp_unit = m_opaque_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit;
if (frame_comp_unit)
{
@@ -377,9 +377,9 @@
SBFrame::GetRegisters ()
{
SBValueList value_list;
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
- RegisterContext *reg_ctx = m_lldb_object_sp->GetRegisterContext();
+ RegisterContext *reg_ctx = m_opaque_sp->GetRegisterContext();
if (reg_ctx)
{
const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
Modified: lldb/trunk/source/API/SBFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFunction.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFunction.cpp (original)
+++ lldb/trunk/source/API/SBFunction.cpp Tue Jun 22 20:19:29 2010
@@ -15,50 +15,50 @@
SBFunction::SBFunction () :
- m_lldb_object_ptr (NULL)
+ m_opaque_ptr (NULL)
{
}
SBFunction::SBFunction (lldb_private::Function *lldb_object_ptr) :
- m_lldb_object_ptr (lldb_object_ptr)
+ m_opaque_ptr (lldb_object_ptr)
{
}
SBFunction::~SBFunction ()
{
- m_lldb_object_ptr = NULL;
+ m_opaque_ptr = NULL;
}
bool
SBFunction::IsValid () const
{
- return m_lldb_object_ptr != NULL;
+ return m_opaque_ptr != NULL;
}
const char *
SBFunction::GetName() const
{
- if (m_lldb_object_ptr)
- return m_lldb_object_ptr->GetMangled().GetName().AsCString();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->GetMangled().GetName().AsCString();
return NULL;
}
const char *
SBFunction::GetMangledName () const
{
- if (m_lldb_object_ptr)
- return m_lldb_object_ptr->GetMangled().GetMangledName().AsCString();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->GetMangled().GetMangledName().AsCString();
return NULL;
}
bool
SBFunction::operator == (const SBFunction &rhs) const
{
- return m_lldb_object_ptr == rhs.m_lldb_object_ptr;
+ return m_opaque_ptr == rhs.m_opaque_ptr;
}
bool
SBFunction::operator != (const SBFunction &rhs) const
{
- return m_lldb_object_ptr != rhs.m_lldb_object_ptr;
+ return m_opaque_ptr != rhs.m_opaque_ptr;
}
Modified: lldb/trunk/source/API/SBInputReader.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInputReader.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBInputReader.cpp (original)
+++ lldb/trunk/source/API/SBInputReader.cpp Tue Jun 22 20:19:29 2010
@@ -10,8 +10,9 @@
#include "lldb/lldb-enumerations.h"
-#include "lldb/API/SBInputReader.h"
+#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBError.h"
+#include "lldb/API/SBInputReader.h"
#include "lldb/API/SBStringList.h"
#include "lldb/Core/InputReader.h"
@@ -20,7 +21,7 @@
using namespace lldb_private;
SBInputReader::SBInputReader () :
- m_reader_sp (),
+ m_opaque_sp (),
m_callback_function (NULL),
m_callback_baton (NULL)
@@ -28,12 +29,12 @@
}
SBInputReader::SBInputReader (const lldb::InputReaderSP &reader_sp) :
- m_reader_sp (reader_sp)
+ m_opaque_sp (reader_sp)
{
}
SBInputReader::SBInputReader (const SBInputReader &rhs) :
- m_reader_sp (rhs.m_reader_sp)
+ m_opaque_sp (rhs.m_opaque_sp)
{
}
@@ -45,7 +46,7 @@
SBInputReader::PrivateCallback
(
void *baton,
- InputReader *reader,
+ InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len
@@ -62,6 +63,7 @@
SBError
SBInputReader::Initialize
(
+ SBDebugger &debugger,
Callback callback_function,
void *callback_baton,
lldb::InputReaderGranularity granularity,
@@ -71,14 +73,14 @@
)
{
SBError sb_error;
- m_reader_sp.reset (new InputReader ());
+ m_opaque_sp.reset (new InputReader (debugger.ref()));
m_callback_function = callback_function;
m_callback_baton = callback_baton;
- if (m_reader_sp)
+ if (m_opaque_sp)
{
- sb_error.SetError (m_reader_sp->Initialize (SBInputReader::PrivateCallback,
+ sb_error.SetError (m_opaque_sp->Initialize (SBInputReader::PrivateCallback,
this,
granularity,
end_token,
@@ -88,7 +90,7 @@
if (sb_error.Fail())
{
- m_reader_sp.reset ();
+ m_opaque_sp.reset ();
m_callback_function = NULL;
m_callback_baton = NULL;
}
@@ -99,46 +101,53 @@
bool
SBInputReader::IsValid () const
{
- return (m_reader_sp.get() != NULL);
+ return (m_opaque_sp.get() != NULL);
}
const SBInputReader &
SBInputReader::operator = (const SBInputReader &rhs)
{
if (this != &rhs)
- m_reader_sp = rhs.m_reader_sp;
+ m_opaque_sp = rhs.m_opaque_sp;
return *this;
}
-lldb_private::InputReader *
+InputReader *
SBInputReader::operator->() const
{
- return m_reader_sp.get();
+ return m_opaque_sp.get();
}
lldb::InputReaderSP &
SBInputReader::operator *()
{
- return m_reader_sp;
+ return m_opaque_sp;
}
const lldb::InputReaderSP &
SBInputReader::operator *() const
{
- return m_reader_sp;
+ return m_opaque_sp;
}
-lldb_private::InputReader *
+InputReader *
SBInputReader::get() const
{
- return m_reader_sp.get();
+ return m_opaque_sp.get();
+}
+
+InputReader &
+SBInputReader::ref() const
+{
+ assert (m_opaque_sp.get());
+ return *m_opaque_sp;
}
bool
SBInputReader::IsDone () const
{
- if (m_reader_sp)
- return m_reader_sp->IsDone();
+ if (m_opaque_sp)
+ return m_opaque_sp->IsDone();
else
return true;
}
@@ -146,15 +155,15 @@
void
SBInputReader::SetIsDone (bool value)
{
- if (m_reader_sp)
- m_reader_sp->SetIsDone (value);
+ if (m_opaque_sp)
+ m_opaque_sp->SetIsDone (value);
}
bool
SBInputReader::IsActive () const
{
- if (m_reader_sp)
- return m_reader_sp->IsActive();
+ if (m_opaque_sp)
+ return m_opaque_sp->IsActive();
else
return false;
}
@@ -162,8 +171,8 @@
InputReaderGranularity
SBInputReader::GetGranularity ()
{
- if (m_reader_sp)
- return m_reader_sp->GetGranularity();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetGranularity();
else
return eInputReaderGranularityInvalid;
}
Modified: lldb/trunk/source/API/SBInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInstruction.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBInstruction.cpp (original)
+++ lldb/trunk/source/API/SBInstruction.cpp Tue Jun 22 20:19:29 2010
@@ -15,7 +15,7 @@
using namespace lldb_private;
//SBInstruction::SBInstruction (lldb_private::Disassembler::Instruction *lldb_insn) :
-// m_lldb_object_sp (lldb_insn);
+// m_opaque_sp (lldb_insn);
//{
//}
@@ -30,7 +30,7 @@
//bool
//SBInstruction::IsValid()
//{
-// return (m_lldb_object_sp.get() != NULL);
+// return (m_opaque_sp.get() != NULL);
//}
//size_t
@@ -38,7 +38,7 @@
//{
// if (IsValid())
// {
-// return m_lldb_object_sp->GetByteSize();
+// return m_opaque_sp->GetByteSize();
// }
// return 0;
//}
@@ -48,7 +48,7 @@
//{
// if (IsValid ())
// {
-// m_lldb_object_sp->SetByteSize (byte_size);
+// m_opaque_sp->SetByteSize (byte_size);
// }
//}
@@ -57,7 +57,7 @@
//{
// if (IsValid ())
// {
-// return m_lldb_object_sp->DoesBranch ();
+// return m_opaque_sp->DoesBranch ();
// }
// return false;
//}
@@ -70,5 +70,5 @@
//StreamFile out_strem (out);
- //m_lldb_object_sp->Dump (out, LLDB_INVALID_ADDRESS, NULL, 0);
+ //m_opaque_sp->Dump (out, LLDB_INVALID_ADDRESS, NULL, 0);
}
Modified: lldb/trunk/source/API/SBLineEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBLineEntry.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBLineEntry.cpp (original)
+++ lldb/trunk/source/API/SBLineEntry.cpp Tue Jun 22 20:19:29 2010
@@ -14,26 +14,26 @@
SBLineEntry::SBLineEntry () :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
}
SBLineEntry::SBLineEntry (const SBLineEntry &rhs) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (rhs.IsValid())
{
- m_lldb_object_ap.reset (new lldb_private::LineEntry (*rhs));
+ m_opaque_ap.reset (new lldb_private::LineEntry (*rhs));
}
}
SBLineEntry::SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (lldb_object_ptr)
- m_lldb_object_ap.reset (new lldb_private::LineEntry(*lldb_object_ptr));
+ m_opaque_ap.reset (new lldb_private::LineEntry(*lldb_object_ptr));
}
const SBLineEntry &
@@ -42,7 +42,7 @@
if (this != &rhs)
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::LineEntry(*rhs));
+ m_opaque_ap.reset (new lldb_private::LineEntry(*rhs));
}
return *this;
}
@@ -50,10 +50,10 @@
void
SBLineEntry::SetLineEntry (const lldb_private::LineEntry &lldb_object_ref)
{
- if (m_lldb_object_ap.get())
- (*m_lldb_object_ap.get()) = lldb_object_ref;
+ if (m_opaque_ap.get())
+ (*m_opaque_ap.get()) = lldb_object_ref;
else
- m_lldb_object_ap.reset (new lldb_private::LineEntry (lldb_object_ref));
+ m_opaque_ap.reset (new lldb_private::LineEntry (lldb_object_ref));
}
@@ -66,8 +66,8 @@
SBLineEntry::GetStartAddress () const
{
SBAddress sb_address;
- if (m_lldb_object_ap.get())
- sb_address.SetAddress(&m_lldb_object_ap->range.GetBaseAddress());
+ if (m_opaque_ap.get())
+ sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
return sb_address;
}
@@ -75,10 +75,10 @@
SBLineEntry::GetEndAddress () const
{
SBAddress sb_address;
- if (m_lldb_object_ap.get())
+ if (m_opaque_ap.get())
{
- sb_address.SetAddress(&m_lldb_object_ap->range.GetBaseAddress());
- sb_address.OffsetAddress(m_lldb_object_ap->range.GetByteSize());
+ sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
+ sb_address.OffsetAddress(m_opaque_ap->range.GetByteSize());
}
return sb_address;
}
@@ -86,7 +86,7 @@
bool
SBLineEntry::IsValid () const
{
- return m_lldb_object_ap.get() != NULL;
+ return m_opaque_ap.get() != NULL;
}
@@ -94,16 +94,16 @@
SBLineEntry::GetFileSpec () const
{
SBFileSpec sb_file_spec;
- if (m_lldb_object_ap.get() && m_lldb_object_ap->file)
- sb_file_spec.SetFileSpec(m_lldb_object_ap->file);
+ if (m_opaque_ap.get() && m_opaque_ap->file)
+ sb_file_spec.SetFileSpec(m_opaque_ap->file);
return sb_file_spec;
}
uint32_t
SBLineEntry::GetLine () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->line;
+ if (m_opaque_ap.get())
+ return m_opaque_ap->line;
return 0;
}
@@ -111,16 +111,16 @@
uint32_t
SBLineEntry::GetColumn () const
{
- if (m_lldb_object_ap.get())
- return m_lldb_object_ap->column;
+ if (m_opaque_ap.get())
+ return m_opaque_ap->column;
return 0;
}
bool
SBLineEntry::operator == (const SBLineEntry &rhs) const
{
- lldb_private::LineEntry *lhs_ptr = m_lldb_object_ap.get();
- lldb_private::LineEntry *rhs_ptr = rhs.m_lldb_object_ap.get();
+ lldb_private::LineEntry *lhs_ptr = m_opaque_ap.get();
+ lldb_private::LineEntry *rhs_ptr = rhs.m_opaque_ap.get();
if (lhs_ptr && rhs_ptr)
return lldb_private::LineEntry::Compare (*lhs_ptr, *rhs_ptr) == 0;
@@ -131,8 +131,8 @@
bool
SBLineEntry::operator != (const SBLineEntry &rhs) const
{
- lldb_private::LineEntry *lhs_ptr = m_lldb_object_ap.get();
- lldb_private::LineEntry *rhs_ptr = rhs.m_lldb_object_ap.get();
+ lldb_private::LineEntry *lhs_ptr = m_opaque_ap.get();
+ lldb_private::LineEntry *rhs_ptr = rhs.m_opaque_ap.get();
if (lhs_ptr && rhs_ptr)
return lldb_private::LineEntry::Compare (*lhs_ptr, *rhs_ptr) != 0;
@@ -143,13 +143,13 @@
const lldb_private::LineEntry *
SBLineEntry::operator->() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
const lldb_private::LineEntry &
SBLineEntry::operator*() const
{
- return *m_lldb_object_ap;
+ return *m_opaque_ap;
}
Modified: lldb/trunk/source/API/SBListener.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBListener.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBListener.cpp (original)
+++ lldb/trunk/source/API/SBListener.cpp Tue Jun 22 20:19:29 2010
@@ -19,30 +19,32 @@
using namespace lldb_private;
-SBListener::SBListener ()
+SBListener::SBListener () :
+ m_opaque_ptr (NULL),
+ m_opaque_ptr_owned (false)
{
}
SBListener::SBListener (const char *name) :
- m_lldb_object_ptr (new Listener (name)),
- m_lldb_object_ptr_owned (true)
+ m_opaque_ptr (new Listener (name)),
+ m_opaque_ptr_owned (true)
{
}
SBListener::SBListener (Listener &listener) :
- m_lldb_object_ptr (&listener),
- m_lldb_object_ptr_owned (false)
+ m_opaque_ptr (&listener),
+ m_opaque_ptr_owned (false)
{
}
SBListener::~SBListener ()
{
- if (m_lldb_object_ptr_owned)
+ if (m_opaque_ptr_owned)
{
- if (m_lldb_object_ptr)
+ if (m_opaque_ptr)
{
- delete m_lldb_object_ptr;
- m_lldb_object_ptr = NULL;
+ delete m_opaque_ptr;
+ m_opaque_ptr = NULL;
}
}
}
@@ -50,30 +52,30 @@
bool
SBListener::IsValid() const
{
- return m_lldb_object_ptr != NULL;
+ return m_opaque_ptr != NULL;
}
void
SBListener::AddEvent (const SBEvent &event)
{
- EventSP &event_sp = event.GetSharedPtr ();
+ EventSP &event_sp = event.GetSP ();
if (event_sp)
- m_lldb_object_ptr->AddEvent (event_sp);
+ m_opaque_ptr->AddEvent (event_sp);
}
void
SBListener::Clear ()
{
- if (IsValid())
- m_lldb_object_ptr->Clear ();
+ if (m_opaque_ptr)
+ m_opaque_ptr->Clear ();
}
uint32_t
SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t event_mask)
{
- if (IsValid() && broadcaster.IsValid())
+ if (m_opaque_ptr && broadcaster.IsValid())
{
- return m_lldb_object_ptr->StartListeningForEvents (broadcaster.GetLLDBObjectPtr (), event_mask);
+ return m_opaque_ptr->StartListeningForEvents (broadcaster.get(), event_mask);
}
return false;
}
@@ -81,9 +83,9 @@
bool
SBListener::StopListeningForEvents (const SBBroadcaster& broadcaster, uint32_t event_mask)
{
- if (IsValid() && broadcaster.IsValid())
+ if (m_opaque_ptr && broadcaster.IsValid())
{
- return m_lldb_object_ptr->StopListeningForEvents (broadcaster.GetLLDBObjectPtr (), event_mask);
+ return m_opaque_ptr->StopListeningForEvents (broadcaster.get(), event_mask);
}
return false;
}
@@ -91,7 +93,7 @@
bool
SBListener::WaitForEvent (uint32_t num_seconds, SBEvent &event)
{
- if (IsValid())
+ if (m_opaque_ptr)
{
TimeValue time_value;
if (num_seconds != UINT32_MAX)
@@ -101,13 +103,13 @@
time_value.OffsetWithSeconds (num_seconds);
}
EventSP event_sp;
- if (m_lldb_object_ptr->WaitForEvent (time_value.IsValid() ? &time_value : NULL, event_sp))
+ if (m_opaque_ptr->WaitForEvent (time_value.IsValid() ? &time_value : NULL, event_sp))
{
- event.SetEventSP (event_sp);
+ event.reset (event_sp);
return true;
}
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
@@ -119,7 +121,7 @@
SBEvent &event
)
{
- if (IsValid() && broadcaster.IsValid())
+ if (m_opaque_ptr && broadcaster.IsValid())
{
TimeValue time_value;
if (num_seconds != UINT32_MAX)
@@ -128,16 +130,16 @@
time_value.OffsetWithSeconds (num_seconds);
}
EventSP event_sp;
- if (m_lldb_object_ptr->WaitForEventForBroadcaster (time_value.IsValid() ? &time_value : NULL,
- broadcaster.GetLLDBObjectPtr (),
+ if (m_opaque_ptr->WaitForEventForBroadcaster (time_value.IsValid() ? &time_value : NULL,
+ broadcaster.get(),
event_sp))
{
- event.SetEventSP (event_sp);
+ event.reset (event_sp);
return true;
}
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
@@ -150,7 +152,7 @@
SBEvent &event
)
{
- if (IsValid() && broadcaster.IsValid())
+ if (m_opaque_ptr && broadcaster.IsValid())
{
TimeValue time_value;
if (num_seconds != UINT32_MAX)
@@ -159,40 +161,40 @@
time_value.OffsetWithSeconds (num_seconds);
}
EventSP event_sp;
- if (m_lldb_object_ptr->WaitForEventForBroadcasterWithType (time_value.IsValid() ? &time_value : NULL,
- broadcaster.GetLLDBObjectPtr (),
- event_type_mask,
- event_sp))
+ if (m_opaque_ptr->WaitForEventForBroadcasterWithType (time_value.IsValid() ? &time_value : NULL,
+ broadcaster.get(),
+ event_type_mask,
+ event_sp))
{
- event.SetEventSP (event_sp);
+ event.reset (event_sp);
return true;
}
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
bool
SBListener::PeekAtNextEvent (SBEvent &event)
{
- if (m_lldb_object_ptr)
+ if (m_opaque_ptr)
{
- event.SetLLDBObjectPtr (m_lldb_object_ptr->PeekAtNextEvent ());
+ event.reset (m_opaque_ptr->PeekAtNextEvent ());
return event.IsValid();
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
bool
SBListener::PeekAtNextEventForBroadcaster (const SBBroadcaster &broadcaster, SBEvent &event)
{
- if (IsValid() && broadcaster.IsValid())
+ if (m_opaque_ptr && broadcaster.IsValid())
{
- event.SetLLDBObjectPtr (m_lldb_object_ptr->PeekAtNextEventForBroadcaster (broadcaster.GetLLDBObjectPtr ()));
+ event.reset (m_opaque_ptr->PeekAtNextEventForBroadcaster (broadcaster.get()));
return event.IsValid();
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
@@ -200,44 +202,44 @@
SBListener::PeekAtNextEventForBroadcasterWithType (const SBBroadcaster &broadcaster, uint32_t event_type_mask,
SBEvent &event)
{
- if (IsValid() && broadcaster.IsValid())
+ if (m_opaque_ptr && broadcaster.IsValid())
{
- event.SetLLDBObjectPtr(m_lldb_object_ptr->PeekAtNextEventForBroadcasterWithType (broadcaster.GetLLDBObjectPtr (), event_type_mask));
+ event.reset(m_opaque_ptr->PeekAtNextEventForBroadcasterWithType (broadcaster.get(), event_type_mask));
return event.IsValid();
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
bool
SBListener::GetNextEvent (SBEvent &event)
{
- if (m_lldb_object_ptr)
+ if (m_opaque_ptr)
{
EventSP event_sp;
- if (m_lldb_object_ptr->GetNextEvent (event_sp))
+ if (m_opaque_ptr->GetNextEvent (event_sp))
{
- event.SetEventSP (event_sp);
+ event.reset (event_sp);
return true;
}
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
bool
SBListener::GetNextEventForBroadcaster (const SBBroadcaster &broadcaster, SBEvent &event)
{
- if (IsValid() && broadcaster.IsValid())
+ if (m_opaque_ptr && broadcaster.IsValid())
{
EventSP event_sp;
- if (m_lldb_object_ptr->GetNextEventForBroadcaster (broadcaster.GetLLDBObjectPtr (), event_sp))
+ if (m_opaque_ptr->GetNextEventForBroadcaster (broadcaster.get(), event_sp))
{
- event.SetEventSP (event_sp);
+ event.reset (event_sp);
return true;
}
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
@@ -249,51 +251,61 @@
SBEvent &event
)
{
- if (IsValid() && broadcaster.IsValid())
+ if (m_opaque_ptr && broadcaster.IsValid())
{
EventSP event_sp;
- if (m_lldb_object_ptr->GetNextEventForBroadcasterWithType (broadcaster.GetLLDBObjectPtr (),
- event_type_mask,
- event_sp))
+ if (m_opaque_ptr->GetNextEventForBroadcasterWithType (broadcaster.get(),
+ event_type_mask,
+ event_sp))
{
- event.SetEventSP (event_sp);
+ event.reset (event_sp);
return true;
}
}
- event.SetLLDBObjectPtr (NULL);
+ event.reset (NULL);
return false;
}
bool
SBListener::HandleBroadcastEvent (const SBEvent &event)
{
- if (m_lldb_object_ptr)
- return m_lldb_object_ptr->HandleBroadcastEvent (event.GetSharedPtr());
+ if (m_opaque_ptr)
+ return m_opaque_ptr->HandleBroadcastEvent (event.GetSP());
return false;
}
-lldb_private::Listener *
+Listener *
SBListener::operator->() const
{
- return m_lldb_object_ptr;
+ return m_opaque_ptr;
}
-lldb_private::Listener *
+Listener *
SBListener::get() const
{
- return m_lldb_object_ptr;
+ return m_opaque_ptr;
}
-lldb_private::Listener &
+void
+SBListener::reset(Listener *listener, bool transfer_ownership)
+{
+ if (m_opaque_ptr_owned && m_opaque_ptr)
+ delete m_opaque_ptr;
+ m_opaque_ptr_owned = transfer_ownership;
+ m_opaque_ptr = listener;
+}
+
+
+Listener &
SBListener::operator *()
{
- return *m_lldb_object_ptr;
+ return *m_opaque_ptr;
}
-const lldb_private::Listener &
+const Listener &
SBListener::operator *() const
{
- return *m_lldb_object_ptr;
+ return *m_opaque_ptr;
}
Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Tue Jun 22 20:19:29 2010
@@ -15,12 +15,12 @@
SBModule::SBModule () :
- m_lldb_object_sp ()
+ m_opaque_sp ()
{
}
SBModule::SBModule (const lldb::ModuleSP& module_sp) :
- m_lldb_object_sp (module_sp)
+ m_opaque_sp (module_sp)
{
}
@@ -31,23 +31,23 @@
bool
SBModule::IsValid () const
{
- return m_lldb_object_sp.get() != NULL;
+ return m_opaque_sp.get() != NULL;
}
SBFileSpec
SBModule::GetFileSpec () const
{
SBFileSpec file_spec;
- if (m_lldb_object_sp)
- file_spec.SetFileSpec(m_lldb_object_sp->GetFileSpec());
+ if (m_opaque_sp)
+ file_spec.SetFileSpec(m_opaque_sp->GetFileSpec());
return file_spec;
}
const uint8_t *
SBModule::GetUUIDBytes () const
{
- if (m_lldb_object_sp)
- return (const uint8_t *)m_lldb_object_sp->GetUUID().GetBytes();
+ if (m_opaque_sp)
+ return (const uint8_t *)m_opaque_sp->GetUUID().GetBytes();
return NULL;
}
@@ -55,53 +55,53 @@
bool
SBModule::operator == (const SBModule &rhs) const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp.get() == rhs.m_lldb_object_sp.get();
+ if (m_opaque_sp)
+ return m_opaque_sp.get() == rhs.m_opaque_sp.get();
return false;
}
bool
SBModule::operator != (const SBModule &rhs) const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp.get() != rhs.m_lldb_object_sp.get();
+ if (m_opaque_sp)
+ return m_opaque_sp.get() != rhs.m_opaque_sp.get();
return false;
}
lldb::ModuleSP &
SBModule::operator *()
{
- return m_lldb_object_sp;
+ return m_opaque_sp;
}
lldb_private::Module *
SBModule::operator ->()
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
const lldb_private::Module *
SBModule::operator ->() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
lldb_private::Module *
SBModule::get()
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
const lldb_private::Module *
SBModule::get() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
void
SBModule::SetModule (const lldb::ModuleSP& module_sp)
{
- m_lldb_object_sp = module_sp;
+ m_opaque_sp = module_sp;
}
Modified: lldb/trunk/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBProcess.cpp (original)
+++ lldb/trunk/source/API/SBProcess.cpp Tue Jun 22 20:19:29 2010
@@ -19,8 +19,9 @@
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Target/Process.h"
-#include "lldb/Target/Thread.h"
#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Target/Thread.h"
// Project includes
@@ -37,7 +38,7 @@
SBProcess::SBProcess () :
- m_lldb_object_sp()
+ m_opaque_sp()
{
}
@@ -47,13 +48,13 @@
//----------------------------------------------------------------------
SBProcess::SBProcess (const SBProcess& rhs) :
- m_lldb_object_sp (rhs.m_lldb_object_sp)
+ m_opaque_sp (rhs.m_opaque_sp)
{
}
SBProcess::SBProcess (const lldb::ProcessSP &process_sp) :
- m_lldb_object_sp (process_sp)
+ m_opaque_sp (process_sp)
{
}
@@ -67,30 +68,30 @@
void
SBProcess::SetProcess (const ProcessSP &process_sp)
{
- m_lldb_object_sp = process_sp;
+ m_opaque_sp = process_sp;
}
void
SBProcess::Clear ()
{
- m_lldb_object_sp.reset();
+ m_opaque_sp.reset();
}
bool
SBProcess::IsValid() const
{
- return m_lldb_object_sp.get() != NULL;
+ return m_opaque_sp.get() != NULL;
}
uint32_t
SBProcess::GetNumThreads ()
{
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
const bool can_update = true;
- return m_lldb_object_sp->GetThreadList().GetSize(can_update);
+ return m_opaque_sp->GetThreadList().GetSize(can_update);
}
return 0;
}
@@ -99,8 +100,8 @@
SBProcess::GetCurrentThread () const
{
SBThread sb_thread;
- if (m_lldb_object_sp)
- sb_thread.SetThread (m_lldb_object_sp->GetThreadList().GetCurrentThread());
+ if (m_opaque_sp)
+ sb_thread.SetThread (m_opaque_sp->GetThreadList().GetCurrentThread());
return sb_thread;
}
@@ -108,8 +109,8 @@
SBProcess::GetTarget() const
{
SBTarget sb_target;
- if (m_lldb_object_sp)
- sb_target = SBDebugger::FindTargetWithLLDBProcess (m_lldb_object_sp);
+ if (m_opaque_sp)
+ sb_target = m_opaque_sp->GetTarget().GetSP();
return sb_target;
}
@@ -117,10 +118,10 @@
size_t
SBProcess::PutSTDIN (const char *src, size_t src_len)
{
- if (m_lldb_object_sp != NULL)
+ if (m_opaque_sp != NULL)
{
Error error;
- return m_lldb_object_sp->PutSTDIN (src, src_len, error);
+ return m_opaque_sp->PutSTDIN (src, src_len, error);
}
else
return 0;
@@ -129,10 +130,10 @@
size_t
SBProcess::GetSTDOUT (char *dst, size_t dst_len) const
{
- if (m_lldb_object_sp != NULL)
+ if (m_opaque_sp != NULL)
{
Error error;
- return m_lldb_object_sp->GetSTDOUT (dst, dst_len, error);
+ return m_opaque_sp->GetSTDOUT (dst, dst_len, error);
}
else
return 0;
@@ -141,10 +142,10 @@
size_t
SBProcess::GetSTDERR (char *dst, size_t dst_len) const
{
- if (m_lldb_object_sp != NULL)
+ if (m_opaque_sp != NULL)
{
Error error;
- return m_lldb_object_sp->GetSTDERR (dst, dst_len, error);
+ return m_opaque_sp->GetSTDERR (dst, dst_len, error);
}
else
return 0;
@@ -156,14 +157,14 @@
if (out == NULL)
return;
- if (m_lldb_object_sp != NULL)
+ if (m_opaque_sp != NULL)
{
const StateType event_state = SBProcess::GetStateFromEvent (event);
char message[1024];
int message_len = ::snprintf (message,
sizeof (message),
"Process %d %s\n",
- m_lldb_object_sp->GetID(),
+ m_opaque_sp->GetID(),
SBDebugger::StateAsCString (event_state));
if (message_len > 0)
@@ -174,14 +175,14 @@
void
SBProcess::AppendCurrentStateReport (const SBEvent &event, SBCommandReturnObject &result)
{
- if (m_lldb_object_sp != NULL)
+ if (m_opaque_sp != NULL)
{
const StateType event_state = SBProcess::GetStateFromEvent (event);
char message[1024];
::snprintf (message,
sizeof (message),
"Process %d %s\n",
- m_lldb_object_sp->GetID(),
+ m_opaque_sp->GetID(),
SBDebugger::StateAsCString (event_state));
result.AppendMessage (message);
@@ -191,16 +192,16 @@
bool
SBProcess::SetCurrentThread (const SBThread &thread)
{
- if (m_lldb_object_sp != NULL)
- return m_lldb_object_sp->GetThreadList().SetCurrentThreadByID (thread.GetThreadID());
+ if (m_opaque_sp != NULL)
+ return m_opaque_sp->GetThreadList().SetCurrentThreadByID (thread.GetThreadID());
return false;
}
bool
SBProcess::SetCurrentThreadByID (uint32_t tid)
{
- if (m_lldb_object_sp != NULL)
- return m_lldb_object_sp->GetThreadList().SetCurrentThreadByID (tid);
+ if (m_opaque_sp != NULL)
+ return m_opaque_sp->GetThreadList().SetCurrentThreadByID (tid);
return false;
}
@@ -208,16 +209,16 @@
SBProcess::GetThreadAtIndex (size_t index)
{
SBThread thread;
- if (m_lldb_object_sp)
- thread.SetThread (m_lldb_object_sp->GetThreadList().GetThreadAtIndex(index));
+ if (m_opaque_sp)
+ thread.SetThread (m_opaque_sp->GetThreadList().GetThreadAtIndex(index));
return thread;
}
StateType
SBProcess::GetState ()
{
- if (m_lldb_object_sp != NULL)
- return m_lldb_object_sp->GetState();
+ if (m_opaque_sp != NULL)
+ return m_opaque_sp->GetState();
else
return eStateInvalid;
}
@@ -226,8 +227,8 @@
int
SBProcess::GetExitStatus ()
{
- if (m_lldb_object_sp != NULL)
- return m_lldb_object_sp->GetExitStatus ();
+ if (m_opaque_sp != NULL)
+ return m_opaque_sp->GetExitStatus ();
else
return 0;
}
@@ -235,8 +236,8 @@
const char *
SBProcess::GetExitDescription ()
{
- if (m_lldb_object_sp != NULL)
- return m_lldb_object_sp->GetExitDescription ();
+ if (m_opaque_sp != NULL)
+ return m_opaque_sp->GetExitDescription ();
else
return NULL;
}
@@ -244,8 +245,8 @@
lldb::pid_t
SBProcess::GetProcessID ()
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetID();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetID();
else
return LLDB_INVALID_PROCESS_ID;
}
@@ -253,85 +254,12 @@
uint32_t
SBProcess::GetAddressByteSize () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetAddressByteSize();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetAddressByteSize();
else
return 0;
}
-
-void
-SBProcess::DisplayThreadsInfo (FILE *out, FILE *err, bool only_threads_with_stop_reason)
-{
- if (m_lldb_object_sp != NULL)
- {
- size_t num_thread_infos_dumped = 0;
- size_t num_threads = GetNumThreads();
-
- if (out == NULL)
- out = SBDebugger::GetOutputFileHandle();
-
- if (err == NULL)
- err = SBDebugger::GetErrorFileHandle();
-
- if ((out == NULL) ||(err == NULL))
- return;
-
- if (num_threads > 0)
- {
- Thread::StopInfo thread_stop_info;
- SBThread curr_thread (m_lldb_object_sp->GetThreadList().GetCurrentThread());
- for (int i = 0; i < num_threads; ++i)
- {
- SBThread thread (m_lldb_object_sp->GetThreadList().GetThreadAtIndex(i));
- if (thread.IsValid())
- {
- bool is_current_thread = false;
- StreamFile str (out);
- if (thread == curr_thread)
- is_current_thread = true;
- StopReason thread_stop_reason = eStopReasonNone;
- if (thread->GetStopInfo (&thread_stop_info))
- {
- thread_stop_reason = thread_stop_info.GetStopReason();
- if (thread_stop_reason == eStopReasonNone)
- {
- if (only_threads_with_stop_reason && !is_current_thread)
- continue;
- }
- }
- ++num_thread_infos_dumped;
- fprintf (out, " %c thread #%u: tid = 0x%4.4x, pc = 0x%16.16llx",
- (is_current_thread ? '*' : ' '),
- thread->GetIndexID(), thread->GetID(), thread->GetRegisterContext()->GetPC());
-
- StackFrameSP frame_sp(thread->GetStackFrameAtIndex (0));
- if (frame_sp)
- {
- SymbolContext sc (frame_sp->GetSymbolContext (eSymbolContextEverything));
- fprintf (out, ", where = ");
- sc.DumpStopContext (&str, m_lldb_object_sp.get(), frame_sp->GetPC ());
- }
-
- if (thread_stop_reason != eStopReasonNone)
- {
- fprintf (out, ", stop reason = ");
- thread_stop_info.Dump (&str);
- }
-
- const char *thread_name = thread->GetName();
- if (thread_name && thread_name[0])
- fprintf (out, ", thread_name = '%s'", thread_name);
-
- fprintf (out, "\n");
-
- SBThread sb_thread (thread);
- sb_thread.DisplayFramesForCurrentContext (out, err, 0, 1, false, 1);
- }
- }
- }
- }
-}
bool
SBProcess::WaitUntilProcessHasStopped (SBCommandReturnObject &result)
{
@@ -340,11 +268,11 @@
if (IsValid())
{
EventSP event_sp;
- StateType state = m_lldb_object_sp->WaitForStateChangedEvents (NULL, event_sp);
+ StateType state = m_opaque_sp->WaitForStateChangedEvents (NULL, event_sp);
while (StateIsStoppedState (state))
{
- state = m_lldb_object_sp->WaitForStateChangedEvents (NULL, event_sp);
+ state = m_opaque_sp->WaitForStateChangedEvents (NULL, event_sp);
SBEvent event (event_sp);
AppendCurrentStateReport (event, result);
state_changed = true;
@@ -358,7 +286,7 @@
{
SBError sb_error;
if (IsValid())
- sb_error.SetError(m_lldb_object_sp->Resume());
+ sb_error.SetError(m_opaque_sp->Resume());
else
sb_error.SetErrorString ("SBProcess is invalid");
@@ -370,8 +298,8 @@
SBProcess::Destroy ()
{
SBError sb_error;
- if (m_lldb_object_sp)
- sb_error.SetError(m_lldb_object_sp->Destroy());
+ if (m_opaque_sp)
+ sb_error.SetError(m_opaque_sp->Destroy());
else
sb_error.SetErrorString ("SBProcess is invalid");
@@ -384,7 +312,7 @@
{
SBError sb_error;
if (IsValid())
- sb_error.SetError (m_lldb_object_sp->Halt());
+ sb_error.SetError (m_opaque_sp->Halt());
else
sb_error.SetErrorString ("SBProcess is invalid");
return sb_error;
@@ -394,8 +322,8 @@
SBProcess::Kill ()
{
SBError sb_error;
- if (m_lldb_object_sp)
- sb_error.SetError (m_lldb_object_sp->Destroy());
+ if (m_opaque_sp)
+ sb_error.SetError (m_opaque_sp->Destroy());
else
sb_error.SetErrorString ("SBProcess is invalid");
return sb_error;
@@ -406,8 +334,8 @@
SBProcess::AttachByName (const char *name, bool wait_for_launch)
{
SBError sb_error;
- if (m_lldb_object_sp)
- sb_error.SetError (m_lldb_object_sp->Attach (name, wait_for_launch));
+ if (m_opaque_sp)
+ sb_error.SetError (m_opaque_sp->Attach (name, wait_for_launch));
else
sb_error.SetErrorString ("SBProcess is invalid");
return sb_error;
@@ -425,8 +353,8 @@
SBProcess::Attach (lldb::pid_t attach_pid)
{
SBError sb_error;
- if (m_lldb_object_sp)
- sb_error.SetError (m_lldb_object_sp->Attach (attach_pid));
+ if (m_opaque_sp)
+ sb_error.SetError (m_opaque_sp->Attach (attach_pid));
else
sb_error.SetErrorString ("SBProcess is invalid");
return sb_error;
@@ -436,8 +364,8 @@
SBProcess::Detach ()
{
SBError sb_error;
- if (m_lldb_object_sp)
- sb_error.SetError (m_lldb_object_sp->Detach());
+ if (m_opaque_sp)
+ sb_error.SetError (m_opaque_sp->Detach());
else
sb_error.SetErrorString ("SBProcess is invalid");
@@ -448,102 +376,38 @@
SBProcess::Signal (int signal)
{
SBError sb_error;
- if (m_lldb_object_sp)
- sb_error.SetError (m_lldb_object_sp->Signal (signal));
+ if (m_opaque_sp)
+ sb_error.SetError (m_opaque_sp->Signal (signal));
else
sb_error.SetErrorString ("SBProcess is invalid");
return sb_error;
}
-void
-SBProcess::ListThreads ()
-{
- FILE *out = SBDebugger::GetOutputFileHandle();
- if (out == NULL)
- return;
-
- if (m_lldb_object_sp)
- {
- size_t num_threads = GetNumThreads ();
- if (num_threads > 0)
- {
- Thread *cur_thread = m_lldb_object_sp->GetThreadList().GetCurrentThread().get();
- for (int i = 0; i < num_threads; ++i)
- {
- Thread *thread = m_lldb_object_sp->GetThreadList().GetThreadAtIndex(i).get();
- if (thread)
- {
- bool is_current_thread = false;
- if (thread == cur_thread)
- is_current_thread = true;
- fprintf (out, " [%u] %c tid = 0x%4.4x, pc = 0x%16.16llx",
- i,
- (is_current_thread ? '*' : ' '),
- thread->GetID(),
- thread->GetRegisterContext()->GetPC());
- const char *thread_name = thread->GetName();
- if (thread_name && thread_name[0])
- fprintf (out, ", name = %s", thread_name);
- const char *queue_name = thread->GetQueueName();
- if (queue_name && queue_name[0])
- fprintf (out, ", queue = %s", queue_name);
- fprintf (out, "\n");
- }
- }
- }
- }
-}
-
SBThread
SBProcess::GetThreadByID (tid_t sb_thread_id)
{
SBThread thread;
- if (m_lldb_object_sp)
- thread.SetThread (m_lldb_object_sp->GetThreadList().FindThreadByID ((tid_t) sb_thread_id));
+ if (m_opaque_sp)
+ thread.SetThread (m_opaque_sp->GetThreadList().FindThreadByID ((tid_t) sb_thread_id));
return thread;
}
-void
-SBProcess::Backtrace (bool all_threads, uint32_t num_frames)
-{
- if (m_lldb_object_sp)
- {
- if (!all_threads)
- {
- SBDebugger::UpdateCurrentThread (*this);
- SBThread cur_thread = GetCurrentThread();
- if (cur_thread.IsValid())
- cur_thread.Backtrace (num_frames);
- }
- else
- {
- int num_threads = GetNumThreads ();
- for (int i = 0; i < num_threads; ++i)
- {
- SBThread sb_thread = GetThreadAtIndex (i);
- sb_thread.Backtrace (num_frames);
- }
- }
- }
-}
-
StateType
SBProcess::GetStateFromEvent (const SBEvent &event)
{
- return Process::ProcessEventData::GetStateFromEvent (event.GetLLDBObjectPtr());
+ return Process::ProcessEventData::GetStateFromEvent (event.get());
}
-
bool
SBProcess::GetRestartedFromEvent (const SBEvent &event)
{
- return Process::ProcessEventData::GetRestartedFromEvent (event.GetLLDBObjectPtr());
+ return Process::ProcessEventData::GetRestartedFromEvent (event.get());
}
SBProcess
SBProcess::GetProcessFromEvent (const SBEvent &event)
{
- SBProcess process(Process::ProcessEventData::GetProcessFromEvent (event.GetLLDBObjectPtr()));
+ SBProcess process(Process::ProcessEventData::GetProcessFromEvent (event.get()));
return process;
}
@@ -551,14 +415,14 @@
SBBroadcaster
SBProcess::GetBroadcaster () const
{
- SBBroadcaster broadcaster(m_lldb_object_sp.get(), false);
+ SBBroadcaster broadcaster(m_opaque_sp.get(), false);
return broadcaster;
}
lldb_private::Process *
SBProcess::operator->() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
size_t
@@ -569,7 +433,7 @@
if (IsValid())
{
Error error;
- bytes_read = m_lldb_object_sp->ReadMemory (addr, dst, dst_len, error);
+ bytes_read = m_opaque_sp->ReadMemory (addr, dst, dst_len, error);
sb_error.SetError (error);
}
else
@@ -588,7 +452,7 @@
if (IsValid())
{
Error error;
- bytes_written = m_lldb_object_sp->WriteMemory (addr, src, src_len, error);
+ bytes_written = m_opaque_sp->WriteMemory (addr, src, src_len, error);
sb_error.SetError (error);
}
@@ -599,6 +463,6 @@
lldb_private::Process *
SBProcess::get() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
Modified: lldb/trunk/source/API/SBSourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSourceManager.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSourceManager.cpp (original)
+++ lldb/trunk/source/API/SBSourceManager.cpp Tue Jun 22 20:19:29 2010
@@ -21,7 +21,7 @@
SBSourceManager::SBSourceManager (SourceManager& source_manager) :
- m_source_manager (source_manager)
+ m_opaque_ref (source_manager)
{
}
@@ -48,12 +48,12 @@
StreamFile str (f);
- return m_source_manager.DisplaySourceLinesWithLineNumbers (*file,
- line,
- context_before,
- context_after,
- current_line_cstr,
- &str);
+ return m_opaque_ref.DisplaySourceLinesWithLineNumbers (*file,
+ line,
+ context_before,
+ context_after,
+ current_line_cstr,
+ &str);
}
return 0;
}
@@ -61,5 +61,5 @@
SourceManager &
SBSourceManager::GetLLDBManager ()
{
- return m_source_manager;
+ return m_opaque_ref;
}
Modified: lldb/trunk/source/API/SBStringList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBStringList.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBStringList.cpp (original)
+++ lldb/trunk/source/API/SBStringList.cpp Tue Jun 22 20:19:29 2010
@@ -15,22 +15,22 @@
using namespace lldb_private;
SBStringList::SBStringList () :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
}
SBStringList::SBStringList (const lldb_private::StringList *lldb_strings_ptr) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (lldb_strings_ptr)
- m_lldb_object_ap.reset (new lldb_private::StringList (*lldb_strings_ptr));
+ m_opaque_ap.reset (new lldb_private::StringList (*lldb_strings_ptr));
}
SBStringList::SBStringList (const SBStringList &rhs) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::StringList(*rhs));
+ m_opaque_ap.reset (new lldb_private::StringList(*rhs));
}
@@ -44,7 +44,7 @@
SBStringList::operator = (const SBStringList &rhs)
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::StringList(*rhs));
+ m_opaque_ap.reset (new lldb_private::StringList(*rhs));
return *this;
}
@@ -52,19 +52,19 @@
const lldb_private::StringList *
SBStringList::operator->() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
const lldb_private::StringList &
SBStringList::operator*() const
{
- return *m_lldb_object_ap;
+ return *m_opaque_ap;
}
bool
SBStringList::IsValid() const
{
- return (m_lldb_object_ap.get() != NULL);
+ return (m_opaque_ap.get() != NULL);
}
void
@@ -73,9 +73,9 @@
if (str != NULL)
{
if (IsValid())
- m_lldb_object_ap->AppendString (str);
+ m_opaque_ap->AppendString (str);
else
- m_lldb_object_ap.reset (new lldb_private::StringList (str));
+ m_opaque_ap.reset (new lldb_private::StringList (str));
}
}
@@ -87,9 +87,9 @@
&& (strc > 0))
{
if (IsValid())
- m_lldb_object_ap->AppendList (strv, strc);
+ m_opaque_ap->AppendList (strv, strc);
else
- m_lldb_object_ap.reset (new lldb_private::StringList (strv, strc));
+ m_opaque_ap.reset (new lldb_private::StringList (strv, strc));
}
}
@@ -99,8 +99,8 @@
if (strings.IsValid())
{
if (! IsValid())
- m_lldb_object_ap.reset (new lldb_private::StringList());
- m_lldb_object_ap->AppendList (*(strings.m_lldb_object_ap));
+ m_opaque_ap.reset (new lldb_private::StringList());
+ m_opaque_ap->AppendList (*(strings.m_opaque_ap));
}
}
@@ -109,7 +109,7 @@
{
if (IsValid())
{
- return m_lldb_object_ap->GetSize();
+ return m_opaque_ap->GetSize();
}
return 0;
}
@@ -119,7 +119,7 @@
{
if (IsValid())
{
- return m_lldb_object_ap->GetStringAtIndex (idx);
+ return m_opaque_ap->GetStringAtIndex (idx);
}
return NULL;
}
@@ -129,6 +129,6 @@
{
if (IsValid())
{
- m_lldb_object_ap->Clear();
+ m_opaque_ap->Clear();
}
}
Modified: lldb/trunk/source/API/SBSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbol.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbol.cpp (original)
+++ lldb/trunk/source/API/SBSymbol.cpp Tue Jun 22 20:19:29 2010
@@ -14,39 +14,39 @@
SBSymbol::SBSymbol () :
- m_lldb_object_ptr (NULL)
+ m_opaque_ptr (NULL)
{
}
SBSymbol::SBSymbol (lldb_private::Symbol *lldb_object_ptr) :
- m_lldb_object_ptr (lldb_object_ptr)
+ m_opaque_ptr (lldb_object_ptr)
{
}
SBSymbol::~SBSymbol ()
{
- m_lldb_object_ptr = NULL;
+ m_opaque_ptr = NULL;
}
bool
SBSymbol::IsValid () const
{
- return m_lldb_object_ptr != NULL;
+ return m_opaque_ptr != NULL;
}
const char *
SBSymbol::GetName() const
{
- if (m_lldb_object_ptr)
- return m_lldb_object_ptr->GetMangled().GetName().AsCString();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->GetMangled().GetName().AsCString();
return NULL;
}
const char *
SBSymbol::GetMangledName () const
{
- if (m_lldb_object_ptr)
- return m_lldb_object_ptr->GetMangled().GetMangledName().AsCString();
+ if (m_opaque_ptr)
+ return m_opaque_ptr->GetMangled().GetMangledName().AsCString();
return NULL;
}
@@ -54,11 +54,11 @@
bool
SBSymbol::operator == (const SBSymbol &rhs) const
{
- return m_lldb_object_ptr == rhs.m_lldb_object_ptr;
+ return m_opaque_ptr == rhs.m_opaque_ptr;
}
bool
SBSymbol::operator != (const SBSymbol &rhs) const
{
- return m_lldb_object_ptr != rhs.m_lldb_object_ptr;
+ return m_opaque_ptr != rhs.m_opaque_ptr;
}
Modified: lldb/trunk/source/API/SBSymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbolContext.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbolContext.cpp (original)
+++ lldb/trunk/source/API/SBSymbolContext.cpp Tue Jun 22 20:19:29 2010
@@ -16,22 +16,22 @@
SBSymbolContext::SBSymbolContext () :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
}
SBSymbolContext::SBSymbolContext (const SymbolContext *sc_ptr) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (sc_ptr)
- m_lldb_object_ap.reset (new SymbolContext (*sc_ptr));
+ m_opaque_ap.reset (new SymbolContext (*sc_ptr));
}
SBSymbolContext::SBSymbolContext (const SBSymbolContext& rhs) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (rhs.IsValid())
- *m_lldb_object_ap = *rhs.m_lldb_object_ap;
+ *m_opaque_ap = *rhs.m_opaque_ap;
}
SBSymbolContext::~SBSymbolContext ()
@@ -44,7 +44,7 @@
if (this != &rhs)
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::SymbolContext(*rhs.m_lldb_object_ap.get()));
+ m_opaque_ap.reset (new lldb_private::SymbolContext(*rhs.m_opaque_ap.get()));
}
return *this;
}
@@ -54,22 +54,22 @@
{
if (sc_ptr)
{
- if (m_lldb_object_ap.get())
- *m_lldb_object_ap = *sc_ptr;
+ if (m_opaque_ap.get())
+ *m_opaque_ap = *sc_ptr;
else
- m_lldb_object_ap.reset (new SymbolContext (*sc_ptr));
+ m_opaque_ap.reset (new SymbolContext (*sc_ptr));
}
else
{
- if (m_lldb_object_ap.get())
- m_lldb_object_ap->Clear();
+ if (m_opaque_ap.get())
+ m_opaque_ap->Clear();
}
}
bool
SBSymbolContext::IsValid () const
{
- return m_lldb_object_ap.get() != NULL;
+ return m_opaque_ap.get() != NULL;
}
@@ -78,35 +78,35 @@
SBSymbolContext::GetModule ()
{
SBModule sb_module;
- if (m_lldb_object_ap.get())
- sb_module.SetModule(m_lldb_object_ap->module_sp);
+ if (m_opaque_ap.get())
+ sb_module.SetModule(m_opaque_ap->module_sp);
return sb_module;
}
SBCompileUnit
SBSymbolContext::GetCompileUnit ()
{
- return SBCompileUnit (m_lldb_object_ap.get() ? m_lldb_object_ap->comp_unit : NULL);
+ return SBCompileUnit (m_opaque_ap.get() ? m_opaque_ap->comp_unit : NULL);
}
SBFunction
SBSymbolContext::GetFunction ()
{
- return SBFunction (m_lldb_object_ap.get() ? m_lldb_object_ap->function : NULL);
+ return SBFunction (m_opaque_ap.get() ? m_opaque_ap->function : NULL);
}
SBBlock
SBSymbolContext::GetBlock ()
{
- return SBBlock (m_lldb_object_ap.get() ? m_lldb_object_ap->block : NULL);
+ return SBBlock (m_opaque_ap.get() ? m_opaque_ap->block : NULL);
}
SBLineEntry
SBSymbolContext::GetLineEntry ()
{
SBLineEntry sb_line_entry;
- if (m_lldb_object_ap.get())
- sb_line_entry.SetLineEntry (m_lldb_object_ap->line_entry);
+ if (m_opaque_ap.get())
+ sb_line_entry.SetLineEntry (m_opaque_ap->line_entry);
return sb_line_entry;
}
@@ -114,19 +114,19 @@
SBSymbol
SBSymbolContext::GetSymbol ()
{
- return SBSymbol (m_lldb_object_ap.get() ? m_lldb_object_ap->symbol : NULL);
+ return SBSymbol (m_opaque_ap.get() ? m_opaque_ap->symbol : NULL);
}
lldb_private::SymbolContext*
SBSymbolContext::operator->() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
lldb_private::SymbolContext *
SBSymbolContext::GetLLDBObjectPtr() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Tue Jun 22 20:19:29 2010
@@ -53,12 +53,12 @@
}
SBTarget::SBTarget (const SBTarget& rhs) :
- m_target_sp (rhs.m_target_sp)
+ m_opaque_sp (rhs.m_opaque_sp)
{
}
SBTarget::SBTarget(const TargetSP& target_sp) :
- m_target_sp (target_sp)
+ m_opaque_sp (target_sp)
{
}
@@ -67,7 +67,7 @@
{
if (this != &rhs)
{
- m_target_sp = rhs.m_target_sp;
+ m_opaque_sp = rhs.m_opaque_sp;
}
return *this;
}
@@ -83,28 +83,37 @@
bool
SBTarget::IsValid () const
{
- return m_target_sp.get() != NULL;
+ return m_opaque_sp.get() != NULL;
}
SBProcess
SBTarget::GetProcess ()
{
SBProcess sb_process;
- if (IsValid())
- sb_process.SetProcess (m_target_sp->GetProcessSP());
+ if (m_opaque_sp)
+ sb_process.SetProcess (m_opaque_sp->GetProcessSP());
return sb_process;
}
+SBDebugger
+SBTarget::GetDebugger () const
+{
+ SBDebugger debugger;
+ if (m_opaque_sp)
+ debugger.reset (m_opaque_sp->GetDebugger().GetSP());
+ return debugger;
+}
+
SBProcess
SBTarget::CreateProcess ()
{
SBProcess sb_process;
- if (IsValid())
+ if (m_opaque_sp)
{
- SBListener sb_listener = SBDebugger::GetListener();
+ SBListener sb_listener (m_opaque_sp->GetDebugger().GetListener());
if (sb_listener.IsValid())
- sb_process.SetProcess (m_target_sp->CreateProcess (*sb_listener));
+ sb_process.SetProcess (m_opaque_sp->CreateProcess (*sb_listener));
}
return sb_process;
}
@@ -141,9 +150,9 @@
SBTarget::GetExecutable ()
{
SBFileSpec exe_file_spec;
- if (IsValid())
+ if (m_opaque_sp)
{
- ModuleSP exe_module_sp (m_target_sp->GetExecutableModule ());
+ ModuleSP exe_module_sp (m_opaque_sp->GetExecutableModule ());
if (exe_module_sp)
exe_file_spec.SetFileSpec (exe_module_sp->GetFileSpec());
}
@@ -154,8 +163,8 @@
bool
SBTarget::DeleteTargetFromList (TargetList *list)
{
- if (IsValid())
- return list->DeleteTarget (m_target_sp);
+ if (m_opaque_sp)
+ return list->DeleteTarget (m_opaque_sp);
else
return false;
}
@@ -163,9 +172,9 @@
bool
SBTarget::MakeCurrentTarget ()
{
- if (IsValid())
+ if (m_opaque_sp)
{
- Debugger::GetSharedInstance().GetTargetList().SetCurrentTarget (m_target_sp.get());
+ m_opaque_sp->GetDebugger().GetTargetList().SetCurrentTarget (m_opaque_sp.get());
return true;
}
return false;
@@ -174,24 +183,31 @@
bool
SBTarget::operator == (const SBTarget &rhs) const
{
- return m_target_sp.get() == rhs.m_target_sp.get();
+ return m_opaque_sp.get() == rhs.m_opaque_sp.get();
}
bool
SBTarget::operator != (const SBTarget &rhs) const
{
- return m_target_sp.get() != rhs.m_target_sp.get();
+ return m_opaque_sp.get() != rhs.m_opaque_sp.get();
}
lldb_private::Target *
-SBTarget::GetLLDBObjectPtr()
+SBTarget::operator ->() const
{
- return m_target_sp.get();
+ return m_opaque_sp.get();
}
-const lldb_private::Target *
-SBTarget::GetLLDBObjectPtr() const
+
+lldb_private::Target *
+SBTarget::get() const
+{
+ return m_opaque_sp.get();
+}
+
+void
+SBTarget::reset (const lldb::TargetSP& target_sp)
{
- return m_target_sp.get();
+ m_opaque_sp = target_sp;
}
SBBreakpoint
@@ -207,8 +223,8 @@
SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t line)
{
SBBreakpoint sb_bp;
- if (m_target_sp.get() && line != 0)
- *sb_bp = m_target_sp->CreateBreakpoint (NULL, *sb_file_spec, line, true, false);
+ if (m_opaque_sp.get() && line != 0)
+ *sb_bp = m_opaque_sp->CreateBreakpoint (NULL, *sb_file_spec, line, true, false);
return sb_bp;
}
@@ -216,16 +232,16 @@
SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_name)
{
SBBreakpoint sb_bp;
- if (m_target_sp.get() && symbol_name && symbol_name[0])
+ if (m_opaque_sp.get() && symbol_name && symbol_name[0])
{
if (module_name && module_name[0])
{
FileSpec module_file_spec(module_name);
- *sb_bp = m_target_sp->CreateBreakpoint (&module_file_spec, symbol_name, false);
+ *sb_bp = m_opaque_sp->CreateBreakpoint (&module_file_spec, symbol_name, false);
}
else
{
- *sb_bp = m_target_sp->CreateBreakpoint (NULL, symbol_name, false);
+ *sb_bp = m_opaque_sp->CreateBreakpoint (NULL, symbol_name, false);
}
}
return sb_bp;
@@ -235,7 +251,7 @@
SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name)
{
SBBreakpoint sb_bp;
- if (m_target_sp.get() && symbol_name_regex && symbol_name_regex[0])
+ if (m_opaque_sp.get() && symbol_name_regex && symbol_name_regex[0])
{
RegularExpression regexp(symbol_name_regex);
@@ -243,11 +259,11 @@
{
FileSpec module_file_spec(module_name);
- *sb_bp = m_target_sp->CreateBreakpoint (&module_file_spec, regexp, false);
+ *sb_bp = m_opaque_sp->CreateBreakpoint (&module_file_spec, regexp, false);
}
else
{
- *sb_bp = m_target_sp->CreateBreakpoint (NULL, regexp, false);
+ *sb_bp = m_opaque_sp->CreateBreakpoint (NULL, regexp, false);
}
}
return sb_bp;
@@ -259,22 +275,22 @@
SBTarget::BreakpointCreateByAddress (addr_t address)
{
SBBreakpoint sb_bp;
- if (m_target_sp.get())
- *sb_bp = m_target_sp->CreateBreakpoint (address, false);
+ if (m_opaque_sp.get())
+ *sb_bp = m_opaque_sp->CreateBreakpoint (address, false);
return sb_bp;
}
void
SBTarget::ListAllBreakpoints ()
{
- FILE *out_file = SBDebugger::GetOutputFileHandle();
+ FILE *out_file = m_opaque_sp->GetDebugger().GetOutputFileHandle();
if (out_file == NULL)
return;
- if (IsValid())
+ if (m_opaque_sp)
{
- const BreakpointList &bp_list = m_target_sp->GetBreakpointList();
+ const BreakpointList &bp_list = m_opaque_sp->GetBreakpointList();
size_t num_bps = bp_list.GetSize();
for (int i = 0; i < num_bps; ++i)
{
@@ -288,8 +304,8 @@
SBTarget::FindBreakpointByID (break_id_t bp_id)
{
SBBreakpoint sb_breakpoint;
- if (m_target_sp && bp_id != LLDB_INVALID_BREAK_ID)
- *sb_breakpoint = m_target_sp->GetBreakpointByID (bp_id);
+ if (m_opaque_sp && bp_id != LLDB_INVALID_BREAK_ID)
+ *sb_breakpoint = m_opaque_sp->GetBreakpointByID (bp_id);
return sb_breakpoint;
}
@@ -297,17 +313,17 @@
bool
SBTarget::BreakpointDelete (break_id_t bp_id)
{
- if (m_target_sp)
- return m_target_sp->RemoveBreakpointByID (bp_id);
+ if (m_opaque_sp)
+ return m_opaque_sp->RemoveBreakpointByID (bp_id);
return false;
}
bool
SBTarget::EnableAllBreakpoints ()
{
- if (m_target_sp)
+ if (m_opaque_sp)
{
- m_target_sp->EnableAllBreakpoints ();
+ m_opaque_sp->EnableAllBreakpoints ();
return true;
}
return false;
@@ -316,9 +332,9 @@
bool
SBTarget::DisableAllBreakpoints ()
{
- if (m_target_sp)
+ if (m_opaque_sp)
{
- m_target_sp->DisableAllBreakpoints ();
+ m_opaque_sp->DisableAllBreakpoints ();
return true;
}
return false;
@@ -327,9 +343,9 @@
bool
SBTarget::DeleteAllBreakpoints ()
{
- if (m_target_sp)
+ if (m_opaque_sp)
{
- m_target_sp->RemoveAllBreakpoints ();
+ m_opaque_sp->RemoveAllBreakpoints ();
return true;
}
return false;
@@ -339,8 +355,8 @@
uint32_t
SBTarget::GetNumModules () const
{
- if (m_target_sp)
- return m_target_sp->GetImages().GetSize();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetImages().GetSize();
return 0;
}
@@ -348,8 +364,8 @@
SBTarget::FindModule (const SBFileSpec &sb_file_spec)
{
SBModule sb_module;
- if (m_target_sp && sb_file_spec.IsValid())
- sb_module.SetModule (m_target_sp->GetImages().FindFirstModuleForFileSpec (*sb_file_spec, NULL));
+ if (m_opaque_sp && sb_file_spec.IsValid())
+ sb_module.SetModule (m_opaque_sp->GetImages().FindFirstModuleForFileSpec (*sb_file_spec, NULL));
return sb_module;
}
@@ -357,8 +373,8 @@
SBTarget::GetModuleAtIndex (uint32_t idx)
{
SBModule sb_module;
- if (m_target_sp)
- sb_module.SetModule(m_target_sp->GetImages().GetModuleAtIndex(idx));
+ if (m_opaque_sp)
+ sb_module.SetModule(m_opaque_sp->GetImages().GetModuleAtIndex(idx));
return sb_module;
}
@@ -366,7 +382,7 @@
SBBroadcaster
SBTarget::GetBroadcaster () const
{
- SBBroadcaster broadcaster(m_target_sp.get(), false);
+ SBBroadcaster broadcaster(m_opaque_sp.get(), false);
return broadcaster;
}
@@ -376,11 +392,11 @@
if (file_address_start == LLDB_INVALID_ADDRESS)
return;
- FILE *out = SBDebugger::GetOutputFileHandle();
+ FILE *out = m_opaque_sp->GetDebugger().GetOutputFileHandle();
if (out == NULL)
return;
- if (IsValid())
+ if (m_opaque_sp)
{
SBModule module;
if (module_name != NULL)
@@ -388,7 +404,7 @@
SBFileSpec file_spec (module_name);
module = FindModule (file_spec);
}
- ArchSpec arch (m_target_sp->GetArchitecture());
+ ArchSpec arch (m_opaque_sp->GetArchitecture());
if (!arch.IsValid())
return;
Disassembler *disassembler = Disassembler::FindPlugin (arch);
@@ -446,11 +462,11 @@
if (function_name == NULL)
return;
- FILE *out = SBDebugger::GetOutputFileHandle();
+ FILE *out = m_opaque_sp->GetDebugger().GetOutputFileHandle();
if (out == NULL)
return;
- if (IsValid())
+ if (m_opaque_sp)
{
SBModule module;
@@ -460,7 +476,7 @@
module = FindModule (file_spec);
}
- ArchSpec arch (m_target_sp->GetArchitecture());
+ ArchSpec arch (m_opaque_sp->GetArchitecture());
if (!arch.IsValid())
return;
@@ -486,7 +502,7 @@
if (module_name != NULL)
containing_module = new FileSpec (module_name);
- SearchFilterSP filter_sp (m_target_sp->GetSearchFilterForModule (containing_module));
+ SearchFilterSP filter_sp (m_opaque_sp->GetSearchFilterForModule (containing_module));
AddressResolverSP resolver_sp (new AddressResolverName (function_name));
resolver_sp->ResolveAddress (*filter_sp);
Modified: lldb/trunk/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Tue Jun 22 20:19:29 2010
@@ -11,8 +11,10 @@
#include "lldb/API/SBSymbolContext.h"
#include "lldb/API/SBFileSpec.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/Process.h"
#include "lldb/Symbol/SymbolContext.h"
@@ -35,7 +37,7 @@
using namespace lldb_private;
SBThread::SBThread () :
- m_lldb_object_sp ()
+ m_opaque_sp ()
{
}
@@ -43,13 +45,13 @@
// Thread constructor
//----------------------------------------------------------------------
SBThread::SBThread (const ThreadSP& lldb_object_sp) :
- m_lldb_object_sp (lldb_object_sp)
+ m_opaque_sp (lldb_object_sp)
{
}
SBThread::SBThread (const SBThread &rhs)
{
- m_lldb_object_sp = rhs.m_lldb_object_sp;
+ m_opaque_sp = rhs.m_opaque_sp;
}
//----------------------------------------------------------------------
@@ -62,16 +64,16 @@
bool
SBThread::IsValid() const
{
- return m_lldb_object_sp != NULL;
+ return m_opaque_sp != NULL;
}
StopReason
SBThread::GetStopReason()
{
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
lldb_private::Thread::StopInfo thread_stop_info;
- if (m_lldb_object_sp->GetStopInfo(&thread_stop_info))
+ if (m_opaque_sp->GetStopInfo(&thread_stop_info))
return thread_stop_info.GetStopReason();
}
return eStopReasonInvalid;
@@ -80,10 +82,10 @@
size_t
SBThread::GetStopDescription (char *dst, size_t dst_len)
{
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
lldb_private::Thread::StopInfo thread_stop_info;
- if (m_lldb_object_sp->GetStopInfo(&thread_stop_info))
+ if (m_opaque_sp->GetStopInfo(&thread_stop_info))
{
const char *stop_desc = thread_stop_info.GetStopDescription();
if (stop_desc)
@@ -129,7 +131,7 @@
case eStopReasonSignal:
{
- stop_desc = m_lldb_object_sp->GetProcess().GetUnixSignals ().GetSignalAsCString (thread_stop_info.GetSignal());
+ stop_desc = m_opaque_sp->GetProcess().GetUnixSignals ().GetSignalAsCString (thread_stop_info.GetSignal());
if (stop_desc == NULL || stop_desc[0] == '\0')
{
static char signal_desc[] = "signal";
@@ -169,15 +171,15 @@
void
SBThread::SetThread (const ThreadSP& lldb_object_sp)
{
- m_lldb_object_sp = lldb_object_sp;
+ m_opaque_sp = lldb_object_sp;
}
lldb::tid_t
SBThread::GetThreadID () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetID();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetID();
else
return LLDB_INVALID_THREAD_ID;
}
@@ -185,23 +187,23 @@
uint32_t
SBThread::GetIndexID () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetIndexID();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetIndexID();
return LLDB_INVALID_INDEX32;
}
const char *
SBThread::GetName () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetName();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetName();
return NULL;
}
const char *
SBThread::GetQueueName () const
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetQueueName();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetQueueName();
return NULL;
}
@@ -219,9 +221,9 @@
if ((out == NULL) || (err == NULL))
return;
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
- uint32_t num_stack_frames = m_lldb_object_sp->GetStackFrameCount ();
+ uint32_t num_stack_frames = m_opaque_sp->GetStackFrameCount ();
StackFrameSP frame_sp;
int frame_idx = 0;
@@ -230,7 +232,7 @@
if (frame_idx >= num_stack_frames)
break;
- frame_sp = m_lldb_object_sp->GetStackFrameAtIndex (frame_idx);
+ frame_sp = m_opaque_sp->GetStackFrameAtIndex (frame_idx);
if (!frame_sp)
break;
@@ -257,17 +259,16 @@
uint32_t source_lines_before)
{
bool success = false;
-
- if ((out == NULL) || (err == NULL))
+
+ if ((out == NULL) || (err == NULL))
return false;
-
- if (m_lldb_object_sp && frame.IsValid())
+
+ if (m_opaque_sp && frame.IsValid())
{
-
StreamFile str (out);
-
+
SBSymbolContext sc(frame.GetSymbolContext(eSymbolContextEverything));
-
+
if (show_frame_info && sc.IsValid())
{
user_id_t frame_idx = (user_id_t) frame.GetFrameID();
@@ -277,28 +278,28 @@
frame_idx,
GetThreadID(),
pc);
- sc->DumpStopContext (&str, &m_lldb_object_sp->GetProcess(), *frame.GetPCAddress());
+ sc->DumpStopContext (&str, &m_opaque_sp->GetProcess(), *frame.GetPCAddress());
fprintf (out, "\n");
success = true;
}
-
+
SBCompileUnit comp_unit(sc.GetCompileUnit());
if (show_source && comp_unit.IsValid())
{
- success = false;
+ success = false;
SBLineEntry line_entry;
if (line_entry.IsValid())
{
- SBSourceManager& source_manager = SBDebugger::GetSourceManager();
- SBFileSpec line_entry_file_spec = line_entry.GetFileSpec();
-
+ SourceManager& source_manager = m_opaque_sp->GetProcess().GetTarget().GetDebugger().GetSourceManager();
+ SBFileSpec line_entry_file_spec (line_entry.GetFileSpec());
+
if (line_entry_file_spec.IsValid())
{
- source_manager.DisplaySourceLinesWithLineNumbers (line_entry_file_spec,
+ source_manager.DisplaySourceLinesWithLineNumbers (line_entry_file_spec.ref(),
line_entry.GetLine(),
source_lines_after,
source_lines_before, "->",
- out);
+ &str);
success = true;
}
}
@@ -310,17 +311,17 @@
void
SBThread::StepOver (lldb::RunMode stop_other_threads)
{
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
bool abort_other_plans = true;
- StackFrameSP frame_sp(m_lldb_object_sp->GetStackFrameAtIndex (0));
+ StackFrameSP frame_sp(m_opaque_sp->GetStackFrameAtIndex (0));
if (frame_sp)
{
if (frame_sp->HasDebugInformation ())
{
SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
- m_lldb_object_sp->QueueThreadPlanForStepRange (abort_other_plans,
+ m_opaque_sp->QueueThreadPlanForStepRange (abort_other_plans,
eStepTypeOver,
sc.line_entry.range,
sc,
@@ -330,15 +331,15 @@
}
else
{
- m_lldb_object_sp->QueueThreadPlanForStepSingleInstruction (true,
+ m_opaque_sp->QueueThreadPlanForStepSingleInstruction (true,
abort_other_plans,
stop_other_threads);
}
}
- Process &process = m_lldb_object_sp->GetProcess();
+ Process &process = m_opaque_sp->GetProcess();
// Why do we need to set the current thread by ID here???
- process.GetThreadList().SetCurrentThreadByID (m_lldb_object_sp->GetID());
+ process.GetThreadList().SetCurrentThreadByID (m_opaque_sp->GetID());
process.Resume();
}
}
@@ -346,17 +347,17 @@
void
SBThread::StepInto (lldb::RunMode stop_other_threads)
{
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
bool abort_other_plans = true;
- StackFrameSP frame_sp(m_lldb_object_sp->GetStackFrameAtIndex (0));
+ StackFrameSP frame_sp(m_opaque_sp->GetStackFrameAtIndex (0));
if (frame_sp && frame_sp->HasDebugInformation ())
{
bool avoid_code_without_debug_info = true;
SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
- m_lldb_object_sp->QueueThreadPlanForStepRange (abort_other_plans,
+ m_opaque_sp->QueueThreadPlanForStepRange (abort_other_plans,
eStepTypeInto,
sc.line_entry.range,
sc,
@@ -365,14 +366,14 @@
}
else
{
- m_lldb_object_sp->QueueThreadPlanForStepSingleInstruction (false,
+ m_opaque_sp->QueueThreadPlanForStepSingleInstruction (false,
abort_other_plans,
stop_other_threads);
}
- Process &process = m_lldb_object_sp->GetProcess();
+ Process &process = m_opaque_sp->GetProcess();
// Why do we need to set the current thread by ID here???
- process.GetThreadList().SetCurrentThreadByID (m_lldb_object_sp->GetID());
+ process.GetThreadList().SetCurrentThreadByID (m_opaque_sp->GetID());
process.Resume();
}
@@ -381,15 +382,15 @@
void
SBThread::StepOut ()
{
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
bool abort_other_plans = true;
bool stop_other_threads = true;
- m_lldb_object_sp->QueueThreadPlanForStepOut (abort_other_plans, NULL, false, stop_other_threads, eVoteYes, eVoteNoOpinion);
+ m_opaque_sp->QueueThreadPlanForStepOut (abort_other_plans, NULL, false, stop_other_threads, eVoteYes, eVoteNoOpinion);
- Process &process = m_lldb_object_sp->GetProcess();
- process.GetThreadList().SetCurrentThreadByID (m_lldb_object_sp->GetID());
+ Process &process = m_opaque_sp->GetProcess();
+ process.GetThreadList().SetCurrentThreadByID (m_opaque_sp->GetID());
process.Resume();
}
}
@@ -397,11 +398,11 @@
void
SBThread::StepInstruction (bool step_over)
{
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
- m_lldb_object_sp->QueueThreadPlanForStepSingleInstruction (step_over, true, true);
- Process &process = m_lldb_object_sp->GetProcess();
- process.GetThreadList().SetCurrentThreadByID (m_lldb_object_sp->GetID());
+ m_opaque_sp->QueueThreadPlanForStepSingleInstruction (step_over, true, true);
+ Process &process = m_opaque_sp->GetProcess();
+ process.GetThreadList().SetCurrentThreadByID (m_opaque_sp->GetID());
process.Resume();
}
}
@@ -409,67 +410,29 @@
void
SBThread::RunToAddress (lldb::addr_t addr)
{
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
bool abort_other_plans = true;
bool stop_other_threads = true;
Address target_addr (NULL, addr);
- m_lldb_object_sp->QueueThreadPlanForRunToAddress (abort_other_plans, target_addr, stop_other_threads);
- Process &process = m_lldb_object_sp->GetProcess();
- process.GetThreadList().SetCurrentThreadByID (m_lldb_object_sp->GetID());
+ m_opaque_sp->QueueThreadPlanForRunToAddress (abort_other_plans, target_addr, stop_other_threads);
+ Process &process = m_opaque_sp->GetProcess();
+ process.GetThreadList().SetCurrentThreadByID (m_opaque_sp->GetID());
process.Resume();
}
}
-void
-SBThread::Backtrace (uint32_t num_frames)
-{
- bool all_frames = false;
- if (num_frames < 1)
- all_frames = true;
-
- FILE *out = SBDebugger::GetOutputFileHandle();
- FILE *err = SBDebugger::GetErrorFileHandle();
-
- if ((out == NULL) || (err == NULL))
- return;
-
- if (m_lldb_object_sp)
- {
- if (out && err)
- {
- int max_num_frames = m_lldb_object_sp->GetStackFrameCount();
- int last_frame = max_num_frames;
-
- if (!all_frames && (num_frames < last_frame))
- last_frame = num_frames;
-
- StackFrameSP frame_sp;
- for (int i = 0; i < last_frame; ++i)
- {
- frame_sp = m_lldb_object_sp->GetStackFrameAtIndex (i);
- if (!frame_sp)
- break;
-
- SBFrame sb_frame (frame_sp);
- if (DisplaySingleFrameForCurrentContext ((FILE *) out, (FILE *) err, sb_frame, true, false, 0, 0) == false)
- break;
- }
- }
- }
-}
-
SBProcess
SBThread::GetProcess ()
{
SBProcess process;
- if (m_lldb_object_sp)
+ if (m_opaque_sp)
{
// Have to go up to the target so we can get a shared pointer to our process...
- process.SetProcess(m_lldb_object_sp->GetProcess().GetTarget().GetProcessSP());
+ process.SetProcess(m_opaque_sp->GetProcess().GetTarget().GetProcessSP());
}
return process;
}
@@ -477,8 +440,8 @@
uint32_t
SBThread::GetNumFrames ()
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetStackFrameCount();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetStackFrameCount();
return 0;
}
@@ -486,56 +449,56 @@
SBThread::GetFrameAtIndex (uint32_t idx)
{
SBFrame sb_frame;
- if (m_lldb_object_sp)
- sb_frame.SetFrame (m_lldb_object_sp->GetStackFrameAtIndex (idx));
+ if (m_opaque_sp)
+ sb_frame.SetFrame (m_opaque_sp->GetStackFrameAtIndex (idx));
return sb_frame;
}
const lldb::SBThread &
SBThread::operator = (const lldb::SBThread &rhs)
{
- m_lldb_object_sp = rhs.m_lldb_object_sp;
+ m_opaque_sp = rhs.m_opaque_sp;
return *this;
}
bool
SBThread::operator == (const SBThread &rhs) const
{
- return m_lldb_object_sp.get() == rhs.m_lldb_object_sp.get();
+ return m_opaque_sp.get() == rhs.m_opaque_sp.get();
}
bool
SBThread::operator != (const SBThread &rhs) const
{
- return m_lldb_object_sp.get() != rhs.m_lldb_object_sp.get();
+ return m_opaque_sp.get() != rhs.m_opaque_sp.get();
}
lldb_private::Thread *
SBThread::GetLLDBObjectPtr ()
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
const lldb_private::Thread *
SBThread::operator->() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
const lldb_private::Thread &
SBThread::operator*() const
{
- return *m_lldb_object_sp;
+ return *m_opaque_sp;
}
lldb_private::Thread *
SBThread::operator->()
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
lldb_private::Thread &
SBThread::operator*()
{
- return *m_lldb_object_sp;
+ return *m_opaque_sp;
}
Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Tue Jun 22 20:19:29 2010
@@ -33,12 +33,12 @@
using namespace lldb_private;
SBValue::SBValue () :
- m_lldb_object_sp ()
+ m_opaque_sp ()
{
}
SBValue::SBValue (const lldb::ValueObjectSP &value_sp) :
- m_lldb_object_sp (value_sp)
+ m_opaque_sp (value_sp)
{
}
@@ -49,7 +49,7 @@
bool
SBValue::IsValid () const
{
- return (m_lldb_object_sp.get() != NULL);
+ return (m_opaque_sp.get() != NULL);
}
void
@@ -72,25 +72,25 @@
lldb_private::StreamFile out_stream (out_file);
- out_stream.Printf ("%s ", m_lldb_object_sp->GetName().AsCString (NULL));
- if (! m_lldb_object_sp->IsInScope (lldb_frame))
+ out_stream.Printf ("%s ", m_opaque_sp->GetName().AsCString (NULL));
+ if (! m_opaque_sp->IsInScope (lldb_frame))
out_stream.Printf ("[out-of-scope] ");
if (print_type)
{
- out_stream.Printf ("(%s) ", m_lldb_object_sp->GetTypeName().AsCString ("<unknown-type>"));
+ out_stream.Printf ("(%s) ", m_opaque_sp->GetTypeName().AsCString ("<unknown-type>"));
}
if (print_value)
{
ExecutionContextScope *exe_scope = frame->get();
- const char *val_cstr = m_lldb_object_sp->GetValueAsCString(exe_scope);
- const char *err_cstr = m_lldb_object_sp->GetError().AsCString();
+ const char *val_cstr = m_opaque_sp->GetValueAsCString(exe_scope);
+ const char *err_cstr = m_opaque_sp->GetError().AsCString();
if (!err_cstr)
{
- const char *sum_cstr = m_lldb_object_sp->GetSummaryAsCString(exe_scope);
+ const char *sum_cstr = m_opaque_sp->GetSummaryAsCString(exe_scope);
const bool is_aggregate =
- ClangASTContext::IsAggregateType (m_lldb_object_sp->GetOpaqueClangQualType());
+ ClangASTContext::IsAggregateType (m_opaque_sp->GetOpaqueClangQualType());
if (val_cstr)
out_stream.Printf ("= %s ", val_cstr);
@@ -100,13 +100,13 @@
if (is_aggregate)
{
out_stream.PutChar ('{');
- const uint32_t num_children = m_lldb_object_sp->GetNumChildren();
+ const uint32_t num_children = m_opaque_sp->GetNumChildren();
if (num_children)
{
out_stream.IndentMore();
for (uint32_t idx = 0; idx < num_children; ++idx)
{
- lldb::ValueObjectSP child_sp (m_lldb_object_sp->GetChildAtIndex (idx, true));
+ lldb::ValueObjectSP child_sp (m_opaque_sp->GetChildAtIndex (idx, true));
if (child_sp.get())
{
out_stream.EOL();
@@ -131,7 +131,7 @@
SBValue::GetName()
{
if (IsValid())
- return m_lldb_object_sp->GetName().AsCString();
+ return m_opaque_sp->GetName().AsCString();
else
return NULL;
}
@@ -140,7 +140,7 @@
SBValue::GetTypeName ()
{
if (IsValid())
- return m_lldb_object_sp->GetTypeName().AsCString();
+ return m_opaque_sp->GetTypeName().AsCString();
else
return NULL;
}
@@ -151,7 +151,7 @@
size_t result = 0;
if (IsValid())
- result = m_lldb_object_sp->GetByteSize();
+ result = m_opaque_sp->GetByteSize();
return result;
}
@@ -162,7 +162,7 @@
bool result = false;
if (IsValid())
- result = m_lldb_object_sp->IsInScope (frame.get());
+ result = m_opaque_sp->IsInScope (frame.get());
return result;
}
@@ -171,8 +171,8 @@
SBValue::GetValue (const SBFrame &frame)
{
const char *value_string = NULL;
- if ( m_lldb_object_sp)
- value_string = m_lldb_object_sp->GetValueAsCString(frame.get());
+ if ( m_opaque_sp)
+ value_string = m_opaque_sp->GetValueAsCString(frame.get());
return value_string;
}
@@ -180,7 +180,7 @@
SBValue::GetValueDidChange ()
{
if (IsValid())
- return m_lldb_object_sp->GetValueDidChange();
+ return m_opaque_sp->GetValueDidChange();
return false;
}
@@ -188,8 +188,8 @@
SBValue::GetSummary (const SBFrame &frame)
{
const char *value_string = NULL;
- if ( m_lldb_object_sp)
- value_string = m_lldb_object_sp->GetSummaryAsCString(frame.get());
+ if ( m_opaque_sp)
+ value_string = m_opaque_sp->GetSummaryAsCString(frame.get());
return value_string;
}
@@ -198,7 +198,7 @@
{
const char *value_string = NULL;
if (IsValid())
- value_string = m_lldb_object_sp->GetLocationAsCString(frame.get());
+ value_string = m_opaque_sp->GetLocationAsCString(frame.get());
return value_string;
}
@@ -207,7 +207,7 @@
{
bool success = false;
if (IsValid())
- success = m_lldb_object_sp->SetValueFromCString (frame.get(), value_str);
+ success = m_opaque_sp->SetValueFromCString (frame.get(), value_str);
return success;
}
@@ -218,7 +218,7 @@
if (IsValid())
{
- child_sp = m_lldb_object_sp->GetChildAtIndex (idx, true);
+ child_sp = m_opaque_sp->GetChildAtIndex (idx, true);
}
SBValue sb_value (child_sp);
@@ -229,7 +229,7 @@
SBValue::GetIndexOfChildWithName (const char *name)
{
if (IsValid())
- return m_lldb_object_sp->GetIndexOfChildWithName (ConstString(name));
+ return m_opaque_sp->GetIndexOfChildWithName (ConstString(name));
return UINT32_MAX;
}
@@ -241,7 +241,7 @@
if (IsValid())
{
- child_sp = m_lldb_object_sp->GetChildMemberWithName (str_name, true);
+ child_sp = m_opaque_sp->GetChildMemberWithName (str_name, true);
}
SBValue sb_value (child_sp);
@@ -256,7 +256,7 @@
if (IsValid())
{
- num_children = m_lldb_object_sp->GetNumChildren();
+ num_children = m_opaque_sp->GetNumChildren();
}
return num_children;
@@ -269,7 +269,7 @@
if (IsValid())
{
- result = m_lldb_object_sp->GetValueIsValid();
+ result = m_opaque_sp->GetValueIsValid();
}
return result;
@@ -281,7 +281,7 @@
{
if (IsValid())
{
- if (m_lldb_object_sp->IsPointerType())
+ if (m_opaque_sp->IsPointerType())
{
return GetChildAtIndex(0);
}
@@ -296,53 +296,53 @@
if (IsValid())
{
- is_ptr_type = m_lldb_object_sp->IsPointerType();
+ is_ptr_type = m_opaque_sp->IsPointerType();
}
return is_ptr_type;
}
-lldb_private::ExecutionContext
-SBValue::GetCurrentExecutionContext ()
-{
- lldb_private::Process *process = NULL;
- lldb_private::Thread *thread = NULL;
- lldb_private::StackFrame *frame = NULL;
-
- SBTarget sb_target = SBDebugger::GetCurrentTarget();
- if (sb_target.IsValid())
- {
- SBProcess sb_process = sb_target.GetProcess();
- if (sb_process.IsValid())
- {
- process = sb_process.get();
- SBThread sb_thread = sb_process.GetCurrentThread();
- if (sb_thread.IsValid())
- {
- thread = sb_thread.GetLLDBObjectPtr();
- frame = thread->GetStackFrameAtIndex(0).get();
- lldb_private::ExecutionContext exe_context (process, thread, frame);
- return exe_context;
- }
- else
- {
- lldb_private::ExecutionContext exe_context (process, NULL, NULL);
- return exe_context;
- }
- }
- }
-
- lldb_private::ExecutionContext exe_context (NULL, NULL, NULL);
- return exe_context;
-}
-
-
+//lldb_private::ExecutionContext
+//SBValue::GetCurrentExecutionContext ()
+//{
+// lldb_private::Process *process = NULL;
+// lldb_private::Thread *thread = NULL;
+// lldb_private::StackFrame *frame = NULL;
+//
+// SBTarget sb_target = SBDebugger::GetCurrentTarget();
+// if (sb_target.IsValid())
+// {
+// SBProcess sb_process = sb_target.GetProcess();
+// if (sb_process.IsValid())
+// {
+// process = sb_process.get();
+// SBThread sb_thread = sb_process.GetCurrentThread();
+// if (sb_thread.IsValid())
+// {
+// thread = sb_thread.GetLLDBObjectPtr();
+// frame = thread->GetStackFrameAtIndex(0).get();
+// lldb_private::ExecutionContext exe_context (process, thread, frame);
+// return exe_context;
+// }
+// else
+// {
+// lldb_private::ExecutionContext exe_context (process, NULL, NULL);
+// return exe_context;
+// }
+// }
+// }
+//
+// lldb_private::ExecutionContext exe_context (NULL, NULL, NULL);
+// return exe_context;
+//}
+//
+//
void *
SBValue::GetOpaqueType()
{
- if (m_lldb_object_sp)
- return m_lldb_object_sp->GetOpaqueClangQualType();
+ if (m_opaque_sp)
+ return m_opaque_sp->GetOpaqueClangQualType();
return NULL;
}
@@ -350,23 +350,23 @@
lldb_private::ValueObject *
SBValue::get() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
lldb_private::ValueObject *
SBValue::operator->() const
{
- return m_lldb_object_sp.get();
+ return m_opaque_sp.get();
}
lldb::ValueObjectSP &
SBValue::operator*()
{
- return m_lldb_object_sp;
+ return m_opaque_sp;
}
const lldb::ValueObjectSP &
SBValue::operator*() const
{
- return m_lldb_object_sp;
+ return m_opaque_sp;
}
Modified: lldb/trunk/source/API/SBValueList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValueList.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValueList.cpp (original)
+++ lldb/trunk/source/API/SBValueList.cpp Tue Jun 22 20:19:29 2010
@@ -17,22 +17,22 @@
using namespace lldb_private;
SBValueList::SBValueList () :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
}
SBValueList::SBValueList (const SBValueList &rhs) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::ValueObjectList (*rhs));
+ m_opaque_ap.reset (new lldb_private::ValueObjectList (*rhs));
}
SBValueList::SBValueList (const lldb_private::ValueObjectList *lldb_object_ptr) :
- m_lldb_object_ap ()
+ m_opaque_ap ()
{
if (lldb_object_ptr)
- m_lldb_object_ap.reset (new lldb_private::ValueObjectList (*lldb_object_ptr));
+ m_opaque_ap.reset (new lldb_private::ValueObjectList (*lldb_object_ptr));
}
SBValueList::~SBValueList ()
@@ -42,7 +42,7 @@
bool
SBValueList::IsValid () const
{
- return (m_lldb_object_ap.get() != NULL);
+ return (m_opaque_ap.get() != NULL);
}
const SBValueList &
@@ -51,9 +51,9 @@
if (this != &rhs)
{
if (rhs.IsValid())
- m_lldb_object_ap.reset (new lldb_private::ValueObjectList (*rhs));
+ m_opaque_ap.reset (new lldb_private::ValueObjectList (*rhs));
else
- m_lldb_object_ap.reset ();
+ m_opaque_ap.reset ();
}
return *this;
}
@@ -61,25 +61,25 @@
lldb_private::ValueObjectList *
SBValueList::operator->()
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
lldb_private::ValueObjectList &
SBValueList::operator*()
{
- return *m_lldb_object_ap;
+ return *m_opaque_ap;
}
const lldb_private::ValueObjectList *
SBValueList::operator->() const
{
- return m_lldb_object_ap.get();
+ return m_opaque_ap.get();
}
const lldb_private::ValueObjectList &
SBValueList::operator*() const
{
- return *m_lldb_object_ap;
+ return *m_opaque_ap;
}
void
@@ -88,7 +88,7 @@
if (val_obj.get())
{
CreateIfNeeded ();
- m_lldb_object_ap->Append (*val_obj);
+ m_opaque_ap->Append (*val_obj);
}
}
@@ -98,7 +98,7 @@
if (val_obj_sp)
{
CreateIfNeeded ();
- m_lldb_object_ap->Append (val_obj_sp);
+ m_opaque_ap->Append (val_obj_sp);
}
}
@@ -107,8 +107,8 @@
SBValueList::GetValueAtIndex (uint32_t idx) const
{
SBValue sb_value;
- if (m_lldb_object_ap.get())
- *sb_value = m_lldb_object_ap->GetValueObjectAtIndex (idx);
+ if (m_opaque_ap.get())
+ *sb_value = m_opaque_ap->GetValueObjectAtIndex (idx);
return sb_value;
}
@@ -116,16 +116,16 @@
SBValueList::GetSize () const
{
uint32_t size = 0;
- if (m_lldb_object_ap.get())
- size = m_lldb_object_ap->GetSize();
+ if (m_opaque_ap.get())
+ size = m_opaque_ap->GetSize();
return size;
}
void
SBValueList::CreateIfNeeded ()
{
- if (m_lldb_object_ap.get() == NULL)
- m_lldb_object_ap.reset (new ValueObjectList());
+ if (m_opaque_ap.get() == NULL)
+ m_opaque_ap.reset (new ValueObjectList());
}
@@ -133,8 +133,8 @@
SBValueList::FindValueObjectByUID (lldb::user_id_t uid)
{
SBValue sb_value;
- if ( m_lldb_object_ap.get())
- *sb_value = m_lldb_object_ap->FindValueObjectByUID (uid);
+ if ( m_opaque_ap.get())
+ *sb_value = m_opaque_ap->FindValueObjectByUID (uid);
return sb_value;
}
Modified: lldb/trunk/source/Breakpoint/StoppointCallbackContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/StoppointCallbackContext.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/StoppointCallbackContext.cpp (original)
+++ lldb/trunk/source/Breakpoint/StoppointCallbackContext.cpp Tue Jun 22 20:19:29 2010
@@ -18,13 +18,13 @@
StoppointCallbackContext::StoppointCallbackContext() :
event (NULL),
- context()
+ exe_ctx()
{
}
StoppointCallbackContext::StoppointCallbackContext(Event *e, Process* p, Thread *t, StackFrame *f, bool synchronously) :
event (e),
- context (p, t, f),
+ exe_ctx (p, t, f),
is_synchronous(synchronously)
{
}
@@ -33,6 +33,6 @@
StoppointCallbackContext::Clear()
{
event = NULL;
- context.Clear();
+ exe_ctx.Clear();
is_synchronous = false;
}
Modified: lldb/trunk/source/Commands/CommandCompletions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandCompletions.cpp (original)
+++ lldb/trunk/source/Commands/CommandCompletions.cpp Tue Jun 22 20:19:29 2010
@@ -33,13 +33,16 @@
};
bool
-CommandCompletions::InvokeCommonCompletionCallbacks (uint32_t completion_mask,
- const char *completion_str,
- int match_start_point,
- int max_return_elements,
- lldb_private::CommandInterpreter *interpreter,
- SearchFilter *searcher,
- lldb_private::StringList &matches)
+CommandCompletions::InvokeCommonCompletionCallbacks
+(
+ CommandInterpreter &interpreter,
+ uint32_t completion_mask,
+ const char *completion_str,
+ int match_start_point,
+ int max_return_elements,
+ SearchFilter *searcher,
+ StringList &matches
+)
{
bool handled = false;
@@ -54,10 +57,10 @@
&& g_common_completions[i].callback != NULL)
{
handled = true;
- g_common_completions[i].callback (completion_str,
+ g_common_completions[i].callback (interpreter,
+ completion_str,
match_start_point,
max_return_elements,
- interpreter,
searcher,
matches);
}
@@ -66,20 +69,27 @@
}
int
-CommandCompletions::SourceFiles (const char *partial_file_name,
- int match_start_point,
- int max_return_elements,
- lldb_private::CommandInterpreter *interpreter,
- SearchFilter *searcher,
- lldb_private::StringList &matches)
+CommandCompletions::SourceFiles
+(
+ CommandInterpreter &interpreter,
+ const char *partial_file_name,
+ int match_start_point,
+ int max_return_elements,
+ SearchFilter *searcher,
+ StringList &matches
+)
{
// Find some way to switch "include support files..."
- SourceFileCompleter completer (false, partial_file_name, match_start_point, max_return_elements, interpreter,
+ SourceFileCompleter completer (interpreter,
+ false,
+ partial_file_name,
+ match_start_point,
+ max_return_elements,
matches);
if (searcher == NULL)
{
- lldb::TargetSP target_sp = interpreter->Context()->GetTarget()->GetSP();
+ lldb::TargetSP target_sp = interpreter.GetDebugger().GetCurrentTarget();
SearchFilter null_searcher (target_sp);
completer.DoCompletion (&null_searcher);
}
@@ -91,18 +101,25 @@
}
int
-CommandCompletions::Modules (const char *partial_file_name,
- int match_start_point,
- int max_return_elements,
- lldb_private::CommandInterpreter *interpreter,
- SearchFilter *searcher,
- lldb_private::StringList &matches)
+CommandCompletions::Modules
+(
+ CommandInterpreter &interpreter,
+ const char *partial_file_name,
+ int match_start_point,
+ int max_return_elements,
+ SearchFilter *searcher,
+ StringList &matches
+)
{
- ModuleCompleter completer(partial_file_name, match_start_point, max_return_elements, interpreter, matches);
-
+ ModuleCompleter completer (interpreter,
+ partial_file_name,
+ match_start_point,
+ max_return_elements,
+ matches);
+
if (searcher == NULL)
{
- lldb::TargetSP target_sp = interpreter->Context()->GetTarget()->GetSP();
+ lldb::TargetSP target_sp = interpreter.GetDebugger().GetCurrentTarget();
SearchFilter null_searcher (target_sp);
completer.DoCompletion (&null_searcher);
}
@@ -114,18 +131,24 @@
}
int
-CommandCompletions::Symbols (const char *partial_file_name,
- int match_start_point,
- int max_return_elements,
- lldb_private::CommandInterpreter *interpreter,
- SearchFilter *searcher,
- lldb_private::StringList &matches)
+CommandCompletions::Symbols
+(
+ CommandInterpreter &interpreter,
+ const char *partial_file_name,
+ int match_start_point,
+ int max_return_elements,
+ SearchFilter *searcher,
+ StringList &matches)
{
- SymbolCompleter completer(partial_file_name, match_start_point, max_return_elements, interpreter, matches);
+ SymbolCompleter completer (interpreter,
+ partial_file_name,
+ match_start_point,
+ max_return_elements,
+ matches);
if (searcher == NULL)
{
- lldb::TargetSP target_sp = interpreter->Context()->GetTarget()->GetSP();
+ lldb::TargetSP target_sp = interpreter.GetDebugger().GetCurrentTarget();
SearchFilter null_searcher (target_sp);
completer.DoCompletion (&null_searcher);
}
@@ -136,17 +159,18 @@
return matches.GetSize();
}
-CommandCompletions::Completer::Completer (
+CommandCompletions::Completer::Completer
+(
+ CommandInterpreter &interpreter,
const char *completion_str,
int match_start_point,
int max_return_elements,
- CommandInterpreter *interpreter,
StringList &matches
) :
+ m_interpreter (interpreter),
m_completion_str (completion_str),
m_match_start_point (match_start_point),
m_max_return_elements (max_return_elements),
- m_interpreter (interpreter),
m_matches (matches)
{
}
@@ -160,15 +184,16 @@
// SourceFileCompleter
//----------------------------------------------------------------------
-CommandCompletions::SourceFileCompleter::SourceFileCompleter (
+CommandCompletions::SourceFileCompleter::SourceFileCompleter
+(
+ CommandInterpreter &interpreter,
bool include_support_files,
const char *completion_str,
int match_start_point,
int max_return_elements,
- CommandInterpreter *interpreter,
StringList &matches
) :
- CommandCompletions::Completer (completion_str, match_start_point, max_return_elements, interpreter, matches),
+ CommandCompletions::Completer (interpreter, completion_str, match_start_point, max_return_elements, matches),
m_include_support_files (include_support_files),
m_matching_files()
{
@@ -264,14 +289,15 @@
else
return false;
}
-CommandCompletions::SymbolCompleter::SymbolCompleter (
+CommandCompletions::SymbolCompleter::SymbolCompleter
+(
+ CommandInterpreter &interpreter,
const char *completion_str,
int match_start_point,
int max_return_elements,
- CommandInterpreter *interpreter,
StringList &matches
) :
- CommandCompletions::Completer (completion_str, match_start_point, max_return_elements, interpreter, matches)
+ CommandCompletions::Completer (interpreter, completion_str, match_start_point, max_return_elements, matches)
{
std::string regex_str ("^");
regex_str.append(completion_str);
@@ -353,14 +379,15 @@
//----------------------------------------------------------------------
// ModuleCompleter
//----------------------------------------------------------------------
-CommandCompletions::ModuleCompleter::ModuleCompleter (
+CommandCompletions::ModuleCompleter::ModuleCompleter
+(
+ CommandInterpreter &interpreter,
const char *completion_str,
int match_start_point,
int max_return_elements,
- CommandInterpreter *interpreter,
StringList &matches
) :
- CommandCompletions::Completer (completion_str, match_start_point, max_return_elements, interpreter, matches)
+ CommandCompletions::Completer (interpreter, completion_str, match_start_point, max_return_elements, matches)
{
FileSpec partial_spec (m_completion_str.c_str());
m_file_name = partial_spec.GetFilename().GetCString();
Removed: lldb/trunk/source/Commands/CommandObjectAdd.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectAdd.cpp?rev=106614&view=auto
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectAdd.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectAdd.cpp (removed)
@@ -1,51 +0,0 @@
-//===-- CommandObjectAdd.cpp ------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "CommandObjectAdd.h"
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/Options.h"
-#include "lldb/Interpreter/CommandReturnObject.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-//-------------------------------------------------------------------------
-// CommandObjectAdd
-//-------------------------------------------------------------------------
-
-CommandObjectAdd::CommandObjectAdd () :
- CommandObject ("add",
- "Allows the user to add a new command/function pair to the debugger's dictionary.",
- "add <new-command-name> <script-function-name>")
-{
-}
-
-CommandObjectAdd::~CommandObjectAdd()
-{
-}
-
-
-bool
-CommandObjectAdd::Execute
-(
- Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result
-)
-{
- result.AppendMessage ("This function has not been implemented yet.");
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
- return result.Succeeded();
-}
Removed: lldb/trunk/source/Commands/CommandObjectAdd.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectAdd.h?rev=106614&view=auto
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectAdd.h (original)
+++ lldb/trunk/source/Commands/CommandObjectAdd.h (removed)
@@ -1,43 +0,0 @@
-//===-- CommandObjectAdd.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_CommandObjectAdd_h_
-#define liblldb_CommandObjectAdd_h_
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Interpreter/CommandObject.h"
-
-namespace lldb_private {
-//-------------------------------------------------------------------------
-// CommandObjectAdd
-//-------------------------------------------------------------------------
-
-class CommandObjectAdd : public CommandObject
-{
-public:
-
- CommandObjectAdd ();
-
- virtual
- ~CommandObjectAdd ();
-
- virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result);
-
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_CommandObjectAdd_h_
Modified: lldb/trunk/source/Commands/CommandObjectAlias.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectAlias.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectAlias.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectAlias.cpp Tue Jun 22 20:19:29 2010
@@ -89,8 +89,12 @@
bool
-CommandObjectAlias::Execute (Args& args, CommandContext *context, CommandInterpreter *interpreter,
- CommandReturnObject &result)
+CommandObjectAlias::Execute
+(
+ CommandInterpreter &interpreter,
+ Args& args,
+ CommandReturnObject &result
+)
{
const int argc = args.GetArgumentCount();
@@ -109,7 +113,7 @@
// Verify that the command is alias'able, and get the appropriate command object.
- if (interpreter->CommandExists (alias_command.c_str()))
+ if (interpreter.CommandExists (alias_command.c_str()))
{
result.AppendErrorWithFormat ("'%s' is a permanent debugger command and cannot be redefined.\n",
alias_command.c_str());
@@ -117,7 +121,7 @@
}
else
{
- CommandObjectSP command_obj_sp(interpreter->GetCommandSP (actual_command.c_str()));
+ CommandObjectSP command_obj_sp(interpreter.GetCommandSP (actual_command.c_str()));
CommandObjectSP subcommand_obj_sp;
bool use_subcommand = false;
if (command_obj_sp.get())
@@ -193,24 +197,24 @@
// Create the alias.
- if (interpreter->AliasExists (alias_command.c_str())
- || interpreter->UserCommandExists (alias_command.c_str()))
+ if (interpreter.AliasExists (alias_command.c_str())
+ || interpreter.UserCommandExists (alias_command.c_str()))
{
- OptionArgVectorSP tmp_option_arg_sp (interpreter->GetAliasOptions (alias_command.c_str()));
+ OptionArgVectorSP tmp_option_arg_sp (interpreter.GetAliasOptions (alias_command.c_str()));
if (tmp_option_arg_sp.get())
{
if (option_arg_vector->size() == 0)
- interpreter->RemoveAliasOptions (alias_command.c_str());
+ interpreter.RemoveAliasOptions (alias_command.c_str());
}
result.AppendWarningWithFormat ("Overwriting existing definition for '%s'.\n", alias_command.c_str());
}
if (use_subcommand)
- interpreter->AddAlias (alias_command.c_str(), subcommand_obj_sp);
+ interpreter.AddAlias (alias_command.c_str(), subcommand_obj_sp);
else
- interpreter->AddAlias (alias_command.c_str(), command_obj_sp);
+ interpreter.AddAlias (alias_command.c_str(), command_obj_sp);
if (option_arg_vector->size() > 0)
- interpreter->AddOrReplaceAliasOptions (alias_command.c_str(), option_arg_vector_sp);
+ interpreter.AddOrReplaceAliasOptions (alias_command.c_str(), option_arg_vector_sp);
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else
Modified: lldb/trunk/source/Commands/CommandObjectAlias.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectAlias.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectAlias.h (original)
+++ lldb/trunk/source/Commands/CommandObjectAlias.h Tue Jun 22 20:19:29 2010
@@ -32,9 +32,8 @@
~CommandObjectAlias ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
};
Modified: lldb/trunk/source/Commands/CommandObjectAppend.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectAppend.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectAppend.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectAppend.cpp Tue Jun 22 20:19:29 2010
@@ -37,9 +37,8 @@
bool
CommandObjectAppend::Execute
(
+ CommandInterpreter &interpreter,
Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
@@ -64,7 +63,7 @@
}
else
{
- StateVariable *var = interpreter->GetStateVariable(var_name);
+ StateVariable *var = interpreter.GetStateVariable(var_name);
if (var == NULL)
{
result.AppendErrorWithFormat ("'%s' is not a settable internal variable.\n", var_name);
Modified: lldb/trunk/source/Commands/CommandObjectAppend.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectAppend.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectAppend.h (original)
+++ lldb/trunk/source/Commands/CommandObjectAppend.h Tue Jun 22 20:19:29 2010
@@ -30,9 +30,8 @@
~CommandObjectAppend ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
Modified: lldb/trunk/source/Commands/CommandObjectApropos.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectApropos.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectApropos.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectApropos.cpp Tue Jun 22 20:19:29 2010
@@ -40,14 +40,18 @@
bool
-CommandObjectApropos::Execute (Args &command, CommandContext *context, CommandInterpreter *interpreter,
- CommandReturnObject &result)
+CommandObjectApropos::Execute
+(
+ CommandInterpreter &interpreter,
+ Args& args,
+ CommandReturnObject &result
+)
{
- const int argc = command.GetArgumentCount ();
+ const int argc = args.GetArgumentCount ();
if (argc == 1)
{
- const char *search_word = command.GetArgumentAtIndex(0);
+ const char *search_word = args.GetArgumentAtIndex(0);
if ((search_word != NULL)
&& (strlen (search_word) > 0))
{
@@ -55,7 +59,7 @@
// is private.
StringList commands_found;
StringList commands_help;
- interpreter->FindCommandsForApropos (search_word, commands_found, commands_help);
+ interpreter.FindCommandsForApropos (search_word, commands_found, commands_help);
if (commands_found.GetSize() == 0)
{
result.AppendMessageWithFormat ("No commands found pertaining to '%s'.", search_word);
@@ -74,8 +78,11 @@
}
for (int i = 0; i < commands_found.GetSize(); ++i)
- interpreter->OutputFormattedHelpText (result.GetOutputStream(), commands_found.GetStringAtIndex(i),
- "--", commands_help.GetStringAtIndex(i), max_len);
+ interpreter.OutputFormattedHelpText (result.GetOutputStream(),
+ commands_found.GetStringAtIndex(i),
+ "--", commands_help.
+ GetStringAtIndex(i),
+ max_len);
}
result.SetStatus (eReturnStatusSuccessFinishNoResult);
Modified: lldb/trunk/source/Commands/CommandObjectApropos.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectApropos.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectApropos.h (original)
+++ lldb/trunk/source/Commands/CommandObjectApropos.h Tue Jun 22 20:19:29 2010
@@ -32,9 +32,8 @@
~CommandObjectApropos ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
Modified: lldb/trunk/source/Commands/CommandObjectArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectArgs.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectArgs.cpp Tue Jun 22 20:19:29 2010
@@ -20,7 +20,7 @@
#include "lldb/Expression/ClangFunction.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/CommandContext.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Variable.h"
@@ -95,14 +95,17 @@
}
bool
-CommandObjectArgs::Execute(Args &command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result)
+CommandObjectArgs::Execute
+(
+ CommandInterpreter &interpreter,
+ Args& args,
+ CommandReturnObject &result
+)
{
ConstString target_triple;
- Process *process = context->GetExecutionContext().process;
+
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (!process)
{
result.AppendError ("Args found no process.");
@@ -118,7 +121,7 @@
return false;
}
- int num_args = command.GetArgumentCount ();
+ int num_args = args.GetArgumentCount ();
int arg_index;
if (!num_args)
@@ -128,7 +131,7 @@
return false;
}
- Thread *thread = context->GetExecutionContext ().thread;
+ Thread *thread = interpreter.GetDebugger().GetExecutionContext ().thread;
if (!thread)
{
@@ -167,7 +170,7 @@
for (arg_index = 0; arg_index < num_args; ++arg_index)
{
- const char *arg_type_cstr = command.GetArgumentAtIndex(arg_index);
+ const char *arg_type_cstr = args.GetArgumentAtIndex(arg_index);
Value value;
value.SetValueType(Value::eValueTypeScalar);
void *type;
@@ -262,7 +265,7 @@
for (arg_index = 0; arg_index < num_args; ++arg_index)
{
- result.GetOutputStream ().Printf ("%d (%s): ", arg_index, command.GetArgumentAtIndex (arg_index));
+ result.GetOutputStream ().Printf ("%d (%s): ", arg_index, args.GetArgumentAtIndex (arg_index));
value_list.GetValueAtIndex (arg_index)->Dump (&result.GetOutputStream ());
result.GetOutputStream ().Printf("\n");
}
Modified: lldb/trunk/source/Commands/CommandObjectArgs.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectArgs.h (original)
+++ lldb/trunk/source/Commands/CommandObjectArgs.h Tue Jun 22 20:19:29 2010
@@ -58,9 +58,8 @@
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
virtual bool
Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Tue Jun 22 20:19:29 2010
@@ -32,7 +32,7 @@
using namespace lldb_private;
static void
-AddBreakpointDescription (CommandContext *context, StreamString *s, Breakpoint *bp, lldb::DescriptionLevel level)
+AddBreakpointDescription (StreamString *s, Breakpoint *bp, lldb::DescriptionLevel level)
{
s->IndentMore();
bp->GetDescription (s, level, true);
@@ -240,13 +240,12 @@
bool
CommandObjectBreakpointSet::Execute
(
+ CommandInterpreter &interpreter,
Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
result.AppendError ("Invalid target, set executable file using 'file' command.");
@@ -287,7 +286,7 @@
FileSpec file;
if (m_options.m_filename.empty())
{
- StackFrame *cur_frame = context->GetExecutionContext().frame;
+ StackFrame *cur_frame = interpreter.GetDebugger().GetExecutionContext().frame;
if (cur_frame == NULL)
{
result.AppendError ("Attempting to set breakpoint by line number alone with no selected frame.");
@@ -458,7 +457,7 @@
//-------------------------------------------------------------------------
#pragma mark MultiwordBreakpoint
-CommandObjectMultiwordBreakpoint::CommandObjectMultiwordBreakpoint (CommandInterpreter *interpreter) :
+CommandObjectMultiwordBreakpoint::CommandObjectMultiwordBreakpoint (CommandInterpreter &interpreter) :
CommandObjectMultiword ("breakpoint",
"A set of commands for operating on breakpoints.",
"breakpoint <command> [<command-options>]")
@@ -480,13 +479,13 @@
modify_command_object->SetCommandName ("breakpoint modify");
set_command_object->SetCommandName("breakpoint set");
- status = LoadSubCommand (list_command_object, "list", interpreter);
- status = LoadSubCommand (enable_command_object, "enable", interpreter);
- status = LoadSubCommand (disable_command_object, "disable", interpreter);
- status = LoadSubCommand (delete_command_object, "delete", interpreter);
- status = LoadSubCommand (set_command_object, "set", interpreter);
- status = LoadSubCommand (command_command_object, "command", interpreter);
- status = LoadSubCommand (modify_command_object, "modify", interpreter);
+ status = LoadSubCommand (interpreter, "list", list_command_object);
+ status = LoadSubCommand (interpreter, "enable", enable_command_object);
+ status = LoadSubCommand (interpreter, "disable", disable_command_object);
+ status = LoadSubCommand (interpreter, "delete", delete_command_object);
+ status = LoadSubCommand (interpreter, "set", set_command_object);
+ status = LoadSubCommand (interpreter, "command", command_command_object);
+ status = LoadSubCommand (interpreter, "modify", modify_command_object);
}
CommandObjectMultiwordBreakpoint::~CommandObjectMultiwordBreakpoint ()
@@ -653,13 +652,12 @@
bool
CommandObjectBreakpointList::Execute
(
+ CommandInterpreter &interpreter,
Args& args,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
result.AppendError ("Invalid target, set executable file using 'file' command.");
@@ -689,7 +687,7 @@
for (int i = 0; i < num_breakpoints; ++i)
{
Breakpoint *breakpoint = breakpoints.GetBreakpointByIndex (i).get();
- AddBreakpointDescription (context, &output_stream, breakpoint, m_options.m_level);
+ AddBreakpointDescription (&output_stream, breakpoint, m_options.m_level);
}
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
@@ -705,7 +703,7 @@
{
BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
Breakpoint *breakpoint = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get();
- AddBreakpointDescription (context, &output_stream, breakpoint, m_options.m_level);
+ AddBreakpointDescription (&output_stream, breakpoint, m_options.m_level);
}
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
@@ -743,10 +741,14 @@
bool
-CommandObjectBreakpointEnable::Execute (Args& args, CommandContext *context,
- CommandInterpreter *interpreter, CommandReturnObject &result)
+CommandObjectBreakpointEnable::Execute
+(
+ CommandInterpreter &interpreter,
+ Args& args,
+ CommandReturnObject &result
+)
{
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
result.AppendError ("Invalid target, set executable file using 'file' command.");
@@ -838,10 +840,14 @@
}
bool
-CommandObjectBreakpointDisable::Execute (Args& args, CommandContext *context,
- CommandInterpreter *interpreter, CommandReturnObject &result)
+CommandObjectBreakpointDisable::Execute
+(
+ CommandInterpreter &interpreter,
+ Args& args,
+ CommandReturnObject &result
+)
{
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
result.AppendError ("Invalid target, set executable file using 'file' command.");
@@ -929,10 +935,14 @@
}
bool
-CommandObjectBreakpointDelete::Execute (Args& args, CommandContext *context,
- CommandInterpreter *interpreter, CommandReturnObject &result)
+CommandObjectBreakpointDelete::Execute
+(
+ CommandInterpreter &interpreter,
+ Args& args,
+ CommandReturnObject &result
+)
{
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
result.AppendError ("Invalid target, set executable file using 'file' command.");
@@ -1163,9 +1173,8 @@
bool
CommandObjectBreakpointModify::Execute
(
+ CommandInterpreter &interpreter,
Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
@@ -1176,7 +1185,7 @@
return false;
}
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
result.AppendError ("Invalid target, set executable file using 'file' command.");
Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.h (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.h Tue Jun 22 20:19:29 2010
@@ -32,7 +32,7 @@
class CommandObjectMultiwordBreakpoint : public CommandObjectMultiword
{
public:
- CommandObjectMultiwordBreakpoint (CommandInterpreter *interpreter);
+ CommandObjectMultiwordBreakpoint (CommandInterpreter &interpreter);
virtual
~CommandObjectMultiwordBreakpoint ();
@@ -66,9 +66,8 @@
~CommandObjectBreakpointSet ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
virtual Options *
@@ -133,9 +132,8 @@
~CommandObjectBreakpointModify ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
virtual Options *
@@ -194,9 +192,8 @@
~CommandObjectBreakpointEnable ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
private:
@@ -215,9 +212,8 @@
~CommandObjectBreakpointDisable ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
private:
@@ -236,9 +232,8 @@
~CommandObjectBreakpointList ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
virtual Options *
@@ -290,9 +285,8 @@
~CommandObjectBreakpointDelete ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
private:
Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Tue Jun 22 20:19:29 2010
@@ -208,13 +208,12 @@
bool
CommandObjectBreakpointCommandAdd::Execute
(
+ CommandInterpreter &interpreter,
Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
@@ -258,12 +257,12 @@
{
if (m_options.m_use_script_language)
{
- interpreter->GetScriptInterpreter()->CollectDataForBreakpointCommandCallback (bp_loc_sp->GetLocationOptions(),
+ interpreter.GetScriptInterpreter()->CollectDataForBreakpointCommandCallback (bp_loc_sp->GetLocationOptions(),
result);
}
else
{
- CollectDataForBreakpointCommandCallback (bp_loc_sp->GetLocationOptions(), result);
+ CollectDataForBreakpointCommandCallback (interpreter, bp_loc_sp->GetLocationOptions(), result);
}
}
}
@@ -271,12 +270,12 @@
{
if (m_options.m_use_script_language)
{
- interpreter->GetScriptInterpreter()->CollectDataForBreakpointCommandCallback (bp->GetOptions(),
+ interpreter.GetScriptInterpreter()->CollectDataForBreakpointCommandCallback (bp->GetOptions(),
result);
}
else
{
- CollectDataForBreakpointCommandCallback (bp->GetOptions(), result);
+ CollectDataForBreakpointCommandCallback (interpreter, bp->GetOptions(), result);
}
}
}
@@ -297,11 +296,12 @@
void
CommandObjectBreakpointCommandAdd::CollectDataForBreakpointCommandCallback
(
+ CommandInterpreter &interpreter,
BreakpointOptions *bp_options,
CommandReturnObject &result
)
{
- InputReaderSP reader_sp (new InputReader());
+ InputReaderSP reader_sp (new InputReader(interpreter.GetDebugger()));
std::auto_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
if (reader_sp && data_ap.get())
{
@@ -316,7 +316,7 @@
true)); // echo input
if (err.Success())
{
- Debugger::GetSharedInstance().PushInputReader (reader_sp);
+ interpreter.GetDebugger().PushInputReader (reader_sp);
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else
@@ -337,13 +337,13 @@
CommandObjectBreakpointCommandAdd::GenerateBreakpointCommandCallback
(
void *baton,
- InputReader *reader,
+ InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len
)
{
- FILE *out_fh = Debugger::GetSharedInstance().GetOutputFileHandle();
+ FILE *out_fh = reader.GetDebugger().GetOutputFileHandle();
switch (notification)
{
@@ -351,8 +351,8 @@
if (out_fh)
{
::fprintf (out_fh, "%s\n", g_reader_instructions);
- if (reader->GetPrompt())
- ::fprintf (out_fh, "%s", reader->GetPrompt());
+ if (reader.GetPrompt())
+ ::fprintf (out_fh, "%s", reader.GetPrompt());
}
break;
@@ -360,8 +360,8 @@
break;
case eInputReaderReactivate:
- if (out_fh && reader->GetPrompt())
- ::fprintf (out_fh, "%s", reader->GetPrompt());
+ if (out_fh && reader.GetPrompt())
+ ::fprintf (out_fh, "%s", reader.GetPrompt());
break;
case eInputReaderGotToken:
@@ -375,8 +375,8 @@
((BreakpointOptions::CommandData *)bp_options_baton->m_data)->user_source.AppendString (bytes, bytes_len);
}
}
- if (out_fh && !reader->IsDone() && reader->GetPrompt())
- ::fprintf (out_fh, "%s", reader->GetPrompt());
+ if (out_fh && !reader.IsDone() && reader.GetPrompt())
+ ::fprintf (out_fh, "%s", reader.GetPrompt());
break;
case eInputReaderDone:
@@ -403,12 +403,14 @@
}
bool
-CommandObjectBreakpointCommandRemove::Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result)
+CommandObjectBreakpointCommandRemove::Execute
+(
+ CommandInterpreter &interpreter,
+ Args& command,
+ CommandReturnObject &result
+)
{
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
@@ -486,12 +488,14 @@
}
bool
-CommandObjectBreakpointCommandList::Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result)
+CommandObjectBreakpointCommandList::Execute
+(
+ CommandInterpreter &interpreter,
+ Args& command,
+ CommandReturnObject &result
+)
{
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
@@ -587,7 +591,7 @@
// CommandObjectBreakpointCommand
//-------------------------------------------------------------------------
-CommandObjectBreakpointCommand::CommandObjectBreakpointCommand (CommandInterpreter *interpreter) :
+CommandObjectBreakpointCommand::CommandObjectBreakpointCommand (CommandInterpreter &interpreter) :
CommandObjectMultiword ("command",
"A set of commands for adding, removing and examining bits of code to be executed when the breakpoint is hit (breakpoint 'commmands').",
"command <sub-command> [<sub-command-options>] <breakpoint-id>")
@@ -601,9 +605,9 @@
remove_command_object->SetCommandName ("breakpoint command remove");
list_command_object->SetCommandName ("breakpoint command list");
- status = LoadSubCommand (add_command_object, "add", interpreter);
- status = LoadSubCommand (remove_command_object, "remove", interpreter);
- status = LoadSubCommand (list_command_object, "list", interpreter);
+ status = LoadSubCommand (interpreter, "add", add_command_object);
+ status = LoadSubCommand (interpreter, "remove", remove_command_object);
+ status = LoadSubCommand (interpreter, "list", list_command_object);
}
@@ -631,63 +635,61 @@
if (commands.GetSize() > 0)
{
uint32_t num_commands = commands.GetSize();
- CommandInterpreter &interpreter = Debugger::GetSharedInstance().GetCommandInterpreter();
CommandReturnObject result;
- ExecutionContext exe_ctx = context->context;
-
- FILE *out_fh = Debugger::GetSharedInstance().GetOutputFileHandle();
- FILE *err_fh = Debugger::GetSharedInstance().GetErrorFileHandle();
-
-
- uint32_t i;
- for (i = 0; i < num_commands; ++i)
+ if (context->exe_ctx.target)
{
-
- // First time through we use the context from the stoppoint, after that we use whatever
- // has been set by the previous command.
-
- if (!interpreter.HandleCommand (commands.GetStringAtIndex(i), false, result, &exe_ctx))
- break;
+
+ Debugger &debugger = context->exe_ctx.target->GetDebugger();
+ CommandInterpreter &interpreter = debugger.GetCommandInterpreter();
+
+ FILE *out_fh = debugger.GetOutputFileHandle();
+ FILE *err_fh = debugger.GetErrorFileHandle();
- // FIXME: This isn't really the right way to do this. We should be able to peek at the public
- // to see if there is any new events, but that is racey, since the internal process thread has to run and
- // deliver the event to the public queue before a run will show up. So for now we check
- // the internal thread state.
-
- lldb::StateType internal_state = exe_ctx.process->GetPrivateState();
- if (internal_state != eStateStopped)
+ uint32_t i;
+ for (i = 0; i < num_commands; ++i)
{
- if (i < num_commands - 1)
+
+ // First time through we use the context from the stoppoint, after that we use whatever
+ // has been set by the previous command.
+
+ if (!interpreter.HandleCommand (commands.GetStringAtIndex(i), false, result, &context->exe_ctx))
+ break;
+
+ // FIXME: This isn't really the right way to do this. We should be able to peek at the public
+ // to see if there is any new events, but that is racey, since the internal process thread has to run and
+ // deliver the event to the public queue before a run will show up. So for now we check
+ // the internal thread state.
+
+ lldb::StateType internal_state = context->exe_ctx.process->GetPrivateState();
+ if (internal_state != eStateStopped)
{
- if (out_fh)
- ::fprintf (out_fh, "Short-circuiting command execution because target state changed to %s."
- " last command: \"%s\"\n", StateAsCString(internal_state),
- commands.GetStringAtIndex(i));
+ if (i < num_commands - 1)
+ {
+ if (out_fh)
+ ::fprintf (out_fh, "Short-circuiting command execution because target state changed to %s."
+ " last command: \"%s\"\n", StateAsCString(internal_state),
+ commands.GetStringAtIndex(i));
+ }
+ break;
}
- break;
+
+ if (out_fh)
+ ::fprintf (out_fh, "%s", result.GetErrorStream().GetData());
+ if (err_fh)
+ ::fprintf (err_fh, "%s", result.GetOutputStream().GetData());
+ result.Clear();
+ result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
-
- // First time through we use the context from the stoppoint, after that we use whatever
- // has been set by the previous command.
- exe_ctx = Debugger::GetSharedInstance().GetCurrentExecutionContext();
-
+ if (err_fh && !result.Succeeded() && i < num_commands)
+ ::fprintf (err_fh, "Attempt to execute '%s' failed.\n", commands.GetStringAtIndex(i));
+
if (out_fh)
::fprintf (out_fh, "%s", result.GetErrorStream().GetData());
+
if (err_fh)
- ::fprintf (err_fh, "%s", result.GetOutputStream().GetData());
- result.Clear();
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
+ ::fprintf (err_fh, "%s", result.GetOutputStream().GetData());
}
-
- if (err_fh && !result.Succeeded() && i < num_commands)
- ::fprintf (err_fh, "Attempt to execute '%s' failed.\n", commands.GetStringAtIndex(i));
-
- if (out_fh)
- ::fprintf (out_fh, "%s", result.GetErrorStream().GetData());
-
- if (err_fh)
- ::fprintf (err_fh, "%s", result.GetOutputStream().GetData());
}
return ret_value;
}
Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h Tue Jun 22 20:19:29 2010
@@ -34,7 +34,7 @@
class CommandObjectBreakpointCommand : public CommandObjectMultiword
{
public:
- CommandObjectBreakpointCommand (CommandInterpreter *interpreter);
+ CommandObjectBreakpointCommand (CommandInterpreter &interpreter);
virtual
~CommandObjectBreakpointCommand ();
@@ -62,21 +62,21 @@
~CommandObjectBreakpointCommandAdd ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
virtual Options *
GetOptions ();
void
- CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options,
+ CollectDataForBreakpointCommandCallback (CommandInterpreter &interpreter,
+ BreakpointOptions *bp_options,
CommandReturnObject &result);
static size_t
GenerateBreakpointCommandCallback (void *baton,
- InputReader *reader,
+ InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len);
@@ -134,9 +134,8 @@
~CommandObjectBreakpointCommandRemove ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
private:
@@ -155,9 +154,8 @@
~CommandObjectBreakpointCommandList ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
private:
Modified: lldb/trunk/source/Commands/CommandObjectCall.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCall.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCall.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCall.cpp Tue Jun 22 20:19:29 2010
@@ -20,7 +20,7 @@
#include "lldb/Expression/ClangFunction.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/CommandContext.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Variable.h"
@@ -128,23 +128,21 @@
bool
CommandObjectCall::Execute
(
+ CommandInterpreter &interpreter,
Args &command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
ConstString target_triple;
int num_args = command.GetArgumentCount();
- Target *target = context->GetTarget ();
- if (target)
- target->GetTargetTriple(target_triple);
+ ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
+ if (exe_ctx.target)
+ exe_ctx.target->GetTargetTriple(target_triple);
if (!target_triple)
target_triple = Host::GetTargetTriple ();
- ExecutionContext exe_ctx(context->GetExecutionContext());
if (exe_ctx.thread == NULL || exe_ctx.frame == NULL)
{
result.AppendError ("No currently selected thread and frame.");
@@ -215,7 +213,7 @@
val.SetValueType (Value::eValueTypeHostAddress);
- void *cstr_type = target->GetScratchClangASTContext()->GetCStringType(true);
+ void *cstr_type = exe_ctx.target->GetScratchClangASTContext()->GetCStringType(true);
val.SetContext (Value::eContextTypeOpaqueClangQualType, cstr_type);
value_list.PushValue(val);
@@ -233,7 +231,7 @@
// run it:
StreamString errors;
- ClangFunction clang_fun (target_triple.GetCString(), *target_fn, target->GetScratchClangASTContext(), value_list);
+ ClangFunction clang_fun (target_triple.GetCString(), *target_fn, exe_ctx.target->GetScratchClangASTContext(), value_list);
if (m_options.noexecute)
{
// Now write down the argument values for this call.
Modified: lldb/trunk/source/Commands/CommandObjectCall.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCall.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCall.h (original)
+++ lldb/trunk/source/Commands/CommandObjectCall.h Tue Jun 22 20:19:29 2010
@@ -66,9 +66,8 @@
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
virtual bool
Modified: lldb/trunk/source/Commands/CommandObjectCrossref.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCrossref.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCrossref.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCrossref.cpp Tue Jun 22 20:19:29 2010
@@ -40,9 +40,8 @@
bool
CommandObjectCrossref::Execute
(
+ CommandInterpreter &interpreter,
Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Tue Jun 22 20:19:29 2010
@@ -155,8 +155,7 @@
void
CommandObjectDisassemble::Disassemble
(
- CommandContext *context,
- CommandInterpreter *interpreter,
+ CommandInterpreter &interpreter,
CommandReturnObject &result,
Disassembler *disassembler,
const SymbolContextList &sc_list
@@ -171,11 +170,11 @@
break;
if (sc.GetAddressRange(eSymbolContextFunction | eSymbolContextSymbol, range))
{
- lldb::addr_t addr = range.GetBaseAddress().GetLoadAddress(context->GetExecutionContext().process);
+ lldb::addr_t addr = range.GetBaseAddress().GetLoadAddress(interpreter.GetDebugger().GetExecutionContext().process);
if (addr != LLDB_INVALID_ADDRESS)
{
lldb::addr_t end_addr = addr + range.GetByteSize();
- Disassemble (context, interpreter, result, disassembler, addr, end_addr);
+ Disassemble (interpreter, result, disassembler, addr, end_addr);
}
}
}
@@ -184,8 +183,7 @@
void
CommandObjectDisassemble::Disassemble
(
- CommandContext *context,
- CommandInterpreter *interpreter,
+ CommandInterpreter &interpreter,
CommandReturnObject &result,
Disassembler *disassembler,
lldb::addr_t addr,
@@ -198,7 +196,7 @@
if (end_addr == LLDB_INVALID_ADDRESS || addr >= end_addr)
end_addr = addr + DEFAULT_DISASM_BYTE_SIZE;
- ExecutionContext exe_ctx (context->GetExecutionContext());
+ ExecutionContext exe_ctx (interpreter.GetDebugger().GetExecutionContext());
DataExtractor data;
size_t bytes_disassembled = disassembler->ParseInstructions (&exe_ctx, eAddressTypeLoad, addr, end_addr - addr, data);
if (bytes_disassembled == 0)
@@ -225,7 +223,7 @@
lldb::addr_t curr_addr = addr + offset;
if (m_options.show_mixed)
{
- Process *process = context->GetExecutionContext().process;
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (!sc_range.ContainsLoadAddress (curr_addr, process))
{
prev_sc = sc;
@@ -248,7 +246,7 @@
output_stream.EOL();
if (sc.comp_unit && sc.line_entry.IsValid())
{
- interpreter->GetSourceManager().DisplaySourceLinesWithLineNumbers (
+ interpreter.GetDebugger().GetSourceManager().DisplaySourceLinesWithLineNumbers (
sc.line_entry.file,
sc.line_entry.line,
m_options.num_lines_context,
@@ -286,13 +284,12 @@
bool
CommandObjectDisassemble::Execute
(
+ CommandInterpreter &interpreter,
Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
result.AppendError ("invalid target, set executable file using 'file' command");
@@ -353,7 +350,7 @@
}
else
{
- ExecutionContext exe_ctx(context->GetExecutionContext());
+ ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
if (exe_ctx.frame)
{
SymbolContext sc(exe_ctx.frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol));
@@ -394,11 +391,11 @@
if (target->GetImages().FindFunctions(name, sc_list))
{
- Disassemble (context, interpreter, result, disassembler, sc_list);
+ Disassemble (interpreter, result, disassembler, sc_list);
}
else if (target->GetImages().FindSymbolsWithNameAndType(name, eSymbolTypeCode, sc_list))
{
- Disassemble (context, interpreter, result, disassembler, sc_list);
+ Disassemble (interpreter, result, disassembler, sc_list);
}
else
{
@@ -409,7 +406,7 @@
}
else
{
- Disassemble (context, interpreter, result, disassembler, addr, end_addr);
+ Disassemble (interpreter, result, disassembler, addr, end_addr);
}
return result.Succeeded();
Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectDisassemble.h (original)
+++ lldb/trunk/source/Commands/CommandObjectDisassemble.h Tue Jun 22 20:19:29 2010
@@ -67,25 +67,22 @@
}
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
protected:
CommandOptions m_options;
void
- Disassemble (CommandContext *context,
- CommandInterpreter *interpreter,
+ Disassemble (CommandInterpreter &interpreter,
CommandReturnObject &result,
Disassembler *disassembler,
lldb::addr_t addr,
lldb::addr_t end_addr);
void
- Disassemble (CommandContext *context,
- CommandInterpreter *interpreter,
+ Disassemble (CommandInterpreter &interpreter,
CommandReturnObject &result,
Disassembler *disassembler,
const SymbolContextList &sc_list);
Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Tue Jun 22 20:19:29 2010
@@ -21,7 +21,8 @@
#include "lldb/Expression/ClangExpressionVariable.h"
#include "lldb/Expression/DWARFExpression.h"
#include "lldb/Host/Host.h"
-#include "lldb/Interpreter/CommandContext.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Variable.h"
@@ -124,9 +125,8 @@
bool
CommandObjectExpression::Execute
(
+ CommandInterpreter &interpreter,
Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
@@ -138,24 +138,22 @@
CommandObjectExpression::MultiLineExpressionCallback
(
void *baton,
- InputReader *reader,
+ InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len
)
{
- FILE *out_fh = Debugger::GetSharedInstance().GetOutputFileHandle();
CommandObjectExpression *cmd_object_expr = (CommandObjectExpression *) baton;
switch (notification)
{
case eInputReaderActivate:
- if (out_fh)
- ::fprintf (out_fh, "%s\n", "Enter expressions, then terminate with an empty line to evaluate:");
+ reader.GetDebugger().GetOutputStream().Printf("%s\n", "Enter expressions, then terminate with an empty line to evaluate:");
// Fall through
case eInputReaderReactivate:
//if (out_fh)
- // ::fprintf (out_fh, "%3u: ", cmd_object_expr->m_expr_line_count);
+ // reader.GetDebugger().GetOutputStream().Printf ("%3u: ", cmd_object_expr->m_expr_line_count);
break;
case eInputReaderDeactivate:
@@ -169,20 +167,18 @@
}
if (bytes_len == 0)
- reader->SetIsDone(true);
+ reader.SetIsDone(true);
//else if (out_fh && !reader->IsDone())
// ::fprintf (out_fh, "%3u: ", cmd_object_expr->m_expr_line_count);
break;
case eInputReaderDone:
{
- StreamFile out_stream(Debugger::GetSharedInstance().GetOutputFileHandle());
- StreamFile err_stream(Debugger::GetSharedInstance().GetErrorFileHandle());
bool bare = false;
cmd_object_expr->EvaluateExpression (cmd_object_expr->m_expr_lines.c_str(),
bare,
- out_stream,
- err_stream);
+ reader.GetDebugger().GetOutputStream(),
+ reader.GetDebugger().GetErrorStream());
}
break;
}
@@ -329,21 +325,20 @@
bool
CommandObjectExpression::ExecuteRawCommandString
(
+ CommandInterpreter &interpreter,
const char *command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
ConstString target_triple;
- Target *target = context->GetTarget ();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target)
target->GetTargetTriple(target_triple);
if (!target_triple)
target_triple = Host::GetTargetTriple ();
- ExecutionContext exe_ctx(context->GetExecutionContext());
+ ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
Stream &output_stream = result.GetOutputStream();
@@ -356,18 +351,18 @@
m_expr_lines.clear();
m_expr_line_count = 0;
- InputReaderSP reader_sp (new InputReader());
+ InputReaderSP reader_sp (new InputReader(interpreter.GetDebugger()));
if (reader_sp)
{
Error err (reader_sp->Initialize (CommandObjectExpression::MultiLineExpressionCallback,
this, // baton
eInputReaderGranularityLine, // token size, to pass to callback function
- NULL, // end token
+ NULL, // end token
NULL, // prompt
true)); // echo input
if (err.Success())
{
- Debugger::GetSharedInstance().PushInputReader (reader_sp);
+ interpreter.GetDebugger().PushInputReader (reader_sp);
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else
@@ -408,8 +403,8 @@
if (end_options)
{
- Args args(command, end_options - command);
- if (!ParseOptions(args, interpreter, result))
+ Args args (command, end_options - command);
+ if (!ParseOptions (interpreter, args, result))
return false;
}
}
Modified: lldb/trunk/source/Commands/CommandObjectExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.h (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.h Tue Jun 22 20:19:29 2010
@@ -65,25 +65,23 @@
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
virtual bool
WantsRawCommandString() { return true; }
virtual bool
- ExecuteRawCommandString (const char *command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ ExecuteRawCommandString (CommandInterpreter &interpreter,
+ const char *command,
CommandReturnObject &result);
protected:
static size_t
MultiLineExpressionCallback (void *baton,
- InputReader *reader,
+ InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len);
Modified: lldb/trunk/source/Commands/CommandObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFile.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFile.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFile.cpp Tue Jun 22 20:19:29 2010
@@ -16,7 +16,7 @@
#include "lldb/Interpreter/Args.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Timer.h"
-#include "lldb/Interpreter/CommandContext.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Target/Process.h"
@@ -104,9 +104,8 @@
bool
CommandObjectFile::Execute
(
+ CommandInterpreter &interpreter,
Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
@@ -135,8 +134,8 @@
if (!arch.IsValid())
arch = LLDB_ARCH_DEFAULT;
}
-
- Error error = Debugger::GetSharedInstance().GetTargetList().CreateTarget (file_spec, arch, NULL, true, target_sp);
+ Debugger &debugger = interpreter.GetDebugger();
+ Error error = debugger.GetTargetList().CreateTarget (debugger, file_spec, arch, NULL, true, target_sp);
if (error.Fail() && !m_options.m_arch.IsValid())
{
@@ -144,12 +143,12 @@
arch = LLDB_ARCH_DEFAULT_64BIT;
else
arch = LLDB_ARCH_DEFAULT_32BIT;
- error = Debugger::GetSharedInstance().GetTargetList().CreateTarget (file_spec, arch, NULL, true, target_sp);
+ error = debugger.GetTargetList().CreateTarget (debugger, file_spec, arch, NULL, true, target_sp);
}
if (target_sp)
{
- Debugger::GetSharedInstance().GetTargetList().SetCurrentTarget(target_sp.get());
+ debugger.GetTargetList().SetCurrentTarget(target_sp.get());
result.AppendMessageWithFormat ("Current executable set to '%s' (%s).\n", file_path, arch.AsCString());
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
Modified: lldb/trunk/source/Commands/CommandObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFile.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFile.h (original)
+++ lldb/trunk/source/Commands/CommandObjectFile.h Tue Jun 22 20:19:29 2010
@@ -34,9 +34,8 @@
~CommandObjectFile ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
virtual Options *
Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Tue Jun 22 20:19:29 2010
@@ -16,7 +16,7 @@
#include "lldb/Interpreter/Args.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Timer.h"
-#include "lldb/Interpreter/CommandContext.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Target/Process.h"
@@ -51,12 +51,11 @@
}
bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- ExecutionContext exe_ctx(context->GetExecutionContext());
+ ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
if (exe_ctx.frame)
{
exe_ctx.frame->Dump (&result.GetOutputStream(), true);
@@ -95,12 +94,11 @@
}
bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- ExecutionContext exe_ctx (context->GetExecutionContext());
+ ExecutionContext exe_ctx (interpreter.GetDebugger().GetExecutionContext());
if (exe_ctx.thread)
{
if (command.GetArgumentCount() == 1)
@@ -156,13 +154,13 @@
// CommandObjectMultiwordFrame
//-------------------------------------------------------------------------
-CommandObjectMultiwordFrame::CommandObjectMultiwordFrame (CommandInterpreter *interpreter) :
+CommandObjectMultiwordFrame::CommandObjectMultiwordFrame (CommandInterpreter &interpreter) :
CommandObjectMultiword ("frame",
"A set of commands for operating on the current thread's frames.",
"frame <subcommand> [<subcommand-options>]")
{
- LoadSubCommand (CommandObjectSP (new CommandObjectFrameInfo ()), "info", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectFrameSelect ()), "select", interpreter);
+ LoadSubCommand (interpreter, "info", CommandObjectSP (new CommandObjectFrameInfo ()));
+ LoadSubCommand (interpreter, "select", CommandObjectSP (new CommandObjectFrameSelect ()));
}
CommandObjectMultiwordFrame::~CommandObjectMultiwordFrame ()
Modified: lldb/trunk/source/Commands/CommandObjectFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.h (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.h Tue Jun 22 20:19:29 2010
@@ -28,7 +28,7 @@
{
public:
- CommandObjectMultiwordFrame (CommandInterpreter *interpreter);
+ CommandObjectMultiwordFrame (CommandInterpreter &interpreter);
virtual
~CommandObjectMultiwordFrame ();
Modified: lldb/trunk/source/Commands/CommandObjectHelp.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectHelp.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectHelp.cpp Tue Jun 22 20:19:29 2010
@@ -38,133 +38,29 @@
bool
-CommandObjectHelp::OldExecute
-(
- Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result
-)
-{
- CommandObject::CommandMap::iterator pos;
- CommandObject *cmd_obj;
-
- const int argc = command.GetArgumentCount();
- if (argc > 0)
- {
- cmd_obj = interpreter->GetCommandObject (command.GetArgumentAtIndex(0), false, false);
- if (cmd_obj == NULL)
- {
- cmd_obj = interpreter->GetCommandObject (command.GetArgumentAtIndex(0), true, false);
- if (cmd_obj != NULL)
- {
- StreamString alias_help_str;
- interpreter->GetAliasHelp (command.GetArgumentAtIndex(0), cmd_obj->GetCommandName(), alias_help_str);
- result.AppendMessageWithFormat ("'%s' is an alias for %s.\n", command.GetArgumentAtIndex (0),
- alias_help_str.GetData());
- }
- }
-
- if (cmd_obj)
- {
- Stream &output_strm = result.GetOutputStream();
- if (cmd_obj->GetOptions() != NULL)
- {
- const char * long_help = cmd_obj->GetHelpLong();
- if ((long_help!= NULL)
- && strlen (long_help) > 0)
- output_strm.Printf ("\n%s", cmd_obj->GetHelpLong());
- else
- output_strm.Printf ("\n%s\n", cmd_obj->GetHelp());
- output_strm.Printf ("\nSyntax: %s\n", cmd_obj->GetSyntax());
- cmd_obj->GetOptions()->GenerateOptionUsage (output_strm, cmd_obj);
- }
- else if (cmd_obj->IsMultiwordObject())
- {
- bool done = false;
- if (argc > 1)
- {
- CommandObject::CommandMap::iterator pos;
- std::string sub_command = command.GetArgumentAtIndex(1);
- pos = ((CommandObjectMultiword *) cmd_obj)->m_subcommand_dict.find(sub_command);
- if (pos != ((CommandObjectMultiword *) cmd_obj)->m_subcommand_dict.end())
- {
- CommandObject *sub_cmd_obj = pos->second.get();
- if (sub_cmd_obj->GetOptions() != NULL)
- {
- output_strm.Printf ("\n%s\n", sub_cmd_obj->GetHelp());
- output_strm.Printf ("\nSyntax: %s\n", sub_cmd_obj->GetSyntax());
- sub_cmd_obj->GetOptions()->GenerateOptionUsage (output_strm, sub_cmd_obj);
- done = true;
- }
- else
- {
- output_strm.Printf ("\n%s\n", sub_cmd_obj->GetHelp());
- output_strm.Printf ("\nSyntax: %s\n", sub_cmd_obj->GetSyntax());
- done = true;
- }
- }
- }
- if (!done)
- {
- output_strm.Printf ("%s\n", cmd_obj->GetHelp());
- ((CommandObjectMultiword *) cmd_obj)->GenerateHelpText (result, interpreter);
- }
- }
- else
- {
- const char *long_help = cmd_obj->GetHelpLong();
- if ((long_help != NULL)
- && (strlen (long_help) > 0))
- output_strm.Printf ("\n%s", cmd_obj->GetHelpLong());
- else
- output_strm.Printf ("\n%s\n", cmd_obj->GetHelp());
- output_strm.Printf ("\nSyntax: %s\n", cmd_obj->GetSyntax());
- }
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
- }
- else
- {
- result.AppendErrorWithFormat
- ("'%s' is not a known command.\nTry 'help' to see a current list of commands.\n",
- command.GetArgumentAtIndex(0));
- result.SetStatus (eReturnStatusFailed);
- }
- }
- else
- {
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
- interpreter->GetHelp(result);
- }
- return result.Succeeded();
-}
-
-bool
-CommandObjectHelp::Execute (Args &command, CommandContext *context, CommandInterpreter *interpreter,
- CommandReturnObject &result)
+CommandObjectHelp::Execute (CommandInterpreter &interpreter, Args& command, CommandReturnObject &result)
{
CommandObject::CommandMap::iterator pos;
CommandObject *cmd_obj;
const int argc = command.GetArgumentCount ();
-
+
// 'help' doesn't take any options or arguments, other than command names. If argc is 0, we show the user
// all commands and aliases. Otherwise every argument must be the name of a command or a sub-command.
-
if (argc == 0)
{
result.SetStatus (eReturnStatusSuccessFinishNoResult);
- interpreter->GetHelp (result); // General help, for ALL commands.
+ interpreter.GetHelp (result); // General help, for ALL commands.
}
else
{
// Get command object for the first command argument. Only search built-in command dictionary.
- cmd_obj = interpreter->GetCommandObject (command.GetArgumentAtIndex (0), false, false);
+ cmd_obj = interpreter.GetCommandObject (command.GetArgumentAtIndex (0), false, false);
if (cmd_obj == NULL)
- {
+ {
// That failed, so now search in the aliases dictionary, too.
- cmd_obj = interpreter->GetCommandObject (command.GetArgumentAtIndex (0), true, false);
- }
-
+ cmd_obj = interpreter.GetCommandObject (command.GetArgumentAtIndex (0), true, false);
+ }
+
if (cmd_obj != NULL)
{
bool all_okay = true;
@@ -182,19 +78,19 @@
{
pos = ((CommandObjectMultiword *) sub_cmd_obj)->m_subcommand_dict.find (sub_command);
if (pos != ((CommandObjectMultiword *) sub_cmd_obj)->m_subcommand_dict.end())
- sub_cmd_obj = pos->second.get();
+ sub_cmd_obj = pos->second.get();
else
- all_okay = false;
+ all_okay = false;
}
}
-
+
if (!all_okay || (sub_cmd_obj == NULL))
{
std::string cmd_string;
command.GetCommandString (cmd_string);
result.AppendErrorWithFormat
- ("'%s' is not a known command.\nTry 'help' to see a current list of commands.\n",
- cmd_string.c_str());
+ ("'%s' is not a known command.\nTry 'help' to see a current list of commands.\n",
+ cmd_string.c_str());
result.SetStatus (eReturnStatusFailed);
}
else
@@ -208,59 +104,59 @@
const char *long_help = sub_cmd_obj->GetHelpLong();
if ((long_help != NULL)
&& (strlen (long_help) > 0))
- output_strm.Printf ("\n%s", long_help);
+ output_strm.Printf ("\n%s", long_help);
}
else if (sub_cmd_obj->IsMultiwordObject())
{
output_strm.Printf ("%s\n", sub_cmd_obj->GetHelp());
- ((CommandObjectMultiword *) sub_cmd_obj)->GenerateHelpText (result, interpreter);
+ ((CommandObjectMultiword *) sub_cmd_obj)->GenerateHelpText (interpreter, result);
}
else
{
- const char *long_help = sub_cmd_obj->GetHelpLong();
- if ((long_help != NULL)
- && (strlen (long_help) > 0))
- output_strm.Printf ("%s", long_help);
- else
- output_strm.Printf ("%s\n", sub_cmd_obj->GetHelp());
- output_strm.Printf ("\nSyntax: %s\n", sub_cmd_obj->GetSyntax());
+ const char *long_help = sub_cmd_obj->GetHelpLong();
+ if ((long_help != NULL)
+ && (strlen (long_help) > 0))
+ output_strm.Printf ("%s", long_help);
+ else
+ output_strm.Printf ("%s\n", sub_cmd_obj->GetHelp());
+ output_strm.Printf ("\nSyntax: %s\n", sub_cmd_obj->GetSyntax());
}
}
}
else
{
result.AppendErrorWithFormat
- ("'%s' is not a known command.\nTry 'help' to see a current list of commands.\n",
- command.GetArgumentAtIndex(0));
+ ("'%s' is not a known command.\nTry 'help' to see a current list of commands.\n",
+ command.GetArgumentAtIndex(0));
result.SetStatus (eReturnStatusFailed);
}
}
-
+
return result.Succeeded();
}
int
CommandObjectHelp::HandleCompletion
(
+ CommandInterpreter &interpreter,
Args &input,
int &cursor_index,
int &cursor_char_position,
int match_start_point,
int max_return_elements,
- CommandInterpreter *interpreter,
StringList &matches
)
{
// Return the completions of the commands in the help system:
if (cursor_index == 0)
{
- return interpreter->HandleCompletionMatches(input, cursor_index, cursor_char_position, match_start_point, max_return_elements, matches);
+ return interpreter.HandleCompletionMatches(input, cursor_index, cursor_char_position, match_start_point, max_return_elements, matches);
}
else
{
- CommandObject *cmd_obj = interpreter->GetCommandObject (input.GetArgumentAtIndex(0), true, false);
+ CommandObject *cmd_obj = interpreter.GetCommandObject (input.GetArgumentAtIndex(0), true, false);
input.Shift();
cursor_index--;
- return cmd_obj->HandleCompletion (input, cursor_index, cursor_char_position, match_start_point, max_return_elements, interpreter, matches);
+ return cmd_obj->HandleCompletion (interpreter, input, cursor_index, cursor_char_position, match_start_point, max_return_elements, matches);
}
}
Modified: lldb/trunk/source/Commands/CommandObjectHelp.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectHelp.h (original)
+++ lldb/trunk/source/Commands/CommandObjectHelp.h Tue Jun 22 20:19:29 2010
@@ -31,25 +31,18 @@
virtual
~CommandObjectHelp ();
- bool
- OldExecute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result);
-
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
virtual int
- HandleCompletion (Args &input,
+ HandleCompletion (CommandInterpreter &interpreter,
+ Args &input,
int &cursor_index,
int &cursor_char_position,
int match_start_point,
int max_return_elements,
- CommandInterpreter *interpreter,
StringList &matches);
};
Modified: lldb/trunk/source/Commands/CommandObjectImage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectImage.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectImage.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectImage.cpp Tue Jun 22 20:19:29 2010
@@ -13,21 +13,22 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/FileSpec.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/RegularExpression.h"
+#include "lldb/Core/Stream.h"
#include "lldb/Interpreter/Args.h"
-#include "lldb/Interpreter/CommandContext.h"
#include "lldb/Interpreter/Options.h"
+#include "lldb/Interpreter/CommandCompletions.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Core/FileSpec.h"
#include "lldb/Symbol/LineTable.h"
#include "lldb/Symbol/ObjectFile.h"
-#include "lldb/Core/RegularExpression.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/SymbolVendor.h"
-#include "lldb/Core/Module.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
-#include "lldb/Interpreter/CommandCompletions.h"
using namespace lldb;
using namespace lldb_private;
@@ -56,7 +57,7 @@
static uint32_t
DumpCompileUnitLineTable
(
- CommandContext *context,
+ CommandInterpreter &interpreter,
Stream &strm,
Module *module,
const FileSpec &file_spec,
@@ -85,7 +86,9 @@
<< module->GetFileSpec().GetFilename() << "\n";
LineTable *line_table = sc.comp_unit->GetLineTable();
if (line_table)
- line_table->GetDescription (&strm, context->GetExecutionContext().process, lldb::eDescriptionLevelBrief);
+ line_table->GetDescription (&strm,
+ interpreter.GetDebugger().GetExecutionContext().process,
+ lldb::eDescriptionLevelBrief);
else
strm << "No line table";
}
@@ -153,7 +156,7 @@
static void
-DumpModuleSymtab (CommandContext *context, Stream &strm, Module *module)
+DumpModuleSymtab (CommandInterpreter &interpreter, Stream &strm, Module *module)
{
if (module)
{
@@ -162,13 +165,13 @@
{
Symtab *symtab = objfile->GetSymtab();
if (symtab)
- symtab->Dump(&strm, context->GetExecutionContext().process);
+ symtab->Dump(&strm, interpreter.GetDebugger().GetExecutionContext().process);
}
}
}
static void
-DumpModuleSections (CommandContext *context, Stream &strm, Module *module)
+DumpModuleSections (CommandInterpreter &interpreter, Stream &strm, Module *module)
{
if (module)
{
@@ -177,7 +180,7 @@
{
SectionList *section_list = objfile->GetSectionList();
if (section_list)
- section_list->Dump(&strm, context->GetExecutionContext().process, true);
+ section_list->Dump(&strm, interpreter.GetDebugger().GetExecutionContext().process, true);
}
}
}
@@ -198,14 +201,14 @@
}
static bool
-LookupAddressInModule (CommandContext *context, Stream &strm, Module *module, uint32_t resolve_mask, lldb::addr_t raw_addr, lldb::addr_t offset)
+LookupAddressInModule (CommandInterpreter &interpreter, Stream &strm, Module *module, uint32_t resolve_mask, lldb::addr_t raw_addr, lldb::addr_t offset)
{
if (module)
{
lldb::addr_t addr = raw_addr - offset;
Address so_addr;
SymbolContext sc;
- Process *process = context->GetExecutionContext().process;
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (process && process->IsAlive())
{
if (!process->ResolveLoadAddress (addr, so_addr))
@@ -223,7 +226,7 @@
if (offset)
strm.Printf("0x%llx: ", addr);
- ExecutionContextScope *exe_scope = context->GetExecutionContext().GetBestExecutionContextScope();
+ ExecutionContextScope *exe_scope = interpreter.GetDebugger().GetExecutionContext().GetBestExecutionContextScope();
if (so_addr.Dump (&strm, exe_scope, Address::DumpStyleSectionNameOffset))
strm.PutCString(": ");
so_addr.Dump (&strm, exe_scope, Address::DumpStyleResolvedDescription);
@@ -234,7 +237,7 @@
}
static uint32_t
-LookupSymbolInModule (CommandContext *context, Stream &strm, Module *module, const char *name, bool name_is_regex)
+LookupSymbolInModule (CommandInterpreter &interpreter, Stream &strm, Module *module, const char *name, bool name_is_regex)
{
if (module)
{
@@ -275,7 +278,7 @@
{
Symbol *symbol = symtab->SymbolAtIndex(match_indexes[i]);
strm.Indent ();
- symbol->Dump (&strm, context->GetExecutionContext().process, i);
+ symbol->Dump (&strm, interpreter.GetDebugger().GetExecutionContext().process, i);
}
strm.IndentLess ();
return num_matches;
@@ -288,7 +291,7 @@
static void
-DumpSymbolContextList (CommandContext *context, Stream &strm, SymbolContextList &sc_list, bool prepend_addr)
+DumpSymbolContextList (CommandInterpreter &interpreter, Stream &strm, SymbolContextList &sc_list, bool prepend_addr)
{
strm.IndentMore ();
uint32_t i;
@@ -305,9 +308,9 @@
if (sc.line_entry.range.GetBaseAddress().IsValid())
{
lldb::addr_t vm_addr =
- sc.line_entry.range.GetBaseAddress().GetLoadAddress(context->GetExecutionContext().process);
+ sc.line_entry.range.GetBaseAddress().GetLoadAddress(interpreter.GetDebugger().GetExecutionContext().process);
int addr_size = sizeof (addr_t);
- Process *process = context->GetExecutionContext().process;
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (process)
addr_size = process->GetAddressByteSize();
if (vm_addr != LLDB_INVALID_ADDRESS)
@@ -318,14 +321,14 @@
strm.PutCString(" in ");
}
}
- sc.DumpStopContext(&strm, context->GetExecutionContext().process, sc.line_entry.range.GetBaseAddress());
+ sc.DumpStopContext(&strm, interpreter.GetDebugger().GetExecutionContext().process, sc.line_entry.range.GetBaseAddress());
}
}
strm.IndentLess ();
}
static uint32_t
-LookupFunctionInModule (CommandContext *context, Stream &strm, Module *module, const char *name, bool name_is_regex)
+LookupFunctionInModule (CommandInterpreter &interpreter, Stream &strm, Module *module, const char *name, bool name_is_regex)
{
if (module && name && name[0])
{
@@ -353,7 +356,7 @@
strm.Printf("%u match%s found in ", num_matches, num_matches > 1 ? "es" : "");
DumpFullpath (strm, &module->GetFileSpec(), 0);
strm.PutCString(":\n");
- DumpSymbolContextList (context, strm, sc_list, true);
+ DumpSymbolContextList (interpreter, strm, sc_list, true);
}
return num_matches;
}
@@ -362,7 +365,7 @@
}
static uint32_t
-LookupFileAndLineInModule (CommandContext *context, Stream &strm, Module *module, const FileSpec &file_spec, uint32_t line, bool check_inlines)
+LookupFileAndLineInModule (CommandInterpreter &interpreter, Stream &strm, Module *module, const FileSpec &file_spec, uint32_t line, bool check_inlines)
{
if (module && file_spec)
{
@@ -379,7 +382,7 @@
strm << " in ";
DumpFullpath (strm, &module->GetFileSpec(), 0);
strm.PutCString(":\n");
- DumpSymbolContextList (context, strm, sc_list, true);
+ DumpSymbolContextList (interpreter, strm, sc_list, true);
return num_matches;
}
}
@@ -397,8 +400,8 @@
public:
CommandObjectImageDumpModuleList (const char *name,
- const char *help,
- const char *syntax) :
+ const char *help,
+ const char *syntax) :
CommandObject (name, help, syntax)
{
}
@@ -409,26 +412,26 @@
}
virtual int
- HandleArgumentCompletion (Args &input,
- int &cursor_index,
- int &cursor_char_position,
- OptionElementVector &opt_element_vector,
- int match_start_point,
- int max_return_elements,
- CommandInterpreter *interpreter,
- StringList &matches)
+ HandleArgumentCompletion (CommandInterpreter &interpreter,
+ Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ OptionElementVector &opt_element_vector,
+ int match_start_point,
+ int max_return_elements,
+ StringList &matches)
{
// Arguments are the standard module completer.
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
- CommandCompletions::InvokeCommonCompletionCallbacks (CommandCompletions::eModuleCompletion,
- completion_str.c_str(),
- match_start_point,
- max_return_elements,
- interpreter,
- NULL,
- matches);
+ CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
+ CommandCompletions::eModuleCompletion,
+ completion_str.c_str(),
+ match_start_point,
+ max_return_elements,
+ NULL,
+ matches);
return matches.GetSize();
}
};
@@ -438,8 +441,8 @@
public:
CommandObjectImageDumpSourceFileList (const char *name,
- const char *help,
- const char *syntax) :
+ const char *help,
+ const char *syntax) :
CommandObject (name, help, syntax)
{
}
@@ -450,26 +453,26 @@
}
virtual int
- HandleArgumentCompletion (Args &input,
- int &cursor_index,
- int &cursor_char_position,
- OptionElementVector &opt_element_vector,
- int match_start_point,
- int max_return_elements,
- CommandInterpreter *interpreter,
- StringList &matches)
+ HandleArgumentCompletion (CommandInterpreter &interpreter,
+ Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ OptionElementVector &opt_element_vector,
+ int match_start_point,
+ int max_return_elements,
+ StringList &matches)
{
// Arguments are the standard source file completer.
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
- CommandCompletions::InvokeCommonCompletionCallbacks (CommandCompletions::eSourceFileCompletion,
- completion_str.c_str(),
- match_start_point,
- max_return_elements,
- interpreter,
- NULL,
- matches);
+ CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
+ CommandCompletions::eSourceFileCompletion,
+ completion_str.c_str(),
+ match_start_point,
+ max_return_elements,
+ NULL,
+ matches);
return matches.GetSize();
}
};
@@ -491,12 +494,11 @@
}
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
result.AppendError ("invalid target, set executable file using 'file' command");
@@ -521,7 +523,7 @@
for (uint32_t image_idx = 0; image_idx<num_modules; ++image_idx)
{
num_dumped++;
- DumpModuleSymtab (context, result.GetOutputStream(), target->GetImages().GetModulePointerAtIndex(image_idx));
+ DumpModuleSymtab (interpreter, result.GetOutputStream(), target->GetImages().GetModulePointerAtIndex(image_idx));
}
}
else
@@ -549,7 +551,7 @@
if (image_module)
{
num_dumped++;
- DumpModuleSymtab (context, result.GetOutputStream(), image_module);
+ DumpModuleSymtab (interpreter, result.GetOutputStream(), image_module);
}
}
}
@@ -578,10 +580,9 @@
{
public:
CommandObjectImageDumpSections () :
- CommandObjectImageDumpModuleList (
- "image dump sections",
- "Dump the sections from one or more executable images.",
- "image dump sections [<file1> ...]")
+ CommandObjectImageDumpModuleList ("image dump sections",
+ "Dump the sections from one or more executable images.",
+ "image dump sections [<file1> ...]")
{
}
@@ -591,12 +592,11 @@
}
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
result.AppendError ("invalid target, set executable file using 'file' command");
@@ -621,7 +621,7 @@
for (uint32_t image_idx = 0; image_idx<num_modules; ++image_idx)
{
num_dumped++;
- DumpModuleSections (context, result.GetOutputStream(), target->GetImages().GetModulePointerAtIndex(image_idx));
+ DumpModuleSections (interpreter, result.GetOutputStream(), target->GetImages().GetModulePointerAtIndex(image_idx));
}
}
else
@@ -649,7 +649,7 @@
if (image_module)
{
num_dumped++;
- DumpModuleSections (context, result.GetOutputStream(), image_module);
+ DumpModuleSections (interpreter, result.GetOutputStream(), image_module);
}
}
}
@@ -689,12 +689,11 @@
}
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
result.AppendError ("invalid target, set executable file using 'file' command");
@@ -787,12 +786,11 @@
}
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
result.AppendError ("invalid target, set executable file using 'file' command");
@@ -801,7 +799,7 @@
}
else
{
- ExecutionContext exe_ctx(context->GetExecutionContext());
+ ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
uint32_t total_num_dumped = 0;
uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
@@ -826,7 +824,7 @@
uint32_t num_dumped = 0;
for (uint32_t i = 0; i<num_modules; ++i)
{
- if (DumpCompileUnitLineTable (context,
+ if (DumpCompileUnitLineTable (interpreter,
result.GetOutputStream(),
target->GetImages().GetModulePointerAtIndex(i),
file_spec,
@@ -863,15 +861,15 @@
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
- CommandObjectImageDump(CommandInterpreter *interpreter) :
+ CommandObjectImageDump(CommandInterpreter &interpreter) :
CommandObjectMultiword ("image dump",
- "Dumps information in one or more executable images; 'line-table' expects a source file name",
- "image dump [symtab|sections|symfile|line-table] [<file1> <file2> ...]")
+ "Dumps information in one or more executable images; 'line-table' expects a source file name",
+ "image dump [symtab|sections|symfile|line-table] [<file1> <file2> ...]")
{
- LoadSubCommand (CommandObjectSP (new CommandObjectImageDumpSymtab ()), "symtab", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectImageDumpSections ()), "sections", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectImageDumpSymfile ()), "symfile", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectImageDumpLineTable ()), "line-table", interpreter);
+ LoadSubCommand (interpreter, "symtab", CommandObjectSP (new CommandObjectImageDumpSymtab ()));
+ LoadSubCommand (interpreter, "sections", CommandObjectSP (new CommandObjectImageDumpSections ()));
+ LoadSubCommand (interpreter, "symfile", CommandObjectSP (new CommandObjectImageDumpSymfile ()));
+ LoadSubCommand (interpreter, "line-table", CommandObjectSP (new CommandObjectImageDumpLineTable ()));
}
virtual
@@ -957,12 +955,11 @@
}
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
result.AppendError ("invalid target, set executable file using 'file' command");
@@ -1223,14 +1220,14 @@
bool
- LookupInModule (CommandContext *context, Module *module, CommandReturnObject &result, bool &syntax_error)
+ LookupInModule (CommandInterpreter &interpreter, Module *module, CommandReturnObject &result, bool &syntax_error)
{
switch (m_options.m_type)
{
case eLookupTypeAddress:
if (m_options.m_addr != LLDB_INVALID_ADDRESS)
{
- if (LookupAddressInModule (context, result.GetOutputStream(), module, eSymbolContextEverything, m_options.m_addr, m_options.m_offset))
+ if (LookupAddressInModule (interpreter, result.GetOutputStream(), module, eSymbolContextEverything, m_options.m_addr, m_options.m_offset))
{
result.SetStatus(eReturnStatusSuccessFinishResult);
return true;
@@ -1241,7 +1238,7 @@
case eLookupTypeSymbol:
if (!m_options.m_str.empty())
{
- if (LookupSymbolInModule (context, result.GetOutputStream(), module, m_options.m_str.c_str(), m_options.m_use_regex))
+ if (LookupSymbolInModule (interpreter, result.GetOutputStream(), module, m_options.m_str.c_str(), m_options.m_use_regex))
{
result.SetStatus(eReturnStatusSuccessFinishResult);
return true;
@@ -1253,7 +1250,7 @@
if (m_options.m_file)
{
- if (LookupFileAndLineInModule (context,
+ if (LookupFileAndLineInModule (interpreter,
result.GetOutputStream(),
module,
m_options.m_file,
@@ -1269,7 +1266,7 @@
case eLookupTypeFunction:
if (!m_options.m_str.empty())
{
- if (LookupFunctionInModule (context,
+ if (LookupFunctionInModule (interpreter,
result.GetOutputStream(),
module,
m_options.m_str.c_str(),
@@ -1292,12 +1289,11 @@
}
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
result.AppendError ("invalid target, set executable file using 'file' command");
@@ -1322,7 +1318,7 @@
{
for (i = 0; i<num_modules && syntax_error == false; ++i)
{
- if (LookupInModule (context, target->GetImages().GetModulePointerAtIndex(i), result, syntax_error))
+ if (LookupInModule (interpreter, target->GetImages().GetModulePointerAtIndex(i), result, syntax_error))
{
result.GetOutputStream().EOL();
num_successful_lookups++;
@@ -1353,7 +1349,7 @@
Module * image_module = matching_modules.GetModulePointerAtIndex(i);
if (image_module)
{
- if (LookupInModule (context, image_module, result, syntax_error))
+ if (LookupInModule (interpreter, image_module, result, syntax_error))
{
result.GetOutputStream().EOL();
num_successful_lookups++;
@@ -1399,14 +1395,14 @@
//----------------------------------------------------------------------
// CommandObjectImage constructor
//----------------------------------------------------------------------
-CommandObjectImage::CommandObjectImage(CommandInterpreter *interpreter) :
+CommandObjectImage::CommandObjectImage(CommandInterpreter &interpreter) :
CommandObjectMultiword ("image",
- "Access information for one or more executable images.",
- "image [dump|list] ...")
+ "Access information for one or more executable images.",
+ "image [dump|list] ...")
{
- LoadSubCommand (CommandObjectSP (new CommandObjectImageDump (interpreter)), "dump", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectImageList ()), "list", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectImageLookup ()), "lookup", interpreter);
+ LoadSubCommand (interpreter, "dump", CommandObjectSP (new CommandObjectImageDump (interpreter)));
+ LoadSubCommand (interpreter, "list", CommandObjectSP (new CommandObjectImageList ()));
+ LoadSubCommand (interpreter, "lookup", CommandObjectSP (new CommandObjectImageLookup ()));
}
//----------------------------------------------------------------------
Modified: lldb/trunk/source/Commands/CommandObjectImage.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectImage.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectImage.h (original)
+++ lldb/trunk/source/Commands/CommandObjectImage.h Tue Jun 22 20:19:29 2010
@@ -28,7 +28,8 @@
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
- CommandObjectImage(CommandInterpreter *interpreter);
+ CommandObjectImage(CommandInterpreter &interpreter);
+
virtual
~CommandObjectImage();
Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectLog.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectLog.cpp Tue Jun 22 20:19:29 2010
@@ -26,7 +26,7 @@
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/Timer.h"
-#include "lldb/Interpreter/CommandContext.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Symbol/LineTable.h"
@@ -76,9 +76,8 @@
}
virtual bool
- Execute (Args& args,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& args,
CommandReturnObject &result)
{
if (args.GetArgumentCount() < 1)
@@ -256,9 +255,8 @@
}
virtual bool
- Execute (Args& args,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& args,
CommandReturnObject &result)
{
const size_t argc = args.GetArgumentCount();
@@ -318,9 +316,8 @@
}
virtual bool
- Execute (Args& args,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& args,
CommandReturnObject &result)
{
const size_t argc = args.GetArgumentCount();
@@ -382,9 +379,8 @@
}
virtual bool
- Execute (Args& args,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& args,
CommandReturnObject &result)
{
const size_t argc = args.GetArgumentCount();
@@ -429,15 +425,15 @@
//----------------------------------------------------------------------
// CommandObjectLog constructor
//----------------------------------------------------------------------
-CommandObjectLog::CommandObjectLog(CommandInterpreter *interpreter) :
+CommandObjectLog::CommandObjectLog(CommandInterpreter &interpreter) :
CommandObjectMultiword ("log",
"A set of commands for operating on logs.",
"log <command> [<command-options>]")
{
- LoadSubCommand (CommandObjectSP (new CommandObjectLogEnable), "enable", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectLogDisable), "disable", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectLogList), "list", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectLogTimer), "timers", interpreter);
+ LoadSubCommand (interpreter, "enable", CommandObjectSP (new CommandObjectLogEnable));
+ LoadSubCommand (interpreter, "disable", CommandObjectSP (new CommandObjectLogDisable));
+ LoadSubCommand (interpreter, "list", CommandObjectSP (new CommandObjectLogList));
+ LoadSubCommand (interpreter, "timers", CommandObjectSP (new CommandObjectLogTimer));
}
//----------------------------------------------------------------------
Modified: lldb/trunk/source/Commands/CommandObjectLog.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectLog.h (original)
+++ lldb/trunk/source/Commands/CommandObjectLog.h Tue Jun 22 20:19:29 2010
@@ -31,7 +31,7 @@
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
- CommandObjectLog(CommandInterpreter *interpreter);
+ CommandObjectLog(CommandInterpreter &interpreter);
virtual
~CommandObjectLog();
Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Tue Jun 22 20:19:29 2010
@@ -13,13 +13,14 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Interpreter/Args.h"
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/DataExtractor.h"
-#include "lldb/Interpreter/Options.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Core/StreamString.h"
+#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Interpreter/CommandContext.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/Options.h"
#include "lldb/Target/Process.h"
using namespace lldb;
@@ -195,12 +196,11 @@
}
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Process *process = context->GetExecutionContext().process;
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (process == NULL)
{
result.AppendError("need a process to read memory");
@@ -441,12 +441,11 @@
}
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Process *process = context->GetExecutionContext().process;
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (process == NULL)
{
result.AppendError("need a process to read memory");
@@ -666,13 +665,13 @@
// CommandObjectMemory
//-------------------------------------------------------------------------
-CommandObjectMemory::CommandObjectMemory (CommandInterpreter *interpreter) :
+CommandObjectMemory::CommandObjectMemory (CommandInterpreter &interpreter) :
CommandObjectMultiword ("memory",
"A set of commands for operating on a memory.",
"memory <subcommand> [<subcommand-options>]")
{
- LoadSubCommand (CommandObjectSP (new CommandObjectMemoryRead ()), "read", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectMemoryWrite ()), "write", interpreter);
+ LoadSubCommand (interpreter, "read", CommandObjectSP (new CommandObjectMemoryRead ()));
+ LoadSubCommand (interpreter, "write", CommandObjectSP (new CommandObjectMemoryWrite ()));
}
CommandObjectMemory::~CommandObjectMemory ()
Modified: lldb/trunk/source/Commands/CommandObjectMemory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.h (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.h Tue Jun 22 20:19:29 2010
@@ -21,7 +21,7 @@
class CommandObjectMemory : public CommandObjectMultiword
{
public:
- CommandObjectMemory (CommandInterpreter *interpreter);
+ CommandObjectMemory (CommandInterpreter &interpreter);
virtual
~CommandObjectMemory ();
Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMultiword.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMultiword.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMultiword.cpp Tue Jun 22 20:19:29 2010
@@ -12,7 +12,7 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Interpreter/CommandContext.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@@ -80,8 +80,12 @@
}
bool
-CommandObjectMultiword::LoadSubCommand (CommandObjectSP cmd_obj, const char *name,
- CommandInterpreter *interpreter)
+CommandObjectMultiword::LoadSubCommand
+(
+ CommandInterpreter &interpreter,
+ const char *name,
+ const CommandObjectSP& cmd_obj
+)
{
CommandMap::iterator pos;
bool success = true;
@@ -90,7 +94,7 @@
if (pos == m_subcommand_dict.end())
{
m_subcommand_dict[name] = cmd_obj;
- interpreter->CrossRegisterCommand (name, GetCommandName());
+ interpreter.CrossRegisterCommand (name, GetCommandName());
}
else
success = false;
@@ -101,16 +105,15 @@
bool
CommandObjectMultiword::Execute
(
+ CommandInterpreter &interpreter,
Args& args,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
const size_t argc = args.GetArgumentCount();
if (argc == 0)
{
- GenerateHelpText (result, interpreter);
+ GenerateHelpText (interpreter, result);
}
else
{
@@ -120,7 +123,7 @@
{
if (::strcasecmp (sub_command, "help") == 0)
{
- GenerateHelpText (result, interpreter);
+ GenerateHelpText (interpreter, result);
}
else if (!m_subcommand_dict.empty())
{
@@ -133,7 +136,7 @@
args.Shift();
- sub_cmd_obj->ExecuteWithOptions (args, context, interpreter, result);
+ sub_cmd_obj->ExecuteWithOptions (interpreter, args, result);
}
else
{
@@ -176,7 +179,7 @@
}
void
-CommandObjectMultiword::GenerateHelpText (CommandReturnObject &result, CommandInterpreter *interpreter)
+CommandObjectMultiword::GenerateHelpText (CommandInterpreter &interpreter, CommandReturnObject &result)
{
// First time through here, generate the help text for the object and
// push it to the return result object as well
@@ -185,7 +188,7 @@
output_stream.PutCString ("The following subcommands are supported:\n\n");
CommandMap::iterator pos;
- std::string longest_word = interpreter->FindLongestCommandWord (m_subcommand_dict);
+ std::string longest_word = interpreter.FindLongestCommandWord (m_subcommand_dict);
uint32_t max_len = 0;
if (! longest_word.empty())
@@ -195,8 +198,11 @@
{
std::string indented_command (" ");
indented_command.append (pos->first);
- interpreter->OutputFormattedHelpText (result.GetOutputStream(), indented_command.c_str(), "--",
- pos->second->GetHelp(), max_len);
+ interpreter.OutputFormattedHelpText (result.GetOutputStream(),
+ indented_command.c_str(),
+ "--",
+ pos->second->GetHelp(),
+ max_len);
}
output_stream.PutCString ("\nFor more help on any particular subcommand, type 'help <command> <subcommand>'.\n");
@@ -207,33 +213,40 @@
int
CommandObjectMultiword::HandleCompletion
(
+ CommandInterpreter &interpreter,
Args &input,
int &cursor_index,
int &cursor_char_position,
int match_start_point,
int max_return_elements,
- CommandInterpreter *interpreter,
StringList &matches
)
{
if (cursor_index == 0)
{
- CommandObject::AddNamesMatchingPartialString (m_subcommand_dict, input.GetArgumentAtIndex(0), matches);
+ CommandObject::AddNamesMatchingPartialString (m_subcommand_dict,
+ input.GetArgumentAtIndex(0),
+ matches);
if (matches.GetSize() == 1
&& matches.GetStringAtIndex(0) != NULL
&& strcmp (input.GetArgumentAtIndex(0), matches.GetStringAtIndex(0)) == 0)
{
StringList temp_matches;
- CommandObject *cmd_obj = GetSubcommandObject (input.GetArgumentAtIndex(0), &temp_matches);
+ CommandObject *cmd_obj = GetSubcommandObject (input.GetArgumentAtIndex(0),
+ &temp_matches);
if (cmd_obj != NULL)
{
matches.DeleteStringAtIndex (0);
input.Shift();
cursor_char_position = 0;
input.AppendArgument ("");
- return cmd_obj->HandleCompletion (input, cursor_index, cursor_char_position, match_start_point,
- max_return_elements, interpreter, matches);
+ return cmd_obj->HandleCompletion (interpreter,
+ input, cursor_index,
+ cursor_char_position,
+ match_start_point,
+ max_return_elements,
+ matches);
}
else
return matches.GetSize();
@@ -243,7 +256,8 @@
}
else
{
- CommandObject *sub_command_object = GetSubcommandObject (input.GetArgumentAtIndex(0), &matches);
+ CommandObject *sub_command_object = GetSubcommandObject (input.GetArgumentAtIndex(0),
+ &matches);
if (sub_command_object == NULL)
{
return matches.GetSize();
@@ -254,8 +268,13 @@
matches.DeleteStringAtIndex(0);
input.Shift();
cursor_index--;
- return sub_command_object->HandleCompletion (input, cursor_index, cursor_char_position, match_start_point,
- max_return_elements, interpreter, matches);
+ return sub_command_object->HandleCompletion (interpreter,
+ input,
+ cursor_index,
+ cursor_char_position,
+ match_start_point,
+ max_return_elements,
+ matches);
}
}
Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Tue Jun 22 20:19:29 2010
@@ -120,13 +120,12 @@
}
bool
- Execute (Args& launch_args,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& launch_args,
CommandReturnObject &result)
{
- Target *target = context->GetTarget();
- bool synchronous_execution = interpreter->GetSynchronous ();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
+ bool synchronous_execution = interpreter.GetSynchronous ();
// bool launched = false;
// bool stopped_after_launch = false;
@@ -138,19 +137,11 @@
}
// If our listener is NULL, users aren't allows to launch
- Listener *listener = interpreter->GetListener();
- if (listener == NULL)
- {
- result.AppendError ("operation not allowed through the command interpreter");
- result.SetStatus (eReturnStatusFailed);
- return false;
- }
-
char filename[PATH_MAX];
Module *exe_module = target->GetExecutableModule().get();
exe_module->GetFileSpec().GetPath(filename, sizeof(filename));
- Process *process = context->GetExecutionContext().process;
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (process)
{
if (process->IsAlive())
@@ -168,10 +159,10 @@
else
plugin_name = NULL;
- process = target->CreateProcess (*listener, plugin_name).get();
+ process = target->CreateProcess (interpreter.GetDebugger().GetListener(), plugin_name).get();
- const Args *environment = interpreter->GetEnvironmentVariables();
- const Args *run_args = interpreter->GetProgramArguments();
+ const Args *environment = interpreter.GetEnvironmentVariables();
+ const Args *run_args = interpreter.GetProgramArguments();
// There are two possible sources of args to be passed to the process upon launching: Those the user
// typed at the run command (launch_args); or those the user pre-set in the run-args variable (run_args).
@@ -185,7 +176,7 @@
else
{
// launch-args was not empty; use that, AND re-set run-args to contains launch-args values.
- StateVariable *run_args_var = interpreter->GetStateVariable ("run-args");
+ StateVariable *run_args_var = interpreter.GetStateVariable ("run-args");
if (run_args_var != NULL)
{
run_args_var->ArrayClearValues();
@@ -229,7 +220,7 @@
{
// Call continue_command.
CommandReturnObject continue_result;
- interpreter->HandleCommand("process continue", false, continue_result);
+ interpreter.HandleCommand("process continue", false, continue_result);
}
if (synchronous_execution)
@@ -296,12 +287,11 @@
}
bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
result.AppendError ("invalid target, set executable file using 'file' command");
@@ -310,14 +300,8 @@
}
// If our listener is NULL, users aren't allows to launch
- Listener *listener = interpreter->GetListener();
- if (listener == NULL)
- {
- result.AppendError ("operation not allowed through the command interpreter");
- result.SetStatus (eReturnStatusFailed);
- return false;
- }
- Process *process = context->GetExecutionContext().process;
+
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (process)
{
if (process->IsAlive())
@@ -340,7 +324,7 @@
if (!m_options.plugin_name.empty())
plugin_name = m_options.plugin_name.c_str();
- process = target->CreateProcess (*listener, plugin_name).get();
+ process = target->CreateProcess (interpreter.GetDebugger().GetListener(), plugin_name).get();
if (process)
{
@@ -508,13 +492,12 @@
}
bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Process *process = context->GetExecutionContext().process;
- bool synchronous_execution = interpreter->GetSynchronous ();
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+ bool synchronous_execution = interpreter.GetSynchronous ();
if (process == NULL)
{
@@ -595,12 +578,11 @@
}
bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Process *process = context->GetExecutionContext().process;
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (process == NULL)
{
result.AppendError ("must have a valid process in order to detach");
@@ -643,12 +625,11 @@
}
bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Process *process = context->GetExecutionContext().process;
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (process == NULL)
{
result.AppendError ("no process to signal");
@@ -711,12 +692,11 @@
}
bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Process *process = context->GetExecutionContext().process;
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (process == NULL)
{
result.AppendError ("no process to halt");
@@ -773,12 +753,11 @@
}
bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Process *process = context->GetExecutionContext().process;
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (process == NULL)
{
result.AppendError ("no process to kill");
@@ -832,15 +811,14 @@
bool
Execute
(
+ CommandInterpreter &interpreter,
Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
StreamString &output_stream = result.GetOutputStream();
result.SetStatus (eReturnStatusSuccessFinishNoResult);
- ExecutionContext exe_ctx(context->GetExecutionContext());
+ ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
if (exe_ctx.process)
{
const StateType state = exe_ctx.process->GetState();
@@ -891,19 +869,19 @@
// CommandObjectMultiwordProcess
//-------------------------------------------------------------------------
-CommandObjectMultiwordProcess::CommandObjectMultiwordProcess (CommandInterpreter *interpreter) :
+CommandObjectMultiwordProcess::CommandObjectMultiwordProcess (CommandInterpreter &interpreter) :
CommandObjectMultiword ("process",
"A set of commands for operating on a process.",
"process <subcommand> [<subcommand-options>]")
{
- LoadSubCommand (CommandObjectSP (new CommandObjectProcessAttach ()), "attach", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectProcessLaunch ()), "launch", interpreter);
- 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);
+ LoadSubCommand (interpreter, "attach", CommandObjectSP (new CommandObjectProcessAttach ()));
+ LoadSubCommand (interpreter, "launch", CommandObjectSP (new CommandObjectProcessLaunch ()));
+ LoadSubCommand (interpreter, "continue", CommandObjectSP (new CommandObjectProcessContinue ()));
+ LoadSubCommand (interpreter, "detach", CommandObjectSP (new CommandObjectProcessDetach ()));
+ LoadSubCommand (interpreter, "signal", CommandObjectSP (new CommandObjectProcessSignal ()));
+ LoadSubCommand (interpreter, "status", CommandObjectSP (new CommandObjectProcessStatus ()));
+ LoadSubCommand (interpreter, "interrupt", CommandObjectSP (new CommandObjectProcessInterrupt ()));
+ LoadSubCommand (interpreter, "kill", CommandObjectSP (new CommandObjectProcessKill ()));
}
CommandObjectMultiwordProcess::~CommandObjectMultiwordProcess ()
Modified: lldb/trunk/source/Commands/CommandObjectProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.h (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.h Tue Jun 22 20:19:29 2010
@@ -25,7 +25,7 @@
class CommandObjectMultiwordProcess : public CommandObjectMultiword
{
public:
- CommandObjectMultiwordProcess (CommandInterpreter *interpreter);
+ CommandObjectMultiwordProcess (CommandInterpreter &interpreter);
virtual
~CommandObjectMultiwordProcess ();
Modified: lldb/trunk/source/Commands/CommandObjectQuit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectQuit.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectQuit.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectQuit.cpp Tue Jun 22 20:19:29 2010
@@ -35,13 +35,12 @@
bool
CommandObjectQuit::Execute
(
- Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ CommandInterpreter &interpreter,
+ Args& args,
CommandReturnObject &result
)
{
- interpreter->BroadcastEvent (CommandInterpreter::eBroadcastBitQuitCommandReceived);
+ interpreter.BroadcastEvent (CommandInterpreter::eBroadcastBitQuitCommandReceived);
result.SetStatus (eReturnStatusQuit);
return true;
}
Modified: lldb/trunk/source/Commands/CommandObjectQuit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectQuit.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectQuit.h (original)
+++ lldb/trunk/source/Commands/CommandObjectQuit.h Tue Jun 22 20:19:29 2010
@@ -39,9 +39,8 @@
~CommandObjectQuit ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& args,
CommandReturnObject &result);
};
Modified: lldb/trunk/source/Commands/CommandObjectRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectRegister.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectRegister.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectRegister.cpp Tue Jun 22 20:19:29 2010
@@ -13,10 +13,11 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Interpreter/Args.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Scalar.h"
-#include "lldb/Interpreter/CommandContext.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Interpreter/Args.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/RegisterContext.h"
@@ -44,14 +45,16 @@
}
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result)
+ Execute
+ (
+ CommandInterpreter &interpreter,
+ Args& command,
+ CommandReturnObject &result
+ )
{
StreamString &output_stream = result.GetOutputStream();
DataExtractor reg_data;
- ExecutionContext exe_ctx(context->GetExecutionContext());
+ ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
RegisterContext *reg_context = exe_ctx.GetRegisterContext ();
if (reg_context)
@@ -150,13 +153,15 @@
}
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result)
+ Execute
+ (
+ CommandInterpreter &interpreter,
+ Args& command,
+ CommandReturnObject &result
+ )
{
DataExtractor reg_data;
- ExecutionContext exe_ctx(context->GetExecutionContext());
+ ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
RegisterContext *reg_context = exe_ctx.GetRegisterContext ();
if (reg_context)
@@ -213,13 +218,13 @@
//----------------------------------------------------------------------
// CommandObjectRegister constructor
//----------------------------------------------------------------------
-CommandObjectRegister::CommandObjectRegister(CommandInterpreter *interpreter) :
+CommandObjectRegister::CommandObjectRegister(CommandInterpreter &interpreter) :
CommandObjectMultiword ("register",
"Access thread registers.",
"register [read|write] ...")
{
- LoadSubCommand (CommandObjectSP (new CommandObjectRegisterRead ()), "read", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectRegisterWrite ()), "write", interpreter);
+ LoadSubCommand (interpreter, "read", CommandObjectSP (new CommandObjectRegisterRead ()));
+ LoadSubCommand (interpreter, "write", CommandObjectSP (new CommandObjectRegisterWrite ()));
}
Modified: lldb/trunk/source/Commands/CommandObjectRegister.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectRegister.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectRegister.h (original)
+++ lldb/trunk/source/Commands/CommandObjectRegister.h Tue Jun 22 20:19:29 2010
@@ -28,7 +28,8 @@
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
- CommandObjectRegister(CommandInterpreter *interpreter);
+ CommandObjectRegister(CommandInterpreter &interpreter);
+
virtual
~CommandObjectRegister();
Removed: lldb/trunk/source/Commands/CommandObjectRemove.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectRemove.cpp?rev=106614&view=auto
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectRemove.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectRemove.cpp (removed)
@@ -1,89 +0,0 @@
-//===-- CommandObjectRemove.cpp ---------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "CommandObjectRemove.h"
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/CommandReturnObject.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-//-------------------------------------------------------------------------
-// CommandObjectRemove
-//-------------------------------------------------------------------------
-
-CommandObjectRemove::CommandObjectRemove () :
- CommandObject ("remove",
- "Allows the user to remove/delete user-defined command functions (script functions).",
- "remove <command-name-to-be-removed>")
-{
-}
-
-CommandObjectRemove::~CommandObjectRemove()
-{
-}
-
-
-bool
-CommandObjectRemove::Execute (Args& args, CommandContext *context, CommandInterpreter *interpreter,
- CommandReturnObject &result)
-{
- CommandObject::CommandMap::iterator pos;
- CommandObject *cmd_obj;
-
- if (args.GetArgumentCount() != 0)
- {
- const char *command_name = args.GetArgumentAtIndex(0);
- cmd_obj = interpreter->GetCommandObject(command_name);
- if (cmd_obj)
- {
- if (interpreter->CommandExists (command_name))
- {
- result.AppendErrorWithFormat ("'%s' is a permanent debugger command and cannot be removed.\n",
- command_name);
- result.SetStatus (eReturnStatusFailed);
- }
- else
- {
-
- if (interpreter->RemoveUser (command_name) == false)
- {
- if (interpreter->UserCommandExists (command_name))
- result.AppendErrorWithFormat ("Unknown error occurred; unable to remove command '%s'.\n",
- command_name);
- else
- result.AppendErrorWithFormat ("'%s' is not a user-defined command/function name.\n",
- command_name);
- result.SetStatus (eReturnStatusFailed);
- }
- else
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
- }
- }
- else
- {
- result.AppendErrorWithFormat ("'%s' is not a known command.\nTry 'help' to see a current list of commands.\n",
- command_name);
- result.SetStatus (eReturnStatusFailed);
- }
- }
- else
- {
- result.AppendError ("must call remove with a valid command");
- result.SetStatus (eReturnStatusFailed);
- }
-
- return result.Succeeded();
-}
-
Removed: lldb/trunk/source/Commands/CommandObjectRemove.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectRemove.h?rev=106614&view=auto
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectRemove.h (original)
+++ lldb/trunk/source/Commands/CommandObjectRemove.h (removed)
@@ -1,44 +0,0 @@
-//===-- CommandObjectRemove.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_CommandObjectRemove_h_
-#define liblldb_CommandObjectRemove_h_
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Interpreter/CommandObject.h"
-
-namespace lldb_private {
-
-//-------------------------------------------------------------------------
-// CommandObjectRemove
-//-------------------------------------------------------------------------
-
-class CommandObjectRemove : public CommandObject
-{
-public:
-
- CommandObjectRemove ();
-
- virtual
- ~CommandObjectRemove ();
-
- virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result);
-
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_CommandObjectRemove_h_
Modified: lldb/trunk/source/Commands/CommandObjectSet.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSet.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSet.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSet.cpp Tue Jun 22 20:19:29 2010
@@ -38,9 +38,8 @@
bool
CommandObjectSet::Execute
(
+ CommandInterpreter &interpreter,
Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
@@ -66,7 +65,7 @@
else if (var_value == NULL || var_value[0] == '\0')
{
// No value given: Check to see if we're trying to clear an array.
- StateVariable *var = interpreter->GetStateVariable (var_name);
+ StateVariable *var = interpreter.GetStateVariable (var_name);
if (var != NULL
&& var->GetType() == StateVariable::eTypeStringArray)
{
@@ -81,7 +80,7 @@
}
else
{
- StateVariable *var = interpreter->GetStateVariable(var_name);
+ StateVariable *var = interpreter.GetStateVariable(var_name);
if (var == NULL)
{
result.AppendErrorWithFormat ("'%s' is not a settable internal variable.\n", var_name);
@@ -98,7 +97,7 @@
if (success)
{
result.SetStatus(eReturnStatusSuccessFinishResult);
- if (!var->HasVerifyFunction() || var->VerifyValue (interpreter, (void *) &new_value, result))
+ if (!var->HasVerifyFunction() || var->VerifyValue (&interpreter, (void *) &new_value, result))
var->SetBoolValue (new_value);
}
else
@@ -115,7 +114,7 @@
if (success)
{
result.SetStatus(eReturnStatusSuccessFinishResult);
- if (!var->HasVerifyFunction() || var->VerifyValue (interpreter, (void *) &new_value, result))
+ if (!var->HasVerifyFunction() || var->VerifyValue (&interpreter, (void *) &new_value, result))
var->SetIntValue (new_value);
}
else
@@ -126,7 +125,7 @@
}
else if (var->GetType() == StateVariable::eTypeString)
{
- if (!var->HasVerifyFunction() || var->VerifyValue (interpreter, (void *) var_value, result))
+ if (!var->HasVerifyFunction() || var->VerifyValue (&interpreter, (void *) var_value, result))
var->SetStringValue (var_value);
}
else if (var->GetType() == StateVariable::eTypeStringArray)
Modified: lldb/trunk/source/Commands/CommandObjectSet.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSet.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSet.h (original)
+++ lldb/trunk/source/Commands/CommandObjectSet.h Tue Jun 22 20:19:29 2010
@@ -32,9 +32,8 @@
~CommandObjectSet ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
};
Modified: lldb/trunk/source/Commands/CommandObjectSettings.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSettings.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSettings.cpp Tue Jun 22 20:19:29 2010
@@ -38,9 +38,8 @@
bool
CommandObjectSettings::Execute
(
+ CommandInterpreter &interpreter,
Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
@@ -53,7 +52,7 @@
}
else
{
- interpreter->ShowVariableHelp (result);
+ interpreter.ShowVariableHelp (result);
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
Modified: lldb/trunk/source/Commands/CommandObjectSettings.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSettings.h (original)
+++ lldb/trunk/source/Commands/CommandObjectSettings.h Tue Jun 22 20:19:29 2010
@@ -32,9 +32,8 @@
~CommandObjectSettings ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
};
Modified: lldb/trunk/source/Commands/CommandObjectShow.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectShow.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectShow.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectShow.cpp Tue Jun 22 20:19:29 2010
@@ -38,9 +38,8 @@
bool
CommandObjectShow::Execute
(
+ CommandInterpreter &interpreter,
Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
@@ -51,7 +50,7 @@
// The user requested to see the value of a particular variable.
const char *var_name = command.GetArgumentAtIndex(0);
- StateVariable *var = interpreter->GetStateVariable(var_name);
+ StateVariable *var = interpreter.GetStateVariable(var_name);
if (var)
{
var->AppendVariableInformation (result);
@@ -66,7 +65,7 @@
else
{
// The user didn't specify a particular variable, so show the values of all of them.
- interpreter->ShowVariableValues(result);
+ interpreter.ShowVariableValues(result);
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
Modified: lldb/trunk/source/Commands/CommandObjectShow.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectShow.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectShow.h (original)
+++ lldb/trunk/source/Commands/CommandObjectShow.h Tue Jun 22 20:19:29 2010
@@ -32,9 +32,8 @@
~CommandObjectShow ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
};
Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSource.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSource.cpp Tue Jun 22 20:19:29 2010
@@ -14,7 +14,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/Args.h"
-#include "lldb/Interpreter/CommandContext.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Target/Process.h"
@@ -43,9 +43,8 @@
bool
CommandObjectSource::Execute
(
+ CommandInterpreter &interpreter,
Args& args,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
@@ -88,8 +87,8 @@
size_t i;
for (i = 0; i<num_commands; ++i)
{
- result.GetOutputStream().Printf("%s %s\n", interpreter->GetPrompt(), commands[i].c_str());
- if (!interpreter->HandleCommand(commands[i].c_str(), false, result))
+ result.GetOutputStream().Printf("%s %s\n", interpreter.GetPrompt(), commands[i].c_str());
+ if (!interpreter.HandleCommand(commands[i].c_str(), false, result))
break;
}
Modified: lldb/trunk/source/Commands/CommandObjectSource.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSource.h (original)
+++ lldb/trunk/source/Commands/CommandObjectSource.h Tue Jun 22 20:19:29 2010
@@ -36,9 +36,8 @@
GetCommands ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
};
Modified: lldb/trunk/source/Commands/CommandObjectSourceFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSourceFile.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSourceFile.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSourceFile.cpp Tue Jun 22 20:19:29 2010
@@ -14,7 +14,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/Args.h"
-#include "lldb/Interpreter/CommandContext.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Target/Process.h"
@@ -119,9 +119,8 @@
bool
CommandObjectSourceFile::Execute
(
+ CommandInterpreter &interpreter,
Args& args,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
@@ -133,7 +132,7 @@
result.SetStatus (eReturnStatusFailed);
}
- ExecutionContext exe_ctx(context->GetExecutionContext());
+ ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
if (m_options.file_name.empty())
{
// Last valid source manager context, or the current frame if no
@@ -142,14 +141,14 @@
// more likely because you typed it once, then typed it again
if (m_options.start_line == 0)
{
- if (interpreter->GetSourceManager().DisplayMoreWithLineNumbers (&result.GetOutputStream()))
+ if (interpreter.GetDebugger().GetSourceManager().DisplayMoreWithLineNumbers (&result.GetOutputStream()))
{
result.SetStatus (eReturnStatusSuccessFinishResult);
}
}
else
{
- if (interpreter->GetSourceManager().DisplaySourceLinesWithLineNumbersUsingLastFile(
+ if (interpreter.GetDebugger().GetSourceManager().DisplaySourceLinesWithLineNumbersUsingLastFile(
m_options.start_line, // Line to display
0, // Lines before line to display
m_options.num_lines, // Lines after line to display
@@ -164,7 +163,7 @@
else
{
const char *filename = m_options.file_name.c_str();
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
result.AppendError ("invalid target, set executable file using 'file' command");
@@ -187,13 +186,13 @@
{
if (sc.comp_unit)
{
- interpreter->GetSourceManager ().DisplaySourceLinesWithLineNumbers (sc.comp_unit,
- m_options.start_line, // Line to display
- 0, // Lines before line to display
- m_options.num_lines, // Lines after line to display
- "", // Don't mark "line"
- &result.GetOutputStream());
-
+ interpreter.GetDebugger().GetSourceManager ().DisplaySourceLinesWithLineNumbers (sc.comp_unit,
+ m_options.start_line, // Line to display
+ 0, // Lines before line to display
+ m_options.num_lines, // Lines after line to display
+ "", // Don't mark "line"
+ &result.GetOutputStream());
+
result.SetStatus (eReturnStatusSuccessFinishResult);
}
Modified: lldb/trunk/source/Commands/CommandObjectSourceFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSourceFile.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSourceFile.h (original)
+++ lldb/trunk/source/Commands/CommandObjectSourceFile.h Tue Jun 22 20:19:29 2010
@@ -62,9 +62,8 @@
~CommandObjectSourceFile ();
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
virtual
Modified: lldb/trunk/source/Commands/CommandObjectSyntax.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSyntax.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSyntax.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSyntax.cpp Tue Jun 22 20:19:29 2010
@@ -43,7 +43,7 @@
CommandObjectSyntax::OldExecute
(
Args& command,
- CommandContext *context,
+ Debugger *context,
CommandInterpreter *interpreter,
CommandReturnObject &result
)
@@ -86,7 +86,7 @@
}
bool
-CommandObjectSyntax::Execute (Args &command, CommandContext *context, CommandInterpreter *interpreter,
+CommandObjectSyntax::Execute (Args &command, Debugger *context, CommandInterpreter *interpreter,
CommandReturnObject &result)
{
CommandObject::CommandMap::iterator pos;
Modified: lldb/trunk/source/Commands/CommandObjectSyntax.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSyntax.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSyntax.h (original)
+++ lldb/trunk/source/Commands/CommandObjectSyntax.h Tue Jun 22 20:19:29 2010
@@ -33,13 +33,13 @@
bool
OldExecute (Args& command,
- CommandContext *context,
+ Debugger *context,
CommandInterpreter *interpreter,
CommandReturnObject &result);
virtual bool
Execute (Args& command,
- CommandContext *context,
+ Debugger *context,
CommandInterpreter *interpreter,
CommandReturnObject &result);
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Tue Jun 22 20:19:29 2010
@@ -18,7 +18,7 @@
#include "lldb/Interpreter/Args.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Timer.h"
-#include "lldb/Interpreter/CommandContext.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Target/Process.h"
@@ -46,12 +46,11 @@
}
bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Target * target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target)
{
uint32_t argc = command.GetArgumentCount();
@@ -70,9 +69,9 @@
if (from[0] && to[0])
{
bool last_pair = ((argc - i) == 2);
- target->GetImageSearchPathList().Append(ConstString(from),
- ConstString(to),
- last_pair); // Notify if this is the last pair
+ target->GetImageSearchPathList().Append (ConstString(from),
+ ConstString(to),
+ last_pair); // Notify if this is the last pair
}
else
{
@@ -110,12 +109,11 @@
}
bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Target * target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target)
{
bool notify = true;
@@ -146,12 +144,11 @@
}
bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Target * target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target)
{
uint32_t argc = command.GetArgumentCount();
@@ -230,12 +227,11 @@
}
bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Target * target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target)
{
if (command.GetArgumentCount() != 0)
@@ -272,12 +268,11 @@
}
bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result)
{
- Target * target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target)
{
if (command.GetArgumentCount() != 1)
@@ -327,8 +322,8 @@
//
// bool
// Execute (Args& command,
-// CommandContext *context,
-// CommandInterpreter *interpreter,
+// Debugger *context,
+// CommandInterpreter &interpreter,
// CommandReturnObject &result)
// {
// ExecutionContext exe_ctx (context->GetExecutionContext());
@@ -392,16 +387,16 @@
{
public:
- CommandObjectMultiwordImageSearchPaths (CommandInterpreter *interpreter) :
+ CommandObjectMultiwordImageSearchPaths (CommandInterpreter &interpreter) :
CommandObjectMultiword ("target image-search-paths",
"A set of commands for operating on debugger target image search paths.",
"target image-search-paths <subcommand> [<subcommand-options>]")
{
- LoadSubCommand (CommandObjectSP (new CommandObjectTargetImageSearchPathsAdd ()), "add", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectTargetImageSearchPathsClear ()), "clear", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectTargetImageSearchPathsInsert ()), "insert", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectTargetImageSearchPathsList ()), "list", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectTargetImageSearchPathsQuery ()), "query", interpreter);
+ LoadSubCommand (interpreter, "add", CommandObjectSP (new CommandObjectTargetImageSearchPathsAdd ()));
+ LoadSubCommand (interpreter, "clear", CommandObjectSP (new CommandObjectTargetImageSearchPathsClear ()));
+ LoadSubCommand (interpreter, "insert", CommandObjectSP (new CommandObjectTargetImageSearchPathsInsert ()));
+ LoadSubCommand (interpreter, "list", CommandObjectSP (new CommandObjectTargetImageSearchPathsList ()));
+ LoadSubCommand (interpreter, "query", CommandObjectSP (new CommandObjectTargetImageSearchPathsQuery ()));
}
~CommandObjectMultiwordImageSearchPaths()
@@ -416,12 +411,12 @@
// CommandObjectMultiwordTarget
//-------------------------------------------------------------------------
-CommandObjectMultiwordTarget::CommandObjectMultiwordTarget (CommandInterpreter *interpreter) :
+CommandObjectMultiwordTarget::CommandObjectMultiwordTarget (CommandInterpreter &interpreter) :
CommandObjectMultiword ("target",
"A set of commands for operating on debugger targets.",
"target <subcommand> [<subcommand-options>]")
{
- LoadSubCommand (CommandObjectSP (new CommandObjectMultiwordImageSearchPaths (interpreter)), "image-search-paths", interpreter);
+ LoadSubCommand (interpreter, "image-search-paths", CommandObjectSP (new CommandObjectMultiwordImageSearchPaths (interpreter)));
}
CommandObjectMultiwordTarget::~CommandObjectMultiwordTarget ()
Modified: lldb/trunk/source/Commands/CommandObjectTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.h (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.h Tue Jun 22 20:19:29 2010
@@ -28,7 +28,7 @@
{
public:
- CommandObjectMultiwordTarget (CommandInterpreter *interpreter);
+ CommandObjectMultiwordTarget (CommandInterpreter &interpreter);
virtual
~CommandObjectMultiwordTarget ();
Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Tue Jun 22 20:19:29 2010
@@ -39,7 +39,7 @@
bool
lldb_private::DisplayThreadInfo
(
- CommandInterpreter *interpreter,
+ CommandInterpreter &interpreter,
Stream &strm,
Thread *thread,
bool only_threads_with_stop_reason,
@@ -96,7 +96,7 @@
size_t
lldb_private::DisplayThreadsInfo
(
- CommandInterpreter *interpreter,
+ CommandInterpreter &interpreter,
ExecutionContext *exe_ctx,
CommandReturnObject &result,
bool only_threads_with_stop_reason,
@@ -145,7 +145,7 @@
lldb_private::DisplayFramesForExecutionContext
(
Thread *thread,
- CommandInterpreter *interpreter,
+ CommandInterpreter &interpreter,
Stream& strm,
bool ascending,
uint32_t first_frame,
@@ -226,7 +226,7 @@
(
Thread *thread,
StackFrame *frame,
- CommandInterpreter *interpreter,
+ CommandInterpreter &interpreter,
Stream& strm,
bool show_frame_info,
bool show_source,
@@ -248,7 +248,7 @@
if (show_source && sc.comp_unit && sc.line_entry.IsValid())
{
- interpreter->GetSourceManager().DisplaySourceLinesWithLineNumbers (
+ interpreter.GetDebugger().GetSourceManager().DisplaySourceLinesWithLineNumbers (
sc.line_entry.file,
sc.line_entry.line,
3,
@@ -285,18 +285,17 @@
}
- bool
+ virtual bool
Execute
(
+ CommandInterpreter &interpreter,
Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
if (command.GetArgumentCount() == 0)
{
- ExecutionContext exe_ctx(context->GetExecutionContext());
+ ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
if (exe_ctx.thread)
{
bool show_frame_info = true;
@@ -441,13 +440,15 @@
}
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result)
+ Execute
+ (
+ CommandInterpreter &interpreter,
+ Args& command,
+ CommandReturnObject &result
+ )
{
- Process *process = context->GetExecutionContext().process;
- bool synchronous_execution = interpreter->GetSynchronous();
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+ bool synchronous_execution = interpreter.GetSynchronous();
if (process == NULL)
{
@@ -647,21 +648,23 @@
}
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result)
+ Execute
+ (
+ CommandInterpreter &interpreter,
+ Args& command,
+ CommandReturnObject &result
+ )
{
- bool synchronous_execution = interpreter->GetSynchronous ();
+ bool synchronous_execution = interpreter.GetSynchronous ();
- if (!context->GetTarget())
+ if (!interpreter.GetDebugger().GetCurrentTarget().get())
{
result.AppendError ("invalid target, set executable file using 'file' command");
result.SetStatus (eReturnStatusFailed);
return false;
}
- Process *process = context->GetExecutionContext().process;
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (process == NULL)
{
result.AppendError ("no process exists. Cannot continue");
@@ -897,21 +900,23 @@
}
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result)
+ Execute
+ (
+ CommandInterpreter &interpreter,
+ Args& command,
+ CommandReturnObject &result
+ )
{
- bool synchronous_execution = interpreter->GetSynchronous ();
+ bool synchronous_execution = interpreter.GetSynchronous ();
- if (!context->GetTarget())
+ if (!interpreter.GetDebugger().GetCurrentTarget().get())
{
result.AppendError ("invalid target, set executable file using 'file' command");
result.SetStatus (eReturnStatusFailed);
return false;
}
- Process *process = context->GetExecutionContext().process;
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (process == NULL)
{
result.AppendError ("need a valid process to step");
@@ -1085,12 +1090,14 @@
}
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result)
+ Execute
+ (
+ CommandInterpreter &interpreter,
+ Args& command,
+ CommandReturnObject &result
+ )
{
- Process *process = context->GetExecutionContext().process;
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (process == NULL)
{
result.AppendError ("no process");
@@ -1132,128 +1139,130 @@
// CommandObjectThreadList
//-------------------------------------------------------------------------
-CommandObjectThreadList::CommandObjectThreadList ():
- CommandObject ("thread list",
- "Shows a summary of all current threads in a process.",
- "thread list",
- eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
+class CommandObjectThreadList : public CommandObject
{
-}
+public:
-CommandObjectThreadList::~CommandObjectThreadList()
-{
-}
-bool
-CommandObjectThreadList::Execute
-(
- Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result
-)
-{
- StreamString &strm = 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();
- strm.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
+ CommandObjectThreadList ():
+ CommandObject ("thread list",
+ "Shows a summary of all current threads in a process.",
+ "thread list",
+ eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
+ {
+ }
+
+ ~CommandObjectThreadList()
+ {
+ }
+
+ bool
+ Execute
+ (
+ CommandInterpreter &interpreter,
+ Args& command,
+ CommandReturnObject &result
+ )
+ {
+ StreamString &strm = result.GetOutputStream();
+ result.SetStatus (eReturnStatusSuccessFinishNoResult);
+ ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
+ if (exe_ctx.process)
+ {
+ const StateType state = exe_ctx.process->GetState();
+
+ if (StateIsStoppedState(state))
{
- strm.Printf ("Process %d state is %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)
+ if (state == eStateExited)
{
- DisplayThreadsInfo (interpreter, &exe_ctx, result, false, false);
+ int exit_status = exe_ctx.process->GetExitStatus();
+ const char *exit_description = exe_ctx.process->GetExitDescription();
+ strm.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
{
- result.AppendError ("no valid thread found in current process");
- result.SetStatus (eReturnStatusFailed);
+ strm.Printf ("Process %d state is %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, false, false);
+ }
+ else
+ {
+ result.AppendError ("no valid thread found in current process");
+ result.SetStatus (eReturnStatusFailed);
+ }
}
}
+ else
+ {
+ result.AppendError ("process is currently running");
+ result.SetStatus (eReturnStatusFailed);
+ }
}
else
{
- result.AppendError ("process is currently running");
+ result.AppendError ("no current location or status available");
result.SetStatus (eReturnStatusFailed);
}
+ return result.Succeeded();
}
- else
- {
- result.AppendError ("no current location or status available");
- result.SetStatus (eReturnStatusFailed);
- }
- return result.Succeeded();
-}
+};
//-------------------------------------------------------------------------
// CommandObjectMultiwordThread
//-------------------------------------------------------------------------
-CommandObjectMultiwordThread::CommandObjectMultiwordThread (CommandInterpreter *interpreter) :
+CommandObjectMultiwordThread::CommandObjectMultiwordThread (CommandInterpreter &interpreter) :
CommandObjectMultiword ("thread",
"A set of commands for operating on one or more thread within a running process.",
"thread <subcommand> [<subcommand-options>]")
{
- LoadSubCommand (CommandObjectSP (new CommandObjectThreadBacktrace ()), "backtrace", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectThreadContinue ()), "continue", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectThreadList ()), "list", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectThreadSelect ()), "select", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectThreadUntil ()), "until", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope ("thread step-in",
- "Source level single step in in specified thread (current thread, if none specified).",
- "thread step-in [<thread-id>]",
- eFlagProcessMustBeLaunched | eFlagProcessMustBePaused,
- eStepTypeInto,
- eStepScopeSource)),
- "step-in", interpreter);
-
- LoadSubCommand (CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope ("thread step-out",
+ LoadSubCommand (interpreter, "backtrace", CommandObjectSP (new CommandObjectThreadBacktrace ()));
+ LoadSubCommand (interpreter, "continue", CommandObjectSP (new CommandObjectThreadContinue ()));
+ LoadSubCommand (interpreter, "list", CommandObjectSP (new CommandObjectThreadList ()));
+ LoadSubCommand (interpreter, "select", CommandObjectSP (new CommandObjectThreadSelect ()));
+ LoadSubCommand (interpreter, "until", CommandObjectSP (new CommandObjectThreadUntil ()));
+ LoadSubCommand (interpreter, "step-in", CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope (
+ "thread step-in",
+ "Source level single step in in specified thread (current thread, if none specified).",
+ "thread step-in [<thread-id>]",
+ eFlagProcessMustBeLaunched | eFlagProcessMustBePaused,
+ eStepTypeInto,
+ eStepScopeSource)));
+
+ LoadSubCommand (interpreter, "step-out", CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope ("thread step-out",
"Source level single step out in specified thread (current thread, if none specified).",
"thread step-out [<thread-id>]",
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused,
eStepTypeOut,
- eStepScopeSource)),
- "step-out", interpreter);
+ eStepScopeSource)));
- LoadSubCommand (CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope ("thread step-over",
+ LoadSubCommand (interpreter, "step-over", CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope ("thread step-over",
"Source level single step over in specified thread (current thread, if none specified).",
"thread step-over [<thread-id>]",
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused,
eStepTypeOver,
- eStepScopeSource)),
- "step-over", interpreter);
+ eStepScopeSource)));
- LoadSubCommand (CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope ("thread step-inst",
+ LoadSubCommand (interpreter, "step-inst", CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope ("thread step-inst",
"Single step one instruction in specified thread (current thread, if none specified).",
"thread step-inst [<thread-id>]",
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused,
eStepTypeTrace,
- eStepScopeInstruction)),
- "step-inst", interpreter);
- LoadSubCommand (CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope ("thread step-inst-over",
+ eStepScopeInstruction)));
+
+ LoadSubCommand (interpreter, "step-inst-over", CommandObjectSP (new CommandObjectThreadStepWithTypeAndScope ("thread step-inst-over",
"Single step one instruction in specified thread (current thread, if none specified), stepping over calls.",
"thread step-inst-over [<thread-id>]",
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused,
eStepTypeTraceOver,
- eStepScopeInstruction)),
- "step-inst-over", interpreter);
+ eStepScopeInstruction)));
}
CommandObjectMultiwordThread::~CommandObjectMultiwordThread ()
Modified: lldb/trunk/source/Commands/CommandObjectThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectThread.h (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.h Tue Jun 22 20:19:29 2010
@@ -18,27 +18,11 @@
namespace lldb_private {
-class CommandObjectThreadList : public CommandObject
-{
-public:
-
- CommandObjectThreadList ();
-
- ~CommandObjectThreadList ();
-
- virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result);
-};
-
-
class CommandObjectMultiwordThread : public CommandObjectMultiword
{
public:
- CommandObjectMultiwordThread (CommandInterpreter *interpreter);
+ CommandObjectMultiwordThread (CommandInterpreter &interpreter);
virtual
~CommandObjectMultiwordThread ();
@@ -47,14 +31,14 @@
bool
-DisplayThreadInfo (CommandInterpreter *interpreter,
+DisplayThreadInfo (CommandInterpreter &interpreter,
Stream &strm,
Thread *thread,
bool only_threads_with_stop_reason,
bool show_source);
size_t
-DisplayThreadsInfo (CommandInterpreter *interpreter,
+DisplayThreadsInfo (CommandInterpreter &interpreter,
ExecutionContext *exe_ctx,
CommandReturnObject &result,
bool only_threads_with_stop_reason,
@@ -62,7 +46,7 @@
size_t
DisplayFramesForExecutionContext (Thread *thread,
- CommandInterpreter *interpreter,
+ CommandInterpreter &interpreter,
Stream& strm,
bool ascending,
uint32_t first_frame,
@@ -75,7 +59,7 @@
bool
DisplayFrameForExecutionContext (Thread *thread,
StackFrame *frame,
- CommandInterpreter *interpreter,
+ CommandInterpreter &interpreter,
Stream& strm,
bool show_frame_info,
bool show_source,
Removed: lldb/trunk/source/Commands/CommandObjectTranslate.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTranslate.cpp?rev=106614&view=auto
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTranslate.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTranslate.cpp (removed)
@@ -1,75 +0,0 @@
-//===-- CommandObjectTranslate.cpp ------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "CommandObjectTranslate.h"
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Interpreter/Args.h"
-#include "lldb/Interpreter/Options.h"
-
-#include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/CommandReturnObject.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-//-------------------------------------------------------------------------
-// CommandObjectTranslate
-//-------------------------------------------------------------------------
-
-CommandObjectTranslate::CommandObjectTranslate () :
- CommandObject ("translate",
- "Shows the actual function called for a given debugger command.",
- "translate <command>")
-{
-}
-
-CommandObjectTranslate::~CommandObjectTranslate()
-{
-}
-
-
-bool
-CommandObjectTranslate::Execute
-(
- Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result
-)
-{
- CommandObject *cmd_obj;
-
- if (command.GetArgumentCount() != 0)
- {
- cmd_obj = interpreter->GetCommandObject(command.GetArgumentAtIndex(0));
- if (cmd_obj)
- {
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
- result.AppendMessageWithFormat ("%s\n", cmd_obj->Translate());
- }
- else
- {
- result.AppendErrorWithFormat
- ("'%s' is not a known command.\nTry 'help' to see a current list of commands.\n",
- command.GetArgumentAtIndex(0));
- result.SetStatus (eReturnStatusFailed);
- }
- }
- else
- {
- result.AppendError ("must call translate with a valid command");
- result.SetStatus (eReturnStatusFailed);
- }
-
- return result.Succeeded();
-}
Removed: lldb/trunk/source/Commands/CommandObjectTranslate.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTranslate.h?rev=106614&view=auto
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTranslate.h (original)
+++ lldb/trunk/source/Commands/CommandObjectTranslate.h (removed)
@@ -1,44 +0,0 @@
-//===-- CommandObjectTranslate.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_CommandObjectTranslate_h_
-#define liblldb_CommandObjectTranslate_h_
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Interpreter/CommandObject.h"
-
-namespace lldb_private {
-
-//-------------------------------------------------------------------------
-// CommandObjectTranslate
-//-------------------------------------------------------------------------
-
-class CommandObjectTranslate : public CommandObject
-{
-public:
-
- CommandObjectTranslate ();
-
- virtual
- ~CommandObjectTranslate ();
-
- virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result);
-
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_CommandObjectTranslate_h_
Modified: lldb/trunk/source/Commands/CommandObjectUnalias.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectUnalias.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectUnalias.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectUnalias.cpp Tue Jun 22 20:19:29 2010
@@ -25,8 +25,8 @@
CommandObjectUnalias::CommandObjectUnalias () :
CommandObject ("unalias",
- "Allows the user to remove/delete a user-defined command abbreviation.",
- "unalias <alias-name-to-be-removed>")
+ "Allows the user to remove/delete a user-defined command abbreviation.",
+ "unalias <alias-name-to-be-removed>")
{
}
@@ -36,8 +36,12 @@
bool
-CommandObjectUnalias::Execute (Args& args, CommandContext *context, CommandInterpreter *interpreter,
- CommandReturnObject &result)
+CommandObjectUnalias::Execute
+(
+ CommandInterpreter &interpreter,
+ Args& args,
+ CommandReturnObject &result
+)
{
CommandObject::CommandMap::iterator pos;
CommandObject *cmd_obj;
@@ -45,10 +49,10 @@
if (args.GetArgumentCount() != 0)
{
const char *command_name = args.GetArgumentAtIndex(0);
- cmd_obj = interpreter->GetCommandObject(command_name);
+ cmd_obj = interpreter.GetCommandObject(command_name);
if (cmd_obj)
{
- if (interpreter->CommandExists (command_name))
+ if (interpreter.CommandExists (command_name))
{
result.AppendErrorWithFormat ("'%s' is a permanent debugger command and cannot be removed.\n",
command_name);
@@ -57,9 +61,9 @@
else
{
- if (interpreter->RemoveAlias (command_name) == false)
+ if (interpreter.RemoveAlias (command_name) == false)
{
- if (interpreter->AliasExists (command_name))
+ if (interpreter.AliasExists (command_name))
result.AppendErrorWithFormat ("Error occurred while attempting to unalias '%s'.\n", command_name);
else
result.AppendErrorWithFormat ("'%s' is not an existing alias.\n", command_name);
Modified: lldb/trunk/source/Commands/CommandObjectUnalias.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectUnalias.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectUnalias.h (original)
+++ lldb/trunk/source/Commands/CommandObjectUnalias.h Tue Jun 22 20:19:29 2010
@@ -32,9 +32,8 @@
~CommandObjectUnalias ();
virtual bool
- Execute (Args& args,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& args,
CommandReturnObject &result);
};
Modified: lldb/trunk/source/Commands/CommandObjectVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectVariable.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectVariable.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectVariable.cpp Tue Jun 22 20:19:29 2010
@@ -465,12 +465,14 @@
}
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result)
+ Execute
+ (
+ CommandInterpreter &interpreter,
+ Args& command,
+ CommandReturnObject &result
+ )
{
- ExecutionContext exe_ctx(context->GetExecutionContext());
+ ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
if (exe_ctx.frame == NULL)
{
result.AppendError ("invalid frame");
@@ -492,14 +494,13 @@
if (!m_options.globals.empty())
{
uint32_t fail_count = 0;
- Target *target = context->GetTarget();
- if (target)
+ if (exe_ctx.target)
{
const size_t num_globals = m_options.globals.size();
for (idx = 0; idx < num_globals; ++idx)
{
VariableList global_var_list;
- const uint32_t num_matching_globals = target->GetImages().FindGlobalVariables (m_options.globals[idx], true, UINT32_MAX, global_var_list);
+ const uint32_t num_matching_globals = exe_ctx.target->GetImages().FindGlobalVariables (m_options.globals[idx], true, UINT32_MAX, global_var_list);
if (num_matching_globals == 0)
{
@@ -781,12 +782,12 @@
//----------------------------------------------------------------------
// CommandObjectVariable constructor
//----------------------------------------------------------------------
-CommandObjectVariable::CommandObjectVariable(CommandInterpreter *interpreter) :
+CommandObjectVariable::CommandObjectVariable(CommandInterpreter &interpreter) :
CommandObjectMultiword ("variable",
- "Access program arguments, locals, static and global variables.",
- "variable [list] ...")
+ "Access program arguments, locals, static and global variables.",
+ "variable [list] ...")
{
- LoadSubCommand (CommandObjectSP (new CommandObjectVariableList ()), "list", interpreter);
+ LoadSubCommand (interpreter, "list", CommandObjectSP (new CommandObjectVariableList ()));
}
//----------------------------------------------------------------------
Modified: lldb/trunk/source/Commands/CommandObjectVariable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectVariable.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectVariable.h (original)
+++ lldb/trunk/source/Commands/CommandObjectVariable.h Tue Jun 22 20:19:29 2010
@@ -26,7 +26,7 @@
{
public:
- CommandObjectVariable (CommandInterpreter *iterpreter);
+ CommandObjectVariable (CommandInterpreter &interpreter);
virtual
~CommandObjectVariable ();
Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Tue Jun 22 20:19:29 2010
@@ -13,7 +13,7 @@
#include "lldb/Core/InputReader.h"
#include "lldb/Core/State.h"
#include "lldb/Core/Timer.h"
-
+#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Target/TargetList.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Thread.h"
@@ -22,115 +22,137 @@
using namespace lldb;
using namespace lldb_private;
-int Debugger::g_shared_debugger_refcount = 0;
-bool Debugger::g_in_terminate = false;
-
-Debugger::DebuggerSP &
-Debugger::GetDebuggerSP ()
-{
- static DebuggerSP g_shared_debugger_sp;
- return g_shared_debugger_sp;
-}
+static uint32_t g_shared_debugger_refcount = 0;
void
Debugger::Initialize ()
{
- g_shared_debugger_refcount++;
- if (GetDebuggerSP().get() == NULL)
- {
- GetDebuggerSP().reset (new Debugger());
+ if (g_shared_debugger_refcount == 0)
lldb_private::Initialize();
- GetDebuggerSP()->GetCommandInterpreter().Initialize();
- }
+ g_shared_debugger_refcount++;
}
void
Debugger::Terminate ()
{
- g_shared_debugger_refcount--;
- if (g_shared_debugger_refcount == 0)
+ if (g_shared_debugger_refcount > 0)
{
- // Because Terminate is called also in the destructor, we need to make sure
- // that none of the calls to GetSharedInstance leads to a call to Initialize,
- // thus bumping the refcount back to 1 & causing Debugger::~Debugger to try to
- // re-terminate. So we use g_in_terminate to indicate this condition.
- // When we can require at least Initialize to be called, we won't have to do
- // this since then the GetSharedInstance won't have to auto-call Initialize...
-
- g_in_terminate = true;
- int num_targets = GetDebuggerSP()->GetTargetList().GetNumTargets();
- for (int i = 0; i < num_targets; i++)
+ g_shared_debugger_refcount--;
+ if (g_shared_debugger_refcount == 0)
{
- ProcessSP process_sp(GetDebuggerSP()->GetTargetList().GetTargetAtIndex (i)->GetProcessSP());
- if (process_sp)
- process_sp->Destroy();
+ lldb_private::WillTerminate();
+ lldb_private::Terminate();
}
- GetDebuggerSP()->DisconnectInput();
- lldb_private::WillTerminate();
- GetDebuggerSP().reset();
}
}
-Debugger &
-Debugger::GetSharedInstance()
+typedef std::vector<DebuggerSP> DebuggerList;
+
+static Mutex &
+GetDebuggerListMutex ()
+{
+ static Mutex g_mutex(Mutex::eMutexTypeRecursive);
+ return g_mutex;
+}
+
+static DebuggerList &
+GetDebuggerList()
+{
+ // hide the static debugger list inside a singleton accessor to avoid
+ // global init contructors
+ static DebuggerList g_list;
+ return g_list;
+}
+
+
+DebuggerSP
+Debugger::CreateInstance ()
+{
+ DebuggerSP debugger_sp (new Debugger);
+ // Scope for locker
+ {
+ Mutex::Locker locker (GetDebuggerListMutex ());
+ GetDebuggerList().push_back(debugger_sp);
+ }
+ return debugger_sp;
+}
+
+lldb::DebuggerSP
+Debugger::GetSP ()
{
- // Don't worry about thread race conditions with the code below as
- // lldb_private::Initialize(); does this in a thread safe way. I just
- // want to avoid having to lock and unlock a mutex in
- // lldb_private::Initialize(); every time we want to access the
- // Debugger shared instance.
+ lldb::DebuggerSP debugger_sp;
- // FIXME: We intend to require clients to call Initialize by hand (since they
- // will also have to call Terminate by hand.) But for now it is not clear where
- // we can reliably call these in JH. So the present version initializes on first use
- // here, and terminates in the destructor.
- if (g_shared_debugger_refcount == 0 && !g_in_terminate)
- Initialize();
-
- assert(GetDebuggerSP().get()!= NULL);
- return *(GetDebuggerSP().get());
+ Mutex::Locker locker (GetDebuggerListMutex ());
+ DebuggerList &debugger_list = GetDebuggerList();
+ DebuggerList::iterator pos, end = debugger_list.end();
+ for (pos = debugger_list.begin(); pos != end; ++pos)
+ {
+ if ((*pos).get() == this)
+ {
+ debugger_sp = *pos;
+ break;
+ }
+ }
+ return debugger_sp;
}
+
+TargetSP
+Debugger::FindTargetWithProcessID (lldb::pid_t pid)
+{
+ lldb::TargetSP target_sp;
+ Mutex::Locker locker (GetDebuggerListMutex ());
+ DebuggerList &debugger_list = GetDebuggerList();
+ DebuggerList::iterator pos, end = debugger_list.end();
+ for (pos = debugger_list.begin(); pos != end; ++pos)
+ {
+ target_sp = (*pos)->GetTargetList().FindTargetWithProcessID (pid);
+ if (target_sp)
+ break;
+ }
+ return target_sp;
+}
+
+
Debugger::Debugger () :
m_input_comm("debugger.input"),
m_input_file (),
m_output_file (),
m_error_file (),
- m_async_execution (true),
m_target_list (),
m_listener ("lldb.Debugger"),
m_source_manager (),
- m_command_interpreter (eScriptLanguageDefault, false, &m_listener, m_source_manager),
+ m_command_interpreter_ap (new CommandInterpreter (*this, eScriptLanguageDefault, false)),
+ m_exe_ctx (),
m_input_readers (),
m_input_reader_data ()
{
+ m_command_interpreter_ap->Initialize ();
}
Debugger::~Debugger ()
{
- // FIXME:
- // Remove this once this version of lldb has made its way through a build.
- Terminate();
+ int num_targets = m_target_list.GetNumTargets();
+ for (int i = 0; i < num_targets; i++)
+ {
+ ProcessSP process_sp (m_target_list.GetTargetAtIndex (i)->GetProcessSP());
+ if (process_sp)
+ process_sp->Destroy();
+ }
+ DisconnectInput();
}
bool
Debugger::GetAsyncExecution ()
{
- return m_async_execution;
+ return !m_command_interpreter_ap->GetSynchronous();
}
void
Debugger::SetAsyncExecution (bool async_execution)
{
- static bool value_has_been_set = false;
-
- if (!value_has_been_set)
- {
- value_has_been_set = true;
- m_async_execution = async_execution;
- m_command_interpreter.SetSynchronous (!async_execution);
- }
+ m_command_interpreter_ap->SetSynchronous (!async_execution);
}
void
@@ -203,7 +225,8 @@
CommandInterpreter &
Debugger::GetCommandInterpreter ()
{
- return m_command_interpreter;
+ assert (m_command_interpreter_ap.get());
+ return *m_command_interpreter_ap;
}
Listener &
@@ -432,3 +455,39 @@
}
}
}
+
+void
+Debugger::UpdateExecutionContext (ExecutionContext *override_context)
+{
+ m_exe_ctx.Clear();
+
+ if (override_context != NULL)
+ {
+ m_exe_ctx.target = override_context->target;
+ m_exe_ctx.process = override_context->process;
+ m_exe_ctx.thread = override_context->thread;
+ m_exe_ctx.frame = override_context->frame;
+ }
+ else
+ {
+ TargetSP target_sp (GetCurrentTarget());
+ if (target_sp)
+ {
+ m_exe_ctx.target = target_sp.get();
+ m_exe_ctx.process = target_sp->GetProcessSP().get();
+ if (m_exe_ctx.process && m_exe_ctx.process->IsRunning() == false)
+ {
+ m_exe_ctx.thread = m_exe_ctx.process->GetThreadList().GetCurrentThread().get();
+ if (m_exe_ctx.thread == NULL)
+ m_exe_ctx.thread = m_exe_ctx.process->GetThreadList().GetThreadAtIndex(0).get();
+ if (m_exe_ctx.thread)
+ {
+ m_exe_ctx.frame = m_exe_ctx.thread->GetCurrentFrame().get();
+ if (m_exe_ctx.frame == NULL)
+ m_exe_ctx.frame = m_exe_ctx.thread->GetStackFrameAtIndex (0).get();
+ }
+ }
+ }
+ }
+}
+
Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Tue Jun 22 20:19:29 2010
@@ -55,6 +55,7 @@
bool
Disassembler::Disassemble
(
+ Debugger &debugger,
const ArchSpec &arch,
const ExecutionContext &exe_ctx,
uint32_t mixed_context_lines,
@@ -144,7 +145,7 @@
if (sc.comp_unit && sc.line_entry.IsValid())
{
- Debugger::GetSharedInstance().GetSourceManager().DisplaySourceLinesWithLineNumbers (
+ debugger.GetSourceManager().DisplaySourceLinesWithLineNumbers (
sc.line_entry.file,
sc.line_entry.line,
mixed_context_lines,
Modified: lldb/trunk/source/Core/InputReader.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/InputReader.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Core/InputReader.cpp (original)
+++ lldb/trunk/source/Core/InputReader.cpp Tue Jun 22 20:19:29 2010
@@ -15,7 +15,8 @@
using namespace lldb;
using namespace lldb_private;
-InputReader::InputReader () :
+InputReader::InputReader (Debugger &debugger) :
+ m_debugger (debugger),
m_callback (NULL),
m_callback_baton (NULL),
m_end_token (),
@@ -126,7 +127,7 @@
break;
}
- if (m_callback (m_callback_baton, this, eInputReaderGotToken, p, 1) == 0)
+ if (m_callback (m_callback_baton, *this, eInputReaderGotToken, p, 1) == 0)
break;
++p;
if (IsDone())
@@ -175,7 +176,7 @@
{
const size_t word_len = p - word_start;
size_t bytes_handled = m_callback (m_callback_baton,
- this,
+ *this,
eInputReaderGotToken,
word_start,
word_len);
@@ -212,7 +213,7 @@
{
SetIsDone(true);
m_callback (m_callback_baton,
- this,
+ *this,
eInputReaderGotToken,
line_start,
end_token - line_start);
@@ -221,7 +222,7 @@
}
size_t bytes_handled = m_callback (m_callback_baton,
- this,
+ *this,
eInputReaderGotToken,
line_start,
line_length);
@@ -259,7 +260,7 @@
{
size_t length = end_token - bytes;
size_t bytes_handled = m_callback (m_callback_baton,
- this,
+ *this,
eInputReaderGotToken,
bytes,
length);
@@ -287,19 +288,6 @@
return 0;
}
-
-FILE *
-InputReader::GetInputFileHandle ()
-{
- return Debugger::GetSharedInstance().GetInputFileHandle ();
-}
-
-FILE *
-InputReader::GetOutputFileHandle ()
-{
- return Debugger::GetSharedInstance().GetOutputFileHandle ();
-}
-
const char *
InputReader::GetPrompt () const
{
@@ -314,7 +302,7 @@
{
if (!m_prompt.empty())
{
- FILE *out_fh = GetOutputFileHandle();
+ FILE *out_fh = m_debugger.GetOutputFileHandle();
if (out_fh)
::fprintf (out_fh, "%s", m_prompt.c_str());
}
@@ -339,5 +327,5 @@
return; // We don't notify the tokens here, it is done in HandleRawBytes
}
if (m_callback)
- m_callback (m_callback_baton, this, notification, NULL, 0);
+ m_callback (m_callback_baton, *this, notification, NULL, 0);
}
Modified: lldb/trunk/source/Core/Log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Log.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Core/Log.cpp (original)
+++ lldb/trunk/source/Core/Log.cpp Tue Jun 22 20:19:29 2010
@@ -43,18 +43,8 @@
if (set)
g_stream_sp = stream_sp;
else
- {
- if (g_stream_sp)
- stream_sp = g_stream_sp;
- else
- {
- FILE *out_fh = Debugger::GetSharedInstance().GetOutputFileHandle();
- if (out_fh)
- stream_sp.reset(new StreamFile(out_fh));
- else
- stream_sp.reset();
- }
- }
+ stream_sp = g_stream_sp;
+
return stream_sp.get();
}
@@ -91,7 +81,7 @@
// Since we are in a shared library and we can't have global
// constructors, we need to control access to this static variable
// through an accessor function to get and set the value.
- static StreamSP g_stream_sp(new StreamFile(Debugger::GetSharedInstance().GetErrorFileHandle()));
+ static StreamSP g_stream_sp;
if (set)
g_stream_sp = stream_sp;
Removed: lldb/trunk/source/Interpreter/CommandContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandContext.cpp?rev=106614&view=auto
==============================================================================
--- lldb/trunk/source/Interpreter/CommandContext.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandContext.cpp (removed)
@@ -1,77 +0,0 @@
-//===-- CommandContext.cpp --------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Interpreter/CommandContext.h"
-
-#include "lldb/Core/Debugger.h"
-#include "lldb/Core/StreamString.h"
-#include "lldb/Interpreter/CommandObject.h"
-#include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Target/Process.h"
-#include "lldb/Target/Target.h"
-#include "lldb/Target/Thread.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-CommandContext::CommandContext () :
- m_exe_ctx ()
-{
-}
-
-CommandContext::~CommandContext ()
-{
-}
-
-Target *
-CommandContext::GetTarget()
-{
- return Debugger::GetSharedInstance().GetCurrentTarget().get();
-}
-
-
-ExecutionContext &
-CommandContext::GetExecutionContext()
-{
- return m_exe_ctx;
-}
-
-void
-CommandContext::Update (ExecutionContext *override_context)
-{
- m_exe_ctx.Clear();
-
- if (override_context != NULL)
- {
- m_exe_ctx.target = override_context->target;
- m_exe_ctx.process = override_context->process;
- m_exe_ctx.thread = override_context->thread;
- m_exe_ctx.frame = override_context->frame;
- }
- else
- {
- TargetSP target_sp (Debugger::GetSharedInstance().GetCurrentTarget());
- if (target_sp)
- {
- m_exe_ctx.process = target_sp->GetProcessSP().get();
- if (m_exe_ctx.process && m_exe_ctx.process->IsRunning() == false)
- {
- m_exe_ctx.thread = m_exe_ctx.process->GetThreadList().GetCurrentThread().get();
- if (m_exe_ctx.thread == NULL)
- m_exe_ctx.thread = m_exe_ctx.process->GetThreadList().GetThreadAtIndex(0).get();
- if (m_exe_ctx.thread)
- {
- m_exe_ctx.frame = m_exe_ctx.thread->GetCurrentFrame().get();
- if (m_exe_ctx.frame == NULL)
- m_exe_ctx.frame = m_exe_ctx.thread->GetStackFrameAtIndex (0).get();
- }
- }
- }
- }
-}
Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue Jun 22 20:19:29 2010
@@ -12,7 +12,6 @@
#include <getopt.h>
#include <stdlib.h>
-#include "../Commands/CommandObjectAdd.h"
#include "../Commands/CommandObjectAlias.h"
#include "../Commands/CommandObjectAppend.h"
#include "../Commands/CommandObjectApropos.h"
@@ -33,7 +32,6 @@
#include "../Commands/CommandObjectQuit.h"
#include "lldb/Interpreter/CommandObjectRegexCommand.h"
#include "../Commands/CommandObjectRegister.h"
-#include "../Commands/CommandObjectRemove.h"
#include "CommandObjectScript.h"
#include "../Commands/CommandObjectSelect.h"
#include "../Commands/CommandObjectSet.h"
@@ -44,7 +42,6 @@
#include "../Commands/CommandObjectSyntax.h"
#include "../Commands/CommandObjectTarget.h"
#include "../Commands/CommandObjectThread.h"
-#include "../Commands/CommandObjectTranslate.h"
#include "../Commands/CommandObjectUnalias.h"
#include "../Commands/CommandObjectVariable.h"
@@ -64,16 +61,14 @@
CommandInterpreter::CommandInterpreter
(
+ Debugger &debugger,
ScriptLanguage script_language,
- bool synchronous_execution,
- Listener *listener,
- SourceManager& source_manager
+ bool synchronous_execution
) :
Broadcaster ("CommandInterpreter"),
+ m_debugger (debugger),
m_script_language (script_language),
- m_synchronous_execution (synchronous_execution),
- m_listener (listener),
- m_source_manager (source_manager)
+ m_synchronous_execution (synchronous_execution)
{
}
@@ -204,43 +199,38 @@
// the crossref object exists and is ready to take the cross reference. Put the cross referencing command
// objects into the CommandDictionary now, so they are ready for use when the other commands get created.
- m_command_dict["select"] = CommandObjectSP (new CommandObjectSelect ());
- m_command_dict["info"] = CommandObjectSP (new CommandObjectInfo ());
- m_command_dict["delete"] = CommandObjectSP (new CommandObjectDelete ());
+ m_command_dict["select"] = CommandObjectSP (new CommandObjectSelect ());
+ m_command_dict["info"] = CommandObjectSP (new CommandObjectInfo ());
+ m_command_dict["delete"] = CommandObjectSP (new CommandObjectDelete ());
// Non-CommandObjectCrossref commands can now be created.
- //m_command_dict["add"] = CommandObjectSP (new CommandObjectAdd ());
m_command_dict["alias"] = CommandObjectSP (new CommandObjectAlias ());
m_command_dict["append"] = CommandObjectSP (new CommandObjectAppend ());
m_command_dict["apropos"] = CommandObjectSP (new CommandObjectApropos ());
- //m_command_dict["args"] = CommandObjectSP (new CommandObjectArgs ());
- m_command_dict["breakpoint"]= CommandObjectSP (new CommandObjectMultiwordBreakpoint (this));
+ m_command_dict["breakpoint"]= CommandObjectSP (new CommandObjectMultiwordBreakpoint (*this));
m_command_dict["call"] = CommandObjectSP (new CommandObjectCall ());
m_command_dict["disassemble"] = CommandObjectSP (new CommandObjectDisassemble ());
m_command_dict["expression"]= CommandObjectSP (new CommandObjectExpression ());
m_command_dict["file"] = CommandObjectSP (new CommandObjectFile ());
- m_command_dict["frame"] = CommandObjectSP (new CommandObjectMultiwordFrame (this));
+ m_command_dict["frame"] = CommandObjectSP (new CommandObjectMultiwordFrame (*this));
m_command_dict["help"] = CommandObjectSP (new CommandObjectHelp ());
- m_command_dict["image"] = CommandObjectSP (new CommandObjectImage (this));
- m_command_dict["log"] = CommandObjectSP (new CommandObjectLog (this));
- m_command_dict["memory"] = CommandObjectSP (new CommandObjectMemory (this));
- m_command_dict["process"] = CommandObjectSP (new CommandObjectMultiwordProcess (this));
+ m_command_dict["image"] = CommandObjectSP (new CommandObjectImage (*this));
+ m_command_dict["log"] = CommandObjectSP (new CommandObjectLog (*this));
+ m_command_dict["memory"] = CommandObjectSP (new CommandObjectMemory (*this));
+ m_command_dict["process"] = CommandObjectSP (new CommandObjectMultiwordProcess (*this));
m_command_dict["quit"] = CommandObjectSP (new CommandObjectQuit ());
- m_command_dict["register"] = CommandObjectSP (new CommandObjectRegister (this));
- //m_command_dict["remove"] = CommandObjectSP (new CommandObjectRemove ());
+ m_command_dict["register"] = CommandObjectSP (new CommandObjectRegister (*this));
m_command_dict["script"] = CommandObjectSP (new CommandObjectScript (m_script_language));
m_command_dict["set"] = CommandObjectSP (new CommandObjectSet ());
m_command_dict["settings"] = CommandObjectSP (new CommandObjectSettings ());
m_command_dict["show"] = CommandObjectSP (new CommandObjectShow ());
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["target"] = CommandObjectSP (new CommandObjectMultiwordTarget (this));
- m_command_dict["thread"] = CommandObjectSP (new CommandObjectMultiwordThread (this));
- //m_command_dict["translate"] = CommandObjectSP (new CommandObjectTranslate ());
+ m_command_dict["target"] = CommandObjectSP (new CommandObjectMultiwordTarget (*this));
+ m_command_dict["thread"] = CommandObjectSP (new CommandObjectMultiwordThread (*this));
m_command_dict["unalias"] = CommandObjectSP (new CommandObjectUnalias ());
- m_command_dict["variable"] = CommandObjectSP (new CommandObjectVariable (this));
+ m_command_dict["variable"] = CommandObjectSP (new CommandObjectVariable (*this));
std::auto_ptr<CommandObjectRegexCommand>
break_regex_cmd_ap(new CommandObjectRegexCommand ("regexp-break",
@@ -568,8 +558,13 @@
// parses the line and takes the appropriate actions.
bool
-CommandInterpreter::HandleCommand (const char *command_line, bool add_to_history, CommandReturnObject &result,
- ExecutionContext *override_context)
+CommandInterpreter::HandleCommand
+(
+ const char *command_line,
+ bool add_to_history,
+ CommandReturnObject &result,
+ ExecutionContext *override_context
+)
{
// FIXME: there should probably be a mutex to make sure only one thread can
// run the interpreter at a time.
@@ -580,7 +575,7 @@
// result.AppendMessageWithFormat ("Processing command: %s\n", command_line);
// }
- m_current_context.Update (override_context);
+ m_debugger.UpdateExecutionContext (override_context);
if (command_line == NULL || command_line[0] == '\0')
{
@@ -639,7 +634,7 @@
stripped_command += strlen(command_cstr);
while (isspace(*stripped_command))
++stripped_command;
- command_obj->ExecuteRawCommandString(stripped_command, Context(), this, result);
+ command_obj->ExecuteRawCommandString (*this, stripped_command, result);
}
}
else
@@ -649,7 +644,7 @@
// Remove the command from the args.
command_args.Shift();
- command_obj->ExecuteWithOptions (command_args, Context(), this, result);
+ command_obj->ExecuteWithOptions (*this, command_args, result);
}
}
else
@@ -658,9 +653,12 @@
int num_matches;
int cursor_index = command_args.GetArgumentCount() - 1;
int cursor_char_position = strlen (command_args.GetArgumentAtIndex(command_args.GetArgumentCount() - 1));
- num_matches = HandleCompletionMatches (command_args, cursor_index,
- cursor_char_position,
- 0, -1, matches);
+ num_matches = HandleCompletionMatches (command_args,
+ cursor_index,
+ cursor_char_position,
+ 0,
+ -1,
+ matches);
if (num_matches > 0)
{
@@ -740,8 +738,12 @@
{
parsed_line.Shift();
cursor_index--;
- num_command_matches = command_object->HandleCompletion (parsed_line, cursor_index, cursor_char_position,
- match_start_point, max_return_elements, this,
+ num_command_matches = command_object->HandleCompletion (*this,
+ parsed_line,
+ cursor_index,
+ cursor_char_position,
+ match_start_point,
+ max_return_elements,
matches);
}
}
@@ -779,8 +781,12 @@
// Only max_return_elements == -1 is supported at present:
assert (max_return_elements == -1);
- num_command_matches = HandleCompletionMatches (parsed_line, cursor_index, cursor_char_position, match_start_point,
- max_return_elements, matches);
+ num_command_matches = HandleCompletionMatches (parsed_line,
+ cursor_index,
+ cursor_char_position,
+ match_start_point,
+ max_return_elements,
+ matches);
if (num_command_matches <= 0)
return num_command_matches;
@@ -817,12 +823,6 @@
return num_command_matches;
}
-CommandContext *
-CommandInterpreter::Context ()
-{
- return &m_current_context;
-}
-
const Args *
CommandInterpreter::GetProgramArguments ()
{
@@ -916,20 +916,6 @@
m_script_language = lang;
}
-Listener *
-CommandInterpreter::GetListener ()
-{
- return m_listener;
-}
-
-SourceManager &
-CommandInterpreter::GetSourceManager ()
-{
- return m_source_manager;
-}
-
-
-
OptionArgVectorSP
CommandInterpreter::GetAliasOptions (const char *alias_name)
{
@@ -1132,16 +1118,15 @@
ScriptInterpreter *
CommandInterpreter::GetScriptInterpreter ()
{
- CommandObject::CommandMap::iterator pos;
-
- pos = m_command_dict.find ("script");
- if (pos != m_command_dict.end())
+ CommandObject::CommandMap::iterator pos;
+
+ pos = m_command_dict.find ("script");
+ if (pos != m_command_dict.end())
{
- CommandObject *script_cmd_obj = pos->second.get();
- return ((CommandObjectScript *) script_cmd_obj)->GetInterpreter ();
+ CommandObject *script_cmd_obj = pos->second.get();
+ return ((CommandObjectScript *) script_cmd_obj)->GetInterpreter (*this);
}
- else
- return NULL;
+ return NULL;
}
Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Tue Jun 22 20:19:29 2010
@@ -133,21 +133,20 @@
bool
CommandObject::ExecuteCommandString
(
+ CommandInterpreter &interpreter,
const char *command_line,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
Args command_args(command_line);
- return ExecuteWithOptions (command_args, context, interpreter, result);
+ return ExecuteWithOptions (interpreter, command_args, result);
}
bool
CommandObject::ParseOptions
(
+ CommandInterpreter &interpreter,
Args& args,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
@@ -189,9 +188,8 @@
bool
CommandObject::ExecuteWithOptions
(
+ CommandInterpreter &interpreter,
Args& args,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
@@ -199,10 +197,10 @@
{
const char *tmp_str = args.GetArgumentAtIndex (i);
if (tmp_str[0] == '`') // back-quote
- args.ReplaceArgumentAtIndex (i, interpreter->ProcessEmbeddedScriptCommands (tmp_str));
+ args.ReplaceArgumentAtIndex (i, interpreter.ProcessEmbeddedScriptCommands (tmp_str));
}
- Process *process = context->GetExecutionContext().process;
+ Process *process = interpreter.GetDebugger().GetExecutionContext().process;
if (process == NULL)
{
if (GetFlags().IsSet(CommandObject::eFlagProcessMustBeLaunched | CommandObject::eFlagProcessMustBePaused))
@@ -248,11 +246,11 @@
}
}
- if (!ParseOptions (args, interpreter, result))
+ if (!ParseOptions (interpreter, args, result))
return false;
// Call the command-specific version of 'Execute', passing it the already processed arguments.
- return Execute (args, context, interpreter, result);
+ return Execute (interpreter, args, result);
}
class CommandDictCommandPartialMatch
@@ -300,12 +298,12 @@
int
CommandObject::HandleCompletion
(
+ CommandInterpreter &interpreter,
Args &input,
int &cursor_index,
int &cursor_char_position,
int match_start_point,
int max_return_elements,
- CommandInterpreter *interpreter,
StringList &matches
)
{
@@ -340,46 +338,30 @@
input.DeleteArgumentAtIndex(input.GetArgumentCount() - 1);
bool handled_by_options;
- handled_by_options = cur_options->HandleOptionCompletion(input,
- opt_element_vector,
- cursor_index,
- cursor_char_position,
- match_start_point,
- max_return_elements,
- interpreter,
- matches);
+ handled_by_options = cur_options->HandleOptionCompletion (interpreter,
+ input,
+ opt_element_vector,
+ cursor_index,
+ cursor_char_position,
+ match_start_point,
+ max_return_elements,
+ matches);
if (handled_by_options)
return matches.GetSize();
}
// If we got here, the last word is not an option or an option argument.
- return HandleArgumentCompletion(input,
- cursor_index,
- cursor_char_position,
- opt_element_vector,
- match_start_point,
- max_return_elements,
- interpreter,
- matches);
+ return HandleArgumentCompletion (interpreter,
+ input,
+ cursor_index,
+ cursor_char_position,
+ opt_element_vector,
+ match_start_point,
+ max_return_elements,
+ matches);
}
}
-int
-CommandObject::HandleArgumentCompletion
-(
- Args &input,
- int &cursor_index,
- int &cursor_char_position,
- OptionElementVector &opt_element_vector,
- int match_start_point,
- int max_return_elements,
- CommandInterpreter *interpreter,
- StringList &matches
-)
-{
- return 0;
-}
-
// Case insensitive version of ::strstr()
// Returns true if s2 is contained within s1.
Modified: lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp Tue Jun 22 20:19:29 2010
@@ -46,9 +46,8 @@
bool
CommandObjectRegexCommand::Execute
(
+ CommandInterpreter &interpreter,
Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
@@ -59,9 +58,8 @@
bool
CommandObjectRegexCommand::ExecuteRawCommandString
(
+ CommandInterpreter &interpreter,
const char *command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
@@ -92,7 +90,7 @@
// Interpret the new command and return this as the result!
// if (m_options.verbose)
// result.GetOutputStream().Printf("%s\n", new_command.c_str());
- return interpreter->HandleCommand(new_command.c_str(), true, result);
+ return interpreter.HandleCommand(new_command.c_str(), true, result);
}
}
result.SetStatus(eReturnStatusFailed);
Modified: lldb/trunk/source/Interpreter/CommandObjectScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObjectScript.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObjectScript.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObjectScript.cpp Tue Jun 22 20:19:29 2010
@@ -43,15 +43,12 @@
bool
CommandObjectScript::ExecuteRawCommandString
(
+ CommandInterpreter &interpreter,
const char *command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
- std::string arg_str (command);
-
- ScriptInterpreter *script_interpreter = GetInterpreter ();
+ ScriptInterpreter *script_interpreter = GetInterpreter (interpreter);
if (script_interpreter == NULL)
{
@@ -59,23 +56,11 @@
result.SetStatus (eReturnStatusFailed);
}
- FILE *out_fh = Debugger::GetSharedInstance().GetOutputFileHandle();
- FILE *err_fh = Debugger::GetSharedInstance().GetOutputFileHandle();
- if (out_fh && err_fh)
- {
- if (arg_str.empty())
- script_interpreter->ExecuteInterpreterLoop (out_fh, err_fh);
- else
- script_interpreter->ExecuteOneLine (arg_str, out_fh, err_fh);
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
- }
+ if (command == NULL || command[0] == '\0')
+ script_interpreter->ExecuteInterpreterLoop (interpreter);
else
- {
- if (out_fh == NULL)
- result.AppendError("invalid output file handle");
- else
- result.AppendError("invalid error file handle");
- }
+ script_interpreter->ExecuteOneLine (interpreter, command);
+ result.SetStatus (eReturnStatusSuccessFinishNoResult);
return result.Succeeded();
}
@@ -88,60 +73,29 @@
bool
CommandObjectScript::Execute
(
+ CommandInterpreter &interpreter,
Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
- std::string arg_str;
- ScriptInterpreter *script_interpreter = GetInterpreter ();
-
- if (script_interpreter == NULL)
- {
- result.AppendError("no script interpeter");
- result.SetStatus (eReturnStatusFailed);
- }
-
- const int argc = command.GetArgumentCount();
- for (int i = 0; i < argc; ++i)
- arg_str.append(command.GetArgumentAtIndex(i));
-
-
- FILE *out_fh = Debugger::GetSharedInstance().GetOutputFileHandle();
- FILE *err_fh = Debugger::GetSharedInstance().GetOutputFileHandle();
- if (out_fh && err_fh)
- {
- if (arg_str.empty())
- script_interpreter->ExecuteInterpreterLoop (out_fh, err_fh);
- else
- script_interpreter->ExecuteOneLine (arg_str, out_fh, err_fh);
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
- }
- else
- {
- if (out_fh == NULL)
- result.AppendError("invalid output file handle");
- else
- result.AppendError("invalid error file handle");
- }
- return result.Succeeded();
+ // everything should be handled in ExecuteRawCommandString
+ return false;
}
ScriptInterpreter *
-CommandObjectScript::GetInterpreter ()
+CommandObjectScript::GetInterpreter (CommandInterpreter &interpreter)
{
if (m_interpreter_ap.get() == NULL)
{
switch (m_script_lang)
{
case eScriptLanguagePython:
- m_interpreter_ap.reset (new ScriptInterpreterPython ());
+ m_interpreter_ap.reset (new ScriptInterpreterPython (interpreter));
break;
case eScriptLanguageNone:
- m_interpreter_ap.reset (new ScriptInterpreterNone ());
+ m_interpreter_ap.reset (new ScriptInterpreterNone (interpreter));
break;
}
}
Modified: lldb/trunk/source/Interpreter/CommandObjectScript.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObjectScript.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObjectScript.h (original)
+++ lldb/trunk/source/Interpreter/CommandObjectScript.h Tue Jun 22 20:19:29 2010
@@ -34,19 +34,17 @@
bool WantsRawCommandString();
virtual bool
- ExecuteRawCommandString (const char *command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result);
+ ExecuteRawCommandString (CommandInterpreter &interpreter,
+ const char *command,
+ CommandReturnObject &result);
virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
+ Execute (CommandInterpreter &interpreter,
+ Args& command,
CommandReturnObject &result);
ScriptInterpreter *
- GetInterpreter ();
+ GetInterpreter (CommandInterpreter &interpreter);
private:
lldb::ScriptLanguage m_script_lang;
Modified: lldb/trunk/source/Interpreter/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Options.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Options.cpp (original)
+++ lldb/trunk/source/Interpreter/Options.cpp Tue Jun 22 20:19:29 2010
@@ -532,13 +532,13 @@
bool
Options::HandleOptionCompletion
(
+ CommandInterpreter &interpreter,
Args &input,
OptionElementVector &opt_element_vector,
int cursor_index,
int char_pos,
int match_start_point,
int max_return_elements,
- lldb_private::CommandInterpreter *interpreter,
lldb_private::StringList &matches
)
{
@@ -625,15 +625,15 @@
if (opt_defs_index != -1)
{
- HandleOptionArgumentCompletion (input,
- cursor_index,
- strlen (input.GetArgumentAtIndex(cursor_index)),
- opt_element_vector,
- i,
- match_start_point,
- max_return_elements,
- interpreter,
- matches);
+ HandleOptionArgumentCompletion (interpreter,
+ input,
+ cursor_index,
+ strlen (input.GetArgumentAtIndex(cursor_index)),
+ opt_element_vector,
+ i,
+ match_start_point,
+ max_return_elements,
+ matches);
return true;
}
else
@@ -655,6 +655,7 @@
bool
Options::HandleOptionArgumentCompletion
(
+ CommandInterpreter &interpreter,
Args &input,
int cursor_index,
int char_pos,
@@ -662,7 +663,6 @@
int opt_element_index,
int match_start_point,
int max_return_elements,
- lldb_private::CommandInterpreter *interpreter,
lldb_private::StringList &matches
)
{
@@ -713,7 +713,7 @@
if (module_name)
{
FileSpec module_spec(module_name);
- lldb::TargetSP target_sp = interpreter->Context()->GetTarget()->GetSP();
+ lldb::TargetSP target_sp = interpreter.GetDebugger().GetCurrentTarget();
// Search filters require a target...
if (target_sp != NULL)
filter_ap.reset (new SearchFilterByModule (target_sp, module_spec));
@@ -723,12 +723,12 @@
}
}
- return CommandCompletions::InvokeCommonCompletionCallbacks (completion_mask,
- input.GetArgumentAtIndex (opt_arg_pos),
- match_start_point,
- max_return_elements,
- interpreter,
- filter_ap.get(),
- matches);
-
+ return CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
+ completion_mask,
+ input.GetArgumentAtIndex (opt_arg_pos),
+ match_start_point,
+ max_return_elements,
+ filter_ap.get(),
+ matches);
+
}
Modified: lldb/trunk/source/Interpreter/ScriptInterpreterNone.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterNone.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterNone.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterNone.cpp Tue Jun 22 20:19:29 2010
@@ -10,11 +10,13 @@
#include "lldb/Interpreter/ScriptInterpreterNone.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StringList.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
using namespace lldb;
using namespace lldb_private;
-ScriptInterpreterNone::ScriptInterpreterNone () :
+ScriptInterpreterNone::ScriptInterpreterNone (CommandInterpreter &interpreter) :
ScriptInterpreter (eScriptLanguageNone)
{
}
@@ -24,15 +26,15 @@
}
void
-ScriptInterpreterNone::ExecuteOneLine (const std::string &line, FILE *out, FILE *err)
+ScriptInterpreterNone::ExecuteOneLine (CommandInterpreter &interpreter, const char *command)
{
- ::fprintf (err, "error: there is no embedded script interpreter in this mode.\n");
+ interpreter.GetDebugger().GetErrorStream().PutCString ("error: there is no embedded script interpreter in this mode.\n");
}
void
-ScriptInterpreterNone::ExecuteInterpreterLoop (FILE *out, FILE *err)
+ScriptInterpreterNone::ExecuteInterpreterLoop (CommandInterpreter &interpreter)
{
- fprintf (err, "error: there is no embedded script interpreter in this mode.\n");
+ interpreter.GetDebugger().GetErrorStream().PutCString ("error: there is no embedded script interpreter in this mode.\n");
}
Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Tue Jun 22 20:19:29 2010
@@ -24,6 +24,7 @@
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/FileSpec.h"
#include "lldb/Core/InputReader.h"
@@ -33,6 +34,7 @@
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Target/Process.h"
extern "C" void init_lldb (void);
@@ -139,7 +141,7 @@
return fflush (stream) || prev_fail ? EOF : 0;
}
-ScriptInterpreterPython::ScriptInterpreterPython () :
+ScriptInterpreterPython::ScriptInterpreterPython (CommandInterpreter &interpreter) :
ScriptInterpreter (eScriptLanguagePython),
m_compiled_module (NULL),
m_termios_valid (false)
@@ -194,7 +196,7 @@
}
const char *pty_slave_name = GetScriptInterpreterPtyName ();
- FILE *out_fh = Debugger::GetSharedInstance().GetOutputFileHandle();
+ FILE *out_fh = interpreter.GetDebugger().GetOutputFileHandle();
PyObject *pmod = PyImport_ExecCodeModule(
const_cast<char*>("embedded_interpreter"),
@@ -249,14 +251,15 @@
}
void
-ScriptInterpreterPython::ExecuteOneLine (const std::string& line, FILE *out, FILE *err)
+ScriptInterpreterPython::ExecuteOneLine (CommandInterpreter &interpreter, const char *command)
{
- int success;
-
- success = PyRun_SimpleString (line.c_str());
- if (success != 0)
+ if (command)
{
- fprintf (err, "error: python failed attempting to evaluate '%s'\n", line.c_str());
+ int success;
+
+ success = PyRun_SimpleString (command);
+ if (success != 0)
+ interpreter.GetDebugger().GetErrorStream().Printf ("error: python failed attempting to evaluate '%s'\n", command);
}
}
@@ -266,7 +269,7 @@
ScriptInterpreterPython::InputReaderCallback
(
void *baton,
- InputReader *reader,
+ InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len
@@ -275,19 +278,20 @@
if (baton == NULL)
return 0;
- ScriptInterpreterPython *interpreter = (ScriptInterpreterPython *) baton;
+ ScriptInterpreterPython *script_interpreter = (ScriptInterpreterPython *) baton;
switch (notification)
{
case eInputReaderActivate:
{
// Save terminal settings if we can
- interpreter->m_termios_valid = ::tcgetattr (::fileno (reader->GetInputFileHandle()),
- &interpreter->m_termios) == 0;
+ FILE *input_fh = reader.GetDebugger().GetInputFileHandle();
+ int input_fd = ::fileno (input_fh);
+ script_interpreter->m_termios_valid = ::tcgetattr (input_fd, &script_interpreter->m_termios) == 0;
struct termios tmp_termios;
- if (::tcgetattr (::fileno (reader->GetInputFileHandle()), &tmp_termios) == 0)
+ if (::tcgetattr (input_fd, &tmp_termios) == 0)
{
tmp_termios.c_cc[VEOF] = _POSIX_VDISABLE;
- ::tcsetattr (::fileno (reader->GetInputFileHandle()), TCSANOW, &tmp_termios);
+ ::tcsetattr (input_fd, TCSANOW, &tmp_termios);
}
}
break;
@@ -302,11 +306,11 @@
if (bytes && bytes_len)
{
if ((int) bytes[0] == 4)
- ::write (interpreter->GetMasterFileDescriptor(), "quit()", 6);
+ ::write (script_interpreter->GetMasterFileDescriptor(), "quit()", 6);
else
- ::write (interpreter->GetMasterFileDescriptor(), bytes, bytes_len);
+ ::write (script_interpreter->GetMasterFileDescriptor(), bytes, bytes_len);
}
- ::write (interpreter->GetMasterFileDescriptor(), "\n", 1);
+ ::write (script_interpreter->GetMasterFileDescriptor(), "\n", 1);
break;
case eInputReaderDone:
@@ -315,11 +319,11 @@
// Write a newline out to the reader output
//::fwrite ("\n", 1, 1, out_fh);
// Restore terminal settings if they were validly saved
- if (interpreter->m_termios_valid)
+ if (script_interpreter->m_termios_valid)
{
- ::tcsetattr (::fileno (reader->GetInputFileHandle()),
+ ::tcsetattr (::fileno (reader.GetDebugger().GetInputFileHandle()),
TCSANOW,
- &interpreter->m_termios);
+ &script_interpreter->m_termios);
}
break;
}
@@ -329,11 +333,12 @@
void
-ScriptInterpreterPython::ExecuteInterpreterLoop (FILE *out, FILE *err)
+ScriptInterpreterPython::ExecuteInterpreterLoop (CommandInterpreter &interpreter)
{
Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
- InputReaderSP reader_sp (new InputReader());
+ Debugger &debugger = interpreter.GetDebugger();
+ InputReaderSP reader_sp (new InputReader(debugger));
if (reader_sp)
{
Error error (reader_sp->Initialize (ScriptInterpreterPython::InputReaderCallback,
@@ -345,9 +350,9 @@
if (error.Success())
{
- Debugger::GetSharedInstance().PushInputReader (reader_sp);
- ExecuteOneLine ("run_python_interpreter(ConsoleDict)", out, err);
- Debugger::GetSharedInstance().PopInputReader (reader_sp);
+ debugger.PushInputReader (reader_sp);
+ ExecuteOneLine (interpreter, "run_python_interpreter(ConsoleDict)");
+ debugger.PopInputReader (reader_sp);
}
}
}
@@ -528,7 +533,7 @@
ScriptInterpreterPython::GenerateBreakpointOptionsCommandCallback
(
void *baton,
- InputReader *reader,
+ InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len
@@ -536,7 +541,7 @@
{
static StringList commands_in_progress;
- FILE *out_fh = reader->GetOutputFileHandle();
+ FILE *out_fh = reader.GetDebugger().GetOutputFileHandle();
switch (notification)
{
case eInputReaderActivate:
@@ -545,8 +550,8 @@
if (out_fh)
{
::fprintf (out_fh, "%s\n", g_reader_instructions);
- if (reader->GetPrompt())
- ::fprintf (out_fh, "%s", reader->GetPrompt());
+ if (reader.GetPrompt())
+ ::fprintf (out_fh, "%s", reader.GetPrompt());
}
}
break;
@@ -555,16 +560,16 @@
break;
case eInputReaderReactivate:
- if (reader->GetPrompt() && out_fh)
- ::fprintf (out_fh, "%s", reader->GetPrompt());
+ if (reader.GetPrompt() && out_fh)
+ ::fprintf (out_fh, "%s", reader.GetPrompt());
break;
case eInputReaderGotToken:
{
std::string temp_string (bytes, bytes_len);
commands_in_progress.AppendString (temp_string.c_str());
- if (out_fh && !reader->IsDone() && reader->GetPrompt())
- ::fprintf (out_fh, "%s", reader->GetPrompt());
+ if (out_fh && !reader.IsDone() && reader.GetPrompt())
+ ::fprintf (out_fh, "%s", reader.GetPrompt());
}
break;
@@ -575,7 +580,7 @@
data_ap->user_source.AppendList (commands_in_progress);
if (data_ap.get())
{
- ScriptInterpreter *interpreter = Debugger::GetSharedInstance().GetCommandInterpreter().GetScriptInterpreter();
+ ScriptInterpreter *interpreter = reader.GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
if (interpreter)
{
if (interpreter->GenerateBreakpointCommandCallbackData (data_ap->user_source,
@@ -602,10 +607,12 @@
}
void
-ScriptInterpreterPython::CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options,
+ScriptInterpreterPython::CollectDataForBreakpointCommandCallback (CommandInterpreter &interpreter,
+ BreakpointOptions *bp_options,
CommandReturnObject &result)
{
- InputReaderSP reader_sp (new InputReader ());
+ Debugger &debugger = interpreter.GetDebugger();
+ InputReaderSP reader_sp (new InputReader (debugger));
if (reader_sp)
{
@@ -618,7 +625,7 @@
true); // echo input
if (err.Success())
- Debugger::GetSharedInstance().PushInputReader (reader_sp);
+ debugger.PushInputReader (reader_sp);
else
{
result.AppendError (err.AsCString());
@@ -819,11 +826,11 @@
if (python_string != NULL)
{
- bool success =
- Debugger::GetSharedInstance().GetCommandInterpreter().GetScriptInterpreter()->ExecuteOneLineWithReturn
- (python_string,
- ScriptInterpreter::eBool,
- (void *) &temp_bool);
+ bool success = context->exe_ctx.target->GetDebugger().
+ GetCommandInterpreter().
+ GetScriptInterpreter()->ExecuteOneLineWithReturn (python_string,
+ ScriptInterpreter::eBool,
+ (void *) &temp_bool);
if (success)
ret_value = temp_bool;
}
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue Jun 22 20:19:29 2010
@@ -1922,7 +1922,7 @@
// debugserver that we are tracking...
lldb::pid_t gdb_remote_pid = (lldb::pid_t)(intptr_t)callback_baton;
- TargetSP target_sp(Debugger::GetSharedInstance().GetTargetList().FindTargetWithProcessID (gdb_remote_pid));
+ TargetSP target_sp(Debugger::FindTargetWithProcessID (gdb_remote_pid));
if (target_sp)
{
ProcessSP process_sp (target_sp->GetProcessSP());
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue Jun 22 20:19:29 2010
@@ -347,7 +347,7 @@
{
if (signo == 0 || exit_status)
{
- TargetSP target_sp(Debugger::GetSharedInstance().GetTargetList().FindTargetWithProcessID (pid));
+ TargetSP target_sp(Debugger::FindTargetWithProcessID (pid));
if (target_sp)
{
ProcessSP process_sp (target_sp->GetProcessSP());
Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Tue Jun 22 20:19:29 2010
@@ -176,7 +176,9 @@
{
ExecutionContext exe_ctx;
Calculate(exe_ctx);
- Disassembler::Disassemble (m_thread.GetProcess().GetTarget().GetArchitecture(),
+ Target &target = m_thread.GetProcess().GetTarget();
+ Disassembler::Disassemble (target.GetDebugger(),
+ target.GetArchitecture(),
exe_ctx,
0,
m_disassembly);
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Tue Jun 22 20:19:29 2010
@@ -33,8 +33,9 @@
//----------------------------------------------------------------------
// Target constructor
//----------------------------------------------------------------------
-Target::Target() :
+Target::Target(Debugger &debugger) :
Broadcaster("Target"),
+ m_debugger (debugger),
m_images(),
m_breakpoint_list (false),
m_internal_breakpoint_list (true),
@@ -111,7 +112,7 @@
lldb::TargetSP
Target::GetSP()
{
- return Debugger::GetSharedInstance().GetTargetList().GetTargetSP(this);
+ return m_debugger.GetTargetList().GetTargetSP(this);
}
BreakpointList &
Modified: lldb/trunk/source/Target/TargetList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/TargetList.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/source/Target/TargetList.cpp (original)
+++ lldb/trunk/source/Target/TargetList.cpp Tue Jun 22 20:19:29 2010
@@ -46,6 +46,7 @@
Error
TargetList::CreateTarget
(
+ Debugger &debugger,
const FileSpec& file,
const ArchSpec& arch,
const UUID *uuid_ptr,
@@ -74,7 +75,7 @@
NULL);
if (exe_module_sp)
{
- target_sp.reset(new Target);
+ target_sp.reset(new Target(debugger));
target_sp->SetExecutableModule (exe_module_sp, get_dependent_files);
if (target_sp.get())
Modified: lldb/trunk/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Tue Jun 22 20:19:29 2010
@@ -79,6 +79,7 @@
Driver::Driver () :
SBBroadcaster ("Driver"),
+ m_debugger (SBDebugger::Create()),
m_editline_pty (),
m_editline_slave_fh (NULL),
m_editline_reader (),
@@ -323,9 +324,93 @@
}
+Driver::OptionData::OptionData () :
+ m_filename(),
+ m_script_lang (lldb::eScriptLanguageDefault),
+ m_source_command_files (),
+ m_debug_mode (false),
+ m_print_help (false),
+ m_print_version (false)
+
+{
+}
+
+Driver::OptionData::~OptionData ()
+{
+}
+
+void
+Driver::OptionData::Clear ()
+{
+ m_filename.clear ();
+ m_script_lang = lldb::eScriptLanguageDefault;
+ m_source_command_files.clear ();
+ m_debug_mode = false;
+ m_print_help = false;
+ m_print_version = false;
+}
+
+void
+Driver::ResetOptionValues ()
+{
+ m_option_data.Clear ();
+}
+
+const char *
+Driver::GetFilename() const
+{
+ if (m_option_data.m_filename.empty())
+ return NULL;
+ return m_option_data.m_filename.c_str();
+}
+
+const char *
+Driver::GetCrashLogFilename() const
+{
+ if (m_option_data.m_crash_log.empty())
+ return NULL;
+ return m_option_data.m_crash_log.c_str();
+}
+
+lldb::ScriptLanguage
+Driver::GetScriptLanguage() const
+{
+ return m_option_data.m_script_lang;
+}
+
+size_t
+Driver::GetNumSourceCommandFiles () const
+{
+ return m_option_data.m_source_command_files.size();
+}
+
+const char *
+Driver::GetSourceCommandFileAtIndex (uint32_t idx) const
+{
+ if (idx < m_option_data.m_source_command_files.size())
+ return m_option_data.m_source_command_files[idx].c_str();
+ return NULL;
+}
+
+bool
+Driver::GetDebugMode() const
+{
+ return m_option_data.m_debug_mode;
+}
+
+
+// Check the arguments that were passed to this program to make sure they are valid and to get their
+// argument values (if any). Return a boolean value indicating whether or not to start up the full
+// debugger (i.e. the Command Interpreter) or not. Return FALSE if the arguments were invalid OR
+// if the user only wanted help or version information.
+
SBError
-ParseOptions (Driver::OptionData &data, int argc, const char **argv)
+Driver::ParseArgs (int argc, const char *argv[], FILE *out_fh, bool &exit)
{
+ ResetOptionValues ();
+
+ SBCommandReturnObject result;
+
SBError error;
std::string option_string;
struct option *long_options = NULL;
@@ -389,7 +474,7 @@
break;
else if (val == '?')
{
- data.m_print_help = true;
+ m_option_data.m_print_help = true;
error.SetErrorStringWithFormat ("unknown or ambiguous option");
break;
}
@@ -397,7 +482,7 @@
continue;
else
{
- data.m_seen_options.insert ((char) val);
+ m_option_data.m_seen_options.insert ((char) val);
if (long_options_index == -1)
{
for (int i = 0;
@@ -414,180 +499,68 @@
if (long_options_index >= 0)
{
- error = Driver::SetOptionValue (long_options_index,
- long_options[long_options_index].has_arg == no_argument ? NULL : optarg,
- data);
- }
- else
- {
- error.SetErrorStringWithFormat ("invalid option with value %i", val);
- }
- if (error.Fail())
- break;
- }
- }
-
- return error;
-}
+ const char short_option = (char) g_options[long_options_index].short_option;
-Driver::OptionData::OptionData () :
- m_filename(),
- m_script_lang (lldb::eScriptLanguageDefault),
- m_source_command_files (),
- m_debug_mode (false),
- m_print_help (false),
- m_print_version (false)
+ switch (short_option)
+ {
+ case 'h':
+ m_option_data.m_print_help = true;
+ break;
-{
-}
+ case 'v':
+ m_option_data.m_print_version = true;
+ break;
-Driver::OptionData::~OptionData ()
-{
-}
+ case 'c':
+ m_option_data.m_crash_log = optarg;
+ break;
-void
-Driver::OptionData::Clear ()
-{
- m_filename.clear ();
- m_script_lang = lldb::eScriptLanguageDefault;
- m_source_command_files.clear ();
- m_debug_mode = false;
- m_print_help = false;
- m_print_version = false;
-}
+ case 'f':
+ {
+ SBFileSpec file(optarg);
+ if (file.Exists())
+ m_option_data.m_filename = optarg;
+ else
+ error.SetErrorStringWithFormat("file specified in --file (-f) option doesn't exist: '%s'", optarg);
+ }
+ break;
-SBError
-Driver::SetOptionValue (int option_idx, const char *option_arg, Driver::OptionData &option_data)
-{
- SBError error;
- const char short_option = (char) g_options[option_idx].short_option;
+ case 'a':
+ if (!m_debugger.SetDefaultArchitecture (optarg))
+ error.SetErrorStringWithFormat("invalid architecture in the -a or --arch option: '%s'", optarg);
+ break;
- switch (short_option)
- {
- case 'h':
- option_data.m_print_help = true;
- break;
+ case 'l':
+ m_option_data.m_script_lang = m_debugger.GetScriptingLanguage (optarg);
+ break;
- case 'v':
- option_data.m_print_version = true;
- break;
+ case 'd':
+ m_option_data.m_debug_mode = true;
+ break;
- case 'c':
- option_data.m_crash_log = option_arg;
- break;
+ case 's':
+ {
+ SBFileSpec file(optarg);
+ if (file.Exists())
+ m_option_data.m_source_command_files.push_back (optarg);
+ else
+ error.SetErrorStringWithFormat("file specified in --source (-s) option doesn't exist: '%s'", optarg);
+ }
+ break;
- case 'f':
- {
- SBFileSpec file(option_arg);
- if (file.Exists())
- option_data.m_filename = option_arg;
- else
- error.SetErrorStringWithFormat("file specified in --file (-f) option doesn't exist: '%s'", option_arg);
+ default:
+ m_option_data.m_print_help = true;
+ error.SetErrorStringWithFormat ("unrecognized option %c", short_option);
+ break;
+ }
}
- break;
-
- case 'a':
- if (!SBDebugger::SetDefaultArchitecture (option_arg))
- error.SetErrorStringWithFormat("invalid architecture in the -a or --arch option: '%s'", option_arg);
- break;
-
- case 'l':
- option_data.m_script_lang = SBDebugger::GetScriptingLanguage (option_arg);
- break;
-
- case 'd':
- option_data.m_debug_mode = true;
- break;
-
- case 's':
+ else
{
- SBFileSpec file(option_arg);
- if (file.Exists())
- option_data.m_source_command_files.push_back (option_arg);
- else
- error.SetErrorStringWithFormat("file specified in --source (-s) option doesn't exist: '%s'", option_arg);
+ error.SetErrorStringWithFormat ("invalid option with value %i", val);
}
- break;
-
- default:
- option_data.m_print_help = true;
- error.SetErrorStringWithFormat ("unrecognized option %c", short_option);
- break;
- }
-
- return error;
-}
-
-void
-Driver::ResetOptionValues ()
-{
- m_option_data.Clear ();
-}
-
-const char *
-Driver::GetFilename() const
-{
- if (m_option_data.m_filename.empty())
- return NULL;
- return m_option_data.m_filename.c_str();
-}
-
-const char *
-Driver::GetCrashLogFilename() const
-{
- if (m_option_data.m_crash_log.empty())
- return NULL;
- return m_option_data.m_crash_log.c_str();
-}
-
-lldb::ScriptLanguage
-Driver::GetScriptLanguage() const
-{
- return m_option_data.m_script_lang;
-}
-
-size_t
-Driver::GetNumSourceCommandFiles () const
-{
- return m_option_data.m_source_command_files.size();
-}
-
-const char *
-Driver::GetSourceCommandFileAtIndex (uint32_t idx) const
-{
- if (idx < m_option_data.m_source_command_files.size())
- return m_option_data.m_source_command_files[idx].c_str();
- return NULL;
-}
-
-bool
-Driver::GetDebugMode() const
-{
- return m_option_data.m_debug_mode;
-}
-
-
-// Check the arguments that were passed to this program to make sure they are valid and to get their
-// argument values (if any). Return a boolean value indicating whether or not to start up the full
-// debugger (i.e. the Command Interpreter) or not. Return FALSE if the arguments were invalid OR
-// if the user only wanted help or version information.
-
-bool
-Driver::ParseArgs (int argc, const char *argv[], FILE *out_fh, FILE *err_fh)
-{
- bool valid = true;
-
- ResetOptionValues ();
-
- SBCommandReturnObject result;
-
- SBError error = ParseOptions (m_option_data, argc, argv);
- if (error.Fail())
- {
- const char *error_cstr = error.GetCString ();
- if (error_cstr)
- ::fprintf (err_fh, "error: %s\n", error_cstr);
- valid = false;
+ if (error.Fail())
+ return error;
+ }
}
// If there is a trailing argument, it is the filename.
@@ -599,28 +572,24 @@
}
else
{
- ::fprintf (err_fh, "error: don't provide a file both on in the -f option and as an argument.");
- valid = false;
+ error.SetErrorStringWithFormat ("error: don't provide a file both on in the -f option and as an argument.");
}
}
else if (optind < argc - 1)
{
// Trailing extra arguments...
- ::fprintf (err_fh, "error: trailing extra arguments - only one the filename is allowed.");
- valid = false;
-
+ error.SetErrorStringWithFormat ("error: trailing extra arguments - only one the filename is allowed.");
}
- if (!valid || m_option_data.m_print_help)
+ if (error.Fail() || m_option_data.m_print_help)
{
ShowUsage (out_fh, g_options, m_option_data);
- valid = false;
}
else if (m_option_data.m_print_version)
{
- ::fprintf (out_fh, "%s\n", SBDebugger::GetVersionString());
- valid = false;
+ ::fprintf (out_fh, "%s\n", m_debugger.GetVersionString());
+ exit = true;
}
else if (! m_option_data.m_crash_log.empty())
{
@@ -631,7 +600,7 @@
// All other combinations are valid; do nothing more here.
}
- return valid;
+ return error;
}
void
@@ -640,7 +609,7 @@
// The process has stuff waiting for stdout; get it and write it out to the appropriate place.
char stdio_buffer[1024];
size_t len;
- while ((len = SBDebugger::GetCurrentTarget().GetProcess().GetSTDOUT (stdio_buffer, sizeof (stdio_buffer))) > 0)
+ while ((len = m_debugger.GetCurrentTarget().GetProcess().GetSTDOUT (stdio_buffer, sizeof (stdio_buffer))) > 0)
m_io_channel_ap->OutWrite (stdio_buffer, len);
}
@@ -650,7 +619,7 @@
// The process has stuff waiting for stderr; get it and write it out to the appropriate place.
char stdio_buffer[1024];
size_t len;
- while ((len = SBDebugger::GetCurrentTarget().GetProcess().GetSTDERR (stdio_buffer, sizeof (stdio_buffer))) > 0)
+ while ((len = m_debugger.GetCurrentTarget().GetProcess().GetSTDERR (stdio_buffer, sizeof (stdio_buffer))) > 0)
m_io_channel_ap->ErrWrite (stdio_buffer, len);
}
@@ -658,7 +627,7 @@
Driver::UpdateCurrentThread ()
{
using namespace lldb;
- SBProcess process(SBDebugger::GetCurrentTarget().GetProcess());
+ SBProcess process(m_debugger.GetCurrentTarget().GetProcess());
if (process.IsValid())
{
SBThread curr_thread (process.GetCurrentThread());
@@ -765,7 +734,7 @@
{
char message[1024];
int message_len = ::snprintf (message, sizeof(message), "Process %d %s\n", process.GetProcessID(),
- SBDebugger::StateAsCString (event_state));
+ m_debugger.StateAsCString (event_state));
m_io_channel_ap->OutWrite(message, message_len);
}
break;
@@ -775,7 +744,7 @@
break;
case eStateExited:
- SBDebugger::HandleCommand("process status");
+ m_debugger.HandleCommand("process status");
m_io_channel_ap->RefreshPrompt();
break;
@@ -794,7 +763,7 @@
else
{
UpdateCurrentThread ();
- SBDebugger::HandleCommand("process status");
+ m_debugger.HandleCommand("process status");
m_io_channel_ap->RefreshPrompt();
}
break;
@@ -820,7 +789,7 @@
if (command_string == NULL)
command_string == "";
SBCommandReturnObject result;
- if (SBDebugger::GetCommandInterpreter().HandleCommand (command_string, result, true) != lldb::eReturnStatusQuit)
+ if (m_debugger.GetCommandInterpreter().HandleCommand (command_string, result, true) != lldb::eReturnStatusQuit)
{
m_io_channel_ap->ErrWrite (result.GetError(), result.GetErrorSize());
m_io_channel_ap->OutWrite (result.GetOutput(), result.GetOutputSize());
@@ -971,7 +940,7 @@
//
// if (crash_infos.size())
// {
-// SBTarget target (SBDebugger::CreateTarget (crash_infos.front().path.c_str(),
+// SBTarget target (m_debugger.CreateTarget (crash_infos.front().path.c_str(),
// lldb::GetDefaultArchitecture().AsCString (),
// false));
// if (target.IsValid())
@@ -995,7 +964,7 @@
{
// Echo the characters back to the Debugger's stdout, that way if you
// type characters while a command is running, you'll see what you've typed.
- FILE *out_fh = SBDebugger::GetOutputFileHandle();
+ FILE *out_fh = m_debugger.GetOutputFileHandle();
if (out_fh)
::fwrite (src, 1, src_len, out_fh);
}
@@ -1076,9 +1045,9 @@
::setbuf (stdin, NULL);
::setbuf (stdout, NULL);
- SBDebugger::SetErrorFileHandle (stderr, false);
- SBDebugger::SetOutputFileHandle (stdout, false);
- SBDebugger::SetInputFileHandle (stdin, true);
+ m_debugger.SetErrorFileHandle (stderr, false);
+ m_debugger.SetOutputFileHandle (stdout, false);
+ m_debugger.SetInputFileHandle (stdin, true);
// You have to drain anything that comes to the master side of the PTY. master_out_comm is
// for that purpose. The reason you need to do this is a curious reason... editline will echo
@@ -1104,7 +1073,7 @@
// ParseCrashLog (crash_log);
// }
//
- SBCommandInterpreter sb_interpreter = SBDebugger::GetCommandInterpreter();
+ SBCommandInterpreter sb_interpreter = m_debugger.GetCommandInterpreter();
m_io_channel_ap.reset (new IOChannel(m_editline_slave_fh, stdout, stderr, this));
@@ -1115,13 +1084,14 @@
char buffer[25];
sprintf (buffer, "set term-width %d", window_size.ws_col);
- SBDebugger::HandleCommand ((const char *) buffer);
+ m_debugger.HandleCommand ((const char *) buffer);
}
// Since input can be redirected by the debugger, we must insert our editline
// input reader in the queue so we know when our reader should be active
// and so we can receive bytes only when we are supposed to.
- SBError err (m_editline_reader.Initialize (Driver::EditLineInputReaderCallback, // callback
+ SBError err (m_editline_reader.Initialize (m_debugger,
+ Driver::EditLineInputReaderCallback, // callback
this, // baton
eInputReaderGranularityByte, // token_size
NULL, // end token - NULL means never done
@@ -1135,9 +1105,9 @@
exit (6);
}
- SBDebugger::PushInputReader (m_editline_reader);
+ m_debugger.PushInputReader (m_editline_reader);
- SBListener listener(SBDebugger::GetListener());
+ SBListener listener(m_debugger.GetListener());
if (listener.IsValid())
{
@@ -1161,8 +1131,8 @@
sb_interpreter.SourceInitFileInHomeDirectory(result);
if (GetDebugMode())
{
- result.PutError (SBDebugger::GetErrorFileHandle());
- result.PutOutput (SBDebugger::GetOutputFileHandle());
+ result.PutError (m_debugger.GetErrorFileHandle());
+ result.PutOutput (m_debugger.GetOutputFileHandle());
}
// Now we handle options we got from the command line
@@ -1174,11 +1144,11 @@
{
const char *command_file = GetSourceCommandFileAtIndex(i);
::snprintf (command_string, sizeof(command_string), "source '%s'", command_file);
- SBDebugger::GetCommandInterpreter().HandleCommand (command_string, result, false);
+ m_debugger.GetCommandInterpreter().HandleCommand (command_string, result, false);
if (GetDebugMode())
{
- result.PutError (SBDebugger::GetErrorFileHandle());
- result.PutOutput (SBDebugger::GetOutputFileHandle());
+ result.PutError (m_debugger.GetErrorFileHandle());
+ result.PutOutput (m_debugger.GetOutputFileHandle());
}
}
}
@@ -1186,13 +1156,13 @@
if (!m_option_data.m_filename.empty())
{
char arch_name[64];
- if (SBDebugger::GetDefaultArchitecture (arch_name, sizeof (arch_name)))
+ if (m_debugger.GetDefaultArchitecture (arch_name, sizeof (arch_name)))
::snprintf (command_string, sizeof (command_string), "file --arch=%s '%s'", arch_name,
m_option_data.m_filename.c_str());
else
::snprintf (command_string, sizeof(command_string), "file '%s'", m_option_data.m_filename.c_str());
- SBDebugger::HandleCommand (command_string);
+ m_debugger.HandleCommand (command_string);
}
// Now that all option parsing is done, we try and parse the .lldbinit
@@ -1200,8 +1170,8 @@
sb_interpreter.SourceInitFileInCurrentWorkingDirectory (result);
if (GetDebugMode())
{
- result.PutError(SBDebugger::GetErrorFileHandle());
- result.PutOutput(SBDebugger::GetOutputFileHandle());
+ result.PutError(m_debugger.GetErrorFileHandle());
+ result.PutOutput(m_debugger.GetOutputFileHandle());
}
SBEvent event;
@@ -1237,7 +1207,7 @@
else
done = HandleIOEvent (event);
}
- else if (event.BroadcasterMatchesRef (SBDebugger::GetCurrentTarget().GetProcess().GetBroadcaster()))
+ else if (event.BroadcasterMatchesRef (m_debugger.GetCurrentTarget().GetProcess().GetBroadcaster()))
{
HandleProcessEvent (event);
}
@@ -1267,7 +1237,7 @@
}
}
- SBProcess process = SBDebugger::GetCurrentTarget().GetProcess();
+ SBProcess process = m_debugger.GetCurrentTarget().GetProcess();
if (process.IsValid())
process.Destroy();
}
@@ -1289,19 +1259,27 @@
int
main (int argc, char const *argv[])
{
-
SBDebugger::Initialize();
SBHostOS::ThreadCreated ("[main]");
- // Do a little setup on the debugger before we get going
- SBDebugger::SetAsync(true);
- Driver driver;
-
- bool valid_args = driver.ParseArgs (argc, argv, stdout, stderr);
- if (valid_args)
+ // Create a scope for driver so that the driver object will destroy itself
+ // before SBDebugger::Terminate() is called.
{
- driver.MainLoop ();
+ Driver driver;
+
+ bool exit = false;
+ SBError error (driver.ParseArgs (argc, argv, stdout, exit));
+ if (error.Fail())
+ {
+ const char *error_cstr = error.GetCString ();
+ if (error_cstr)
+ ::fprintf (stderr, "error: %s\n", error_cstr);
+ }
+ else if (!exit)
+ {
+ driver.MainLoop ();
+ }
}
SBDebugger::Terminate();
Modified: lldb/trunk/tools/driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.h?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Driver.h (original)
+++ lldb/trunk/tools/driver/Driver.h Tue Jun 22 20:19:29 2010
@@ -19,6 +19,7 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBBroadcaster.h"
+#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBInputReader.h"
@@ -59,8 +60,8 @@
void
HandleProcessEvent (const lldb::SBEvent &event);
- bool
- ParseArgs (int argc, const char *argv[], FILE *out_fh, FILE *err_fh);
+ lldb::SBError
+ ParseArgs (int argc, const char *argv[], FILE *out_fh, bool &do_exit);
const char *
GetFilename() const;
@@ -113,7 +114,14 @@
Driver::OptionData &data);
+ lldb::SBDebugger &
+ GetDebugger()
+ {
+ return m_debugger;
+ }
+
private:
+ lldb::SBDebugger m_debugger;
lldb_utility::PseudoTerminal m_editline_pty;
FILE *m_editline_slave_fh;
lldb::SBInputReader m_editline_reader;
Modified: lldb/trunk/tools/driver/IOChannel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/IOChannel.cpp?rev=106615&r1=106614&r2=106615&view=diff
==============================================================================
--- lldb/trunk/tools/driver/IOChannel.cpp (original)
+++ lldb/trunk/tools/driver/IOChannel.cpp Tue Jun 22 20:19:29 2010
@@ -70,13 +70,12 @@
SBStringList completions;
size_t page_size = 40;
- int num_completions
- = SBDebugger::GetCommandInterpreter().HandleCompletion (line_info->buffer,
- line_info->cursor,
- line_info->lastchar,
- 0,
- -1,
- completions);
+ int num_completions = m_driver->GetDebugger().GetCommandInterpreter().HandleCompletion (line_info->buffer,
+ line_info->cursor,
+ line_info->lastchar,
+ 0,
+ -1,
+ completions);
if (num_completions == -1)
{
@@ -269,7 +268,7 @@
SBListener listener("IOChannel::Run");
std::string new_line;
- SBBroadcaster interpreter_broadcaster (SBDebugger::GetCommandInterpreter().GetBroadcaster());
+ SBBroadcaster interpreter_broadcaster (m_driver->GetDebugger().GetCommandInterpreter().GetBroadcaster());
listener.StartListeningForEvents (interpreter_broadcaster,
SBCommandInterpreter::eBroadcastBitResetPrompt |
SBCommandInterpreter::eBroadcastBitThreadShouldExit |
More information about the lldb-commits
mailing list