[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: A question on debugging libraries

On Mon, Feb 09, 2004 at 07:49:53PM -0500, Daniel Jacobowitz wrote:
> You are trying to get a backtrace.  A walk up the stack frame, yes?  So
> you generated a crash by overwriting the stack; naturally we can not
> backtrace.

doh, you are of course right.

Just for the archives, don't use a stack variable and try something

--- new program ---
#include <stdio.h>
#include <string.h>
char *b = "A long string";
char *a;
int main(void)
        strcpy(a, b);

and you'll correctly be able to debug it

Program received signal SIGSEGV, Segmentation fault.
strcpy (dest=0x0, src=0x80484a4 "A long string") at ../sysdeps/generic/strcpy.c:40
40      ../sysdeps/generic/strcpy.c: No such file or directory.
        in ../sysdeps/generic/strcpy.c
(gdb) info args
dest = 0x0
src = 0x80484a4 "A long string"


Attachment: pgp2gMiiHh7I9.pgp
Description: PGP signature

Reply to: