[Lldb-commits] [PATCH] D32149: Correct handling NetBSD core(5) files with threads
krytarowski created this revision. krytarowski added a project: LLDB. Correct detection of the NetBSD specific core(5) files. The original code was apparently copied from FreeBSD and it was buggy, because these BSDs are different and do not share the same ELF layout for core(5) files. Split ProcessElfCore::ParseThreadContextsFromNoteSegment into two functions: NetBSD-specific and Generic. I presume that other BSDs should follow this or share concepts with NetBSD. The Linux threading and NOTE layout is very different to the NetBSD one, and it is not easily doable, without a monstrous design, to introduce there support for threads. OpenBSD could reuse NetBSD code and perhaps share the same functions, as these systems have very similar ELF core(5) layout. Obligatory demo: (lldb) target create "/usr/pkg/bin/rtorrent" --core "rtorrent.core" Core file '/public/lldb_devel/rtorrent.core' (x86_64) was loaded. (lldb) thread list Process 0 stopped * thread #1: tid = 3, 0x7a59d623b51a libc.so.12`_sys___kevent50 + 10, stop reason = signal SIGSTOP thread #2: tid = 2, 0x7a59d623b51a libc.so.12`_sys___kevent50 + 10, stop reason = signal SIGSTOP thread #3: tid = 1, 0x7a59d623b21a libc.so.12`__select50 + 10, stop reason = signal SIGSTOP (lldb) thread select 2 * thread #2, stop reason = signal SIGSTOP frame #0: 0x7a59d623b51a libc.so.12`_sys___kevent50 + 10 libc.so.12`_sys___kevent50: -> 0x7a59d623b51a <+10>: addb %al, (%rax) 0x7a59d623b51c <+12>: addb %al, (%rax) 0x7a59d623b51e <+14>: addb %al, (%rax) 0x7a59d623b520 <+16>: addb %al, (%rax) (lldb) bt * thread #2, stop reason = signal SIGSTOP * frame #0: 0x7a59d623b51a libc.so.12`_sys___kevent50 + 10 frame #1: 0x7a59d6606c97 libpthread.so.1`__kevent50(fd=, ev=, nev=, rev=, nrev=, ts=) at pthread_cancelstub.c:176 frame #2: 0x7a59d91167f2 libtorrent.so.19`torrent::PollKQueue::poll(this=0x7a59da153200, msec=10001) at poll_kqueue.cc:167 frame #3: 0x7a59d9116d98 libtorrent.so.19`torrent::PollKQueue::do_poll(this=0x7a59da153200, timeout_usec=1000, flags=1) at poll_kqueue.cc:268 frame #4: 0x7a59d91396d6 libtorrent.so.19`torrent::thread_base::event_loop(thread=0x7a59da1a6700) at thread_base.cc:174 frame #5: 0x7a59d660b6e1 libpthread.so.1`pthread__create_tramp(cookie=0x7a59da1fd000) at pthread.c:576 frame #6: 0x7a59d6287ac0 libc.so.12 Sponsored by Repository: rL LLVM https://reviews.llvm.org/D32149 Files: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp source/Plugins/Process/elf-core/ProcessElfCore.cpp source/Plugins/Process/elf-core/ProcessElfCore.h Index: source/Plugins/Process/elf-core/ProcessElfCore.h === --- source/Plugins/Process/elf-core/ProcessElfCore.h +++ source/Plugins/Process/elf-core/ProcessElfCore.h @@ -125,6 +125,18 @@ lldb_private::ConstString path; }; + // Parse thread(s) data structuresNetBSD(prstatus, prpsinfo) from given NOTE + // segment + lldb_private::Error ParseThreadContextsFromNoteSegmentNetBSD( + const elf::ELFProgramHeader *segment_header, + lldb_private::DataExtractor segment_data); + + // Parse thread(s) data structuresGeneric(prstatus, prpsinfo) from given NOTE + // segment + lldb_private::Error ParseThreadContextsFromNoteSegmentGeneric( + const elf::ELFProgramHeader *segment_header, + lldb_private::DataExtractor segment_data); + //-- // For ProcessElfCore only //-- Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp === --- source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -19,6 +19,7 @@ #include "lldb/Core/PluginManager.h" #include "lldb/Core/Section.h" #include "lldb/Core/State.h" +#include "lldb/Host/StringConvert.h" #include "lldb/Target/DynamicLoader.h" #include "lldb/Target/MemoryRegionInfo.h" #include "lldb/Target/Target.h" @@ -219,7 +220,7 @@ ArchSpec core_arch(m_core_module_sp->GetArchitecture()); target_arch.MergeFrom(core_arch); GetTarget().SetArchitecture(target_arch); - + SetUnixSignals(UnixSignals::Create(GetArchitecture())); // Ensure we found at least one thread that was stopped on a signal. @@ -373,7 +374,8 @@ lldb::addr_t bytes_left = 0; // Number of bytes available in the core file from the given address - // Don't proceed if core file doesn't contain the actual data for this address range. + // Don't proceed if core file doesn't contain the actual data for this address + // range. if (file_start == file_end) return 0; @@ -458,9 +460,14 @@ namespace NETBSD { -enum { NT_PROCINFO = 1, NT_AUXV, NT_AMD64_REGS = 33,
[Lldb-commits] [PATCH] D32148: [Utility/StringLexer] Remove dead code.
davide created this revision. https://reviews.llvm.org/D32148 Files: include/lldb/Utility/StringLexer.h source/Utility/StringLexer.cpp Index: source/Utility/StringLexer.cpp === --- source/Utility/StringLexer.cpp +++ source/Utility/StringLexer.cpp @@ -73,10 +73,6 @@ m_position -= s; } -bool StringLexer::HasAny(Character c) { - return m_data.find(c, m_position) != std::string::npos; -} - std::string StringLexer::GetUnlexed() { return std::string(m_data, m_position); } Index: include/lldb/Utility/StringLexer.h === --- include/lldb/Utility/StringLexer.h +++ include/lldb/Utility/StringLexer.h @@ -41,8 +41,6 @@ bool HasAtLeast(Size s); - bool HasAny(Character c); - std::string GetUnlexed(); // This will assert if there are less than s characters preceding the cursor. Index: source/Utility/StringLexer.cpp === --- source/Utility/StringLexer.cpp +++ source/Utility/StringLexer.cpp @@ -73,10 +73,6 @@ m_position -= s; } -bool StringLexer::HasAny(Character c) { - return m_data.find(c, m_position) != std::string::npos; -} - std::string StringLexer::GetUnlexed() { return std::string(m_data, m_position); } Index: include/lldb/Utility/StringLexer.h === --- include/lldb/Utility/StringLexer.h +++ include/lldb/Utility/StringLexer.h @@ -41,8 +41,6 @@ bool HasAtLeast(Size s); - bool HasAny(Character c); - std::string GetUnlexed(); // This will assert if there are less than s characters preceding the cursor. ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r300519 - TestStaticVariables still fails on Linux.
Author: jingham Date: Mon Apr 17 19:44:14 2017 New Revision: 300519 URL: http://llvm.org/viewvc/llvm-project?rev=300519=rev Log: TestStaticVariables still fails on Linux. Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py?rev=300519=300518=300519=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py Mon Apr 17 19:44:14 2017 @@ -60,6 +60,8 @@ class StaticVariableTestCase(TestBase): compiler=["gcc"], bugnumber="Compiler emits incomplete debug info") @expectedFailureAll( +oslist=['linux']) +@expectedFailureAll( oslist=['freebsd'], bugnumber='llvm.org/pr20550 failing on FreeBSD-11') @add_test_categories(['pyapi']) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r300517 - This test is succeeding on macOS with clang.
Author: jingham Date: Mon Apr 17 19:20:59 2017 New Revision: 300517 URL: http://llvm.org/viewvc/llvm-project?rev=300517=rev Log: This test is succeeding on macOS with clang. Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py?rev=300517=300516=300517=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py Mon Apr 17 19:20:59 2017 @@ -57,12 +57,7 @@ class StaticVariableTestCase(TestBase): startstr="(int) A::g_points[1].x = 11") @expectedFailureAll( -oslist=lldbplatformutil.getDarwinOSTriples(), -bugnumber="") -@expectedFailureAll( -compiler=[ -"clang", -"gcc"], +compiler=["gcc"], bugnumber="Compiler emits incomplete debug info") @expectedFailureAll( oslist=['freebsd'], ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D32137: [Utility] Placate another GCC warning
davide created this revision. For reference/discussion. GCC complains about signed-vs-unsigned comparison. I'm actually surprised that `m_registers_count` is a `signed` integer, as I can hardly imagine a negative register count. I'm under the impression that we could change `m_register_count` fields to be unsigned, but that would be a larger change. Thoughts? https://reviews.llvm.org/D32137 Files: source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp Index: source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp === --- source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp +++ source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp @@ -55,9 +55,10 @@ m_registers_count[i] = reg_set_ptr->num_registers; } - assert(m_num_registers == m_registers_count[gpr_registers_count] + -m_registers_count[fpr_registers_count] + -m_registers_count[msa_registers_count]); + assert(m_num_registers == + static_cast(m_registers_count[gpr_registers_count] + + m_registers_count[fpr_registers_count] + + m_registers_count[msa_registers_count])); // elf-core yet to support ReadFPR() ProcessSP base = CalculateProcess(); Index: source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp === --- source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp +++ source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp @@ -55,9 +55,10 @@ m_registers_count[i] = reg_set_ptr->num_registers; } - assert(m_num_registers == m_registers_count[gpr_registers_count] + -m_registers_count[fpr_registers_count] + -m_registers_count[msa_registers_count]); + assert(m_num_registers == + static_cast(m_registers_count[gpr_registers_count] + + m_registers_count[fpr_registers_count] + + m_registers_count[msa_registers_count])); // elf-core yet to support ReadFPR() ProcessSP base = CalculateProcess(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D30007: [lldb] Provide API to know which sanitizer generated an eStopReasonInstrumentation
kubamracek updated this revision to Diff 95469. kubamracek added a comment. Addressing review comments. https://reviews.llvm.org/D30007 Files: include/lldb/API/SBThread.h include/lldb/API/SBThreadPlan.h include/lldb/Target/InstrumentationRuntimeStopInfo.h include/lldb/Target/StopInfo.h packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py scripts/interface/SBThread.i scripts/interface/SBThreadPlan.i source/API/SBThread.cpp source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp source/Target/InstrumentationRuntimeStopInfo.cpp Index: source/Target/InstrumentationRuntimeStopInfo.cpp === --- source/Target/InstrumentationRuntimeStopInfo.cpp +++ source/Target/InstrumentationRuntimeStopInfo.cpp @@ -17,9 +17,9 @@ using namespace lldb_private; InstrumentationRuntimeStopInfo::InstrumentationRuntimeStopInfo( -Thread , std::string description, +Thread , InstrumentationRuntimeType type, std::string description, StructuredData::ObjectSP additional_data) -: StopInfo(thread, 0) { +: StopInfo(thread, type) { m_extended_info = additional_data; m_description = description; } @@ -30,8 +30,8 @@ StopInfoSP InstrumentationRuntimeStopInfo::CreateStopReasonWithInstrumentationData( -Thread , std::string description, +Thread , InstrumentationRuntimeType type, std::string description, StructuredData::ObjectSP additionalData) { return StopInfoSP( - new InstrumentationRuntimeStopInfo(thread, description, additionalData)); + new InstrumentationRuntimeStopInfo(thread, type, description, additionalData)); } Index: source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp === --- source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp +++ source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp @@ -859,7 +859,8 @@ thread_sp->SetStopInfo( InstrumentationRuntimeStopInfo:: CreateStopReasonWithInstrumentationData( - *thread_sp, stop_reason_description, report)); + *thread_sp, eInstrumentationRuntimeTypeThreadSanitizer, + stop_reason_description, report)); StreamFileSP stream_sp( process_sp->GetTarget().GetDebugger().GetOutputFile()); Index: source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp === --- source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp +++ source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp @@ -257,9 +257,11 @@ if (process_sp && process_sp == context->exe_ctx_ref.GetProcessSP()) { ThreadSP thread_sp = context->exe_ctx_ref.GetThreadSP(); if (thread_sp) - thread_sp->SetStopInfo(InstrumentationRuntimeStopInfo:: - CreateStopReasonWithInstrumentationData( - *thread_sp, description, report)); + thread_sp->SetStopInfo( + InstrumentationRuntimeStopInfo:: + CreateStopReasonWithInstrumentationData( + *thread_sp, eInstrumentationRuntimeTypeAddressSanitizer, + description, report)); StreamFileSP stream_sp( process_sp->GetTarget().GetDebugger().GetOutputFile()); Index: source/API/SBThread.cpp === --- source/API/SBThread.cpp +++ source/API/SBThread.cpp @@ -167,7 +167,6 @@ case eStopReasonExec: case eStopReasonPlanComplete: case eStopReasonThreadExiting: -case eStopReasonInstrumentation: // There is no data for these stop reasons. return 0; @@ -190,6 +189,9 @@ case eStopReasonException: return 1; + +case eStopReasonInstrumentation: + return 1; } } } else { @@ -221,7 +223,6 @@ case eStopReasonExec: case eStopReasonPlanComplete: case eStopReasonThreadExiting: -case eStopReasonInstrumentation: // There is no data for these stop reasons. return 0; @@ -255,6 +256,9 @@ case eStopReasonException: return stop_info_sp->GetValue(); + +case eStopReasonInstrumentation: + return stop_info_sp->GetValue(); } } } else { Index: scripts/interface/SBThreadPlan.i === --- scripts/interface/SBThreadPlan.i +++
[Lldb-commits] [lldb] r300476 - [ClangASTContext] Placate `casts away qualifiers` warnings from GCC.
Author: davide Date: Mon Apr 17 13:24:18 2017 New Revision: 300476 URL: http://llvm.org/viewvc/llvm-project?rev=300476=rev Log: [ClangASTContext] Placate `casts away qualifiers` warnings from GCC. Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=300476=300475=300476=diff == --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Mon Apr 17 13:24:18 2017 @@ -4484,7 +4484,8 @@ ClangASTContext::GetNumMemberFunctions(l const clang::ObjCInterfaceType *objc_interface_type = objc_class_type->getInterfaceType(); if (objc_interface_type && - GetCompleteType((lldb::opaque_compiler_type_t)objc_interface_type)) { + GetCompleteType(static_cast( + const_cast(objc_interface_type { clang::ObjCInterfaceDecl *class_interface_decl = objc_interface_type->getDecl(); if (class_interface_decl) { @@ -4592,7 +4593,8 @@ ClangASTContext::GetMemberFunctionAtInde const clang::ObjCInterfaceType *objc_interface_type = objc_class_type->getInterfaceType(); if (objc_interface_type && - GetCompleteType((lldb::opaque_compiler_type_t)objc_interface_type)) { + GetCompleteType(static_cast( + const_cast(objc_interface_type { clang::ObjCInterfaceDecl *class_interface_decl = objc_interface_type->getDecl(); if (class_interface_decl) { @@ -5660,7 +5662,8 @@ uint32_t ClangASTContext::GetNumFields(l const clang::ObjCInterfaceType *objc_interface_type = objc_class_type->getInterfaceType(); if (objc_interface_type && -GetCompleteType((lldb::opaque_compiler_type_t)objc_interface_type)) { +GetCompleteType(static_cast( +const_cast(objc_interface_type { clang::ObjCInterfaceDecl *class_interface_decl = objc_interface_type->getDecl(); if (class_interface_decl) { @@ -5807,7 +5810,8 @@ CompilerType ClangASTContext::GetFieldAt const clang::ObjCInterfaceType *objc_interface_type = objc_class_type->getInterfaceType(); if (objc_interface_type && -GetCompleteType((lldb::opaque_compiler_type_t)objc_interface_type)) { +GetCompleteType(static_cast( +const_cast(objc_interface_type { clang::ObjCInterfaceDecl *class_interface_decl = objc_interface_type->getDecl(); if (class_interface_decl) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31823: Update LLDB Host to support IPv6 over TCP
clayborg accepted this revision. clayborg added a comment. I'm good if Pavel is good. https://reviews.llvm.org/D31823 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D32125: [LLVM][MIPS] Fix different definition of off_t in LLDB and LLVM
beanz added a comment. Can you please move this check into `HandleLLVMOptions.cmake`? By putting it into a module that is vended as part of LLVM's packaging then LLVM subprojects can have consistent settings when building out-of-tree. This would enable @zturner's request to remove the duplicated code from LLDB. Repository: rL LLVM https://reviews.llvm.org/D32125 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D31823: Update LLDB Host to support IPv6 over TCP
beanz updated this revision to Diff 95453. beanz added a comment. Removing code I accidentally left in that was from debugging, and moving some duplicated code that @labath spotted out of the ifdef. https://reviews.llvm.org/D31823 Files: cmake/modules/LLDBConfig.cmake include/lldb/Host/Config.h include/lldb/Host/Config.h.cmake include/lldb/Host/MainLoop.h include/lldb/Host/Socket.h include/lldb/Host/common/TCPSocket.h include/lldb/Host/common/UDPSocket.h include/lldb/Host/linux/AbstractSocket.h include/lldb/Host/posix/DomainSocket.h include/lldb/Host/posix/MainLoopPosix.h lldb.xcodeproj/project.pbxproj source/Host/CMakeLists.txt source/Host/common/MainLoop.cpp source/Host/common/Socket.cpp source/Host/common/TCPSocket.cpp source/Host/common/UDPSocket.cpp source/Host/linux/AbstractSocket.cpp source/Host/posix/ConnectionFileDescriptorPosix.cpp source/Host/posix/DomainSocket.cpp source/Host/posix/MainLoopPosix.cpp source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp tools/lldb-server/Acceptor.cpp unittests/Host/SocketTest.cpp unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp unittests/debugserver/RNBSocketTest.cpp Index: unittests/debugserver/RNBSocketTest.cpp === --- unittests/debugserver/RNBSocketTest.cpp +++ unittests/debugserver/RNBSocketTest.cpp @@ -96,7 +96,7 @@ ASSERT_EQ(bye, goodbye); } else { Socket *connected_socket; -err = server_socket->Accept(addr_wrap, false, connected_socket); +err = server_socket->Accept(connected_socket); if (err.Fail()) { llvm::errs() << err.AsCString(); abort(); Index: unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp === --- unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp +++ unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp @@ -33,15 +33,14 @@ void Connect(GDBRemoteCommunication , GDBRemoteCommunication ) { bool child_processes_inherit = false; Error error; - TCPSocket listen_socket(child_processes_inherit, error); + TCPSocket listen_socket(true, child_processes_inherit); ASSERT_FALSE(error.Fail()); error = listen_socket.Listen("127.0.0.1:0", 5); ASSERT_FALSE(error.Fail()); Socket *accept_socket; std::future accept_error = std::async(std::launch::async, [&] { -return listen_socket.Accept("127.0.0.1:0", child_processes_inherit, -accept_socket); +return listen_socket.Accept(accept_socket); }); char connect_remote_address[64]; Index: unittests/Host/SocketTest.cpp === --- unittests/Host/SocketTest.cpp +++ unittests/Host/SocketTest.cpp @@ -44,8 +44,7 @@ const char *listen_remote_address, bool child_processes_inherit, Socket **accept_socket, Error *error) { -*error = listen_socket->Accept(listen_remote_address, - child_processes_inherit, *accept_socket); +*error = listen_socket->Accept(*accept_socket); } template @@ -56,7 +55,7 @@ bool child_processes_inherit = false; Error error; std::unique_ptr listen_socket_up( -new SocketType(child_processes_inherit, error)); +new SocketType(true, child_processes_inherit)); EXPECT_FALSE(error.Fail()); error = listen_socket_up->Listen(listen_remote_address, 5); EXPECT_FALSE(error.Fail()); @@ -70,7 +69,7 @@ std::string connect_remote_address = get_connect_addr(*listen_socket_up); std::unique_ptr connect_socket_up( -new SocketType(child_processes_inherit, error)); +new SocketType(true, child_processes_inherit)); EXPECT_FALSE(error.Fail()); error = connect_socket_up->Connect(connect_remote_address); EXPECT_FALSE(error.Fail()); @@ -141,6 +140,20 @@ EXPECT_STREQ("65535", port_str.c_str()); EXPECT_EQ(65535, port); EXPECT_TRUE(error.Success()); + + EXPECT_TRUE( + Socket::DecodeHostAndPort("[::1]:12345", host_str, port_str, port, )); + EXPECT_STREQ("::1", host_str.c_str()); + EXPECT_STREQ("12345", port_str.c_str()); + EXPECT_EQ(12345, port); + EXPECT_TRUE(error.Success()); + + EXPECT_TRUE( + Socket::DecodeHostAndPort("[abcd:12fg:AF58::1]:12345", host_str, port_str, port, )); + EXPECT_STREQ("abcd:12fg:AF58::1", host_str.c_str()); + EXPECT_STREQ("12345", port_str.c_str()); + EXPECT_EQ(12345, port); + EXPECT_TRUE(error.Success()); } #ifndef LLDB_DISABLE_POSIX Index: tools/lldb-server/Acceptor.cpp === --- tools/lldb-server/Acceptor.cpp +++ tools/lldb-server/Acceptor.cpp @@ -62,8 +62,7 @@ Error Acceptor::Accept(const bool child_processes_inherit, Connection *) { Socket *conn_socket = nullptr; - auto error = m_listener_socket_up->Accept( -
[Lldb-commits] [PATCH] D31823: Update LLDB Host to support IPv6 over TCP
beanz updated this revision to Diff 95448. beanz added a comment. Updating patches to reflect feedback from zturner. https://reviews.llvm.org/D31823 Files: cmake/modules/LLDBConfig.cmake include/lldb/Host/Config.h include/lldb/Host/Config.h.cmake include/lldb/Host/MainLoop.h include/lldb/Host/Socket.h include/lldb/Host/common/TCPSocket.h include/lldb/Host/common/UDPSocket.h include/lldb/Host/linux/AbstractSocket.h include/lldb/Host/posix/DomainSocket.h include/lldb/Host/posix/MainLoopPosix.h lldb.xcodeproj/project.pbxproj source/Host/CMakeLists.txt source/Host/common/MainLoop.cpp source/Host/common/Socket.cpp source/Host/common/TCPSocket.cpp source/Host/common/UDPSocket.cpp source/Host/linux/AbstractSocket.cpp source/Host/posix/ConnectionFileDescriptorPosix.cpp source/Host/posix/DomainSocket.cpp source/Host/posix/MainLoopPosix.cpp source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp tools/lldb-server/Acceptor.cpp unittests/Host/SocketTest.cpp unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp unittests/debugserver/RNBSocketTest.cpp Index: unittests/debugserver/RNBSocketTest.cpp === --- unittests/debugserver/RNBSocketTest.cpp +++ unittests/debugserver/RNBSocketTest.cpp @@ -96,7 +96,7 @@ ASSERT_EQ(bye, goodbye); } else { Socket *connected_socket; -err = server_socket->Accept(addr_wrap, false, connected_socket); +err = server_socket->Accept(connected_socket); if (err.Fail()) { llvm::errs() << err.AsCString(); abort(); Index: unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp === --- unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp +++ unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp @@ -33,15 +33,14 @@ void Connect(GDBRemoteCommunication , GDBRemoteCommunication ) { bool child_processes_inherit = false; Error error; - TCPSocket listen_socket(child_processes_inherit, error); + TCPSocket listen_socket(true, child_processes_inherit); ASSERT_FALSE(error.Fail()); error = listen_socket.Listen("127.0.0.1:0", 5); ASSERT_FALSE(error.Fail()); Socket *accept_socket; std::future accept_error = std::async(std::launch::async, [&] { -return listen_socket.Accept("127.0.0.1:0", child_processes_inherit, -accept_socket); +return listen_socket.Accept(accept_socket); }); char connect_remote_address[64]; Index: unittests/Host/SocketTest.cpp === --- unittests/Host/SocketTest.cpp +++ unittests/Host/SocketTest.cpp @@ -44,8 +44,7 @@ const char *listen_remote_address, bool child_processes_inherit, Socket **accept_socket, Error *error) { -*error = listen_socket->Accept(listen_remote_address, - child_processes_inherit, *accept_socket); +*error = listen_socket->Accept(*accept_socket); } template @@ -56,7 +55,7 @@ bool child_processes_inherit = false; Error error; std::unique_ptr listen_socket_up( -new SocketType(child_processes_inherit, error)); +new SocketType(true, child_processes_inherit)); EXPECT_FALSE(error.Fail()); error = listen_socket_up->Listen(listen_remote_address, 5); EXPECT_FALSE(error.Fail()); @@ -70,7 +69,7 @@ std::string connect_remote_address = get_connect_addr(*listen_socket_up); std::unique_ptr connect_socket_up( -new SocketType(child_processes_inherit, error)); +new SocketType(true, child_processes_inherit)); EXPECT_FALSE(error.Fail()); error = connect_socket_up->Connect(connect_remote_address); EXPECT_FALSE(error.Fail()); @@ -141,6 +140,20 @@ EXPECT_STREQ("65535", port_str.c_str()); EXPECT_EQ(65535, port); EXPECT_TRUE(error.Success()); + + EXPECT_TRUE( + Socket::DecodeHostAndPort("[::1]:12345", host_str, port_str, port, )); + EXPECT_STREQ("::1", host_str.c_str()); + EXPECT_STREQ("12345", port_str.c_str()); + EXPECT_EQ(12345, port); + EXPECT_TRUE(error.Success()); + + EXPECT_TRUE( + Socket::DecodeHostAndPort("[abcd:12fg:AF58::1]:12345", host_str, port_str, port, )); + EXPECT_STREQ("abcd:12fg:AF58::1", host_str.c_str()); + EXPECT_STREQ("12345", port_str.c_str()); + EXPECT_EQ(12345, port); + EXPECT_TRUE(error.Success()); } #ifndef LLDB_DISABLE_POSIX Index: tools/lldb-server/Acceptor.cpp === --- tools/lldb-server/Acceptor.cpp +++ tools/lldb-server/Acceptor.cpp @@ -62,8 +62,7 @@ Error Acceptor::Accept(const bool child_processes_inherit, Connection *) { Socket *conn_socket = nullptr; - auto error = m_listener_socket_up->Accept( - StringRef(m_name), child_processes_inherit, conn_socket); + auto error =
[Lldb-commits] [lldb] r300455 - Don't ever reduce the timeout of a packet, only increase it.
Author: gclayton Date: Mon Apr 17 11:20:22 2017 New Revision: 300455 URL: http://llvm.org/viewvc/llvm-project?rev=300455=rev Log: Don't ever reduce the timeout of a packet, only increase it. Differential Revision: https://reviews.llvm.org/D32087 Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=300455=300454=300455=diff == --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Mon Apr 17 11:20:22 2017 @@ -1310,12 +1310,20 @@ void GDBRemoteCommunication::DumpHistory GDBRemoteCommunication::ScopedTimeout::ScopedTimeout( GDBRemoteCommunication _comm, std::chrono::seconds timeout) -: m_gdb_comm(gdb_comm) { - m_saved_timeout = m_gdb_comm.SetPacketTimeout(timeout); + : m_gdb_comm(gdb_comm), m_timeout_modified(false) { +auto curr_timeout = gdb_comm.GetPacketTimeout(); +// Only update the timeout if the timeout is greater than the current +// timeout. If the current timeout is larger, then just use that. +if (curr_timeout < timeout) { + m_timeout_modified = true; + m_saved_timeout = m_gdb_comm.SetPacketTimeout(timeout); +} } GDBRemoteCommunication::ScopedTimeout::~ScopedTimeout() { - m_gdb_comm.SetPacketTimeout(m_saved_timeout); + // Only restore the timeout if we set it in the constructor. + if (m_timeout_modified) +m_gdb_comm.SetPacketTimeout(m_saved_timeout); } // This function is called via the Communications class read thread when bytes Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h?rev=300455=300454=300455=diff == --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Mon Apr 17 11:20:22 2017 @@ -89,6 +89,10 @@ public: private: GDBRemoteCommunication _gdb_comm; std::chrono::seconds m_saved_timeout; +// Don't ever reduce the timeout for a packet, only increase it. If the +// requested timeout if less than the current timeout, we don't set it +// and won't need to restore it. +bool m_timeout_modified; }; GDBRemoteCommunication(const char *comm_name, const char *listener_name); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D32087: Modify GDBRemoteCommunication::ScopedTimeout to not ever decrease a timeout
This revision was automatically updated to reflect the committed changes. Closed by commit rL300455: Don't ever reduce the timeout of a packet, only increase it. (authored by gclayton). Changed prior to commit: https://reviews.llvm.org/D32087?vs=95314=95442#toc Repository: rL LLVM https://reviews.llvm.org/D32087 Files: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -1310,12 +1310,20 @@ GDBRemoteCommunication::ScopedTimeout::ScopedTimeout( GDBRemoteCommunication _comm, std::chrono::seconds timeout) -: m_gdb_comm(gdb_comm) { - m_saved_timeout = m_gdb_comm.SetPacketTimeout(timeout); + : m_gdb_comm(gdb_comm), m_timeout_modified(false) { +auto curr_timeout = gdb_comm.GetPacketTimeout(); +// Only update the timeout if the timeout is greater than the current +// timeout. If the current timeout is larger, then just use that. +if (curr_timeout < timeout) { + m_timeout_modified = true; + m_saved_timeout = m_gdb_comm.SetPacketTimeout(timeout); +} } GDBRemoteCommunication::ScopedTimeout::~ScopedTimeout() { - m_gdb_comm.SetPacketTimeout(m_saved_timeout); + // Only restore the timeout if we set it in the constructor. + if (m_timeout_modified) +m_gdb_comm.SetPacketTimeout(m_saved_timeout); } // This function is called via the Communications class read thread when bytes Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -89,6 +89,10 @@ private: GDBRemoteCommunication _gdb_comm; std::chrono::seconds m_saved_timeout; +// Don't ever reduce the timeout for a packet, only increase it. If the +// requested timeout if less than the current timeout, we don't set it +// and won't need to restore it. +bool m_timeout_modified; }; GDBRemoteCommunication(const char *comm_name, const char *listener_name); Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -1310,12 +1310,20 @@ GDBRemoteCommunication::ScopedTimeout::ScopedTimeout( GDBRemoteCommunication _comm, std::chrono::seconds timeout) -: m_gdb_comm(gdb_comm) { - m_saved_timeout = m_gdb_comm.SetPacketTimeout(timeout); + : m_gdb_comm(gdb_comm), m_timeout_modified(false) { +auto curr_timeout = gdb_comm.GetPacketTimeout(); +// Only update the timeout if the timeout is greater than the current +// timeout. If the current timeout is larger, then just use that. +if (curr_timeout < timeout) { + m_timeout_modified = true; + m_saved_timeout = m_gdb_comm.SetPacketTimeout(timeout); +} } GDBRemoteCommunication::ScopedTimeout::~ScopedTimeout() { - m_gdb_comm.SetPacketTimeout(m_saved_timeout); + // Only restore the timeout if we set it in the constructor. + if (m_timeout_modified) +m_gdb_comm.SetPacketTimeout(m_saved_timeout); } // This function is called via the Communications class read thread when bytes Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -89,6 +89,10 @@ private: GDBRemoteCommunication _gdb_comm; std::chrono::seconds m_saved_timeout; +// Don't ever reduce the timeout for a packet, only increase it. If the +// requested timeout if less than the current timeout, we don't set it +// and won't need to restore it. +bool m_timeout_modified; }; GDBRemoteCommunication(const char *comm_name, const char *listener_name); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D32125: [LLVM][MIPS] Fix different definition of off_t in LLDB and LLVM
We already have this exact code in lldb/cmake/LLDBConfig.txt. This fix looks fine, but I see no reason to have it twice, so can you delete the LLDB version? On Mon, Apr 17, 2017 at 7:01 AM Kamil Rytarowski via Phabricator < revi...@reviews.llvm.org> wrote: > krytarowski added a comment. > > Is this just GNU specific? BSD moved to 64-bit off_t on 32-bit platforms > 20+ years ago. > > It's perhaps no-op, but it might be noted in the commit message what > platforms are supposed to be improved. > > > Repository: > rL LLVM > > https://reviews.llvm.org/D32125 > > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D32125: [LLVM][MIPS] Fix different definition of off_t in LLDB and LLVM
krytarowski added a comment. Is this just GNU specific? BSD moved to 64-bit off_t on 32-bit platforms 20+ years ago. It's perhaps no-op, but it might be noted in the commit message what platforms are supposed to be improved. Repository: rL LLVM https://reviews.llvm.org/D32125 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D32125: [LLVM][MIPS] Fix different definition of off_t in LLDB and LLVM
nitesh.jain created this revision. Herald added subscribers: arichardson, mgorny. Fix is to define _LARGEFILE_SOURCE and _FILE_OFFSET_BITS=64. This fix will cause llvm::sys::fs::file_size() to return correct object size. Repository: rL LLVM https://reviews.llvm.org/D32125 Files: CMakeLists.txt Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -458,6 +458,12 @@ option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF) endif() +# If building on a 32-bit system, make sure off_t can store offsets > 2GB +if( CMAKE_SIZEOF_VOID_P EQUAL 4 ) + add_definitions( -D_LARGEFILE_SOURCE ) + add_definitions( -D_FILE_OFFSET_BITS=64 ) +endif() + # Define the default arguments to use with 'lit', and an option for the user to # override. set(LIT_ARGS_DEFAULT "-sv") Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -458,6 +458,12 @@ option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF) endif() +# If building on a 32-bit system, make sure off_t can store offsets > 2GB +if( CMAKE_SIZEOF_VOID_P EQUAL 4 ) + add_definitions( -D_LARGEFILE_SOURCE ) + add_definitions( -D_FILE_OFFSET_BITS=64 ) +endif() + # Define the default arguments to use with 'lit', and an option for the user to # override. set(LIT_ARGS_DEFAULT "-sv") ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits