In this week, I was studying a part of the code trying to figure out a way to connect the code with the schematic. I do not just want to type my code. I first need to understand how it works, then, I will try to figure out a technique to fulfil this task and type the code nicely. Before we start, we need to think how can we manipulate the schematic and make changes to it. The previous week, I was able to trigger some wires ON and OFF using their “id”s. That is why we need first to know the id of the exact object we need to communicate with on the schematic side. On the other side of the IDE, we can only get the variable name, the address and the variable type. However, we do not know which variable name goes with which type. If we do, that means the problem is solved because the object id on the schematic side consists of the variable data type + the variable name. In other words, one way to connect the code with schematic is to read the addresses of all lines of code. If the addresses contain information that is related to the objects on the schematic side, we combine the data type with the variable name and we send them along with data to be sent or read to the schematic side. There are many tools that can inquire information from the symbol table which contains the symbols (names of variables, functions and types) defined in your program. Examples of these tools are gdb, nm and readelf.
First, GDB…
to run gdb, you type in the terminal: gdb <file to be read>
after that, you can use the gdb commands. I will talk about some of the commands that I have used.
info address symbol
Describe where the data for the symbol is stored.
info symbol address
Describe what the symbol name of data stored in this address.
whatis exp
Print the data type of expression exp.
ptype typename
Print a description of data type typename.
Second, readelf..
to inquire information of the symbol table, you type: readelf –syms <file to be read>
Third, nm..
to inquire information on the symbol table using “nm”, you type: nm <file to be read>
However, I could not figure out a way to know which variable type goes with which variable, which is important as I have just mentioned earlier. That is why I have decided to send dummy data for the moment so that I can work on the technique of getting the code and schematic to communicate, and that is what I will be working on next week. When we are sure that the technique works, we go back to the problem of addresses. This way is good – I mean ignoring the addresses issue – because it helps us focus on the main goal which is to develop a technique of getting the code and schematic to communicate.
0 Comments