[Lldb-commits] [lldb] r360568 - minidump: Use yaml instead of checked-in binaries for ThreadList tests

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon May 13 02:35:00 PDT 2019


Author: labath
Date: Mon May 13 02:35:00 2019
New Revision: 360568

URL: http://llvm.org/viewvc/llvm-project?rev=360568&view=rev
Log:
minidump: Use yaml instead of checked-in binaries for ThreadList tests

yaml2obj now supports the ThreadList stream.

Removed:
    lldb/trunk/unittests/Process/minidump/Inputs/linux-i386.dmp
    lldb/trunk/unittests/Process/minidump/Inputs/thread-list-not-padded.dmp
    lldb/trunk/unittests/Process/minidump/Inputs/thread-list-padded.dmp
Modified:
    lldb/trunk/unittests/Process/minidump/CMakeLists.txt
    lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp

Modified: lldb/trunk/unittests/Process/minidump/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/CMakeLists.txt?rev=360568&r1=360567&r2=360568&view=diff
==============================================================================
--- lldb/trunk/unittests/Process/minidump/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Process/minidump/CMakeLists.txt Mon May 13 02:35:00 2019
@@ -18,7 +18,6 @@ add_lldb_unittest(LLDBMinidumpTests
 set(test_inputs
    fizzbuzz_no_heap.dmp
    fizzbuzz_wow64.dmp
-   linux-i386.dmp
    linux-x86_64.dmp
    linux-x86_64_not_crashed.dmp
    memory-list-not-padded.dmp
@@ -26,8 +25,6 @@ set(test_inputs
    regions-linux-map.dmp
    regions-memlist.dmp
    regions-memlist64.dmp
-   thread-list-not-padded.dmp
-   thread-list-padded.dmp
    )
 
 add_unittest_inputs(LLDBMinidumpTests "${test_inputs}")

Removed: lldb/trunk/unittests/Process/minidump/Inputs/linux-i386.dmp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/Inputs/linux-i386.dmp?rev=360567&view=auto
==============================================================================
Binary files lldb/trunk/unittests/Process/minidump/Inputs/linux-i386.dmp (original) and lldb/trunk/unittests/Process/minidump/Inputs/linux-i386.dmp (removed) differ

Removed: lldb/trunk/unittests/Process/minidump/Inputs/thread-list-not-padded.dmp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/Inputs/thread-list-not-padded.dmp?rev=360567&view=auto
==============================================================================
Binary file - no diff available.

Removed: lldb/trunk/unittests/Process/minidump/Inputs/thread-list-padded.dmp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/Inputs/thread-list-padded.dmp?rev=360567&view=auto
==============================================================================
Binary file - no diff available.

Modified: lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp?rev=360568&r1=360567&r2=360568&view=diff
==============================================================================
--- lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp (original)
+++ lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Mon May 13 02:35:00 2019
@@ -90,7 +90,19 @@ Streams:
 }
 
 TEST_F(MinidumpParserTest, GetThreadsAndGetThreadContext) {
-  SetUpData("linux-x86_64.dmp");
+  ASSERT_THAT_ERROR(SetUpFromYaml(R"(
+--- !minidump
+Streams:         
+  - Type:            ThreadList
+    Threads:         
+      - Thread Id:       0x00003E81
+        Stack:           
+          Start of Memory Range: 0x00007FFCEB34A000
+          Content:         C84D04BCE97F00
+        Context:         00000000000000
+...
+)"),
+                    llvm::Succeeded());
   llvm::ArrayRef<minidump::Thread> thread_list;
 
   thread_list = parser->GetThreads();
@@ -98,32 +110,10 @@ TEST_F(MinidumpParserTest, GetThreadsAnd
 
   const minidump::Thread &thread = thread_list[0];
 
-  EXPECT_EQ(16001UL, thread.ThreadId);
+  EXPECT_EQ(0x3e81u, thread.ThreadId);
 
   llvm::ArrayRef<uint8_t> context = parser->GetThreadContext(thread);
-  EXPECT_EQ(1232UL, context.size());
-}
-
-TEST_F(MinidumpParserTest, GetThreadListNotPadded) {
-  // Verify that we can load a thread list that doesn't have 4 bytes of padding
-  // after the thread count.
-  SetUpData("thread-list-not-padded.dmp");
-  llvm::ArrayRef<minidump::Thread> thread_list;
-
-  thread_list = parser->GetThreads();
-  ASSERT_EQ(2UL, thread_list.size());
-  EXPECT_EQ(0x11223344UL, thread_list[0].ThreadId);
-  EXPECT_EQ(0x55667788UL, thread_list[1].ThreadId);
-}
-
-TEST_F(MinidumpParserTest, GetThreadListPadded) {
-  // Verify that we can load a thread list that has 4 bytes of padding
-  // after the thread count as found in breakpad minidump files.
-  SetUpData("thread-list-padded.dmp");
-  auto thread_list = parser->GetThreads();
-  ASSERT_EQ(2UL, thread_list.size());
-  EXPECT_EQ(0x11223344UL, thread_list[0].ThreadId);
-  EXPECT_EQ(0x55667788UL, thread_list[1].ThreadId);
+  EXPECT_EQ(7u, context.size());
 }
 
 TEST_F(MinidumpParserTest, GetMemoryListNotPadded) {
@@ -459,7 +449,19 @@ TEST_F(MinidumpParserTest, GetPidWow64)
 #define REG_VAL64(x) *(reinterpret_cast<uint64_t *>(x))
 
 TEST_F(MinidumpParserTest, GetThreadContext_x86_32) {
-  SetUpData("linux-i386.dmp");
+  ASSERT_THAT_ERROR(SetUpFromYaml(R"(
+--- !minidump
+Streams:         
+  - Type:            ThreadList
+    Threads:         
+      - Thread Id:       0x00026804
+        Stack:           
+          Start of Memory Range: 0x00000000FF9DD000
+          Content:         68D39DFF
+        Context:         0F0001000000000000000000000000000000000000000000000000007F03FFFF0000FFFFFFFFFFFF09DC62F72300000088E36CF72B00FFFF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000063000000000000002B0000002B000000A88204085CD59DFF008077F7A3D49DFF01000000000000003CD59DFFA082040823000000820201002CD59DFF2B0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+)"),
+                    llvm::Succeeded());
+
   llvm::ArrayRef<minidump::Thread> thread_list = parser->GetThreads();
   const minidump::Thread &thread = thread_list[0];
   llvm::ArrayRef<uint8_t> registers(parser->GetThreadContext(thread));
@@ -490,7 +492,19 @@ TEST_F(MinidumpParserTest, GetThreadCont
 }
 
 TEST_F(MinidumpParserTest, GetThreadContext_x86_64) {
-  SetUpData("linux-x86_64.dmp");
+  ASSERT_THAT_ERROR(SetUpFromYaml(R"(
+--- !minidump
+Streams:         
+  - Type:            ThreadList
+    Threads:         
+      - Thread Id:       0x00003E81
+        Stack:           
+          Start of Memory Range: 0x00007FFCEB34A000
+          Content:         C84D04BCE97F00
+        Context:         0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B0010000000000033000000000000000000000006020100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000010A234EBFC7F000010A234EBFC7F00000000000000000000F09C34EBFC7F0000C0A91ABCE97F00000000000000000000A0163FBCE97F00004602000000000000921C40000000000030A434EBFC7F000000000000000000000000000000000000C61D4000000000007F0300000000000000000000000000000000000000000000801F0000FFFF0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFF00FFFFFFFFFFFFFF00FFFFFFFF25252525252525252525252525252525000000000000000000000000000000000000000000000000000000000000000000FFFF00FFFFFFFFFFFFFF00FFFFFFFF0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+...
+)"),
+                    llvm::Succeeded());
   llvm::ArrayRef<minidump::Thread> thread_list = parser->GetThreads();
   const minidump::Thread &thread = thread_list[0];
   llvm::ArrayRef<uint8_t> registers(parser->GetThreadContext(thread));




More information about the lldb-commits mailing list