mirror of
https://github.com/intel/llvm.git
synced 2026-01-18 16:50:51 +08:00
Fixed an issue with Function::GetPrologueByteSize() where if a function's first line table entry didn't have the same address as the start address of the function itself, we could end up returning and incorrect value.
llvm-svn: 118830
This commit is contained in:
@@ -500,7 +500,16 @@ Function::GetPrologueByteSize ()
|
||||
{
|
||||
LineEntry line_entry;
|
||||
if (line_table->FindLineEntryByAddress(GetAddressRange().GetBaseAddress(), line_entry))
|
||||
m_prologue_byte_size = line_entry.range.GetByteSize();
|
||||
{
|
||||
// We need to take the delta of the end of the first line entry
|
||||
// as a file address and the start file address of the function
|
||||
// in case the first line entry doesn't start at the beginning
|
||||
// of the function.
|
||||
const addr_t func_start_file_addr = m_range.GetBaseAddress().GetFileAddress();
|
||||
const addr_t line_entry_end_file_addr = line_entry.range.GetBaseAddress().GetFileAddress() + line_entry.range.GetByteSize();
|
||||
if (line_entry_end_file_addr > func_start_file_addr)
|
||||
m_prologue_byte_size = line_entry_end_file_addr - func_start_file_addr;
|
||||
}
|
||||
}
|
||||
}
|
||||
return m_prologue_byte_size;
|
||||
|
||||
Reference in New Issue
Block a user