Skip to content

Commit 6595503

Browse files
committed
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. (cherry picked from commit 2b30fc2)
1 parent b811704 commit 6595503

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6645,6 +6645,7 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
66456645
std::vector<page_object> combined_page_objects;
66466646
page_object last_obj;
66476647
last_obj.addr = LLDB_INVALID_ADDRESS;
6648+
last_obj.size = 0;
66486649
for (page_object obj : pages_to_copy) {
66496650
if (last_obj.addr == LLDB_INVALID_ADDRESS) {
66506651
last_obj = obj;
@@ -6658,12 +6659,10 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
66586659
combined_page_objects.push_back(last_obj);
66596660
last_obj = obj;
66606661
}
6661-
6662-
// If we only ended up with one contiguous memory segment
6663-
if (combined_page_objects.size() == 0 &&
6664-
last_obj.addr != LLDB_INVALID_ADDRESS) {
6662+
// Add the last entry we were looking to combine
6663+
// on to the array.
6664+
if (last_obj.addr != LLDB_INVALID_ADDRESS && last_obj.size != 0)
66656665
combined_page_objects.push_back(last_obj);
6666-
}
66676666

66686667
for (page_object obj : combined_page_objects) {
66696668
uint32_t cmd_type = LC_SEGMENT_64;

lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class TestSkinnyCorefile(TestBase):
1616

1717
mydir = TestBase.compute_mydir(__file__)
1818

19+
@skipIfOutOfTreeDebugserver # newer debugserver required for these qMemoryRegionInfo types
1920
@skipIf(debug_info=no_match(["dsym"]), bugnumber="This test is looking explicitly for a dSYM")
2021
@skipUnlessDarwin
2122
def test_lc_note(self):

lldb/test/API/macosx/stack-corefile/TestStackCorefile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class TestStackCorefile(TestBase):
1313

1414
mydir = TestBase.compute_mydir(__file__)
1515

16+
@skipIfOutOfTreeDebugserver # newer debugserver required for these qMemoryRegionInfo types
1617
@no_debug_info_test
1718
@skipUnlessDarwin
1819
def test(self):

lldb/tools/debugserver/source/RNBRemote.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4311,6 +4311,7 @@ rnb_err_t RNBRemote::HandlePacket_MemoryRegionInfo(const char *p) {
43114311
}
43124312
ostrm << ";";
43134313
if (!region_info.vm_types.empty()) {
4314+
ostrm << "type:";
43144315
for (size_t i = 0; i < region_info.vm_types.size(); i++) {
43154316
if (i)
43164317
ostrm << ",";

0 commit comments

Comments
 (0)