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.

llvm-svn: 106615
This commit is contained in:
Greg Clayton 2010-06-23 01:19:29 +00:00
parent ef5a4383ad
commit 6611103cfe
167 changed files with 2935 additions and 3638 deletions

View file

@ -66,7 +66,7 @@ protected:
private:
std::auto_ptr<lldb_private::Address> m_lldb_object_ap;
std::auto_ptr<lldb_private::Address> m_opaque_ap;
};

View file

@ -35,7 +35,7 @@ private:
SBBlock (lldb_private::Block *lldb_object_ptr);
lldb_private::Block *m_lldb_object_ptr;
lldb_private::Block *m_opaque_ptr;
};

View file

@ -140,7 +140,7 @@ private:
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

View file

@ -82,7 +82,7 @@ private:
void
SetLocation (const lldb::BreakpointLocationSP &break_loc_sp);
lldb::BreakpointLocationSP m_break_loc_sp;
lldb::BreakpointLocationSP m_opaque_sp;
};

View file

@ -66,16 +66,20 @@ protected:
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

View file

@ -19,7 +19,7 @@ class SBCommandContext
{
public:
SBCommandContext (lldb_private::CommandContext *lldb_object);
SBCommandContext (lldb_private::Debugger *lldb_object);
~SBCommandContext ();
@ -28,7 +28,7 @@ public:
private:
lldb_private::CommandContext *m_lldb_object;
lldb_private::Debugger *m_opaque;
};
} // namespace lldb

View file

@ -27,6 +27,9 @@ public:
~SBCommandInterpreter ();
bool
IsValid() const;
bool
CommandExists (const char *cmd);
@ -86,17 +89,20 @@ public:
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;
};

View file

@ -62,17 +62,27 @@ protected:
friend class SBCommandInterpreter;
friend class SBOptions;
#ifndef SWIG
lldb_private::CommandReturnObject *
GetLLDBObjectPtr();
operator->() const;
lldb_private::CommandReturnObject *
get() const;
lldb_private::CommandReturnObject &
GetLLDBObjectRef();
operator*() const;
lldb_private::CommandReturnObject &
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

View file

@ -87,8 +87,8 @@ private:
// void
// CreateIfNeeded ();
lldb_private::Communication *m_lldb_object;
bool m_lldb_object_owned;
lldb_private::Communication *m_opaque;
bool m_opaque_owned;
};

View file

@ -66,7 +66,7 @@ private:
#endif
lldb_private::CompileUnit *m_lldb_object_ptr;
lldb_private::CompileUnit *m_opaque_ptr;
};

View file

@ -25,95 +25,90 @@ public:
static void
Terminate();
static void
static SBDebugger
Create();
~SBDebugger();
bool
IsValid() const;
void
SetAsync (bool b);
static void
SetInputFile (const char *tty_name); // DEPRECATED: will be removed in next submission
static void
SetOutputFile (const char *tty_name); // DEPRECATED: will be removed in next submission
static void
SetErrorFile (const char *tty_name); // DEPRECATED: will be removed in next submission
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 @@ public:
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:
#ifndef SWIG
friend class SBProcess;
static lldb::SBTarget
// Use the static function: SBDebugger::Create();
SBDebugger();
#ifndef SWIG
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

View file

@ -90,7 +90,7 @@ protected:
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 ();

View file

@ -64,25 +64,26 @@ protected:
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

View file

@ -54,6 +54,7 @@ private:
friend class SBHostOS;
friend class SBModule;
friend class SBSourceManager;
friend class SBThread;
friend class SBTarget;
void
@ -74,7 +75,7 @@ private:
#endif
std::auto_ptr <lldb_private::FileSpec> m_lldb_object_ap;
std::auto_ptr <lldb_private::FileSpec> m_opaque_ap;
};

View file

@ -122,7 +122,7 @@ private:
void
SetFrame (const lldb::StackFrameSP &lldb_object_sp);
lldb::StackFrameSP m_lldb_object_sp;
lldb::StackFrameSP m_opaque_sp;
};
} // namespace lldb

View file

@ -46,7 +46,7 @@ private:
SBFunction (lldb_private::Function *lldb_object_ptr);
lldb_private::Function *m_lldb_object_ptr;
lldb_private::Function *m_opaque_ptr;
};

View file

@ -36,7 +36,8 @@ public:
SBError
Initialize (Callback callback,
Initialize (SBDebugger &debugger,
Callback callback,
void *callback_baton,
lldb::InputReaderGranularity granularity,
const char *end_token,
@ -76,21 +77,26 @@ protected:
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;
};

View file

@ -48,7 +48,7 @@ public:
private:
//lldb_private::Disassembler::Instruction::SharedPtr m_lldb_object_sp;
//lldb_private::Disassembler::Instruction::SharedPtr m_opaque_sp;
};

View file

@ -79,7 +79,7 @@ private:
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;
};

View file

@ -106,12 +106,15 @@ private:
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

View file

@ -70,7 +70,7 @@ private:
#endif
lldb::ModuleSP m_lldb_object_sp;
lldb::ModuleSP m_opaque_sp;
};

View file

@ -106,12 +106,6 @@ public:
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 @@ public:
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 @@ protected:
void
SetProcess (const lldb::ProcessSP &process_sp);
lldb::ProcessSP m_lldb_object_sp;
lldb::ProcessSP m_opaque_sp;
};
} // namespace lldb

View file

@ -41,7 +41,7 @@ protected:
private:
lldb_private::SourceManager &m_source_manager;
lldb_private::SourceManager &m_opaque_ref;
};
} // namespace lldb

View file

@ -62,7 +62,7 @@ public:
private:
std::auto_ptr<lldb_private::StringList> m_lldb_object_ap;
std::auto_ptr<lldb_private::StringList> m_opaque_ap;
};

View file

@ -46,7 +46,7 @@ private:
SBSymbol (lldb_private::Symbol *lldb_object_ptr);
lldb_private::Symbol *m_lldb_object_ptr;
lldb_private::Symbol *m_opaque_ptr;
};

