Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add print capture variables for pblock #242

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

Open
dhcdht wants to merge 4 commits into facebook:main
base: main
Choose a base branch
Loading
from dhcdht:printBlock

Conversation

@dhcdht
Copy link

@dhcdht dhcdht commented Apr 24, 2018

before:
Imp: 0x10a451d40 Signature: void ^();

after:
Imp: 0x10a451d40 Signature: void ^() Variables : {
<ViewController: 0x7fdd9b204060>
<AppDelegate: 0x60c00002acc0>
};

董宏昌 added 2 commits April 23, 2018 13:36
before:
Imp: 0x10a451d40 Signature: void ^();
after:
Imp: 0x10a451d40 Signature: void ^() Variables : {
<ViewController: 0x7fdd9b204060>
<AppDelegate: 0x60c00002acc0>
};
Copy link
Contributor

@kastiglione kastiglione left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is a nice addition. I have some questions.

NSMutableDictionary *dict = (id)[NSMutableDictionary dictionary];
[dict setObject:(id)[NSNumber numberWithLong:(long)real.invoke] forKey:@"invoke"];
[dict setValue:(id)[NSNumber numberWithLong:(long)real.invoke] forKey:@"invoke"];
Copy link
Contributor

@kastiglione kastiglione May 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the change to setValue:forKey:?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That can fix #198 . There is another MR that can fix it separately

#241

I guess because function declaration of setValue:forKey doesn't need id , just id

json.update(variables_json)

variablesStrs = []
for i in range(10):
Copy link
Contributor

@kastiglione kastiglione May 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why up to 10?

print 'Imp: ' + hex(json['invoke']) + ' Signature: ' + sigStr
print 'Imp: ' + hex(json['invoke']) + ' Signature: ' + sigStr + ' Variables : {\n'+variablesStr+'\n};'

def getBlockVariables(self, block, min_var_count=1, max_var_count=20):
Copy link
Contributor

@kastiglione kastiglione May 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain min_var_count and max_var_count? I'm not clear on their purpose.

Copy link
Author

dhcdht commented May 22, 2018

@kastiglione
hi, I have added some comments for max_var_count.
max_var_count is the number of placeholders for the variables captured by the block.

the related code

#define BLOCK_VARIABLES_COUNT ($variables_count)
struct Block_literal_1 {
 ...
 // imported variables
 Class *variables[BLOCK_VARIABLES_COUNT];
}

Copy link

I think this is super useful! Is this something that is still in progress? If not, I'd be happy to take a stab at the implementation myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

@kastiglione kastiglione kastiglione left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /