mrhappyasthma / happydebugging Goto Github PK
View Code? Open in Web Editor NEWA collection of LLDB macros to make debugging in Xcode a bit more enjoyable.
License: MIT License
A collection of LLDB macros to make debugging in Xcode a bit more enjoyable.
License: MIT License
Right now the script won't print out the values of primitives. This would be a great addition.
E.g.
Current:
(bool) _someBool,
(int) _someInt
Desired:
(bool) _someBool -> YES,
(int) _someInt -> 10,
Ideally something like ivars UIView
or ivars [UIView class]
should be allowed. It won't be able to print out the values of each ivar for a given instance, but it could still pretty-print the ivar list.
Pretty self explanatory, but to make the scripts more testable I was using SBResult Print()
, which does not append a newline to the end of the command (where as the python print
did).
Therefore you get in the scenario where:
Some command output goes here(lldb): // The output runs into the console input.
A common debugging flow I have is to override setFrame:
in my custom subview and set a conditional breakpoint on some rogue frame value.
It's possible to add this override at runtime via: https://developer.apple.com/documentation/objectivec/1418901-class_addmethod?language=objc
Function would need to be something like:
void SetFrame(id self, SEL _cmd, CGRect frame) {
struct objc_super mySuper = {
.receiver = self,
.super_class = [self superclass],
};
objc_msgSendSuper(&mySuper, _cmd, frame);
}
(Note: we would need to call sell.)
It is theoretically possible (hopefully) to set a symbolic breakpoint on that method after this happens.
Can probably just implement something along the lines of this, where we print out each component in an easy to read format: http://www.stackoverflow.com/questions/26341008
This could be faked using something like:
expr (void)[[UIApplication sharedApplication] performSelector:@selector(_performMemoryWarning)];
or
with delay:
expr (void)[[UIApplication sharedApplication] performSelector:@selector(_performMemoryWarning) withObject:nil afterDelay:1.0]
There's a private protocol on NSObject with tools for printing out accessibility elements.
// Prints a recursive tree of accessibility elements
There's also _accessibilityTreeAsStringWithOptions:, but it's unclear what options it takes.
https://github.com/nst/iOS-Runtime-Headers/blob/master/lib/libobjc.A.dylib/NSObject.h#L1826
Some others:
// Prints the traits for the given parameter
// Prints the traits of the current object.
// Adds a trait to the current object.
// Prints out the accessibility ancestry of this object.
It creates a path to the local device's folder structure so the path cannot be opened from your mac using open
.
Not sure this can easily be fixed.
Self explanatory, the scripts were written in python2 and now violate some python3 syntax changes.
Both the RGB and hex values are truncating floats. Really we should round them.
For some reason, I am seeing "error: error: cannot initialize a parameter of type 'id _Nonnull const __unsafe_unretained' with an rvalue of type 'NSString *'" in some cases.
I need to investigate the root cause.
Both of these commands save a .png
file as part of their output, so we need some way to assert that these actually save the right data into the png.
We could try just comparing the result byte-by-byte with the expected data.
This could either do something like outline it in red, or display a gradient over it temporarily to gain the users attention.
I've been using the screenshot
command for this, but it might be nice to have it shown to you on the simulator live.
This is a private API that can be useful for debugging.
Traceback (most recent call last):
File "/google/src/files/186825105/depot/google3/third_party/HappyDebugging/scripts/pframe.py", line 16, in pframe
if temp_result.GetOutput().strip() == 'NO':
AttributeError: 'NoneType' object has no attribute 'strip'
This might become too spammy, so perhaps this should be optional or another command?
The class_copyIvarList
docs mention explicitly "Any instance variables declared by superclasses are not included."
But this could be done with something like:
id object = <instance>;
while ([object != nil) {
// Print out ivars and the name of the current class.
// Print out newline.
object = [object superclass];
}
[Snapshotting] View (0x15b8b3e00, UICollectionView) drawing with afterScreenUpdates:YES inside CoreAnimation commit is not supported.
The README has the list of commands, but it would be useful if there was a command to list all commands.
E.g.
listcommands
pvc - Print view controller hierarchy
> pv - Print view hierarchy
... Etc.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.