When I was trying to simulate the codes line by line, I found out that the logging file for GDB does not contain the information I was expecting. At first, I suspected that there were some mistakes in the source code. However, after testing and understanding the code, I knew I made the wrong assumption. Apparently, things went wrong when I run the GDB. I forgot to add the debugging information to the ELF file I’ve generated. Hence the debugger could not tell exactly where a specific line of code starts and ends.
Dr Shawn also pointed out the cons of doing a double encoding. I learnt a lot from that because I did not consider the efficiency of my codes when I wrote them. After listening to his advice, I changed my code to encode the binaries with Base64 only.