[Lldb-commits] [PATCH] D35784: [LLD][MIPS] Fix Address::GetAddressClass() to return correct AddressClass based on the load address
clayborg requested changes to this revision. clayborg added a comment. This revision now requires changes to proceed. Two issues we need to resolve: - I don't think AddressClass should have Absolute as a value. Absolute values in symbol tables are just numbers, not necessarily addresses. - This change won't work for ARM Comment at: include/lldb/lldb-enumerations.h:829 + eAddressClassRuntime, + eAddressClassTypeAbsoluteAddress }; I would suggest removing "Address" from the end of the enum name. It is already in an enum that starts with "eAddressClass". I also question why any address class should be absolute. Absolute symbols are usually not addresses, but just values. Comment at: source/Core/Address.cpp:993-1003 + // Get address class based on loaded Section type + SectionSP section_sp(GetSection()); + if (section_sp) { +const SectionType section_type = section_sp->GetType(); +AddressClass addr_class; +addr_class = ObjectFile::SectionTypeToAddressClass(section_type); +if (addr_class != eAddressClassTypeAbsoluteAddress) This won't work correctly for ARM binaries. ".text" can be filled with ARM, Thumb and Data and there is a CPU map that can help unwind this. The above code will just ay "eAddressClassCode" for all ".text". So this won't work. My guess is the right fix here is to check if the address has a valid section before calling the code below and removing all code above. ``` if (!GetSection()) return eAddressClassInvalid; ``` GetFileAddress will just return the m_offset if the section isn't valid. One could argue that Address::GetFileAddress() should only return the file address if the section is valid though, perhaps that should be the change we make here. https://reviews.llvm.org/D35784 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D35784: [LLD][MIPS] Fix Address::GetAddressClass() to return correct AddressClass based on the load address
clayborg added a comment. In your log we see: [10] .text PROGBITS bb80 bb80 00054380 AX 0 0 16 [30] .debug_arangesMIPS_DWARF 0006c24c 0560 0 0 1 .debug_aranges doesn't have a valid address: it is set to 0x0. Not sure how the ELF plug-in is marking these sections, but I am guessing that that is the problem here. https://reviews.llvm.org/D35784 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D35784: [LLD][MIPS] Fix Address::GetAddressClass() to return correct AddressClass based on the load address
clayborg added a comment. (in the above log output .text has a valid address, but .debug_aranges doesn't. We might need to cross correlate withe the program headers to tell if something gets loaded (PT_LOAD) for a given file address. What does the output of: (lldb) image dump sections look like? https://reviews.llvm.org/D35784 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D33213: Use socketpair on all Unix platforms
DemiMarie updated this revision to Diff 108094. DemiMarie added a comment. Initalize connection_fd Otherwise undefined behavior ensues whenever --fd is not passed to lldb-server -g. https://reviews.llvm.org/D33213 Files: tools/lldb-server/lldb-gdbserver.cpp Index: tools/lldb-server/lldb-gdbserver.cpp === --- tools/lldb-server/lldb-gdbserver.cpp +++ tools/lldb-server/lldb-gdbserver.cpp @@ -106,6 +106,7 @@ // than llgs listening for a connection from address on port. {"setsid", no_argument, NULL, 'S'}, // Call setsid() to make llgs run in its own session. +{"fd", required_argument, NULL, 'F'}, {NULL, 0, NULL, 0}}; //-- @@ -132,13 +133,13 @@ "[--log-file log-file-name] " "[--log-channels log-channel-list] " "[--setsid] " + "[--fd file-descriptor]" "[--named-pipe named-pipe-path] " "[--native-regs] " "[--attach pid] " "[[HOST]:PORT] " "[-- PROGRAM ARG1 ARG2 ...]\n", progname, subcommand); - exit(0); } void handle_attach_to_pid(GDBRemoteCommunicationServerLLGS &gdb_server, @@ -232,10 +233,31 @@ GDBRemoteCommunicationServerLLGS &gdb_server, bool reverse_connect, const char *const host_and_port, const char *const progname, const char *const subcommand, - const char *const named_pipe_path, int unnamed_pipe_fd) { + const char *const named_pipe_path, int unnamed_pipe_fd, + int connection_fd) { Status error; - if (host_and_port && host_and_port[0]) { + std::unique_ptr connection_up; + if (connection_fd != -1) { +// Build the connection string. +char connection_url[512]; +snprintf(connection_url, sizeof(connection_url), "fd://%d", connection_fd); + +// Create the connection. +connection_up.reset(new ConnectionFileDescriptor); +auto connection_result = connection_up->Connect(connection_url, &error); +if (connection_result != eConnectionStatusSuccess) { + fprintf(stderr, "error: failed to connect to client at '%s' " + "(connection status: %d)", + connection_url, static_cast(connection_result)); + exit(-1); +} +if (error.Fail()) { + fprintf(stderr, "error: failed to connect to client at '%s': %s", + connection_url, error.AsCString()); + exit(-1); +} + } else if (host_and_port && host_and_port[0]) { // Parse out host and port. std::string final_host_and_port; std::string connection_host; @@ -255,7 +277,6 @@ connection_portno = StringConvert::ToUInt32(connection_port.c_str(), 0); } -std::unique_ptr connection_up; if (reverse_connect) { // llgs will connect to the gdb-remote client. @@ -328,14 +349,14 @@ } connection_up.reset(conn); } -error = gdb_server.InitializeConnection(std::move(connection_up)); -if (error.Fail()) { - fprintf(stderr, "Failed to initialize connection: %s\n", - error.AsCString()); - exit(-1); -} -printf("Connection established.\n"); } + error = gdb_server.InitializeConnection(std::move(connection_up)); + if (error.Fail()) { +fprintf(stderr, "Failed to initialize connection: %s\n", +error.AsCString()); +exit(-1); + } + printf("Connection established.\n"); } //-- @@ -364,6 +385,7 @@ log_channels; // e.g. "lldb process threads:gdb-remote default:linux all" int unnamed_pipe_fd = -1; bool reverse_connect = false; + int connection_fd = -1; // ProcessLaunchInfo launch_info; ProcessAttachInfo attach_info; @@ -413,6 +435,10 @@ reverse_connect = true; break; +case 'F': + connection_fd = StringConvert::ToUInt32(optarg, -1); + break; + #ifndef _WIN32 case 'S': // Put llgs into a new session. Terminals group processes @@ -472,7 +498,8 @@ argc -= optind; argv += optind; - if (argc == 0) { + if (argc == 0 && connection_fd == -1) { +fputs("No arguments\n", stderr); display_usage(progname, subcommand); exit(255); } @@ -501,7 +528,7 @@ ConnectToRemote(mainloop, gdb_server, reverse_connect, host_and_port, progname, subcommand, named_pipe_path.c_str(), - unnamed_pipe_fd); + unnamed_pipe_fd, connection_fd); if (!gdb_server.IsConnected()) { fprintf(stderr, "no connection information provided, unable to run\n"); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D35784: [LLD][MIPS] Fix Address::GetAddressClass() to return correct AddressClass based on the load address
clayborg added a comment. Looking at an ELF file with DWARF, I see: (lldb) image dump sections Dumping sections for 1 modules. Sections for '/Volumes/android/aosp/out/target/product/generic/symbols/system/lib/libart.so' (arm): SectID Type File Address Perm File Off. File Size Flags Section Name -- --- -- -- -- 0x0001 regular --- 0x 0x 0x libart.so. 0x0002 regular [0x0154-0x0167) r-- 0x0154 0x0013 0x0002 libart.so..interp 0x0003 elf-dynamic-symbols [0x0168-0x00010d18) r-- 0x0168 0x00010bb0 0x0002 libart.so..dynsym 0x0004 regular [0x00010d18-0x0005228f) r-- 0x00010d18 0x00041577 0x0002 libart.so..dynstr 0x0005 regular [0x00052290-0x0005a590) r-- 0x00052290 0x8300 0x0002 libart.so..hash 0x0006 elf-relocation-entries [0x0005a590-0x00067870) r-- 0x0005a590 0xd2e0 0x0002 libart.so..rel.dyn 0x0007 elf-relocation-entries [0x00067870-0x00068398) r-- 0x00067870 0x0b28 0x0002 libart.so..rel.plt 0x0008 regular [0x00068398-0x00069468) r-x 0x00068398 0x10d0 0x0006 libart.so..plt 0x0009 code [0x00069470-0x002a94f8) r-x 0x00069470 0x00240088 0x0006 libart.so..text 0x000a ARM.exidx[0x002a94f8-0x002b12d0) r-- 0x002a94f8 0x7dd8 0x0082 libart.so..ARM.exidx 0x000b ARM.extab[0x002b12d0-0x002b1e44) r-- 0x002b12d0 0x0b74 0x0002 libart.so..ARM.extab 0x000c regular [0x002b1e48-0x002e39e4) r-- 0x002b1e48 0x00031b9c 0x0002 libart.so..rodata 0x000d eh-frame [0x002e39e4-0x002e5fa8) r-- 0x002e39e4 0x25c4 0x0002 libart.so..eh_frame 0x000e regular [0x002e5fa8-0x002e63d4) r-- 0x002e5fa8 0x042c 0x0002 libart.so..eh_frame_hdr 0x000f regular [0x002e7e38-0x002eaa24) rw- 0x002e6e38 0x2bec 0x0003 libart.so..data.rel.ro.local 0x0010 regular [0x002eaa24-0x002eaa28) rw- 0x002e9a24 0x0004 0x0003 libart.so..fini_array 0x0011 regular [0x002eaa28-0x002ee370) rw- 0x002e9a28 0x3948 0x0003 libart.so..data.rel.ro 0x0012 regular [0x002ee370-0x002ee3c0) rw- 0x002ed370 0x0050 0x0003 libart.so..init_array 0x0013 elf-dynamic-link-info [0x002ee3c0-0x002ee4f0) rw- 0x002ed3c0 0x0130 0x0003 libart.so..dynamic 0x0014 regular [0x002ee4f4-0x002ef000) rw- 0x002ed4f4 0x0b0c 0x0003 libart.so..got 0x0015 data [0x002ef000-0x002ef8c4) rw- 0x002ee000 0x08c4 0x0003 libart.so..data 0x0016 zero-fill[0x002ef8c8-0x002f11fc) rw- 0x002ee8c8 0x 0x0003 libart.so..bss 0x0017 regular --- 0x002ee8c4 0x0010 0x0030 libart.so..comment 0x0018 dwarf-line--- 0x002ee8d4 0x002c10eb 0x libart.so..debug_line 0x0019 dwarf-info--- 0x005af9bf 0x054eb22a 0x libart.so..debug_info 0x001a dwarf-abbrev --- 0x05a9abe9 0x000f5e5b 0x libart.so..debug_abbrev 0x001b dwarf-aranges --- 0x05b90a48 0x00011960 0x libart.so..debug_aranges 0x001c dwarf-loc --- 0x05ba23a8 0x00a0d623 0x libart.so..debug_loc 0x001d dwarf-ranges --- 0x065af9cb 0x0029c7b0 0x libart.so..debug_ranges 0x001e dwarf-macro --- 0x0684c17b 0x000ada15 0x libart.so..debug_macro 0x001f dwarf-str --- 0x068f9b90 0x004a45e9 0x0030 libart.so..debug_str 0x0020 dwarf-frame --- 0x06d9e17c 0x0003fc6c 0x libart.so..debug_frame 0x0021 regular --- 0x06e8 0x001c 0x libart.so..note.gnu.gold-version 0x0022 regular --- 0x06ddde04 0x0038 0x
[Lldb-commits] [PATCH] D33213: Use socketpair on all Unix platforms
clayborg added a comment. So where did the other changes go where we use "--fd" for non Apple builds? Did those changes get lost? They will be needed. Are you able to run the test suite now? https://reviews.llvm.org/D33213 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r308993 - [TypeSystem] Guard the global `ASTSourceMap` with a mutex
Author: spyffe Date: Tue Jul 25 10:33:37 2017 New Revision: 308993 URL: http://llvm.org/viewvc/llvm-project?rev=308993&view=rev Log: [TypeSystem] Guard the global `ASTSourceMap` with a mutex s_source_map in ClangExternalASTSourceCommon.cpp is unguarded and therefore can break in multithreaded conditions. This can cause crashes in particular if multiple targets are being set up at once. This patch wraps s_source_map in a function that ensures exclusivity, and makes every user of it use that function instead. lldb crashes after "resume_off" Differential Revision: https://reviews.llvm.org/D35083 Modified: lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp Modified: lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp?rev=308993&r1=308992&r2=308993&view=diff == --- lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp (original) +++ lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp Tue Jul 25 10:33:37 2017 @@ -10,6 +10,8 @@ #include "lldb/Symbol/ClangExternalASTSourceCommon.h" #include "lldb/Utility/Stream.h" +#include + using namespace lldb_private; uint64_t g_TotalSizeOfMetadata = 0; @@ -18,15 +20,19 @@ typedef llvm::DenseMap ASTSourceMap; -static ASTSourceMap &GetSourceMap() { +static ASTSourceMap &GetSourceMap(std::unique_lock &guard) { // Intentionally leaked to avoid problems with global destructors. static ASTSourceMap *s_source_map = new ASTSourceMap; + static std::mutex s_mutex; + std::unique_lock locked_guard(s_mutex); + guard.swap(locked_guard); return *s_source_map; } ClangExternalASTSourceCommon * ClangExternalASTSourceCommon::Lookup(clang::ExternalASTSource *source) { - ASTSourceMap &source_map = GetSourceMap(); + std::unique_lock guard; + ASTSourceMap &source_map = GetSourceMap(guard); ASTSourceMap::iterator iter = source_map.find(source); @@ -40,11 +46,13 @@ ClangExternalASTSourceCommon::Lookup(cla ClangExternalASTSourceCommon::ClangExternalASTSourceCommon() : clang::ExternalASTSource() { g_TotalSizeOfMetadata += m_metadata.size(); - GetSourceMap()[this] = this; + std::unique_lock guard; + GetSourceMap(guard)[this] = this; } ClangExternalASTSourceCommon::~ClangExternalASTSourceCommon() { - GetSourceMap().erase(this); + std::unique_lock guard; + GetSourceMap(guard).erase(this); g_TotalSizeOfMetadata -= m_metadata.size(); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D35083: [TypeSystem] Guard the global `ASTSourceMap` with a mutex
This revision was automatically updated to reflect the committed changes. Closed by commit rL308993: [TypeSystem] Guard the global `ASTSourceMap` with a mutex (authored by spyffe). Changed prior to commit: https://reviews.llvm.org/D35083?vs=106087&id=108116#toc Repository: rL LLVM https://reviews.llvm.org/D35083 Files: lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp Index: lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp === --- lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp +++ lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp @@ -10,23 +10,29 @@ #include "lldb/Symbol/ClangExternalASTSourceCommon.h" #include "lldb/Utility/Stream.h" +#include + using namespace lldb_private; uint64_t g_TotalSizeOfMetadata = 0; typedef llvm::DenseMap ASTSourceMap; -static ASTSourceMap &GetSourceMap() { +static ASTSourceMap &GetSourceMap(std::unique_lock &guard) { // Intentionally leaked to avoid problems with global destructors. static ASTSourceMap *s_source_map = new ASTSourceMap; + static std::mutex s_mutex; + std::unique_lock locked_guard(s_mutex); + guard.swap(locked_guard); return *s_source_map; } ClangExternalASTSourceCommon * ClangExternalASTSourceCommon::Lookup(clang::ExternalASTSource *source) { - ASTSourceMap &source_map = GetSourceMap(); + std::unique_lock guard; + ASTSourceMap &source_map = GetSourceMap(guard); ASTSourceMap::iterator iter = source_map.find(source); @@ -40,11 +46,13 @@ ClangExternalASTSourceCommon::ClangExternalASTSourceCommon() : clang::ExternalASTSource() { g_TotalSizeOfMetadata += m_metadata.size(); - GetSourceMap()[this] = this; + std::unique_lock guard; + GetSourceMap(guard)[this] = this; } ClangExternalASTSourceCommon::~ClangExternalASTSourceCommon() { - GetSourceMap().erase(this); + std::unique_lock guard; + GetSourceMap(guard).erase(this); g_TotalSizeOfMetadata -= m_metadata.size(); } Index: lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp === --- lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp +++ lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp @@ -10,23 +10,29 @@ #include "lldb/Symbol/ClangExternalASTSourceCommon.h" #include "lldb/Utility/Stream.h" +#include + using namespace lldb_private; uint64_t g_TotalSizeOfMetadata = 0; typedef llvm::DenseMap ASTSourceMap; -static ASTSourceMap &GetSourceMap() { +static ASTSourceMap &GetSourceMap(std::unique_lock &guard) { // Intentionally leaked to avoid problems with global destructors. static ASTSourceMap *s_source_map = new ASTSourceMap; + static std::mutex s_mutex; + std::unique_lock locked_guard(s_mutex); + guard.swap(locked_guard); return *s_source_map; } ClangExternalASTSourceCommon * ClangExternalASTSourceCommon::Lookup(clang::ExternalASTSource *source) { - ASTSourceMap &source_map = GetSourceMap(); + std::unique_lock guard; + ASTSourceMap &source_map = GetSourceMap(guard); ASTSourceMap::iterator iter = source_map.find(source); @@ -40,11 +46,13 @@ ClangExternalASTSourceCommon::ClangExternalASTSourceCommon() : clang::ExternalASTSource() { g_TotalSizeOfMetadata += m_metadata.size(); - GetSourceMap()[this] = this; + std::unique_lock guard; + GetSourceMap(guard)[this] = this; } ClangExternalASTSourceCommon::~ClangExternalASTSourceCommon() { - GetSourceMap().erase(this); + std::unique_lock guard; + GetSourceMap(guard).erase(this); g_TotalSizeOfMetadata -= m_metadata.size(); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r309019 - Improve the fix for PR33875 by not hardcoding the section name.
Author: adrian Date: Tue Jul 25 13:12:25 2017 New Revision: 309019 URL: http://llvm.org/viewvc/llvm-project?rev=309019&view=rev Log: Improve the fix for PR33875 by not hardcoding the section name. This is a follow-up to r308905. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp?rev=309019&r1=309018&r2=309019&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp Tue Jul 25 13:12:25 2017 @@ -61,13 +61,13 @@ SymbolFileDWARFDwo::ParseCompileUnit(DWA } DWARFCompileUnit *SymbolFileDWARFDwo::GetCompileUnit() { - // Clang modules are found via a skeleton CU, but are not DWO - // objects. Clang modules have a .debug_info section instead of the - // *_dwo variant. Note that this is hardcoding the ELF section name - // based on the assumption that Mach-O does not use DWO objects. + // A clang module is found via a skeleton CU, but is not a proper DWO. + // Clang modules have a .debug_info section instead of the *_dwo variant. if (auto *section_list = m_obj_file->GetSectionList(false)) -if (section_list->FindSectionByName(ConstString(".debug_info"))) - return nullptr; +if (auto section_sp = +section_list->FindSectionByType(eSectionTypeDWARFDebugInfo, true)) + if (!section_sp->GetName().GetStringRef().endswith("dwo")) +return nullptr; // Only dwo files with 1 compile unit is supported if (GetNumCompileUnits() == 1) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r309020 - [CMake] Add debugserver entitlements
Author: cbieneman Date: Tue Jul 25 13:29:28 2017 New Revision: 309020 URL: http://llvm.org/viewvc/llvm-project?rev=309020&view=rev Log: [CMake] Add debugserver entitlements When consigning debugserver we should also include the entitlements file on the code sign command. Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/CMakeLists.txt?rev=309020&r1=309019&r2=309020&view=diff == --- lldb/trunk/tools/debugserver/source/CMakeLists.txt (original) +++ lldb/trunk/tools/debugserver/source/CMakeLists.txt Tue Jul 25 13:29:28 2017 @@ -95,10 +95,8 @@ add_library(lldbDebugserverCommon ${lldb if (APPLE) if(IOS) find_library(COCOA_LIBRARY UIKit) -target_link_libraries(lldbDebugserverCommon INTERFACE ${COCOA_LIBRARY} ${CORE_FOUNDATION_LIBRARY} ${FOUNDATION_LIBRARY}) else() find_library(COCOA_LIBRARY Cocoa) -target_link_libraries(lldbDebugserverCommon INTERFACE ${COCOA_LIBRARY}) endif() endif() @@ -117,6 +115,11 @@ add_lldb_tool(debugserver INCLUDE_IN_FRA lldbDebugserverCommon ) +set(entitlements_xml ${CMAKE_CURRENT_SOURCE_DIR}/debugserver-macosx-entitlements.plist) +if(IOS) + set(entitlements_xml ${CMAKE_CURRENT_SOURCE_DIR}/debugserver-entitlements.plist) +endif() + set(LLDB_CODESIGN_IDENTITY "lldb_codesign" CACHE STRING "Identity used for code signing. Set to empty string to skip the signing step.") if (NOT ("${LLDB_CODESIGN_IDENTITY}" STREQUAL "")) @@ -129,6 +132,7 @@ if (NOT ("${LLDB_CODESIGN_IDENTITY}" STR POST_BUILD COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${LLDB_CODESIGN_IDENTITY} +--entitlements ${entitlements_xml} $ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r309021 - [CMake] Cleanup unnecessary definition
Author: cbieneman Date: Tue Jul 25 13:29:45 2017 New Revision: 309021 URL: http://llvm.org/viewvc/llvm-project?rev=309021&view=rev Log: [CMake] Cleanup unnecessary definition This is only used in one file, and we already set it correctly on that file, so we don't need to set this everywhere. Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=309021&r1=309020&r2=309021&view=diff == --- lldb/trunk/cmake/modules/LLDBConfig.cmake (original) +++ lldb/trunk/cmake/modules/LLDBConfig.cmake Tue Jul 25 13:29:45 2017 @@ -22,10 +22,6 @@ elseif(IOS) set(LLDB_DEFAULT_DISABLE_PYTHON 1) endif() -if(IOS) - add_definitions(-DNO_XPC_SERVICES) -endif() - set(LLDB_DISABLE_PYTHON ${LLDB_DEFAULT_DISABLE_PYTHON} CACHE BOOL "Disables the Python scripting integration.") set(LLDB_DISABLE_CURSES ${LLDB_DEFAULT_DISABLE_CURSES} CACHE BOOL @@ -282,6 +278,8 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) PATTERN ".svn" EXCLUDE PATTERN ".cmake" EXCLUDE PATTERN "Config.h" EXCLUDE +PATTERN "lldb-*.h" EXCLUDE +PATTERN "API/*.h" EXCLUDE ) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ @@ -291,6 +289,8 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) PATTERN "*.h" PATTERN ".svn" EXCLUDE PATTERN ".cmake" EXCLUDE +PATTERN "lldb-*.h" EXCLUDE +PATTERN "API/*.h" EXCLUDE ) endif() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r309022 - [CMake] NFC. Cleanup unnecessary CMake policy
Author: cbieneman Date: Tue Jul 25 13:30:18 2017 New Revision: 309022 URL: http://llvm.org/viewvc/llvm-project?rev=309022&view=rev Log: [CMake] NFC. Cleanup unnecessary CMake policy This is just setting to the default behavior, so it does nothing. Modified: lldb/trunk/cmake/modules/LLDBStandalone.cmake Modified: lldb/trunk/cmake/modules/LLDBStandalone.cmake URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBStandalone.cmake?rev=309022&r1=309021&r2=309022&view=diff == --- lldb/trunk/cmake/modules/LLDBStandalone.cmake (original) +++ lldb/trunk/cmake/modules/LLDBStandalone.cmake Tue Jul 25 13:30:18 2017 @@ -3,10 +3,6 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) project(lldb) - if (POLICY CMP0022) -cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required - endif() - option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF) # Rely on llvm-config. ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r309023 - [CMake] Fix framework build
Author: cbieneman Date: Tue Jul 25 13:30:35 2017 New Revision: 309023 URL: http://llvm.org/viewvc/llvm-project?rev=309023&view=rev Log: [CMake] Fix framework build The LLDB framework build looks for the swig-generated source in the wrong place. This should resolve that. Modified: lldb/trunk/CMakeLists.txt Modified: lldb/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=309023&r1=309022&r2=309023&view=diff == --- lldb/trunk/CMakeLists.txt (original) +++ lldb/trunk/CMakeLists.txt Tue Jul 25 13:30:35 2017 @@ -32,14 +32,16 @@ if (NOT LLDB_DISABLE_PYTHON) endif() set(LLDB_PYTHON_TARGET_DIR ${LLDB_BINARY_DIR}/scripts) + set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp) if(LLDB_BUILD_FRAMEWORK) set(LLDB_PYTHON_TARGET_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}) +set(LLDB_WRAP_PYTHON ${LLDB_PYTHON_TARGET_DIR}/LLDBWrapPython.cpp) else() # Don't set -m when building the framework. set(FINISH_EXTRA_ARGS "-m") endif() - set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp) + add_subdirectory(scripts) endif () ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r309024 - [CMake] Rework construction of framework bundle
Author: cbieneman Date: Tue Jul 25 13:30:58 2017 New Revision: 309024 URL: http://llvm.org/viewvc/llvm-project?rev=309024&view=rev Log: [CMake] Rework construction of framework bundle This adds an explicit step for processing the headers and restructures how the framework bundles are constructed. This should make the frameworks more reliably constructed. Added: lldb/trunk/scripts/framework-header-fix.sh (with props) Modified: lldb/trunk/source/API/CMakeLists.txt Added: lldb/trunk/scripts/framework-header-fix.sh URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/framework-header-fix.sh?rev=309024&view=auto == --- lldb/trunk/scripts/framework-header-fix.sh (added) +++ lldb/trunk/scripts/framework-header-fix.sh Tue Jul 25 13:30:58 2017 @@ -0,0 +1,13 @@ +#!/bin/sh +# Usage: framework-header-fix.sh +for file in `find $1 -name "*.h"` +do + sed -i '' 's/\(#include\)[ ]*"lldb\/\(API\/\)\{0,1\}\(.*\)"/\1 /1' "$file" + sed -i '' 's|http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/CMakeLists.txt?rev=309024&r1=309023&r2=309024&view=diff == --- lldb/trunk/source/API/CMakeLists.txt (original) +++ lldb/trunk/source/API/CMakeLists.txt Tue Jul 25 13:30:58 2017 @@ -156,19 +156,41 @@ endif() target_link_libraries(liblldb PRIVATE ${LLDB_SYSTEM_LIBS}) if(LLDB_BUILD_FRAMEWORK) - file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h) + file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h + ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h) + file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h) + + foreach(header ${root_public_headers}) +list(APPEND copy_headers_commands + COMMAND ${CMAKE_COMMAND} -E copy ${header} ${LLDB_SOURCE_DIR}/include/lldb/API ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders) + endforeach() + + foreach(header ${public_headers} ${root_public_headers}) +get_filename_component(basename ${header} NAME) +list(APPEND framework_headers ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/${basename}) + endforeach() + + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/LLDB.h +COMMAND ${CMAKE_COMMAND} -E copy_directory ${LLDB_SOURCE_DIR}/include/lldb/API ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders +${copy_headers_commands} +COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders ${LLDB_VERSION} +) + add_custom_target(lldb-framework-headers DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/LLDB.h) + add_dependencies(liblldb lldb-framework-headers) + set_target_properties(liblldb PROPERTIES OUTPUT_NAME LLDB FRAMEWORK On FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION} LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR} -PUBLIC_HEADER "${public_headers}") +PUBLIC_HEADER "${framework_headers}") add_custom_command(TARGET liblldb POST_BUILD -COMMAND ${CMAKE_COMMAND} -E make_directory $/Versions/${LLDB_FRAMEWORK_VERSION} -COMMAND ${CMAKE_COMMAND} -E copy_directory ${LLDB_SOURCE_DIR}/include/lldb/API $/Headers -COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Headers +COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders $/Headers +COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Headers +COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_FRAMEWORK_VERSION} ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/Current COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} $/Resources/Clang ) + endif() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r309025 - [CMake] Update Framework construction for iOS
Author: cbieneman Date: Tue Jul 25 13:31:15 2017 New Revision: 309025 URL: http://llvm.org/viewvc/llvm-project?rev=309025&view=rev Log: [CMake] Update Framework construction for iOS On iOS frameworks don't have versions or resources, they are flatter bundles. This updates the LLDB framework build to accommodate the flatter bundles. Modified: lldb/trunk/cmake/modules/AddLLDB.cmake lldb/trunk/source/API/CMakeLists.txt Modified: lldb/trunk/cmake/modules/AddLLDB.cmake URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=309025&r1=309024&r2=309025&view=diff == --- lldb/trunk/cmake/modules/AddLLDB.cmake (original) +++ lldb/trunk/cmake/modules/AddLLDB.cmake Tue Jul 25 13:31:15 2017 @@ -101,11 +101,15 @@ function(add_lldb_executable name) if(LLDB_BUILD_FRAMEWORK) if(ARG_INCLUDE_IN_FRAMEWORK) + if(NOT IOS) +set(resource_dir "/Resources") +set(resource_dots "../") + endif() string(REGEX REPLACE "[^/]+" ".." _dots ${LLDB_FRAMEWORK_INSTALL_DIR}) set_target_properties(${name} PROPERTIES -RUNTIME_OUTPUT_DIRECTORY $/Resources +RUNTIME_OUTPUT_DIRECTORY $${resource_dir} BUILD_WITH_INSTALL_RPATH On -INSTALL_RPATH "@loader_path/../../../../${_dots}/${LLDB_FRAMEWORK_INSTALL_DIR}") +INSTALL_RPATH "@loader_path/../../../${resource_dots}${_dots}/${LLDB_FRAMEWORK_INSTALL_DIR}") # For things inside the framework we don't need functional install targets # because CMake copies the resources and headers from the build directory. # But we still need this target to exist in order to use the Modified: lldb/trunk/source/API/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/CMakeLists.txt?rev=309025&r1=309024&r2=309025&view=diff == --- lldb/trunk/source/API/CMakeLists.txt (original) +++ lldb/trunk/source/API/CMakeLists.txt Tue Jul 25 13:31:15 2017 @@ -185,12 +185,18 @@ if(LLDB_BUILD_FRAMEWORK) LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR} PUBLIC_HEADER "${framework_headers}") - add_custom_command(TARGET liblldb POST_BUILD -COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders $/Headers -COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Headers -COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_FRAMEWORK_VERSION} ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/Current -COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} $/Resources/Clang -) + if(NOT IOS) +add_custom_command(TARGET liblldb POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders $/Headers + COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Headers + COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_FRAMEWORK_VERSION} ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/Current + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} $/Resources/Clang + ) + else() +add_custom_command(TARGET liblldb POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders $/Headers + ) + endif() endif() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r309026 - [CMake] Build debugserver & debugserver_nonui
Author: cbieneman Date: Tue Jul 25 13:31:53 2017 New Revision: 309026 URL: http://llvm.org/viewvc/llvm-project?rev=309026&view=rev Log: [CMake] Build debugserver & debugserver_nonui When building for iOS we build two variants of debugserver. One which supports UI functionality like Springboard for launching applications, and one which does not. This patch adds support for building debugserver with and without UI support libraries being available. Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/CMakeLists.txt?rev=309026&r1=309025&r2=309026&view=diff == --- lldb/trunk/tools/debugserver/source/CMakeLists.txt (original) +++ lldb/trunk/tools/debugserver/source/CMakeLists.txt Tue Jul 25 13:31:53 2017 @@ -94,26 +94,72 @@ add_library(lldbDebugserverCommon ${lldb if (APPLE) if(IOS) -find_library(COCOA_LIBRARY UIKit) +find_library(BACKBOARD_LIBRARY BackBoardServices + PATHS ${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks) +find_library(FRONTBOARD_LIBRARY FrontBoardServices + PATHS ${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks) +find_library(SPRINGBOARD_LIBRARY SpringBoardServices + PATHS ${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks) +find_library(MOBILESERVICES_LIBRARY MobileCoreServices + PATHS ${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks) +find_library(LOCKDOWN_LIBRARY lockdown) + +if(NOT BACKBOARD_LIBRARY) + set(SKIP_DEBUGSERVER True) +endif() else() find_library(COCOA_LIBRARY Cocoa) endif() endif() -target_link_libraries(lldbDebugserverCommon +if(NOT SKIP_DEBUGSERVER) + target_link_libraries(lldbDebugserverCommon +INTERFACE ${COCOA_LIBRARY} +${CORE_FOUNDATION_LIBRARY} +${FOUNDATION_LIBRARY} +${BACKBOARD_LIBRARY} +${FRONTBOARD_LIBRARY} +${SPRINGBOARD_LIBRARY} +${MOBILESERVICES_LIBRARY} +${LOCKDOWN_LIBRARY} +lldbDebugserverArchSupport +lldbDebugserverDarwin_DarwinLog) + + set(LLVM_OPTIONAL_SOURCES ${lldbDebugserverCommonSources}) + add_lldb_tool(debugserver INCLUDE_IN_FRAMEWORK +debugserver.cpp + +LINK_LIBS + lldbDebugserverCommon +) + if(IOS) +set_property(TARGET lldbDebugserverCommon APPEND PROPERTY COMPILE_DEFINITIONS + WITH_LOCKDOWN + WITH_FBS + WITH_BKS + ) +set_property(TARGET lldbDebugserverCommon APPEND PROPERTY COMPILE_FLAGS + -F${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks + ) + endif() +endif() + +if(IOS) + add_library(lldbDebugserverCommon_NonUI ${lldbDebugserverCommonSources}) + target_link_libraries(lldbDebugserverCommon_NonUI INTERFACE ${COCOA_LIBRARY} ${CORE_FOUNDATION_LIBRARY} ${FOUNDATION_LIBRARY} lldbDebugserverArchSupport lldbDebugserverDarwin_DarwinLog) -set(LLVM_OPTIONAL_SOURCES ${lldbDebugserverCommonSources}) -add_lldb_tool(debugserver INCLUDE_IN_FRAMEWORK - debugserver.cpp + add_lldb_tool(debugserver_nonui INCLUDE_IN_FRAMEWORK +debugserver.cpp - LINK_LIBS -lldbDebugserverCommon - ) +LINK_LIBS + lldbDebugserverCommon_NonUI +) +endif() set(entitlements_xml ${CMAKE_CURRENT_SOURCE_DIR}/debugserver-macosx-entitlements.plist) if(IOS) @@ -136,6 +182,16 @@ if (NOT ("${LLDB_CODESIGN_IDENTITY}" STR $ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) + if(IOS) +add_custom_command(TARGET debugserver_nonui + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} + codesign --force --sign ${LLDB_CODESIGN_IDENTITY} + --entitlements ${entitlements_xml} + $ + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin +) + endif() endif() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r309046 - Skip test_unique_stacks on Darwin, because it doesn't terminate reliably.
Author: spyffe Date: Tue Jul 25 15:44:34 2017 New Revision: 309046 URL: http://llvm.org/viewvc/llvm-project?rev=309046&view=rev Log: Skip test_unique_stacks on Darwin, because it doesn't terminate reliably. rdar://problem/33462362 Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py?rev=309046&r1=309045&r2=309046&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py Tue Jul 25 15:44:34 2017 @@ -8,6 +8,7 @@ from __future__ import print_function import os import time import lldb +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * import lldbsuite.test.lldbutil as lldbutil @@ -60,7 +61,8 @@ class NumberOfThreadsTestCase(TestBase): self.assertTrue( num_threads >= 13, 'Number of expected threads and actual threads do not match.') - + +@skipIfDarwin # rdar://33462362 def test_unique_stacks(self): """Test backtrace unique with multiple threads executing the same stack.""" self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D33213: Use socketpair on all Unix platforms
DemiMarie updated this revision to Diff 108214. DemiMarie added a comment. Actually use socketpair :) https://reviews.llvm.org/D33213 Files: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp tools/lldb-server/lldb-gdbserver.cpp Index: tools/lldb-server/lldb-gdbserver.cpp === --- tools/lldb-server/lldb-gdbserver.cpp +++ tools/lldb-server/lldb-gdbserver.cpp @@ -106,6 +106,7 @@ // than llgs listening for a connection from address on port. {"setsid", no_argument, NULL, 'S'}, // Call setsid() to make llgs run in its own session. +{"fd", required_argument, NULL, 'F'}, {NULL, 0, NULL, 0}}; //-- @@ -132,13 +133,13 @@ "[--log-file log-file-name] " "[--log-channels log-channel-list] " "[--setsid] " + "[--fd file-descriptor]" "[--named-pipe named-pipe-path] " "[--native-regs] " "[--attach pid] " "[[HOST]:PORT] " "[-- PROGRAM ARG1 ARG2 ...]\n", progname, subcommand); - exit(0); } void handle_attach_to_pid(GDBRemoteCommunicationServerLLGS &gdb_server, @@ -232,10 +233,31 @@ GDBRemoteCommunicationServerLLGS &gdb_server, bool reverse_connect, const char *const host_and_port, const char *const progname, const char *const subcommand, - const char *const named_pipe_path, int unnamed_pipe_fd) { + const char *const named_pipe_path, int unnamed_pipe_fd, + int connection_fd) { Status error; - if (host_and_port && host_and_port[0]) { + std::unique_ptr connection_up; + if (connection_fd != -1) { +// Build the connection string. +char connection_url[512]; +snprintf(connection_url, sizeof(connection_url), "fd://%d", connection_fd); + +// Create the connection. +connection_up.reset(new ConnectionFileDescriptor); +auto connection_result = connection_up->Connect(connection_url, &error); +if (connection_result != eConnectionStatusSuccess) { + fprintf(stderr, "error: failed to connect to client at '%s' " + "(connection status: %d)", + connection_url, static_cast(connection_result)); + exit(-1); +} +if (error.Fail()) { + fprintf(stderr, "error: failed to connect to client at '%s': %s", + connection_url, error.AsCString()); + exit(-1); +} + } else if (host_and_port && host_and_port[0]) { // Parse out host and port. std::string final_host_and_port; std::string connection_host; @@ -255,7 +277,6 @@ connection_portno = StringConvert::ToUInt32(connection_port.c_str(), 0); } -std::unique_ptr connection_up; if (reverse_connect) { // llgs will connect to the gdb-remote client. @@ -328,14 +349,14 @@ } connection_up.reset(conn); } -error = gdb_server.InitializeConnection(std::move(connection_up)); -if (error.Fail()) { - fprintf(stderr, "Failed to initialize connection: %s\n", - error.AsCString()); - exit(-1); -} -printf("Connection established.\n"); } + error = gdb_server.InitializeConnection(std::move(connection_up)); + if (error.Fail()) { +fprintf(stderr, "Failed to initialize connection: %s\n", +error.AsCString()); +exit(-1); + } + printf("Connection established.\n"); } //-- @@ -364,6 +385,7 @@ log_channels; // e.g. "lldb process threads:gdb-remote default:linux all" int unnamed_pipe_fd = -1; bool reverse_connect = false; + int connection_fd = -1; // ProcessLaunchInfo launch_info; ProcessAttachInfo attach_info; @@ -413,6 +435,10 @@ reverse_connect = true; break; +case 'F': + connection_fd = StringConvert::ToUInt32(optarg, -1); + break; + #ifndef _WIN32 case 'S': // Put llgs into a new session. Terminals group processes @@ -472,7 +498,8 @@ argc -= optind; argv += optind; - if (argc == 0) { + if (argc == 0 && connection_fd == -1) { +fputs("No arguments\n", stderr); display_usage(progname, subcommand); exit(255); } @@ -501,7 +528,7 @@ ConnectToRemote(mainloop, gdb_server, reverse_connect, host_and_port, progname, subcommand, named_pipe_path.c_str(), - unnamed_pipe_fd); + unnamed_pipe_fd, connection_fd); if (!gdb_server.IsConnected()) { fprintf(stderr, "no connection information provided, unable to run\n"); Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp === --- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++
[Lldb-commits] [PATCH] D33213: Use socketpair on all Unix platforms
DemiMarie added a comment. In https://reviews.llvm.org/D33213#820238, @clayborg wrote: > So where did the other changes go where we use "--fd" for non Apple builds? > Did those changes get lost? They will be needed. > > Are you able to run the test suite now? I did. Not all tests passed, but none of the failures appeared to be related to this change. https://reviews.llvm.org/D33213 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits