Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -133,6 +133,7 @@ int platform_port; std::string platform_path; bool ok = UriParser::Parse(GetConnection()->GetURI().c_str(), platform_scheme, platform_ip, platform_port, platform_path); + (void)ok; assert(ok); Error error = StartDebugserverProcess ( platform_ip.c_str(), Index: lldb/trunk/source/Symbol/ClangASTImporter.cpp =================================================================== --- lldb/trunk/source/Symbol/ClangASTImporter.cpp +++ lldb/trunk/source/Symbol/ClangASTImporter.cpp @@ -623,6 +623,7 @@ m_decls_to_deport->erase(decl); DeclOrigin &origin = to_context_md->m_origins[decl]; + (void)origin; assert (origin.ctx == m_source_ctx); // otherwise we should never have added this // because it doesn't need to be deported Index: lldb/trunk/source/Target/Process.cpp =================================================================== --- lldb/trunk/source/Target/Process.cpp +++ lldb/trunk/source/Target/Process.cpp @@ -2843,6 +2843,7 @@ size_t intersect_size; size_t opcode_offset; const bool intersects = bp->IntersectsRange(addr, size, &intersect_addr, &intersect_size, &opcode_offset); + (void)intersects; assert(intersects); assert(addr <= intersect_addr && intersect_addr < addr + size); assert(addr < intersect_addr + intersect_size && intersect_addr + intersect_size <= addr + size); Index: lldb/trunk/tools/debugserver/source/CMakeLists.txt =================================================================== --- lldb/trunk/tools/debugserver/source/CMakeLists.txt +++ lldb/trunk/tools/debugserver/source/CMakeLists.txt @@ -10,6 +10,30 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_SOURCE_DIR}/../resources/lldb-debugserver-Info.plist") endif() +check_cxx_compiler_flag("-Wno-gnu-zero-variadic-macro-arguments" + CXX_SUPPORTS_NO_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS) +if (CXX_SUPPORTS_NO_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-gnu-zero-variadic-macro-arguments") +endif () + +check_cxx_compiler_flag("-Wno-vla-extension" + CXX_SUPPORTS_NO_VLA_EXTENSION) +if (CXX_SUPPORTS_NO_VLA_EXTENSION) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-vla-extension") +endif () + +check_cxx_compiler_flag("-Wno-zero-length-array" + CXX_SUPPORTS_NO_ZERO_LENGTH_ARRAY) +if (CXX_SUPPORTS_NO_ZERO_LENGTH_ARRAY) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-zero-length-array") +endif () + +check_cxx_compiler_flag("-Wno-extended-offsetof" + CXX_SUPPORTS_NO_EXTENDED_OFFSETOF) +if (CXX_SUPPORTS_NO_EXTENDED_OFFSETOF) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-extended-offsetof") +endif () + add_definitions( -DDEBUGSERVER_VERSION_STR="${LLDB_VERSION}" ) Index: lldb/trunk/tools/debugserver/source/DNB.cpp =================================================================== --- lldb/trunk/tools/debugserver/source/DNB.cpp +++ lldb/trunk/tools/debugserver/source/DNB.cpp @@ -446,6 +446,7 @@ else { bool res = AddProcessToMap(pid, processSP); + (void)res; assert(res && "Couldn't add process to map!"); return pid; } @@ -494,6 +495,7 @@ if (pid != INVALID_NUB_PROCESS) { bool res = AddProcessToMap(pid, processSP); + (void)res; assert(res && "Couldn't add process to map!"); spawn_waitpid_thread(pid); } Index: lldb/trunk/tools/debugserver/source/DNBArch.h =================================================================== --- lldb/trunk/tools/debugserver/source/DNBArch.h +++ lldb/trunk/tools/debugserver/source/DNBArch.h @@ -27,7 +27,7 @@ typedef DNBArchProtocol * (* DNBArchCallbackCreate)(MachThread *thread); typedef const DNBRegisterSetInfo * (* DNBArchCallbackGetRegisterSetInfo)(nub_size_t *num_reg_sets); -typedef const uint8_t * const (* DNBArchCallbackGetBreakpointOpcode)(nub_size_t byte_size); +typedef const uint8_t * (* DNBArchCallbackGetBreakpointOpcode)(nub_size_t byte_size); typedef struct DNBArchPluginInfoTag { @@ -49,7 +49,7 @@ static const DNBRegisterSetInfo * GetRegisterSetInfo (nub_size_t *num_reg_sets); - static const uint8_t * const + static const uint8_t * GetBreakpointOpcode (nub_size_t byte_size); static void @@ -94,7 +94,7 @@ virtual uint32_t EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write, bool also_set_on_task) { return INVALID_NUB_HW_INDEX; } virtual bool DisableHardwareBreakpoint (uint32_t hw_index) { return false; } virtual bool DisableHardwareWatchpoint (uint32_t hw_index, bool also_set_on_task) { return false; } - virtual uint32_t GetHardwareWatchpointHit() { return INVALID_NUB_HW_INDEX; } + virtual uint32_t GetHardwareWatchpointHit(nub_addr_t &addr) { return INVALID_NUB_HW_INDEX; } virtual bool StepNotComplete () { return false; } protected: Index: lldb/trunk/tools/debugserver/source/DNBArch.cpp =================================================================== --- lldb/trunk/tools/debugserver/source/DNBArch.cpp +++ lldb/trunk/tools/debugserver/source/DNBArch.cpp @@ -86,7 +86,7 @@ } -const uint8_t * const +const uint8_t * DNBArchProtocol::GetBreakpointOpcode (nub_size_t byte_size) { const DNBArchPluginInfo *arch_info = GetArchInfo (); Index: lldb/trunk/tools/debugserver/source/DNBDataRef.cpp =================================================================== --- lldb/trunk/tools/debugserver/source/DNBDataRef.cpp +++ lldb/trunk/tools/debugserver/source/DNBDataRef.cpp @@ -334,7 +334,7 @@ uint32_t count; char str[1024]; str[0] = '\0'; - int str_offset = 0; + size_t str_offset = 0; for (offset = startOffset, count = 0; ValidOffset(offset) && offset < endOffset; ++count) { Index: lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp =================================================================== --- lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp +++ lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp @@ -45,7 +45,6 @@ { if (info.name != NULL) { - int i; char str[1024]; char *pos; char *end = str + sizeof(str); @@ -62,7 +61,7 @@ default: strncpy(str, "0x", 3); pos = str + 2; - for (i=0; iIntersectsRange(addr, size, &intersect_addr, &intersect_size, &opcode_offset); + (void)intersects; assert(intersects); assert(addr <= intersect_addr && intersect_addr < addr + size); assert(addr < intersect_addr + intersect_size && intersect_addr + intersect_size <= addr + size); Index: lldb/trunk/tools/debugserver/source/MacOSX/MachTask.mm =================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/MachTask.mm +++ lldb/trunk/tools/debugserver/source/MacOSX/MachTask.mm @@ -266,7 +266,7 @@ if (kr != KERN_SUCCESS) return; - for (int i = 0; i < tcnt; i++) + for (mach_msg_type_number_t i = 0; i < tcnt; i++) { thread_identifier_info_data_t identifier_info; mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT; @@ -431,7 +431,7 @@ // Make sure that thread name doesn't interfere with our delimiter. profile_data_stream << RAW_HEXBASE << std::setw(2); const uint8_t *ubuf8 = (const uint8_t *)(thread_name); - for (int j=0; j %zu", buf, buf_len, size); @@ -2027,6 +2028,7 @@ p += sizeof(m_state.context.exc); size_t bytes_written = p - (uint8_t *)buf; + (void)bytes_written; assert (bytes_written == size); SetGPRState(); SetVFPState(); Index: lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h =================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h +++ lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h @@ -221,7 +221,7 @@ static DNBArchProtocol * Create (MachThread *thread); - static const uint8_t * const + static const uint8_t * SoftwareBreakpointOpcode (nub_size_t byte_size); static const DNBRegisterSetInfo * Index: lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp =================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp +++ lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp @@ -1246,7 +1246,7 @@ return obj; } -const uint8_t * const +const uint8_t * DNBArchImplI386::SoftwareBreakpointOpcode (nub_size_t byte_size) { static const uint8_t g_breakpoint_opcode[] = { 0xCC }; @@ -1703,6 +1703,7 @@ // make sure we end up with exactly what we think we should have size_t bytes_written = p - (uint8_t *)buf; + (void)bytes_written; assert (bytes_written == size); } } @@ -1788,6 +1789,7 @@ // make sure we end up with exactly what we think we should have size_t bytes_written = p - (uint8_t *)buf; + (void)bytes_written; assert (bytes_written == size); kern_return_t kret; if ((kret = SetGPRState()) != KERN_SUCCESS) Index: lldb/trunk/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.h =================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.h +++ lldb/trunk/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.h @@ -46,7 +46,7 @@ virtual bool ThreadWillResume(); virtual bool ThreadDidStop(); - static const uint8_t * const SoftwareBreakpointOpcode (nub_size_t byte_size); + static const uint8_t * SoftwareBreakpointOpcode (nub_size_t byte_size); static uint32_t GetCPUType(); protected: Index: lldb/trunk/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp =================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp +++ lldb/trunk/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp @@ -27,7 +27,7 @@ static const uint8_t g_breakpoint_opcode[] = { 0x7F, 0xC0, 0x00, 0x08 }; -const uint8_t * const +const uint8_t * DNBArchMachPPC::SoftwareBreakpointOpcode (nub_size_t size) { if (size == 4) Index: lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h =================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h +++ lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h @@ -227,7 +227,7 @@ static DNBArchProtocol * Create (MachThread *thread); - static const uint8_t * const + static const uint8_t * SoftwareBreakpointOpcode (nub_size_t byte_size); static const DNBRegisterSetInfo * Index: lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp =================================================================== --- lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp +++ lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp @@ -1566,7 +1566,7 @@ return obj; } -const uint8_t * const +const uint8_t * DNBArchImplX86_64::SoftwareBreakpointOpcode (nub_size_t byte_size) { static const uint8_t g_breakpoint_opcode[] = { 0xCC }; @@ -2089,6 +2089,7 @@ // make sure we end up with exactly what we think we should have size_t bytes_written = p - (uint8_t *)buf; + (void)bytes_written; assert (bytes_written == size); } @@ -2176,6 +2177,7 @@ // make sure we end up with exactly what we think we should have size_t bytes_written = p - (uint8_t *)buf; + (void)bytes_written; assert (bytes_written == size); kern_return_t kret; Index: lldb/trunk/tools/debugserver/source/RNBRemote.h =================================================================== --- lldb/trunk/tools/debugserver/source/RNBRemote.h +++ lldb/trunk/tools/debugserver/source/RNBRemote.h @@ -161,7 +161,7 @@ nub_thread_t GetCurrentThread () const { - if (m_thread == 0 || m_thread == -1) + if (m_thread == 0 || m_thread == (nub_thread_t)-1) return DNBProcessGetCurrentThread (m_ctx.ProcessID()); return m_thread; } Index: lldb/trunk/tools/debugserver/source/RNBRemote.cpp =================================================================== --- lldb/trunk/tools/debugserver/source/RNBRemote.cpp +++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp @@ -542,7 +542,7 @@ } else { - for (int i = 0; i != s_compressed.size(); ++i) + for (size_t i = 0; i != s_compressed.size(); ++i) cksum += s_compressed[i]; snprintf (hexbuf, sizeof hexbuf, "%02x", cksum & 0xff); sendpacket += hexbuf; @@ -1076,7 +1076,7 @@ { return bytes; } - if (len == -1) + if (len == (size_t)-1) len = strlen (str); while (len--) @@ -2454,7 +2454,7 @@ } else { - for (i = 0; i < buf_size; i++) + for (size_t i = 0; i < buf_size; i++) ostrm << RAWHEX8(p[i]); } } @@ -2676,7 +2676,7 @@ // the thread name contains special chars, send as hex bytes ostrm << std::hex << "hexname:"; uint8_t *u_thread_name = (uint8_t *)thread_name; - for (int i = 0; i < thread_name_len; i++) + for (size_t i = 0; i < thread_name_len; i++) ostrm << RAWHEX8(u_thread_name[i]); ostrm << ';'; } @@ -2787,7 +2787,7 @@ { ostrm << "metype:" << std::hex << tid_stop_info.details.exception.type << ';'; ostrm << "mecount:" << std::hex << tid_stop_info.details.exception.data_count << ';'; - for (int i = 0; i < tid_stop_info.details.exception.data_count; ++i) + for (nub_size_t i = 0; i < tid_stop_info.details.exception.data_count; ++i) ostrm << "medata:" << std::hex << tid_stop_info.details.exception.data[i] << ';'; } @@ -3026,7 +3026,7 @@ length = bytes_read; std::ostringstream ostrm; - for (int i = 0; i < length; i++) + for (unsigned long i = 0; i < length; i++) ostrm << RAWHEX8(buf[i]); return SendPacket (ostrm.str ()); } @@ -3093,7 +3093,7 @@ std::vector buf_quoted; buf_quoted.reserve (bytes_read + 30); - for (int i = 0; i < bytes_read; i++) + for (nub_size_t i = 0; i < bytes_read; i++) { if (buf[i] == '#' || buf[i] == '$' || buf[i] == '}' || buf[i] == '*') { @@ -3108,7 +3108,7 @@ length = buf_quoted.size(); std::ostringstream ostrm; - for (int i = 0; i < length; i++) + for (unsigned long i = 0; i < length; i++) ostrm << buf_quoted[i]; return SendPacket (ostrm.str ()); @@ -3471,6 +3471,7 @@ // By default, don't enable compression. It's only worth doing when we are working // with a low speed communication channel. bool enable_compression = false; + (void)enable_compression; // Enable compression when debugserver is running on a watchOS device where communication may be over Bluetooth. #if defined (TARGET_OS_WATCH) && TARGET_OS_WATCH == 1 @@ -3907,7 +3908,7 @@ DNBLogError("RNBRemote::HandlePacket_p(%s): unknown register number %u requested\n", p, reg); ostrm << "00000000"; } - else if (reg_entry->nub_info.reg == -1) + else if (reg_entry->nub_info.reg == (uint32_t)-1) { if (reg_entry->nub_info.size > 0) { @@ -3966,7 +3967,7 @@ reg_entry = &g_reg_entries[reg]; - if (reg_entry->nub_info.set == -1 && reg_entry->nub_info.reg == -1) + if (reg_entry->nub_info.set == (uint32_t)-1 && reg_entry->nub_info.reg == (uint32_t)-1) { DNBLogError("RNBRemote::HandlePacket_P(%s): unknown register number %u requested\n", p, reg); return SendPacket("E48"); @@ -4389,7 +4390,7 @@ // Hardware supported stepping not supported on arm nub_thread_t tid = GetContinueThread (); - if (tid == 0 || tid == -1) + if (tid == 0 || tid == (nub_thread_t)-1) tid = GetCurrentThread(); if (tid == INVALID_NUB_THREAD) @@ -4437,7 +4438,7 @@ } action.tid = GetContinueThread (); - if (action.tid == 0 || action.tid == -1) + if (action.tid == 0 || action.tid == (nub_thread_t)-1) return SendPacket ("E40"); nub_state_t tstate = DNBThreadGetState (pid, action.tid); Index: lldb/trunk/tools/debugserver/source/RNBServices.cpp =================================================================== --- lldb/trunk/tools/debugserver/source/RNBServices.cpp +++ lldb/trunk/tools/debugserver/source/RNBServices.cpp @@ -11,21 +11,21 @@ // //===----------------------------------------------------------------------===// -#import "RNBServices.h" +#include "RNBServices.h" -#import +#include #include -#import +#include #include #include "CFString.h" #include -#import "DNBLog.h" +#include "DNBLog.h" #include "MacOSX/CFUtils.h" // For now only SpringBoard has a notion of "Applications" that it can list for us. // So we have to use the SpringBoard API's here. #if defined (WITH_SPRINGBOARD) || defined (WITH_BKS) -#import +#include #endif // From DNB.cpp Index: lldb/trunk/tools/debugserver/source/RNBSocket.cpp =================================================================== --- lldb/trunk/tools/debugserver/source/RNBSocket.cpp +++ lldb/trunk/tools/debugserver/source/RNBSocket.cpp @@ -395,7 +395,7 @@ if (bytessent < 0) return rnb_err; - if (bytessent != length) + if ((size_t)bytessent != length) return rnb_err; DNBLogThreadedIf(LOG_RNB_PACKETS, "putpkt: %*s", (int)length, (char *)buffer); // All data is string based in debugserver, so this is safe Index: lldb/trunk/tools/debugserver/source/libdebugserver.cpp =================================================================== --- lldb/trunk/tools/debugserver/source/libdebugserver.cpp +++ lldb/trunk/tools/debugserver/source/libdebugserver.cpp @@ -189,18 +189,18 @@ if (ctx.GetProcessStopCount() == 1) { - DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %u (old %u)) Notify??? no, first stop...", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count); + DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %zu (old %zu)) Notify??? no, first stop...", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count); } else { - DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %u (old %u)) Notify??? YES!!!", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count); + DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %zu (old %zu)) Notify??? YES!!!", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count); remote->NotifyThatProcessStopped (); } } else { - DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %u (old %u)) Notify??? skipping...", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count); + DNBLogThreadedIf (LOG_RNB_MINIMAL, "%s (&remote, initialize=%i) pid_state = %s pid_stop_count %zu (old %zu)) Notify??? skipping...", __FUNCTION__, (int)initialize, DNBStateAsString (pid_state), ctx.GetProcessStopCount(), prev_pid_stop_count); } } return eRNBRunLoopModeInferiorExecuting;