LLDB
LLDB copied to clipboard
ivars not working.
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
Oh,it's on Mac OS.
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;
};
....
I also ran a (lldb) cpo @import ObjectiveC
before this example to fix LLDBs module headers, a problem that is constantly changing for every LLDB release
that is great. Thanks @DerekSelander . I haven't see the cpo
command before. gulp!