Comments (5)
Some testing suggests that you can't add a symbolic breakpoint in this way.
from happydebugging.
One alternative is to breakpoint in the parent, check the type of class of the current instance in the condition of the breakpoint, and then print the frame using memory read --format f --size 8 --count 4 $rsp
.
Alternatives I tried were: executing __asm__("int3")
inside of the class_addMethod
implementation. But that won't work since its assembly.
I also tried adding a symbolic breakpoint to a dummy method using the following, and it failed to resolve it:
e (BOOL)class_addMethod([MyView class], @selector(setFrame:), (IMP)imp_implementationWithBlock(^(id self, CGRect frame) { (void)NSLog(@"test"); }), "v@{CGRect={CGPoint=dd}{CGSize=dd}}")
break set -F '-[MyView setFrame:]' -L objc
Note: I couldn't seem to get the implementation to work by casting a function, so I used imp_implementationWithBlock()
. Perhaps it could be done if the actual function exists? But it seems unlikely. The problem seems to be the symbol isn't there for the symbolic breakpoint even though we add an implementation at runtime.
from happydebugging.
The biggest downside would be handling all of the different calling conventions. Above was working with x86_64.
Using this website, I was using: https://www.raywenderlich.com/615-assembly-register-calling-convention-tutorial
First Argument: RDI
Second Argument: RSI
Third Argument: RDX
Fourth Argument: RCX
Fifth Argument: R8
Sixth Argument: R9
Meaning $rdi
would be self
and (SEL)$rsi
would be _cmd
.
from happydebugging.
Another useful reference for calling conventions: https://github.com/stephanemoore/archives/blob/master/general/calling-conventions.md
i386: https://wiki.osdev.org/Calling_Conventions#Cheat_Sheets
from happydebugging.
Architecture can be inferred from GetSelectedTarget
or target list
.
64-bit simulator = x86_64
32-bit simulator = i386
64-bit device = arm64
32-bit device = arm7
https://docs.elementscompiler.com/Platforms/Cocoa/CpuArchitectures/
from happydebugging.
Related Issues (18)
- Error when using `ivars` command. HOT 3
- Recursively print superclass ivars for `ivars` commands.
- Allow `ivars` command to take Class objects (or strings with class names?)
- Add a command to fake a low memory warning (even on device).
- Add a command to highlight a given element on screen.
- [Bug] pcolor truncates floats to ints
- Add command for UIView -isHiddenOrHasHiddenAncestor
- Update python scripts to be fully python3 compliant.
- Screenshot command fails in modern Xcode HOT 1
- Update the `result.Print()` statements to include a newline. HOT 1
- Add a command to list all commands via the LLDB command interface. HOT 2
- Error in `pframe` command. HOT 2
- [Request] Add comment to print UIColor as hex code + easy to read RGBA values. HOT 1
- Add support for Accessibility Debugging HOT 14
- Add tests for `screenshot` and `png` command.
- Screenshot command fails on device
- Print out values for primitives in `ivars` command. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from happydebugging.