From c1fdb889a9e24fb6732b10c26568e5af4ada2f68 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Fri, 27 Jun 2014 16:02:55 +0000 Subject: [PATCH] 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 --- lldb/tools/debugserver/source/DNB.cpp | 3 +-- lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp | 4 +--- lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp | 10 ++++------ .../debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp | 10 ++++------ .../tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp | 12 +++++------- lldb/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp | 12 +++++------- .../debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp | 12 +++++------- lldb/tools/debugserver/source/TTYState.h | 6 ++---- 8 files changed, 27 insertions(+), 42 deletions(-) diff --git a/lldb/tools/debugserver/source/DNB.cpp b/lldb/tools/debugserver/source/DNB.cpp index cbbf82f..8380752 100644 --- a/lldb/tools/debugserver/source/DNB.cpp +++ b/lldb/tools/debugserver/source/DNB.cpp @@ -47,7 +47,6 @@ #include "DNBTimer.h" #include "CFBundle.h" -#include "llvm/ADT/STLExtras.h" typedef std::shared_ptr MachProcessSP; typedef std::map ProcessMap; @@ -543,7 +542,7 @@ GetAllInfos (std::vector& 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 diff --git a/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp b/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp index a012515..68b272a 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp @@ -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; diff --git a/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp b/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp index 08cbbfb..3282d70 100644 --- a/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp +++ b/lldb/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp @@ -23,8 +23,6 @@ #include "ARM_GCC_Registers.h" #include "ARM_DWARF_Registers.h" -#include "llvm/ADT/STLExtras.h" - #include #include @@ -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 * diff --git a/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp b/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp index 42e0d4c..909fac6 100644 --- a/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp +++ b/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp @@ -24,8 +24,6 @@ #include "DNBRegisterInfo.h" #include "DNB.h" -#include "llvm/ADT/STLExtras.h" - #include #include @@ -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 * diff --git a/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp b/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp index fef0d47..faa534e 100644 --- a/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp +++ b/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp @@ -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) diff --git a/lldb/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp b/lldb/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp index 0f555d7..2feb1f4 100644 --- a/lldb/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp +++ b/lldb/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp @@ -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 * diff --git a/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp b/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp index 7d859e4..f683635 100644 --- a/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp +++ b/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp @@ -13,8 +13,6 @@ #if defined (__i386__) || defined (__x86_64__) -#include "llvm/ADT/STLExtras.h" - #include #include #include @@ -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 * diff --git a/lldb/tools/debugserver/source/TTYState.h b/lldb/tools/debugserver/source/TTYState.h index 7d26f5e..c01d512 100644 --- a/lldb/tools/debugserver/source/TTYState.h +++ b/lldb/tools/debugserver/source/TTYState.h @@ -17,8 +17,6 @@ #include #include -#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 \ No newline at end of file -- 2.7.4