[lldb-dev] disassemble w/ source

Michael Sartain mikesart at gmail.com
Fri Jul 5 16:22:35 PDT 2013


On Fri, Jul 5, 2013 at 3:54 PM, Michael Sartain <mikesart at gmail.com> wrote:

> When I explicitly run the "disassemble -m -n printf" command I don't get
> source even though we've obviously got source and I'm stepping through it.
> Example is way down below.
>

This patch fixes the issue and I believe is similar to what
DisplaySourceLinesWithLineNumbers() in SBSourceManager.cpp does.

Please let me know if this is ok to check in (or not...) Thanks.
 -Mike

mikesart at mikesart-rad:~/data/src/llvm.svn/llvm/tools/lldb$ svn diff
source/Core/Disassembler.cpp
Index: source/Core/Disassembler.cpp
===================================================================
--- source/Core/Disassembler.cpp        (revision 185589)
+++ source/Core/Disassembler.cpp        (working copy)
@@ -402,6 +402,9 @@
     ExecutionContextScope *exe_scope =
exe_ctx.GetBestExecutionContextScope();
     StackFrame *frame = exe_ctx.GetFramePtr();

+    TargetSP target_sp (exe_ctx.GetTargetSP());
+    SourceManager &source_manager = target_sp ?
target_sp->GetSourceManager() : debugger.GetSourceManager();
+
     if (frame)
         pc_addr_ptr = &frame->GetFrameCodeAddress();
     const uint32_t scope = eSymbolContextLineEntry |
eSymbolContextFunction | eSymbolContextSymbol;
@@ -438,12 +441,12 @@

                                 if (sc.comp_unit &&
sc.line_entry.IsValid())
                                 {
-
 debugger.GetSourceManager().DisplaySourceLinesWithLineNumbers
(sc.line_entry.file,
-
                        sc.line_entry.line,
-
                        num_mixed_context_lines,
-
                        num_mixed_context_lines,
-
                        ((inst_is_at_pc && (options &
eOptionMarkPCSourceLine)) ? "->" : ""),
-
                        &strm);
+
 source_manager.DisplaySourceLinesWithLineNumbers (sc.line_entry.file,
+
           sc.line_entry.line,
+
           num_mixed_context_lines,
+
           num_mixed_context_lines,
+
           ((inst_is_at_pc && (options & eOptionMarkPCSourceLine)) ? "->" :
""),
+
           &strm);
                                 }
                             }
                         }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20130705/09348744/attachment.html>


More information about the lldb-dev mailing list