[<<][staapl][>>][..]
Sun Feb 15 13:38:09 CET 2009

gdb vs. forth

The Staapl/Forth approach is to see a program as a library with
multiple entry points, which can be invoked during debugging.

In gdb it's also possible to call functions.  To debug a library of
functions, simply add dummy main() and instantiate the program.
I.e. test.c :

#include <stdio.h>
void boo(void){
	printf("boo!\n");
}

int main(int argc, char **argv){
	return 0;
}

tom@zzz:/tmp$ gcc -g test.c
tom@zzz:/tmp$ gdb ./a.out
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(gdb) break main
Breakpoint 1 at 0x80483c6: file test.c, line 7.
(gdb) r
Starting program: /tmp/a.out

Breakpoint 1, main () at test.c:7
7		return 0;
(gdb) p boo()
boo!
$1 = void
(gdb)



[Reply][About]
[<<][staapl][>>][..]