-
Notifications
You must be signed in to change notification settings - Fork 165
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
Implement a new API for representing threads #129
Conversation
74ac552
to
27b872c
Compare
Latest force-push didn't change anything, just signed off on the commit to fix the failing DCO Check |
0201cd6
to
601bcd3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love where this is going. I commented on a potential improvement for the thread map and a bunch of minor things. Please let me know if I missed your reasoning for anything I mentioned here. Thanks for tackling this!
Signed-off-by: Kevin Svetlitski <[email protected]>
0ed73b8
to
6c78d8f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only looked at the thread iterator parts, which looks great overall. I have some suggestions on improving the handling of the crashed thread, some cleanups, and some nits in the Python bindings.
Signed-off-by: Kevin Svetlitski <[email protected]>
a494996
to
bd43853
Compare
Just finished addressing these changes, I rebased them and combined them into the 2nd commit on this branch (i.e. the one with the message "Address @osandov's comments on #129") |
Signed-off-by: Kevin Svetlitski <[email protected]>
10693ee
to
d61a5c3
Compare
Signed-off-by: Kevin Svetlitski <[email protected]>
cadd964
to
b674d51
Compare
Signed-off-by: Kevin Svetlitski <[email protected]>
3108389
to
43e7a79
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looked at the thread API changes now, just a few minor things.
See new PR #140 |
8da787a
to
55a282a
Compare
Now that #140 is merged, I think this is ready other than the last few comments I left. Please rebase and reorganize the commits for merging, then you can mark this as ready. |
ffb97e8
to
7d6d20c
Compare
7d6d20c
to
413aea7
Compare
The majority of test cases already inherited from drgn's TestCase class. The few outliers that inherited directly from unittest.TestCase have been brought in line with the other tests. Signed-off-by: Kevin Svetlitski <[email protected]>
7852e96
to
c04889b
Compare
…celeration Disabling SMP is necessary to work around a bug in QEMU's handling of the capture kernel, but makes the tests run much slower. However, this bug only appears to manifest when KVM acceleration is disabled, so the testing harness has been modified to only disable SMP when this is true. [Omar: use an environment variable instead of touching a file] Signed-off-by: Omar Sandoval <[email protected]> Signed-off-by: Kevin Svetlitski <[email protected]>
This reverts commit 2b47583. After Kevin had completed this, we realized that there is a simpler method for iterating through tasks from libdrgn, which the next commit will implement. Revert the translation, but keep the improved tests.helpers.linux.test_pid.TestPid.test_for_each_task. Signed-off-by: Omar Sandoval <[email protected]>
The thread API needs a way to iterate over all task_structs in the kernel. Previously, we translated the existing for_each_task helper, which supports iterating through specific PID namespaces by walking through the PID radix tree or PID hashtable. However, we don't need specific namespaces for the thread API, so we can instead use the much simpler linked lists of thread groups and threads. Signed-off-by: Kevin Svetlitski <[email protected]>
c04889b
to
9710b6e
Compare
I did a last pass for a few things:
Please look it over and make sure I didn't break anything. Once the tests pass and you take a look, I'll merge this. Thanks so much, this feature is going to be huge! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One or two minor correctness oversights, but otherwise looks good
Previously, drgn had no way to represent a thread – retrieving a stack trace (the only extant thread-specific operation) was achieved by requiring the user to directly provide a tid. This commit introduces the scaffolding for the design outlined in issue osandov#92, and implements the corresponding methods for userspace core dumps, the live Linux kernel, and Linux kernel core dumps. Future work will build on top of this commit to support live userspace processes. Signed-off-by: Kevin Svetlitski <[email protected]>
9710b6e
to
8c93492
Compare
Merged! |
PR osandov#129 introduced the Threads API to drgn, but did not include support for live userspace processes. This commit changes that, both adding support for the existing Threads API, as well as extending it with a few additional methods which only make sense in the context of a live process, most notably `Thread.pause()` and `Thread.resume()` At present, only x86 is supported, but the plan is to support other architectures in the near future. Signed-off-by: Kevin Svetlitski <[email protected]>
PR osandov#129 introduced the Threads API to drgn, but did not include support for live userspace processes. This commit changes that, both adding support for the existing Threads API, as well as extending it with a few additional methods which only make sense in the context of a live process, most notably `Thread.pause()` and `Thread.resume()` At present, only x86 is supported, but the plan is to support other architectures in the near future. Signed-off-by: Kevin Svetlitski <[email protected]>
This PR, once finished, will close #92. It is currently in draft mode as it is not yet finished. At present, the scaffolding has been set up following the design outlined in #92, and has been fully implemented for the case of debugging userspace coredumps.