3

I'm trying to figure out why NSSavePanel fails in my SwiftUI app. I tried every possible documentation, or asking on the Swift programming forums - to no avail.

I'm originally a Windows programmer, and I am also a reverse engineer. The way I can see why some API doesn't work (on Windows) is usually by stepping into it with a live debugger/disassembler. This is what I want to do with the NSSavePanel.runModal() call. But I'm kinda new to macOS.

So to test the concept, I built a simple C++ app with the Xcode (natively for ARM64 architecture, with the "release" configuration):

int main(int argc, const char * argv[])
{
    if(argc > 2)
    {
        int a = atoi(argv[1]);
        int b = atoi(argv[2]);
        int c = a / b;
        
        printf("v=%d\n", c);
    }
    
    return 0;
}

I then configured Xcode to "Debug -> Debug Workflow -> Always show disassembly" and set a bp at the start. So I get this:

enter image description here

I can somewhat step-over and -into ARM64 assembly instructions with ^F6 and ^F7 keyboard shortcuts, but the Xcode UI is not really showing values of registers (one needs to type p $register into the console) and to see memory one needs to use "Debug -> Debug Workflow -> View memory" option, which is very clunky.

In other words, Xcode is not the best for this type of low-level debugging.

So I'm wondering, if there's another live debugger/disassembler that can be used for this purpose?

3
  • 1
    Ghidra is a free disassembler/decompiler that comes with a debugger
    – mimak
    Apr 23, 2023 at 13:30
  • @mimak oh wow, it has a debugger now?
    – c00000fd
    Apr 23, 2023 at 13:43
  • yes, apparently it was introduced in v10.0
    – mimak
    Apr 23, 2023 at 13:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.