I've created a simple project in sourceforge.net. It is called Coded Debug Print and available at http://codeddebugprint.sourceforge.net. This helped me a lot when I was working on embedded systems which you get debug prints from serial port (Ex: com1) and I thought there might be some other developers, especially working on embedded systems who can get help from this project.
On some systems debugging may not be possible or preferred according to a case. Debug prints are very helpful if you need to get some information and do not want to interfere the running code too much. However, when the number of characters you want to print increase, the software gets slower and bigger in size. For example:
printf("Function X is completed\n");
Coded Debug Print gives a number to each print statement and replaces it with that number. For example, print statement above becomes
printf("1\n");
This means, it changes the source file and you need to compile changed source. It also creates a database table to match strings to each number.
After you compile your code, you see that you'll have a smaller debug builds. That also means that it is safer to give your build to 3rd party people (Ex: Testers) because, without database file, those information is not valuable.
There are 2 python files. These are code.py and decode.py. code.py codes print statements and builds database using a regular expression to find print statement. An example regular expression is shown below.
([puts|printf]\s*\(\s*\")(.*)(\"\s*\)\s*;)
decoder.py is like a tail utility and uses database file to print original strings.
CodedDebugPrint is in early stages and will be evolved. All comments are welcome.
March 13, 2009
Subscribe to:
Post Comments (Atom)
0 comment:
Post a Comment