Use existing llvm::RoundUpToAlignment in ELF note parsing
llvm-svn: 192486
This commit is contained in:
parent
b5637b62f2
commit
52b6e8dac0
|
@ -363,13 +363,6 @@ enum {
|
|||
NT_FREEBSD_PROCSTAT_AUXV = 16
|
||||
};
|
||||
|
||||
/// Align the given value to next boundary specified by the alignment bytes
|
||||
static uint32_t
|
||||
AlignToNext(uint32_t value, int alignment_bytes)
|
||||
{
|
||||
return (value + alignment_bytes - 1) & ~(alignment_bytes - 1);
|
||||
}
|
||||
|
||||
/// Note Structure found in ELF core dumps.
|
||||
/// This is PT_NOTE type program/segments in the core file.
|
||||
struct ELFNote
|
||||
|
@ -421,7 +414,7 @@ struct ELFNote
|
|||
}
|
||||
}
|
||||
|
||||
const char *cstr = data.GetCStr(offset, AlignToNext(n_namesz, 4));
|
||||
const char *cstr = data.GetCStr(offset, llvm::RoundUpToAlignment(n_namesz, 4));
|
||||
if (cstr == NULL)
|
||||
{
|
||||
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));
|
||||
|
@ -526,7 +519,7 @@ ProcessElfCore::ParseThreadContextsFromNoteSegment(const elf::ELFProgramHeader *
|
|||
|
||||
size_t note_start, note_size;
|
||||
note_start = offset;
|
||||
note_size = AlignToNext(note.n_descsz, 4);
|
||||
note_size = llvm::RoundUpToAlignment(note.n_descsz, 4);
|
||||
|
||||
// Store the NOTE information in the current thread
|
||||
DataExtractor note_data (segment_data, note_start, note_size);
|
||||
|
|
Loading…
Reference in New Issue