Added a way to open the current source file & line in an external editor, and you can turn this on with:
lldb -e
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@112502 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectFrame.cpp b/source/Commands/CommandObjectFrame.cpp
index 316b0f7..cd9ee08 100644
--- a/source/Commands/CommandObjectFrame.cpp
+++ b/source/Commands/CommandObjectFrame.cpp
@@ -114,12 +114,19 @@
if (exe_ctx.frame)
{
+ bool already_shown = false;
+ SymbolContext frame_sc(exe_ctx.frame->GetSymbolContext(eSymbolContextLineEntry));
+ if (interpreter.GetDebugger().UseExternalEditor() && frame_sc.line_entry.file && frame_sc.line_entry.line != 0)
+ {
+ already_shown = Host::OpenFileInExternalEditor (frame_sc.line_entry.file, frame_sc.line_entry.line);
+ }
+
if (DisplayFrameForExecutionContext (exe_ctx.thread,
exe_ctx.frame,
interpreter,
result.GetOutputStream(),
true,
- true,
+ !already_shown,
3,
3))
{
diff --git a/source/Commands/CommandObjectThread.cpp b/source/Commands/CommandObjectThread.cpp
index 1ed9794..8d1737b 100644
--- a/source/Commands/CommandObjectThread.cpp
+++ b/source/Commands/CommandObjectThread.cpp
@@ -60,13 +60,21 @@
// Show one frame with only the first showing source
if (show_source)
{
+ bool already_shown = false;
+ StackFrameSP frame_sp = thread->GetStackFrameAtIndex(0);
+ SymbolContext frame_sc(frame_sp->GetSymbolContext (eSymbolContextLineEntry));
+ if (interpreter.GetDebugger().UseExternalEditor() && frame_sc.line_entry.file && frame_sc.line_entry.line != 0)
+ {
+ already_shown = Host::OpenFileInExternalEditor (frame_sc.line_entry.file, frame_sc.line_entry.line);
+ }
+
DisplayFramesForExecutionContext (thread,
interpreter,
strm,
0, // Start at first frame
1, // Number of frames to show
false,// Don't show the frame info since we already displayed most of it above...
- 1, // Show source for the first frame
+ !already_shown, // Show source for the first frame
3, // lines of source context before
3); // lines of source context after
}