Powered by Invision Power Board


  Reply to this topicStart new topicStart Poll

> segmentation fault, segmantation fault...
poojap123
Posted: Jul 28 2004, 08:48 PM
Quote Post


Newbie
*

Group: Members
Posts: 1
Member No.: 408
Joined: 28-July 04



HI,
while I am running my program I am getting segmentation fault...
this is the back trace from gdb ...
I am having hard time with this segmentation faukt...
please anyone suggest me how can i fix it up...
i am not a computer science student.. i don't know so many technical stuff..
please help me...


Program received signal SIGSEGV, Segmentation fault.
0x4014f46d in __printf_fp () from /lib/i686/libc.so.6
(gdb) bt
#0 0x4014f46d in __printf_fp () from /lib/i686/libc.so.6
#1 0x4014a6be in vfprintf () from /lib/i686/libc.so.6
#2 0x4016b014 in vsnprintf () from /lib/i686/libc.so.6
#3 0x40152ef4 in snprintf () from /lib/i686/libc.so.6
#4 0x4008c617 in bool std::has_facet<std::messages<wchar_t> >(std::locale const&) () from /usr/lib/libstdc++.so.5
#5 0x4007e9ae in std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_convert_float<double>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, char, double) const () from /usr/lib/libstdc++.so.5
#6 0x4007e2c2 in std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::do_put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, double) const () from /usr/lib/libstdc++.so.5
#7 0x400926bc in std::ostream::operator<<(double) ()
from /usr/lib/libstdc++.so.5
#8 0x0804b2c3 in PLFFP::leaving_var1() (this=0xbffff5f0) at tPLFFP.cpp:465
PMEmail Poster
Top
jim mcnamara
Posted: Jul 29 2004, 02:28 PM
Quote Post


User Level: 2
**

Group: Members
Posts: 28
Member No.: 320
Joined: 4-June 04



The error is caused by a call to sprintf() which expects a NULL-terminated string.
The string is not null terminated. In this case formatting output for ostream is the problem.

Look for a string which is too large for the size of the declared string.
PMEmail Poster
Top
arunkumar
Posted: Oct 15 2004, 04:32 AM
Quote Post


Newbie
*

Group: Members
Posts: 6
Member No.: 577
Joined: 13-October 04



Hello,
Segmentation faults comes with strings or character only.If you have string or character variable check it out.
The size of it cannot take the information.
make the size to be greater or you may redeclare a same variable.
arunkumar
PMEmail PosterYahooMSN
Top
rahul200676
  Posted: Mar 13 2005, 09:56 AM
Quote Post


Newbie
*

Group: Members
Posts: 2
Member No.: 856
Joined: 13-March 05



Hi,
I will saw, segmentation fault occurs generally when one program tries to read or write to a memory area which is not belonging to that program.

If u r working with string, see if the string size is beyond the limit of the memory space of the array, or if u have the terminating character in the end of the string.

No need to mention that you r not a computer science student.

Rahul
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
« Next Oldest | Programming/Languages | Next Newest »

Topic Options Reply to this topicStart new topicStart Poll

 



[ Script Execution time: 0.1036 ]   [ 12 queries used ]   [ GZIP Enabled ]




Partners: Cambridge Plus :: <Link Available> :: PIC Boot-loader Utility :: <Link Available>
Unix Man Pages / Linux Man Pages :: HiFi Forum :: SIP VoIP Phone & Provider Reviews :: UNIX/Linux Forum Archives

More info on advertising on Unix/Linux Forum