Disassemble Mach-O to GAS (AT&T)

Discussion in 'Mac Programming' started by GRMrGecko, Feb 27, 2010.

  1. GRMrGecko macrumors member

    GRMrGecko

    Joined:
    Jun 7, 2008
    Location:
    Nowhere and everywhere
    #1
    Hello, I'm trying to find a disassembler for Mach-O mac Binary file, I can't really find one that works the way I expect it. The one I found to be the closest is objconv at http://www.agner.org/optimize/ but it's syntax output isn't correct for GAS or also know as AT&T. The sections that come from C, such as cstring, causes a problem since the gnu assembler doesn't know about it. When I get the raw code from gcc, it works fine. Reason I'm asking is because I'm trying to learn Assembly and it'll be nice to have something that outputs right code from a Mach-O binary.

    Thanks for any tips,
    Mr. Gecko
     
  2. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #2
    I wouldn't bother trying to learn by disassembling things.

    Your best bet is just to compile C code with -S flag for gcc which will output assembly from the C rather than a binary.
     
  3. autorelease macrumors regular

    Joined:
    Oct 13, 2008
    Location:
    Achewood, CA
    #3
    otool is the name of the disassembler in Mac OS X. It works similar to GNU's objdump (but for Mach-O binaries instead of ELF.) Read the man page.
     
  4. GRMrGecko thread starter macrumors member

    GRMrGecko

    Joined:
    Jun 7, 2008
    Location:
    Nowhere and everywhere
    #4
    Objdump supports Mach-O binaries, I'm using it now to help me in making this assembly code all right. I also know of OTX and am using it as well. No I'm not using this to steal apps, using it for educational reasons and finding out how hard it'll be to crack my own app that I have source code to and all of that. I don't want to use GCC -S to do this.
     

Share This Page