Revert the debugserver part of r211868. While formally a fine change, debugserver

doesn't depend on llvm (it really doesn't even depend on anything in lldb) and this
nicety isn't worth adding that dependence.

llvm-svn: 211903
This commit is contained in:
Jim Ingham 2014-06-27 16:02:55 +00:00
parent b673b4b187
commit c1fdb889a9
8 changed files with 27 additions and 42 deletions

View File

@ -47,7 +47,6 @@
#include "DNBTimer.h"
#include "CFBundle.h"
#include "llvm/ADT/STLExtras.h"
typedef std::shared_ptr<MachProcess> MachProcessSP;
typedef std::map<nub_process_t, MachProcessSP> ProcessMap;
@ -543,7 +542,7 @@ GetAllInfos (std::vector<struct kinfo_proc>& proc_infos)
{
size_t size = 0;
int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL };
u_int namelen = llvm::array_lengthof(name);
u_int namelen = sizeof(name)/sizeof(int);
int err;
// Try to find out how many processes are around so we can

View File

@ -20,8 +20,6 @@
#include "DNBThreadResumeActions.h"
#include "MachProcess.h"
#include "llvm/ADT/STLExtras.h"
MachThreadList::MachThreadList() :
m_threads(),
m_threads_mutex(PTHREAD_MUTEX_RECURSIVE),
@ -315,7 +313,7 @@ MachThreadList::UpdateThreadList(MachProcess *process, bool update, MachThreadLi
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process->ProcessID() };
struct kinfo_proc processInfo;
size_t bufsize = sizeof(processInfo);
if (sysctl(mib, llvm::array_lengthof(mib), &processInfo, &bufsize, NULL, 0) == 0 && bufsize > 0)
if (sysctl(mib, (unsigned)(sizeof(mib)/sizeof(int)), &processInfo, &bufsize, NULL, 0) == 0 && bufsize > 0)
{
if (processInfo.kp_proc.p_flag & P_LP64)
m_is_64_bit = true;

View File

@ -23,8 +23,6 @@
#include "ARM_GCC_Registers.h"
#include "ARM_DWARF_Registers.h"
#include "llvm/ADT/STLExtras.h"
#include <inttypes.h>
#include <sys/sysctl.h>
@ -1557,9 +1555,9 @@ DNBArchMachARM::g_exc_registers[] =
};
// Number of registers in each register set
const size_t DNBArchMachARM::k_num_gpr_registers = llvm::array_lengthof(g_gpr_registers);
const size_t DNBArchMachARM::k_num_vfp_registers = llvm::array_lengthof(g_vfp_registers);
const size_t DNBArchMachARM::k_num_exc_registers = llvm::array_lengthof(g_exc_registers);
const size_t DNBArchMachARM::k_num_gpr_registers = sizeof(g_gpr_registers)/sizeof(DNBRegisterInfo);
const size_t DNBArchMachARM::k_num_vfp_registers = sizeof(g_vfp_registers)/sizeof(DNBRegisterInfo);
const size_t DNBArchMachARM::k_num_exc_registers = sizeof(g_exc_registers)/sizeof(DNBRegisterInfo);
const size_t DNBArchMachARM::k_num_all_registers = k_num_gpr_registers + k_num_vfp_registers + k_num_exc_registers;
//----------------------------------------------------------------------
@ -1576,7 +1574,7 @@ DNBArchMachARM::g_reg_sets[] =
{ "Exception State Registers", g_exc_registers, k_num_exc_registers }
};
// Total number of register sets for this architecture
const size_t DNBArchMachARM::k_num_register_sets = llvm::array_lengthof(g_reg_sets);
const size_t DNBArchMachARM::k_num_register_sets = sizeof(g_reg_sets)/sizeof(DNBRegisterSetInfo);
const DNBRegisterSetInfo *

View File

@ -24,8 +24,6 @@
#include "DNBRegisterInfo.h"
#include "DNB.h"
#include "llvm/ADT/STLExtras.h"
#include <inttypes.h>
#include <sys/sysctl.h>
@ -1646,9 +1644,9 @@ DNBArchMachARM64::g_exc_registers[] =
};
// Number of registers in each register set
const size_t DNBArchMachARM64::k_num_gpr_registers = llvm::array_lengthof(g_gpr_registers);
const size_t DNBArchMachARM64::k_num_vfp_registers = llvm::array_lengthof(g_vfp_registers);
const size_t DNBArchMachARM64::k_num_exc_registers = llvm::array_lengthof(g_exc_registers);
const size_t DNBArchMachARM64::k_num_gpr_registers = sizeof(g_gpr_registers)/sizeof(DNBRegisterInfo);
const size_t DNBArchMachARM64::k_num_vfp_registers = sizeof(g_vfp_registers)/sizeof(DNBRegisterInfo);
const size_t DNBArchMachARM64::k_num_exc_registers = sizeof(g_exc_registers)/sizeof(DNBRegisterInfo);
const size_t DNBArchMachARM64::k_num_all_registers = k_num_gpr_registers + k_num_vfp_registers + k_num_exc_registers;
//----------------------------------------------------------------------
@ -1665,7 +1663,7 @@ DNBArchMachARM64::g_reg_sets[] =
{ "Exception State Registers", g_exc_registers, k_num_exc_registers }
};
// Total number of register sets for this architecture
const size_t DNBArchMachARM64::k_num_register_sets = llvm::array_lengthof(g_reg_sets);
const size_t DNBArchMachARM64::k_num_register_sets = sizeof(g_reg_sets)/sizeof(DNBRegisterSetInfo);
const DNBRegisterSetInfo *

View File

@ -20,8 +20,6 @@
#include "MachThread.h"
#include "MachProcess.h"
#include "llvm/ADT/STLExtras.h"
extern "C" bool CPUHasAVX(); // Defined over in DNBArchImplX86_64.cpp
#if defined (LLDB_DEBUGSERVER_RELEASE) || defined (LLDB_DEBUGSERVER_DEBUG)
@ -1203,10 +1201,10 @@ DNBArchImplI386::g_exc_registers[] =
};
// Number of registers in each register set
const size_t DNBArchImplI386::k_num_gpr_registers = llvm::array_lengthof(g_gpr_registers);
const size_t DNBArchImplI386::k_num_fpu_registers_no_avx = llvm::array_lengthof(g_fpu_registers_no_avx);
const size_t DNBArchImplI386::k_num_fpu_registers_avx = llvm::array_lengthof(g_fpu_registers_avx);
const size_t DNBArchImplI386::k_num_exc_registers = llvm::array_lengthof(g_exc_registers);
const size_t DNBArchImplI386::k_num_gpr_registers = sizeof(g_gpr_registers)/sizeof(DNBRegisterInfo);
const size_t DNBArchImplI386::k_num_fpu_registers_no_avx = sizeof(g_fpu_registers_no_avx)/sizeof(DNBRegisterInfo);
const size_t DNBArchImplI386::k_num_fpu_registers_avx = sizeof(g_fpu_registers_avx)/sizeof(DNBRegisterInfo);
const size_t DNBArchImplI386::k_num_exc_registers = sizeof(g_exc_registers)/sizeof(DNBRegisterInfo);
const size_t DNBArchImplI386::k_num_all_registers_no_avx = k_num_gpr_registers + k_num_fpu_registers_no_avx + k_num_exc_registers;
const size_t DNBArchImplI386::k_num_all_registers_avx = k_num_gpr_registers + k_num_fpu_registers_avx + k_num_exc_registers;
@ -1234,7 +1232,7 @@ DNBArchImplI386::g_reg_sets_avx[] =
};
// Total number of register sets for this architecture
const size_t DNBArchImplI386::k_num_register_sets = llvm::array_lengthof(g_reg_sets_no_avx);
const size_t DNBArchImplI386::k_num_register_sets = sizeof(g_reg_sets_no_avx)/sizeof(DNBRegisterSetInfo);
DNBArchProtocol *
DNBArchImplI386::Create (MachThread *thread)

View File

