1) How to locate the start of actual instruction from the .text section and how to figure out where to stop? 2) I see that your implementation reads all PT_LOAD sections into a buffer but then how to distinguish between .text (.rodata) and .data ?