diff options
author | Jim Ingham <jingham@apple.com> | 2011-09-08 22:13:49 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2011-09-08 22:13:49 +0000 |
commit | b7f6b2fa3c4a5162223850b28e63b5193159ae6d (patch) | |
tree | f51b13eb1e25bdab179c6b60e4caaf5b104b6136 /lldb/source/Commands/CommandObjectBreakpoint.cpp | |
parent | 7db8d697cf094ac586531d5500892e94a49ec537 (diff) | |
download | bcm5719-llvm-b7f6b2fa3c4a5162223850b28e63b5193159ae6d.tar.gz bcm5719-llvm-b7f6b2fa3c4a5162223850b28e63b5193159ae6d.zip |
Move the SourceManager from the Debugger to the Target. That way it can store the per-Target default Source File & Line.
Set the default Source File & line to main (if it can be found.) at startup. Selecting the current thread & or frame resets
the current source file & line, and "source list" as well as the breakpoint command "break set -l <NUM>" will use the
current source file.
llvm-svn: 139323
Diffstat (limited to 'lldb/source/Commands/CommandObjectBreakpoint.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectBreakpoint.cpp | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index 2e894edae11..20641acf117 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -321,32 +321,38 @@ CommandObjectBreakpointSet::Execute FileSpec file; if (m_options.m_filename.empty()) { - StackFrame *cur_frame = m_interpreter.GetExecutionContext().frame; - if (cur_frame == NULL) + uint32_t default_line; + // First use the Source Manager's default file. + // Then use the current stack frame's file. + if (!target->GetSourceManager().GetDefaultFileAndLine(file, default_line)) { - result.AppendError ("Attempting to set breakpoint by line number alone with no selected frame."); - result.SetStatus (eReturnStatusFailed); - break; - } - else if (!cur_frame->HasDebugInformation()) - { - result.AppendError ("Attempting to set breakpoint by line number alone but selected frame has no debug info."); - result.SetStatus (eReturnStatusFailed); - break; - } - else - { - const SymbolContext &sc = cur_frame->GetSymbolContext (eSymbolContextLineEntry); - if (sc.line_entry.file) + StackFrame *cur_frame = m_interpreter.GetExecutionContext().frame; + if (cur_frame == NULL) { - file = sc.line_entry.file; + result.AppendError ("Attempting to set breakpoint by line number alone with no selected frame."); + result.SetStatus (eReturnStatusFailed); + break; } - else + else if (!cur_frame->HasDebugInformation()) { - result.AppendError ("Attempting to set breakpoint by line number alone but can't find the file for the selected frame."); + result.AppendError ("Attempting to set breakpoint by line number alone but selected frame has no debug info."); result.SetStatus (eReturnStatusFailed); break; } + else + { + const SymbolContext &sc = cur_frame->GetSymbolContext (eSymbolContextLineEntry); + if (sc.line_entry.file) + { + file = sc.line_entry.file; + } + else + { + result.AppendError ("Attempting to set breakpoint by line number alone but can't find the file for the selected frame."); + result.SetStatus (eReturnStatusFailed); + break; + } + } } } else |