Make sure the end of the first line is still within the function, and if not, don't push the prologue past it.

rdar://problem/11271074

llvm-svn: 155579
This commit is contained in:
Jim Ingham 2012-04-25 19:48:30 +00:00
parent 365f1ec246
commit e5b2245d68
1 changed files with 6 additions and 1 deletions

View File

@ -564,7 +564,12 @@ Function::GetPrologueByteSize ()
// 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)
// Watch out for the case where the end of the first line is at or past the end of the function, in that
// case, set the prologue byte size to 0. This happens, for instance, with a function that is one
// instruction long...
if (!GetAddressRange().ContainsFileAddress(line_entry_end_file_addr))
m_prologue_byte_size = 0;
else if (line_entry_end_file_addr > func_start_file_addr)
m_prologue_byte_size = line_entry_end_file_addr - func_start_file_addr;
}
}