View file

@ -64,7 +64,7 @@ protected:
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;
};

View file

@ -70,6 +70,9 @@ public:
lldb::SBModule
GetModuleAtIndex (uint32_t idx);
lldb::SBDebugger
GetDebugger() const;
lldb::SBModule
FindModule (const lldb::SBFileSpec &file_spec);
@ -146,20 +149,20 @@ protected:
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

View file

@ -82,9 +82,6 @@ public:
void
RunToAddress (lldb::addr_t addr);
void
Backtrace (uint32_t num_frames = 0);
uint32_t
GetNumFrames ();
@ -146,7 +143,7 @@ private:
// Classes that inherit from Thread can see and modify these
//------------------------------------------------------------------
lldb::ThreadSP m_lldb_object_sp;
lldb::ThreadSP m_opaque_sp;
};
} // namespace lldb

View file

@ -112,11 +112,11 @@ protected:
#endif
private:
lldb_private::ExecutionContext
GetCurrentExecutionContext ();
lldb::ValueObjectSP m_lldb_object_sp;
//
// lldb_private::ExecutionContext
// GetCurrentExecutionContext ();
//
lldb::ValueObjectSP m_opaque_sp;
};
} // namespace lldb

View file

@ -68,7 +68,7 @@ private:
void
CreateIfNeeded ();
std::auto_ptr<lldb_private::ValueObjectList> m_lldb_object_ap;
std::auto_ptr<lldb_private::ValueObjectList> m_opaque_ap;
};

View file

@ -48,7 +48,7 @@ public:
//------------------------------------------------------------------
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?
};

View file

@ -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 @@ class Debugger
{
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 @@ public:
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 @@ protected:
void
DisconnectInput();
bool m_async_execution;
Communication m_input_comm;
StreamFile m_input_file;
StreamFile m_output_file;
@ -145,21 +160,19 @@ protected:
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;
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();
// Use Debugger::CreateInstance() to get a shared pointer to a new
// debugger object
Debugger ();
DISALLOW_COPY_AND_ASSIGN (Debugger);
};

View file

@ -86,7 +86,8 @@ public:
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);

View file

@ -24,12 +24,12 @@ class InputReader
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 @@ public:
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 @@ protected:
void
Notify (lldb::InputReaderAction notification);
Debugger &m_debugger;
Callback m_callback;
void *m_callback_baton;
std::string m_end_token;

View file

