I'm building an application on windows using the python api. I need to be able to access a code symbols instructions but when I launch the process the symbol has no instructions. I can manually read the symbols address space but the symbol also has no end_addr set which makes it difficult to tell where the symbol ends .
Can anybody help me to find out how to generate the instructions when the process is loaded ?
It sounds like the symbols in the symbol table don't have valid sizes when they really should. What kind of executable are you debugging? A PECOFF file? If so, you should take a look at and fix the code in:
What we do for mach-o is to parse the symbol table first and then run back through all symbols, and any symbol that have a size of zero, set their sizes to the delta between the current symbol and the next addressed symbol. Since the symbols are usually out of order address wise, we run through all symbols that have addresses and add their indexes to a std::vector, then sort the vector of address indexes, and then we can do the above fixups.
Ok I see what you're saying. I was trying to use the next symbol address as a delimeter but I realised they were not in order. It is a PECOFF binary that I'm debugging so I will take a look at the code suggested below.