Parser for 32-bit and 64-bit Mach-O binary/executable formats in C++ [closed]
Asked Answered
E

4

5

I'm looking for a C++ library that can parse 32-bit and 64-bit Mach-O binary format. I don't need anything fancy, just a disassembly and splitting the file into its sections, so no decompilation, name demangling and so on.

I know I can either rip open any existing disassembler or craft my own binary parsers using the format specification from Apple, but I was kind of hoping not having to go that far, especially if someone else has done the work for me.

Many thanks!

Eatables answered 22/11, 2009 at 8:54 Comment(0)
E
5

You can start with the open-source class-dump tool (http://www.codethecode.com/projects/class-dump/). It can read both 32 and 64 bits Mach-o binaries, and is known to have a decent parser.

Examination answered 1/12, 2009 at 14:27 Comment(0)
S
5

Try playing around with the command-line tool otool; it sounds like it does what you want. You could call it from C code with system(), etc.

Smog answered 1/12, 2009 at 18:51 Comment(0)
P
2

Try this: MachOView It is still in developing stage, but hopefully becomes a powerful tool soon.

Pitanga answered 23/7, 2010 at 18:4 Comment(0)
Q
0

Get the Darwin (Mac OS X kernel) source code, I guarantee somewhere in there they've got a parser for Mach-O binaries.

Quintain answered 22/11, 2009 at 9:50 Comment(1)
It'd be better to read the source to the disassembler. opensource.apple.com/source/cctools/cctools-750/otool Not quite a library, though.Hone

© 2022 - 2024 — McMap. All rights reserved.