@ -25,8 +25,6 @@
#include "DNBLog.h"
#include "DNBRegisterInfo.h"
#include "llvm/ADT/STLExtras.h"
static const uint8_t g_breakpoint_opcode[] = { 0x7F, 0xC0, 0x00, 0x08 };
const uint8_t * const
@ -388,10 +386,10 @@ static DNBRegisterInfo g_vec_registers[] =
};
// Number of registers in each register set
const size_t k_num_gpr_registers = llvm::array_lengthof(g_gpr_registers);
const size_t k_num_fpr_registers = llvm::array_lengthof(g_fpr_registers);
const size_t k_num_exc_registers = llvm::array_lengthof(g_exc_registers);
const size_t k_num_vec_registers = llvm::array_lengthof(g_vec_registers);
const size_t k_num_gpr_registers = sizeof(g_gpr_registers)/sizeof(DNBRegisterInfo);
const size_t k_num_fpr_registers = sizeof(g_fpr_registers)/sizeof(DNBRegisterInfo);
const size_t k_num_exc_registers = sizeof(g_exc_registers)/sizeof(DNBRegisterInfo);
const size_t k_num_vec_registers = sizeof(g_vec_registers)/sizeof(DNBRegisterInfo);
// Total number of registers for this architecture
const size_t k_num_ppc_registers = k_num_gpr_registers + k_num_fpr_registers + k_num_exc_registers + k_num_vec_registers;
@ -409,7 +407,7 @@ static const DNBRegisterSetInfo g_reg_sets[] =
{ "Altivec Registers", g_vec_registers, k_num_vec_registers }
};
// Total number of register sets for this architecture
const size_t k_num_register_sets = llvm::array_lengthof(g_reg_sets);
const size_t k_num_register_sets = sizeof(g_reg_sets)/sizeof(DNBRegisterSetInfo);
const DNBRegisterSetInfo *

View File

@ -13,8 +13,6 @@
#if defined (__i386__) || defined (__x86_64__)
#include "llvm/ADT/STLExtras.h"
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/sysctl.h>
@ -1527,10 +1525,10 @@ DNBArchImplX86_64::g_exc_registers[] =
};
// Number of registers in each register set
const size_t DNBArchImplX86_64::k_num_gpr_registers = llvm::array_lengthof(g_gpr_registers);
const size_t DNBArchImplX86_64::k_num_fpu_registers_no_avx = llvm::array_lengthof(g_fpu_registers_no_avx);
const size_t DNBArchImplX86_64::k_num_fpu_registers_avx = llvm::array_lengthof(g_fpu_registers_avx);
const size_t DNBArchImplX86_64::k_num_exc_registers = llvm::array_lengthof(g_exc_registers);
const size_t DNBArchImplX86_64::k_num_gpr_registers = sizeof(g_gpr_registers)/sizeof(DNBRegisterInfo);
const size_t DNBArchImplX86_64::k_num_fpu_registers_no_avx = sizeof(g_fpu_registers_no_avx)/sizeof(DNBRegisterInfo);
const size_t DNBArchImplX86_64::k_num_fpu_registers_avx = sizeof(g_fpu_registers_avx)/sizeof(DNBRegisterInfo);
const size_t DNBArchImplX86_64::k_num_exc_registers = sizeof(g_exc_registers)/sizeof(DNBRegisterInfo);
const size_t DNBArchImplX86_64::k_num_all_registers_no_avx = k_num_gpr_registers + k_num_fpu_registers_no_avx + k_num_exc_registers;
const size_t DNBArchImplX86_64::k_num_all_registers_avx = k_num_gpr_registers + k_num_fpu_registers_avx + k_num_exc_registers;
@ -1558,7 +1556,7 @@ DNBArchImplX86_64::g_reg_sets_avx[] =
};
// Total number of register sets for this architecture
const size_t DNBArchImplX86_64::k_num_register_sets = llvm::array_lengthof(g_reg_sets_avx);
const size_t DNBArchImplX86_64::k_num_register_sets = sizeof(g_reg_sets_avx)/sizeof(DNBRegisterSetInfo);
DNBArchProtocol *

View File

@ -17,8 +17,6 @@
#include <termios.h>
#include <stdint.h>
#include "llvm/ADT/STLExtras.h"
class TTYState
{
public:
@ -52,7 +50,7 @@ public:
bool GetState(uint32_t idx, int fd, bool saveProcessGroup);
bool SetState(uint32_t idx) const;
uint32_t NumStates() const { return llvm::array_lengthof(m_ttystates); }
uint32_t NumStates() const { return sizeof(m_ttystates)/sizeof(TTYState); }
bool ValidStateIndex(uint32_t idx) const { return idx < NumStates(); }
protected:
@ -60,4 +58,4 @@ protected:
TTYState m_ttystates[2];
};
#endif
#endif