I'm trying to design a lab to ease my students into working on a target. I thought I'd have them use the simulator for a few programs. The problem is getting output.
For the following program

char *msg = "hello world\n";

int putchar(int i){}

write(const char *msg)
{
 while (msg[0])
   {
     putchar(msg[0]);
     msg++;
   }
}

main()
{
 int i;
 for (i = 0; i < 10; i++)
   {
     write(msg);
   }
}


I've tried the following gdbinit file to cause breakpoint commands to do my work:

target sim
load
break putchar
commands
silent
printf "%c", i
continue
end
run


Unfortunately, msp430-gdb doesn't seem to do the right thing with breakpoints. Where
it should silently handle the breakpoint and print to the screen, I get:

Program received signal SIGTRAP, Trace/breakpoint trap.
putchar (i=101) at test2.c:6
6       }


continue doesn't print the output either. This program and gdbinit file (minus the target sim) does what it's supposed to under linux.
Any ideas ?

Geoffrey



Reply via email to