[Lldb-commits] [lldb] r276254 - Add a new DynamicLoader plugin that uses SPI that are in development
Author: jmolenda Date: Thu Jul 21 03:30:55 2016 New Revision: 276254 URL: http://llvm.org/viewvc/llvm-project?rev=276254&view=rev Log: Add a new DynamicLoader plugin that uses SPI that are in development for the fall (northern hemisphere) 2016 Darwin platforms to learn about loaded images, instead of reading dyld internal data structures. These new SPI don't exist on older releases, and new packets are needed from debugserver to use them (those changes are already committed). I had to change the minimum deployment target for debugserver in the xcode project file to macOS 10.10 so that debugserver will use the [[NSProcessInfo processInfo] operatingSystemVersion] call in MachProcess::GetOSVersionNumbers to get the operarting system version # -- this API is only available in macOS 10.10 and newer ("OS X Yosemite", released Oct 2014). If we have many people building llvm.org lldb on older systems still, we can back off on this for the llvm.org sources. There should be no change in behavior with this commit, either to older darwin systems or newer darwin systems. For now the new DynamicLoader plugin is never activated - I'm forcing the old plugin to be used in DynamicLoaderDarwin::UseDYLDSPI. I'll remove that unconditional use of the old plugin soon, so the newer plugin is used on the newest Darwin platforms. Added: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h Modified: lldb/trunk/include/lldb/Target/Process.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Modified: lldb/trunk/include/lldb/Target/Process.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=276254&r1=276253&r2=276254&view=diff == --- lldb/trunk/include/lldb/Target/Process.h (original) +++ lldb/trunk/include/lldb/Target/Process.h Thu Jul 21 03:30:55 2016 @@ -1918,6 +1918,9 @@ public: //-- /// Retrieve the list of shared libraries that are loaded for this process +/// This method is used on pre-macOS 10.12, pre-iOS 10, pre-tvOS 10, +/// pre-watchOS 3 systems. The following two methods are for newer versions +/// of those OSes. /// /// For certain platforms, the time it takes for the DynamicLoader plugin to /// read all of the shared libraries out of memory over a slow communication @@ -1945,6 +1948,22 @@ public: { return StructuredData::ObjectSP(); } + +// On macOS 10.12, tvOS 10, iOS 10, watchOS 3 and newer, debugserver can return +// the full list of loaded shared libraries without needing any input. +virtual lldb_private::StructuredData::ObjectSP +GetLoadedDynamicLibrariesInfos () +{ +return StructuredData::ObjectSP(); +} + +// On macOS 10.12, tvOS 10, iOS 10, watchOS 3 and newer, debugserver can return +// information about binaries given their load addresses. +virtual lldb_private::StructuredData::ObjectSP +GetLoadedDynamicLibrariesInfos (const std::vector &load_addresses) +{ +return StructuredData::ObjectSP(); +} //-- /// Print a user-visible warning about a module being built with optimization Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=276254&r1=276253&r2=276254&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Jul 21 03:30:55 2016 @@ -894,6 +894,8 @@ AF26703B1852D01E00B6CC36 /* QueueList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF2670391852D01E00B6CC36 /* QueueList.cpp */; }; AF27AD551D3603EA00CF2833 /* DynamicLoaderDarwin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AF27AD531D3603EA00CF2833 /* DynamicLoaderDarwin.cpp */; }; AF27AD561D3603EA00CF2833 /* DynamicLoaderDarwin.h in Headers */ = {isa = PBXBuildFile; fileRef = AF27AD541D3603EA00CF2833 /* DynamicLoaderDarwin.h */; }; +
Re: [Lldb-commits] [PATCH] D22457: Unify process launching code on linux
tberghammer accepted this revision. tberghammer added a comment. This revision is now accepted and ready to land. Looks good with 2 minor comments Comment at: source/Host/linux/ProcessLauncherLinux.cpp:28-29 @@ +27,4 @@ + +// If there is no PATH variable specified inside the environment then set the path to /system/bin. +// It is required because the default path used by execve() is wrong on android. +static void (nit): Please move this comment into the ifdef __ANDROID__ block Comment at: source/Host/linux/ProcessLauncherLinux.cpp:49 @@ +48,3 @@ +write(error_fd, os.str().data(), os.str().size()); +_exit(1); +} Should we close the file descriptor before exiting? https://reviews.llvm.org/D22457 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D22457: Unify process launching code on linux
labath marked 2 inline comments as done. labath added a comment. https://reviews.llvm.org/D22457 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r276288 - Unify process launching code on linux
Author: labath Date: Thu Jul 21 09:54:03 2016 New Revision: 276288 URL: http://llvm.org/viewvc/llvm-project?rev=276288&view=rev Log: Unify process launching code on linux Summary: We've had two copies of code for launching processes: - one in NativeProcessLinux, used for launching debugged processes - one in ProcessLauncherAndroid, used on android for launching all other kinds of processes These have over time acquired support for various launch options, but neither supported all of them. I now replace them with a single implementation ProcessLauncherLinux, which supports all the options the individual versions supported and set it to be used to launch all processes on linux. This also works around the ETXTBSY issue on android when the process is started from the platform instance, as that used to go through the version which did not contain the workaround. Reviewers: tberghammer Subscribers: tberghammer, danalbert, srhines, lldb-commits Differential Revision: https://reviews.llvm.org/D22457 Added: lldb/trunk/include/lldb/Host/linux/ProcessLauncherLinux.h - copied, changed from r276254, lldb/trunk/include/lldb/Host/android/ProcessLauncherAndroid.h lldb/trunk/source/Host/linux/ProcessLauncherLinux.cpp Removed: lldb/trunk/include/lldb/Host/android/ProcessLauncherAndroid.h lldb/trunk/source/Host/android/ProcessLauncherAndroid.cpp Modified: lldb/trunk/source/Host/CMakeLists.txt lldb/trunk/source/Host/common/Host.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Removed: lldb/trunk/include/lldb/Host/android/ProcessLauncherAndroid.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/android/ProcessLauncherAndroid.h?rev=276287&view=auto == --- lldb/trunk/include/lldb/Host/android/ProcessLauncherAndroid.h (original) +++ lldb/trunk/include/lldb/Host/android/ProcessLauncherAndroid.h (removed) @@ -1,26 +0,0 @@ -//===-- ProcessLauncherAndroid.h *- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===--===// - -#ifndef lldb_Host_android_ProcessLauncherAndroid_h_ -#define lldb_Host_android_ProcessLauncherAndroid_h_ - -#include "lldb/Host/ProcessLauncher.h" - -namespace lldb_private -{ - -class ProcessLauncherAndroid : public ProcessLauncher -{ - public: -virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, Error &error); -}; - -} // end of namespace lldb_private - -#endif Copied: lldb/trunk/include/lldb/Host/linux/ProcessLauncherLinux.h (from r276254, lldb/trunk/include/lldb/Host/android/ProcessLauncherAndroid.h) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/ProcessLauncherLinux.h?p2=lldb/trunk/include/lldb/Host/linux/ProcessLauncherLinux.h&p1=lldb/trunk/include/lldb/Host/android/ProcessLauncherAndroid.h&r1=276254&r2=276288&rev=276288&view=diff == --- lldb/trunk/include/lldb/Host/android/ProcessLauncherAndroid.h (original) +++ lldb/trunk/include/lldb/Host/linux/ProcessLauncherLinux.h Thu Jul 21 09:54:03 2016 @@ -15,10 +15,11 @@ namespace lldb_private { -class ProcessLauncherAndroid : public ProcessLauncher +class ProcessLauncherLinux : public ProcessLauncher { - public: -virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, Error &error); +public: +virtual HostProcess +LaunchProcess(const ProcessLaunchInfo &launch_info, Error &error); }; } // end of namespace lldb_private Modified: lldb/trunk/source/Host/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=276288&r1=276287&r2=276288&view=diff == --- lldb/trunk/source/Host/CMakeLists.txt (original) +++ lldb/trunk/source/Host/CMakeLists.txt Thu Jul 21 09:54:03 2016 @@ -120,24 +120,17 @@ else() add_host_subdirectory(android android/HostInfoAndroid.cpp android/LibcGlue.cpp -android/ProcessLauncherAndroid.cpp -linux/AbstractSocket.cpp -linux/Host.cpp -linux/HostInfoLinux.cpp -linux/HostThreadLinux.cpp -linux/LibcGlue.cpp -linux/ThisThread.cpp -) -else() - add_host_subdirectory(linux -linux/AbstractSocket.cpp -linux/Host.cpp -linux/HostInfoLinux.cpp -linux/HostThreadLinux.cpp -linux/LibcGlue.cpp -
Re: [Lldb-commits] [PATCH] D22457: Unify process launching code on linux
This revision was automatically updated to reflect the committed changes. Closed by commit rL276288: Unify process launching code on linux (authored by labath). Changed prior to commit: https://reviews.llvm.org/D22457?vs=64296&id=64894#toc Repository: rL LLVM https://reviews.llvm.org/D22457 Files: lldb/trunk/include/lldb/Host/android/ProcessLauncherAndroid.h lldb/trunk/include/lldb/Host/linux/ProcessLauncherLinux.h lldb/trunk/source/Host/CMakeLists.txt lldb/trunk/source/Host/android/ProcessLauncherAndroid.cpp lldb/trunk/source/Host/common/Host.cpp lldb/trunk/source/Host/linux/ProcessLauncherLinux.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -884,8 +884,8 @@ FileAction file_action; std::string path; packet.GetHexByteString(path); -const bool read = false; -const bool write = true; +const bool read = true; +const bool write = false; if (file_action.Open(STDIN_FILENO, FileSpec{path, false}, read, write)) { m_process_launch_info.AppendFileAction(file_action); @@ -901,8 +901,8 @@ FileAction file_action; std::string path; packet.GetHexByteString(path); -const bool read = true; -const bool write = false; +const bool read = false; +const bool write = true; if (file_action.Open(STDOUT_FILENO, FileSpec{path, false}, read, write)) { m_process_launch_info.AppendFileAction(file_action); @@ -918,8 +918,8 @@ FileAction file_action; std::string path; packet.GetHexByteString(path); -const bool read = true; -const bool write = false; +const bool read = false; +const bool write = true; if (file_action.Open(STDERR_FILENO, FileSpec{path, false}, read, write)) { m_process_launch_info.AppendFileAction(file_action); Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -203,6 +203,15 @@ if (!m_process_launch_info.GetArguments ().GetArgumentCount ()) return Error ("%s: no process command line specified to launch", __FUNCTION__); +const bool should_forward_stdio = m_process_launch_info.GetFileActionForFD(STDIN_FILENO) == nullptr || + m_process_launch_info.GetFileActionForFD(STDOUT_FILENO) == nullptr || + m_process_launch_info.GetFileActionForFD(STDERR_FILENO) == nullptr; +m_process_launch_info.SetLaunchInSeparateProcessGroup(true); +m_process_launch_info.GetFlags().Set(eLaunchFlagDebug); + +const bool default_to_use_pty = true; +m_process_launch_info.FinalizeFileActions(nullptr, default_to_use_pty); + Error error; { std::lock_guard guard(m_debugged_process_mutex); @@ -226,11 +235,7 @@ // file actions non-null // process launch -i/e/o will also make these file actions non-null // nullptr means that the traffic is expected to flow over gdb-remote protocol -if ( -m_process_launch_info.GetFileActionForFD(STDIN_FILENO) == nullptr || -m_process_launch_info.GetFileActionForFD(STDOUT_FILENO) == nullptr || -m_process_launch_info.GetFileActionForFD(STDERR_FILENO) == nullptr -) +if (should_forward_stdio) { // nullptr means it's not redirected to file or pty (in case of LLGS local) // at least one of stdio will be transferred pty<->gdb-remote @@ -998,14 +1003,6 @@ if (! m_stdio_communication.IsConnected()) return; -// llgs local-process debugging may specify PTY paths, which will make these -// file actions non-null -// process launch -e/o will also make these file actions non-null -// nullptr means that the traffic is expected to flow over gdb-remote protocol -if ( m_process_launch_info.GetFileActionForFD(STDOUT_FILENO) && - m_process_launch_info.GetFileActionForFD(STDERR_FILENO)) -return; - Error error; lldbassert(! m_stdio_handle_up); m_stdio_handle_up = m_mainloop.RegisterReadObject( Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h === --- lldb/trunk/source/Plu
Re: [Lldb-commits] [PATCH] D22404: [test] Report error when inferior test processes exit with a non-zero code
tfiala added a comment. That's weird - it shows up as abandoned, but you did check it in, right Pavel? https://reviews.llvm.org/D22404 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D22404: [test] Report error when inferior test processes exit with a non-zero code
labath added a comment. I also reverted it back, as it was causing some issues (if a specific test case in a test file failed, it still marked the whole file as failed). I'll need revisit this later... https://reviews.llvm.org/D22404 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D22404: [test] Report error when inferior test processes exit with a non-zero code
tfiala added a comment. Ah yes okay, that orients what I heard earlier. Thanks! https://reviews.llvm.org/D22404 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r276303 - Add check for non-null log instance in PlatformAndroid.
Author: ovyalov Date: Thu Jul 21 12:03:25 2016 New Revision: 276303 URL: http://llvm.org/viewvc/llvm-project?rev=276303&view=rev Log: Add check for non-null log instance in PlatformAndroid. Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp?rev=276303&r1=276302&r2=276303&view=diff == --- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp (original) +++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp Thu Jul 21 12:03:25 2016 @@ -378,7 +378,7 @@ PlatformAndroid::DownloadSymbolFile (con Error error = adb.Shell(command.GetData(), 5000 /* ms */, nullptr); Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_PLATFORM)); -if (error.Fail()) +if (log && error.Fail()) log->Printf("Failed to remove temp directory: %s", error.AsCString()); } ); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D22628: Fixing layout of elf-core file related structures
dvlahovski created this revision. dvlahovski added a reviewer: labath. dvlahovski added a subscriber: lldb-commits. The binary layout of prstatus and prpsinfo was wrong. Some of the member variables where not aligned properly and others where with a wrong type (e.g. the time related stuff in prstatus). I used the structs defined in bfd in binutils to see what the layout of the elf-core format in these section is. (https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/hosts/x86-64linux.h;h=4e420a1f2081dd3b51f5d6b7a8e4093580f5cdb5;hb=master) Note: those structures are only for x86 64 bit elf-core files This shouldn't have any impact on the functionality, because lldb actually uses only a few of the member variables of those structs and they are with a correct type and alignment. I found this while trying to add/fix the support for i386 core files (https://llvm.org/bugs/show_bug.cgi?id=26947) https://reviews.llvm.org/D22628 Files: source/Plugins/Process/elf-core/ThreadElfCore.cpp source/Plugins/Process/elf-core/ThreadElfCore.h Index: source/Plugins/Process/elf-core/ThreadElfCore.h === --- source/Plugins/Process/elf-core/ThreadElfCore.h +++ source/Plugins/Process/elf-core/ThreadElfCore.h @@ -21,17 +21,13 @@ struct compat_timeval { -int64_t tv_sec; -int32_t tv_usec; +alignas(8) uint64_t tv_sec; +alignas(8) uint64_t tv_usec; }; // PRSTATUS structure's size differs based on architecture. // Currently parsing done only for x86-64 architecture by // simply reading data from the buffer. -// The following macros are used to specify the size. -// Calculating size using sizeof() wont work because of padding. -#define ELFLINUXPRSTATUS64_SIZE (112) -#define ELFLINUXPRPSINFO64_SIZE (132) #undef si_signo #undef si_code @@ -70,28 +66,30 @@ { case lldb_private::ArchSpec::eCore_s390x_generic: case lldb_private::ArchSpec::eCore_x86_64_x86_64: -return ELFLINUXPRSTATUS64_SIZE; +return sizeof(ELFLinuxPrStatus); default: return 0; } } }; +static_assert(sizeof(ELFLinuxPrStatus) == 112, "sizeof ELFLinuxPrStatus is not correct!"); + struct ELFLinuxPrPsInfo { -charpr_state; -charpr_sname; -charpr_zomb; -charpr_nice; -uint64_tpr_flag; -uint32_tpr_uid; -uint32_tpr_gid; -int32_t pr_pid; -int32_t pr_ppid; -int32_t pr_pgrp; -int32_t pr_sid; -charpr_fname[16]; -charpr_psargs[80]; +char pr_state; +char pr_sname; +char pr_zomb; +char pr_nice; +alignas(8) uint64_t pr_flag; +uint32_t pr_uid; +uint32_t pr_gid; +int32_t pr_pid; +int32_t pr_ppid; +int32_t pr_pgrp; +int32_t pr_sid; +char pr_fname[16]; +char pr_psargs[80]; ELFLinuxPrPsInfo(); @@ -105,13 +103,15 @@ { case lldb_private::ArchSpec::eCore_s390x_generic: case lldb_private::ArchSpec::eCore_x86_64_x86_64: -return ELFLINUXPRPSINFO64_SIZE; +return sizeof(ELFLinuxPrPsInfo); default: return 0; } } }; +static_assert(sizeof(ELFLinuxPrPsInfo) == 136, "sizeof ELFLinuxPrPsInfo is not correct!"); + struct ThreadData { lldb_private::DataExtractor gpregset; Index: source/Plugins/Process/elf-core/ThreadElfCore.cpp === --- source/Plugins/Process/elf-core/ThreadElfCore.cpp +++ source/Plugins/Process/elf-core/ThreadElfCore.cpp @@ -228,8 +228,8 @@ { case ArchSpec::eCore_s390x_generic: case ArchSpec::eCore_x86_64_x86_64: -len = data.ExtractBytes(0, ELFLINUXPRSTATUS64_SIZE, byteorder, this); -return len == ELFLINUXPRSTATUS64_SIZE; +len = data.ExtractBytes(0, sizeof(ELFLinuxPrStatus), byteorder, this); +return len == sizeof(ELFLinuxPrStatus); default: return false; } @@ -252,8 +252,8 @@ { case ArchSpec::eCore_s390x_generic: case ArchSpec::eCore_x86_64_x86_64: -len = data.ExtractBytes(0, ELFLINUXPRPSINFO64_SIZE, byteorder, this); -return len == ELFLINUXPRPSINFO64_SIZE; +len = data.ExtractBytes(0, sizeof(ELFLinuxPrPsInfo), byteorder, this); +return len == sizeof(ELFLinuxPrPsInfo); default: return false; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D22628: Fixing layout of elf-core file related structures
dvlahovski updated this revision to Diff 64902. dvlahovski added a comment. Forgot to add alignas to two members of prstatus https://reviews.llvm.org/D22628 Files: source/Plugins/Process/elf-core/ThreadElfCore.cpp source/Plugins/Process/elf-core/ThreadElfCore.h Index: source/Plugins/Process/elf-core/ThreadElfCore.h === --- source/Plugins/Process/elf-core/ThreadElfCore.h +++ source/Plugins/Process/elf-core/ThreadElfCore.h @@ -21,42 +21,38 @@ struct compat_timeval { -int64_t tv_sec; -int32_t tv_usec; +alignas(8) uint64_t tv_sec; +alignas(8) uint64_t tv_usec; }; // PRSTATUS structure's size differs based on architecture. // Currently parsing done only for x86-64 architecture by // simply reading data from the buffer. -// The following macros are used to specify the size. -// Calculating size using sizeof() wont work because of padding. -#define ELFLINUXPRSTATUS64_SIZE (112) -#define ELFLINUXPRPSINFO64_SIZE (132) #undef si_signo #undef si_code #undef si_errno struct ELFLinuxPrStatus { -int32_t si_signo; -int32_t si_code; -int32_t si_errno; +int32_t si_signo; +int32_t si_code; +int32_t si_errno; -int16_t pr_cursig; +int16_t pr_cursig; -uint64_tpr_sigpend; -uint64_tpr_sighold; +alignas(8) uint64_t pr_sigpend; +alignas(8) uint64_t pr_sighold; -uint32_tpr_pid; -uint32_tpr_ppid; -uint32_tpr_pgrp; -uint32_tpr_sid; +uint32_t pr_pid; +uint32_t pr_ppid; +uint32_t pr_pgrp; +uint32_t pr_sid; -compat_timeval pr_utime; -compat_timeval pr_stime; -compat_timeval pr_cutime; -compat_timeval pr_cstime; +compat_timeval pr_utime; +compat_timeval pr_stime; +compat_timeval pr_cutime; +compat_timeval pr_cstime; ELFLinuxPrStatus(); @@ -70,28 +66,30 @@ { case lldb_private::ArchSpec::eCore_s390x_generic: case lldb_private::ArchSpec::eCore_x86_64_x86_64: -return ELFLINUXPRSTATUS64_SIZE; +return sizeof(ELFLinuxPrStatus); default: return 0; } } }; +static_assert(sizeof(ELFLinuxPrStatus) == 112, "sizeof ELFLinuxPrStatus is not correct!"); + struct ELFLinuxPrPsInfo { -charpr_state; -charpr_sname; -charpr_zomb; -charpr_nice; -uint64_tpr_flag; -uint32_tpr_uid; -uint32_tpr_gid; -int32_t pr_pid; -int32_t pr_ppid; -int32_t pr_pgrp; -int32_t pr_sid; -charpr_fname[16]; -charpr_psargs[80]; +char pr_state; +char pr_sname; +char pr_zomb; +char pr_nice; +alignas(8) uint64_t pr_flag; +uint32_t pr_uid; +uint32_t pr_gid; +int32_t pr_pid; +int32_t pr_ppid; +int32_t pr_pgrp; +int32_t pr_sid; +char pr_fname[16]; +char pr_psargs[80]; ELFLinuxPrPsInfo(); @@ -105,13 +103,15 @@ { case lldb_private::ArchSpec::eCore_s390x_generic: case lldb_private::ArchSpec::eCore_x86_64_x86_64: -return ELFLINUXPRPSINFO64_SIZE; +return sizeof(ELFLinuxPrPsInfo); default: return 0; } } }; +static_assert(sizeof(ELFLinuxPrPsInfo) == 136, "sizeof ELFLinuxPrPsInfo is not correct!"); + struct ThreadData { lldb_private::DataExtractor gpregset; Index: source/Plugins/Process/elf-core/ThreadElfCore.cpp === --- source/Plugins/Process/elf-core/ThreadElfCore.cpp +++ source/Plugins/Process/elf-core/ThreadElfCore.cpp @@ -228,8 +228,8 @@ { case ArchSpec::eCore_s390x_generic: case ArchSpec::eCore_x86_64_x86_64: -len = data.ExtractBytes(0, ELFLINUXPRSTATUS64_SIZE, byteorder, this); -return len == ELFLINUXPRSTATUS64_SIZE; +len = data.ExtractBytes(0, sizeof(ELFLinuxPrStatus), byteorder, this); +return len == sizeof(ELFLinuxPrStatus); default: return false; } @@ -252,8 +252,8 @@ { case ArchSpec::eCore_s390x_generic: case ArchSpec::eCore_x86_64_x86_64: -len = data.ExtractBytes(0, ELFLINUXPRPSINFO64_SIZE, byteorder, this); -return len == ELFLINUXPRPSINFO64_SIZE; +len = data.ExtractBytes(0, sizeof(ELFLinuxPrPsInfo), byteorder, this); +return len == sizeof(ELFLinuxPrPsInfo); default: return false; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D20436: Clean up vestigial remnants of locking primitives
Yeah I can do this today. > On Jul 19, 2016, at 1:58 AM, Zachary Turner wrote: > > I can't test this on Windows until Friday because I'm traveling and my laptop > isn't set up to build lldb. Could Stephane maybe help? > > > On Tue, Jul 19, 2016 at 1:51 AM Saleem Abdulrasool > wrote: > compnerd updated this revision to Diff 64448. > > https://reviews.llvm.org/D20436 > > Files: > include/lldb/Core/Event.h > include/lldb/Core/Listener.h > include/lldb/Core/ThreadSafeDenseMap.h > include/lldb/Core/ThreadSafeDenseSet.h > include/lldb/Host/Condition.h > include/lldb/Host/Editline.h > include/lldb/Host/Mutex.h > include/lldb/Host/Predicate.h > include/lldb/Host/ProcessRunLock.h > include/lldb/Target/Process.h > source/API/SBListener.cpp > source/Core/Communication.cpp > source/Core/Debugger.cpp > source/Core/Listener.cpp > source/Host/CMakeLists.txt > source/Host/common/Condition.cpp > source/Host/common/Host.cpp > source/Host/common/Mutex.cpp > source/Host/posix/ConnectionFileDescriptorPosix.cpp > source/Host/windows/Condition.cpp > source/Host/windows/Mutex.cpp > source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h > source/Plugins/Platform/Linux/PlatformLinux.cpp > source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp > source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h > source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp > source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp > source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h > source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp > source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h > source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp > source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp > source/Target/Process.cpp > source/Target/Target.cpp > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r276351 - Stop printing double { characters on Dictionary StructuredData objects
Author: jmolenda Date: Thu Jul 21 17:50:01 2016 New Revision: 276351 URL: http://llvm.org/viewvc/llvm-project?rev=276351&view=rev Log: Stop printing double { characters on Dictionary StructuredData objects when Dumping, thanks to Devin to catching the edit mistake I made in r276079. Modified: lldb/trunk/source/Core/StructuredData.cpp Modified: lldb/trunk/source/Core/StructuredData.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/StructuredData.cpp?rev=276351&r1=276350&r2=276351&view=diff == --- lldb/trunk/source/Core/StructuredData.cpp (original) +++ lldb/trunk/source/Core/StructuredData.cpp Thu Jul 21 17:50:01 2016 @@ -291,7 +291,7 @@ StructuredData::Dictionary::Dump (Stream s << "{"; if (pretty_print) { -s << "{\n"; +s << "\n"; s.IndentMore(); } for (const auto &pair : m_dict) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r276369 - Add support to get the shared cache information from the new
Author: jmolenda Date: Thu Jul 21 19:17:55 2016 New Revision: 276369 URL: http://llvm.org/viewvc/llvm-project?rev=276369&view=rev Log: Add support to get the shared cache information from the new debugserver jGetSharedCacheInfo packet instead of reading the dyld internal data structures directly. This code is (currently) only used for ios native lldb's - I should really move this ObjectFileMachO::GetProcessSharedCacheUUID method somewhere else, it makes less and less sense being in the file reader. Modified: lldb/trunk/include/lldb/Target/Process.h lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Modified: lldb/trunk/include/lldb/Target/Process.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=276369&r1=276368&r2=276369&view=diff == --- lldb/trunk/include/lldb/Target/Process.h (original) +++ lldb/trunk/include/lldb/Target/Process.h Thu Jul 21 19:17:55 2016 @@ -1966,6 +1966,19 @@ public: } //-- +// Get information about the library shared cache, if that exists +// +// On macOS 10.12, tvOS 10, iOS 10, watchOS 3 and newer, debugserver can return +// information about the library shared cache (a set of standard libraries that are +// loaded at the same location for all processes on a system) in use. +//-- +virtual lldb_private::StructuredData::ObjectSP +GetSharedCacheInfo () +{ +return StructuredData::ObjectSP(); +} + +//-- /// Print a user-visible warning about a module being built with optimization /// /// Prints a async warning message to the user one time per Module Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp?rev=276369&r1=276368&r2=276369&view=diff == --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp Thu Jul 21 19:17:55 2016 @@ -480,6 +480,13 @@ DynamicLoaderMacOS::CanLoadImage () } } } +else +{ +// If we were unable to find _dyld_global_lock_held in any modules, or it is not loaded into +// memory yet, we may be at process startup (sitting at _dyld_start) - so we should not allow +// dlopen calls. +error.SetErrorToGenericError(); +} return error; } Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=276369&r1=276368&r2=276369&view=diff == --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Thu Jul 21 19:17:55 2016 @@ -5449,6 +5449,33 @@ UUID ObjectFileMachO::GetProcessSharedCacheUUID (Process *process) { UUID uuid; + +// First see if we can get the shared cache details from debugserver +if (process) +{ +StructuredData::ObjectSP info = process->GetSharedCacheInfo(); +StructuredData::Dictionary *info_dict = nullptr; +if (info.get() && info->GetAsDictionary()) +{ +info_dict = info->GetAsDictionary(); +} + +// {"shared_cache_base_address":140735683125248,"shared_cache_uuid":"DDB8D70C-C9A2-3561-B2C8-BE48A4F33F96","no_shared_cache":false,"shared_cache_private_cache":false} + +if (info_dict +&& info_dict->HasKey("shared_cache_uuid") +&& info_dict->HasKey("no_shared_cache") +&& info_dict->HasKey("shared_cache_base_address")) +{ +bool process_using_shared_cache = info_dict->GetValueForKey("no_shared_cache")->GetBooleanValue() == false; +std::string uuid_str = info_dict->GetValueForKey("shared_cache_uuid")->GetStringValue(); + +if (process_using_shared_cache && !uuid_str.empty() && uuid.SetFromCString (uuid_str.c_str()) == 0) +return uuid; +} +} + +// Fall back to trying to read the shared cache info