forked from OSchip/llvm-project
Symbol prologue code checks if funciton lines up with symbol and uses function prologue code with line info if so.
Differential Revision: http://llvm-reviews.chandlerc.com/D1082 llvm-svn: 185553
This commit is contained in:
parent
8490bbd16b
commit
bf43d1ad26
|
@ -14,6 +14,7 @@
|
|||
#include "lldb/Core/Stream.h"
|
||||
#include "lldb/Symbol/ObjectFile.h"
|
||||
#include "lldb/Symbol/Symtab.h"
|
||||
#include "lldb/Symbol/Function.h"
|
||||
#include "lldb/Target/Process.h"
|
||||
#include "lldb/Target/Target.h"
|
||||
#include "lldb/Symbol/SymbolVendor.h"
|
||||
|
@ -287,11 +288,22 @@ Symbol::GetPrologueByteSize ()
|
|||
if (!m_type_data_resolved)
|
||||
{
|
||||
m_type_data_resolved = true;
|
||||
ModuleSP module_sp (m_addr_range.GetBaseAddress().GetModule());
|
||||
|
||||
const Address &base_address = m_addr_range.GetBaseAddress();
|
||||
Function *function = base_address.CalculateSymbolContextFunction();
|
||||
if (function)
|
||||
{
|
||||
// Functions have line entries which can also potentially have end of prologue information.
|
||||
// So if this symbol points to a function, use the prologue information from there.
|
||||
m_type_data = function->GetPrologueByteSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
ModuleSP module_sp (base_address.GetModule());
|
||||
SymbolContext sc;
|
||||
if (module_sp)
|
||||
{
|
||||
uint32_t resolved_flags = module_sp->ResolveSymbolContextForAddress (m_addr_range.GetBaseAddress(),
|
||||
uint32_t resolved_flags = module_sp->ResolveSymbolContextForAddress (base_address,
|
||||
eSymbolContextLineEntry,
|
||||
sc);
|
||||
if (resolved_flags & eSymbolContextLineEntry)
|
||||
|
@ -300,7 +312,7 @@ Symbol::GetPrologueByteSize ()
|
|||
m_type_data = sc.line_entry.range.GetByteSize();
|
||||
|
||||
// Set address for next line.
|
||||
Address addr (m_addr_range.GetBaseAddress());
|
||||
Address addr (base_address);
|
||||
addr.Slide (m_type_data);
|
||||
|
||||
// Check the first few instructions and look for one that has a line number that is
|
||||
|
@ -344,6 +356,7 @@ Symbol::GetPrologueByteSize ()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return m_type_data;
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue