[Lldb-commits] [lldb] r134019 - in /lldb/trunk: include/lldb/Core/Disassembler.h source/Commands/CommandObjectDisassemble.cpp source/Core/Disassembler.cpp

Greg Clayton gclayton at apple.com
Tue Jun 28 12:01:40 PDT 2011


Author: gclayton
Date: Tue Jun 28 14:01:40 2011
New Revision: 134019

URL: http://llvm.org/viewvc/llvm-project?rev=134019&view=rev
Log:
Remove the disassembly option: "eOptionShowCurrentLine" and replaced it with
two:

eOptionMarkPCSourceLine = (1u << 2), // Mark the source line that contains the current PC (mixed mode only)
eOptionMarkPCAddress    = (1u << 3)  // Mark the disassembly line the contains the PC

This allows mixed mode to show the line that contains the current PC, and it
allows us to mark the PC address in the disassembly if desired. Having these
be separate gives more control on the disassembly output. SBFrame::Disassemble()
doesn't enable any of these options.


Modified:
    lldb/trunk/include/lldb/Core/Disassembler.h
    lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
    lldb/trunk/source/Core/Disassembler.cpp

Modified: lldb/trunk/include/lldb/Core/Disassembler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Disassembler.h?rev=134019&r1=134018&r2=134019&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Disassembler.h (original)
+++ lldb/trunk/include/lldb/Core/Disassembler.h Tue Jun 28 14:01:40 2011
@@ -189,7 +189,8 @@
         eOptionNone             = 0u,
         eOptionShowBytes        = (1u << 0),
         eOptionRawOuput         = (1u << 1),
-        eOptionShowCurrentLine  = (1u << 2)
+        eOptionMarkPCSourceLine = (1u << 2), // Mark the source line that contains the current PC (mixed mode only)
+        eOptionMarkPCAddress    = (1u << 3)  // Mark the disassembly line the contains the PC
     };
 
     static Disassembler*

Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=134019&r1=134018&r2=134019&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Tue Jun 28 14:01:40 2011
@@ -258,10 +258,12 @@
         m_options.num_lines_context = 1;
 
     ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
-    uint32_t options = 0;
+    // Always show the PC in the disassembly
+    uint32_t options = Disassembler::eOptionMarkPCAddress;
 
-    if (!m_options.show_mixed)
-        options |= Disassembler::eOptionShowCurrentLine;
+    // Mark the source line for the current PC only if we are doing mixed source and assembly
+    if (m_options.show_mixed)
+        options |= Disassembler::eOptionMarkPCSourceLine;
 
     if (m_options.show_bytes)
         options |= Disassembler::eOptionShowBytes;

Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=134019&r1=134018&r2=134019&view=diff
==============================================================================
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Tue Jun 28 14:01:40 2011
@@ -337,7 +337,6 @@
         pc_addr_ptr = &exe_ctx.frame->GetFrameCodeAddress();
     const uint32_t scope = eSymbolContextLineEntry | eSymbolContextFunction | eSymbolContextSymbol;
     const bool use_inline_block_range = false;
-
     for (size_t i=0; i<num_instructions_found; ++i)
     {
         Instruction *inst = disasm_ptr->GetInstructionList().GetInstructionAtIndex (i).get();
@@ -375,7 +374,7 @@
                                                                                                    sc.line_entry.line,
                                                                                                    num_mixed_context_lines,
                                                                                                    num_mixed_context_lines,
-                                                                                                   ((options & eOptionShowCurrentLine) ? "->" : ""),
+                                                                                                   ((inst_is_at_pc && (options & eOptionMarkPCSourceLine)) ? "->" : ""),
                                                                                                    &strm);
                                 }
                             }
@@ -405,12 +404,9 @@
                 }
             }
 
-            if (pc_addr_ptr)
+            if ((options & eOptionMarkPCAddress) && pc_addr_ptr)
             {
-                if (inst_is_at_pc)
-                    strm.PutCString("-> ");
-                else
-                    strm.PutCString("   ");
+                strm.PutCString(inst_is_at_pc ? "-> " : "   ");
             }
             const bool show_bytes = (options & eOptionShowBytes) != 0;
             const bool raw = (options & eOptionRawOuput) != 0;





More information about the lldb-commits mailing list