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

ivars not working. #14

Open
CodeLife2012 opened this issue Apr 19, 2019 · 5 comments
Open

ivars not working. #14

CodeLife2012 opened this issue Apr 19, 2019 · 5 comments

Comments

@CodeLife2012
Copy link

image

@DerekSelander
Copy link
Owner

I'll need a bit more context: Is self Swift or ObjC? Do you have the source to this program you are debugging? Is this iOS or a different platform?

ivars currently only works with iOS since it's calling a private UIKit(Core) method. MacOS doesn't have it. One day I'll rewrite it with my own, but I don't see that happening for at least a month

@CodeLife2012
Copy link
Author

Oh,it's on Mac OS.

@DerekSelander
Copy link
Owner

Ah, ok, I'll keep this open then until I've got a replacement for MacOS. In the time being you can run dclass self to obtain all the Objective-C values ivars from the class and manually jump to the interesting offsets. For example, picking on Finder:

(lldb) search NSObject -m Finder
<TWindowHistoryEntry: 0x600003c49260>

# Other results removed for brevity

# query instance for info using dclass 
(lldb) dclass 0x600003c49260

@interface TWindowHistoryEntry : NSObject
{
 {TFENodeVector="__begin_"^{TFENode}"__end_"^{TFENode}"__end_cap_"{__compressed_pair<TFENode *, std::__1::allocator<TFENode> >="__value_"^{TFENode}}} _targetPath                   ; offset 0x8, 0x18
      @"NSDictionary" _windowState                  ; offset 0x20, 0x8
      @"NSDictionary" _searchState                  ; offset 0x28, 0x8
}

@property T{TFENodeVector=^{TFENode}^{TFENode}{__compressed_pair<TFENode *, std::__1::allocator<TFENode> >=^{TFENode}}},N,V_targetPath *targetPath
@property T@"NSDictionary",&,N,V_windowState *windowState
@property T@"NSDictionary",&,N,V_searchState *searchState

 -                           .cxx_destruct  0x101f94f78
 -                                 dealloc  0x101f94f20
 -                                 isValid  0x101fa8e37
 -                              targetPath  0x101f6d4d6
 -                         setSearchState:  0x101f6d4b7
 -                          setTargetPath:  0x101f6d485
 -                             searchState  0x101f6f026
 -                          .cxx_construct  0x101f6d459
 -                             windowState  0x101fa92c4
 -                         setWindowState:  0x101f6d4a5
 +  historyEntryForTargetPath:windowState:  0x101f6d387

@end

# Let's say we are interested in the _windowState property at offset 0x20 
po *(id *)(0x600003c49260 + 0x20)
{
    BrowserViewState =     {
        IconViewScrollOrigin = "{0, 0}";
    };
    ContainerShowSidebar = 1;
    SearchViewState =     {
        EmptyStringAbortsSearch = 1;
        PropertyList = "";
        TypingScope = 9223372036854775806;
        UseTokens = 1;
    };
.... 

@DerekSelander
Copy link
Owner

I also ran a (lldb) cpo @import ObjectiveCbefore this example to fix LLDBs module headers, a problem that is constantly changing for every LLDB release

@rustymagnet3000
Copy link

that is great. Thanks @DerekSelander . I haven't see the cpo command before. gulp!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants