-
Notifications
You must be signed in to change notification settings - Fork 23
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
Devel/rbtree #39
Devel/rbtree #39
Conversation
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.
There are a few nits, comments inline, but also (as you mentioned on IRC) since this is intended to be part of the API, we need documentation for it. We also need test cases. If you can come up with simple cases like those in tests/test_list.py, that would be helpful. Test cases that work with common in-kernel rbtrees would also be helpful to ensure that it still works correctly when the kernel is updated.
Finally, outside of the .gitignore changes, this should all be a single commit.
Thanks,
-Jeff
crash/types/rbtree.py
Outdated
if root.type == types.rb_root_type.pointer(): | ||
root = root.dereference() | ||
elif root.type != types.rb_root_type: | ||
raise ArgumentTypeError('root', root, types.rb_root_type) |
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.
This should be UnexpectedGDBTypeError now.
crash/types/rbtree.py
Outdated
|
||
def rbtree_postorder_for_each(root: gdb.Value) -> Iterable[gdb.Value]: | ||
if not isinstance(root, gdb.Value): | ||
raise InvalidArgumentError("root must be gdb.Value representing 'struct rb_root' or 'struct rb_root *' not {}" |
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.
This should be ArgumentTypeError now
No ready yet (only backing up the branch), will rebase later. |
Force pushed a new version:
Also, I noticed that similar API for linked list traversing says in the docs:
However, the returned gdb.Value is of type |
Signed-off-by: Michal Koutný <mkoutny@suse.com>
Add functions for traversing generic RB tree structures and accompanying tests (both for correctness and applicability to real kernel dumps). Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Michal Koutný <mkoutny@suse.com>
We honor the principle of accepting both pointer to or object itself on input and giving out the object on output. The list iterator implementation returns the pointer (contradicting docs). Switch to the object type for consistency with other APIs (e.g. list_for_each_entry). Signed-off-by: Michal Koutný <mkoutny@suse.com>
I've rebased the branch on the current master (resolved trouble with gdb update from 8.3 to 9.1) and added one more commit to rectify the type situation as laid out in my previous comment. |
No description provided.