开发者

Interpreting gdb output

I get a segfault in my program and was trying to detect the source via gdb.

O/p of the gdb is as follows:

开发者_如何学C[Switching to Thread 0xb6dffb70 (LWP 6448)]
#0 0x00adc026 in __strlen_sse2_bsf () from /lib/libc.so/6
#1 0x08049e77 in sim_txn (fd=0x804c5c0) at rand_trace0.c:390

and at rand_trace0.c:390 I have the line

system_call_length = strlen("rename(")+strlen(filename1)+strlen(",")+strlen(filename)+strlen(")")+1;

Everything seems to be working before it. I am at a loss.


Are filename1 and filename both valid pointers to null-terminated strings? The most common reason you might get a segfault with that is if your pointer wasn't properly initialized or if one of the strings isn't null-terminated (possibly because of a buffer overflow) and thus is resulting in strlen() trying to read past the size of the allocated memory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