svn commit: r327132 - in vendor/lldb/dist: include/lldb/Interpreter include/lldb/Symbol include/lldb/Target include/lldb/Utility packages/Python/lldbsuite/test/expression_command/radar_9673664 pack...
Dimitry Andric
dim at FreeBSD.org
Sun Dec 24 01:01:07 UTC 2017
Author: dim
Date: Sun Dec 24 01:01:00 2017
New Revision: 327132
URL: https://svnweb.freebsd.org/changeset/base/327132
Log:
Vendor import of lldb trunk r321414:
https://llvm.org/svn/llvm-project/lldb/trunk@321414
Added:
vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/
vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/Makefile (contents, props changed)
vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py (contents, props changed)
vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/main.c (contents, props changed)
Modified:
vendor/lldb/dist/include/lldb/Interpreter/OptionValueFileSpec.h
vendor/lldb/dist/include/lldb/Symbol/ObjectFile.h
vendor/lldb/dist/include/lldb/Target/Target.h
vendor/lldb/dist/include/lldb/Utility/DataBufferLLVM.h
vendor/lldb/dist/packages/Python/lldbsuite/test/expression_command/radar_9673664/TestExprHelpExamples.py
vendor/lldb/dist/packages/Python/lldbsuite/test/expression_command/top-level/test.cpp
vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py
vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp
vendor/lldb/dist/scripts/Python/python-typemaps.swig
vendor/lldb/dist/source/Interpreter/OptionValueFileSpec.cpp
vendor/lldb/dist/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
vendor/lldb/dist/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
vendor/lldb/dist/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
vendor/lldb/dist/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
vendor/lldb/dist/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
vendor/lldb/dist/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
vendor/lldb/dist/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
vendor/lldb/dist/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
vendor/lldb/dist/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
vendor/lldb/dist/source/Symbol/ObjectFile.cpp
vendor/lldb/dist/source/Target/Target.cpp
vendor/lldb/dist/source/Utility/DataBufferLLVM.cpp
vendor/lldb/dist/tools/debugserver/debugserver.xcodeproj/project.pbxproj
vendor/lldb/dist/tools/debugserver/source/RNBContext.cpp
vendor/lldb/dist/tools/debugserver/source/RNBContext.h
vendor/lldb/dist/tools/debugserver/source/debugserver.cpp
vendor/lldb/dist/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
vendor/lldb/dist/tools/lldb-mi/MIUtilString.cpp
vendor/lldb/dist/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
vendor/lldb/dist/unittests/tools/lldb-server/CMakeLists.txt
vendor/lldb/dist/unittests/tools/lldb-server/tests/LLGSTest.cpp
vendor/lldb/dist/unittests/tools/lldb-server/tests/TestClient.cpp
vendor/lldb/dist/unittests/tools/lldb-server/tests/TestClient.h
Modified: vendor/lldb/dist/include/lldb/Interpreter/OptionValueFileSpec.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Interpreter/OptionValueFileSpec.h Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/include/lldb/Interpreter/OptionValueFileSpec.h Sun Dec 24 01:01:00 2017 (r327132)
@@ -77,7 +77,7 @@ class OptionValueFileSpec : public OptionValue { (publ
void SetDefaultValue(const FileSpec &value) { m_default_value = value; }
- const lldb::DataBufferSP &GetFileContents(bool null_terminate);
+ const lldb::DataBufferSP &GetFileContents();
void SetCompletionMask(uint32_t mask) { m_completion_mask = mask; }
Modified: vendor/lldb/dist/include/lldb/Symbol/ObjectFile.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Symbol/ObjectFile.h Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/include/lldb/Symbol/ObjectFile.h Sun Dec 24 01:01:00 2017 (r327132)
@@ -879,6 +879,9 @@ class ObjectFile : public std::enable_shared_from_this
ConstString GetNextSyntheticSymbolName();
+ static lldb::DataBufferSP MapFileData(const FileSpec &file, uint64_t Size,
+ uint64_t Offset);
+
private:
DISALLOW_COPY_AND_ASSIGN(ObjectFile);
};
Modified: vendor/lldb/dist/include/lldb/Target/Target.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Target/Target.h Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/include/lldb/Target/Target.h Sun Dec 24 01:01:00 2017 (r327132)
@@ -161,7 +161,7 @@ class TargetProperties : public Properties { (public)
lldb::LanguageType GetLanguage() const;
- const char *GetExpressionPrefixContentsAsCString();
+ llvm::StringRef GetExpressionPrefixContents();
bool GetUseHexImmediates() const;
Modified: vendor/lldb/dist/include/lldb/Utility/DataBufferLLVM.h
==============================================================================
--- vendor/lldb/dist/include/lldb/Utility/DataBufferLLVM.h Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/include/lldb/Utility/DataBufferLLVM.h Sun Dec 24 01:01:00 2017 (r327132)
@@ -17,7 +17,7 @@
#include <stdint.h> // for uint8_t, uint64_t
namespace llvm {
-class MemoryBuffer;
+class WritableMemoryBuffer;
class Twine;
}
@@ -28,10 +28,10 @@ class DataBufferLLVM : public DataBuffer { (public)
~DataBufferLLVM();
static std::shared_ptr<DataBufferLLVM>
- CreateSliceFromPath(const llvm::Twine &Path, uint64_t Size, uint64_t Offset, bool Private = false);
+ CreateSliceFromPath(const llvm::Twine &Path, uint64_t Size, uint64_t Offset);
static std::shared_ptr<DataBufferLLVM>
- CreateFromPath(const llvm::Twine &Path, bool NullTerminate = false, bool Private = false);
+ CreateFromPath(const llvm::Twine &Path);
uint8_t *GetBytes() override;
const uint8_t *GetBytes() const override;
@@ -42,10 +42,9 @@ class DataBufferLLVM : public DataBuffer { (public)
private:
/// \brief Construct a DataBufferLLVM from \p Buffer. \p Buffer must be a
/// valid pointer.
- explicit DataBufferLLVM(std::unique_ptr<llvm::MemoryBuffer> Buffer);
- const uint8_t *GetBuffer() const;
+ explicit DataBufferLLVM(std::unique_ptr<llvm::WritableMemoryBuffer> Buffer);
- std::unique_ptr<llvm::MemoryBuffer> Buffer;
+ std::unique_ptr<llvm::WritableMemoryBuffer> Buffer;
};
}
Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/expression_command/radar_9673664/TestExprHelpExamples.py
==============================================================================
--- vendor/lldb/dist/packages/Python/lldbsuite/test/expression_command/radar_9673664/TestExprHelpExamples.py Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/expression_command/radar_9673664/TestExprHelpExamples.py Sun Dec 24 01:01:00 2017 (r327132)
@@ -42,7 +42,7 @@ class Radar9673644TestCase(TestBase):
# rdar://problem/9673664 lldb expression evaluation problem
- self.expect('expr char c[] = "foo"; c[0]',
+ self.expect('expr char str[] = "foo"; str[0]',
substrs=["'f'"])
# runCmd: expr char c[] = "foo"; c[0]
# output: (char) $0 = 'f'
Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/expression_command/top-level/test.cpp
==============================================================================
--- vendor/lldb/dist/packages/Python/lldbsuite/test/expression_command/top-level/test.cpp Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/expression_command/top-level/test.cpp Sun Dec 24 01:01:00 2017 (r327132)
@@ -42,11 +42,11 @@ class AnotherClass (public)
int i;
} s = { 15 };
- int as[4] = { 2, 3, 4, 5 };
+ int numbers[4] = { 2, 3, 4, 5 };
- for (signed char a : as)
+ for (signed char number: numbers)
{
- s.i -= a;
+ s.i -= number;
}
return s.i;
@@ -94,14 +94,14 @@ class DiamondD : public DiamondB, public DiamondC (pub
int doTest()
{
- int a = m.memberResult();
- a += MyClass::staticResult();
- a += m.externResult();
- a += MyEnum::myEnumThree;
- a += myEnumOne;
- a += AnotherClass().complicatedFunction();
- a += DiamondD(3).accessor();
- return a;
+ int accumulator = m.memberResult();
+ accumulator += MyClass::staticResult();
+ accumulator += m.externResult();
+ accumulator += MyEnum::myEnumThree;
+ accumulator += myEnumOne;
+ accumulator += AnotherClass().complicatedFunction();
+ accumulator += DiamondD(3).accessor();
+ return accumulator;
}
// --
Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
==============================================================================
--- vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py Sun Dec 24 01:01:00 2017 (r327132)
@@ -29,12 +29,14 @@ class ExecTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
+ @expectedFailureAll(oslist=['macosx'], bugnumber="rdar://36134350") # when building with cmake on green gragon or on ci.swift.org, this test fails.
@expectedFailureAll(archs=['i386'], bugnumber="rdar://28656532")
@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://problem/34559552") # this exec test has problems on ios systems
def test_hitting_exec (self):
self.do_test(False)
@skipUnlessDarwin
+ @expectedFailureAll(oslist=['macosx'], bugnumber="rdar://36134350") # when building with cmake on green gragon or on ci.swift.org, this test fails.
@expectedFailureAll(archs=['i386'], bugnumber="rdar://28656532")
@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://problem/34559552") # this exec test has problems on ios systems
def test_skipping_exec (self):
Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
==============================================================================
--- vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py Sun Dec 24 01:01:00 2017 (r327132)
@@ -117,7 +117,7 @@ class MiniDumpNewTestCase(TestBase):
thread = self.process.GetThreadAtIndex(0)
self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone)
stop_description = thread.GetStopDescription(256)
- self.assertEqual(stop_description, None)
+ self.assertEqual(stop_description, "")
def do_test_deeper_stack(self, binary, core, pid):
target = self.dbg.CreateTarget(binary)
Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py
==============================================================================
--- vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py Sun Dec 24 01:01:00 2017 (r327132)
@@ -16,6 +16,13 @@ class TestConflictingSymbols(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCASE = True
+ def setUp(self):
+ TestBase.setUp(self)
+
+ self.One_line = line_number('One/One.c', '// break here')
+ self.Two_line = line_number('Two/Two.c', '// break here')
+ self.main_line = line_number('main.c', '// break here')
+
def test_conflicting_symbols(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
@@ -27,15 +34,12 @@ class TestConflictingSymbols(TestBase):
environment = self.registerSharedLibrariesWithTarget(
target, ['One', 'Two'])
- One_line = line_number('One/One.c', '// break here')
- Two_line = line_number('Two/Two.c', '// break here')
- main_line = line_number('main.c', '// break here')
lldbutil.run_break_set_command(
- self, 'breakpoint set -f One.c -l %s' % (One_line))
+ self, 'breakpoint set -f One.c -l %s' % (self.One_line))
lldbutil.run_break_set_command(
- self, 'breakpoint set -f Two.c -l %s' % (Two_line))
+ self, 'breakpoint set -f Two.c -l %s' % (self.Two_line))
lldbutil.run_break_set_by_file_and_line(
- self, 'main.c', main_line, num_expected_locations=1, loc_exact=True)
+ self, 'main.c', self.main_line, num_expected_locations=1, loc_exact=True)
process = target.LaunchSimple(
None, environment, self.get_process_working_directory())
@@ -88,3 +92,32 @@ class TestConflictingSymbols(TestBase):
error=True,
substrs=[
"Multiple internal symbols"])
+
+ @expectedFailureAll(bugnumber="llvm.org/pr35043")
+ def test_shadowed(self):
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ target = self.dbg.CreateTarget("a.out")
+ self.assertTrue(target, VALID_TARGET)
+
+ # Register our shared libraries for remote targets so they get
+ # automatically uploaded
+ environment = self.registerSharedLibrariesWithTarget(
+ target, ['One', 'Two'])
+
+ lldbutil.run_break_set_by_file_and_line(self, 'main.c', self.main_line)
+
+ process = target.LaunchSimple(
+ None, environment, self.get_process_working_directory())
+ self.assertTrue(process, PROCESS_IS_VALID)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
+ # As we are shadowing the conflicting symbol, there should be no
+ # ambiguity in this expression.
+ self.expect(
+ "expr int conflicting_symbol = 474747; conflicting_symbol",
+ substrs=[ "474747"])
Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp
==============================================================================
--- vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp Sun Dec 24 01:01:00 2017 (r327132)
@@ -11,7 +11,7 @@
int main (int argc, char const *argv[])
{
- printf("Stop here\n"); //% self.runCmd("expression auto $add = [](int a, int b) { return a + b; }")
+ printf("Stop here\n"); //% self.runCmd("expression auto $add = [](int first, int second) { return first + second; }")
//% self.expect("expression $add(2,3)", substrs = ['= 5'])
return 0;
}
Added: vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/Makefile
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/Makefile Sun Dec 24 01:01:00 2017 (r327132)
@@ -0,0 +1,6 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+EXE := read-mem-cstring
+
+include $(LEVEL)/Makefile.rules
Added: vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py Sun Dec 24 01:01:00 2017 (r327132)
@@ -0,0 +1,57 @@
+"""Test reading c-strings from memory via SB API."""
+
+from __future__ import print_function
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestReadMemCString(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
+
+ def test_read_memory_c_string(self):
+ """Test corner case behavior of SBProcess::ReadCStringFromMemory"""
+ self.build()
+ self.dbg.SetAsync(False)
+
+ self.main_source = "main.c"
+ self.main_source_spec = lldb.SBFileSpec(self.main_source)
+ self.exe = os.path.join(os.getcwd(), "read-mem-cstring")
+
+ (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
+ self, 'breakpoint here', self.main_source_spec, None, self.exe)
+
+ frame = thread.GetFrameAtIndex(0)
+
+ err = lldb.SBError()
+
+ empty_str_addr = frame.FindVariable("empty_string").GetValueAsUnsigned(err)
+ self.assertTrue(err.Success())
+ self.assertTrue(empty_str_addr != lldb.LLDB_INVALID_ADDRESS)
+
+ one_letter_str_addr = frame.FindVariable("one_letter_string").GetValueAsUnsigned(err)
+ self.assertTrue(err.Success())
+ self.assertTrue(one_letter_str_addr != lldb.LLDB_INVALID_ADDRESS)
+
+ invalid_memory_str_addr = frame.FindVariable("invalid_memory_string").GetValueAsUnsigned(err)
+ self.assertTrue(err.Success())
+ self.assertTrue(invalid_memory_str_addr != lldb.LLDB_INVALID_ADDRESS)
+
+ # Important: An empty (0-length) c-string must come back as a Python string, not a
+ # None object.
+ empty_str = process.ReadCStringFromMemory(empty_str_addr, 2048, err)
+ self.assertTrue(err.Success())
+ self.assertTrue(empty_str == "")
+
+ one_letter_string = process.ReadCStringFromMemory(one_letter_str_addr, 2048, err)
+ self.assertTrue(err.Success())
+ self.assertTrue(one_letter_string == "1")
+
+ invalid_memory_string = process.ReadCStringFromMemory(invalid_memory_str_addr, 2048, err)
+ self.assertTrue(err.Fail())
+ self.assertTrue(invalid_memory_string == "" or invalid_memory_string == None)
Added: vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/main.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/lldb/dist/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/main.c Sun Dec 24 01:01:00 2017 (r327132)
@@ -0,0 +1,11 @@
+#include <stdlib.h>
+int main ()
+{
+ const char *empty_string = "";
+ const char *one_letter_string = "1";
+ // This expects that lower 4k of memory will be mapped unreadable, which most
+ // OSs do (to catch null pointer dereferences).
+ const char *invalid_memory_string = (char*)0x100;
+
+ return empty_string[0] + one_letter_string[0]; // breakpoint here
+}
Modified: vendor/lldb/dist/scripts/Python/python-typemaps.swig
==============================================================================
--- vendor/lldb/dist/scripts/Python/python-typemaps.swig Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/scripts/Python/python-typemaps.swig Sun Dec 24 01:01:00 2017 (r327132)
@@ -102,7 +102,8 @@
%typemap(argout) (char *dst, size_t dst_len) {
Py_XDECREF($result); /* Blow away any previous result */
if (result == 0) {
- $result = Py_None;
+ lldb_private::PythonString string("");
+ $result = string.release();
Py_INCREF($result);
} else {
llvm::StringRef ref(static_cast<const char*>($1), result);
Modified: vendor/lldb/dist/source/Interpreter/OptionValueFileSpec.cpp
==============================================================================
--- vendor/lldb/dist/source/Interpreter/OptionValueFileSpec.cpp Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/source/Interpreter/OptionValueFileSpec.cpp Sun Dec 24 01:01:00 2017 (r327132)
@@ -113,14 +113,12 @@ size_t OptionValueFileSpec::AutoComplete(
return matches.GetSize();
}
-const lldb::DataBufferSP &
-OptionValueFileSpec::GetFileContents(bool null_terminate) {
+const lldb::DataBufferSP &OptionValueFileSpec::GetFileContents() {
if (m_current_value) {
const auto file_mod_time = FileSystem::GetModificationTime(m_current_value);
if (m_data_sp && m_data_mod_time == file_mod_time)
return m_data_sp;
- m_data_sp = DataBufferLLVM::CreateFromPath(m_current_value.GetPath(),
- null_terminate);
+ m_data_sp = DataBufferLLVM::CreateFromPath(m_current_value.GetPath());
m_data_mod_time = file_mod_time;
}
return m_data_sp;
Modified: vendor/lldb/dist/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp Sun Dec 24 01:01:00 2017 (r327132)
@@ -1127,6 +1127,11 @@ DisassemblerLLVMC::DisassemblerLLVMC(const ArchSpec &a
features_str += "+dspr2,";
}
+ // If any AArch64 variant, enable the ARMv8.2 ISA
+ // extensions so we can disassemble newer instructions.
+ if (triple.getArch() == llvm::Triple::aarch64)
+ features_str += "+v8.2a";
+
m_disasm_ap.reset(new LLVMCDisassembler(triple_str, cpu, features_str.c_str(),
flavor, *this));
if (!m_disasm_ap->IsValid()) {
Modified: vendor/lldb/dist/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Sun Dec 24 01:01:00 2017 (r327132)
@@ -24,7 +24,6 @@
#include "lldb/Target/Target.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBufferHeap.h"
-#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/Stream.h"
@@ -406,8 +405,7 @@ ObjectFile *ObjectFileELF::CreateInstance(const lldb::
lldb::offset_t file_offset,
lldb::offset_t length) {
if (!data_sp) {
- data_sp =
- DataBufferLLVM::CreateSliceFromPath(file->GetPath(), length, file_offset, true);
+ data_sp = MapFileData(*file, length, file_offset);
if (!data_sp)
return nullptr;
data_offset = 0;
@@ -424,8 +422,7 @@ ObjectFile *ObjectFileELF::CreateInstance(const lldb::
// Update the data to contain the entire file if it doesn't already
if (data_sp->GetByteSize() < length) {
- data_sp =
- DataBufferLLVM::CreateSliceFromPath(file->GetPath(), length, file_offset, true);
+ data_sp = MapFileData(*file, length, file_offset);
if (!data_sp)
return nullptr;
data_offset = 0;
@@ -684,8 +681,7 @@ size_t ObjectFileELF::GetModuleSpecifications(
size_t section_header_end = header.e_shoff + header.e_shentsize;
if (header.HasHeaderExtension() &&
section_header_end > data_sp->GetByteSize()) {
- data_sp = DataBufferLLVM::CreateSliceFromPath(
- file.GetPath(), section_header_end, file_offset);
+ data_sp = MapFileData(file, section_header_end, file_offset);
if (data_sp) {
data.SetData(data_sp);
lldb::offset_t header_offset = data_offset;
@@ -698,8 +694,7 @@ size_t ObjectFileELF::GetModuleSpecifications(
section_header_end =
header.e_shoff + header.e_shnum * header.e_shentsize;
if (section_header_end > data_sp->GetByteSize()) {
- data_sp = DataBufferLLVM::CreateSliceFromPath(
- file.GetPath(), section_header_end, file_offset);
+ data_sp = MapFileData(file, section_header_end, file_offset);
if (data_sp)
data.SetData(data_sp);
}
@@ -741,8 +736,7 @@ size_t ObjectFileELF::GetModuleSpecifications(
size_t program_headers_end =
header.e_phoff + header.e_phnum * header.e_phentsize;
if (program_headers_end > data_sp->GetByteSize()) {
- data_sp = DataBufferLLVM::CreateSliceFromPath(
- file.GetPath(), program_headers_end, file_offset);
+ data_sp = MapFileData(file, program_headers_end, file_offset);
if (data_sp)
data.SetData(data_sp);
}
@@ -757,8 +751,7 @@ size_t ObjectFileELF::GetModuleSpecifications(
}
if (segment_data_end > data_sp->GetByteSize()) {
- data_sp = DataBufferLLVM::CreateSliceFromPath(
- file.GetPath(), segment_data_end, file_offset);
+ data_sp = MapFileData(file, segment_data_end, file_offset);
if (data_sp)
data.SetData(data_sp);
}
@@ -767,8 +760,7 @@ size_t ObjectFileELF::GetModuleSpecifications(
CalculateELFNotesSegmentsCRC32(program_headers, data);
} else {
// Need to map entire file into memory to calculate the crc.
- data_sp = DataBufferLLVM::CreateSliceFromPath(file.GetPath(), -1,
- file_offset);
+ data_sp = MapFileData(file, -1, file_offset);
if (data_sp) {
data.SetData(data_sp);
gnu_debuglink_crc = calc_gnu_debuglink_crc32(
Modified: vendor/lldb/dist/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Sun Dec 24 01:01:00 2017 (r327132)
@@ -38,7 +38,7 @@
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadList.h"
#include "lldb/Utility/ArchSpec.h"
-#include "lldb/Utility/DataBufferLLVM.h"
+#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
@@ -862,8 +862,7 @@ ObjectFile *ObjectFileMachO::CreateInstance(const lldb
lldb::offset_t file_offset,
lldb::offset_t length) {
if (!data_sp) {
- data_sp =
- DataBufferLLVM::CreateSliceFromPath(file->GetPath(), length, file_offset);
+ data_sp = MapFileData(*file, length, file_offset);
if (!data_sp)
return nullptr;
data_offset = 0;
@@ -874,8 +873,7 @@ ObjectFile *ObjectFileMachO::CreateInstance(const lldb
// Update the data to contain the entire file if it doesn't already
if (data_sp->GetByteSize() < length) {
- data_sp =
- DataBufferLLVM::CreateSliceFromPath(file->GetPath(), length, file_offset);
+ data_sp = MapFileData(*file, length, file_offset);
if (!data_sp)
return nullptr;
data_offset = 0;
@@ -914,8 +912,7 @@ size_t ObjectFileMachO::GetModuleSpecifications(
size_t header_and_load_cmds =
header.sizeofcmds + MachHeaderSizeFromMagic(header.magic);
if (header_and_load_cmds >= data_sp->GetByteSize()) {
- data_sp = DataBufferLLVM::CreateSliceFromPath(
- file.GetPath(), header_and_load_cmds, file_offset);
+ data_sp = MapFileData(file, header_and_load_cmds, file_offset);
data.SetData(data_sp);
data_offset = MachHeaderSizeFromMagic(header.magic);
}
@@ -1127,8 +1124,7 @@ bool ObjectFileMachO::ParseHeader() {
ReadMemory(process_sp, m_memory_addr, header_and_lc_size);
} else {
// Read in all only the load command data from the file on disk
- data_sp = DataBufferLLVM::CreateSliceFromPath(
- m_file.GetPath(), header_and_lc_size, m_file_offset);
+ data_sp = MapFileData(m_file, header_and_lc_size, m_file_offset);
if (data_sp->GetByteSize() != header_and_lc_size)
return false;
}
@@ -2100,9 +2096,8 @@ UUID ObjectFileMachO::GetSharedCacheUUID(FileSpec dyld
const ByteOrder byte_order,
const uint32_t addr_byte_size) {
UUID dsc_uuid;
- DataBufferSP DscData = DataBufferLLVM::CreateSliceFromPath(
- dyld_shared_cache.GetPath(),
- sizeof(struct lldb_copy_dyld_cache_header_v1), 0);
+ DataBufferSP DscData = MapFileData(
+ dyld_shared_cache, sizeof(struct lldb_copy_dyld_cache_header_v1), 0);
if (!DscData)
return dsc_uuid;
DataExtractor dsc_header_data(DscData, byte_order, addr_byte_size);
@@ -2708,9 +2703,8 @@ size_t ObjectFileMachO::ParseSymtab() {
// Process the dyld shared cache header to find the unmapped symbols
- DataBufferSP dsc_data_sp = DataBufferLLVM::CreateSliceFromPath(
- dsc_filespec.GetPath(), sizeof(struct lldb_copy_dyld_cache_header_v1),
- 0);
+ DataBufferSP dsc_data_sp = MapFileData(
+ dsc_filespec, sizeof(struct lldb_copy_dyld_cache_header_v1), 0);
if (!dsc_uuid.IsValid()) {
dsc_uuid = GetSharedCacheUUID(dsc_filespec, byte_order, addr_byte_size);
}
@@ -2742,11 +2736,9 @@ size_t ObjectFileMachO::ParseSymtab() {
if (uuid_match &&
mappingOffset >= sizeof(struct lldb_copy_dyld_cache_header_v1)) {
- DataBufferSP dsc_mapping_info_data_sp =
- DataBufferLLVM::CreateSliceFromPath(
- dsc_filespec.GetPath(),
- sizeof(struct lldb_copy_dyld_cache_mapping_info),
- mappingOffset);
+ DataBufferSP dsc_mapping_info_data_sp = MapFileData(
+ dsc_filespec, sizeof(struct lldb_copy_dyld_cache_mapping_info),
+ mappingOffset);
DataExtractor dsc_mapping_info_data(dsc_mapping_info_data_sp,
byte_order, addr_byte_size);
@@ -2770,9 +2762,7 @@ size_t ObjectFileMachO::ParseSymtab() {
if (localSymbolsOffset && localSymbolsSize) {
// Map the local symbols
DataBufferSP dsc_local_symbols_data_sp =
- DataBufferLLVM::CreateSliceFromPath(dsc_filespec.GetPath(),
- localSymbolsSize,
- localSymbolsOffset);
+ MapFileData(dsc_filespec, localSymbolsSize, localSymbolsOffset);
if (dsc_local_symbols_data_sp) {
DataExtractor dsc_local_symbols_data(dsc_local_symbols_data_sp,
Modified: vendor/lldb/dist/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Sun Dec 24 01:01:00 2017 (r327132)
@@ -22,7 +22,6 @@
#include "lldb/Target/Target.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBufferHeap.h"
-#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/Timer.h"
@@ -66,8 +65,7 @@ ObjectFile *ObjectFilePECOFF::CreateInstance(const lld
lldb::offset_t file_offset,
lldb::offset_t length) {
if (!data_sp) {
- data_sp =
- DataBufferLLVM::CreateSliceFromPath(file->GetPath(), length, file_offset);
+ data_sp = MapFileData(file, length, file_offset);
if (!data_sp)
return nullptr;
data_offset = 0;
@@ -78,8 +76,7 @@ ObjectFile *ObjectFilePECOFF::CreateInstance(const lld
// Update the data to contain the entire file if it doesn't already
if (data_sp->GetByteSize() < length) {
- data_sp =
- DataBufferLLVM::CreateSliceFromPath(file->GetPath(), length, file_offset);
+ data_sp = MapFileData(file, length, file_offset);
if (!data_sp)
return nullptr;
}
@@ -436,8 +433,7 @@ DataExtractor ObjectFilePECOFF::ReadImageData(uint32_t
if (m_file) {
// A bit of a hack, but we intend to write to this buffer, so we can't
// mmap it.
- auto buffer_sp =
- DataBufferLLVM::CreateSliceFromPath(m_file.GetPath(), size, offset, true);
+ auto buffer_sp = MapFileData(m_file, size, offset);
return DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize());
}
ProcessSP process_sp(m_process_wp.lock());
Modified: vendor/lldb/dist/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Sun Dec 24 01:01:00 2017 (r327132)
@@ -1173,7 +1173,7 @@ const char *PlatformDarwin::GetDeveloperDirectory() {
xcode_dir_path.append("/usr/share/xcode-select/xcode_dir_path");
temp_file_spec.SetFile(xcode_dir_path, false);
auto dir_buffer =
- DataBufferLLVM::CreateFromPath(temp_file_spec.GetPath(), true);
+ DataBufferLLVM::CreateFromPath(temp_file_spec.GetPath());
if (dir_buffer && dir_buffer->GetByteSize() > 0) {
llvm::StringRef path_ref(dir_buffer->GetChars());
// Trim tailing newlines and make sure there is enough room for a null
Modified: vendor/lldb/dist/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp Sun Dec 24 01:01:00 2017 (r327132)
@@ -98,7 +98,7 @@ bool CommunicationKDP::SendRequestAndGetReply(
#ifdef LLDB_CONFIGURATION_DEBUG
// NOTE: this only works for packets that are in native endian byte order
assert(request_packet.GetSize() ==
- *((uint16_t *)(request_packet.GetData() + 2)));
+ *((const uint16_t *)(request_packet.GetData() + 2)));
#endif
lldb::offset_t offset = 1;
const uint32_t num_retries = 3;
Modified: vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp Sun Dec 24 01:01:00 2017 (r327132)
@@ -60,6 +60,7 @@ StateType GDBRemoteClientBase::SendContinuePacketAndWa
continue;
if (steady_clock::now() >= m_interrupt_time + kInterruptTimeout)
return eStateInvalid;
+ break;
}
case PacketResult::Success:
break;
Modified: vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Sun Dec 24 01:01:00 2017 (r327132)
@@ -1743,8 +1743,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const S
"DWARF DW_TAG_array_type DIE at 0x%8.8x has a "
"class/union/struct element type DIE 0x%8.8x that is a "
"forward declaration, not a complete definition.\nTry "
- "compiling the source file with -fno-limit-debug-info or "
- "disable -gmodule",
+ "compiling the source file with -fstandalone-debug or "
+ "disable -gmodules",
die.GetOffset(), type_die_ref.die_offset);
else
module_sp->ReportError(
@@ -2255,7 +2255,7 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const
if (die.GetCU()->GetProducer() ==
DWARFCompileUnit::eProducerClang)
module->ReportError(":: Try compiling the source file with "
- "-fno-limit-debug-info.");
+ "-fstandalone-debug.");
// We have no choice other than to pretend that the base class
// is complete. If we don't do this, clang will crash when we
@@ -3095,7 +3095,7 @@ bool DWARFASTParserClang::ParseChildMembers(
"DWARF DIE at 0x%8.8x (class %s) has a member variable "
"0x%8.8x (%s) whose type is a forward declaration, not a "
"complete definition.\nTry compiling the source file "
- "with -fno-limit-debug-info",
+ "with -fstandalone-debug",
parent_die.GetOffset(), parent_die.GetName(),
die.GetOffset(), name);
else
Modified: vendor/lldb/dist/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp Sun Dec 24 01:01:00 2017 (r327132)
@@ -124,6 +124,8 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(c
} else if (auto type_def = llvm::dyn_cast<PDBSymbolTypeTypedef>(&type)) {
lldb_private::Type *target_type =
m_ast.GetSymbolFile()->ResolveTypeUID(type_def->getTypeId());
+ if (!target_type)
+ return nullptr;
std::string name = type_def->getName();
uint64_t bytes = type_def->getLength();
if (!target_type)
@@ -179,6 +181,8 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(c
lldb_private::Type *element_type =
m_ast.GetSymbolFile()->ResolveTypeUID(element_uid);
+ if (!element_type)
+ return nullptr;
CompilerType element_ast_type = element_type->GetFullCompilerType();
CompilerType array_ast_type =
m_ast.CreateArrayType(element_ast_type, num_elements, false);
Modified: vendor/lldb/dist/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
==============================================================================
--- vendor/lldb/dist/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp Sun Dec 24 01:01:00 2017 (r327132)
@@ -19,14 +19,18 @@
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/TypeMap.h"
+#include "lldb/Utility/RegularExpression.h"
#include "llvm/DebugInfo/PDB/GenericError.h"
+#include "llvm/DebugInfo/PDB/IPDBDataStream.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
+#include "llvm/DebugInfo/PDB/IPDBTable.h"
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
#include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h"
@@ -93,6 +97,10 @@ SymbolFilePDB::SymbolFilePDB(lldb_private::ObjectFile
SymbolFilePDB::~SymbolFilePDB() {}
uint32_t SymbolFilePDB::CalculateAbilities() {
+ uint32_t abilities = 0;
+ if (!m_obj_file)
+ return 0;
+
if (!m_session_up) {
// Lazily load and match the PDB file, but only do this once.
std::string exePath = m_obj_file->GetFileSpec().GetPath();
@@ -100,10 +108,46 @@ uint32_t SymbolFilePDB::CalculateAbilities() {
m_session_up);
if (error) {
llvm::consumeError(std::move(error));
- return 0;
+ auto module_sp = m_obj_file->GetModule();
+ if (!module_sp)
+ return 0;
+ // See if any symbol file is specified through `--symfile` option.
+ FileSpec symfile = module_sp->GetSymbolFileFileSpec();
+ if (!symfile)
+ return 0;
+ error = loadDataForPDB(PDB_ReaderType::DIA,
+ llvm::StringRef(symfile.GetPath()),
+ m_session_up);
+ if (error) {
+ llvm::consumeError(std::move(error));
+ return 0;
+ }
}
}
- return CompileUnits | LineTables;
+ if (!m_session_up.get())
+ return 0;
+
+ auto enum_tables_up = m_session_up->getEnumTables();
+ if (!enum_tables_up)
+ return 0;
+ while (auto table_up = enum_tables_up->getNext()) {
+ if (table_up->getItemCount() == 0)
+ continue;
+ auto type = table_up->getTableType();
+ switch (type) {
+ case PDB_TableType::Symbols:
+ // This table represents a store of symbols with types listed in
+ // PDBSym_Type
+ abilities |= (CompileUnits | Functions | Blocks |
+ GlobalVariables | LocalVariables | VariableTypes);
+ break;
+ case PDB_TableType::LineNumbers:
+ abilities |= LineTables;
+ break;
+ default: break;
+ }
+ }
+ return abilities;
}
void SymbolFilePDB::InitializeObject() {
@@ -250,7 +294,8 @@ lldb_private::Type *SymbolFilePDB::ResolveTypeUID(lldb
return nullptr;
lldb::TypeSP result = pdb->CreateLLDBTypeFromPDBType(*pdb_type);
- m_types.insert(std::make_pair(type_uid, result));
+ if (result.get())
+ m_types.insert(std::make_pair(type_uid, result));
return result.get();
}
@@ -385,19 +430,16 @@ uint32_t SymbolFilePDB::FindTypes(
std::string name_str = name.AsCString();
- // If this might be a regex, we have to return EVERY symbol and process them
- // one by one, which is going to destroy performance on large PDB files. So
- // try really hard not to use a regex match.
- if (name_str.find_first_of("[]?*.-+\\") != std::string::npos)
- FindTypesByRegex(name_str, max_matches, types);
- else
- FindTypesByName(name_str, max_matches, types);
+ // There is an assumption 'name' is not a regex
+ FindTypesByName(name_str, max_matches, types);
+
return types.GetSize();
}
-void SymbolFilePDB::FindTypesByRegex(const std::string ®ex,
- uint32_t max_matches,
- lldb_private::TypeMap &types) {
+void
+SymbolFilePDB::FindTypesByRegex(const lldb_private::RegularExpression ®ex,
+ uint32_t max_matches,
+ lldb_private::TypeMap &types) {
// When searching by regex, we need to go out of our way to limit the search
// space as much as possible since this searches EVERYTHING in the PDB,
// manually doing regex comparisons. PDB library isn't optimized for regex
@@ -409,8 +451,6 @@ void SymbolFilePDB::FindTypesByRegex(const std::string
auto global = m_session_up->getGlobalScope();
std::unique_ptr<IPDBEnumSymbols> results;
- std::regex re(regex);
-
uint32_t matches = 0;
for (auto tag : tags_to_search) {
@@ -433,7 +473,7 @@ void SymbolFilePDB::FindTypesByRegex(const std::string
continue;
}
- if (!std::regex_match(type_name, re))
+ if (!regex.Execute(type_name))
continue;
// This should cause the type to get cached and stored in the `m_types`
Modified: vendor/lldb/dist/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
==============================================================================
--- vendor/lldb/dist/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h Sun Dec 24 01:01:00 2017 (r327132)
@@ -172,7 +172,8 @@ class SymbolFilePDB : public lldb_private::SymbolFile
const llvm::pdb::PDBSymbolCompiland &cu,
llvm::DenseMap<uint32_t, uint32_t> &index_map) const;
- void FindTypesByRegex(const std::string ®ex, uint32_t max_matches,
+ void FindTypesByRegex(const lldb_private::RegularExpression ®ex,
+ uint32_t max_matches,
lldb_private::TypeMap &types);
void FindTypesByName(const std::string &name, uint32_t max_matches,
Modified: vendor/lldb/dist/source/Symbol/ObjectFile.cpp
==============================================================================
--- vendor/lldb/dist/source/Symbol/ObjectFile.cpp Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/source/Symbol/ObjectFile.cpp Sun Dec 24 01:01:00 2017 (r327132)
@@ -688,3 +688,8 @@ Status ObjectFile::LoadInMemory(Target &target, bool s
void ObjectFile::RelocateSection(lldb_private::Section *section)
{
}
+
+DataBufferSP ObjectFile::MapFileData(const FileSpec &file, uint64_t Size,
+ uint64_t Offset) {
+ return DataBufferLLVM::CreateSliceFromPath(file.GetPath(), Size, Offset);
+}
Modified: vendor/lldb/dist/source/Target/Target.cpp
==============================================================================
--- vendor/lldb/dist/source/Target/Target.cpp Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/source/Target/Target.cpp Sun Dec 24 01:01:00 2017 (r327132)
@@ -2313,7 +2313,7 @@ ExpressionResults Target::EvaluateExpression(
result_valobj_sp = persistent_var_sp->GetValueObject();
execution_results = eExpressionCompleted;
} else {
- const char *prefix = GetExpressionPrefixContentsAsCString();
+ llvm::StringRef prefix = GetExpressionPrefixContents();
Status error;
execution_results = UserExpression::Evaluate(exe_ctx, options, expr, prefix,
result_valobj_sp, error,
@@ -4046,18 +4046,19 @@ LanguageType TargetProperties::GetLanguage() const {
return LanguageType();
}
-const char *TargetProperties::GetExpressionPrefixContentsAsCString() {
+llvm::StringRef TargetProperties::GetExpressionPrefixContents() {
const uint32_t idx = ePropertyExprPrefix;
OptionValueFileSpec *file =
m_collection_sp->GetPropertyAtIndexAsOptionValueFileSpec(nullptr, false,
idx);
if (file) {
- const bool null_terminate = true;
- DataBufferSP data_sp(file->GetFileContents(null_terminate));
+ DataBufferSP data_sp(file->GetFileContents());
if (data_sp)
- return (const char *)data_sp->GetBytes();
+ return llvm::StringRef(
+ reinterpret_cast<const char *>(data_sp->GetBytes()),
+ data_sp->GetByteSize());
}
- return nullptr;
+ return "";
}
bool TargetProperties::GetBreakpointsConsultPlatformAvoidList() {
Modified: vendor/lldb/dist/source/Utility/DataBufferLLVM.cpp
==============================================================================
--- vendor/lldb/dist/source/Utility/DataBufferLLVM.cpp Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/source/Utility/DataBufferLLVM.cpp Sun Dec 24 01:01:00 2017 (r327132)
@@ -18,7 +18,8 @@
using namespace lldb_private;
-DataBufferLLVM::DataBufferLLVM(std::unique_ptr<llvm::MemoryBuffer> MemBuffer)
+DataBufferLLVM::DataBufferLLVM(
+ std::unique_ptr<llvm::WritableMemoryBuffer> MemBuffer)
: Buffer(std::move(MemBuffer)) {
assert(Buffer != nullptr &&
"Cannot construct a DataBufferLLVM with a null buffer");
@@ -28,13 +29,13 @@ DataBufferLLVM::~DataBufferLLVM() {}
std::shared_ptr<DataBufferLLVM>
DataBufferLLVM::CreateSliceFromPath(const llvm::Twine &Path, uint64_t Size,
- uint64_t Offset, bool Private) {
+ uint64_t Offset) {
// If the file resides non-locally, pass the volatile flag so that we don't
// mmap it.
- if (!Private)
- Private = !llvm::sys::fs::is_local(Path);
+ bool IsVolatile = !llvm::sys::fs::is_local(Path);
- auto Buffer = llvm::MemoryBuffer::getFileSlice(Path, Size, Offset, Private);
+ auto Buffer =
+ llvm::WritableMemoryBuffer::getFileSlice(Path, Size, Offset, IsVolatile);
if (!Buffer)
return nullptr;
return std::shared_ptr<DataBufferLLVM>(
@@ -42,13 +43,12 @@ DataBufferLLVM::CreateSliceFromPath(const llvm::Twine
}
std::shared_ptr<DataBufferLLVM>
-DataBufferLLVM::CreateFromPath(const llvm::Twine &Path, bool NullTerminate, bool Private) {
+DataBufferLLVM::CreateFromPath(const llvm::Twine &Path) {
// If the file resides non-locally, pass the volatile flag so that we don't
// mmap it.
- if (!Private)
- Private = !llvm::sys::fs::is_local(Path);
+ bool IsVolatile = !llvm::sys::fs::is_local(Path);
- auto Buffer = llvm::MemoryBuffer::getFile(Path, -1, NullTerminate, Private);
+ auto Buffer = llvm::WritableMemoryBuffer::getFile(Path, -1, IsVolatile);
if (!Buffer)
return nullptr;
return std::shared_ptr<DataBufferLLVM>(
@@ -56,15 +56,13 @@ DataBufferLLVM::CreateFromPath(const llvm::Twine &Path
}
uint8_t *DataBufferLLVM::GetBytes() {
- return const_cast<uint8_t *>(GetBuffer());
+ return reinterpret_cast<uint8_t *>(Buffer->getBufferStart());
}
-const uint8_t *DataBufferLLVM::GetBytes() const { return GetBuffer(); }
+const uint8_t *DataBufferLLVM::GetBytes() const {
+ return reinterpret_cast<const uint8_t *>(Buffer->getBufferStart());
+}
lldb::offset_t DataBufferLLVM::GetByteSize() const {
return Buffer->getBufferSize();
-}
-
-const uint8_t *DataBufferLLVM::GetBuffer() const {
- return reinterpret_cast<const uint8_t *>(Buffer->getBufferStart());
}
Modified: vendor/lldb/dist/tools/debugserver/debugserver.xcodeproj/project.pbxproj
==============================================================================
--- vendor/lldb/dist/tools/debugserver/debugserver.xcodeproj/project.pbxproj Sun Dec 24 01:00:56 2017 (r327131)
+++ vendor/lldb/dist/tools/debugserver/debugserver.xcodeproj/project.pbxproj Sun Dec 24 01:01:00 2017 (r327132)
@@ -820,7 +820,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
- "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
+ "CODE_SIGN_ENTITLEMENTS[sdk=*]" = "source/debugserver-entitlements.plist";
"CODE_SIGN_ENTITLEMENTS[sdk=macosx*]" = "source/debugserver-macosx-entitlements.plist";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
@@ -920,8 +920,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
- "CODE_SIGN_ENTITLEMENTS[sdk=*]" = "source/debugserver-macosx-entitlements.plist";
- "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
+ "CODE_SIGN_ENTITLEMENTS[sdk=*]" = "source/debugserver-entitlements.plist";
"CODE_SIGN_ENTITLEMENTS[sdk=macosx*]" = "source/debugserver-macosx-entitlements.plist";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "";
@@ -1020,8 +1019,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
- "CODE_SIGN_ENTITLEMENTS[sdk=*]" = "source/debugserver-macosx-entitlements.plist";
- "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
+ "CODE_SIGN_ENTITLEMENTS[sdk=*]" = "source/debugserver-entitlements.plist";
"CODE_SIGN_ENTITLEMENTS[sdk=macosx*]" = "source/debugserver-macosx-entitlements.plist";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "";
@@ -1127,8 +1125,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- "CODE_SIGN_ENTITLEMENTS[sdk=*]" = "source/debugserver-macosx-entitlements.plist";
- "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
+ "CODE_SIGN_ENTITLEMENTS[sdk=*]" = "source/debugserver-entitlements.plist";
"CODE_SIGN_ENTITLEMENTS[sdk=macosx*]" = "source/debugserver-macosx-entitlements.plist";
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
@@ -1209,8 +1206,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
- "CODE_SIGN_ENTITLEMENTS[sdk=*]" = "source/debugserver-macosx-entitlements.plist";
- "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
+ "CODE_SIGN_ENTITLEMENTS[sdk=*]" = "source/debugserver-entitlements.plist";
"CODE_SIGN_ENTITLEMENTS[sdk=macosx*]" = "source/debugserver-macosx-entitlements.plist";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "";
@@ -1279,8 +1275,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
- "CODE_SIGN_ENTITLEMENTS[sdk=*]" = "source/debugserver-macosx-entitlements.plist";
- "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
+ "CODE_SIGN_ENTITLEMENTS[sdk=*]" = "source/debugserver-entitlements.plist";
"CODE_SIGN_ENTITLEMENTS[sdk=macosx*]" = "source/debugserver-macosx-entitlements.plist";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "";
@@ -1352,7 +1347,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
- "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
+ "CODE_SIGN_ENTITLEMENTS[sdk=*]" = "source/debugserver-entitlements.plist";
"CODE_SIGN_ENTITLEMENTS[sdk=macosx*]" = "source/debugserver-macosx-entitlements.plist";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
@@ -1460,8 +1455,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
- "CODE_SIGN_ENTITLEMENTS[sdk=*]" = "source/debugserver-macosx-entitlements.plist";
- "CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
+ "CODE_SIGN_ENTITLEMENTS[sdk=*]" = "source/debugserver-entitlements.plist";
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list