[Lldb-commits] [lldb] 2b30fc2 - Fix two bugs with stack corefiles patch, restrict test built debugserver

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 11 17:19:37 PDT 2021


Author: Jason Molenda
Date: 2021-08-11T17:19:31-07:00
New Revision: 2b30fc2ff3cadd085f7103cb953cd9cf091ee9b9

URL: https://github.com/llvm/llvm-project/commit/2b30fc2ff3cadd085f7103cb953cd9cf091ee9b9
DIFF: https://github.com/llvm/llvm-project/commit/2b30fc2ff3cadd085f7103cb953cd9cf091ee9b9.diff

LOG: Fix two bugs with stack corefiles patch, restrict test built debugserver

These two tests, TestSkinnyCorefile.py and TestStackCorefile.py,
require a new debugserver on darwin systems to run correctly; for now,
skip them if the system debugserver is in use.  There's no easy way to
test if the debugserver being used supports either of these memory
region info features. For end users, the fallback will be a full
corefile and that's not the worst thing, but for the tests it is a
problem.

Added: 
    

Modified: 
    lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py
    lldb/test/API/macosx/stack-corefile/TestStackCorefile.py
    lldb/tools/debugserver/source/RNBRemote.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index decccc494bc08..8d3b3ebbe95f6 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -6616,6 +6616,7 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
         std::vector<page_object> combined_page_objects;
         page_object last_obj;
         last_obj.addr = LLDB_INVALID_ADDRESS;
+        last_obj.size = 0;
         for (page_object obj : pages_to_copy) {
           if (last_obj.addr == LLDB_INVALID_ADDRESS) {
             last_obj = obj;
@@ -6629,12 +6630,10 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
           combined_page_objects.push_back(last_obj);
           last_obj = obj;
         }
-
-        // If we only ended up with one contiguous memory segment
-        if (combined_page_objects.size() == 0 &&
-            last_obj.addr != LLDB_INVALID_ADDRESS) {
+        // Add the last entry we were looking to combine
+        // on to the array.
+        if (last_obj.addr != LLDB_INVALID_ADDRESS && last_obj.size != 0)
           combined_page_objects.push_back(last_obj);
-        }
 
         for (page_object obj : combined_page_objects) {
           uint32_t cmd_type = LC_SEGMENT_64;

diff  --git a/lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py b/lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py
index a0822a6e392d9..4257aa5ca26a5 100644
--- a/lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py
+++ b/lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py
@@ -16,6 +16,7 @@ class TestSkinnyCorefile(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
 
+    @skipIfOutOfTreeDebugserver  # newer debugserver required for these qMemoryRegionInfo types
     @skipIf(debug_info=no_match(["dsym"]), bugnumber="This test is looking explicitly for a dSYM")
     @skipUnlessDarwin
     def test_lc_note(self):

diff  --git a/lldb/test/API/macosx/stack-corefile/TestStackCorefile.py b/lldb/test/API/macosx/stack-corefile/TestStackCorefile.py
index a9104e73419dc..b1c0fa98712e3 100644
--- a/lldb/test/API/macosx/stack-corefile/TestStackCorefile.py
+++ b/lldb/test/API/macosx/stack-corefile/TestStackCorefile.py
@@ -13,6 +13,7 @@ class TestStackCorefile(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
 
+    @skipIfOutOfTreeDebugserver  # newer debugserver required for these qMemoryRegionInfo types
     @no_debug_info_test
     @skipUnlessDarwin
     def test(self):

diff  --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp
index b70c7ae3707e5..dd8b90297995a 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -4311,6 +4311,7 @@ rnb_err_t RNBRemote::HandlePacket_MemoryRegionInfo(const char *p) {
     }
     ostrm << ";";
     if (!region_info.vm_types.empty()) {
+      ostrm << "type:";
       for (size_t i = 0; i < region_info.vm_types.size(); i++) {
         if (i)
           ostrm << ",";


        


More information about the lldb-commits mailing list