summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectSourceFile.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-06-23 01:19:29 +0000
committerGreg Clayton <gclayton@apple.com>2010-06-23 01:19:29 +0000
commit6611103cfe7a8c08554816fc08abef2e2960e799 (patch)
treeb940bb129b59af3cf6923f8d69f095d2d9fc8dca /lldb/source/Commands/CommandObjectSourceFile.cpp
parentef5a4383ad679e58743c540c25d6a1bab0c77423 (diff)
downloadbcm5719-llvm-6611103cfe7a8c08554816fc08abef2e2960e799.tar.gz
bcm5719-llvm-6611103cfe7a8c08554816fc08abef2e2960e799.zip
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
Diffstat (limited to 'lldb/source/Commands/CommandObjectSourceFile.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectSourceFile.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/lldb/source/Commands/CommandObjectSourceFile.cpp b/lldb/source/Commands/CommandObjectSourceFile.cpp
index 6e6082c81c2..cfb53e0ad34 100644
--- a/lldb/source/Commands/CommandObjectSourceFile.cpp
+++ b/lldb/source/Commands/CommandObjectSourceFile.cpp
@@ -14,7 +14,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/Args.h"
-#include "lldb/Interpreter/CommandContext.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Target/Process.h"
@@ -119,9 +119,8 @@ CommandObjectSourceFile::GetOptions ()
bool
CommandObjectSourceFile::Execute
(
+ CommandInterpreter &interpreter,
Args& args,
- CommandContext *context,
- CommandInterpreter *interpreter,
CommandReturnObject &result
)
{
@@ -133,7 +132,7 @@ CommandObjectSourceFile::Execute
result.SetStatus (eReturnStatusFailed);
}
- ExecutionContext exe_ctx(context->GetExecutionContext());
+ ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
if (m_options.file_name.empty())
{
// Last valid source manager context, or the current frame if no
@@ -142,14 +141,14 @@ CommandObjectSourceFile::Execute
// more likely because you typed it once, then typed it again
if (m_options.start_line == 0)
{
- if (interpreter->GetSourceManager().DisplayMoreWithLineNumbers (&result.GetOutputStream()))
+ if (interpreter.GetDebugger().GetSourceManager().DisplayMoreWithLineNumbers (&result.GetOutputStream()))
{
result.SetStatus (eReturnStatusSuccessFinishResult);
}
}
else
{
- if (interpreter->GetSourceManager().DisplaySourceLinesWithLineNumbersUsingLastFile(
+ if (interpreter.GetDebugger().GetSourceManager().DisplaySourceLinesWithLineNumbersUsingLastFile(
m_options.start_line, // Line to display
0, // Lines before line to display
m_options.num_lines, // Lines after line to display
@@ -164,7 +163,7 @@ CommandObjectSourceFile::Execute
else
{
const char *filename = m_options.file_name.c_str();
- Target *target = context->GetTarget();
+ Target *target = interpreter.GetDebugger().GetCurrentTarget().get();
if (target == NULL)
{
result.AppendError ("invalid target, set executable file using 'file' command");
@@ -187,13 +186,13 @@ CommandObjectSourceFile::Execute
{
if (sc.comp_unit)
{
- interpreter->GetSourceManager ().DisplaySourceLinesWithLineNumbers (sc.comp_unit,
- m_options.start_line, // Line to display
- 0, // Lines before line to display
- m_options.num_lines, // Lines after line to display
- "", // Don't mark "line"
- &result.GetOutputStream());
-
+ interpreter.GetDebugger().GetSourceManager ().DisplaySourceLinesWithLineNumbers (sc.comp_unit,
+ m_options.start_line, // Line to display
+ 0, // Lines before line to display
+ m_options.num_lines, // Lines after line to display
+ "", // Don't mark "line"
+ &result.GetOutputStream());
+
result.SetStatus (eReturnStatusSuccessFinishResult);
}
OpenPOWER on IntegriCloud