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.
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
volshell: change dt() output to show where pointers lead #1028
base: develop
Are you sure you want to change the base?
volshell: change dt() output to show where pointers lead #1028
Changes from 5 commits
9c1b04f
33dd0e2
d5e0dec
43c02b0
f360a66
2155b7d
f1a1d5e
87522fc
8d24d95
c947323
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
might be better to use isinstance than equality? It's interesting this is a different test than the
isinstance
below used fordisplay_type
They should probably match to avoid weird discrepancies! 5:PThere 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.
They should all get a
type_name
, but then you're having to do string comparisons (although pointer should be a built-in type, so the name shouldn't change?). Happy with either route...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.
Not sure this is a good way of telling a
struct
from apointer
? Can't immediately think of how to do it, but I think there is a single overarchingstruct
type that covers the 3 different children, probably better to isinstance that?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.
Great question - I'll dig into it.
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've been exploring this issue and found that when dealing with actual objects or types with offsets, checking if it's an instance of
objects.AggregateType
works really well. 👍However, I ran into difficulties when working with templates, such as when executing
dt('task_struct')
without any offsets. Both cases appear as ObjectTemplate types, making it challenging to distinguish between them with type checks:I found
.vol.object_class
promising for getting the types:However,
.vol.object_class
ends up asabc.ABCMeta
, makingisinstance
checks infeasible as far as I understand. Which is kind of understandable since they're not actual instances.I've looked for solutions and found some discussions like this one on StackOverflow, but I'm still uncertain about the best approach.
It might be possible to adjust the templates to facilitate
isinstance
checks, but it's currently beyond my expertise. 😕 For now, I've resorted to usinghasattr
to differentiate between types, though it feels like a workaround:I'm open to suggestions or guidance on how to approach this more effectively. 🙃 Let me know if you have any good ideas!