-
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 pclassmethod and pinstancemethod #113
Conversation
Merge master
merge from souce
Thanks for the pull request! Why not one command (say
|
@kastiglione Now It supply only one command 'pmethods', it take two options, if '-a' set, it would print all class methods and instance mehtods, if '-c' set, it would only print class methods, default it only print intance methods. |
👍 I will take a look tomorrow (it's the end of the night for me now) One question: What happens if you call |
@kastiglione The pmethods can take an Instance of some Class or a Class object as its argument, and It
|
thanks, will try this out today or tomorrow! |
Is there any way to know, what prevents this PR to be merged in ?:) |
return 'pmethods' | ||
|
||
def description(self): | ||
return 'Print the class instance methods.' |
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.
"Print the class and instance methods of a class."
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.
@longv2go Do you plan to update this description?
@PaulTaykalo I dropped the ball on following up on the review, apologies. |
|
||
def options(self): | ||
return [ | ||
fb.FBCommandArgument(short='-a', long='--all', arg='all', help='If display all methos include class and instance methods', default=False, boolean=True), |
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 find the combination of '-a' and '-c' to be a bit counter-intuitive. What about '-i/--instance' for instance and '-c/--class' for class and if neither is specified then it defaults to both. This ensures that there aren't any combinations that don't make sense.
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.
Good idea!
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 just add a new '-a' option to show the implementation address of the method
Hi, @fbdeveloper @kastiglione @PaulTaykalo , I change the implementation of pmethods, the CLI not changed. The last version has some issues, it run slowly when the class has many methods and it`s implementation is not so clearly. So I wrote a new method 'evaluate' in fblldbbase.py, it can evaluate a batch of Objective-C expressions and automatic transform the Objective-C object to Python object. I rewrote pmethods base on 'evaluate'. The lines of code go to down, run faster, and more clearly now. Please review this. :) |
Ah sorry, that was me, accidentally logged into an old fb dev account for a repo I was looking into. |
hahaha |
def __init__(self, json): | ||
self.name = json['name'] | ||
self.type_encoding = json['type_encoding'] | ||
self.peremeters_type = json['parameters_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.
parameters_type
Thanks for reviewing! Sorry for my poor english! |
@@ -32,6 +32,10 @@ def class_getSuperclass(klass): | |||
value = fb.evaluateExpression(command) | |||
return value | |||
|
|||
def class_isMetaClass(klass): | |||
command = '(BOOL)class_isMetaClass((Class){})'.format(klass) | |||
return fb.evaluateBooleanExpression(command) |
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.
@longv2go You don't need the (BOOL)
cast when calling evaluateBooleanExpression
.
Thanks @longv2go! |
add two commands pclassmethod and pinstancemethod
This command show the class`s methods in a pretty way.
Options:
--address/-a ; Print the implementation address of the method
--instance/-i ; Print the instance methods
--class/-c ; Print the class methods
You can get the runtime address of the method use option '-a' then do something more with that address,
such as run lldb command "dis -a " to disassemble the method.
Examples: