This is from a long lost track. I used to deal with object files in my previous job. That was like ages ago. Is VCS still compiling the design into object files to run simulation? Anyway, thanks to Synopsys team that helped me a lot in improving my debugging skills. :)
Some simple steps to create a "test case" here. Let's create a "Hello world!" object file.
#include <stdio.h>
void main() {
printf("Hello world!\n");
}
Compile into object file.
gcc <source code file name> -o <object file name>
To enable debug mode, compile with -g option. With debug mode, you can set break point when running the program in gdb.
OK, back to the story.
These are a few commands that they taught me to investigate about the object files.
To get the list of the functions in the object file.
strings <object file>
This one is not obvious in my test case. The strings command actually listed all the strings in the object file. Anyway, it was handy during the debug then.
To list the dependencies and its gcc versions of the object file.
ldd <object file>
To list the symbols and its allocated memory of the object file. I added the format option for better readability on thhe output. :P
nm --format sysv <object file>
Then, I googled and tried one command. This command seems it will "decode" the object files into assembly language! My favourite language during Uni-time. :D
objdump -d <object file>
This is too long to include full result. I am putting a small partial of it here. :)
No comments:
Post a Comment