strlen returns incorrect value when called in gdb
The library is working just fine. The program reports the correct value even when run under gdb. The bug seems to be in the way that gdb is evaluating the expression and forcing the target program to call the function. I'm seeing this same behavior on 10.04 as well. Strangely p printf("foo\n") correctly prints 4.
It seems that gdb is confused because strlen is a builtin. If you do this:
int (*len)(char *) = strlen;
And then have gdb print len("foo") you get the correct result.