LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-12-2009, 03:30 AM   #1
CZTY
Member
 
Registered: May 2009
Distribution: fedora 10
Posts: 34

Rep: Reputation: 16
Segmentation fault.


Hello, when I try to design a small filesystem, it always have the Segmentation fault.#: make makefile
#./filsys
# Segmentation fault.
then I use gdb,
# gdb ./filsys
(gdb) r
Starting program: /home/os/filsys
Do you want to format the disk
y
Format will erase all context on the disk.Are You Sure?
y

Program received signal SIGSEGV, Segmentation fault.
fseek (fp=0x0, offset=0, whence=0) at fseek.c:40
40 _IO_acquire_lock (fp);
(gdb)

the question is,I cann't find the fseek.c anywhere,so I cann't solve the problem,can you help me?thanks very much.I think I should try my best to find the error in the code,code is too long,so the question i describe is not in detail.

Last edited by CZTY; 10-12-2009 at 03:53 AM.
 
Old 10-12-2009, 07:49 AM   #2
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
When you are in gdb after the seg fault, the first thing you need is a backtrace.

Maybe that will be all you need, or maybe what you see in the backtrace will just tell you where to look next.

Type the command
backtrace
in gdb, and you will get a call stack of how your program reached the incorrect call to fseek.

Quote:
I cann't find the fseek.c
There is no reason to want to look at fseek.c. You already can see that fp=0 on entry to fseek, so you know that the error is in whatever provides that fp value, not in fseek itself. Maybe that error is in the function that directly called fseek or maybe it is in something further up the call stack.

Last edited by johnsfine; 10-12-2009 at 07:50 AM.
 
Old 10-13-2009, 10:24 PM   #3
CZTY
Member
 
Registered: May 2009
Distribution: fedora 10
Posts: 34

Original Poster
Rep: Reputation: 16
Thanks for your help,I remove the seg error.
 
Old 10-13-2009, 11:03 PM   #4
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
and the solution was?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Segmentation fault AndeAnderson Linux - Laptop and Netbook 2 03-21-2007 08:10 AM
yast segmentation fault, system freezing - nvidia driver at fault? BaltikaTroika SUSE / openSUSE 2 12-02-2005 09:34 AM
segmentation fault libriana Linux - Newbie 2 06-10-2005 05:52 PM
Help! Segmentation Fault qieqie Linux - Newbie 3 06-03-2005 09:10 PM
Segmentation Fault XPediTioN Slackware 2 09-18-2003 08:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration