digitalmars.D.learn - Accessing the symbol table of a mach-o file
- Jacob Carlborg (27/27) Feb 24 2010 I'm trying to access the symbol table of a mach-o file. I've managed to
I'm trying to access the symbol table of a mach-o file. I've managed to access the symbol table but I have two problems: 1. It seems I can't access the whole symbol table if I compare my output to the output of nm. For example, I have a global struct in the file I'm examining which doesn't show up in my output. I have a global class that does show up but not the methods in the class. 2. When I'm printing the string representation (accessed from the string table) of some of the symbols they don't seem to be complete. For example "inte" instead of "internal". Then the next symbol I print is the rest of the previous symbol. This is the code I have so far, in some kind of pseudo code format: header = the header of the mach-o file cmd = cast(load_command*) (cast(byte*) header + size of header) loop (number of load commands) { cmd = cast(type of command) (cast(byte*) cmd + size of command) if (cmd == symbol table command) break } symbolTable = cast(nlist*) (cast(byte*) header + symbol table offset) stringTable = cast(char*) (cast(byte*) header + string table offset) foreach (entry in symbolTable) { symbol = stringTable + string table index print symbol } Does anyone have any idea what I can do about the above two problems?
Feb 24 2010