Open smilingthax opened 8 years ago
Most likely! May I ask you to file a PR for this?
BTW, I've just finished a decoder for the function_starts section (uleb128 encoded delta values) ... I could create a pull requst for that, if you want?
Of course!
Hmm, now github shows both commits -- the typo and the function_starts decoder -- in my pull-request... I probably would have to create two separate feature branches?
The function_starts addresses are actually relative to the first "non-null" segment's vmaddr (i.e. __TEXT ?), the "base address". I don't have easy access to that information in the current codebase... There are multiple ways this could be dealt with:
1) The user has to add the offset himself, macho only returns relative address, or:
2) store base address in "this" (the Parser instance) during parseSegmentCmd()
-- but this would be problematic when some strange(legal?) mach-o files actually puts a function_starts cmd before the segment cmds, or:
3) fix up the addresses in a second pass in Parser.execute
? It would actually be nice to have some method/mapping from type (or even: segment name) to the corresponding command object; currently one has to iterate over the full cmds array for such (useful) queries.
https://github.com/indutny/macho/blob/master/lib/macho/parser.js#L75