-
Notifications
You must be signed in to change notification settings - Fork 78
Add a function to print object info from the space for debugging #1269
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6f85255
Add a no_mangle function that prints object info from the space
qinsoon f9b5c3f
Merge branch 'master' into debug-print-object-info
qinsoon 19e0f74
Update doc. Fix style check
qinsoon 273dc7d
Merge branch 'master' into debug-print-object-info
qinsoon cf2fe9f
Print one line at a time. Check if the object reference might be valid.
qinsoon c2d2788
Minor refactoring based on the reviews
qinsoon a9cbf4e
Minor fix
qinsoon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
docs/userguide/src/portingguide/debugging/print_obj_info.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Print MMTk Object Information | ||
|
||
MMTk provides a utility function to print object information for debugging, `crate::mmtk::mmtk_debug_print_object`. | ||
The function is marked as `#[no_mangle]`, making it suitable to be used in a debugger. | ||
|
||
The following example shows how to use the function to print MMTk's object metadata before and after a single GC in `rr`. | ||
|
||
Set up break points before and after a GC. | ||
|
||
```console | ||
(rr) b stop_all_mutators | ||
Breakpoint 1 at 0x767cba8f74e8 (14 locations) | ||
(rr) b resume_mutators | ||
Breakpoint 2 at 0x767cba8f8908 | ||
``` | ||
|
||
When the program stops, call `mmtk_debug_print_object`. We might need to | ||
set the language context in the debugger to `C` when we stop in a Rust frame. | ||
Then call `mmtk_debug_print_object` with the interested object. | ||
|
||
```console | ||
(rr) set language c | ||
(rr) call mmtk_debug_print_object_info(0x200fffed9f0) | ||
In immix: | ||
marked = false | ||
line marked = false | ||
block state = Unmarked | ||
forwarding bits = 0, forwarding pointer = None | ||
vo bit = true | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/vm/tests/mock_tests/mock_test_debug_get_object_info.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// GITHUB-CI: MMTK_PLAN=all | ||
|
||
use super::mock_test_prelude::*; | ||
|
||
#[test] | ||
pub fn debug_print_object_info() { | ||
with_mockvm( | ||
default_setup, | ||
|| { | ||
let fixture = SingleObject::create(); | ||
crate::mmtk::mmtk_debug_print_object(fixture.objref); | ||
}, | ||
no_cleanup, | ||
) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.