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/Core/Stream.h"
|
||||||
#include "lldb/Symbol/ObjectFile.h"
|
#include "lldb/Symbol/ObjectFile.h"
|
||||||
#include "lldb/Symbol/Symtab.h"
|
#include "lldb/Symbol/Symtab.h"
|
||||||
|
#include "lldb/Symbol/Function.h"
|
||||||
#include "lldb/Target/Process.h"
|
#include "lldb/Target/Process.h"
|
||||||
#include "lldb/Target/Target.h"
|
#include "lldb/Target/Target.h"
|
||||||
#include "lldb/Symbol/SymbolVendor.h"
|
#include "lldb/Symbol/SymbolVendor.h"
|
||||||
|
@ -287,11 +288,22 @@ Symbol::GetPrologueByteSize ()
|
||||||
if (!m_type_data_resolved)
|
if (!m_type_data_resolved)
|
||||||
{
|
{
|
||||||
m_type_data_resolved = true;
|
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;
|
SymbolContext sc;
|
||||||
if (module_sp)
|
if (module_sp)
|
||||||
{
|
{
|
||||||
uint32_t resolved_flags = module_sp->ResolveSymbolContextForAddress (m_addr_range.GetBaseAddress(),
|
uint32_t resolved_flags = module_sp->ResolveSymbolContextForAddress (base_address,
|
||||||
eSymbolContextLineEntry,
|
eSymbolContextLineEntry,
|
||||||
sc);
|
sc);
|
||||||
if (resolved_flags & eSymbolContextLineEntry)
|
if (resolved_flags & eSymbolContextLineEntry)
|
||||||
|
@ -300,7 +312,7 @@ Symbol::GetPrologueByteSize ()
|
||||||
m_type_data = sc.line_entry.range.GetByteSize();
|
m_type_data = sc.line_entry.range.GetByteSize();
|
||||||
|
|
||||||
// Set address for next line.
|
// Set address for next line.
|
||||||
Address addr (m_addr_range.GetBaseAddress());
|
Address addr (base_address);
|
||||||
addr.Slide (m_type_data);
|
addr.Slide (m_type_data);
|
||||||
|
|
||||||
// Check the first few instructions and look for one that has a line number that is
|
// 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 m_type_data;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue