[Lldb-commits] [lldb] r322167 - [dotest] Remove crashinfo hook
Author: labath Date: Wed Jan 10 02:18:47 2018 New Revision: 322167 URL: http://llvm.org/viewvc/llvm-project?rev=322167&view=rev Log: [dotest] Remove crashinfo hook Summary: This used to be important when all tests were run in a single process, but that has no longer been the case for a while. Furthermore, this hook fails to build on new mac versions for several people, and it's not clear whether fixing it is worth the effort. Reviewers: jingham, clayborg, davide Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D41871 Removed: lldb/trunk/packages/Python/lldbsuite/test/crashinfo.c Modified: lldb/trunk/.gitignore lldb/trunk/packages/Python/lldbsuite/test/configuration.py lldb/trunk/packages/Python/lldbsuite/test/dotest.py lldb/trunk/packages/Python/lldbsuite/test/test_result.py Modified: lldb/trunk/.gitignore URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/.gitignore?rev=322167&r1=322166&r2=322167&view=diff == --- lldb/trunk/.gitignore (original) +++ lldb/trunk/.gitignore Wed Jan 10 02:18:47 2018 @@ -37,8 +37,6 @@ ninja/ *xcuserdata test/20* __pycache__/ -*.lock -*.so clang-module-cache @@ -53,7 +51,3 @@ tags # Ignore test trace directories. 20??-??-??-??_??_??/ -# Ignore crashlog support files. -crashinfo.lock -crashinfo.so - Modified: lldb/trunk/packages/Python/lldbsuite/test/configuration.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/configuration.py?rev=322167&r1=322166&r2=322167&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/configuration.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/configuration.py Wed Jan 10 02:18:47 2018 @@ -24,40 +24,6 @@ import unittest2 import lldbsuite -def __setCrashInfoHook_Mac(text): -from . import crashinfo -crashinfo.setCrashReporterDescription(text) - - -def setupCrashInfoHook(): -if platform.system() == "Darwin": -from . import lock -test_dir = os.environ['LLDB_TEST'] -if not test_dir or not os.path.exists(test_dir): -return -dylib_lock = os.path.join(test_dir, "crashinfo.lock") -dylib_src = os.path.join(test_dir, "crashinfo.c") -dylib_dst = os.path.join(test_dir, "crashinfo.so") -try: -compile_lock = lock.Lock(dylib_lock) -compile_lock.acquire() -if not os.path.isfile(dylib_dst) or os.path.getmtime( -dylib_dst) < os.path.getmtime(dylib_src): -# we need to compile -cmd = "SDKROOT= xcrun clang %s -o %s -framework Python -Xlinker -dylib" % ( -dylib_src, dylib_dst) -if subprocess.call( -cmd, shell=True) != 0 or not os.path.isfile(dylib_dst): -raise Exception('command failed: "{}"'.format(cmd)) -finally: -compile_lock.release() -del compile_lock - -setCrashInfoHook = __setCrashInfoHook_Mac - -else: -pass - # The test suite. suite = unittest2.TestSuite() Removed: lldb/trunk/packages/Python/lldbsuite/test/crashinfo.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/crashinfo.c?rev=322166&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/crashinfo.c (original) +++ lldb/trunk/packages/Python/lldbsuite/test/crashinfo.c (removed) @@ -1,64 +0,0 @@ -/** - The LLVM Compiler Infrastructure - - This file is distributed under the University of Illinois Open Source - License. See LICENSE.TXT for details. - ** - -* This C file vends a simple interface to set the Application Specific Info -* on Mac OS X through Python. To use, compile as a dylib, import crashinfo -* and call crashinfo.setCrashReporterDescription("hello world") -* The testCrashReporterDescription() API is simply there to let you test that this -* is doing what it is intended to do without having to actually cons up a crash -**/ - -#include -#include -#include -#include - -void *__crashreporter_info__ = NULL; - -asm(".desc ___crashreporter_info__, 0x10"); - -static PyObject* setCrashReporterDescription(PyObject* self, PyObject* string) -{ - if (__crashreporter_info__) - { - free(__crashreporter_info__); - __crashreporter_info__ = NULL; - } - - if (string && PyString_Check(string)) - { - Py_ssize_t size = PyString_Size(string); - char* data = PyString_AsString(string); -
[Lldb-commits] [PATCH] D41871: [dotest] Remove crashinfo hook
This revision was automatically updated to reflect the committed changes. Closed by commit rL322167: [dotest] Remove crashinfo hook (authored by labath, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D41871?vs=129102&id=129224#toc Repository: rL LLVM https://reviews.llvm.org/D41871 Files: lldb/trunk/.gitignore lldb/trunk/packages/Python/lldbsuite/test/configuration.py lldb/trunk/packages/Python/lldbsuite/test/crashinfo.c lldb/trunk/packages/Python/lldbsuite/test/dotest.py lldb/trunk/packages/Python/lldbsuite/test/test_result.py Index: lldb/trunk/packages/Python/lldbsuite/test/test_result.py === --- lldb/trunk/packages/Python/lldbsuite/test/test_result.py +++ lldb/trunk/packages/Python/lldbsuite/test/test_result.py @@ -171,9 +171,6 @@ (str(test), inspect.getfile( test.__class__))) self.counter += 1 -# if self.counter == 4: -#import crashinfo -#crashinfo.testCrashReporterDescription(None) test.test_number = self.counter if self.showAll: self.stream.write(self.fmt % self.counter) Index: lldb/trunk/packages/Python/lldbsuite/test/configuration.py === --- lldb/trunk/packages/Python/lldbsuite/test/configuration.py +++ lldb/trunk/packages/Python/lldbsuite/test/configuration.py @@ -24,40 +24,6 @@ import lldbsuite -def __setCrashInfoHook_Mac(text): -from . import crashinfo -crashinfo.setCrashReporterDescription(text) - - -def setupCrashInfoHook(): -if platform.system() == "Darwin": -from . import lock -test_dir = os.environ['LLDB_TEST'] -if not test_dir or not os.path.exists(test_dir): -return -dylib_lock = os.path.join(test_dir, "crashinfo.lock") -dylib_src = os.path.join(test_dir, "crashinfo.c") -dylib_dst = os.path.join(test_dir, "crashinfo.so") -try: -compile_lock = lock.Lock(dylib_lock) -compile_lock.acquire() -if not os.path.isfile(dylib_dst) or os.path.getmtime( -dylib_dst) < os.path.getmtime(dylib_src): -# we need to compile -cmd = "SDKROOT= xcrun clang %s -o %s -framework Python -Xlinker -dylib" % ( -dylib_src, dylib_dst) -if subprocess.call( -cmd, shell=True) != 0 or not os.path.isfile(dylib_dst): -raise Exception('command failed: "{}"'.format(cmd)) -finally: -compile_lock.release() -del compile_lock - -setCrashInfoHook = __setCrashInfoHook_Mac - -else: -pass - # The test suite. suite = unittest2.TestSuite() Index: lldb/trunk/packages/Python/lldbsuite/test/dotest.py === --- lldb/trunk/packages/Python/lldbsuite/test/dotest.py +++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py @@ -1117,7 +1117,6 @@ signal.signal(signal.SIGINT, signal.SIG_IGN) setupSysPath() -configuration.setupCrashInfoHook() # # If '-l' is specified, do not skip the long running tests. Index: lldb/trunk/.gitignore === --- lldb/trunk/.gitignore +++ lldb/trunk/.gitignore @@ -37,8 +37,6 @@ *xcuserdata test/20* __pycache__/ -*.lock -*.so clang-module-cache @@ -53,7 +51,3 @@ # Ignore test trace directories. 20??-??-??-??_??_??/ -# Ignore crashlog support files. -crashinfo.lock -crashinfo.so - Index: lldb/trunk/packages/Python/lldbsuite/test/crashinfo.c === --- lldb/trunk/packages/Python/lldbsuite/test/crashinfo.c +++ lldb/trunk/packages/Python/lldbsuite/test/crashinfo.c @@ -1,64 +0,0 @@ -/** - The LLVM Compiler Infrastructure - - This file is distributed under the University of Illinois Open Source - License. See LICENSE.TXT for details. - ** - -* This C file vends a simple interface to set the Application Specific Info -* on Mac OS X through Python. To use, compile as a dylib, import crashinfo -* and call crashinfo.setCrashReporterDescription("hello world") -* The testCrashReporterDescription() API is simply there to let you test that this -* is doing what it is intended to do without having to actually cons up a crash -**/ - -#include -#include -#include -#include - -void *__crashreporter_info__ = NULL; - -asm(".desc ___crashreporter_info__, 0x10"); - -static PyObject* setCrashReporterDescription(PyObject* self, PyObject* string) -{ - if (__crashrepor
[Lldb-commits] [PATCH] D41584: Check existence of each required component during construction of LLVMCDisassembler.
labath accepted this revision. labath added a comment. Looks good to me. Just make sure to respond to all of Greg's comments as well. Comment at: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp:989-1003 +DisassemblerLLVMC::MCDisasmToolset::MCDisasmToolset( +std::unique_ptr &&instr_info, +std::unique_ptr &®_info, +std::unique_ptr &&subtarget_info, +std::unique_ptr &&asm_info, +std::unique_ptr &&context, +std::unique_ptr &&disasm, clayborg wrote: > Do we need this? We are placing the MCDisasmToolset into std::unique_ptr<> > member variables so this shouldn't be needed by anyone as the std::unique_ptr > already has a move operator The `std::move` is necessary in this context. The rvalue references can be dropped theoretically -- that will enforce that the constructor takes ownership of the passed-in arguments (as they will get implicitly deleted otherwise) -- right now the constructor can just do nothing and the caller will keep owning these objects. However, this distinction seldom matters. Comment at: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp:1002 + assert(m_instr_info && m_reg_info && m_subtarget_info && m_asm_info && + m_context && disasm && instr_printer); +} this should be `m_disasm` and `m_instr_printer` (and make sure to test this with assertions enabled). https://reviews.llvm.org/D41584 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41533: Advanced guessing of rendezvous breakpoint
labath accepted this revision. labath added a comment. This revision is now accepted and ready to land. looks good, thanks. https://reviews.llvm.org/D41533 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41702: Add SysV Abi for PPC64le
labath added a comment. In https://reviews.llvm.org/D41702#971076, @jhibbits wrote: > > @emaste, @jhibbits: do you know what's the state of ppc64 lldb support in > > freebsd? > > It's broken because LLDB doesn't yet handle function descriptors, and I > haven't yet made the effort (ENOTIME) to fix that. I think our eventual goal > is to move even BE to ELFv2 on FreeBSD, to do away with function descriptors, > and it should then Just Work, as powerpc (32-bit) works fine for most cases > right now. > > That said, if anyone knows enough to add function descriptor knowledge to > LLDB, I think that's the only missing piece, or the biggest missing piece. I > do want to finish the effort, since I started it 3.5 years ago, but I do need > help with understanding that ABI detail and how it fits with LLDB. Thanks for the explanation. How badly is it broken would you say? Do you think that using this ABI plugin for the big endian target (instead of the one from 2014) would make things any worse? Could you take a quick look to see if there is anything in this plugin that would be completely wrong for the big endian target ? (I couldn't find anything, apart from the obvious things like register constants in `CreateDefaultUnwindPlan`, but then again, I don't know the ABIs). I'm trying to avoid making bad design decisions now because of legacy code that is known to be broken and has no clear maintainer nor a plan to fix it. https://reviews.llvm.org/D41702 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D35356: [zorg] Enable assertions on the linux lldb bot
This revision was automatically updated to reflect the committed changes. labath marked an inline comment as done. Closed by commit rL322171: [zorg] Enable assertions on the linux lldb bot (authored by labath, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D35356 Files: zorg/trunk/buildbot/osuosl/master/config/builders.py zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py Index: zorg/trunk/buildbot/osuosl/master/config/builders.py === --- zorg/trunk/buildbot/osuosl/master/config/builders.py +++ zorg/trunk/buildbot/osuosl/master/config/builders.py @@ -887,7 +887,8 @@ 'factory': LLDBBuilder.getLLDBScriptCommandsFactory( downloadBinary=False, buildAndroid=True, -runTest=False)}, +runTest=False, +extra_cmake_args=['-DLLVM_ENABLE_ASSERTIONS=ON'])}, {'name': "lldb-x86_64-ubuntu-14.04-cmake", 'slavenames': ["lldb-build1-ubuntu-1404"], 'builddir': "buildWorkingDir", Index: zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py === --- zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py +++ zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py @@ -918,14 +918,18 @@ buildAndroid=False, runTest=True, scriptExt='.sh', + extra_cmake_args=None, ): f = buildbot.process.factory.BuildFactory() if scriptExt is '.bat': pathSep = '.\\' else: pathSep = './' +if extra_cmake_args is None: +extra_cmake_args = [] + # Update scripts getShellCommandStep(f, name='update scripts', command=['updateScripts' + scriptExt]) @@ -948,16 +952,9 @@ property="got_revision", workdir="scripts")) -# Update NDK and create toolchains -getShellCommandStep(f, name='ndk download and toolchains update', -command=[pathSep + 'updateToolChain' + scriptExt], -description=["Update NDK toolchain"], -flunkOnFailure=False, -haltOnFailure=False) - # Configure getShellCommandStep(f, name='cmake local', -command=[pathSep + 'cmake' + scriptExt]) +command=[pathSep + 'cmake' + scriptExt] + extra_cmake_args) # Build getShellCommandStep(f, name='ninja build local', Index: zorg/trunk/buildbot/osuosl/master/config/builders.py === --- zorg/trunk/buildbot/osuosl/master/config/builders.py +++ zorg/trunk/buildbot/osuosl/master/config/builders.py @@ -887,7 +887,8 @@ 'factory': LLDBBuilder.getLLDBScriptCommandsFactory( downloadBinary=False, buildAndroid=True, -runTest=False)}, +runTest=False, +extra_cmake_args=['-DLLVM_ENABLE_ASSERTIONS=ON'])}, {'name': "lldb-x86_64-ubuntu-14.04-cmake", 'slavenames': ["lldb-build1-ubuntu-1404"], 'builddir': "buildWorkingDir", Index: zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py === --- zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py +++ zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py @@ -918,14 +918,18 @@ buildAndroid=False, runTest=True, scriptExt='.sh', + extra_cmake_args=None, ): f = buildbot.process.factory.BuildFactory() if scriptExt is '.bat': pathSep = '.\\' else: pathSep = './' +if extra_cmake_args is None: +extra_cmake_args = [] + # Update scripts getShellCommandStep(f, name='update scripts', command=['updateScripts' + scriptExt]) @@ -948,16 +952,9 @@ property="got_revision", workdir="scripts")) -# Update NDK and create toolchains -getShellCommandStep(f, name='ndk download and toolchains update', -command=[pathSep + 'updateToolChain' + scriptExt], -description=["Update NDK toolchain"], -flunkOnFailure=False, -haltOnFailure=False) - # Configure getShellCommandStep(f, name='cmake local', -command=[pathSep + 'cmake' + scriptExt]) +command=[pathSep + 'cmake' + scriptExt] + extra_cmake_args) # Build getShellCommandStep(f, name='ninja build local', ___ lldb-commits mailing list lldb-commits@lists.llvm.org http:/
[Lldb-commits] [lldb] r322174 - Add Utility/Environment class for handling... environments
Author: labath Date: Wed Jan 10 03:57:31 2018 New Revision: 322174 URL: http://llvm.org/viewvc/llvm-project?rev=322174&view=rev Log: Add Utility/Environment class for handling... environments Summary: There was some confusion in the code about how to represent process environment. Most of the code (ab)used the Args class for this purpose, but some of it used a more basic StringList class instead. In either case, the fact that the underlying abstraction did not provide primitive operations for the typical environment operations meant that even a simple operation like checking for an environment variable value was several lines of code. This patch adds a separate Environment class, which is essentialy a llvm::StringMap in disguise. To standard StringMap functionality, it adds a couple of new functions, which are specific to the environment use case: - (most important) envp conversion for passing into execve() and likes. Instead of trying to maintain a constantly up-to-date envp view, it provides a function which creates a envp view on demand, with the expectation that this will be called as the very last thing before handing the value to the system function. - insert(StringRef KeyEqValue) - splits KeyEqValue into (key, value) pair and inserts it into the environment map. - compose(value_type KeyValue) - takes a map entry and converts in back into "KEY=VALUE" representation. With this interface most of the environment-manipulating code becomes one-liners. The only tricky part was maintaining compatibility in SBLaunchInfo, which expects that the environment entries are accessible by index and that the returned const char* is backed by the launch info object (random access into maps is hard and the map stores the entry in a deconstructed form, so we cannot just return a .c_str() value). To solve this, I have the SBLaunchInfo convert the environment into the "envp" form, and use it to answer the environment queries. Extra code is added to make sure the envp version is always in sync. (This also improves the layering situation as Args was in the Interpreter module whereas Environment is in Utility.) Reviewers: zturner, davide, jingham, clayborg Subscribers: emaste, lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D41359 Added: lldb/trunk/include/lldb/Utility/Environment.h lldb/trunk/packages/Python/lldbsuite/test/python_api/sblaunchinfo/ lldb/trunk/packages/Python/lldbsuite/test/python_api/sblaunchinfo/TestSBLaunchInfo.py lldb/trunk/source/Utility/Environment.cpp lldb/trunk/unittests/Utility/EnvironmentTest.cpp Modified: lldb/trunk/include/lldb/API/SBLaunchInfo.h lldb/trunk/include/lldb/Host/Host.h lldb/trunk/include/lldb/Interpreter/Args.h lldb/trunk/include/lldb/Target/Platform.h lldb/trunk/include/lldb/Target/ProcessInfo.h lldb/trunk/include/lldb/Target/Target.h lldb/trunk/source/API/SBLaunchInfo.cpp lldb/trunk/source/API/SBPlatform.cpp lldb/trunk/source/API/SBProcess.cpp lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/Commands/CommandObjectProcess.cpp lldb/trunk/source/Host/freebsd/Host.cpp lldb/trunk/source/Host/linux/Host.cpp lldb/trunk/source/Host/macosx/Host.mm lldb/trunk/source/Host/netbsd/Host.cpp lldb/trunk/source/Host/openbsd/Host.cpp lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp lldb/trunk/source/Host/windows/Host.cpp lldb/trunk/source/Interpreter/Args.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.mm lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.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/GDBRemoteCommunicationServerCommon.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp lldb/trunk/source/Target/Platform.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/ProcessInfo.cpp lldb/trunk/source/Target/Target.cpp lldb/trunk/source/Utility/CMakeLists.txt lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp lldb/trunk/unittests/Host/HostTest.cpp lldb/trunk/unittests/Interpreter/TestArgs.cpp lldb/trunk/unittests/Utility/CMakeLists.txt lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp Modified: lldb/trunk/include/lldb/API/SBLaunchInfo.h URL: http://llvm.org/vie
[Lldb-commits] [PATCH] D41359: Add Utility/Environment class for handling... environments
This revision was automatically updated to reflect the committed changes. Closed by commit rL322174: Add Utility/Environment class for handling... environments (authored by labath, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D41359?vs=127384&id=129239#toc Repository: rL LLVM https://reviews.llvm.org/D41359 Files: lldb/trunk/include/lldb/API/SBLaunchInfo.h lldb/trunk/include/lldb/Host/Host.h lldb/trunk/include/lldb/Interpreter/Args.h lldb/trunk/include/lldb/Target/Platform.h lldb/trunk/include/lldb/Target/ProcessInfo.h lldb/trunk/include/lldb/Target/Target.h lldb/trunk/include/lldb/Utility/Environment.h lldb/trunk/packages/Python/lldbsuite/test/python_api/sblaunchinfo/TestSBLaunchInfo.py lldb/trunk/source/API/SBLaunchInfo.cpp lldb/trunk/source/API/SBPlatform.cpp lldb/trunk/source/API/SBProcess.cpp lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/Commands/CommandObjectProcess.cpp lldb/trunk/source/Host/freebsd/Host.cpp lldb/trunk/source/Host/linux/Host.cpp lldb/trunk/source/Host/macosx/Host.mm lldb/trunk/source/Host/netbsd/Host.cpp lldb/trunk/source/Host/openbsd/Host.cpp lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp lldb/trunk/source/Host/windows/Host.cpp lldb/trunk/source/Interpreter/Args.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulatorCoreSimulatorSupport.mm lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.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/GDBRemoteCommunicationServerCommon.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp lldb/trunk/source/Target/Platform.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/ProcessInfo.cpp lldb/trunk/source/Target/Target.cpp lldb/trunk/source/Utility/CMakeLists.txt lldb/trunk/source/Utility/Environment.cpp lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp lldb/trunk/unittests/Host/HostTest.cpp lldb/trunk/unittests/Interpreter/TestArgs.cpp lldb/trunk/unittests/Utility/CMakeLists.txt lldb/trunk/unittests/Utility/EnvironmentTest.cpp lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp Index: lldb/trunk/include/lldb/Target/ProcessInfo.h === --- lldb/trunk/include/lldb/Target/ProcessInfo.h +++ lldb/trunk/include/lldb/Target/ProcessInfo.h @@ -13,6 +13,7 @@ // LLDB headers #include "lldb/Interpreter/Args.h" #include "lldb/Utility/ArchSpec.h" +#include "lldb/Utility/Environment.h" #include "lldb/Utility/FileSpec.h" namespace lldb_private { @@ -81,18 +82,17 @@ void SetArguments(char const **argv, bool first_arg_is_executable); - Args &GetEnvironmentEntries() { return m_environment; } - - const Args &GetEnvironmentEntries() const { return m_environment; } + Environment &GetEnvironment() { return m_environment; } + const Environment &GetEnvironment() const { return m_environment; } protected: FileSpec m_executable; std::string m_arg0; // argv[0] if supported. If empty, then use m_executable. // Not all process plug-ins support specifying an argv[0] // that differs from the resolved platform executable // (which is in m_executable) Args m_arguments; // All program arguments except argv[0] - Args m_environment; + Environment m_environment; uint32_t m_uid; uint32_t m_gid; ArchSpec m_arch; Index: lldb/trunk/include/lldb/Target/Platform.h === --- lldb/trunk/include/lldb/Target/Platform.h +++ lldb/trunk/include/lldb/Target/Platform.h @@ -633,7 +633,7 @@ //-- virtual Status Install(const FileSpec &src, const FileSpec &dst); - virtual size_t GetEnvironment(StringList &environment); + virtual Environment GetEnvironment(); virtual bool GetFileExists(const lldb_private::FileSpec &file_spec); Index: lldb/trunk/include/lldb/Target/Target.h === --- lldb/trunk/include/lldb/Target/Target.h +++ lldb/trunk/include/lldb/Target/Target.h @@ -115,9 +115,8 @@ void SetRunArguments(const Args &args); - size_t GetEnvironmentAsArgs(Args &env) const; - - void SetEnvironmentFromArgs(const Args &env); + Environment G
[Lldb-commits] [PATCH] D41584: Check existence of each required component during construction of LLVMCDisassembler.
tatyana-krasnukha added inline comments. Comment at: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp:1002 + assert(m_instr_info && m_reg_info && m_subtarget_info && m_asm_info && + m_context && disasm && instr_printer); +} labath wrote: > this should be `m_disasm` and `m_instr_printer` (and make sure to test this > with assertions enabled). Thanks, I was not aware of this CMake option. Of course assertion failed. Comment at: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h:102 + // disassemblers. + class MCDisasmToolset; + std::unique_ptr m_disasm; clayborg wrote: > Maybe "MCDisasmInstance", "MCDisassembler" or just "Disassembler"? MCDisassembler already exists in llvm namespace (it is one of members of this class). Disassembler is base class of DisassemblerLLVMC. l thought about MCDisasmImpl also. Probably MCDisasmInstance is even better. https://reviews.llvm.org/D41584 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r322176 - Fix windows and freebsd builds for r322174 (Environment)
Author: labath Date: Wed Jan 10 04:25:48 2018 New Revision: 322176 URL: http://llvm.org/viewvc/llvm-project?rev=322176&view=rev Log: Fix windows and freebsd builds for r322174 (Environment) Modified: lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Modified: lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp?rev=322176&r1=322175&r2=322176&view=diff == --- lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp (original) +++ lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp Wed Jan 10 04:25:48 2018 @@ -21,14 +21,15 @@ using namespace lldb; using namespace lldb_private; namespace { -void CreateEnvironmentBuffer(const Args &env, std::vector &buffer) { - if (env.GetArgumentCount() == 0) +void CreateEnvironmentBuffer(const Environment &env, + std::vector &buffer) { + if (env.size() == 0) return; // Environment buffer is a null terminated list of null terminated strings - for (auto &entry : env.entries()) { + for (const auto &KV : env) { std::wstring warg; -if (llvm::ConvertUTF8toWide(entry.ref, warg)) { +if (llvm::ConvertUTF8toWide(Environment::compose(KV), warg)) { buffer.insert(buffer.end(), (char *)warg.c_str(), (char *)(warg.c_str() + warg.size() + 1)); } @@ -75,9 +76,8 @@ ProcessLauncherWindows::LaunchProcess(co if (launch_info.GetFlags().Test(eLaunchFlagDebug)) flags |= DEBUG_ONLY_THIS_PROCESS; - auto &env = const_cast(launch_info.GetEnvironmentEntries()); LPVOID env_block = nullptr; - ::CreateEnvironmentBuffer(env, environment); + ::CreateEnvironmentBuffer(launch_info.GetEnvironment(), environment); if (!environment.empty()) env_block = environment.data(); Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=322176&r1=322175&r2=322176&view=diff == --- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original) +++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Wed Jan 10 04:25:48 2018 @@ -407,9 +407,8 @@ Status ProcessFreeBSD::DoLaunch(Module * m_monitor = new ProcessMonitor( this, module, launch_info.GetArguments().GetConstArgumentVector(), - launch_info.GetEnvironmentEntries().GetConstArgumentVector(), - stdin_file_spec, stdout_file_spec, stderr_file_spec, working_dir, - launch_info, error); + launch_info.GetEnvironment().getEnvp(), stdin_file_spec, stdout_file_spec, + stderr_file_spec, working_dir, launch_info, error); m_module = module; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41702: Add SysV Abi for PPC64le
alexandreyy added a comment. I think the stack frame structure is not correct for the PPC64be plugin. But it is hard to say how bad it is broken and fix the plugin without testing it. The register numbers and stack frame structures are different from the ABI 1.9 to the ABI 2.0. In https://reviews.llvm.org/D41702#971012, @labath wrote: > In https://reviews.llvm.org/D41702#970887, @alexandreyy wrote: > > > Thanks, @labath . > > The ABI plugin for PPC64be is not working: https://reviews.llvm.org/D5988 . > > It was implemented based on the x86_64 plugin and needs to be fixed. > > We could commit this patch and merge the plugins when both plugins work > > properly. > > > Hmm.. that complicates things a bit. How badly is it broken, do you estimate? > Would it be any better than if we just made your new plugin handle the the > big-endian target as well (just a best effort, I'm not asking you to actually > test it on that target)? > > If the ppc64be FreeBSD target is really broken, and there is no desire to fix > it, maybe we should just delete the relevant plugin. > > @emaste, @jhibbits: do you know what's the state of ppc64 lldb support in > freebsd? https://reviews.llvm.org/D41702 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41902: Remove Platform references from the Host module
labath created this revision. labath added reviewers: jingham, clayborg. Herald added a subscriber: emaste. These were used by Host::LaunchProcess to "resolve" the executable it was about to launch. The only parts of Platform::ResolveExecutable, which seem to be relevant here are the FileSpec::ResolvePath and ResolveExecutableLocation calls. The rest (most) of that function deals with selecting an architecture out of a fat binary and making sure we are able to create a Module with that slice. These are reasonable actions when selecting a binary to debug, but not for a generic process launching framework (it's technically even wrong because we should be able to launch a binary with execute permissions only, but trying to parse such file will obviously fail). I remove the platform call by inlining the relevant FileSpec calls and ignoring the rest of the Platform::ResolveExecutable code. The architecture found by the slice-searching code is being ignored already anyway, as we use the one specified in the LaunchInfo, so the only effect of this should be a different error message in case the executable does not contain the requested architecture -- before we would get an error message from the Platform class, but now we will get an error from the actual posix_spawn syscall (this is only relevant on mac, as it's the only target supporting fat binaries). Launching targets for debugging should not be affected as here the executable is pre-resolved at the point when the Target is created. https://reviews.llvm.org/D41902 Files: source/Host/common/MonitoringProcessLauncher.cpp source/Host/freebsd/Host.cpp source/Host/macosx/Host.mm source/Host/netbsd/Host.cpp source/Host/openbsd/Host.cpp Index: source/Host/openbsd/Host.cpp === --- source/Host/openbsd/Host.cpp +++ source/Host/openbsd/Host.cpp @@ -25,7 +25,6 @@ #include "lldb/Core/Module.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" -#include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" #include "lldb/Utility/CleanUp.h" #include "lldb/Utility/DataBufferHeap.h" Index: source/Host/netbsd/Host.cpp === --- source/Host/netbsd/Host.cpp +++ source/Host/netbsd/Host.cpp @@ -28,7 +28,6 @@ #include "lldb/Core/Module.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" -#include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" #include "lldb/Utility/CleanUp.h" #include "lldb/Utility/DataBufferHeap.h" Index: source/Host/macosx/Host.mm === --- source/Host/macosx/Host.mm +++ source/Host/macosx/Host.mm @@ -55,12 +55,9 @@ #include #include "lldb/Core/Communication.h" -#include "lldb/Core/Module.h" -#include "lldb/Core/ModuleSpec.h" #include "lldb/Host/ConnectionFileDescriptor.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/ThreadLauncher.h" -#include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/CleanUp.h" @@ -1463,36 +1460,28 @@ Status Host::LaunchProcess(ProcessLaunchInfo &launch_info) { Status error; - char exe_path[PATH_MAX]; - PlatformSP host_platform_sp(Platform::GetHostPlatform()); + FileSpec exe_spec(launch_info.GetExecutableFile()); - ModuleSpec exe_module_spec(launch_info.GetExecutableFile(), - launch_info.GetArchitecture()); - - if (!llvm::sys::fs::is_regular_file( - exe_module_spec.GetFileSpec().GetPath())) { -lldb::ModuleSP exe_module_sp; -error = host_platform_sp->ResolveExecutable(exe_module_spec, exe_module_sp, -NULL); - -if (error.Fail()) - return error; - -if (exe_module_sp) - exe_module_spec.GetFileSpec() = exe_module_sp->GetFileSpec(); + llvm::sys::fs::file_status stats; + status(exe_spec.GetPath(), stats); + if (!exists(stats)) { +exe_spec.ResolvePath(); +status(exe_spec.GetPath(), stats); } - - if (exe_module_spec.GetFileSpec().Exists()) { -exe_module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path)); - } else { -launch_info.GetExecutableFile().GetPath(exe_path, sizeof(exe_path)); -error.SetErrorStringWithFormat("executable doesn't exist: '%s'", exe_path); + if (!exists(stats)) { +exe_spec.ResolveExecutableLocation(); +status(exe_spec.GetPath(), stats); + } + if (!exists(stats)) { +error.SetErrorStringWithFormatv("executable doesn't exist: '{0}'", +launch_info.GetExecutableFile()); return error; } if (launch_info.GetFlags().Test(eLaunchFlagLaunchInTTY)) { #if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__) -return LaunchInNewTerminalWithAppleScript(exe_path, launch_info); +return LaunchInNewTerminalWithAppleScript(exe_spec.GetPath().c_str(), +
[Lldb-commits] [lldb] r322183 - Fix Xcode build for r322174
Author: tnorthover Date: Wed Jan 10 05:32:01 2018 New Revision: 322183 URL: http://llvm.org/viewvc/llvm-project?rev=322183&view=rev Log: Fix Xcode build for r322174 Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=322183&r1=322182&r2=322183&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Jan 10 05:32:01 2018 @@ -53,6 +53,7 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 22DC561A20064C9700A7E9E8 /* Environment.cpp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 22DC561920064C9600A7E9E8 /* Environment.cpp */; }; 23042D121976CA1D00621B2C /* PlatformKalimba.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 23042D101976CA0A00621B2C /* PlatformKalimba.cpp */; }; 23059A0719532B96007B8189 /* LinuxSignals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 23059A0519532B96007B8189 /* LinuxSignals.cpp */; }; 23059A101958B319007B8189 /* SBUnixSignals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 23059A0F1958B319007B8189 /* SBUnixSignals.cpp */; }; @@ -1246,6 +1247,7 @@ dstSubfolderSpec = 0; files = ( 9A20570F1F3B821A00F6C293 /* test-dwarf.cpp in CopyFiles */, + 22DC561A20064C9700A7E9E8 /* Environment.cpp in CopyFiles */, 9A2057101F3B821A00F6C293 /* test-dwarf.exe in CopyFiles */, AF90106515AB7D3600FF120D /* lldb.1 in CopyFiles */, ); @@ -1268,6 +1270,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 22DC561920064C9600A7E9E8 /* Environment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Environment.cpp; path = source/Utility/Environment.cpp; sourceTree = ""; }; 23042D101976CA0A00621B2C /* PlatformKalimba.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformKalimba.cpp; sourceTree = ""; }; 23042D111976CA0A00621B2C /* PlatformKalimba.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformKalimba.h; sourceTree = ""; }; 23059A0519532B96007B8189 /* LinuxSignals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LinuxSignals.cpp; path = Utility/LinuxSignals.cpp; sourceTree = ""; }; @@ -4372,6 +4375,7 @@ 2682F168115ED9C800CCFF99 /* Utility */ = { isa = PBXGroup; children = ( + 22DC561920064C9600A7E9E8 /* Environment.cpp */, AF6CA6651FBBAF27005A0DC3 /* ArchSpec.cpp */, AF6CA6671FBBAF37005A0DC3 /* ArchSpec.h */, 26BC7D5710F1B77400F91463 /* Connection.h */, ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r322187 - Another attempt to fix FreeBsd build
Author: labath Date: Wed Jan 10 05:53:40 2018 New Revision: 322187 URL: http://llvm.org/viewvc/llvm-project?rev=322187&view=rev Log: Another attempt to fix FreeBsd build the previous fix did not work because of different const qualifications on the envp pointer. This should resolve that (and remove a couple of const_casts in the process). Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=322187&r1=322186&r2=322187&view=diff == --- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original) +++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Wed Jan 10 05:53:40 2018 @@ -407,7 +407,7 @@ Status ProcessFreeBSD::DoLaunch(Module * m_monitor = new ProcessMonitor( this, module, launch_info.GetArguments().GetConstArgumentVector(), - launch_info.GetEnvironment().getEnvp(), stdin_file_spec, stdout_file_spec, + launch_info.GetEnvironment(), stdin_file_spec, stdout_file_spec, stderr_file_spec, working_dir, launch_info, error); m_module = module; Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp?rev=322187&r1=322186&r2=322187&view=diff == --- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp (original) +++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Wed Jan 10 05:53:40 2018 @@ -38,10 +38,6 @@ #include "ProcessFreeBSD.h" #include "ProcessMonitor.h" -extern "C" { -extern char **environ; -} - using namespace lldb; using namespace lldb_private; @@ -695,13 +691,14 @@ ProcessMonitor::OperationArgs::~Operatio ProcessMonitor::LaunchArgs::LaunchArgs(ProcessMonitor *monitor, lldb_private::Module *module, - char const **argv, char const **envp, + char const **argv, Environment env, const FileSpec &stdin_file_spec, const FileSpec &stdout_file_spec, const FileSpec &stderr_file_spec, const FileSpec &working_dir) -: OperationArgs(monitor), m_module(module), m_argv(argv), m_envp(envp), - m_stdin_file_spec(stdin_file_spec), m_stdout_file_spec(stdout_file_spec), +: OperationArgs(monitor), m_module(module), m_argv(argv), + m_env(std::move(env)), m_stdin_file_spec(stdin_file_spec), + m_stdout_file_spec(stdout_file_spec), m_stderr_file_spec(stderr_file_spec), m_working_dir(working_dir) {} ProcessMonitor::LaunchArgs::~LaunchArgs() {} @@ -726,7 +723,7 @@ ProcessMonitor::AttachArgs::~AttachArgs( /// on the Operation class for more info as to why this is needed. ProcessMonitor::ProcessMonitor( ProcessFreeBSD *process, Module *module, const char *argv[], -const char *envp[], const FileSpec &stdin_file_spec, +Environment env, const FileSpec &stdin_file_spec, const FileSpec &stdout_file_spec, const FileSpec &stderr_file_spec, const FileSpec &working_dir, const lldb_private::ProcessLaunchInfo & /* launch_info */, @@ -736,7 +733,7 @@ ProcessMonitor::ProcessMonitor( using namespace std::placeholders; std::unique_ptr args( - new LaunchArgs(this, module, argv, envp, stdin_file_spec, + new LaunchArgs(this, module, argv, std::move(env), stdin_file_spec, stdout_file_spec, stderr_file_spec, working_dir)); sem_init(&m_operation_pending, 0, 0); @@ -837,7 +834,6 @@ bool ProcessMonitor::Launch(LaunchArgs * ProcessMonitor *monitor = args->m_monitor; ProcessFreeBSD &process = monitor->GetProcess(); const char **argv = args->m_argv; - const char **envp = args->m_envp; const FileSpec &stdin_file_spec = args->m_stdin_file_spec; const FileSpec &stdout_file_spec = args->m_stdout_file_spec; const FileSpec &stderr_file_spec = args->m_stderr_file_spec; @@ -849,8 +845,8 @@ bool ProcessMonitor::Launch(LaunchArgs * ::pid_t pid; // Propagate the environment if one is not supplied. - if (envp == NULL || envp[0] == NULL) -envp = const_cast(environ); + Environment::Envp envp = + (args->m_env.empty() ? Host::GetEnvironment() : args->m_env).getEnvp(); if ((pid = terminal.Fork(err_str, err_len)) == -1) { args->m_error.SetErrorToGenericError(); @@ -908,8 +904,7 @@ bool ProcessMonitor::Launch(LaunchArgs * exit(eChdirFailed); // Execute. We sho
[Lldb-commits] [PATCH] D41584: Check existence of each required component during construction of LLVMCDisassembler.
tatyana-krasnukha updated this revision to Diff 129268. tatyana-krasnukha added a comment. Added "_up" suffix to each unique_ptr, renamed MCDisasmToolset to MCDisasmInstance. https://reviews.llvm.org/D41584 Files: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h Index: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h === --- source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h +++ source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h @@ -16,62 +16,14 @@ #include #include -// Other libraries and framework includes -#include "llvm-c/Disassembler.h" - // Project includes #include "lldb/Core/Address.h" #include "lldb/Core/Disassembler.h" #include "lldb/Core/PluginManager.h" -// Opaque references to C++ Objects in LLVM's MC. -namespace llvm { -class MCContext; -class MCInst; -class MCInstrInfo; -class MCRegisterInfo; -class MCDisassembler; -class MCInstPrinter; -class MCAsmInfo; -class MCSubtargetInfo; -} // namespace llvm - class InstructionLLVMC; class DisassemblerLLVMC : public lldb_private::Disassembler { - // Since we need to make two actual MC Disassemblers for ARM (ARM & THUMB), - // and there's a bit of goo to set up and own - // in the MC disassembler world, I added this class to manage the actual - // disassemblers. - class LLVMCDisassembler { - public: -LLVMCDisassembler(const char *triple, const char *cpu, - const char *features_str, unsigned flavor, - DisassemblerLLVMC &owner); - -~LLVMCDisassembler(); - -uint64_t GetMCInst(const uint8_t *opcode_data, size_t opcode_data_len, - lldb::addr_t pc, llvm::MCInst &mc_inst); -void PrintMCInst(llvm::MCInst &mc_inst, std::string &inst_string, - std::string &comments_string); -void SetStyle(bool use_hex_immed, HexImmediateStyle hex_style); -bool CanBranch(llvm::MCInst &mc_inst); -bool HasDelaySlot(llvm::MCInst &mc_inst); -bool IsCall(llvm::MCInst &mc_inst); -bool IsValid() { return m_is_valid; } - - private: -bool m_is_valid; -std::unique_ptr m_context_ap; -std::unique_ptr m_asm_info_ap; -std::unique_ptr m_subtarget_info_ap; -std::unique_ptr m_instr_info_ap; -std::unique_ptr m_reg_info_ap; -std::unique_ptr m_instr_printer_ap; -std::unique_ptr m_disasm_ap; - }; - public: DisassemblerLLVMC(const lldb_private::ArchSpec &arch, const char *flavor /* = NULL */); @@ -108,9 +60,7 @@ bool FlavorValidForArchSpec(const lldb_private::ArchSpec &arch, const char *flavor) override; - bool IsValid() { -return (m_disasm_ap.get() != NULL && m_disasm_ap->IsValid()); - } + bool IsValid() const; int OpInfo(uint64_t PC, uint64_t Offset, uint64_t Size, int TagType, void *TagBug); @@ -145,8 +95,13 @@ std::mutex m_mutex; bool m_data_from_file; - std::unique_ptr m_disasm_ap; - std::unique_ptr m_alternate_disasm_ap; + // Since we need to make two actual MC Disassemblers for ARM (ARM & THUMB), + // and there's a bit of goo to set up and own + // in the MC disassembler world, I added this class to manage the actual + // disassemblers. + class MCDisasmInstance; + std::unique_ptr m_disasm_up; + std::unique_ptr m_alternate_disasm_up; }; #endif // liblldb_DisassemblerLLVM_h_ Index: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp === --- source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp +++ source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp @@ -10,6 +10,9 @@ // C Includes // C++ Includes // Project includes +#include "DisassemblerLLVMC.h" + +// Other libraries and framework includes #include "llvm-c/Disassembler.h" #include "llvm/ADT/SmallString.h" #include "llvm/MC/MCAsmInfo.h" @@ -27,9 +30,6 @@ #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetSelect.h" -// Other libraries and framework includes -#include "DisassemblerLLVMC.h" - #include "lldb/Core/Address.h" #include "lldb/Core/Module.h" #include "lldb/Symbol/SymbolContext.h" @@ -41,13 +41,47 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/Stream.h" -#include "lldb/Utility/RegularExpression.h" - using namespace lldb; using namespace lldb_private; +class DisassemblerLLVMC::MCDisasmInstance { +public: + static std::unique_ptr + Create(const char *triple, const char *cpu, const char *features_str, + unsigned flavor, DisassemblerLLVMC &owner); + + ~MCDisasmInstance() = default; + + uint64_t GetMCInst(const uint8_t *opcode_data, size_t opcode_data_len, + lldb::addr_t pc, llvm::MCInst &mc_inst) const; + void PrintMCInst(llvm::MCInst &mc_inst, std::string &in
[Lldb-commits] [lldb] r322188 - Add empty() function to the Environment class
Author: labath Date: Wed Jan 10 06:17:40 2018 New Revision: 322188 URL: http://llvm.org/viewvc/llvm-project?rev=322188&view=rev Log: Add empty() function to the Environment class Needed to make the previous Freebsd fix work. Modified: lldb/trunk/include/lldb/Utility/Environment.h Modified: lldb/trunk/include/lldb/Utility/Environment.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Environment.h?rev=322188&r1=322187&r2=322188&view=diff == --- lldb/trunk/include/lldb/Utility/Environment.h (original) +++ lldb/trunk/include/lldb/Utility/Environment.h Wed Jan 10 06:17:40 2018 @@ -46,6 +46,7 @@ public: using Base::begin; using Base::clear; using Base::count; + using Base::empty; using Base::end; using Base::erase; using Base::find; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41745: Handle O reply packets during qRcmd
This revision was automatically updated to reflect the committed changes. Closed by commit rL322190: Handle O reply packets during qRcmd (authored by labath, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D41745?vs=128991&id=129273#toc Repository: rL LLVM https://reviews.llvm.org/D41745 Files: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp Index: lldb/trunk/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp === --- lldb/trunk/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp +++ lldb/trunk/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp @@ -339,3 +339,23 @@ ASSERT_TRUE(async_result.get()); ASSERT_EQ(eStateInvalid, continue_state.get()); } + +TEST_F(GDBRemoteClientBaseTest, SendPacketAndReceiveResponseWithOutputSupport) { + StringExtractorGDBRemote response; + StreamString command_output; + + ASSERT_EQ(PacketResult::Success, server.SendPacket("O")); + ASSERT_EQ(PacketResult::Success, server.SendPacket("O48656c6c6f2c")); + ASSERT_EQ(PacketResult::Success, server.SendPacket("O20")); + ASSERT_EQ(PacketResult::Success, server.SendPacket("O")); + ASSERT_EQ(PacketResult::Success, server.SendPacket("O776f726c64")); + ASSERT_EQ(PacketResult::Success, server.SendPacket("OK")); + + PacketResult result = client.SendPacketAndReceiveResponseWithOutputSupport( + "qRcmd,test", response, true, + [&command_output](llvm::StringRef output) { command_output << output; }); + + ASSERT_EQ(PacketResult::Success, result); + ASSERT_EQ("OK", response.GetStringRef()); + ASSERT_EQ("Hello, world", command_output.GetString().str()); +} Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h @@ -48,6 +48,11 @@ StringExtractorGDBRemote &response, bool send_async); + PacketResult SendPacketAndReceiveResponseWithOutputSupport( + llvm::StringRef payload, StringExtractorGDBRemote &response, + bool send_async, + llvm::function_ref output_callback); + bool SendvContPacket(llvm::StringRef payload, StringExtractorGDBRemote &response); Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp === --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -5145,10 +5145,11 @@ bool send_async = true; StringExtractorGDBRemote response; - process->GetGDBRemote().SendPacketAndWaitForResponse( - packet.GetString(), response, send_async); - result.SetStatus(eReturnStatusSuccessFinishResult); Stream &output_strm = result.GetOutputStream(); + process->GetGDBRemote().SendPacketAndReceiveResponseWithOutputSupport( + packet.GetString(), response, send_async, + [&output_strm](llvm::StringRef output) { output_strm << output; }); + result.SetStatus(eReturnStatusSuccessFinishResult); output_strm.Printf(" packet: %s\n", packet.GetData()); const std::string &response_str = response.GetStringRef(); 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 @@ -232,6 +232,11 @@ PacketResult ReadPacket(StringExtractorGDBRemote &response, Timeout timeout, bool sync_on_timeout); + PacketResult ReadPacketWithOutputSupport( + StringExtractorGDBRemote &response, Timeout timeout, + bool sync_on_timeout, + llvm::function_ref output_callback); + // Pop a packet from the queue in a thread safe manner PacketResult PopPacketFromQueue(StringExtractorGDBRemote &response, Timeout timeout); Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp @@ -177,6 +177,30 @@ } GDBRemoteCo
[Lldb-commits] [lldb] r322190 - Handle O reply packets during qRcmd
Author: labath Date: Wed Jan 10 06:39:08 2018 New Revision: 322190 URL: http://llvm.org/viewvc/llvm-project?rev=322190&view=rev Log: Handle O reply packets during qRcmd Summary: Gdb servers like openocd may send many $O reply packets for the client to output during a qRcmd command sequence. Currently, lldb interprets the first O packet as an unexpected response. Besides generating no output, this causes lldb to get out of sync with future commands because it continues reading O packets from the first command as response to subsequent commands. This patch handles any O packets during an qRcmd, treating the first non-O packet as the true response. Preliminary discussion at http://lists.llvm.org/pipermail/lldb-dev/2018-January/013078.html Reviewers: clayborg Reviewed By: clayborg Subscribers: labath, lldb-commits Differential Revision: https://reviews.llvm.org/D41745 Patch by Owen Shaw Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp?rev=322190&r1=322189&r2=322190&view=diff == --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp Wed Jan 10 06:39:08 2018 @@ -177,6 +177,30 @@ GDBRemoteClientBase::SendPacketAndWaitFo } GDBRemoteCommunication::PacketResult +GDBRemoteClientBase::SendPacketAndReceiveResponseWithOutputSupport( +llvm::StringRef payload, StringExtractorGDBRemote &response, +bool send_async, +llvm::function_ref output_callback) { + Lock lock(*this, send_async); + if (!lock) { +if (Log *log = +ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)) + log->Printf("GDBRemoteClientBase::%s failed to get mutex, not sending " + "packet '%.*s' (send_async=%d)", + __FUNCTION__, int(payload.size()), payload.data(), + send_async); +return PacketResult::ErrorSendFailed; + } + + PacketResult packet_result = SendPacketNoLock(payload); + if (packet_result != PacketResult::Success) +return packet_result; + + return ReadPacketWithOutputSupport(response, GetPacketTimeout(), true, + output_callback); +} + +GDBRemoteCommunication::PacketResult GDBRemoteClientBase::SendPacketAndWaitForResponseNoLock( llvm::StringRef payload, StringExtractorGDBRemote &response) { PacketResult packet_result = SendPacketNoLock(payload); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h?rev=322190&r1=322189&r2=322190&view=diff == --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h Wed Jan 10 06:39:08 2018 @@ -48,6 +48,11 @@ public: StringExtractorGDBRemote &response, bool send_async); + PacketResult SendPacketAndReceiveResponseWithOutputSupport( + llvm::StringRef payload, StringExtractorGDBRemote &response, + bool send_async, + llvm::function_ref output_callback); + bool SendvContPacket(llvm::StringRef payload, StringExtractorGDBRemote &response); 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=322190&r1=322189&r2=322190&view=diff == --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Wed Jan 10 06:39:08 2018 @@ -275,6 +275,23 @@ GDBRemoteCommunication::PacketResult GDB } GDBRemoteCommunication::PacketResult +GDBRemoteCommunication::ReadPacketWithOutputSupport( +StringExtractorGDBRemote &response, Timeout timeout, +bool sync_on_timeout, +llvm::function_ref output_callback) { + auto result = ReadPacket(response, timeout, sync_on_timeout); + while (result == PacketResult::Success && response.IsNormalResponse() && +
[Lldb-commits] [PATCH] D41745: Handle O reply packets during qRcmd
labath added a comment. Committed as r322190. I've changed one more std::function to function_ref and re-clang-formatted the patch. Repository: rL LLVM https://reviews.llvm.org/D41745 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41584: Check existence of each required component during construction of LLVMCDisassembler.
tatyana-krasnukha added a comment. There is the function GetDisasmToUse in InstructionLLVMC class that can return nullptr. But this case is not handled in any usage. I suppose that caller functions cannot be invoked if !DisassemblerLLVMC::IsValid(). But it still looks dangerous for me. May be GetDisasmToUse should assert if neither m_disasm_up nor m_alternate_disasm_up exists? And may return a reference then. https://reviews.llvm.org/D41584 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41902: Remove Platform references from the Host module
davide accepted this revision. davide added a comment. This revision is now accepted and ready to land. This LGTM but please wait for a second opinion. https://reviews.llvm.org/D41902 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41909: Fix deadlock in dwarf logging
fjricci created this revision. fjricci added reviewers: clayborg, zturner, tberghammer. Herald added subscribers: JDevlieghere, aprantl. When dwarf parse logging is enabled (ie `log enable dwarf info`), deadlocks can occur during dwarf parsing: Thread 1: `SymbolVendor::FindFunctions` (acquires mutex for Module) `SymbolFileDWARF::Index` Task pool threads: `ExtractDIEsIfNeeded` `Module::LogMessageVerboseBacktrace` `Module::GetDescription` (tries to acquire mutex for Module and deadlocks) Since `GetDescription` is read-only, only touches fairly immutable data (architecture and filename), and is only used for logging, the most straightforward fix is to remove the lock guard from this function. https://reviews.llvm.org/D41909 Files: source/Core/Module.cpp Index: source/Core/Module.cpp === --- source/Core/Module.cpp +++ source/Core/Module.cpp @@ -1077,8 +1077,6 @@ } void Module::GetDescription(Stream *s, lldb::DescriptionLevel level) { - std::lock_guard guard(m_mutex); - if (level >= eDescriptionLevelFull) { if (m_arch.IsValid()) s->Printf("(%s) ", m_arch.GetArchitectureName()); Index: source/Core/Module.cpp === --- source/Core/Module.cpp +++ source/Core/Module.cpp @@ -1077,8 +1077,6 @@ } void Module::GetDescription(Stream *s, lldb::DescriptionLevel level) { - std::lock_guard guard(m_mutex); - if (level >= eDescriptionLevelFull) { if (m_arch.IsValid()) s->Printf("(%s) ", m_arch.GetArchitectureName()); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41533: Advanced guessing of rendezvous breakpoint
ted added a comment. Thanks for adding me, Pavel. Hexagon running Linux uses this plugin. These changes lgtm. Standalone Hexagon uses its own dyld plugin; I need to look at it and see if I want to pull any of these ideas into it. https://reviews.llvm.org/D41533 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41909: Fix deadlock in dwarf logging
zturner added a comment. `GetDescription` might be read only, but the code that modifies the description isn't, right? https://reviews.llvm.org/D41909 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41909: Fix deadlock in dwarf logging
fjricci added a comment. I guess the question is whether we expect that someone will do something like change the module's filepath while we're printing a log message with that filepath in it. https://reviews.llvm.org/D41909 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41909: Fix deadlock in dwarf logging
fjricci added a comment. Actually I don't think even that is racy, because we just get a pointer to the const char *, which is immutable anyway. https://reviews.llvm.org/D41909 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41909: Fix deadlock in dwarf logging
fjricci added a comment. It's definitely possible to re-design the lock holding in such a way that we can keep this locked, but I don't want to go through all the work to do that if there isn't any added value to doing so. https://reviews.llvm.org/D41909 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r322188 - Add empty() function to the Environment class
Picking a random commit in the `Environment` series. Hey Pavel, I'm currently seeing errors when building with Xcode Ld build/DebugClang/lldb-server normal x86_64 cd /Users/davide/work/lldb export MACOSX_DEPLOYMENT_TARGET=10.11 /Volumes/Xcode10A36a_m18A103_i16A160a_t16J145_w16R149_XcodeInternals_29GB/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Volumes/Xcode10A36a_m18A103_i16A160a_t16J145_w16R149_XcodeInternals_29GB/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -L/Users/davide/work/lldb/build/DebugClang -L/Users/davide/work/lldb/llvm-build/Debug+Asserts/x86_64 -F/Users/davide/work/lldb/build/DebugClang -F/Volumes/Xcode10A36a_m18A103_i16A160a_t16J145_w16R149_XcodeInternals_29GB/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/PrivateFrameworks -filelist /Users/davide/work/lldb/build/lldb.build/DebugClang/lldb-server.build/Objects-normal/x86_64/lldb-server.LinkFileList -exported_symbols_list tools/lldb-server/lldb-server.exports -mmacosx-version-min=10.11 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/davide/work/lldb/build/lldb.build/DebugClang/lldb-server.build/Objects-normal/x86_64/lldb-server_lto.o -Xlinker -no_deduplicate -stdlib=libc++ -weak-lcompression -lz -filelist /Users/davide/work/lldb/llvm-build/Debug+Asserts/archives.txt -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -lpython2.7 -lxml2 -framework DebugSymbols -framework Foundation -framework Carbon -framework Security -lpanel -lz -lncurses -ledit /Users/davide/work/lldb/build/DebugClang/liblldb-core.a -Xlinker -dependency_info -Xlinker /Users/davide/work/lldb/build/lldb.build/DebugClang/lldb-server.build/Objects-normal/x86_64/lldb-server_dependency_info.dat -o /Users/davide/work/lldb/build/DebugClang/lldb-server Undefined symbols for architecture x86_64: "lldb_private::Environment::Envp::Envp(lldb_private::Environment const&)", referenced from: lldb_private::Environment::getEnvp() const in liblldb-core.a(Host-9B62CE0F4D4B7B7B.o) "lldb_private::Environment::Environment(char const* const*)", referenced from: lldb_private::Environment::Environment(char* const*) in liblldb-core.a(Host-9B62CE0F4D4B7B7B.o) lldb_private::Args::operator lldb_private::Environment() const in liblldb-core.a(Target.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Do you know what could be? (note this is a fresh build of lldb). Thanks! -- Davide On Wed, Jan 10, 2018 at 6:17 AM, Pavel Labath via lldb-commits wrote: > Author: labath > Date: Wed Jan 10 06:17:40 2018 > New Revision: 322188 > > URL: http://llvm.org/viewvc/llvm-project?rev=322188&view=rev > Log: > Add empty() function to the Environment class > > Needed to make the previous Freebsd fix work. > > Modified: > lldb/trunk/include/lldb/Utility/Environment.h > > Modified: lldb/trunk/include/lldb/Utility/Environment.h > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Environment.h?rev=322188&r1=322187&r2=322188&view=diff > == > --- lldb/trunk/include/lldb/Utility/Environment.h (original) > +++ lldb/trunk/include/lldb/Utility/Environment.h Wed Jan 10 06:17:40 2018 > @@ -46,6 +46,7 @@ public: >using Base::begin; >using Base::clear; >using Base::count; > + using Base::empty; >using Base::end; >using Base::erase; >using Base::find; > > > ___ > lldb-commits mailing list > lldb-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r322188 - Add empty() function to the Environment class
Also, the upstream `lldb-xcode` bot is red http://lab.llvm.org:8080/green/view/LLDB/job/lldb-xcode/ On Wed, Jan 10, 2018 at 10:26 AM, Davide Italiano wrote: > Picking a random commit in the `Environment` series. > Hey Pavel, I'm currently seeing errors when building with Xcode > > Ld build/DebugClang/lldb-server normal x86_64 > > cd /Users/davide/work/lldb > > export MACOSX_DEPLOYMENT_TARGET=10.11 > > > /Volumes/Xcode10A36a_m18A103_i16A160a_t16J145_w16R149_XcodeInternals_29GB/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ > -arch x86_64 -isysroot > /Volumes/Xcode10A36a_m18A103_i16A160a_t16J145_w16R149_XcodeInternals_29GB/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk > -L/Users/davide/work/lldb/build/DebugClang > -L/Users/davide/work/lldb/llvm-build/Debug+Asserts/x86_64 > -F/Users/davide/work/lldb/build/DebugClang > -F/Volumes/Xcode10A36a_m18A103_i16A160a_t16J145_w16R149_XcodeInternals_29GB/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/PrivateFrameworks > -filelist > /Users/davide/work/lldb/build/lldb.build/DebugClang/lldb-server.build/Objects-normal/x86_64/lldb-server.LinkFileList > -exported_symbols_list tools/lldb-server/lldb-server.exports > -mmacosx-version-min=10.11 -dead_strip -Xlinker -object_path_lto > -Xlinker > /Users/davide/work/lldb/build/lldb.build/DebugClang/lldb-server.build/Objects-normal/x86_64/lldb-server_lto.o > -Xlinker -no_deduplicate -stdlib=libc++ -weak-lcompression -lz > -filelist /Users/davide/work/lldb/llvm-build/Debug+Asserts/archives.txt > -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config > -lpython2.7 -lxml2 -framework DebugSymbols -framework Foundation > -framework Carbon -framework Security -lpanel -lz -lncurses -ledit > /Users/davide/work/lldb/build/DebugClang/liblldb-core.a -Xlinker > -dependency_info -Xlinker > /Users/davide/work/lldb/build/lldb.build/DebugClang/lldb-server.build/Objects-normal/x86_64/lldb-server_dependency_info.dat > -o /Users/davide/work/lldb/build/DebugClang/lldb-server > > > Undefined symbols for architecture x86_64: > > "lldb_private::Environment::Envp::Envp(lldb_private::Environment > const&)", referenced from: > > lldb_private::Environment::getEnvp() const in > liblldb-core.a(Host-9B62CE0F4D4B7B7B.o) > > "lldb_private::Environment::Environment(char const* const*)", referenced > from: > > lldb_private::Environment::Environment(char* const*) in > liblldb-core.a(Host-9B62CE0F4D4B7B7B.o) > > lldb_private::Args::operator lldb_private::Environment() const > in liblldb-core.a(Target.o) > > ld: symbol(s) not found for architecture x86_64 > > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > > > Do you know what could be? (note this is a fresh build of lldb). > > Thanks! > > -- > Davide > > > On Wed, Jan 10, 2018 at 6:17 AM, Pavel Labath via lldb-commits > wrote: >> Author: labath >> Date: Wed Jan 10 06:17:40 2018 >> New Revision: 322188 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=322188&view=rev >> Log: >> Add empty() function to the Environment class >> >> Needed to make the previous Freebsd fix work. >> >> Modified: >> lldb/trunk/include/lldb/Utility/Environment.h >> >> Modified: lldb/trunk/include/lldb/Utility/Environment.h >> URL: >> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Environment.h?rev=322188&r1=322187&r2=322188&view=diff >> == >> --- lldb/trunk/include/lldb/Utility/Environment.h (original) >> +++ lldb/trunk/include/lldb/Utility/Environment.h Wed Jan 10 06:17:40 2018 >> @@ -46,6 +46,7 @@ public: >>using Base::begin; >>using Base::clear; >>using Base::count; >> + using Base::empty; >>using Base::end; >>using Base::erase; >>using Base::find; >> >> >> ___ >> lldb-commits mailing list >> lldb-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods
> On Jan 9, 2018, at 9:31 PM, Nelson Elhage via Phabricator > wrote: > > nelhage added a comment. > > Hey -- Is there anything I can do to move this patch forward? Would it help > to do something like only setting the attribute if the mangled name that > *would* be generated doesn't match the one from the DWARF? Any such symbol is > already broken for lldb, so such a patch feels perhaps safer and more > conservative, at the cost of a bit of added complexity. That sounds fine from a complexity standpoint, but I worry about the performance impact of doing more work than we already do on all mangled names we look at. Jim > > > https://reviews.llvm.org/D40283 > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r322208 - [XCodebuild] Catch up with recent changes (Environment.cpp).
Author: davide Date: Wed Jan 10 10:53:00 2018 New Revision: 322208 URL: http://llvm.org/viewvc/llvm-project?rev=322208&view=rev Log: [XCodebuild] Catch up with recent changes (Environment.cpp). Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=322208&r1=322207&r2=322208&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Jan 10 10:53:00 2018 @@ -53,7 +53,6 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ - 22DC561A20064C9700A7E9E8 /* Environment.cpp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 22DC561920064C9600A7E9E8 /* Environment.cpp */; }; 23042D121976CA1D00621B2C /* PlatformKalimba.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 23042D101976CA0A00621B2C /* PlatformKalimba.cpp */; }; 23059A0719532B96007B8189 /* LinuxSignals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 23059A0519532B96007B8189 /* LinuxSignals.cpp */; }; 23059A101958B319007B8189 /* SBUnixSignals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 23059A0F1958B319007B8189 /* SBUnixSignals.cpp */; }; @@ -753,6 +752,8 @@ 4CF52AF51428291E0051E832 /* SBFileSpecList.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CF52AF41428291E0051E832 /* SBFileSpecList.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4CF52AF8142829390051E832 /* SBFileSpecList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CF52AF7142829390051E832 /* SBFileSpecList.cpp */; }; 54067BF11DF2041B00749AA5 /* UBSanRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 54067BEC1DF2034B00749AA5 /* UBSanRuntime.cpp */; }; + 6B74D89B200696BB0074051B /* Environment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 22DC561920064C9600A7E9E8 /* Environment.cpp */; }; + 6B74D89D2006972E0074051B /* Environment.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 6B74D89C2006972D0074051B /* Environment.h */; }; 6D0F61431C80AAAE00A4ECEE /* JavaASTContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D0F61411C8000A4ECEE /* JavaASTContext.cpp */; }; 6D0F61481C80AAD600A4ECEE /* DWARFASTParserJava.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D0F61441C80AACF00A4ECEE /* DWARFASTParserJava.cpp */; }; 6D0F614E1C80AB0700A4ECEE /* JavaLanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D0F614A1C80AB0400A4ECEE /* JavaLanguageRuntime.cpp */; }; @@ -1246,8 +1247,8 @@ dstPath = "$(DEVELOPER_INSTALL_DIR)/usr/share/man/man1"; dstSubfolderSpec = 0; files = ( + 6B74D89D2006972E0074051B /* Environment.h in CopyFiles */, 9A20570F1F3B821A00F6C293 /* test-dwarf.cpp in CopyFiles */, - 22DC561A20064C9700A7E9E8 /* Environment.cpp in CopyFiles */, 9A2057101F3B821A00F6C293 /* test-dwarf.exe in CopyFiles */, AF90106515AB7D3600FF120D /* lldb.1 in CopyFiles */, ); @@ -2642,6 +2643,7 @@ 54067BED1DF2034B00749AA5 /* UBSanRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UBSanRuntime.h; sourceTree = ""; }; 69A01E1C1236C5D400C660B5 /* Host.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Host.cpp; sourceTree = ""; }; 69A01E1F1236C5D400C660B5 /* Symbols.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Symbols.cpp; sourceTree = ""; }; + 6B74D89C2006972D0074051B /* Environment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Environment.h; path = include/lldb/Utility/Environment.h; sourceTree = ""; }; 6D0F613C1C80AA8900A4ECEE /* DebugMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DebugMacros.h; path = include/lldb/Symbol/DebugMacros.h; sourceTree = ""; }; 6D0F613D1C80AA8900A4ECEE /* JavaASTContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JavaASTContext.h; path = include/lldb/Symbol/JavaASTContext.h; sourceTree = ""; }; 6D0F61411C8000A4ECEE /* JavaASTContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JavaASTContext.cpp; path = source/Symbol/JavaASTContext.cpp; sourceTree = ""; }; @@ -4375,6 +4377,7 @@ 2682F168115
Re: [Lldb-commits] [lldb] r322188 - Add empty() function to the Environment class
Tim added it to the Xcode project, but added it to the wrong target. All lldb_private implementation files need to be added to the lldb-core target. We also add all the .h files to the project alongside their .cpp files, but the .h files for don't get added to any target (to keep Xcode's header map's from doing magic that won't work with cmake. I think Davide already fixed this, but just so folks know what should be done w/o having to figure out what a raw patch to an Xcode project file means... Jim > On Jan 10, 2018, at 10:27 AM, Davide Italiano via lldb-commits > wrote: > > Also, the upstream `lldb-xcode` bot is red > http://lab.llvm.org:8080/green/view/LLDB/job/lldb-xcode/ > > On Wed, Jan 10, 2018 at 10:26 AM, Davide Italiano > wrote: >> Picking a random commit in the `Environment` series. >> Hey Pavel, I'm currently seeing errors when building with Xcode >> >> Ld build/DebugClang/lldb-server normal x86_64 >> >>cd /Users/davide/work/lldb >> >>export MACOSX_DEPLOYMENT_TARGET=10.11 >> >> >> /Volumes/Xcode10A36a_m18A103_i16A160a_t16J145_w16R149_XcodeInternals_29GB/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ >> -arch x86_64 -isysroot >> /Volumes/Xcode10A36a_m18A103_i16A160a_t16J145_w16R149_XcodeInternals_29GB/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk >> -L/Users/davide/work/lldb/build/DebugClang >> -L/Users/davide/work/lldb/llvm-build/Debug+Asserts/x86_64 >> -F/Users/davide/work/lldb/build/DebugClang >> -F/Volumes/Xcode10A36a_m18A103_i16A160a_t16J145_w16R149_XcodeInternals_29GB/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/PrivateFrameworks >> -filelist >> /Users/davide/work/lldb/build/lldb.build/DebugClang/lldb-server.build/Objects-normal/x86_64/lldb-server.LinkFileList >> -exported_symbols_list tools/lldb-server/lldb-server.exports >> -mmacosx-version-min=10.11 -dead_strip -Xlinker -object_path_lto >> -Xlinker >> /Users/davide/work/lldb/build/lldb.build/DebugClang/lldb-server.build/Objects-normal/x86_64/lldb-server_lto.o >> -Xlinker -no_deduplicate -stdlib=libc++ -weak-lcompression -lz >> -filelist /Users/davide/work/lldb/llvm-build/Debug+Asserts/archives.txt >> -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config >> -lpython2.7 -lxml2 -framework DebugSymbols -framework Foundation >> -framework Carbon -framework Security -lpanel -lz -lncurses -ledit >> /Users/davide/work/lldb/build/DebugClang/liblldb-core.a -Xlinker >> -dependency_info -Xlinker >> /Users/davide/work/lldb/build/lldb.build/DebugClang/lldb-server.build/Objects-normal/x86_64/lldb-server_dependency_info.dat >> -o /Users/davide/work/lldb/build/DebugClang/lldb-server >> >> >> Undefined symbols for architecture x86_64: >> >> "lldb_private::Environment::Envp::Envp(lldb_private::Environment >> const&)", referenced from: >> >> lldb_private::Environment::getEnvp() const in >> liblldb-core.a(Host-9B62CE0F4D4B7B7B.o) >> >> "lldb_private::Environment::Environment(char const* const*)", referenced >> from: >> >> lldb_private::Environment::Environment(char* const*) in >> liblldb-core.a(Host-9B62CE0F4D4B7B7B.o) >> >> lldb_private::Args::operator lldb_private::Environment() const >> in liblldb-core.a(Target.o) >> >> ld: symbol(s) not found for architecture x86_64 >> >> clang: error: linker command failed with exit code 1 (use -v to see >> invocation) >> >> >> Do you know what could be? (note this is a fresh build of lldb). >> >> Thanks! >> >> -- >> Davide >> >> >> On Wed, Jan 10, 2018 at 6:17 AM, Pavel Labath via lldb-commits >> wrote: >>> Author: labath >>> Date: Wed Jan 10 06:17:40 2018 >>> New Revision: 322188 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=322188&view=rev >>> Log: >>> Add empty() function to the Environment class >>> >>> Needed to make the previous Freebsd fix work. >>> >>> Modified: >>>lldb/trunk/include/lldb/Utility/Environment.h >>> >>> Modified: lldb/trunk/include/lldb/Utility/Environment.h >>> URL: >>> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Environment.h?rev=322188&r1=322187&r2=322188&view=diff >>> == >>> --- lldb/trunk/include/lldb/Utility/Environment.h (original) >>> +++ lldb/trunk/include/lldb/Utility/Environment.h Wed Jan 10 06:17:40 2018 >>> @@ -46,6 +46,7 @@ public: >>> using Base::begin; >>> using Base::clear; >>> using Base::count; >>> + using Base::empty; >>> using Base::end; >>> using Base::erase; >>> using Base::find; >>> >>> >>> ___ >>> lldb-commits mailing list >>> lldb-commits@lists.llvm.org >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits > ___ > lldb-commits mailing list > lldb-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-co
[Lldb-commits] [lldb] r322209 - Advanced guessing of rendezvous breakpoint
Author: eugene Date: Wed Jan 10 11:04:36 2018 New Revision: 322209 URL: http://llvm.org/viewvc/llvm-project?rev=322209&view=rev Log: Advanced guessing of rendezvous breakpoint When rendezvous structure is not initialized we need to set up rendezvous breakpoint anyway. In this case the code will locate dynamic loader (interpreter) and look for known function names. Bug: https://bugs.llvm.org/show_bug.cgi?id=25806 Differential Revision: https://reviews.llvm.org/D41533 Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py?rev=322209&r1=322208&r2=322209&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py Wed Jan 10 11:04:36 2018 @@ -17,23 +17,23 @@ class TestBreakpointInGlobalConstructors mydir = TestBase.compute_mydir(__file__) NO_DEBUG_INFO_TESTCASE = True -def setUp(self): -TestBase.setUp(self) +def test(self): +self.build() self.line_foo = line_number('foo.cpp', '// !BR_foo') self.line_main = line_number('main.cpp', '// !BR_main') -@expectedFailureAll(bugnumber="llvm.org/pr35480", oslist=["linux"]) -def test(self): -self.build() -exe = os.path.join(os.getcwd(), "a.out") -self.runCmd("file %s" % exe) +target = self.dbg.CreateTarget("a.out") +self.assertTrue(target, VALID_TARGET) + +env= self.registerSharedLibrariesWithTarget(target, ["foo"]) bp_main = lldbutil.run_break_set_by_file_and_line( self, 'main.cpp', self.line_main) bp_foo = lldbutil.run_break_set_by_file_and_line( self, 'foo.cpp', self.line_foo) -self.runCmd("run") +process = target.LaunchSimple( +None, env, self.get_process_working_directory()) self.assertIsNotNone( lldbutil.get_one_thread_stopped_at_breakpoint_id( Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py?rev=322209&r1=322208&r2=322209&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py Wed Jan 10 11:04:36 2018 @@ -368,7 +368,6 @@ class LoadUnloadTestCase(TestBase): @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently -@unittest2.expectedFailure("llvm.org/pr25806") def test_static_init_during_load(self): """Test that we can set breakpoints correctly in static initializers""" @@ -395,19 +394,19 @@ class LoadUnloadTestCase(TestBase): self.runCmd("continue") self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', - 'a_init', - 'stop reason = breakpoint %d' % a_init_bp_num]) + 'b_init', + 'stop reason = breakpoint %d' % b_init_bp_num]) self.expect("thread backtrace", -substrs=['a_init', +substrs=['b_init', 'dlopen', 'main']) self.runCmd("continue") self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', - 'b_init', - 'stop reason = breakpoint %d' % b_init_bp_num]) + 'a_init', + 'stop reason = breakpoint %d' % a_init_bp_num]) self.expect("thread backtrace", -substrs=['b_init', +substrs=['a_init', 'dlopen', 'main']) Modified: lldb/trun
[Lldb-commits] [PATCH] D41533: Advanced guessing of rendezvous breakpoint
This revision was automatically updated to reflect the committed changes. Closed by commit rL322209: Advanced guessing of rendezvous breakpoint (authored by eugene, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D41533?vs=129216&id=129309#toc Repository: rL LLVM https://reviews.llvm.org/D41533 Files: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h Index: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp === --- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -79,7 +79,8 @@ : DynamicLoader(process), m_rendezvous(process), m_load_offset(LLDB_INVALID_ADDRESS), m_entry_point(LLDB_INVALID_ADDRESS), m_auxv(), m_dyld_bid(LLDB_INVALID_BREAK_ID), - m_vdso_base(LLDB_INVALID_ADDRESS) {} + m_vdso_base(LLDB_INVALID_ADDRESS), + m_interpreter_base(LLDB_INVALID_ADDRESS) {} DynamicLoaderPOSIXDYLD::~DynamicLoaderPOSIXDYLD() { if (m_dyld_bid != LLDB_INVALID_BREAK_ID) { @@ -117,7 +118,7 @@ : "", load_offset); - EvalVdsoStatus(); + EvalSpecialModulesStatus(); // if we dont have a load address we cant re-base bool rebase_exec = (load_offset == LLDB_INVALID_ADDRESS) ? false : true; @@ -207,7 +208,7 @@ executable = GetTargetExecutable(); load_offset = ComputeLoadOffset(); - EvalVdsoStatus(); + EvalSpecialModulesStatus(); if (executable.get() && load_offset != LLDB_INVALID_ADDRESS) { ModuleList module_list; @@ -217,7 +218,12 @@ if (log) log->Printf("DynamicLoaderPOSIXDYLD::%s about to call ProbeEntry()", __FUNCTION__); -ProbeEntry(); + +if (!SetRendezvousBreakpoint()) { + // If we cannot establish rendezvous breakpoint right now + // we'll try again at entry point. + ProbeEntry(); +} m_process->GetTarget().ModulesDidLoad(module_list); } @@ -329,38 +335,77 @@ return false; // Continue running. } -void DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint() { +bool DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint() { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + if (m_dyld_bid != LLDB_INVALID_BREAK_ID) { +LLDB_LOG(log, + "Rendezvous breakpoint breakpoint id {0} for pid {1}" + "is already set.", + m_dyld_bid, + m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID); +return true; + } - addr_t break_addr = m_rendezvous.GetBreakAddress(); + addr_t break_addr; Target &target = m_process->GetTarget(); - - if (m_dyld_bid == LLDB_INVALID_BREAK_ID) { -if (log) - log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64 - " setting rendezvous break address at 0x%" PRIx64, - __FUNCTION__, - m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID, - break_addr); -Breakpoint *dyld_break = -target.CreateBreakpoint(break_addr, true, false).get(); -dyld_break->SetCallback(RendezvousBreakpointHit, this, true); -dyld_break->SetBreakpointKind("shared-library-event"); -m_dyld_bid = dyld_break->GetID(); + BreakpointSP dyld_break; + if (m_rendezvous.IsValid()) { +break_addr = m_rendezvous.GetBreakAddress(); +LLDB_LOG(log, "Setting rendezvous break address for pid {0} at {1:x}", + m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID, + break_addr); +dyld_break = target.CreateBreakpoint(break_addr, true, false); } else { -if (log) - log->Printf("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64 - " reusing break id %" PRIu32 ", address at 0x%" PRIx64, - __FUNCTION__, - m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID, - m_dyld_bid, break_addr); +LLDB_LOG(log, "Rendezvous structure is not set up yet. " + "Trying to locate rendezvous breakpoint in the interpreter " + "by symbol name."); +ModuleSP interpreter = LoadInterpreterModule(); +if (!interpreter) { + LLDB_LOG(log, "Can't find interpreter, rendezvous breakpoint isn't set."); + return false; +} + +// Function names from different dynamic loaders that are known +// to be used as rendezvous between the loader and debuggers. +static std::vector DebugStateCandidates{ +"_dl_debug_state", "rtld_db_dlactivity", "__dl_rtld_db_dlactivity", +"
[Lldb-commits] [PATCH] D41584: Check existence of each required component during construction of LLVMCDisassembler.
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Fix comment spacing as mentioned in inline comments and this is good to go. Comment at: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h:98-101 + // Since we need to make two actual MC Disassemblers for ARM (ARM & THUMB), + // and there's a bit of goo to set up and own + // in the MC disassembler world, I added this class to manage the actual + // disassemblers. Fix spacing on these comments since they are new. https://reviews.llvm.org/D41584 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41533: Advanced guessing of rendezvous breakpoint
clayborg added a comment. Looks good. Repository: rL LLVM https://reviews.llvm.org/D41533 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41902: Remove Platform references from the Host module
clayborg added a comment. As long as: % lldb /path/to/Foo.app (lldb) r Still works, then I am fine with this. The resolve executable should find the executable down inside the app bundle (like "/path/to/Foo.app/Contents/MacOS/Foo" for desktop apps and "/path/to/Foo.app/Foo" for iOS apps). https://reviews.llvm.org/D41902 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41909: Fix deadlock in dwarf logging
clayborg added a comment. Tough to call on this one. Yes the function is dumping simple stuff, but it is using m_arch, m_file and m_objname. It could cause crashes in multi-threaded environments. Is the deadlock caused by an A/B lock issue? https://reviews.llvm.org/D41909 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41902: Remove Platform references from the Host module
zturner added a comment. In https://reviews.llvm.org/D41902#972614, @clayborg wrote: > As long as: > > % lldb /path/to/Foo.app > (lldb) r > > > Still works, then I am fine with this. The resolve executable should find the > executable down inside the app bundle (like > "/path/to/Foo.app/Contents/MacOS/Foo" for desktop apps and > "/path/to/Foo.app/Foo" for iOS apps). This sounds like something that would be pretty easy to write a test for with `lldb-test`. https://reviews.llvm.org/D41902 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods
clayborg added a comment. Sounds like finding a clang expert to clarify what Jim last asked for is the way forward. Do a source control "blame" command and see who worked on the code in the area of clang and maybe add them as reviewers so they can comment? I agree with Jim that this sounds like a good fix, but we should be careful. Is there no other way to detect this special "asm" name? No extra DWARF attributes? https://reviews.llvm.org/D40283 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods
clayborg added a comment. Added Adrian Prantl as a reviewer in case he has any input. Adrian: is there any way that a DIE is marked up with an extra attribute when the asm name is explicitly set? It would be great to know this from the DWARF so we don't have to end up setting the ASM name for every single possibly affected DIE... https://reviews.llvm.org/D40283 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods
clayborg added a comment. And I do agree with Jim that we don't want to have to mangle the typename to see if it matches, that is too much work. https://reviews.llvm.org/D40283 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D41902: Remove Platform references from the Host module
davide added a comment. In https://reviews.llvm.org/D41902#972619, @zturner wrote: > In https://reviews.llvm.org/D41902#972614, @clayborg wrote: > > > As long as: > > > > % lldb /path/to/Foo.app > > (lldb) r > > > > > > Still works, then I am fine with this. The resolve executable should find > > the executable down inside the app bundle (like > > "/path/to/Foo.app/Contents/MacOS/Foo" for desktop apps and > > "/path/to/Foo.app/Foo" for iOS apps). > > > This sounds like something that would be pretty easy to write a test for with > `lldb-test`. Yes, please add a test. https://reviews.llvm.org/D41902 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods
aprantl added a comment. In https://reviews.llvm.org/D40283#972622, @clayborg wrote: > Added Adrian Prantl as a reviewer in case he has any input. Adrian: is there > any way that a DIE is marked up with an extra attribute when the asm name is > explicitly set? It would be great to know this from the DWARF so we don't > have to end up setting the ASM name for every single possibly affected DIE... I'm afraid DW_AT_linkage *is* that attribute. If you don't want to explicitly set the mangled name for each entity with a DW_AT_linkage_name, the way to do this is to add a DWARF extension like DW_AT_GNU_abi_tag or something. How does GDB/gcc handle this? Maybe they already invented an encoding for the attribute? https://reviews.llvm.org/D40283 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D41902: Remove Platform references from the Host module
The only hard part of writing any kind of test for this is actually getting a legitimate .app into the testsuite. Doesn't seem fair to ask Pavel to do that, since he doesn't work on macOS... Jim > On Jan 10, 2018, at 1:59 PM, Davide Italiano via Phabricator > wrote: > > davide added a comment. > > In https://reviews.llvm.org/D41902#972619, @zturner wrote: > >> In https://reviews.llvm.org/D41902#972614, @clayborg wrote: >> >>> As long as: >>> >>> % lldb /path/to/Foo.app >>> (lldb) r >>> >>> >>> Still works, then I am fine with this. The resolve executable should find >>> the executable down inside the app bundle (like >>> "/path/to/Foo.app/Contents/MacOS/Foo" for desktop apps and >>> "/path/to/Foo.app/Foo" for iOS apps). >> >> >> This sounds like something that would be pretty easy to write a test for >> with `lldb-test`. > > > Yes, please add a test. > > > https://reviews.llvm.org/D41902 > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D41902: Remove Platform references from the Host module
I understand, but having components untested is not ideal :( On Wed, Jan 10, 2018 at 2:09 PM, Jim Ingham wrote: > The only hard part of writing any kind of test for this is actually getting a > legitimate .app into the testsuite. Doesn't seem fair to ask Pavel to do > that, since he doesn't work on macOS... > > Jim > > >> On Jan 10, 2018, at 1:59 PM, Davide Italiano via Phabricator >> wrote: >> >> davide added a comment. >> >> In https://reviews.llvm.org/D41902#972619, @zturner wrote: >> >>> In https://reviews.llvm.org/D41902#972614, @clayborg wrote: >>> As long as: % lldb /path/to/Foo.app (lldb) r Still works, then I am fine with this. The resolve executable should find the executable down inside the app bundle (like "/path/to/Foo.app/Contents/MacOS/Foo" for desktop apps and "/path/to/Foo.app/Foo" for iOS apps). >>> >>> >>> This sounds like something that would be pretty easy to write a test for >>> with `lldb-test`. >> >> >> Yes, please add a test. >> >> >> https://reviews.llvm.org/D41902 >> >> >> > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D41902: Remove Platform references from the Host module
On Wed, Jan 10, 2018 at 2:09 PM Jim Ingham wrote: > The only hard part of writing any kind of test for this is actually > getting a legitimate .app into the testsuite. Doesn't seem fair to ask > Pavel to do that, since he doesn't work on macOS... > > Jim > What exactly *is* a .app file on disk? Is it literally just a directory? If so then the test can simply create the directory. Or is it more like "a directory that's actually compressed into a single file, sorta like a zip file, but using a different format"? If it's the latter, it would be nice if we had an llvm tool that could create them. As a fallback, perhaps the lldb-test tool could be given a command line option like --treat-as-bundle, where it pretends an existing directory is actually a bundle, so that the tests would work without one. ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods
nelhage added a comment. Compiling my test program with g++ and looking at `llvm-dwarfdump -all`, I can see no reference to the ABI tag other than in the `DW_AT_linkage_name`. Skimming the gdb source, I see references to it knowing how to *demangle* ABI tags, but no references in the DWARF code or otherwise in the expression-handler. I strongly suspect that GDB implements essentially this solution, using `DW_AT_linkage_name` to populate linkage names in its symbol table, and uses its C++ demangler to find ABI tags for display purposes. https://reviews.llvm.org/D40283 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods
nelhage added a comment. Further evidence that the ABI tag is never stored separately: $ strings -a -n4 test_abi_tag | grep cxx11 helloWorld_cxx11 _ZN1A16helloWorld_cxx11B5cxx11Ev _ZN1A16helloWorld_cxx11B5cxx11Ev Those three instances are, I presume, the `DW_AT_name`, and the `DW_AT_linkage_name`, and the ELF symbol table. https://reviews.llvm.org/D40283 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r322229 - Revert "Advanced guessing of rendezvous breakpoint"
Author: eugene Date: Wed Jan 10 14:25:33 2018 New Revision: 39 URL: http://llvm.org/viewvc/llvm-project?rev=39&view=rev Log: Revert "Advanced guessing of rendezvous breakpoint" This reverts commit r322209, because it broke TestNoreturnUnwind,TestInferiorAssert and TestNumThreads on i386. Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py?rev=39&r1=38&r2=39&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py Wed Jan 10 14:25:33 2018 @@ -17,23 +17,23 @@ class TestBreakpointInGlobalConstructors mydir = TestBase.compute_mydir(__file__) NO_DEBUG_INFO_TESTCASE = True -def test(self): -self.build() +def setUp(self): +TestBase.setUp(self) self.line_foo = line_number('foo.cpp', '// !BR_foo') self.line_main = line_number('main.cpp', '// !BR_main') -target = self.dbg.CreateTarget("a.out") -self.assertTrue(target, VALID_TARGET) - -env= self.registerSharedLibrariesWithTarget(target, ["foo"]) +@expectedFailureAll(bugnumber="llvm.org/pr35480", oslist=["linux"]) +def test(self): +self.build() +exe = os.path.join(os.getcwd(), "a.out") +self.runCmd("file %s" % exe) bp_main = lldbutil.run_break_set_by_file_and_line( self, 'main.cpp', self.line_main) bp_foo = lldbutil.run_break_set_by_file_and_line( self, 'foo.cpp', self.line_foo) -process = target.LaunchSimple( -None, env, self.get_process_working_directory()) +self.runCmd("run") self.assertIsNotNone( lldbutil.get_one_thread_stopped_at_breakpoint_id( Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py?rev=39&r1=38&r2=39&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py Wed Jan 10 14:25:33 2018 @@ -368,6 +368,7 @@ class LoadUnloadTestCase(TestBase): @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently +@unittest2.expectedFailure("llvm.org/pr25806") def test_static_init_during_load(self): """Test that we can set breakpoints correctly in static initializers""" @@ -394,19 +395,19 @@ class LoadUnloadTestCase(TestBase): self.runCmd("continue") self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', - 'b_init', - 'stop reason = breakpoint %d' % b_init_bp_num]) + 'a_init', + 'stop reason = breakpoint %d' % a_init_bp_num]) self.expect("thread backtrace", -substrs=['b_init', +substrs=['a_init', 'dlopen', 'main']) self.runCmd("continue") self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', - 'a_init', - 'stop reason = breakpoint %d' % a_init_bp_num]) + 'b_init', + 'stop reason = breakpoint %d' % b_init_bp_num]) self.expect("thread backtrace", -substrs=['a_init', +substrs=['b_init', 'dlopen', 'main']) Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoader
Re: [Lldb-commits] [PATCH] D41902: Remove Platform references from the Host module
App bundles are "just directories" but they are actually different on iOS & OS X. The most interesting part of them is a plist that gives some information about the bundle. lldb reads that plist to figure out what the real executable is (it is usually the bundle name minus the .app, but it doesn't have to be.) So you have to get the plist right, you can't just pretend the directory is an app bundle. I don't know if there's anything in llvm to make these, in general Xcode does the job of laying out the bundle, so I would be surprised if it has anything along these lines. I'll add a test that makes a simple app wrapper for darwin and makes sure we can read from it. We do something similar for Frameworks (another kind of bundle) in the macosx/add-dsym tests. It's pretty easy to do. Jim > On Jan 10, 2018, at 2:18 PM, Zachary Turner wrote: > > > > On Wed, Jan 10, 2018 at 2:09 PM Jim Ingham wrote: > The only hard part of writing any kind of test for this is actually getting a > legitimate .app into the testsuite. Doesn't seem fair to ask Pavel to do > that, since he doesn't work on macOS... > > Jim > > What exactly *is* a .app file on disk? Is it literally just a directory? If > so then the test can simply create the directory. Or is it more like "a > directory that's actually compressed into a single file, sorta like a zip > file, but using a different format"? > > If it's the latter, it would be nice if we had an llvm tool that could create > them. As a fallback, perhaps the lldb-test tool could be given a command > line option like --treat-as-bundle, where it pretends an existing directory > is actually a bundle, so that the tests would work without one. ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D40283: lldb: Use the DWARF linkage name when importing C++ methods
The right solution seems to be adding some sort of custom GNU ABI tag to the DWARF. I know that won't help with existing binaries, but it sounds too expensive to set the ASM name for everything. > On Jan 10, 2018, at 2:23 PM, Nelson Elhage via Phabricator > wrote: > > nelhage added a comment. > > Further evidence that the ABI tag is never stored separately: > > $ strings -a -n4 test_abi_tag | grep cxx11 > helloWorld_cxx11 > _ZN1A16helloWorld_cxx11B5cxx11Ev > _ZN1A16helloWorld_cxx11B5cxx11Ev > > Those three instances are, I presume, the `DW_AT_name`, and the > `DW_AT_linkage_name`, and the ELF symbol table. > > > https://reviews.llvm.org/D40283 > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r322232 - Add a test for finding a binary in an app package.
Author: jingham Date: Wed Jan 10 14:52:42 2018 New Revision: 322232 URL: http://llvm.org/viewvc/llvm-project?rev=322232&view=rev Log: Add a test for finding a binary in an app package. Added: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/Info.plist lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/MacOS/ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/PkgInfo lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/Resources/ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/main.c Added: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile?rev=322232&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile Wed Jan 10 14:52:42 2018 @@ -0,0 +1,16 @@ +CC ?= clang + +ifeq "$(ARCH)" "" + ARCH = x86_64 +endif + +CFLAGS ?= -g -O0 -arch $(ARCH) + +all: clean TestApp + +TestApp: + $(CC) $(CFLAGS) -o TestApp main.c + mv TestApp TestApp.app/Contents/MacOs/TestApp + mv TestApp.dSYM TestApp.app.dSYM +clean: + rm -rf TestApp.app/Contents/MacOS/TestApp TestApp.app.dSYM Added: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/Info.plist URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/Info.plist?rev=322232&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/Info.plist (added) +++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/Info.plist Wed Jan 10 14:52:42 2018 @@ -0,0 +1,30 @@ + +http://www.apple.com/DTDs/PropertyList-1.0.dtd";> + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + TestApp + CFBundleIdentifier + com.lldb.TestApp + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + TestApp + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSupportedPlatforms + + MacOSX + + CFBundleVersion + 1 + LSMinimumSystemVersion + 10.8 + NSHumanReadableCopyright + Copyright © 2018 Jim Ingham. All rights reserved. + + Added: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/PkgInfo URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/PkgInfo?rev=322232&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/PkgInfo (added) +++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestApp.app/Contents/PkgInfo Wed Jan 10 14:52:42 2018 @@ -0,0 +1 @@ +APPL \ No newline at end of file Added: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py?rev=322232&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py Wed Jan 10 14:52:42 2018 @@ -0,0 +1,62 @@ +""" +Make sure we can find the binary inside an app bundle. +""" + +from __future__ import print_function + + +import os +import time +import re +import lldb +from lldbsuite.test.decorators import * +import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.lldbtest import * + +@decorators.skipUnlessDarwin +class FindAppInMacOSAppBundle(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +NO_DEBUG_INFO_TESTCASE = True + +def test_find_app_in_bundle(self): +"""There can be many tests in a test case - describe this test here.""" +
[Lldb-commits] [lldb] r322235 - Runs the part of the test that just finds the binary on all systems.
Author: jingham Date: Wed Jan 10 15:06:34 2018 New Revision: 322235 URL: http://llvm.org/viewvc/llvm-project?rev=322235&view=rev Log: Runs the part of the test that just finds the binary on all systems. That should work everywhere. Then only try actually running on macosx. Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py?rev=322235&r1=322234&r2=322235&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py Wed Jan 10 15:06:34 2018 @@ -11,9 +11,9 @@ import re import lldb from lldbsuite.test.decorators import * import lldbsuite.test.lldbutil as lldbutil +import lldbsuite.test.lldbplatformutil as lldbplatformutil from lldbsuite.test.lldbtest import * -@decorators.skipUnlessDarwin class FindAppInMacOSAppBundle(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -46,17 +46,18 @@ class FindAppInMacOSAppBundle(TestBase): bkpt = target.BreakpointCreateBySourceRegex("Set a breakpoint here", self.main_source_file) self.assertTrue(bkpt.GetNumLocations() == 1, "Couldn't set a breakpoint in the main app") -launch_info = lldb.SBLaunchInfo(None) -launch_info.SetWorkingDirectory(self.get_process_working_directory()) - -error = lldb.SBError() -process = target.Launch(launch_info, error) - -self.assertTrue(process, "Could not create a valid process for TestApp: %s"%(error.GetCString())) - -# Frame #0 should be at our breakpoint. -threads = lldbutil.get_threads_stopped_at_breakpoint(process, bkpt) - -self.assertTrue(len(threads) == 1, "Expected 1 thread to stop at breakpoint, %d did."%(len(threads))) +if lldbplatformutil.getPlatform() == "macosx": +launch_info = lldb.SBLaunchInfo(None) + launch_info.SetWorkingDirectory(self.get_process_working_directory()) + +error = lldb.SBError() +process = target.Launch(launch_info, error) + +self.assertTrue(process, "Could not create a valid process for TestApp: %s"%(error.GetCString())) + +# Frame #0 should be at our breakpoint. +threads = lldbutil.get_threads_stopped_at_breakpoint(process, bkpt) + +self.assertTrue(len(threads) == 1, "Expected 1 thread to stop at breakpoint, %d did."%(len(threads))) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D41902: Remove Platform references from the Host module
I added a simple test: macosx/find-app-in-bundle. On non-Darwin systems it just ensures we find the app in the app bundle and can set a breakpoint in it. On Darwin, it also ensures we can launch the app and hit our breakpoint. When I get a chance I'll add an iOS app bundle and make a tricky one with a renamed executable. Jim > On Jan 10, 2018, at 2:27 PM, Jim Ingham wrote: > > App bundles are "just directories" but they are actually different on iOS & > OS X. The most interesting part of them is a plist that gives some > information about the bundle. lldb reads that plist to figure out what the > real executable is (it is usually the bundle name minus the .app, but it > doesn't have to be.) So you have to get the plist right, you can't just > pretend the directory is an app bundle. > > I don't know if there's anything in llvm to make these, in general Xcode does > the job of laying out the bundle, so I would be surprised if it has anything > along these lines. > > I'll add a test that makes a simple app wrapper for darwin and makes sure we > can read from it. We do something similar for Frameworks (another kind of > bundle) in the macosx/add-dsym tests. It's pretty easy to do. > > Jim > > > > >> On Jan 10, 2018, at 2:18 PM, Zachary Turner wrote: >> >> >> >> On Wed, Jan 10, 2018 at 2:09 PM Jim Ingham wrote: >> The only hard part of writing any kind of test for this is actually getting >> a legitimate .app into the testsuite. Doesn't seem fair to ask Pavel to do >> that, since he doesn't work on macOS... >> >> Jim >> >> What exactly *is* a .app file on disk? Is it literally just a directory? >> If so then the test can simply create the directory. Or is it more like "a >> directory that's actually compressed into a single file, sorta like a zip >> file, but using a different format"? >> >> If it's the latter, it would be nice if we had an llvm tool that could >> create them. As a fallback, perhaps the lldb-test tool could be given a >> command line option like --treat-as-bundle, where it pretends an existing >> directory is actually a bundle, so that the tests would work without one. > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r322237 - Remove Environment.h, test-dwarf.cpp, test-dwarf.exe
Author: jmolenda Date: Wed Jan 10 15:11:29 2018 New Revision: 322237 URL: http://llvm.org/viewvc/llvm-project?rev=322237&view=rev Log: Remove Environment.h, test-dwarf.cpp, test-dwarf.exe from being listed as a part of the desktop or desktop/desktop_no_xpc Targets - they should not be a part of any target. Having them listed as a part of desktop target results in them being added to the Copy Files build phase for desktop and I'm guessing they'd end up in the manpage directory or something. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=322237&r1=322236&r2=322237&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Jan 10 15:11:29 2018 @@ -753,7 +753,6 @@ 4CF52AF8142829390051E832 /* SBFileSpecList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CF52AF7142829390051E832 /* SBFileSpecList.cpp */; }; 54067BF11DF2041B00749AA5 /* UBSanRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 54067BEC1DF2034B00749AA5 /* UBSanRuntime.cpp */; }; 6B74D89B200696BB0074051B /* Environment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 22DC561920064C9600A7E9E8 /* Environment.cpp */; }; - 6B74D89D2006972E0074051B /* Environment.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 6B74D89C2006972D0074051B /* Environment.h */; }; 6D0F61431C80AAAE00A4ECEE /* JavaASTContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D0F61411C8000A4ECEE /* JavaASTContext.cpp */; }; 6D0F61481C80AAD600A4ECEE /* DWARFASTParserJava.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D0F61441C80AACF00A4ECEE /* DWARFASTParserJava.cpp */; }; 6D0F614E1C80AB0700A4ECEE /* JavaLanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D0F614A1C80AB0400A4ECEE /* JavaLanguageRuntime.cpp */; }; @@ -886,8 +885,6 @@ 9A1E595D1EB2B141002206A5 /* SBTraceOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A1E59531EB2B0B9002206A5 /* SBTraceOptions.cpp */; }; 9A2057031F3A605200F6C293 /* VASprintfTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D43C41F3150D200EB767C /* VASprintfTest.cpp */; }; 9A2057081F3B819100F6C293 /* MemoryRegionInfoTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A2057061F3B818600F6C293 /* MemoryRegionInfoTest.cpp */; }; - 9A20570F1F3B821A00F6C293 /* test-dwarf.cpp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9A20570D1F3B821A00F6C293 /* test-dwarf.cpp */; }; - 9A2057101F3B821A00F6C293 /* test-dwarf.exe in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9A20570E1F3B821A00F6C293 /* test-dwarf.exe */; }; 9A2057121F3B824B00F6C293 /* SymbolFileDWARFTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A20570A1F3B81F300F6C293 /* SymbolFileDWARFTests.cpp */; }; 9A2057171F3B861400F6C293 /* TestDWARFCallFrameInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A2057131F3B860D00F6C293 /* TestDWARFCallFrameInfo.cpp */; }; 9A2057181F3B861400F6C293 /* TestType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A2057141F3B860D00F6C293 /* TestType.cpp */; }; @@ -1247,9 +1244,6 @@ dstPath = "$(DEVELOPER_INSTALL_DIR)/usr/share/man/man1"; dstSubfolderSpec = 0; files = ( - 6B74D89D2006972E0074051B /* Environment.h in CopyFiles */, - 9A20570F1F3B821A00F6C293 /* test-dwarf.cpp in CopyFiles */, - 9A2057101F3B821A00F6C293 /* test-dwarf.exe in CopyFiles */, AF90106515AB7D3600FF120D /* lldb.1 in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 1; @@ -2895,8 +2889,6 @@ 9A1E59591EB2B10D002206A5 /* SBTraceOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBTraceOptions.h; path = include/lldb/API/SBTraceOptions.h; sourceTree = ""; }; 9A2057061F3B818600F6C293 /* MemoryRegionInfoTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MemoryRegionInfoTest.cpp; path = Target/MemoryRegionInfoTest.cpp; sourceTree = ""; }; 9A20570A1F3B81F300F6C293 /* SymbolFileDWARFTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SymbolFileDWARFTests.cpp; path = DWARF/SymbolFileDWARFTests.cpp; sourceTree = ""; }; - 9A20570D1F3B821A00F6C293 /* test-dwarf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFi
[Lldb-commits] [lldb] r322239 - Running this on other systems won't work because I don't
Author: jingham Date: Wed Jan 10 15:32:43 2018 New Revision: 322239 URL: http://llvm.org/viewvc/llvm-project?rev=322239&view=rev Log: Running this on other systems won't work because I don't know how to specifically build a MachO binary on other systems. Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py?rev=322239&r1=322238&r2=322239&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py Wed Jan 10 15:32:43 2018 @@ -14,6 +14,7 @@ import lldbsuite.test.lldbutil as lldbut import lldbsuite.test.lldbplatformutil as lldbplatformutil from lldbsuite.test.lldbtest import * +@decorators.skipUnlessDarwin class FindAppInMacOSAppBundle(TestBase): mydir = TestBase.compute_mydir(__file__) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D41902: Remove Platform references from the Host module
Eh, no, that wasn't right. I don't know how to build and link a mach-o binary on some random other system. So I made this a Darwin only test till I can figure out how to do that. Jim > On Jan 10, 2018, at 3:09 PM, Jim Ingham wrote: > > I added a simple test: macosx/find-app-in-bundle. On non-Darwin systems it > just ensures we find the app in the > app bundle and can set a breakpoint in it. On Darwin, it also ensures we can > launch the app and hit our breakpoint. > > When I get a chance I'll add an iOS app bundle and make a tricky one with a > renamed executable. > > Jim > > >> On Jan 10, 2018, at 2:27 PM, Jim Ingham wrote: >> >> App bundles are "just directories" but they are actually different on iOS & >> OS X. The most interesting part of them is a plist that gives some >> information about the bundle. lldb reads that plist to figure out what the >> real executable is (it is usually the bundle name minus the .app, but it >> doesn't have to be.) So you have to get the plist right, you can't just >> pretend the directory is an app bundle. >> >> I don't know if there's anything in llvm to make these, in general Xcode >> does the job of laying out the bundle, so I would be surprised if it has >> anything along these lines. >> >> I'll add a test that makes a simple app wrapper for darwin and makes sure we >> can read from it. We do something similar for Frameworks (another kind of >> bundle) in the macosx/add-dsym tests. It's pretty easy to do. >> >> Jim >> >> >> >> >>> On Jan 10, 2018, at 2:18 PM, Zachary Turner wrote: >>> >>> >>> >>> On Wed, Jan 10, 2018 at 2:09 PM Jim Ingham wrote: >>> The only hard part of writing any kind of test for this is actually getting >>> a legitimate .app into the testsuite. Doesn't seem fair to ask Pavel to do >>> that, since he doesn't work on macOS... >>> >>> Jim >>> >>> What exactly *is* a .app file on disk? Is it literally just a directory? >>> If so then the test can simply create the directory. Or is it more like "a >>> directory that's actually compressed into a single file, sorta like a zip >>> file, but using a different format"? >>> >>> If it's the latter, it would be nice if we had an llvm tool that could >>> create them. As a fallback, perhaps the lldb-test tool could be given a >>> command line option like --treat-as-bundle, where it pretends an existing >>> directory is actually a bundle, so that the tests would work without one. >> > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r322251 - Advanced guessing of rendezvous breakpoint (resubmit)
Author: eugene Date: Wed Jan 10 19:46:35 2018 New Revision: 322251 URL: http://llvm.org/viewvc/llvm-project?rev=322251&view=rev Log: Advanced guessing of rendezvous breakpoint (resubmit) When rendezvous structure is not initialized we need to set up rendezvous breakpoint anyway. In this case the code will locate dynamic loader (interpreter) and look for known function names. This is r322209, but with fixed VDSO loading fixed. Bug: https://bugs.llvm.org/show_bug.cgi?id=25806 Differential Revision: https://reviews.llvm.org/D41533 Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py?rev=322251&r1=322250&r2=322251&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py Wed Jan 10 19:46:35 2018 @@ -17,23 +17,23 @@ class TestBreakpointInGlobalConstructors mydir = TestBase.compute_mydir(__file__) NO_DEBUG_INFO_TESTCASE = True -def setUp(self): -TestBase.setUp(self) +def test(self): +self.build() self.line_foo = line_number('foo.cpp', '// !BR_foo') self.line_main = line_number('main.cpp', '// !BR_main') -@expectedFailureAll(bugnumber="llvm.org/pr35480", oslist=["linux"]) -def test(self): -self.build() -exe = os.path.join(os.getcwd(), "a.out") -self.runCmd("file %s" % exe) +target = self.dbg.CreateTarget("a.out") +self.assertTrue(target, VALID_TARGET) + +env= self.registerSharedLibrariesWithTarget(target, ["foo"]) bp_main = lldbutil.run_break_set_by_file_and_line( self, 'main.cpp', self.line_main) bp_foo = lldbutil.run_break_set_by_file_and_line( self, 'foo.cpp', self.line_foo) -self.runCmd("run") +process = target.LaunchSimple( +None, env, self.get_process_working_directory()) self.assertIsNotNone( lldbutil.get_one_thread_stopped_at_breakpoint_id( Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py?rev=322251&r1=322250&r2=322251&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py Wed Jan 10 19:46:35 2018 @@ -368,7 +368,6 @@ class LoadUnloadTestCase(TestBase): @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently -@unittest2.expectedFailure("llvm.org/pr25806") def test_static_init_during_load(self): """Test that we can set breakpoints correctly in static initializers""" @@ -395,19 +394,19 @@ class LoadUnloadTestCase(TestBase): self.runCmd("continue") self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', - 'a_init', - 'stop reason = breakpoint %d' % a_init_bp_num]) + 'b_init', + 'stop reason = breakpoint %d' % b_init_bp_num]) self.expect("thread backtrace", -substrs=['a_init', +substrs=['b_init', 'dlopen', 'main']) self.runCmd("continue") self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', - 'b_init', - 'stop reason = breakpoint %d' % b_init_bp_num]) + 'a_init', + 'stop reason = breakpoint %d' % a_init_bp_num]) self.expect("thread backtrace", -substrs=['b_init', +substrs=['a_init', 'dlope