I'm doing a project that reorders basic blocks inside a function at runtime in C++ under 64-bit Linux. The reordering process includes updating instructions like "jmp". One problem is that if the compiler (clang++ or g++) determines the try{...} block using a range, i.e., from address1 to address2; the reordered code would have problems (some basic blocks are out of range and some new basic blocks are swapped in).

My question is: Does the compiler/program determines the try{...} block using a range? If so, or not, how can I know and modify the corresponding determinants, through which I can recover the try/throw/catch blocks and let the program execute normally; when the program has been already loaded into memory?

  • I linked to the answer which probably has the information you need. If you need some additional information after reading it, make a new question with specific issues.
    – Igor Skochinsky
    Dec 15 '14 at 12:29