Centralized all disassembly into static functions in source/Core/Disassembler.cpp.

Added the ability to read memory from the target's object files when we aren't
running, so disassembling works before you run!

Cleaned up the API to lldb_private::Target::ReadMemory().

Cleaned up the API to the Disassembler to use actual "lldb_private::Address"
objects instead of just an "addr_t". This is nice because the Address objects
when resolved carry along their section and module which can get us the 
object file. This allows Target::ReadMemory to be used when we are not 
running.

Added a new lldb_private::Address dump style: DumpStyleDetailedSymbolContext
This will show a full breakdown of what an address points to. To see some
sample output, execute a "image lookup --address <addr>".

Fixed SymbolContext::DumpStopContext(...) to not require a live process in
order to be able to print function and symbol offsets.





git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@107350 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp b/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
index 0abfd93..340d906 100644
--- a/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
+++ b/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
@@ -100,19 +100,27 @@
 DisassemblerLLVM::Instruction::Dump
 (
     Stream *s,
-    lldb::addr_t base_address,
-    DataExtractor *bytes,
+    lldb_private::Address *inst_addr_ptr,
+    const DataExtractor *bytes,
     uint32_t bytes_offset,
-    const lldb_private::ExecutionContext exe_ctx,
+    const lldb_private::ExecutionContext& exe_ctx,
     bool raw
 )
 {
     const size_t opcodeColumnWidth = 7;
     const size_t operandColumnWidth = 25;
 
+    ExecutionContextScope *exe_scope = exe_ctx.GetBestExecutionContextScope();
     // If we have an address, print it out
-    if (base_address != LLDB_INVALID_ADDRESS)
-        s->Printf("0x%llx:  ", base_address);
+    if (inst_addr_ptr)
+    {
+        if (inst_addr_ptr->Dump (s, 
+                                 exe_scope, 
+                                 Address::DumpStyleLoadAddress, 
+                                 Address::DumpStyleModuleWithFileAddress,
+                                 0))
+            s->PutCString(":  ");
+    }
 
     // If we are supposed to show bytes, "bytes" will be non-NULL.
     if (bytes)
@@ -131,9 +139,15 @@
 
     int currentOpIndex = -1;
 
-    RegisterReaderArg rra(base_address + EDInstByteSize(m_inst), m_disassembler);
-
     lldb_private::Process *process = exe_ctx.process;
+    addr_t base_addr = LLDB_INVALID_ADDRESS;
+    if (process && process->IsAlive())
+        base_addr = inst_addr_ptr->GetLoadAddress (process);
+    if (base_addr == LLDB_INVALID_ADDRESS)
+        base_addr = inst_addr_ptr->GetFileAddress ();
+
+    RegisterReaderArg rra(base_addr + EDInstByteSize(m_inst), m_disassembler);
+
 
     bool printTokenized = false;
 
@@ -228,13 +242,21 @@
                                         }
 
                                         lldb_private::Address so_addr;
-                                        if (process)
+                                        if (process && process->IsAlive())
                                         {
-                                            if (process->ResolveLoadAddress(operand_value, so_addr))
+                                            if (process->ResolveLoadAddress (operand_value, so_addr))
+                                                so_addr.Dump(&comment, exe_scope, Address::DumpStyleResolvedDescription, Address::DumpStyleSectionNameOffset);
+                                        }
+                                        else if (inst_addr_ptr)
+                                        {
+                                            Module *module = inst_addr_ptr->GetModule();
+                                            if (module)
                                             {
-                                                so_addr.Dump(&comment, process, Address::DumpStyleResolvedDescription, Address::DumpStyleSectionNameOffset);
+                                                if (module->ResolveFileAddress (operand_value, so_addr))
+                                                    so_addr.Dump(&comment, exe_scope, Address::DumpStyleResolvedDescription, Address::DumpStyleSectionNameOffset);
                                             }
                                         }
+
                                     } // EDEvaluateOperand
                                 } // EDOperandIsMemory
                             } // EDGetOperand
@@ -364,12 +386,11 @@
 }
 
 size_t
-DisassemblerLLVM::ParseInstructions
+DisassemblerLLVM::DecodeInstructions
 (
     const DataExtractor& data,
     uint32_t data_offset,
-    uint32_t num_instructions,
-    lldb::addr_t base_addr
+    uint32_t num_instructions
 )
 {
     size_t total_inst_byte_size = 0;