Is there a way to view C code "live", by displaying the current current line, as it is being executed?
You can pretty close by using GDB, but I'm wondering if there is something slightly more elegant than holding the return key down:
$ gdb ./mycode
(gdb) break 1
Breakpoint 1 at 0x100000f08: file mycode.c, line 1.
(gdb) run
Starting program: mycode
Breakpoint 1, main () at mycode.c:4
4 for(x = 0; x < 4; x++){
(gdb) next
5 printf("Example\n");
(gdb) [press return]
Example
4 for(x = 0; x < 4; x++){
(gdb) [press return]
Performance isn't an issue (obviously it will be slowed down a lot by all the printf()
'ing, which is fine). Ideally the solution would be a command line tool (alternatively a OS X compatible GUI application)
Perhaps the usage would be along the lines of..
$ viewlivec --delay 500 -- ./mycode -mycodes=arg --verbose
01: int main(){
02: int x;
03: for(x = 0; x < 4; x++){
04: printf("Example\n");
05: }
03: for(x = 0; x < 4; x++){
04: printf("Example\n");
05: }
03: for(x = 0; x < 4; x++){
04: printf("Example\n");
05: }
03: for(x = 0; x < 4; x++){
04: printf("Example\n");
05: }
06: }
The --delay
flag would wait 0.5 seconds between each line
(This may have been asked previously, but I wasn't really sure what to search for, thus couldn't find anything)