summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/lit/Modules/Breakpad/Inputs/uuid-matching-mac.syms2
-rw-r--r--lldb/lit/Modules/Breakpad/Inputs/uuid-matching-mac.yaml59
-rw-r--r--lldb/lit/Modules/Breakpad/breakpad-identification.test4
-rw-r--r--lldb/lit/Modules/Breakpad/uuid-matching-mac.test13
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py10
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/fizzbuzz.syms2
-rw-r--r--lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp41
-rw-r--r--lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp2
8 files changed, 101 insertions, 32 deletions
diff --git a/lldb/lit/Modules/Breakpad/Inputs/uuid-matching-mac.syms b/lldb/lit/Modules/Breakpad/Inputs/uuid-matching-mac.syms
new file mode 100644
index 00000000000..7da9264de98
--- /dev/null
+++ b/lldb/lit/Modules/Breakpad/Inputs/uuid-matching-mac.syms
@@ -0,0 +1,2 @@
+MODULE mac x86_64 A0AB76409C3B3A279E521045D84FA2DC0 a.out
+FUNC f90 1b 0 main
diff --git a/lldb/lit/Modules/Breakpad/Inputs/uuid-matching-mac.yaml b/lldb/lit/Modules/Breakpad/Inputs/uuid-matching-mac.yaml
new file mode 100644
index 00000000000..9e1af9c6e90
--- /dev/null
+++ b/lldb/lit/Modules/Breakpad/Inputs/uuid-matching-mac.yaml
@@ -0,0 +1,59 @@
+--- !mach-o
+FileHeader:
+ magic: 0xFEEDFACF
+ cputype: 0x01000007
+ cpusubtype: 0x80000003
+ filetype: 0x00000002
+ ncmds: 14
+ sizeofcmds: 744
+ flags: 0x00200085
+ reserved: 0x00000000
+LoadCommands:
+ - cmd: LC_SEGMENT_64
+ cmdsize: 72
+ segname: __PAGEZERO
+ vmaddr: 0
+ vmsize: 4294967296
+ fileoff: 0
+ filesize: 0
+ maxprot: 0
+ initprot: 0
+ nsects: 0
+ flags: 0
+ - cmd: LC_SEGMENT_64
+ cmdsize: 232
+ segname: __TEXT
+ vmaddr: 4294967296
+ vmsize: 4096
+ fileoff: 0
+ filesize: 4096
+ maxprot: 7
+ initprot: 5
+ nsects: 2
+ flags: 0
+ Sections:
+ - sectname: __text
+ segname: __TEXT
+ addr: 0x0000000100000F90
+ size: 27
+ offset: 0x00000F90
+ align: 4
+ reloff: 0x00000000
+ nreloc: 0
+ flags: 0x80000400
+ reserved1: 0x00000000
+ reserved2: 0x00000000
+ reserved3: 0x00000000
+ - cmd: LC_UUID
+ cmdsize: 24
+ uuid: A0AB7640-9C3B-3A27-9E52-1045D84FA2DC
+ - cmd: LC_BUILD_VERSION
+ cmdsize: 32
+ platform: 1
+ minos: 658944
+ sdk: 658944
+ ntools: 1
+ Tools:
+ - tool: 3
+ version: 29491968
+...
diff --git a/lldb/lit/Modules/Breakpad/breakpad-identification.test b/lldb/lit/Modules/Breakpad/breakpad-identification.test
index 49758b59a1e..3e70345bc7d 100644
--- a/lldb/lit/Modules/Breakpad/breakpad-identification.test
+++ b/lldb/lit/Modules/Breakpad/breakpad-identification.test
@@ -15,7 +15,7 @@ LINUX: Strata: user
MAC: Plugin name: breakpad
MAC: Architecture: x86_64--macosx
-MAC: UUID: 680E8CD9-8920-1BAA-EACD-6A8C1F16707B
+MAC: UUID: D98C0E68-2089-AA1B-EACD-6A8C1F16707B
MAC: Executable: false
MAC: Stripped: false
MAC: Type: debug info
@@ -23,7 +23,7 @@ MAC: Strata: user
WINDOWS: Plugin name: breakpad
WINDOWS: Architecture: i386--windows
-WINDOWS: UUID: 5716C9A0-B580-0949-81A1-925EA62165C0-01000000
+WINDOWS: UUID: A0C91657-80B5-4909-81A1-925EA62165C0-00000001
WINDOWS: Executable: false
WINDOWS: Stripped: false
WINDOWS: Type: debug info
diff --git a/lldb/lit/Modules/Breakpad/uuid-matching-mac.test b/lldb/lit/Modules/Breakpad/uuid-matching-mac.test
new file mode 100644
index 00000000000..f2dd2e56312
--- /dev/null
+++ b/lldb/lit/Modules/Breakpad/uuid-matching-mac.test
@@ -0,0 +1,13 @@
+# RUN: yaml2obj %S/Inputs/uuid-matching-mac.yaml -o %T/uuid-matching-mac.out
+# RUN: cd %S
+# RUN: %lldb %T/uuid-matching-mac.out -s %s -o exit | FileCheck %s
+
+target symbols add Inputs/uuid-matching-mac.syms
+# CHECK-LABEL: target symbols add
+# CHECK: symbol file '{{.*}}uuid-matching-mac.syms' has been added to '{{.*}}uuid-matching-mac.out'
+
+image lookup -n main
+# CHECK-LABEL: image lookup
+# CHECK: Address: uuid-matching-mac.out[0x0000000100000f90]
+
+
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
index f6a7d7c7ff3..7800c2802f7 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
@@ -80,6 +80,16 @@ class MiniDumpTestCase(TestBase):
self.assertEqual(module.file.fullpath, expected['filename'])
self.assertEqual(module.GetUUIDString(), expected['uuid'])
+ def test_breakpad_uuid_matching(self):
+ """Test that the uuid computation algorithms in minidump and breakpad
+ files match."""
+ self.target = self.dbg.CreateTarget("")
+ self.process = self.target.LoadCore("fizzbuzz_no_heap.dmp")
+ self.assertTrue(self.process, PROCESS_IS_VALID)
+ self.expect("target symbols add fizzbuzz.syms", substrs=["symbol file",
+ "fizzbuzz.syms", "has been added to", "fizzbuzz.exe"]),
+ self.assertTrue(self.target.modules[0].FindSymbol("main"))
+
def test_stack_info_in_mini_dump(self):
"""Test that we can see a trivial stack in a VS-generate mini dump."""
# target create -c fizzbuzz_no_heap.dmp
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/fizzbuzz.syms b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/fizzbuzz.syms
new file mode 100644
index 00000000000..cab06c1c9d5
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/fizzbuzz.syms
@@ -0,0 +1,2 @@
+MODULE windows x86 0F45B7919A9646F9BF8F2D6076EA421A11 fizzbuzz.pdb
+PUBLIC 1000 0 main
diff --git a/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp b/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
index d5b87e387d8..322be35a1a8 100644
--- a/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
+++ b/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
@@ -76,26 +76,11 @@ template <typename T> static constexpr size_t hex_digits() {
return 2 * sizeof(T);
}
-/// Consume the right number of digits from the input StringRef and convert it
-/// to the endian-specific integer N. Return true on success.
-template <typename T> static bool consume_hex_integer(llvm::StringRef &str, T &N) {
- llvm::StringRef chunk = str.take_front(hex_digits<T>());
- uintmax_t t;
- if (!to_integer(chunk, t, 16))
- return false;
- N = t;
- str = str.drop_front(hex_digits<T>());
- return true;
-}
-
static UUID parseModuleId(llvm::Triple::OSType os, llvm::StringRef str) {
struct data_t {
- struct uuid_t {
- llvm::support::ulittle32_t part1;
- llvm::support::ulittle16_t part2[2];
- uint8_t part3[8];
- } uuid;
- llvm::support::ulittle32_t age;
+ using uuid_t = uint8_t[16];
+ uuid_t uuid;
+ llvm::support::ubig32_t age;
} data;
static_assert(sizeof(data) == 20, "");
// The textual module id encoding should be between 33 and 40 bytes long,
@@ -105,19 +90,17 @@ static UUID parseModuleId(llvm::Triple::OSType os, llvm::StringRef str) {
if (str.size() <= hex_digits<data_t::uuid_t>() ||
str.size() > hex_digits<data_t>())
return UUID();
- if (!consume_hex_integer(str, data.uuid.part1))
+ if (!all_of(str, llvm::isHexDigit))
return UUID();
- for (auto &t : data.uuid.part2) {
- if (!consume_hex_integer(str, t))
- return UUID();
- }
- for (auto &t : data.uuid.part3) {
- if (!consume_hex_integer(str, t))
- return UUID();
- }
+
+ llvm::StringRef uuid_str = str.take_front(hex_digits<data_t::uuid_t>());
+ llvm::StringRef age_str = str.drop_front(hex_digits<data_t::uuid_t>());
+
+ llvm::copy(fromHex(uuid_str), data.uuid);
uint32_t age;
- if (!to_integer(str, age, 16))
- return UUID();
+ bool success = to_integer(age_str, age, 16);
+ assert(success);
+ (void)success;
data.age = age;
// On non-windows, the age field should always be zero, so we don't include to
diff --git a/lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp b/lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
index a25a7076b60..acf788a9789 100644
--- a/lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
+++ b/lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
@@ -36,7 +36,7 @@ TEST(ModuleRecord, parse) {
EXPECT_EQ(ModuleRecord(llvm::Triple::Linux, llvm::Triple::x86_64,
UUID::fromData("@ABCDEFGHIJKLMNO", 16)),
ModuleRecord::parse(
- "MODULE Linux x86_64 434241404544474648494a4b4c4d4e4f0 a.out"));
+ "MODULE Linux x86_64 404142434445464748494a4b4c4d4e4f0 a.out"));
EXPECT_EQ(llvm::None, ModuleRecord::parse("MODULE"));
EXPECT_EQ(llvm::None, ModuleRecord::parse("MODULE Linux"));
OpenPOWER on IntegriCloud