-
Notifications
You must be signed in to change notification settings - Fork 803
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
Add two commands pproperties, pblock #133
Conversation
the -n option to take the argument as a class name
# Conflicts: # commands/FBClassDump.py
Thank you. I'm hoping to review this before the end of the week. |
@longv2go What do you think of looking up the symbol that corresponds to the block's |
@kastiglione The pblock just show the invoke function`s address, and I do not know which lldb api can do that. I can go deep with the block struct to find out if I can print the objects that the block captures. |
I'm also not sure which part of the lldb api we're looking for, but worst case scenario we could call The two suggestions were just for discussion, they actually came up today when I was showing chisel to someone. They asked about inspecting blocks and I remembered this pull request (sorry). If adding symbol lookup isn't much work, which I hope is the case, then I think it's a no brainer to add. However I suspect getting the captured objects is more work and I also don't think it's as valuable as the symbol lookup. Those are my thoughts. thanks! |
tmpString = """ | ||
NSMutableArray *result = (id)[NSMutableArray array]; | ||
unsigned int count; | ||
objc_property_t *props = (objc_property_t *)class_copyPropertyList((Class)$cls, &count); |
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.
props
does not ever get free
d.
@kastiglione I remove the "free()" because it would cause evaluateExpressionValue to raise exception some time on real device. I do not know the reason. I guess it`s a lldb bug. |
@kastiglione The block struct is dynamically generated by the compiler. The captured objects and other objects the block referenced are all attached to that struct, such as
The http://clang.llvm.org/docs/Block-ABI-Apple.html#importing-attribute-nsobject-variables |
Thanks @longv2go. I'll give this another review today or tomorrow. |
@longv2go Do you have any more details on this? I guess it doesn't matter if a bit of memory leaks in debugging, but if it is an lldb bug, we might want to report it or track it if it's known. |
@kastiglione When I add the
and the |
Thanks. Would you mind putting that into a gist, and adding a comment with a link where the |
@kastiglione I create a new repo. I find a way to print all objects of a block using fishhook. Because the evaluateExpression function can not define a c function, I could`t implement chisel command to print those objects. Please refer https://github.com/longv2go/BlockInspector |
@longv2go Does your new repo supersede this pull request? Should I still consider merging this, or should people instead use your BlockInspector? |
@kastiglione the repo BlockInspector is written in Objective-C, It can not implement as a chisel command. |
@longv2go Understood. Would you like to continue with this pull request? Or do you plan to use BlockInspector instead? |
@kastiglione continue this pull request. |
Thanks again! |
pproperties can print the properties of an instance of Class.
pblock can print the implementation address and signature of a block.