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 pivars command to FBClassDump.py #173

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
longv2go wants to merge 5 commits into facebook:main
base: main
Choose a base branch
Loading
from longv2go:print_ivar

Conversation

@longv2go
Copy link
Contributor

@longv2go longv2go commented Nov 8, 2016

pivars command call the class_copyIvarList to get all ivars of an Class and print them out. It would show the offset, type, name and value if need.

(lldb) pivars -r -n child
NSObject:
 [0x0] Class isa
father:
 [0x4] NSString * father_var
 [0x8] NSString * faterh_var2
child:
 [0xc] {teststr="a"i"b"l} straaa
 [0x14] NSString * c_var1
 [0x18] NSString * _c_var2

Copy link
Contributor

Thanks, and sorry for the late reply. This looks good, but I'm also wondering if we should consolidate pinternals and pivar? Should we discuss that now, or leave that for another time.

Copy link
Contributor Author

@kastiglione I notice that too. pinternals can not show the ivar`s offset, so I wrote this command. Sometimes I need the offset to inspect the object`s memory layout, and pivar need the ivar`s name, no name no working.

kastiglione reacted with thumbs up emoji

Copy link
Contributor

Related, a command I came across last week is:

language objc class-table dump -v <regular-expression>

This prints ivars and their offsets, but it also prints methods too, which adds noise if you just want structure information.

Copy link
Contributor Author

@kastiglione I think we should to merge the pivars, pmethods, pproperties to one command.

class-dump <options> <arg>

if the arg is an instance of some class, it can show the ivar`s value of that instance. But there is more work to decode the struct infomation.

Copy link
Contributor

@longv2go I'm following up on outstanding pull requests. Sorry for the long silence. Note that since this time, a -a flag was added to pinternals which calls the debugging helper _ivarDescription.

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

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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