@ -29,12 +29,12 @@ public:
// 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 @@ public:
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 @@ public:
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 @@ public:
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:
{
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:
{
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:
{
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 @@ public:
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);

View file

@ -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_

View file

@ -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 @@ public:
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 @@ public:
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 @@ public:
void
ShowVariableHelp (CommandReturnObject &result);
CommandContext *
Context();
Debugger &
GetDebugger ()
{
return m_debugger;
}
const Args *
GetProgramArguments ();
@ -159,12 +163,6 @@ public:
const char *
ProcessEmbeddedScriptCommands (const char *arg);
Listener *
GetListener ();
SourceManager &
GetSourceManager ();
const char *
GetPrompt ();
@ -244,12 +242,9 @@ protected:
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

View file

@ -83,26 +83,23 @@ public:
// 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 @@ public:
virtual bool
Execute (Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result) = 0;
void
@ -134,12 +130,12 @@ public:
// 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 @@ public:
// 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);

View file

@ -37,9 +37,8 @@ public:
GenerateHelpText (CommandReturnObject &result);
virtual bool
Execute (Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
virtual bool

View file

@ -28,10 +28,10 @@ class CommandObjectMultiword : public CommandObject
{
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 @@ public:
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 @@ public:
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;

View file

@ -35,18 +35,16 @@ public:
~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);

View file

@ -218,13 +218,13 @@ public:
/// \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 @@ public:
/// \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;

View file

@ -43,10 +43,10 @@ public:
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)

View file

@ -18,15 +18,15 @@ class ScriptInterpreterNone : public ScriptInterpreter
{
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);
};

View file

@ -20,15 +20,15 @@ class ScriptInterpreterPython : public ScriptInterpreter
{
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 @@ public:
static size_t
GenerateBreakpointOptionsCommandCallback (void *baton,
InputReader *reader,
InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len);
@ -58,7 +58,8 @@ public:
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 @@ private:
static size_t
InputReaderCallback (void *baton,
InputReader *reader,
InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len);

View file

@ -64,7 +64,7 @@ private:
///
/// @see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
//------------------------------------------------------------------
Target();
Target(Debugger &debugger);
public:
~Target();
@ -253,6 +253,12 @@ public:
ArchSpec
GetArchitecture () const;
Debugger &
GetDebugger ()
{
return m_debugger;
}
bool
GetTargetTriple (ConstString &target_triple);
@ -294,6 +300,7 @@ protected:
//------------------------------------------------------------------
// 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;

View file

@ -79,7 +79,8 @@ public:
/// 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,

View file

@ -33,6 +33,7 @@ namespace lldb {
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;

View file

@ -42,7 +42,7 @@ class ClangASTContext;
class ClangExpression;
class ClangExpressionDeclMap;
class ClangExpressionVariableList;
class CommandContext;
class Debugger;
class CommandInterpreter;
class CommandObject;
class CommandReturnObject;

View file

@ -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 */,

View file

@ -15,22 +15,22 @@ using namespace lldb;
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 @@ SBAddress::operator = (const SBAddress &rhs)
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 @@ SBAddress::operator = (const SBAddress &rhs)
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 @@ SBAddress::SetAddress (const lldb_private::Address *lldb_object_ptr)
{
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 @@ SBAddress::GetFileAddress () const
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 @@ SBAddress::GetLoadAddress (const SBProcess &process) const
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 @@ SBAddress::OffsetAddress (addr_t offset)
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;
}

View file

@ -14,24 +14,24 @@ using namespace lldb;
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 @@ SBBlock::AppendVariables (bool can_create, bool get_parent_variables, lldb_priva
{
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);
}
}

View file

@ -62,18 +62,18 @@ public:
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 @@ SBBreakpoint::operator = (const SBBreakpoint& rhs)
{
if (this != &rhs)
{
m_break_sp = rhs.m_break_sp;
m_opaque_sp = rhs.m_opaque_sp;
}
return *this;
}
@ -94,8 +94,8 @@ SBBreakpoint::operator = (const SBBreakpoint& rhs)
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 @@ SBBreakpoint::GetID () const
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 @@ SBBreakpoint::FindLocationByAddress (addr_t vm_addr)
{
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 @@ SBBreakpoint::FindLocationIDByAddress (addr_t vm_addr)
{
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 @@ SBBreakpoint::FindLocationByID (break_id_t bp_loc_id)
{
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 @@ SBBreakpoint::GetLocationAtIndex (uint32_t index)
{
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 @@ SBBreakpoint::GetLocationAtIndex (uint32_t index)
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 @@ SBBreakpoint::ListLocations (FILE* f, const char *description_level)
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 @@ SBBreakpoint::ListLocations (FILE* f, const char *description_level)
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 @@ SBBreakpoint::IsEnabled ()
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 @@ SBBreakpoint::GetIgnoreCount () const
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 @@ SBBreakpoint::GetThreadID ()
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 @@ SBBreakpoint::GetThreadIndex() const
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 @@ SBBreakpoint::GetThreadName () const
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 @@ SBBreakpoint::GetQueueName () const
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 @@ SBBreakpoint::GetNumResolvedLocations() const
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 @@ SBBreakpoint::GetDescription (FILE *f, const char *description_level, bool descr
if (f == NULL)
return;
if (m_break_sp)
if (m_opaque_sp)
{
DescriptionLevel level;
if (strcmp (description_level, "brief") == 0)
@ -379,15 +369,15 @@ SBBreakpoint::GetDescription (FILE *f, const char *description_level, bool descr
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 @@ SBBreakpoint::PrivateBreakpointHitCallback
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 @@ SBBreakpoint::PrivateBreakpointHitCallback
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 @@ SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton)
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;
}

View file

@ -31,7 +31,7 @@ SBBreakpointLocation::SBBreakpointLocation ()
}
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 @@ SBBreakpointLocation::~SBBreakpointLocation ()
bool
SBBreakpointLocation::IsValid() const
{
return m_break_loc_sp.get() != NULL;
return m_opaque_sp.get() != NULL;
}
addr_t
@ -50,9 +50,9 @@ SBBreakpointLocation::GetLoadAddress ()
{
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 @@ SBBreakpointLocation::GetLoadAddress ()
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 @@ SBBreakpointLocation::IsEnabled ()
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 @@ SBBreakpointLocation::GetIgnoreCount ()
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 @@ SBBreakpointLocation::GetThreadIndex() const
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 @@ SBBreakpointLocation::GetThreadName () const
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 @@ SBBreakpointLocation::GetQueueName () const
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 @@ SBBreakpointLocation::IsResolved ()
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 @@ SBBreakpointLocation::GetDescription (FILE *f, const char *description_level)
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 @@ SBBreakpointLocation::GetDescription (FILE *f, const char *description_level)
StreamFile str (f);
m_break_loc_sp->GetDescription (&str, level);
m_opaque_sp->GetDescription (&str, level);
str.EOL();
}
}
@ -221,8 +220,8 @@ SBBreakpoint
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;
}

View file

@ -19,124 +19,124 @@ using namespace lldb_private;
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;
}

View file

@ -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;
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 @@ SBCommandContext::~SBCommandContext ()
bool
SBCommandContext::IsValid () const
{
return m_lldb_object != NULL;
return m_opaque != NULL;
}

View file

@ -30,8 +30,8 @@ using namespace lldb;
using namespace lldb_private;
SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter &interpreter) :
m_interpreter (interpreter)
SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) :
m_opaque_ptr (interpreter)
{
}
@ -39,29 +39,50 @@ SBCommandInterpreter::~SBCommandInterpreter ()
{
}
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 @@ SBCommandInterpreter::HandleCompletion (const char *current_line,
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 @@ SBCommandInterpreter::GetProcess ()
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 @@ SBCommandInterpreter::WriteToScriptInterpreter (const char *src)
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 @@ SBCommandInterpreter::WriteToScriptInterpreter (const char *src, size_t src_len)
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;
}

View file

@ -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 @@ SBCommandReturnObject::PutError (FILE *fh)
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);
}

View file

@ -18,57 +18,57 @@ using namespace lldb_private;
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 @@ SBCommunication::Connect (const char *url)
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 @@ SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd)
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 @@ SBCommunication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, Connect
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 @@ SBCommunication::Write (const void *src, size_t src_len, ConnectionStatus &statu
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 @@ SBCommunication::ReadThreadStart ()
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 @@ SBCommunication::SetReadThreadBytesReceivedCallback
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 @@ SBCommunication::SetReadThreadBytesReceivedCallback
SBBroadcaster
SBCommunication::GetBroadcaster ()
{
SBBroadcaster broadcaster (m_lldb_object, false);
SBBroadcaster broadcaster (m_opaque, false);
return broadcaster;
}
@ -180,15 +180,15 @@ SBCommunication::GetBroadcaster ()
//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);
//}
//
//

View file

@ -18,35 +18,35 @@ using namespace lldb_private;
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 @@ SBLineEntry
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 @@ SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const
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 @@ SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec
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;
}

View file

@ -43,112 +43,121 @@ SBDebugger::Terminate ()
Debugger::Terminate();
}
SBDebugger
SBDebugger::Create()
{
SBDebugger debugger;
debugger.reset(Debugger::CreateInstance());
return debugger;
}
SBDebugger::SBDebugger () :
m_opaque_sp ()
{
}
SBDebugger::~SBDebugger ()
{
}
bool
SBDebugger::IsValid() const
{
return m_opaque_sp.get() != NULL;
}
void
SBDebugger::SetAsync (bool b)
{
static bool value_set_once = false;
if (!value_set_once)
{
value_set_once = true;
Debugger::GetSharedInstance().SetAsyncExecution(b);
}
if (m_opaque_sp)
m_opaque_sp->SetAsyncExecution(b);
}
void
SBDebugger::SetInputFile (const char *tty_name)
{
// DEPRECATED: will be removed in next submission
FILE *fh = ::fopen (tty_name, "r");
SetInputFileHandle (fh, true);
}
void
SBDebugger::SetOutputFile (const char *tty_name)
{
// DEPRECATED: will be removed in next submission
FILE *fh = ::fopen (tty_name, "w");
SetOutputFileHandle (fh, true);
SetErrorFileHandle (fh, false);
}
void
SBDebugger::SetErrorFile (const char *tty_name)
{
// DEPRECATED: will be removed in next submission
}
// 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 @@ SBDebugger::HandleCommand (const char *command)
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 @@ SBDebugger::UpdateCurrentThread (SBProcess &process)
}
}
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 @@ SBDebugger::GetScriptingLanguage (const char *script_language_name)
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 @@ SBTarget
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;
SBTarget target;
if (m_opaque_sp)
{
FileSpec file (filename);
ArchSpec arch = lldb_private::GetDefaultArchitecture();
TargetSP target_sp;
Error error;
if (archname != NULL)
{
ArchSpec arch2 (archname);
error = Debugger::GetSharedInstance().GetTargetList().CreateTarget (file, arch2, NULL, true, target_sp);
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 @@ SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archn
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())
{
m_opaque_sp->GetTargetList().SetCurrentTarget (target_sp.get());
target.reset (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.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 @@ SBDebugger::FindTargetWithLLDBProcess (const lldb::ProcessSP &process_sp)
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;
}

View file

@ -16,15 +16,15 @@ using namespace lldb_private;
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 @@ SBError::operator = (const SBError &rhs)
{
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 @@ SBError::operator = (const SBError &rhs)
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 @@ void
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 @@ void
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 @@ SBError::SetErrorStringWithFormat (const char *format, ...)
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 @@ SBError::SetErrorStringWithFormat (const char *format, ...)
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 @@ const lldb_private::Error &
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;
}

View file

@ -24,19 +24,19 @@ using namespace lldb_private;
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 @@ SBEvent::~SBEvent()
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 @@ SBEvent::Dump (FILE *f) const
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 @@ SBEvent::GetDataFlavor ()
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 @@ SBBroadcaster
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 @@ SBEvent::BroadcasterMatchesPtr (const SBBroadcaster *broadcaster)
{
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 @@ SBEvent::BroadcasterMatchesPtr (const SBBroadcaster *broadcaster)
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()));
}

View file

@ -16,19 +16,19 @@ using namespace lldb_private;
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 @@ SBFileSpec::operator = (const SBFileSpec &rhs)
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 @@ SBFileSpec::operator = (const SBFileSpec &rhs)
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 @@ SBFileSpec::ResolvePath (const char *src_path, char *dst_path, size_t dst_len)
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 @@ SBFileSpec::GetPath (char *dst_path, size_t dst_len) const
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));
}

View file

@ -41,12 +41,12 @@ using namespace lldb;
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 @@ SBFrame::~SBFrame()
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 @@ SBFrame::GetFrameID () const
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 @@ SBFrame::GetSP () const
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 @@ SBAddress
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 @@ SBFrame::LookupVarInScope (const char *var_name, const char *scope)
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 @@ SBFrame::Disassemble () const
lldb_private::StackFrame *
SBFrame::GetLLDBObjectPtr ()
{
return m_lldb_object_sp.get();
return m_opaque_sp.get();
}
SBValueList
@ -302,10 +302,10 @@ SBFrame::GetVariables (bool arguments,
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 @@ SBFrame::GetVariables (bool arguments,
}
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 @@ SBFrame::GetVariables (bool arguments,
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 @@ lldb::SBValueList
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();

View file

@ -15,50 +15,50 @@ using namespace lldb;
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;
}

View file

@ -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;
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 () :
}
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 @@ size_t
SBInputReader::PrivateCallback
(
void *baton,
InputReader *reader,
InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len
@ -62,6 +63,7 @@ SBInputReader::PrivateCallback
SBError
SBInputReader::Initialize
(
SBDebugger &debugger,
Callback callback_function,
void *callback_baton,
lldb::InputReaderGranularity granularity,
@ -71,14 +73,14 @@ SBInputReader::Initialize
)
{
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 @@ SBInputReader::Initialize
if (sb_error.Fail())
{
m_reader_sp.reset ();
m_opaque_sp.reset ();
m_callback_function = NULL;
m_callback_baton = NULL;
}
@ -99,46 +101,53 @@ SBInputReader::Initialize
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 @@ SBInputReader::IsDone () const
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 @@ SBInputReader::IsActive () const
InputReaderGranularity
SBInputReader::GetGranularity ()
{
if (m_reader_sp)
return m_reader_sp->GetGranularity();
if (m_opaque_sp)
return m_opaque_sp->GetGranularity();
else
return eInputReaderGranularityInvalid;
}

View file

@ -15,7 +15,7 @@ using namespace lldb;
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 @@ SBInstruction::~SBInstruction ()
//bool
//SBInstruction::IsValid()
//{
// return (m_lldb_object_sp.get() != NULL);
// return (m_opaque_sp.get() != NULL);
//}
//size_t
@ -38,7 +38,7 @@ SBInstruction::~SBInstruction ()
//{
// if (IsValid())
// {
// return m_lldb_object_sp->GetByteSize();
// return m_opaque_sp->GetByteSize();
// }
// return 0;
//}
@ -48,7 +48,7 @@ SBInstruction::~SBInstruction ()
//{
// if (IsValid ())
// {
// m_lldb_object_sp->SetByteSize (byte_size);
// m_opaque_sp->SetByteSize (byte_size);
// }
//}
@ -57,7 +57,7 @@ SBInstruction::~SBInstruction ()
//{
// if (IsValid ())
// {
// return m_lldb_object_sp->DoesBranch ();
// return m_opaque_sp->DoesBranch ();
// }
// return false;
//}
@ -70,5 +70,5 @@ SBInstruction::Print (FILE *out)
//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);
}

View file

@ -14,26 +14,26 @@ using namespace lldb;
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 @@ SBLineEntry::operator = (const SBLineEntry &rhs)
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 @@ SBLineEntry::operator = (const SBLineEntry &rhs)
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 @@ SBAddress
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 @@ SBAddress
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 @@ SBLineEntry::GetEndAddress () const
bool
SBLineEntry::IsValid () const
{
return m_lldb_object_ap.get() != NULL;
return m_opaque_ap.get() != NULL;
}
@ -94,16 +94,16 @@ SBFileSpec
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 @@ SBLineEntry::GetLine () const
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 @@ SBLineEntry::operator == (const SBLineEntry &rhs) const
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 @@ SBLineEntry::operator != (const SBLineEntry &rhs) const
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;
}

View file

@ -19,30 +19,32 @@ using namespace lldb;
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 @@ SBListener::~SBListener ()
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 @@ SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t
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 @@ SBListener::StopListeningForEvents (const SBBroadcaster& broadcaster, uint32_t e
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 @@ SBListener::WaitForEvent (uint32_t num_seconds, SBEvent &event)
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 @@ SBListener::WaitForEventForBroadcaster
SBEvent &event
)
{
if (IsValid() && broadcaster.IsValid())
if (m_opaque_ptr && broadcaster.IsValid())
{
TimeValue time_value;
if (num_seconds != UINT32_MAX)
@ -128,16 +130,16 @@ SBListener::WaitForEventForBroadcaster
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 @@ SBListener::WaitForEventForBroadcasterWithType
SBEvent &event
)
{
if (IsValid() && broadcaster.IsValid())
if (m_opaque_ptr && broadcaster.IsValid())
{
TimeValue time_value;
if (num_seconds != UINT32_MAX)
@ -159,40 +161,40 @@ SBListener::WaitForEventForBroadcasterWithType
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 @@ bool
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 @@ SBListener::GetNextEventForBroadcasterWithType
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;
}

View file

@ -15,12 +15,12 @@ using namespace lldb;
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 @@ SBModule::~SBModule ()
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 @@ SBModule::GetUUIDBytes () const
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;
}

View file

@ -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 @@ using namespace lldb_private;
SBProcess::SBProcess () :
m_lldb_object_sp()
m_opaque_sp()
{
}
@ -47,13 +48,13 @@ SBProcess::SBProcess () :
//----------------------------------------------------------------------
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 @@ SBProcess::~SBProcess()
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 @@ SBThread
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 @@ SBTarget
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 @@ SBProcess::GetTarget() const
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 @@ SBProcess::PutSTDIN (const char *src, size_t src_len)
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 @@ SBProcess::GetSTDOUT (char *dst, size_t dst_len) const
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 @@ SBProcess::ReportCurrentState (const SBEvent &event, FILE *out) const
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 @@ SBProcess::ReportCurrentState (const SBEvent &event, FILE *out) const
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 @@ SBProcess::AppendCurrentStateReport (const SBEvent &event, SBCommandReturnObject
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 @@ SBThread
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 @@ SBProcess::GetState ()
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 @@ SBProcess::GetExitStatus ()
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 @@ SBProcess::GetExitDescription ()
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 @@ SBProcess::GetProcessID ()
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 @@ SBProcess::WaitUntilProcessHasStopped (SBCommandReturnObject &result)
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 @@ SBProcess::Continue ()
{
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 @@ SBError
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 @@ SBProcess::Stop ()
{
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 @@ SBError
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 @@ SBError
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 @@ SBError
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 @@ SBError
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 @@ SBError
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 @@ SBProcess::GetProcessFromEvent (const SBEvent &event)
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 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error
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 @@ SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &s
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 @@ SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &s
lldb_private::Process *
SBProcess::get() const
{
return m_lldb_object_sp.get();
return m_opaque_sp.get();
}

View file

@ -21,7 +21,7 @@ using namespace lldb_private;
SBSourceManager::SBSourceManager (SourceManager& source_manager) :
m_source_manager (source_manager)
m_opaque_ref (source_manager)
{
}
@ -48,12 +48,12 @@ SBSourceManager::DisplaySourceLinesWithLineNumbers
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 @@ SBSourceManager::DisplaySourceLinesWithLineNumbers
SourceManager &
SBSourceManager::GetLLDBManager ()
{
return m_source_manager;
return m_opaque_ref;
}

View file

@ -15,22 +15,22 @@ using namespace lldb;
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 @@ const SBStringList &
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 @@ SBStringList::operator = (const SBStringList &rhs)
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 @@ SBStringList::AppendString (const char *str)
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 @@ SBStringList::AppendList (const char **strv, int strc)
&& (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 @@ SBStringList::AppendList (SBStringList strings)
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 @@ SBStringList::GetSize () const
{
if (IsValid())
{
return m_lldb_object_ap->GetSize();
return m_opaque_ap->GetSize();
}
return 0;
}
@ -119,7 +119,7 @@ SBStringList::GetStringAtIndex (size_t idx)
{
if (IsValid())
{
return m_lldb_object_ap->GetStringAtIndex (idx);
return m_opaque_ap->GetStringAtIndex (idx);
}
return NULL;
}
@ -129,6 +129,6 @@ SBStringList::Clear ()
{
if (IsValid())
{
m_lldb_object_ap->Clear();
m_opaque_ap->Clear();
}
}

View file

@ -14,39 +14,39 @@ using namespace lldb;
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 @@ SBSymbol::GetMangledName () const
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;
}

View file

@ -16,22 +16,22 @@ using namespace lldb_private;
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 @@ SBSymbolContext::operator = (const SBSymbolContext &rhs)
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 @@ SBSymbolContext::SetSymbolContext (const SymbolContext *sc_ptr)
{
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 @@ SBModule
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 @@ SBSymbolContext::GetLineEntry ()
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();
}

View file

@ -53,12 +53,12 @@ SBTarget::SBTarget ()
}
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 @@ SBTarget::Assign (const SBTarget& rhs)
{
if (this != &rhs)
{
m_target_sp = rhs.m_target_sp;
m_opaque_sp = rhs.m_opaque_sp;
}
return *this;
}
@ -83,28 +83,37 @@ SBTarget::~SBTarget()
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 @@ SBFileSpec
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 @@ SBTarget::GetExecutable ()
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 @@ SBTarget::DeleteTargetFromList (TargetList *list)
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 @@ SBTarget::MakeCurrentTarget ()
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_target_sp.get();
return m_opaque_sp.get();
}
void
SBTarget::reset (const lldb::TargetSP& target_sp)
{
m_opaque_sp = target_sp;
}
SBBreakpoint
@ -207,8 +223,8 @@ SBBreakpoint
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 @@ SBBreakpoint
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 @@ SBBreakpoint
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 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *mo
{
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 @@ SBBreakpoint
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 @@ SBBreakpoint
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 @@ SBTarget::FindBreakpointByID (break_id_t bp_id)
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 @@ SBTarget::EnableAllBreakpoints ()
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 @@ SBTarget::DisableAllBreakpoints ()
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 @@ SBTarget::DeleteAllBreakpoints ()
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 @@ SBModule
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 @@ SBModule
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 @@ SBTarget::GetModuleAtIndex (uint32_t idx)
SBBroadcaster
SBTarget::GetBroadcaster () const
{
SBBroadcaster broadcaster(m_target_sp.get(), false);
SBBroadcaster broadcaster(m_opaque_sp.get(), false);
return broadcaster;
}
@ -376,11 +392,11 @@ SBTarget::Disassemble (lldb::addr_t file_address_start, lldb::addr_t file_addres
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 @@ SBTarget::Disassemble (lldb::addr_t file_address_start, lldb::addr_t file_addres
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 @@ SBTarget::Disassemble (const char *function_name, const char *module_name)
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 @@ SBTarget::Disassemble (const char *function_name, const char *module_name)
module = FindModule (file_spec);
}
ArchSpec arch (m_target_sp->GetArchitecture());
ArchSpec arch (m_opaque_sp->GetArchitecture());
if (!arch.IsValid())
return;
@ -486,7 +502,7 @@ SBTarget::Disassemble (const char *function_name, const char *module_name)
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);

View file

@ -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;
using namespace lldb_private;
SBThread::SBThread () :
m_lldb_object_sp ()
m_opaque_sp ()
{
}
@ -43,13 +45,13 @@ SBThread::SBThread () :
// 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 @@ SBThread::~SBThread()
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 @@ SBThread::GetStopReason()
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 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
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 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
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 @@ SBThread::GetThreadID () const
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 @@ SBThread::DisplayFramesForCurrentContext (FILE *out,
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 @@ SBThread::DisplayFramesForCurrentContext (FILE *out,
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 @@ SBThread::DisplaySingleFrameForCurrentContext (FILE *out,
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 @@ SBThread::DisplaySingleFrameForCurrentContext (FILE *out,
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 @@ SBThread::DisplaySingleFrameForCurrentContext (FILE *out,
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 @@ SBThread::StepOver (lldb::RunMode stop_other_threads)
}
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 @@ SBThread::StepOver (lldb::RunMode stop_other_threads)
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 @@ SBThread::StepInto (lldb::RunMode stop_other_threads)
}
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 @@ SBThread::StepInto (lldb::RunMode stop_other_threads)
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 @@ SBThread::StepOut ()
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 @@ SBThread::StepInstruction (bool step_over)
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 @@ SBThread::GetProcess ()
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 @@ SBFrame
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;
}

View file

@ -33,12 +33,12 @@ using namespace lldb;
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 @@ SBValue::~SBValue()
bool
SBValue::IsValid () const
{
return (m_lldb_object_sp.get() != NULL);
return (m_opaque_sp.get() != NULL);
}
void
@ -72,25 +72,25 @@ SBValue::Print (FILE *out_file, SBFrame *frame, bool print_type, bool print_valu
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 @@ SBValue::Print (FILE *out_file, SBFrame *frame, bool print_type, bool print_valu
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 @@ const char *
SBValue::GetName()
{
if (IsValid())
return m_lldb_object_sp->GetName().AsCString();
return m_opaque_sp->GetName().AsCString();
else
return NULL;
}
@ -140,7 +140,7 @@ const char *
SBValue::GetTypeName ()
{
if (IsValid())
return m_lldb_object_sp->GetTypeName().AsCString();
return m_opaque_sp->GetTypeName().AsCString();
else
return NULL;
}
@ -151,7 +151,7 @@ SBValue::GetByteSize ()
size_t result = 0;
if (IsValid())
result = m_lldb_object_sp->GetByteSize();
result = m_opaque_sp->GetByteSize();
return result;
}
@ -162,7 +162,7 @@ SBValue::IsInScope (const SBFrame &frame)
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 @@ const char *
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 @@ bool
SBValue::GetValueDidChange ()
{
if (IsValid())
return m_lldb_object_sp->GetValueDidChange();
return m_opaque_sp->GetValueDidChange();
return false;
}
@ -188,8 +188,8 @@ const char *
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 @@ SBValue::GetLocation (const SBFrame &frame)
{
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 @@ SBValue::SetValueFromCString (const SBFrame &frame, const char *value_str)
{
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 @@ SBValue::GetChildAtIndex (uint32_t idx)
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 @@ uint32_t
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 @@ SBValue::GetChildMemberWithName (const char *name)
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 @@ SBValue::GetNumChildren ()
if (IsValid())
{
num_children = m_lldb_object_sp->GetNumChildren();
num_children = m_opaque_sp->GetNumChildren();
}
return num_children;
@ -269,7 +269,7 @@ SBValue::ValueIsStale ()
if (IsValid())
{
result = m_lldb_object_sp->GetValueIsValid();
result = m_opaque_sp->GetValueIsValid();
}
return result;
@ -281,7 +281,7 @@ SBValue::Dereference ()
{
if (IsValid())
{
if (m_lldb_object_sp->IsPointerType())
if (m_opaque_sp->IsPointerType())
{
return GetChildAtIndex(0);
}
@ -296,53 +296,53 @@ SBValue::TypeIsPtrType ()
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 @@ SBValue::GetOpaqueType()
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;
}

View file

@ -17,22 +17,22 @@ using namespace lldb;
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 @@ SBValueList::~SBValueList ()
bool
SBValueList::IsValid () const
{
return (m_lldb_object_ap.get() != NULL);
return (m_opaque_ap.get() != NULL);
}
const SBValueList &
@ -51,9 +51,9 @@ SBValueList::operator = (const SBValueList &rhs)
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 @@ SBValueList::operator = (const SBValueList &rhs)
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 @@ SBValueList::Append (const SBValue &val_obj)
if (val_obj.get())
{
CreateIfNeeded ();
m_lldb_object_ap->Append (*val_obj);
m_opaque_ap->Append (*val_obj);
}
}
@ -98,7 +98,7 @@ SBValueList::Append (lldb::ValueObjectSP& val_obj_sp)
if (val_obj_sp)
{
CreateIfNeeded ();
m_lldb_object_ap->Append (val_obj_sp);
m_opaque_ap->Append (val_obj_sp);
}
}
@ -107,8 +107,8 @@ SBValue
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 @@ uint32_t
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 @@ SBValue
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;
}

View file

@ -18,13 +18,13 @@ using namespace lldb_private;
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 @@ void
StoppointCallbackContext::Clear()
{
event = NULL;
context.Clear();
exe_ctx.Clear();
is_synchronous = false;
}

View file

@ -33,13 +33,16 @@ CommandCompletions::g_common_completions[] =
};
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 @@ CommandCompletions::InvokeCommonCompletionCallbacks (uint32_t completion_mask,
&& 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 @@ CommandCompletions::InvokeCommonCompletionCallbacks (uint32_t completion_mask,
}
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 @@ CommandCompletions::SourceFiles (const char *partial_file_name,
}
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 @@ CommandCompletions::Modules (const char *partial_file_name,
}
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 @@ CommandCompletions::Symbols (const char *partial_file_name,
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 @@ CommandCompletions::Completer::~Completer ()
// 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 @@ regex_chars (const char comp)
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 @@ CommandCompletions::SymbolCompleter::DoCompletion (SearchFilter *filter)
//----------------------------------------------------------------------
// 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();

View file

@ -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();
}

View file

@ -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_

View file

@ -89,8 +89,12 @@ CommandObjectAlias::~CommandObjectAlias ()
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 @@ CommandObjectAlias::Execute (Args& args, CommandContext *context, CommandInterpr
// 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 @@ CommandObjectAlias::Execute (Args& args, CommandContext *context, CommandInterpr
}
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 @@ CommandObjectAlias::Execute (Args& args, CommandContext *context, CommandInterpr
// 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

View file

@ -32,9 +32,8 @@ public:
~CommandObjectAlias ();
virtual bool
Execute (Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
};

View file

@ -37,9 +37,8 @@ CommandObjectAppend::~CommandObjectAppend ()
bool
CommandObjectAppend::Execute
(
CommandInterpreter &interpreter,
Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
@ -64,7 +63,7 @@ CommandObjectAppend::Execute
}
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);

View file

@ -30,9 +30,8 @@ public:
~CommandObjectAppend ();
virtual bool
Execute (Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);

View file

@ -40,14 +40,18 @@ CommandObjectApropos::~CommandObjectApropos()
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 @@ CommandObjectApropos::Execute (Args &command, CommandContext *context, CommandIn
// 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 @@ CommandObjectApropos::Execute (Args &command, CommandContext *context, CommandIn
}
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);

View file

@ -32,9 +32,8 @@ public:
~CommandObjectApropos ();
virtual bool
Execute (Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);

View file

@ -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 @@ CommandObjectArgs::GetOptions ()
}
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 @@ CommandObjectArgs::Execute(Args &command,
return false;
}
int num_args = command.GetArgumentCount ();
int num_args = args.GetArgumentCount ();
int arg_index;
if (!num_args)
@ -128,7 +131,7 @@ CommandObjectArgs::Execute(Args &command,
return false;
}
Thread *thread = context->GetExecutionContext ().thread;
Thread *thread = interpreter.GetDebugger().GetExecutionContext ().thread;
if (!thread)
{
@ -167,7 +170,7 @@ CommandObjectArgs::Execute(Args &command,
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 @@ CommandObjectArgs::Execute(Args &command,
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");
}

View file

@ -58,9 +58,8 @@ namespace lldb_private {
virtual bool
Execute (Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
virtual bool

View file

@ -32,7 +32,7 @@ using namespace lldb;
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 @@ CommandObjectBreakpointSet::GetOptions ()
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 @@ CommandObjectBreakpointSet::Execute
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 @@ CommandObjectBreakpointSet::Execute
//-------------------------------------------------------------------------
#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 @@ CommandObjectMultiwordBreakpoint::CommandObjectMultiwordBreakpoint (CommandInter
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 @@ CommandObjectBreakpointList::GetOptions ()
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 @@ CommandObjectBreakpointList::Execute
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 @@ CommandObjectBreakpointList::Execute
{
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 @@ CommandObjectBreakpointEnable::~CommandObjectBreakpointEnable ()
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 @@ CommandObjectBreakpointDisable::~CommandObjectBreakpointDisable ()
}
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 @@ CommandObjectBreakpointDelete::~CommandObjectBreakpointDelete ()
}
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 @@ CommandObjectBreakpointModify::GetOptions ()
bool
CommandObjectBreakpointModify::Execute
(
CommandInterpreter &interpreter,
Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
@ -1176,7 +1185,7 @@ CommandObjectBreakpointModify::Execute
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.");

View file

@ -32,7 +32,7 @@ namespace lldb_private {
class CommandObjectMultiwordBreakpoint : public CommandObjectMultiword
{
public:
CommandObjectMultiwordBreakpoint (CommandInterpreter *interpreter);
CommandObjectMultiwordBreakpoint (CommandInterpreter &interpreter);
virtual
~CommandObjectMultiwordBreakpoint ();
@ -66,9 +66,8 @@ public:
~CommandObjectBreakpointSet ();
virtual bool
Execute (Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
virtual Options *
@ -133,9 +132,8 @@ public:
~CommandObjectBreakpointModify ();
virtual bool
Execute (Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
virtual Options *
@ -194,9 +192,8 @@ public:
~CommandObjectBreakpointEnable ();
virtual bool
Execute (Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
private:
@ -215,9 +212,8 @@ public:
~CommandObjectBreakpointDisable ();
virtual bool
Execute (Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
private:
@ -236,9 +232,8 @@ public:
~CommandObjectBreakpointList ();
virtual bool
Execute (Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
virtual Options *
@ -290,9 +285,8 @@ public:
~CommandObjectBreakpointDelete ();
virtual bool
Execute (Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
private:

View file

@ -208,13 +208,12 @@ CommandObjectBreakpointCommandAdd::~CommandObjectBreakpointCommandAdd ()
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 @@ CommandObjectBreakpointCommandAdd::Execute
{
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 @@ CommandObjectBreakpointCommandAdd::Execute
{
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 @@ const char *g_reader_instructions = "Enter your debugger command(s). Type 'DONE
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 @@ CommandObjectBreakpointCommandAdd::CollectDataForBreakpointCommandCallback
true)); // echo input
if (err.Success())
{
Debugger::GetSharedInstance().PushInputReader (reader_sp);
interpreter.GetDebugger().PushInputReader (reader_sp);
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else
@ -337,13 +337,13 @@ size_t
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 @@ CommandObjectBreakpointCommandAdd::GenerateBreakpointCommandCallback
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 @@ CommandObjectBreakpointCommandAdd::GenerateBreakpointCommandCallback
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 @@ CommandObjectBreakpointCommandAdd::GenerateBreakpointCommandCallback
((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 @@ CommandObjectBreakpointCommandRemove::~CommandObjectBreakpointCommandRemove ()
}
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 @@ CommandObjectBreakpointCommandList::~CommandObjectBreakpointCommandList ()
}
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 @@ CommandObjectBreakpointCommandList::Execute (Args& command,
// 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 @@ CommandObjectBreakpointCommand::CommandObjectBreakpointCommand (CommandInterpret
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 @@ CommandObjectBreakpointCommand::BreakpointOptionsCallbackFunction
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;
}

View file

@ -34,7 +34,7 @@ namespace lldb_private {
class CommandObjectBreakpointCommand : public CommandObjectMultiword
{
public:
CommandObjectBreakpointCommand (CommandInterpreter *interpreter);
CommandObjectBreakpointCommand (CommandInterpreter &interpreter);
virtual
~CommandObjectBreakpointCommand ();
@ -62,21 +62,21 @@ public:
~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 @@ public:
~CommandObjectBreakpointCommandRemove ();
virtual bool
Execute (Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
private:
@ -155,9 +154,8 @@ public:
~CommandObjectBreakpointCommandList ();
virtual bool
Execute (Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
private:

View file

@ -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 @@ CommandObjectCall::GetOptions ()
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 @@ CommandObjectCall::Execute
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 @@ CommandObjectCall::Execute
// 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.

View file

@ -66,9 +66,8 @@ public:
virtual bool
Execute (Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
virtual bool

View file

@ -40,9 +40,8 @@ CommandObjectCrossref::~CommandObjectCrossref ()
bool
CommandObjectCrossref::Execute
(
CommandInterpreter &interpreter,
Args& command,
CommandContext *context,
CommandInterpreter *interpreter,
CommandReturnObject &result
)
{

View file

@ -155,8 +155,7 @@ CommandObjectDisassemble::~CommandObjectDisassemble()
void
CommandObjectDisassemble::Disassemble
(
CommandContext *context,
CommandInterpreter *interpreter,
CommandInterpreter &interpreter,
CommandReturnObject &result,
Disassembler *disassembler,
const SymbolContextList &sc_list
@ -171,11 +170,11 @@ CommandObjectDisassemble::Disassemble
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 @@ CommandObjectDisassemble::Disassemble
void
CommandObjectDisassemble::Disassemble
(
CommandContext *context,
CommandInterpreter *interpreter,
CommandInterpreter &interpreter,
CommandReturnObject &result,
Disassembler *disassembler,
lldb::addr_t addr,
@ -198,7 +196,7 @@ CommandObjectDisassemble::Disassemble
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 @@ CommandObjectDisassemble::Disassemble
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 @@ CommandObjectDisassemble::Disassemble
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 @@ CommandObjectDisassemble::Disassemble
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 @@ CommandObjectDisassemble::Execute
}
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 @@ CommandObjectDisassemble::Execute
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 @@ CommandObjectDisassemble::Execute
}
else
{
Disassemble (context, interpreter, result, disassembler, addr, end_addr);
Disassemble (interpreter, result, disassembler, addr, end_addr);
}
return result.Succeeded();

Some files were not shown because too many files have changed in this diff Show more