Recently, I started fixing the
t command family instructions at radare2. My initial goal was to start understanding how things work without doing any coding at the beginning, but It looked like reading code as if it was the hunger game is really boring and almost useless, so I decided to start the real task side by side with the learning step.
As a first step, I decided to play around with the
t command starting with
t? to see what I have and what I am capable of at the current time.
One of the first commands that really got me interested was the
to command. I decided to start with it basically because it is a primitive command that will be used every now and then for loading mass types and for checking if I cant load them. Proceeding with the other commands will be very very difficult. But I didn’t have any idea how to check if it is doing its job correctly. I decided opening multiple random header files from Linux.
I started with
stdint.h. “Why?”, because as its name suggests, it holds many definitions regarding primitive data types. So it was a good start. Issuing
to /usr/include/stdint.h gave the following error message:
error: #error "You need a ISO C conforming compiler to use the glibc headers"
This gave me good indication about how tcc porting works in r2. It is capable of preprocessing
#include well and most likely other preprocessors like
#endif. The real problem is that it treats
#error like it was a real error and probably stopped compiling the header file because of this error. This sounds like a good start, I made the
#error(s) reported to the user, but the compilation process goes as if it was a
#warning. This did the trick and it worked perfectly.
I started running
r2r tests related to
cmd_types looking for broken tests. Since my initial goal was still learning about the code base (which I know little about), I didn’t rush. There were 4 broken tests, 1 that failed and nothing else. I didn’t know which one to start with so I started fixing them in order :). At the same time, I fixed some compiler warnings and started practicing radare2 code style. Working on them for 2-3 days as far as I remember I managed to fix 3 broken tests.