[HN Gopher] Simulating Slices of iOS Apps
       ___________________________________________________________________
        
       Simulating Slices of iOS Apps
        
       Author : codyd51
       Score  : 22 points
       Date   : 2024-01-15 17:57 UTC (5 hours ago)
        
 (HTM) web link (axleos.com)
 (TXT) w3m dump (axleos.com)
        
       | codyd51 wrote:
       | Hi everyone! This post is a writeup of some curiosities from the
       | course of developing an iOS app simulator from scratch.
       | 
       | Like with any simulator, it was immensely gratifying watching
       | third-party code run in an entirely controlled virtual
       | environment!
       | 
       | This project also got me very familiar with some unintuitive
       | AArch64 addressing rules, and taught me the internals of how
       | funny Objective-C constructors that accept variadic arguments
       | lists are handled.
       | 
       | In one late-night push, I managed to get the real CoreFoundation
       | library dynamically loaded and running, which meant that the real
       | standard library was able to create bona-fide Objective-C
       | objects!
       | 
       | This post also goes into some fun bugs I created for myself, such
       | as the simulator skipping over undefined functions resulting in
       | an infinite loop when simulated code tried to abort(). I hope
       | it's fun to follow along with, and thanks for reading!
        
         | solarexplorer wrote:
         | Very nice! Thanks for sharing! Getting to the point where you
         | can run other people's code is a great achievement!
         | 
         | I have one question: Did you really implement this in Python?
         | Why not C++ or Rust?
        
           | codyd51 wrote:
           | Thank you very much!
           | 
           | Yes, this was all in Python. This simulator was a bit unique
           | in that there was no live user interaction, and therefore no
           | realtime required. Overall, performance wasn't too much of a
           | concern.
           | 
           | More particularly, I built this on top of strongarm, a Mach-O
           | analysis library I had already written in Python. My employer
           | encouraged us to write things in Python so that there was
           | lower cognitive overhead for people to see each other's
           | projects. This was more of an off-time passion project, but I
           | still took the advice.
        
       | m3kw9 wrote:
       | I'm not seeing how you are simulating iOS apps without running
       | the actual OS
        
       ___________________________________________________________________
       (page generated 2024-01-15 23:01 UTC)