forked from OSchip/llvm-project
elf-core: Support FreeBSD at compile-time
Compile-time #ifdef-ery isn't right, but this makes core debugging work on FreeBSD and highlights the parts that will need to be changed for runtime arch support. llvm-svn: 186534
This commit is contained in:
parent
03f9fbbcd7
commit
deb0506790
|
@ -212,7 +212,11 @@ ProcessElfCore::DoLoadCore ()
|
|||
arch.SetTriple ("i386", m_target.GetPlatform().get());
|
||||
break;
|
||||
case ArchSpec::eCore_x86_64_x86_64:
|
||||
#ifdef __FreeBSD__
|
||||
arch.SetTriple ("x86_64-freebsd-unknown", m_target.GetPlatform().get());
|
||||
#else
|
||||
arch.SetTriple ("x86_64-linux-gnu", m_target.GetPlatform().get());
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
assert(false && "Unhandled core type");
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "ThreadElfCore.h"
|
||||
#include "ProcessElfCore.h"
|
||||
#include "RegisterContextCoreFreeBSD_x86_64.h"
|
||||
#include "RegisterContextCoreLinux_x86_64.h"
|
||||
|
||||
using namespace lldb;
|
||||
|
@ -94,7 +95,11 @@ ThreadElfCore::CreateRegisterContextForFrame (StackFrame *frame)
|
|||
switch (arch.GetMachine())
|
||||
{
|
||||
case llvm::Triple::x86_64:
|
||||
#ifdef __FreeBSD__
|
||||
m_thread_reg_ctx_sp.reset(new RegisterContextCoreFreeBSD_x86_64 (*this, gpregset_data, m_fpregset_data));
|
||||
#else
|
||||
m_thread_reg_ctx_sp.reset(new RegisterContextCoreLinux_x86_64 (*this, gpregset_data, m_fpregset_data));
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
if (log)
|
||||
|
|
|
@ -26,11 +26,25 @@ struct compat_timeval
|
|||
// simply reading data from the buffer.
|
||||
// The following macros are used to specify the size.
|
||||
// Calculating size using sizeof() wont work because of padding.
|
||||
#ifdef __FreeBSD__
|
||||
#define ELFPRSTATUS64_SIZE (48)
|
||||
#define ELFPRPSINFO64_SIZE (120)
|
||||
#else
|
||||
#define ELFPRSTATUS64_SIZE (112)
|
||||
#define ELFPRPSINFO64_SIZE (132)
|
||||
#endif
|
||||
|
||||
struct ELFPrStatus
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
int32_t pr_version;
|
||||
uint64_t pr_statussz;
|
||||
uint64_t pr_gregsetsz;
|
||||
uint64_t pr_fpregsetsz;
|
||||
int32_t pr_osreldate;
|
||||
int32_t pr_cursig;
|
||||
uint32_t pr_pid;
|
||||
#else
|
||||
int32_t si_signo;
|
||||
int32_t si_code;
|
||||
int32_t si_errno;
|
||||
|
@ -49,6 +63,7 @@ struct ELFPrStatus
|
|||
compat_timeval pr_stime;
|
||||
compat_timeval pr_cutime;
|
||||
compat_timeval pr_cstime;
|
||||
#endif
|
||||
|
||||
ELFPrStatus();
|
||||
|
||||
|
@ -70,6 +85,12 @@ struct ELFPrStatus
|
|||
|
||||
struct ELFPrPsInfo
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
int32_t pr_version;
|
||||
uint64_t pr_psinfosz;
|
||||
char pr_fname[17];
|
||||
char pr_psargs[81];
|
||||
#else
|
||||
char pr_state;
|
||||
char pr_sname;
|
||||
char pr_zomb;
|
||||
|
@ -83,6 +104,7 @@ struct ELFPrPsInfo
|
|||
int32_t pr_sid;
|
||||
char pr_fname[16];
|
||||
char pr_psargs[80];
|
||||
#endif
|
||||
|
||||
ELFPrPsInfo();
|
||||
|
||||
|
|
Loading…
Reference in New Issue