summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/API/SBAddress.cpp58
-rw-r--r--lldb/source/Core/Address.cpp111
-rw-r--r--lldb/source/Core/Module.cpp6
-rw-r--r--lldb/source/Core/ModuleList.cpp37
-rw-r--r--lldb/source/Core/ValueObject.cpp36
-rw-r--r--lldb/source/Expression/ClangFunction.cpp6
-rw-r--r--lldb/source/Symbol/Block.cpp72
-rw-r--r--lldb/source/Symbol/CompileUnit.cpp12
-rw-r--r--lldb/source/Symbol/Function.cpp25
-rw-r--r--lldb/source/Symbol/Symbol.cpp16
-rw-r--r--lldb/source/Target/Thread.cpp19
-rw-r--r--lldb/source/Target/ThreadPlanTracer.cpp87
12 files changed, 378 insertions, 107 deletions
diff --git a/lldb/source/API/SBAddress.cpp b/lldb/source/API/SBAddress.cpp
index 57b58bf6d0a..110ef2ddfb2 100644
--- a/lldb/source/API/SBAddress.cpp
+++ b/lldb/source/API/SBAddress.cpp
@@ -228,4 +228,62 @@ SBAddress::GetModule ()
return sb_module;
}
+SBSymbolContext
+SBAddress::GetSymbolContext (uint32_t resolve_scope)
+{
+ SBSymbolContext sb_sc;
+ if (m_opaque_ap.get())
+ m_opaque_ap->CalculateSymbolContext (&sb_sc.ref(), resolve_scope);
+ return sb_sc;
+}
+
+SBCompileUnit
+SBAddress::GetCompileUnit ()
+{
+ SBCompileUnit sb_comp_unit;
+ if (m_opaque_ap.get())
+ sb_comp_unit.reset(m_opaque_ap->CalculateSymbolContextCompileUnit());
+ return sb_comp_unit;
+}
+
+SBFunction
+SBAddress::GetFunction ()
+{
+ SBFunction sb_function;
+ if (m_opaque_ap.get())
+ sb_function.reset(m_opaque_ap->CalculateSymbolContextFunction());
+ return sb_function;
+}
+
+SBBlock
+SBAddress::GetBlock ()
+{
+ SBBlock sb_block;
+ if (m_opaque_ap.get())
+ sb_block.reset(m_opaque_ap->CalculateSymbolContextBlock());
+ return sb_block;
+}
+
+SBSymbol
+SBAddress::GetSymbol ()
+{
+ SBSymbol sb_symbol;
+ if (m_opaque_ap.get())
+ sb_symbol.reset(m_opaque_ap->CalculateSymbolContextSymbol());
+ return sb_symbol;
+}
+
+SBLineEntry
+SBAddress::GetLineEntry ()
+{
+ SBLineEntry sb_line_entry;
+ if (m_opaque_ap.get())
+ {
+ LineEntry line_entry;
+ if (m_opaque_ap->CalculateSymbolContextLineEntry (line_entry))
+ sb_line_entry.SetLineEntry (line_entry);
+ }
+ return sb_line_entry;
+}
+
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp
index 9d7af37493e..e90561c7b88 100644
--- a/lldb/source/Core/Address.cpp
+++ b/lldb/source/Core/Address.cpp
@@ -727,20 +727,115 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
return true;
}
-void
-Address::CalculateSymbolContext (SymbolContext *sc)
+uint32_t
+Address::CalculateSymbolContext (SymbolContext *sc, uint32_t resolve_scope)
{
sc->Clear();
// Absolute addresses don't have enough information to reconstruct even their target.
- if (m_section == NULL)
- return;
+ if (m_section)
+ {
+ Module *address_module = m_section->GetModule();
+ if (address_module)
+ {
+ sc->module_sp = address_module->GetSP();
+ if (sc->module_sp)
+ return sc->module_sp->ResolveSymbolContextForAddress (*this, resolve_scope, *sc);
+ }
+ }
+ return 0;
+}
+
+Module *
+Address::CalculateSymbolContextModule ()
+{
+ if (m_section)
+ return m_section->GetModule();
+ return NULL;
+}
- if (m_section->GetModule())
+CompileUnit *
+Address::CalculateSymbolContextCompileUnit ()
+{
+ if (m_section)
{
- sc->module_sp = m_section->GetModule()->GetSP();
- if (sc->module_sp)
- sc->module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextEverything, *sc);
+ SymbolContext sc;
+ sc.module_sp = m_section->GetModule()->GetSP();
+ if (sc.module_sp)
+ {
+ sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextCompUnit, sc);
+ return sc.comp_unit;
+ }
}
+ return NULL;
+}
+
+Function *
+Address::CalculateSymbolContextFunction ()
+{
+ if (m_section)
+ {
+ SymbolContext sc;
+ sc.module_sp = m_section->GetModule()->GetSP();
+ if (sc.module_sp)
+ {
+ sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextFunction, sc);
+ return sc.function;
+ }
+ }
+ return NULL;
+}
+
+Block *
+Address::CalculateSymbolContextBlock ()
+{
+ if (m_section)
+ {
+ SymbolContext sc;
+ sc.module_sp = m_section->GetModule()->GetSP();
+ if (sc.module_sp)
+ {
+ sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextBlock, sc);
+ return sc.block;
+ }
+ }
+ return NULL;
+}
+
+Symbol *
+Address::CalculateSymbolContextSymbol ()
+{
+ if (m_section)
+ {
+ SymbolContext sc;
+ sc.module_sp = m_section->GetModule()->GetSP();
+ if (sc.module_sp)
+ {
+ sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextSymbol, sc);
+ return sc.symbol;
+ }
+ }
+ return NULL;
+}
+
+bool
+Address::CalculateSymbolContextLineEntry (LineEntry &line_entry)
+{
+ if (m_section)
+ {
+ SymbolContext sc;
+ sc.module_sp = m_section->GetModule()->GetSP();
+ if (sc.module_sp)
+ {
+ sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextLineEntry, sc);
+ if (sc.line_entry.IsValid())
+ {
+ line_entry = sc.line_entry;
+ return true;
+ }
+ }
+ }
+ line_entry.Clear();
+ return false;
}
int
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 65f2fb7e628..4c997969ea4 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -214,6 +214,12 @@ Module::CalculateSymbolContext(SymbolContext* sc)
sc->module_sp = GetSP();
}
+Module *
+Module::CalculateSymbolContextModule ()
+{
+ return this;
+}
+
void
Module::DumpSymbolContext(Stream *s)
{
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index f83a23571f1..5cde91fa7d2 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -707,6 +707,33 @@ ModuleList::RemoveOrphanSharedModules ()
{
return GetSharedModuleList ().RemoveOrphans();
}
+//#define ENABLE_MODULE_SP_LOGGING
+#if defined (ENABLE_MODULE_SP_LOGGING)
+#include "lldb/Core/StreamFile.h"
+#include "lldb/Host/Host.h"
+static void
+ModuleSharedPtrLogger(void* p, const ModuleSP& sp, bool will_decrement)
+{
+ if (sp.get())
+ {
+ const char *module_basename = sp->GetFileSpec().GetFilename().GetCString();
+ // If "p" is set, then it is the basename of a module to watch for. This
+ // basename MUST be uniqued first by getting it from a ConstString or this
+ // won't work.
+ if (p && p != module_basename)
+ {
+ return;
+ }
+ long use_count = sp.use_count();
+ if (will_decrement)
+ --use_count;
+
+ printf("\nModuleSP(%p): %c %p {%lu} %s/%s\n", &sp, will_decrement ? '-' : '+', sp.get(), use_count, sp->GetFileSpec().GetDirectory().GetCString(), module_basename);
+ StreamFile stdout_strm(stdout, false);
+ Host::Backtrace (stdout_strm, 512);
+ }
+}
+#endif
Error
ModuleList::GetSharedModule
@@ -783,7 +810,12 @@ ModuleList::GetSharedModule
return error;
else
{
+#if defined ENABLE_MODULE_SP_LOGGING
+ ModuleSP logging_module_sp (new Module (in_file_spec, arch, object_name_ptr, object_offset), ModuleSharedPtrLogger, (void *)ConstString("a.out").GetCString());
+ module_sp = logging_module_sp;
+#else
module_sp.reset (new Module (in_file_spec, arch, object_name_ptr, object_offset));
+#endif
// Make sure there are a module and an object file since we can specify
// a valid file path with an architecture that might not be in that file.
// By getting the object file we can guarantee that the architecture matches
@@ -874,7 +906,12 @@ ModuleList::GetSharedModule
if (module_sp.get() == NULL)
{
+#if defined ENABLE_MODULE_SP_LOGGING
+ ModuleSP logging_module_sp (new Module (file_spec, arch, object_name_ptr, object_offset), ModuleSharedPtrLogger, 0);
+ module_sp = logging_module_sp;
+#else
module_sp.reset (new Module (file_spec, arch, object_name_ptr, object_offset));
+#endif
// Make sure there are a module and an object file since we can specify
// a valid file path with an architecture that might not be in that file.
// By getting the object file we can guarantee that the architecture matches
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 26b7a48cc4c..46feb995573 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -3260,31 +3260,35 @@ ValueObject::EvaluationPoint::GetExecutionContextScope ()
bool
ValueObject::EvaluationPoint::SyncWithProcessState()
{
- // If we're already invalid, we don't need to do anything, and nothing has changed:
- if (!m_mod_id.IsValid())
- {
- // Can't update with an invalid state.
- m_needs_update = false;
- return false;
- }
-
// If we don't have a process nothing can change.
if (!m_process_sp)
+ {
+ m_exe_scope = m_target_sp.get();
return false;
+ }
// If our stop id is the current stop ID, nothing has changed:
ProcessModID current_mod_id = m_process_sp->GetModID();
- if (m_mod_id == current_mod_id)
- return false;
-
// If the current stop id is 0, either we haven't run yet, or the process state has been cleared.
// In either case, we aren't going to be able to sync with the process state.
if (current_mod_id.GetStopID() == 0)
+ {
+ m_exe_scope = m_target_sp.get();
return false;
+ }
- m_mod_id = current_mod_id;
- m_needs_update = true;
+ if (m_mod_id.IsValid())
+ {
+ if (m_mod_id == current_mod_id)
+ {
+ // Everything is already up to date in this object, no need do
+ // update the execution context scope.
+ return false;
+ }
+ m_mod_id = current_mod_id;
+ m_needs_update = true;
+ }
m_exe_scope = m_process_sp.get();
// Something has changed, so we will return true. Now make sure the thread & frame still exist, and if either
@@ -3317,12 +3321,10 @@ ValueObject::EvaluationPoint::SyncWithProcessState()
void
ValueObject::EvaluationPoint::SetUpdated ()
{
+ // this will update the execution context scope and the m_mod_id
+ SyncWithProcessState();
m_first_update = false;
m_needs_update = false;
- if (m_process_sp)
- {
- m_mod_id = m_process_sp->GetModID();
- }
}
diff --git a/lldb/source/Expression/ClangFunction.cpp b/lldb/source/Expression/ClangFunction.cpp
index 21e2cd2e652..2e05e670d75 100644
--- a/lldb/source/Expression/ClangFunction.cpp
+++ b/lldb/source/Expression/ClangFunction.cpp
@@ -386,11 +386,9 @@ ClangFunction::GetThreadPlanToCallFunction (ExecutionContext &exe_ctx,
{
// FIXME: Use the errors Stream for better error reporting.
- Process *process = exe_ctx.process;
-
- if (process == NULL)
+ if (exe_ctx.thread == NULL)
{
- errors.Printf("Can't call a function without a process.");
+ errors.Printf("Can't call a function without a valid thread.");
return NULL;
}
diff --git a/lldb/source/Symbol/Block.cpp b/lldb/source/Symbol/Block.cpp
index 8be43e7825d..8cca445170d 100644
--- a/lldb/source/Symbol/Block.cpp
+++ b/lldb/source/Symbol/Block.cpp
@@ -152,6 +152,36 @@ Block::CalculateSymbolContext (SymbolContext* sc)
sc->block = this;
}
+Module *
+Block::CalculateSymbolContextModule ()
+{
+ if (m_parent_scope)
+ return m_parent_scope->CalculateSymbolContextModule ();
+ return NULL;
+}
+
+CompileUnit *
+Block::CalculateSymbolContextCompileUnit ()
+{
+ if (m_parent_scope)
+ return m_parent_scope->CalculateSymbolContextCompileUnit ();
+ return NULL;
+}
+
+Function *
+Block::CalculateSymbolContextFunction ()
+{
+ if (m_parent_scope)
+ return m_parent_scope->CalculateSymbolContextFunction ();
+ return NULL;
+}
+
+Block *
+Block::CalculateSymbolContextBlock ()
+{
+ return this;
+}
+
void
Block::DumpStopContext
(
@@ -225,12 +255,11 @@ Block::DumpStopContext
}
else if (child_inline_call_site)
{
- SymbolContext sc;
- CalculateSymbolContext(&sc);
- if (sc.function)
+ Function *function = CalculateSymbolContextFunction();
+ if (function)
{
s->EOL();
- s->Indent (sc.function->GetMangled().GetName().AsCString());
+ s->Indent (function->GetMangled().GetName().AsCString());
if (child_inline_call_site && child_inline_call_site->IsValid())
{
s->PutCString(" at ");
@@ -245,10 +274,9 @@ Block::DumpStopContext
void
Block::DumpSymbolContext(Stream *s)
{
- SymbolContext sc;
- CalculateSymbolContext(&sc);
- if (sc.function)
- sc.function->DumpSymbolContext(s);
+ Function *function = CalculateSymbolContextFunction();
+ if (function)
+ function->DumpSymbolContext(s);
s->Printf(", Block{0x%8.8x}", GetID());
}
@@ -297,12 +325,7 @@ Block *
Block::GetParent () const
{
if (m_parent_scope)
- {
- SymbolContext sc;
- m_parent_scope->CalculateSymbolContext(&sc);
- if (sc.block)
- return sc.block;
- }
+ return m_parent_scope->CalculateSymbolContextBlock();
return NULL;
}
@@ -346,11 +369,10 @@ Block::GetRangeContainingOffset (const addr_t offset, VMRange &range)
bool
Block::GetRangeContainingAddress (const Address& addr, AddressRange &range)
{
- SymbolContext sc;
- CalculateSymbolContext(&sc);
- if (sc.function)
+ Function *function = CalculateSymbolContextFunction();
+ if (function)
{
- const AddressRange &func_range = sc.function->GetAddressRange();
+ const AddressRange &func_range = function->GetAddressRange();
if (addr.GetSection() == func_range.GetBaseAddress().GetSection())
{
const addr_t addr_offset = addr.GetOffset();
@@ -379,11 +401,10 @@ Block::GetRangeAtIndex (uint32_t range_idx, AddressRange &range)
{
if (range_idx < m_ranges.size())
{
- SymbolContext sc;
- CalculateSymbolContext(&sc);
- if (sc.function)
+ Function *function = CalculateSymbolContextFunction();
+ if (function)
{
- range.GetBaseAddress() = sc.function->GetAddressRange().GetBaseAddress();
+ range.GetBaseAddress() = function->GetAddressRange().GetBaseAddress();
range.GetBaseAddress().Slide(m_ranges[range_idx].GetBaseAddress ());
range.SetByteSize (m_ranges[range_idx].GetByteSize());
return true;
@@ -398,11 +419,10 @@ Block::GetStartAddress (Address &addr)
if (m_ranges.empty())
return false;
- SymbolContext sc;
- CalculateSymbolContext(&sc);
- if (sc.function)
+ Function *function = CalculateSymbolContextFunction();
+ if (function)
{
- addr = sc.function->GetAddressRange().GetBaseAddress();
+ addr = function->GetAddressRange().GetBaseAddress();
addr.Slide(m_ranges.front().GetBaseAddress ());
return true;
}
diff --git a/lldb/source/Symbol/CompileUnit.cpp b/lldb/source/Symbol/CompileUnit.cpp
index ea49eb36225..8f51210bea8 100644
--- a/lldb/source/Symbol/CompileUnit.cpp
+++ b/lldb/source/Symbol/CompileUnit.cpp
@@ -57,6 +57,18 @@ CompileUnit::CalculateSymbolContext(SymbolContext* sc)
GetModule()->CalculateSymbolContext(sc);
}
+Module *
+CompileUnit::CalculateSymbolContextModule ()
+{
+ return GetModule();
+}
+
+CompileUnit *
+CompileUnit::CalculateSymbolContextCompileUnit ()
+{
+ return this;
+}
+
void
CompileUnit::DumpSymbolContext(Stream *s)
{
diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp
index 5328159fdb7..ca1499745b1 100644
--- a/lldb/source/Symbol/Function.cpp
+++ b/lldb/source/Symbol/Function.cpp
@@ -386,6 +386,31 @@ Function::CalculateSymbolContext(SymbolContext* sc)
m_comp_unit->CalculateSymbolContext(sc);
}
+Module *
+Function::CalculateSymbolContextModule ()
+{
+ return this->GetCompileUnit()->GetModule();
+}
+
+CompileUnit *
+Function::CalculateSymbolContextCompileUnit ()
+{
+ return this->GetCompileUnit();
+}
+
+Function *
+Function::CalculateSymbolContextFunction ()
+{
+ return this;
+}
+
+//Symbol *
+//Function::CalculateSymbolContextSymbol ()
+//{
+// return // TODO: find the symbol for the function???
+//}
+
+
void
Function::DumpSymbolContext(Stream *s)
{
diff --git a/lldb/source/Symbol/Symbol.cpp b/lldb/source/Symbol/Symbol.cpp
index 480405ec5cb..7b44d7736fb 100644
--- a/lldb/source/Symbol/Symbol.cpp
+++ b/lldb/source/Symbol/Symbol.cpp
@@ -366,6 +366,22 @@ Symbol::CalculateSymbolContext (SymbolContext *sc)
sc->module_sp.reset();
}
+Module *
+Symbol::CalculateSymbolContextModule ()
+{
+ const AddressRange *range = GetAddressRangePtr();
+ if (range)
+ return range->GetBaseAddress().GetModule ();
+ return NULL;
+}
+
+Symbol *
+Symbol::CalculateSymbolContextSymbol ()
+{
+ return this;
+}
+
+
void
Symbol::DumpSymbolContext (Stream *s)
{
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 5906d53e446..11d28acd78d 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -51,7 +51,8 @@ Thread::Thread (Process &process, lldb::tid_t tid) :
m_state_mutex (Mutex::eMutexTypeRecursive),
m_plan_stack (),
m_completed_plan_stack(),
- m_curr_frames_ap (),
+ m_curr_frames_sp (),
+ m_prev_frames_sp (),
m_resume_signal (LLDB_INVALID_SIGNAL_NUMBER),
m_resume_state (eStateRunning),
m_unwinder_ap (),
@@ -916,9 +917,9 @@ Thread::CalculateExecutionContext (ExecutionContext &exe_ctx)
StackFrameList &
Thread::GetStackFrameList ()
{
- if (m_curr_frames_ap.get() == NULL)
- m_curr_frames_ap.reset (new StackFrameList (*this, m_prev_frames_sp, true));
- return *m_curr_frames_ap;
+ if (!m_curr_frames_sp)
+ m_curr_frames_sp.reset (new StackFrameList (*this, m_prev_frames_sp, true));
+ return *m_curr_frames_sp;
}
@@ -933,13 +934,9 @@ Thread::GetStackFrameCount()
void
Thread::ClearStackFrames ()
{
- if (m_curr_frames_ap.get() && m_curr_frames_ap->GetNumFrames (false) > 1)
- m_prev_frames_sp.reset (m_curr_frames_ap.release());
- else
- m_curr_frames_ap.release();
-
-// StackFrameList::Merge (m_curr_frames_ap, m_prev_frames_sp);
-// assert (m_curr_frames_ap.get() == NULL);
+ if (m_curr_frames_sp && m_curr_frames_sp->GetNumFrames (false) > 1)
+ m_prev_frames_sp.swap (m_curr_frames_sp);
+ m_curr_frames_sp.reset();
}
lldb::StackFrameSP
diff --git a/lldb/source/Target/ThreadPlanTracer.cpp b/lldb/source/Target/ThreadPlanTracer.cpp
index 177fdab7d1e..1a3f0d4242d 100644
--- a/lldb/source/Target/ThreadPlanTracer.cpp
+++ b/lldb/source/Target/ThreadPlanTracer.cpp
@@ -91,45 +91,47 @@ ThreadPlanTracer::TracerExplainsStop ()
ThreadPlanAssemblyTracer::ThreadPlanAssemblyTracer (Thread &thread, lldb::StreamSP &stream_sp) :
ThreadPlanTracer (thread, stream_sp),
- m_process(thread.GetProcess()),
- m_target(thread.GetProcess().GetTarget())
+ m_disassembler_ap (),
+ m_intptr_type (),
+ m_register_values ()
{
- InitializeTracer ();
}
ThreadPlanAssemblyTracer::ThreadPlanAssemblyTracer (Thread &thread) :
ThreadPlanTracer (thread),
- m_process(thread.GetProcess()),
- m_target(thread.GetProcess().GetTarget())
+ m_disassembler_ap (),
+ m_intptr_type (),
+ m_register_values ()
{
- InitializeTracer ();
}
-void
-ThreadPlanAssemblyTracer::InitializeTracer()
+Disassembler *
+ThreadPlanAssemblyTracer::GetDisassembler ()
{
- Process &process = m_thread.GetProcess();
- Target &target = process.GetTarget();
-
- ArchSpec arch(target.GetArchitecture());
-
- m_disassembler = Disassembler::FindPlugin(arch, NULL);
-
- m_abi = process.GetABI().get();
-
- Module *exe_module = target.GetExecutableModulePointer();
-
- if (exe_module)
+ if (m_disassembler_ap.get() == NULL)
+ m_disassembler_ap.reset(Disassembler::FindPlugin(m_thread.GetProcess().GetTarget().GetArchitecture(), NULL));
+ return m_disassembler_ap.get();
+}
+
+TypeFromUser
+ThreadPlanAssemblyTracer::GetIntPointerType()
+{
+ if (!m_intptr_type.IsValid ())
{
- m_intptr_type = TypeFromUser(exe_module->GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, arch.GetAddressByteSize() * 8),
- exe_module->GetClangASTContext().getASTContext());
+ Target &target = m_thread.GetProcess().GetTarget();
+ Module *exe_module = target.GetExecutableModulePointer();
+
+ if (exe_module)
+ {
+ m_intptr_type = TypeFromUser(exe_module->GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, m_thread.GetProcess().GetAddressByteSize() * 8),
+ exe_module->GetClangASTContext().getASTContext());
+ }
}
-
- const unsigned int buf_size = 32;
-
- m_buffer_sp.reset(new DataBufferHeap(buf_size, 0));
+ return m_intptr_type;
}
+
+
ThreadPlanAssemblyTracer::~ThreadPlanAssemblyTracer()
{
}
@@ -171,33 +173,33 @@ ThreadPlanAssemblyTracer::Log ()
RegisterContext *reg_ctx = m_thread.GetRegisterContext().get();
lldb::addr_t pc = reg_ctx->GetPC();
+ Process &process = m_thread.GetProcess();
Address pc_addr;
bool addr_valid = false;
-
- addr_valid = m_process.GetTarget().GetSectionLoadList().ResolveLoadAddress (pc, pc_addr);
+ uint8_t buffer[16] = {0}; // Must be big enough for any single instruction
+ addr_valid = process.GetTarget().GetSectionLoadList().ResolveLoadAddress (pc, pc_addr);
pc_addr.Dump(stream, &m_thread, Address::DumpStyleResolvedDescription, Address::DumpStyleModuleWithFileAddress);
stream->PutCString (" ");
- if (m_disassembler)
+ Disassembler *disassembler = GetDisassembler();
+ if (disassembler)
{
- ::memset(m_buffer_sp->GetBytes(), 0, m_buffer_sp->GetByteSize());
-
Error err;
- m_process.ReadMemory(pc, m_buffer_sp->GetBytes(), m_buffer_sp->GetByteSize(), err);
+ process.ReadMemory(pc, buffer, sizeof(buffer), err);
if (err.Success())
{
- DataExtractor extractor(m_buffer_sp,
- m_process.GetByteOrder(),
- m_process.GetAddressByteSize());
+ DataExtractor extractor(buffer, sizeof(buffer),
+ process.GetByteOrder(),
+ process.GetAddressByteSize());
if (addr_valid)
- m_disassembler->DecodeInstructions (pc_addr, extractor, 0, 1, false);
+ disassembler->DecodeInstructions (pc_addr, extractor, 0, 1, false);
else
- m_disassembler->DecodeInstructions (Address (NULL, pc), extractor, 0, 1, false);
+ disassembler->DecodeInstructions (Address (NULL, pc), extractor, 0, 1, false);
- InstructionList &instruction_list = m_disassembler->GetInstructionList();
+ InstructionList &instruction_list = disassembler->GetInstructionList();
const uint32_t max_opcode_byte_size = instruction_list.GetMaxOpcocdeByteSize();
if (instruction_list.GetSize())
@@ -215,7 +217,10 @@ ThreadPlanAssemblyTracer::Log ()
}
}
- if (m_abi && m_intptr_type.GetOpaqueQualType())
+ const ABI *abi = process.GetABI().get();
+ TypeFromUser intptr_type = GetIntPointerType();
+
+ if (abi && intptr_type.IsValid())
{
ValueList value_list;
const int num_args = 1;
@@ -224,11 +229,11 @@ ThreadPlanAssemblyTracer::Log ()
{
Value value;
value.SetValueType (Value::eValueTypeScalar);
- value.SetContext (Value::eContextTypeClangType, m_intptr_type.GetOpaqueQualType());
+ value.SetContext (Value::eContextTypeClangType, intptr_type.GetOpaqueQualType());
value_list.PushValue (value);
}
- if (m_abi->GetArgumentValues (m_thread, value_list))
+ if (abi->GetArgumentValues (m_thread, value_list))
{
for (int arg_index = 0; arg_index < num_args; ++arg_index)
{
OpenPOWER on IntegriCloud