elf-core: Add helper function for parsing FreeBSD NT_PRSTATUS

This avoids the use of the ELFPrStatus class, which returns to being
used only for Linux.

llvm-svn: 186976
This commit is contained in:
Ed Maste 2013-07-23 18:37:11 +00:00
parent c05ae522a7
commit 262b8dd7da
1 changed files with 15 additions and 5 deletions

View File

@ -435,6 +435,20 @@ struct ELFNote
} }
}; };
static void
ParseFreeBSDPrStatus(ThreadData *thread_data, DataExtractor &data,
ArchSpec &arch)
{
lldb::offset_t offset;
size_t len;
offset = 36;
thread_data->signo = data.GetU32(&offset);
offset = 48;
len = data.GetByteSize() - offset;
thread_data->gpregset = DataExtractor(data, offset, len);
}
static void static void
ParseFreeBSDThrMisc(ThreadData *thread_data, DataExtractor &data) ParseFreeBSDThrMisc(ThreadData *thread_data, DataExtractor &data)
{ {
@ -507,11 +521,7 @@ ProcessElfCore::ParseThreadContextsFromNoteSegment(const elf::ELFProgramHeader *
{ {
case NT_FREEBSD_PRSTATUS: case NT_FREEBSD_PRSTATUS:
have_prstatus = true; have_prstatus = true;
prstatus.Parse(note_data, arch); ParseFreeBSDPrStatus(thread_data, note_data, arch);
thread_data->signo = prstatus.pr_cursig;
header_size = ELFPrStatus::GetSize(arch);
len = note_data.GetByteSize() - header_size;
thread_data->gpregset = DataExtractor(note_data, header_size, len);
break; break;
case NT_FREEBSD_FPREGSET: case NT_FREEBSD_FPREGSET:
thread_data->fpregset = note_data; thread_data->fpregset = note_data;