I mentioned a way which I used to grab the entry address of BB in previous email for Andrew. As I said, there is a limitation. And I am not sure it can be used for other cases.
For my research code compression, my final goal is to improve the performance and keep code size as small as possible.
Now, for the first step I want to code a program which can load and run elf binary code. Here, I want to load binary code by BBs. Initially the program will load the first BB in binary code ( entrance BB) and excute the instructions in BB. Once the program hit the instruct which need jump or enter another BB, it will load the mapped BB from binary code. And keep doing it.
I will create a table which record the entry address for each BB. Once the BB has been loaded by pervious instruction, I don’t need load it again.
That is why I want to grab the entry address of each BB.
Actually, I tried to use API ptrace to implement the program I mentioned. It means I can set breakpionts at each entry of BB, once the program hits the break point, I can use ptrace to load the next BB to memory. However, I haven’t done it by using ptrace. The reason is that I don’t know how complex process ptrace did. So I really want to write some assemble code or C to do it if I can.
If I can finish the first step, I will find some optimization method based on BB to improve the performance. And then …
Is it clear for my project?