sdcc/debugger ------------- Notes Aug 4, 2001 - Karl Bongers The debugger appears to have been broken for quite some time. My guess is that Sandeep originally had it working in the 1999-2000 year timeframe, but then changes to the command structure in ucSim(simulator) caused it to be busted for quite a long time. I got it working under Linux, a number of ucSim commands changed syntax. Including are: Changed "g" command to "run". Changed "dr" to "info register". Changed l filename.ihx to l "filename.ihx" (the quotes are required by ucSim, and can be a confusing issue with the load(l) command. Also I had to add a "step" command prior to a "run" command when it is desired to resume execution so that ucSim does not stop on the same breakpoint we are currently at. I have not tried compiling or running under Cygwin/Windows. Issues: ====================== * The source line #'s may be out of sync with the breakpoints and assembly. I'm not sure, today it seemed close but not exact, while yesterday on a diferent test program it seemed several lines off... * An initial "run" command must be issued to start up debugging. The debugger refuses to list code or insert breaks on initial startup. The debugger builds up a context as it runs and it doesn't want to do the code listings or breaks until it has some context. This doesn't seem right to me, you should be able to insert breaks or list code immediately. This needs to be looked at. Work arounds: ====================== Compile with --debug option: sdcc --debug hi.c Load sdcdb, like this: sdcdb hi Then you need to do an initial "run" command. It should stop at the main() entrypoint and give a message about a non-user breakpoint. Now you should be able to list code, and set breakpoints. Type "c" to continue running to a breakpoint, or type "step" to single step. Use a preceeding bang("!") to do s51 simulator commands. So for example: !pc will send the "pc" command to ucSim and give you the program counter and list the current line of assembly. !help will give you the brief command line help listing of ucSim. But this help will scroll of the screen. So to get a list, I redirect stdout to a text file to examine like this: sdcdb hi 2>&1 | tee sdcdb.log Slacker Notes: ====================== To debug, it can be helpful to turn on verbose debug dumps by uncommenting #define SDCDB_DEBUG in sdcdb.h. End Notes Aug 4, 2001 - Karl Bongers --------------