summaryrefslogtreecommitdiffstats
path: root/lldb/source/API
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/API')
-rw-r--r--lldb/source/API/SBInstruction.cpp17
-rw-r--r--lldb/source/API/SBInstructionList.cpp16
2 files changed, 30 insertions, 3 deletions
diff --git a/lldb/source/API/SBInstruction.cpp b/lldb/source/API/SBInstruction.cpp
index 2334cc0d124..eccc4e29aad 100644
--- a/lldb/source/API/SBInstruction.cpp
+++ b/lldb/source/API/SBInstruction.cpp
@@ -20,6 +20,7 @@
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/EmulateInstruction.h"
+#include "lldb/Core/Module.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/StackFrame.h"
@@ -170,9 +171,15 @@ SBInstruction::GetDescription (lldb::SBStream &s)
{
if (m_opaque_sp)
{
+ SymbolContext sc;
+ const Address &addr = m_opaque_sp->GetAddress();
+ ModuleSP module_sp (addr.GetModule());
+ if (module_sp)
+ module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
// Use the "ref()" instead of the "get()" accessor in case the SBStream
// didn't have a stream already created, one will get created...
- m_opaque_sp->Dump (&s.ref(), 0, true, false, NULL);
+ const char *disassemble_format = "${addr-file-or-load}: ";
+ m_opaque_sp->Dump (&s.ref(), 0, true, false, NULL, &sc, NULL, disassemble_format);
return true;
}
return false;
@@ -186,8 +193,14 @@ SBInstruction::Print (FILE *out)
if (m_opaque_sp)
{
+ SymbolContext sc;
+ const Address &addr = m_opaque_sp->GetAddress();
+ ModuleSP module_sp (addr.GetModule());
+ if (module_sp)
+ module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
StreamFile out_stream (out, false);
- m_opaque_sp->Dump (&out_stream, 0, true, false, NULL);
+ const char *disassemble_format = "${addr-file-or-load}: ";
+ m_opaque_sp->Dump (&out_stream, 0, true, false, NULL, &sc, NULL, disassemble_format);
}
}
diff --git a/lldb/source/API/SBInstructionList.cpp b/lldb/source/API/SBInstructionList.cpp
index fe22d9c29e4..31585b3e686 100644
--- a/lldb/source/API/SBInstructionList.cpp
+++ b/lldb/source/API/SBInstructionList.cpp
@@ -11,7 +11,9 @@
#include "lldb/API/SBInstruction.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/Disassembler.h"
+#include "lldb/Core/Module.h"
#include "lldb/Core/Stream.h"
+#include "lldb/Symbol/SymbolContext.h"
using namespace lldb;
using namespace lldb_private;
@@ -100,12 +102,24 @@ SBInstructionList::GetDescription (lldb::SBStream &description)
// exist already inside description...
Stream &sref = description.ref();
const uint32_t max_opcode_byte_size = m_opaque_sp->GetInstructionList().GetMaxOpcocdeByteSize();
+ const char *disassemble_format = "${addr-file-or-load}: ";
+ SymbolContext sc;
+ SymbolContext prev_sc;
for (size_t i=0; i<num_instructions; ++i)
{
Instruction *inst = m_opaque_sp->GetInstructionList().GetInstructionAtIndex (i).get();
if (inst == NULL)
break;
- inst->Dump (&sref, max_opcode_byte_size, true, false, NULL);
+
+ const Address &addr = inst->GetAddress();
+ prev_sc = sc;
+ ModuleSP module_sp (addr.GetModule());
+ if (module_sp)
+ {
+ module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
+ }
+
+ inst->Dump (&sref, max_opcode_byte_size, true, false, NULL, &sc, &prev_sc, disassemble_format);
sref.EOL();
}
return true;
OpenPOWER on IntegriCloud