Skip to content
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

[pinternals] -a option added #172

Merged
merged 2 commits into from
Nov 25, 2016

Conversation

dmpv
Copy link
Contributor

@dmpv dmpv commented Oct 2, 2016

pinternals command shows object description in less human-readable form than private Apple method _ivarDescription. This change keeps the default behaviour of the command, but adds an -a (--apple) option to print internals in the Apple way.

(lldb) pint -a $foo
<Foo: 0x170048940>:
in Foo:
    _view (UIView*): <UIView: 0x100204830>
    _layer (CALayer*): <CALayer: 0x170026ca0>
in Bar:
    _array (NSArray*): <__NSArrayI: 0x170024480>
    _dictionary (NSDictionary*): <__NSDictionaryI: 0x17007c900>
in NSObject:
    isa (Class): Foo (isa, 0x1a10001a245)

versus

(lldb) pint $foo
(Foo) $25 = {
  Bar = {
    _array = 0x0000000170024480 @"2 elements"
    _dictionary = 0x000000017007c900 2 key/value pairs
  }
  _view = 0x0000000100204830
  _layer = 0x0000000170026ca0
}


command = 'p *(({} *)((id){}))'.format(objectClass, object)
if options.appleWay:
command = 'po [{} _ivarDescription]'.format(object)
Copy link
Contributor

Choose a reason for hiding this comment

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

Elsewhere in chisel, there's a check that a given private method exists before calling. Would you be willing to add a respondsToSelector: check here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Updated the request.

@kastiglione
Copy link
Contributor

Thanks for this! Just one comment.

@kastiglione
Copy link
Contributor

Thanks!

@kastiglione kastiglione merged commit bbfac3e into facebook:master Nov 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants