Re: Segmentation fault (111 Views)
Frequent Advisor
Posts: 44
Registered: ‎01-28-1999
Message 1 of 4 (111 Views)

Segmentation fault

This fault is happening when calling a fonction :

Program terminated with signal 11, Segmentation fault.
#0 0x6ff3597c in _sigfillset+0x61c () from /usr/lib/libc.2
(gdb) where
#0 0x6ff3597c in _sigfillset+0x61c () from /usr/lib/libc.2
#1 0x6ff33734 in _sscanf+0x67c () from /usr/lib/libc.2
#2 0x6ff38cfc in malloc+0x18c () from /usr/lib/libc.2
#3 0x6fa75e88 in mem_malloc+0x50 ()

Best regards,

R. Mufti
Honored Contributor
Posts: 4,030
Registered: ‎06-09-2004
Message 2 of 4 (111 Views)

Re: Segmentation fault

Memoru allocation is getting failed there.
Try to analyse frame by frame as,

gdb) info f 0

zero'th frame information's will be given.

what program did you try to execute there.?

I hope your tried to get the wrong type of input with scanf() call there after memory allocation. It is good to have your code to analyse more.
Easy to suggest when don't know about the problem!
Occasional Visitor
Posts: 1
Registered: ‎10-28-2005
Message 3 of 4 (111 Views)

Re: Segmentation fault

is your problem still resolved?

I am also facing the same problem. Any pointers?
Honored Contributor
Posts: 1,155
Registered: ‎11-24-2004
Message 4 of 4 (111 Views)

Re: Segmentation fault

It would help if you could post the relevent portion of source code. One common mistake in using scanf() functions is that if the argument is say an integer you need to pass the address of where you want to store it, rather than just the name of a variable.


int a, b, c;
int rc;
char * buffer = "1 2 3";

rc = sscanf(buffer, "%d %d %d", &a, &b, &c);


rc = sscanf(buffer, "%d %d %d", a, b, c);

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.