-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[LLDB] Make the thread list for SBSaveCoreOptions iterable #122541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
5a756db
7638844
a1c2d9d
a93b515
47c0c50
d6d45ad
642f63c
b765308
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,18 @@ | |
from lldbsuite.test.decorators import * | ||
from lldbsuite.test.lldbtest import * | ||
|
||
|
||
class SBSaveCoreOptionsAPICase(TestBase): | ||
basic_minidump = "basic_minidump.yaml" | ||
basic_minidump_different_pid = "basic_minidump_different_pid.yaml" | ||
|
||
def get_process_from_yaml(self, yaml_file): | ||
minidump_path = self.getBuildArtifact(os.path.basename(yaml_file) + ".dmp") | ||
print ("minidump_path: " + minidump_path) | ||
print("minidump_path: " + minidump_path) | ||
self.yaml2obj(yaml_file, minidump_path) | ||
self.assertTrue(os.path.exists(minidump_path), "yaml2obj did not emit a minidump file") | ||
self.assertTrue( | ||
os.path.exists(minidump_path), "yaml2obj did not emit a minidump file" | ||
) | ||
target = self.dbg.CreateTarget(None) | ||
process = target.LoadCore(minidump_path) | ||
self.assertTrue(process.IsValid(), "Process is not valid") | ||
|
@@ -59,7 +62,6 @@ def test_adding_and_removing_thread(self): | |
removed_success = options.RemoveThread(thread) | ||
self.assertFalse(removed_success) | ||
|
||
|
||
def test_adding_thread_different_process(self): | ||
"""Test adding and removing a thread from save core options.""" | ||
options = lldb.SBSaveCoreOptions() | ||
|
@@ -79,3 +81,26 @@ def test_adding_thread_different_process(self): | |
self.assertTrue(error.Fail()) | ||
error = options.AddThread(thread) | ||
self.assertTrue(error.Success()) | ||
|
||
def test_removing_and_adding_insertion_order(self): | ||
"""Test insertion order is maintained when removing and adding threads.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey Alex, good catch. This shouldn't test the ordering, it did before when used our own internal collection but after Greg and I had some back and forth now we're returning a thread collection. |
||
options = lldb.SBSaveCoreOptions() | ||
process = self.get_basic_process() | ||
threads = [] | ||
for x in range(0, 3): | ||
thread = process.GetThreadAtIndex(x) | ||
threads.append(thread) | ||
error = options.AddThread(thread) | ||
self.assertTrue(error.Success()) | ||
|
||
# Get the middle thread, remove it, and insert it back. | ||
middle_thread = threads[1] | ||
self.assertTrue(options.RemoveThread(middle_thread)) | ||
thread_collection = options.GetThreadsToSave() | ||
self.assertTrue(thread_collection is not None) | ||
self.assertEqual(thread_collection.GetSize(), 2) | ||
error = options.AddThread(middle_thread) | ||
self.assertTrue(error.Success()) | ||
thread_collection = options.GetThreadsToSave() | ||
self.assertEqual(thread_collection.GetSize(), 3) | ||
self.assertIn(middle_thread, thread_collection) |
Uh oh!
There was an error while loading. Please reload this page.