Date: Sat, 10 Jun 2017 13:44:59 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r319790 - in vendor/lldb/dist: include/lldb/Core include/lldb/Target include/lldb/Utility packages/Python/lldbsuite/test/functionalities/unwind/noreturn packages/Python/lldbsuite/test/f... Message-ID: <201706101344.v5ADixBK095169@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Sat Jun 10 13:44:58 2017 New Revision: 319790 URL: https://svnweb.freebsd.org/changeset/base/319790 Log: Vendor import of lldb trunk r305145: https://llvm.org/svn/llvm-project/lldb/trunk@305145 Added: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/TestNoReturnModuleEnd.py (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/a.s (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/test.core (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/test.out (contents, props changed) vendor/lldb/dist/unittests/tools/ vendor/lldb/dist/unittests/tools/CMakeLists.txt (contents, props changed) vendor/lldb/dist/unittests/tools/lldb-server/ vendor/lldb/dist/unittests/tools/lldb-server/CMakeLists.txt (contents, props changed) vendor/lldb/dist/unittests/tools/lldb-server/inferior/ vendor/lldb/dist/unittests/tools/lldb-server/inferior/thread_inferior.cpp (contents, props changed) vendor/lldb/dist/unittests/tools/lldb-server/tests/ vendor/lldb/dist/unittests/tools/lldb-server/tests/CMakeLists.txt (contents, props changed) vendor/lldb/dist/unittests/tools/lldb-server/tests/MessageObjects.cpp (contents, props changed) vendor/lldb/dist/unittests/tools/lldb-server/tests/MessageObjects.h (contents, props changed) vendor/lldb/dist/unittests/tools/lldb-server/tests/TestClient.cpp (contents, props changed) vendor/lldb/dist/unittests/tools/lldb-server/tests/TestClient.h (contents, props changed) vendor/lldb/dist/unittests/tools/lldb-server/tests/ThreadIdsInJstopinfoTest.cpp (contents, props changed) Modified: vendor/lldb/dist/include/lldb/Core/Address.h vendor/lldb/dist/include/lldb/Core/Section.h vendor/lldb/dist/include/lldb/Core/dwarf.h vendor/lldb/dist/include/lldb/Target/SectionLoadList.h vendor/lldb/dist/include/lldb/Utility/SafeMachO.h vendor/lldb/dist/include/lldb/Utility/TaskPool.h vendor/lldb/dist/include/lldb/Utility/VMRange.h vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/main.c vendor/lldb/dist/source/Commands/CommandObjectRegister.cpp vendor/lldb/dist/source/Core/Address.cpp vendor/lldb/dist/source/Core/ArchSpec.cpp vendor/lldb/dist/source/Core/CMakeLists.txt vendor/lldb/dist/source/Core/Section.cpp vendor/lldb/dist/source/DataFormatters/TypeCategory.cpp vendor/lldb/dist/source/Host/common/Host.cpp vendor/lldb/dist/source/Host/posix/ConnectionFileDescriptorPosix.cpp vendor/lldb/dist/source/Host/posix/ProcessLauncherPosixFork.cpp vendor/lldb/dist/source/Plugins/Language/ObjC/ObjCLanguage.cpp vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp vendor/lldb/dist/source/Plugins/ObjectFile/ELF/CMakeLists.txt vendor/lldb/dist/source/Plugins/ObjectFile/ELF/ELFHeader.h vendor/lldb/dist/source/Plugins/ObjectFile/PECOFF/CMakeLists.txt vendor/lldb/dist/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp vendor/lldb/dist/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp vendor/lldb/dist/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp vendor/lldb/dist/source/Plugins/Process/Linux/NativeProcessLinux.cpp vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextLLDB.cpp vendor/lldb/dist/source/Plugins/Process/elf-core/CMakeLists.txt vendor/lldb/dist/source/Plugins/Process/elf-core/ProcessElfCore.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp vendor/lldb/dist/source/Target/SectionLoadList.cpp vendor/lldb/dist/source/Target/StackFrame.cpp vendor/lldb/dist/source/Utility/CMakeLists.txt vendor/lldb/dist/source/Utility/Status.cpp vendor/lldb/dist/source/Utility/TaskPool.cpp vendor/lldb/dist/source/Utility/VMRange.cpp vendor/lldb/dist/tools/lldb-server/lldb-gdbserver.cpp vendor/lldb/dist/unittests/CMakeLists.txt vendor/lldb/dist/unittests/Core/ArchSpecTest.cpp vendor/lldb/dist/unittests/Core/StructuredDataTest.cpp vendor/lldb/dist/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp Modified: vendor/lldb/dist/include/lldb/Core/Address.h ============================================================================== --- vendor/lldb/dist/include/lldb/Core/Address.h Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/include/lldb/Core/Address.h Sat Jun 10 13:44:58 2017 (r319790) @@ -422,6 +422,10 @@ class Address { (public) /// a section + offset. The Target's SectionLoadList object /// is used to resolve the address. /// + /// @param[in] allow_section_end + /// If true, treat an address pointing to the end of the module as + /// belonging to that module. + /// /// @return /// Returns \b true if the load address was resolved to be /// section/offset, \b false otherwise. It is often ok for an @@ -429,11 +433,13 @@ class Address { (public) /// happens for JIT'ed code, or any load addresses on the stack /// or heap. //------------------------------------------------------------------ - bool SetLoadAddress(lldb::addr_t load_addr, Target *target); + bool SetLoadAddress(lldb::addr_t load_addr, Target *target, + bool allow_section_end = false); bool SetOpcodeLoadAddress( lldb::addr_t load_addr, Target *target, - lldb::AddressClass addr_class = lldb::eAddressClassInvalid); + lldb::AddressClass addr_class = lldb::eAddressClassInvalid, + bool allow_section_end = false); bool SetCallableLoadAddress(lldb::addr_t load_addr, Target *target); Modified: vendor/lldb/dist/include/lldb/Core/Section.h ============================================================================== --- vendor/lldb/dist/include/lldb/Core/Section.h Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/include/lldb/Core/Section.h Sat Jun 10 13:44:58 2017 (r319790) @@ -143,7 +143,8 @@ class Section : public std::enable_shared_from_this<Se lldb::addr_t GetLoadBaseAddress(Target *target) const; - bool ResolveContainedAddress(lldb::addr_t offset, Address &so_addr) const; + bool ResolveContainedAddress(lldb::addr_t offset, Address &so_addr, + bool allow_section_end = false) const; lldb::offset_t GetFileOffset() const { return m_file_offset; } Modified: vendor/lldb/dist/include/lldb/Core/dwarf.h ============================================================================== --- vendor/lldb/dist/include/lldb/Core/dwarf.h Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/include/lldb/Core/dwarf.h Sat Jun 10 13:44:58 2017 (r319790) @@ -13,7 +13,7 @@ #include <stdint.h> // Get the DWARF constant definitions from llvm -#include "llvm/Support/Dwarf.h" +#include "llvm/BinaryFormat/Dwarf.h" #include "lldb/Core/RangeMap.h" Modified: vendor/lldb/dist/include/lldb/Target/SectionLoadList.h ============================================================================== --- vendor/lldb/dist/include/lldb/Target/SectionLoadList.h Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/include/lldb/Target/SectionLoadList.h Sat Jun 10 13:44:58 2017 (r319790) @@ -47,7 +47,8 @@ class SectionLoadList { (public) lldb::addr_t GetSectionLoadAddress(const lldb::SectionSP §ion_sp) const; - bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr) const; + bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, + bool allow_section_end = false) const; bool SetSectionLoadAddress(const lldb::SectionSP §ion_sp, lldb::addr_t load_addr, Modified: vendor/lldb/dist/include/lldb/Utility/SafeMachO.h ============================================================================== --- vendor/lldb/dist/include/lldb/Utility/SafeMachO.h Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/include/lldb/Utility/SafeMachO.h Sat Jun 10 13:44:58 2017 (r319790) @@ -114,6 +114,6 @@ #undef CPU_SUBTYPE_MC980000_ALL #undef CPU_SUBTYPE_MC98601 -#include "llvm/Support/MachO.h" +#include "llvm/BinaryFormat/MachO.h" #endif // liblldb_SafeMachO_h_ Modified: vendor/lldb/dist/include/lldb/Utility/TaskPool.h ============================================================================== --- vendor/lldb/dist/include/lldb/Utility/TaskPool.h Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/include/lldb/Utility/TaskPool.h Sat Jun 10 13:44:58 2017 (r319790) @@ -10,6 +10,7 @@ #ifndef utility_TaskPool_h_ #define utility_TaskPool_h_ +#include "llvm/ADT/STLExtras.h" #include <functional> // for bind, function #include <future> #include <list> @@ -86,6 +87,6 @@ template <> struct TaskPool::RunTaskImpl<> { // 'batch_size' numbers at a time to work on, so for very fast functions, batch // should be large enough to avoid too much cache line contention. void TaskMapOverInt(size_t begin, size_t end, - std::function<void(size_t)> const &func); + const llvm::function_ref<void(size_t)> &func); #endif // #ifndef utility_TaskPool_h_ Modified: vendor/lldb/dist/include/lldb/Utility/VMRange.h ============================================================================== --- vendor/lldb/dist/include/lldb/Utility/VMRange.h Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/include/lldb/Utility/VMRange.h Sat Jun 10 13:44:58 2017 (r319790) @@ -111,11 +111,6 @@ class VMRange { (public) static bool ContainsRange(const VMRange::collection &coll, const VMRange &range); - // Returns a valid index into coll when a match is found, else UINT32_MAX - // is returned - static size_t FindRangeIndexThatContainsValue(const VMRange::collection &coll, - lldb::addr_t value); - protected: lldb::addr_t m_base_addr; lldb::addr_t m_byte_size; Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py ============================================================================== --- vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py Sat Jun 10 13:44:58 2017 (r319790) @@ -17,8 +17,8 @@ class NoreturnUnwind(TestBase): mydir = TestBase.compute_mydir(__file__) @skipIfWindows # clang-cl does not support gcc style attributes. - @expectedFailureAndroid(bugnumber="llvm.org/pr31192") - @expectedFailureAll(bugnumber="llvm.org/pr31192", oslist=['linux'], compiler="gcc", archs=['arm']) + # clang does not preserve LR in noreturn functions, making unwinding impossible + @skipIf(compiler="clang", archs=['arm'], oslist=['linux']) def test(self): """Test that we can backtrace correctly with 'noreturn' functions on the stack""" self.build() Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/main.c ============================================================================== --- vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/main.c Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/main.c Sat Jun 10 13:44:58 2017 (r319790) @@ -29,8 +29,6 @@ func_a (void) int main (int argc, char *argv[]) { - sleep (2); - func_a (); return 0; Added: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/TestNoReturnModuleEnd.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/TestNoReturnModuleEnd.py Sat Jun 10 13:44:58 2017 (r319790) @@ -0,0 +1,53 @@ +""" +Test that we properly display the backtrace when a noreturn function happens to +be at the end of the stack. +""" + +from __future__ import print_function + +import shutil +import struct + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestNoreturnModuleEnd(TestBase): + NO_DEBUG_INFO_TESTCASE = True + mydir = TestBase.compute_mydir(__file__) + + def setUp(self): + super(TestNoreturnModuleEnd, self).setUp() + self._initial_platform = lldb.DBG.GetSelectedPlatform() + + def tearDown(self): + lldb.DBG.SetSelectedPlatform(self._initial_platform) + super(TestNoreturnModuleEnd, self).tearDown() + + def test(self): + target = self.dbg.CreateTarget("test.out") + process = target.LoadCore("test.core") + self.assertTrue(process.IsValid(), PROCESS_IS_VALID) + self.assertEqual(process.GetNumThreads(), 1) + + thread = process.GetSelectedThread() + self.assertTrue(thread.IsValid()) + + backtrace = [ + ["func2", 3], + ["func1", 8], + ["_start", 8], + ] + self.assertEqual(thread.GetNumFrames(), len(backtrace)) + for i in range(len(backtrace)): + frame = thread.GetFrameAtIndex(i) + self.assertTrue(frame.IsValid()) + symbol = frame.GetSymbol() + self.assertTrue(symbol.IsValid()) + self.assertEqual(symbol.GetName(), backtrace[i][0]) + function_start = symbol.GetStartAddress().GetLoadAddress(target) + self.assertEquals(function_start + backtrace[i][1], frame.GetPC()) + + self.dbg.DeleteTarget(target) Added: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/a.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/a.s Sat Jun 10 13:44:58 2017 (r319790) @@ -0,0 +1,35 @@ +# compile this with: +# as a.s -o a.o --32 && ld a.o -m elf_i386 +# generate core file with: +# ulimit -s 12 && ./a.out + +.text + +.globl func2 +.type func2, @function +func2: + pushl %ebp + movl %esp, %ebp + movl 0, %eax + popl %ebp + ret +.size func2, .-func2 + +.globl _start +.type _start, @function +_start: + pushl %ebp + movl %esp, %ebp + call func1 + popl %ebp + ret +.size _start, .-_start + +.globl func1 +.type func1, @function +func1: + pushl %ebp + movl %esp, %ebp + call func2 +.size func1, .-func1 + Added: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/test.core ============================================================================== Binary file. No diff available. Added: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/module-end/test.out ============================================================================== Binary file. No diff available. Modified: vendor/lldb/dist/source/Commands/CommandObjectRegister.cpp ============================================================================== --- vendor/lldb/dist/source/Commands/CommandObjectRegister.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Commands/CommandObjectRegister.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -7,12 +7,6 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -#include "llvm/ADT/STLExtras.h" - -// Project includes #include "CommandObjectRegister.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/RegisterValue.h" @@ -32,6 +26,7 @@ #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/DataExtractor.h" +#include "llvm/Support/Errno.h" using namespace lldb; using namespace lldb_private; @@ -178,8 +173,8 @@ class CommandObjectRegisterRead : public CommandObject if (set_idx < reg_ctx->GetRegisterSetCount()) { if (!DumpRegisterSet(m_exe_ctx, strm, reg_ctx, set_idx)) { if (errno) - result.AppendErrorWithFormat("register read failed: %s\n", - strerror(errno)); + result.AppendErrorWithFormatv("register read failed: {0}\n", + llvm::sys::StrError()); else result.AppendError("unknown error while reading registers.\n"); result.SetStatus(eReturnStatusFailed); Modified: vendor/lldb/dist/source/Core/Address.cpp ============================================================================== --- vendor/lldb/dist/source/Core/Address.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Core/Address.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -361,8 +361,9 @@ addr_t Address::GetOpcodeLoadAddress(Target *target, } bool Address::SetOpcodeLoadAddress(lldb::addr_t load_addr, Target *target, - AddressClass addr_class) { - if (SetLoadAddress(load_addr, target)) { + AddressClass addr_class, + bool allow_section_end) { + if (SetLoadAddress(load_addr, target, allow_section_end)) { if (target) { if (addr_class == eAddressClassInvalid) addr_class = GetAddressClass(); @@ -1001,9 +1002,10 @@ AddressClass Address::GetAddressClass() const { return eAddressClassUnknown; } -bool Address::SetLoadAddress(lldb::addr_t load_addr, Target *target) { - if (target && - target->GetSectionLoadList().ResolveLoadAddress(load_addr, *this)) +bool Address::SetLoadAddress(lldb::addr_t load_addr, Target *target, + bool allow_section_end) { + if (target && target->GetSectionLoadList().ResolveLoadAddress( + load_addr, *this, allow_section_end)) return true; m_section_wp.reset(); m_offset = load_addr; Modified: vendor/lldb/dist/source/Core/ArchSpec.cpp ============================================================================== --- vendor/lldb/dist/source/Core/ArchSpec.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Core/ArchSpec.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -24,11 +24,11 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/Twine.h" // for Twine -#include "llvm/Support/COFF.h" -#include "llvm/Support/Compiler.h" // for LLVM_FALLTHROUGH -#include "llvm/Support/ELF.h" +#include "llvm/BinaryFormat/COFF.h" +#include "llvm/BinaryFormat/ELF.h" +#include "llvm/BinaryFormat/MachO.h" // for CPUType::CPU_T... +#include "llvm/Support/Compiler.h" // for LLVM_FALLTHROUGH #include "llvm/Support/Host.h" -#include "llvm/Support/MachO.h" // for CPUType::CPU_T... #include <memory> // for shared_ptr #include <string> Modified: vendor/lldb/dist/source/Core/CMakeLists.txt ============================================================================== --- vendor/lldb/dist/source/Core/CMakeLists.txt Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Core/CMakeLists.txt Sat Jun 10 13:44:58 2017 (r319790) @@ -67,6 +67,7 @@ add_lldb_library(lldbCore lldbPluginObjectFileJIT LINK_COMPONENTS + BinaryFormat Support Demangle ) Modified: vendor/lldb/dist/source/Core/Section.cpp ============================================================================== --- vendor/lldb/dist/source/Core/Section.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Core/Section.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -220,18 +220,18 @@ addr_t Section::GetLoadBaseAddress(Target *target) con return load_base_addr; } -bool Section::ResolveContainedAddress(addr_t offset, Address &so_addr) const { +bool Section::ResolveContainedAddress(addr_t offset, Address &so_addr, + bool allow_section_end) const { const size_t num_children = m_children.GetSize(); - if (num_children > 0) { - for (size_t i = 0; i < num_children; i++) { - Section *child_section = m_children.GetSectionAtIndex(i).get(); + for (size_t i = 0; i < num_children; i++) { + Section *child_section = m_children.GetSectionAtIndex(i).get(); - addr_t child_offset = child_section->GetOffset(); - if (child_offset <= offset && - offset - child_offset < child_section->GetByteSize()) - return child_section->ResolveContainedAddress(offset - child_offset, - so_addr); - } + addr_t child_offset = child_section->GetOffset(); + if (child_offset <= offset && + offset - child_offset < + child_section->GetByteSize() + (allow_section_end ? 1 : 0)) + return child_section->ResolveContainedAddress(offset - child_offset, + so_addr, allow_section_end); } so_addr.SetOffset(offset); so_addr.SetSection(const_cast<Section *>(this)->shared_from_this()); Modified: vendor/lldb/dist/source/DataFormatters/TypeCategory.cpp ============================================================================== --- vendor/lldb/dist/source/DataFormatters/TypeCategory.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/DataFormatters/TypeCategory.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -36,23 +36,8 @@ TypeCategoryImpl::TypeCategoryImpl( static bool IsApplicable(lldb::LanguageType category_lang, lldb::LanguageType valobj_lang) { switch (category_lang) { - // these are not languages that LLDB would ordinarily deal with - // only allow an exact equality here, since we really don't know - // any better - case eLanguageTypeAda83: - case eLanguageTypeCobol74: - case eLanguageTypeCobol85: - case eLanguageTypeFortran77: - case eLanguageTypeFortran90: - case eLanguageTypePascal83: - case eLanguageTypeModula2: - case eLanguageTypeJava: - case eLanguageTypeAda95: - case eLanguageTypeFortran95: - case eLanguageTypePLI: - case eLanguageTypeUPC: - case eLanguageTypeD: - case eLanguageTypePython: + // Unless we know better, allow only exact equality. + default: return category_lang == valobj_lang; // the C family, we consider it as one @@ -80,7 +65,7 @@ static bool IsApplicable(lldb::LanguageType category_l valobj_lang == eLanguageTypeC_plus_plus || valobj_lang == eLanguageTypeObjC; - default: + // Categories with unspecified language match everything. case eLanguageTypeUnknown: return true; } Modified: vendor/lldb/dist/source/Host/common/Host.cpp ============================================================================== --- vendor/lldb/dist/source/Host/common/Host.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Host/common/Host.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -68,6 +68,7 @@ #include "lldb/Utility/Status.h" #include "lldb/lldb-private-forward.h" #include "llvm/ADT/SmallString.h" +#include "llvm/Support/Errno.h" #include "llvm/Support/FileSystem.h" #if defined(_WIN32) @@ -217,10 +218,9 @@ static thread_result_t MonitorChildProcessThreadFuncti if (errno == EINTR) continue; else { - if (log) - log->Printf( - "%s (arg = %p) thread exiting because waitpid failed (%s)...", - __FUNCTION__, arg, strerror(errno)); + LLDB_LOG(log, + "arg = {0}, thread exiting because waitpid failed ({1})...", + arg, llvm::sys::StrError()); break; } } else if (wait_pid > 0) { Modified: vendor/lldb/dist/source/Host/posix/ConnectionFileDescriptorPosix.cpp ============================================================================== --- vendor/lldb/dist/source/Host/posix/ConnectionFileDescriptorPosix.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Host/posix/ConnectionFileDescriptorPosix.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -36,6 +36,7 @@ #include <sstream> // Other libraries and framework includes +#include "llvm/Support/Errno.h" #include "llvm/Support/ErrorHandling.h" #if defined(__APPLE__) #include "llvm/ADT/SmallVector.h" @@ -461,10 +462,8 @@ size_t ConnectionFileDescriptor::Read(void *dst, size_ return 0; default: - if (log) - log->Printf( - "%p ConnectionFileDescriptor::Read (), unexpected error: %s", - static_cast<void *>(this), strerror(error_value)); + LLDB_LOG(log, "this = {0}, unexpected error: {1}", this, + llvm::sys::StrError(error_value)); status = eConnectionStatusError; break; // Break to close.... } Modified: vendor/lldb/dist/source/Host/posix/ProcessLauncherPosixFork.cpp ============================================================================== --- vendor/lldb/dist/source/Host/posix/ProcessLauncherPosixFork.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Host/posix/ProcessLauncherPosixFork.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -14,6 +14,7 @@ #include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "llvm/Support/Errno.h" #include <limits.h> #include <sys/ptrace.h> @@ -204,8 +205,8 @@ ProcessLauncherPosixFork::LaunchProcess(const ProcessL ::pid_t pid = ::fork(); if (pid == -1) { // Fork failed - error.SetErrorStringWithFormat("Fork failed with error message: %s", - strerror(errno)); + error.SetErrorStringWithFormatv("Fork failed with error message: {0}", + llvm::sys::StrError()); return HostProcess(LLDB_INVALID_PROCESS_ID); } if (pid == 0) { Modified: vendor/lldb/dist/source/Plugins/Language/ObjC/ObjCLanguage.cpp ============================================================================== --- vendor/lldb/dist/source/Plugins/Language/ObjC/ObjCLanguage.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Plugins/Language/ObjC/ObjCLanguage.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -95,7 +95,7 @@ bool ObjCLanguage::MethodName::SetName(llvm::StringRef // or '-' can be omitted bool valid_prefix = false; - if (name[0] == '+' || name[0] == '-') { + if (name.size() > 1 && (name[0] == '+' || name[0] == '-')) { valid_prefix = name[1] == '['; if (name[0] == '+') m_type = eTypeClassMethod; Modified: vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp ============================================================================== --- vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -171,6 +171,7 @@ UtilityFunction *AppleObjCRuntimeV1::CreateObjectCheck " \n", name); assert(strformatsize < (int)sizeof(buf->contents)); + (void)strformatsize; Status error; return GetTargetRef().GetUtilityFunctionForLanguage( Modified: vendor/lldb/dist/source/Plugins/ObjectFile/ELF/CMakeLists.txt ============================================================================== --- vendor/lldb/dist/source/Plugins/ObjectFile/ELF/CMakeLists.txt Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Plugins/ObjectFile/ELF/CMakeLists.txt Sat Jun 10 13:44:58 2017 (r319790) @@ -8,5 +8,6 @@ add_lldb_library(lldbPluginObjectFileELF PLUGIN lldbSymbol lldbTarget LINK_COMPONENTS + BinaryFormat Support ) Modified: vendor/lldb/dist/source/Plugins/ObjectFile/ELF/ELFHeader.h ============================================================================== --- vendor/lldb/dist/source/Plugins/ObjectFile/ELF/ELFHeader.h Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Plugins/ObjectFile/ELF/ELFHeader.h Sat Jun 10 13:44:58 2017 (r319790) @@ -21,7 +21,7 @@ #ifndef liblldb_ELFHeader_h_ #define liblldb_ELFHeader_h_ -#include "llvm/Support/ELF.h" +#include "llvm/BinaryFormat/ELF.h" #include "lldb/lldb-enumerations.h" #include "lldb/lldb-types.h" Modified: vendor/lldb/dist/source/Plugins/ObjectFile/PECOFF/CMakeLists.txt ============================================================================== --- vendor/lldb/dist/source/Plugins/ObjectFile/PECOFF/CMakeLists.txt Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Plugins/ObjectFile/PECOFF/CMakeLists.txt Sat Jun 10 13:44:58 2017 (r319790) @@ -8,5 +8,6 @@ add_lldb_library(lldbPluginObjectFilePECOFF PLUGIN lldbSymbol lldbTarget LINK_COMPONENTS + BinaryFormat Support ) Modified: vendor/lldb/dist/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp ============================================================================== --- vendor/lldb/dist/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -10,7 +10,7 @@ #include "ObjectFilePECOFF.h" #include "WindowsMiniDump.h" -#include "llvm/Support/COFF.h" +#include "llvm/BinaryFormat/COFF.h" #include "lldb/Core/ArchSpec.h" #include "lldb/Core/FileSpecList.h" Modified: vendor/lldb/dist/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp ============================================================================== --- vendor/lldb/dist/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -35,6 +35,7 @@ #include "lldb/Utility/Log.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" +#include "llvm/Support/Errno.h" #include "CFBundle.h" #include "CFString.h" @@ -319,13 +320,12 @@ static Status PosixSpawnChildForPTraceDebugging(const ::posix_spawnattr_setsigdefault(&attr, &all_signals); if ((error_code = ::posix_spawnattr_setflags(&attr, flags)) != 0) { - if (log) - log->Printf("::posix_spawnattr_setflags(&attr, " - "POSIX_SPAWN_START_SUSPENDED%s) failed: %s", - flags & _POSIX_SPAWN_DISABLE_ASLR - ? " | _POSIX_SPAWN_DISABLE_ASLR" - : "", - strerror(error_code)); + LLDB_LOG(log, + "::posix_spawnattr_setflags(&attr, " + "POSIX_SPAWN_START_SUSPENDED{0}) failed: {1}", + flags & _POSIX_SPAWN_DISABLE_ASLR ? " | _POSIX_SPAWN_DISABLE_ASLR" + : "", + llvm::sys::StrError(error_code)); error.SetError(error_code, eErrorTypePOSIX); return error; } @@ -341,10 +341,10 @@ static Status PosixSpawnChildForPTraceDebugging(const error_code = ::posix_spawnattr_setbinpref_np(&attr, 1, &desired_cpu_type, &ocount); if (error_code != 0) { - if (log) - log->Printf("::posix_spawnattr_setbinpref_np(&attr, 1, " - "cpu_type = 0x%8.8x, count => %llu): %s", - desired_cpu_type, (uint64_t)ocount, strerror(error_code)); + LLDB_LOG(log, + "::posix_spawnattr_setbinpref_np(&attr, 1, " + "cpu_type = {0:x8}, count => {1}): {2}", + desired_cpu_type, ocount, llvm::sys::StrError(error_code)); error.SetError(error_code, eErrorTypePOSIX); return error; } @@ -361,10 +361,8 @@ static Status PosixSpawnChildForPTraceDebugging(const posix_spawn_file_actions_t file_actions; if ((error_code = ::posix_spawn_file_actions_init(&file_actions)) != 0) { - if (log) - log->Printf("::posix_spawn_file_actions_init(&file_actions) " - "failed: %s", - strerror(error_code)); + LLDB_LOG(log, "::posix_spawn_file_actions_init(&file_actions) failed: {0}", + llvm::sys::StrError(error_code)); error.SetError(error_code, eErrorTypePOSIX); return error; } @@ -409,11 +407,11 @@ static Status PosixSpawnChildForPTraceDebugging(const error_code = ::posix_spawnp(pid, path, &file_actions, &attr, (char *const *)argv, (char *const *)envp); if (error_code != 0) { - if (log) - log->Printf("::posix_spawnp(pid => %p, path = '%s', file_actions " - "= %p, attr = %p, argv = %p, envp = %p) failed: %s", - pid, path, &file_actions, &attr, argv, envp, - strerror(error_code)); + LLDB_LOG(log, + "::posix_spawnp(pid => {0}, path = '{1}', file_actions " + "= {2}, attr = {3}, argv = {4}, envp = {5}) failed: {6}", + pid, path, &file_actions, &attr, argv, envp, + llvm::sys::StrError(error_code)); error.SetError(error_code, eErrorTypePOSIX); return error; } Modified: vendor/lldb/dist/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp ============================================================================== --- vendor/lldb/dist/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -30,6 +30,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/Status.h" +#include "llvm/Support/Errno.h" #include "FreeBSDThread.h" #include "Plugins/Process/POSIX/CrashReason.h" @@ -529,10 +530,8 @@ void ResumeOperation::Execute(ProcessMonitor *monitor) if (PTRACE(PT_CONTINUE, pid, (caddr_t)1, data)) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); - - if (log) - log->Printf("ResumeOperation (%" PRIu64 ") failed: %s", pid, - strerror(errno)); + LLDB_LOG(log, "ResumeOperation ({0}) failed: {1}", pid, + llvm::sys::StrError(errno)); m_result = false; } else m_result = true; Modified: vendor/lldb/dist/source/Plugins/Process/Linux/NativeProcessLinux.cpp ============================================================================== --- vendor/lldb/dist/source/Plugins/Process/Linux/NativeProcessLinux.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Plugins/Process/Linux/NativeProcessLinux.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -43,14 +43,14 @@ #include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StringExtractor.h" +#include "llvm/Support/Errno.h" +#include "llvm/Support/FileSystem.h" +#include "llvm/Support/Threading.h" #include "NativeThreadLinux.h" #include "Plugins/Process/POSIX/ProcessPOSIXLog.h" #include "Procfs.h" -#include "llvm/Support/FileSystem.h" -#include "llvm/Support/Threading.h" - #include <linux/unistd.h> #include <sys/socket.h> #include <sys/syscall.h> @@ -97,7 +97,7 @@ static bool ProcessVmReadvSupported() { LLDB_LOG(log, "syscall process_vm_readv failed (error: {0}). Fast memory " "reads disabled.", - strerror(errno)); + llvm::sys::StrError()); }); return is_supported; @@ -1988,7 +1988,7 @@ Status NativeProcessLinux::ReadMemory(lldb::addr_t add LLDB_LOG(log, "using process_vm_readv to read {0} bytes from inferior " "address {1:x}: {2}", - size, addr, success ? "Success" : strerror(errno)); + size, addr, success ? "Success" : llvm::sys::StrError(errno)); if (success) return Status(); Modified: vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextLLDB.cpp ============================================================================== --- vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -329,7 +329,8 @@ void RegisterContextLLDB::InitializeNonZerothFrame() { if (abi) pc = abi->FixCodeAddress(pc); - m_current_pc.SetLoadAddress(pc, &process->GetTarget()); + const bool allow_section_end = true; + m_current_pc.SetLoadAddress(pc, &process->GetTarget(), allow_section_end); // If we don't have a Module for some reason, we're not going to find // symbol/function information - just @@ -477,11 +478,12 @@ void RegisterContextLLDB::InitializeNonZerothFrame() { // Or if we're in the middle of the stack (and not "above" an asynchronous // event like sigtramp), // and our "current" pc is the start of a function... - if (m_sym_ctx_valid && GetNextFrame()->m_frame_type != eTrapHandlerFrame && + if (GetNextFrame()->m_frame_type != eTrapHandlerFrame && GetNextFrame()->m_frame_type != eDebuggerFrame && - addr_range.GetBaseAddress().IsValid() && - addr_range.GetBaseAddress().GetSection() == m_current_pc.GetSection() && - addr_range.GetBaseAddress().GetOffset() == m_current_pc.GetOffset()) { + (!m_sym_ctx_valid || + (addr_range.GetBaseAddress().IsValid() && + addr_range.GetBaseAddress().GetSection() == m_current_pc.GetSection() && + addr_range.GetBaseAddress().GetOffset() == m_current_pc.GetOffset()))) { decr_pc_and_recompute_addr_range = true; } Modified: vendor/lldb/dist/source/Plugins/Process/elf-core/CMakeLists.txt ============================================================================== --- vendor/lldb/dist/source/Plugins/Process/elf-core/CMakeLists.txt Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Plugins/Process/elf-core/CMakeLists.txt Sat Jun 10 13:44:58 2017 (r319790) @@ -17,5 +17,6 @@ add_lldb_library(lldbPluginProcessElfCore PLUGIN lldbPluginObjectFileELF lldbPluginProcessUtility LINK_COMPONENTS + BinaryFormat Support ) Modified: vendor/lldb/dist/source/Plugins/Process/elf-core/ProcessElfCore.cpp ============================================================================== --- vendor/lldb/dist/source/Plugins/Process/elf-core/ProcessElfCore.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Plugins/Process/elf-core/ProcessElfCore.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -27,7 +27,7 @@ #include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/Log.h" -#include "llvm/Support/ELF.h" +#include "llvm/BinaryFormat/ELF.h" #include "llvm/Support/Threading.h" #include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h" Modified: vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp ============================================================================== --- vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -3732,8 +3732,8 @@ static DWARFDIE GetContainingFunctionWithAbstractOrigi } } } - assert(!"Shouldn't call GetContainingFunctionWithAbstractOrigin on something " - "not in a function"); + assert(0 && "Shouldn't call GetContainingFunctionWithAbstractOrigin on " + "something not in a function"); return DWARFDIE(); } Modified: vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp ============================================================================== --- vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -1958,7 +1958,7 @@ void SymbolFileDWARF::Index() { &function_fullname_index, &function_method_index, &function_selector_index, &objc_class_selectors_index, &global_index, &type_index, - &namespace_index](uint32_t cu_idx) { + &namespace_index](size_t cu_idx) { DWARFCompileUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx); if (dwarf_cu) { dwarf_cu->Index( @@ -1967,10 +1967,9 @@ void SymbolFileDWARF::Index() { objc_class_selectors_index[cu_idx], global_index[cu_idx], type_index[cu_idx], namespace_index[cu_idx]); } - return cu_idx; }; - auto extract_fn = [debug_info, &clear_cu_dies](uint32_t cu_idx) { + auto extract_fn = [debug_info, &clear_cu_dies](size_t cu_idx) { DWARFCompileUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx); if (dwarf_cu) { // dwarf_cu->ExtractDIEsIfNeeded(false) will return zero if the Modified: vendor/lldb/dist/source/Target/SectionLoadList.cpp ============================================================================== --- vendor/lldb/dist/source/Target/SectionLoadList.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Target/SectionLoadList.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -207,8 +207,8 @@ bool SectionLoadList::SetSectionUnloaded(const lldb::S return erased; } -bool SectionLoadList::ResolveLoadAddress(addr_t load_addr, - Address &so_addr) const { +bool SectionLoadList::ResolveLoadAddress(addr_t load_addr, Address &so_addr, + bool allow_section_end) const { // First find the top level section that this load address exists in std::lock_guard<std::recursive_mutex> guard(m_mutex); if (!m_addr_to_sect.empty()) { @@ -220,10 +220,11 @@ bool SectionLoadList::ResolveLoadAddress(addr_t load_a const addr_t pos_load_addr = pos->first; if (load_addr >= pos_load_addr) { addr_t offset = load_addr - pos_load_addr; - if (offset < pos->second->GetByteSize()) { + if (offset < pos->second->GetByteSize() + (allow_section_end ? 1 : 0)) { // We have found the top level section, now we need to find the // deepest child section. - return pos->second->ResolveContainedAddress(offset, so_addr); + return pos->second->ResolveContainedAddress(offset, so_addr, + allow_section_end); } } } else { @@ -233,10 +234,12 @@ bool SectionLoadList::ResolveLoadAddress(addr_t load_a m_addr_to_sect.rbegin(); if (load_addr >= rpos->first) { addr_t offset = load_addr - rpos->first; - if (offset < rpos->second->GetByteSize()) { + if (offset < + rpos->second->GetByteSize() + (allow_section_end ? 1 : 0)) { // We have found the top level section, now we need to find the // deepest child section. - return rpos->second->ResolveContainedAddress(offset, so_addr); + return rpos->second->ResolveContainedAddress(offset, so_addr, + allow_section_end); } } } Modified: vendor/lldb/dist/source/Target/StackFrame.cpp ============================================================================== --- vendor/lldb/dist/source/Target/StackFrame.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Target/StackFrame.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -191,9 +191,10 @@ const Address &StackFrame::GetFrameCodeAddress() { if (thread_sp) { TargetSP target_sp(thread_sp->CalculateTarget()); if (target_sp) { + const bool allow_section_end = true; if (m_frame_code_addr.SetOpcodeLoadAddress( m_frame_code_addr.GetOffset(), target_sp.get(), - eAddressClassCode)) { + eAddressClassCode, allow_section_end)) { ModuleSP module_sp(m_frame_code_addr.GetModule()); if (module_sp) { m_sc.module_sp = module_sp; Modified: vendor/lldb/dist/source/Utility/CMakeLists.txt ============================================================================== --- vendor/lldb/dist/source/Utility/CMakeLists.txt Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Utility/CMakeLists.txt Sat Jun 10 13:44:58 2017 (r319790) @@ -38,5 +38,6 @@ add_lldb_library(lldbUtility # lldbUtility cannot have any dependencies LINK_COMPONENTS + BinaryFormat Support ) Modified: vendor/lldb/dist/source/Utility/Status.cpp ============================================================================== --- vendor/lldb/dist/source/Utility/Status.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Utility/Status.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -11,10 +11,11 @@ #include "lldb/Utility/Status.h" #include "lldb/Utility/VASPrintf.h" -#include "lldb/lldb-defines.h" // for LLDB_GENERIC_ERROR -#include "lldb/lldb-enumerations.h" // for ErrorType, ErrorType::eErr... -#include "llvm/ADT/SmallString.h" // for SmallString -#include "llvm/ADT/StringRef.h" // for StringRef +#include "lldb/lldb-defines.h" // for LLDB_GENERIC_ERROR +#include "lldb/lldb-enumerations.h" // for ErrorType, ErrorType::eErr... +#include "llvm/ADT/SmallString.h" // for SmallString +#include "llvm/ADT/StringRef.h" // for StringRef +#include "llvm/Support/Errno.h" #include "llvm/Support/FormatProviders.h" // for format_provider #include <cerrno> @@ -27,7 +28,6 @@ #endif #include <stdint.h> // for uint32_t -#include <string.h> // for strerror namespace llvm { class raw_ostream; @@ -121,23 +121,21 @@ const char *Status::AsCString(const char *default_erro return nullptr; if (m_string.empty()) { - const char *s = nullptr; switch (m_type) { case eErrorTypeMachKernel: #if defined(__APPLE__) - s = ::mach_error_string(m_code); + if (const char *s = ::mach_error_string(m_code)) + m_string.assign(s); #endif break; case eErrorTypePOSIX: - s = ::strerror(m_code); + m_string = llvm::sys::StrError(m_code); break; default: break; } - if (s != nullptr) - m_string.assign(s); } if (m_string.empty()) { if (default_error_str) Modified: vendor/lldb/dist/source/Utility/TaskPool.cpp ============================================================================== --- vendor/lldb/dist/source/Utility/TaskPool.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Utility/TaskPool.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -75,7 +75,7 @@ void TaskPoolImpl::Worker(TaskPoolImpl *pool) { } void TaskMapOverInt(size_t begin, size_t end, - std::function<void(size_t)> const &func) { + const llvm::function_ref<void(size_t)> &func) { std::atomic<size_t> idx{begin}; size_t num_workers = std::min<size_t>(end, std::thread::hardware_concurrency()); Modified: vendor/lldb/dist/source/Utility/VMRange.cpp ============================================================================== --- vendor/lldb/dist/source/Utility/VMRange.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/source/Utility/VMRange.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -25,36 +25,15 @@ using namespace lldb_private; bool VMRange::ContainsValue(const VMRange::collection &coll, lldb::addr_t value) { ValueInRangeUnaryPredicate in_range_predicate(value); - VMRange::const_iterator pos; - VMRange::const_iterator end = coll.end(); - pos = std::find_if(coll.begin(), end, in_range_predicate); - if (pos != end) - return true; - return false; + return llvm::find_if(coll, in_range_predicate) != coll.end(); } bool VMRange::ContainsRange(const VMRange::collection &coll, const VMRange &range) { RangeInRangeUnaryPredicate in_range_predicate(range); - VMRange::const_iterator pos; - VMRange::const_iterator end = coll.end(); - pos = std::find_if(coll.begin(), end, in_range_predicate); - if (pos != end) - return true; - return false; + return llvm::find_if(coll, in_range_predicate) != coll.end(); } -size_t VMRange::FindRangeIndexThatContainsValue(const VMRange::collection &coll, - lldb::addr_t value) { - ValueInRangeUnaryPredicate in_range_predicate(value); - VMRange::const_iterator begin = coll.begin(); - VMRange::const_iterator end = coll.end(); - VMRange::const_iterator pos = std::find_if(begin, end, in_range_predicate); - if (pos != end) - return std::distance(begin, pos); - return UINT32_MAX; -} - void VMRange::Dump(Stream *s, lldb::addr_t offset, uint32_t addr_width) const { s->AddressRange(offset + GetBaseAddress(), offset + GetEndAddress(), addr_width); @@ -66,8 +45,7 @@ bool lldb_private::operator==(const VMRange &lhs, cons } bool lldb_private::operator!=(const VMRange &lhs, const VMRange &rhs) { - return lhs.GetBaseAddress() != rhs.GetBaseAddress() || - lhs.GetEndAddress() != rhs.GetEndAddress(); + return !(lhs == rhs); } bool lldb_private::operator<(const VMRange &lhs, const VMRange &rhs) { @@ -79,25 +57,13 @@ bool lldb_private::operator<(const VMRange &lhs, const } bool lldb_private::operator<=(const VMRange &lhs, const VMRange &rhs) { - if (lhs.GetBaseAddress() < rhs.GetBaseAddress()) - return true; - else if (lhs.GetBaseAddress() > rhs.GetBaseAddress()) - return false; - return lhs.GetEndAddress() <= rhs.GetEndAddress(); + return !(lhs > rhs); } bool lldb_private::operator>(const VMRange &lhs, const VMRange &rhs) { - if (lhs.GetBaseAddress() > rhs.GetBaseAddress()) - return true; - else if (lhs.GetBaseAddress() < rhs.GetBaseAddress()) - return false; - return lhs.GetEndAddress() > rhs.GetEndAddress(); + return rhs < lhs; } bool lldb_private::operator>=(const VMRange &lhs, const VMRange &rhs) { - if (lhs.GetBaseAddress() > rhs.GetBaseAddress()) - return true; - else if (lhs.GetBaseAddress() < rhs.GetBaseAddress()) - return false; - return lhs.GetEndAddress() >= rhs.GetEndAddress(); + return !(lhs < rhs); } Modified: vendor/lldb/dist/tools/lldb-server/lldb-gdbserver.cpp ============================================================================== --- vendor/lldb/dist/tools/lldb-server/lldb-gdbserver.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/tools/lldb-server/lldb-gdbserver.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -21,8 +21,6 @@ // C++ Includes -// Other libraries and framework includes -#include "llvm/ADT/StringRef.h" #include "Acceptor.h" #include "LLDBServerUtilities.h" @@ -36,6 +34,8 @@ #include "lldb/Host/Socket.h" #include "lldb/Host/StringConvert.h" #include "lldb/Utility/Status.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/Errno.h" #ifndef LLGS_PROGRAM_NAME #define LLGS_PROGRAM_NAME "lldb-server" @@ -398,10 +398,9 @@ int main_gdbserver(int argc, char *argv[]) { { const ::pid_t new_sid = setsid(); if (new_sid == -1) { - const char *errno_str = strerror(errno); - fprintf(stderr, "failed to set new session id for %s (%s)\n", - LLGS_PROGRAM_NAME, - errno_str ? errno_str : "<no error string>"); + llvm::errs() << llvm::formatv( + "failed to set new session id for {0} ({1})\n", LLGS_PROGRAM_NAME, + llvm::sys::StrError()); } } break; Modified: vendor/lldb/dist/unittests/CMakeLists.txt ============================================================================== --- vendor/lldb/dist/unittests/CMakeLists.txt Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/unittests/CMakeLists.txt Sat Jun 10 13:44:58 2017 (r319790) @@ -68,9 +68,10 @@ add_subdirectory(Signals) add_subdirectory(Symbol) add_subdirectory(SymbolFile) add_subdirectory(Target) +add_subdirectory(tools) add_subdirectory(UnwindAssembly) add_subdirectory(Utility) if(LLDB_CAN_USE_DEBUGSERVER) add_subdirectory(debugserver) -endif() \ No newline at end of file +endif() Modified: vendor/lldb/dist/unittests/Core/ArchSpecTest.cpp ============================================================================== --- vendor/lldb/dist/unittests/Core/ArchSpecTest.cpp Sat Jun 10 13:44:55 2017 (r319789) +++ vendor/lldb/dist/unittests/Core/ArchSpecTest.cpp Sat Jun 10 13:44:58 2017 (r319790) @@ -11,7 +11,7 @@ #include "lldb/Core/ArchSpec.h" -#include "llvm/Support/MachO.h" +#include "llvm/BinaryFormat/MachO.h" using namespace lldb; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706101344.v5ADixBK095169>