LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 04: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 04:53 AM.
 
Old 10-12-2009, 08:49 AM   #2
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190
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 08:50 AM.
 
Old 10-13-2009, 11: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-14-2009, 12:03 AM   #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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 09:10 AM
yast segmentation fault, system freezing - nvidia driver at fault? BaltikaTroika SUSE / openSUSE 2 12-02-2005 10:34 AM
segmentation fault libriana Linux - Newbie 2 06-10-2005 06:52 PM
Help! Segmentation Fault qieqie Linux - Newbie 3 06-03-2005 10:10 PM
Segmentation Fault XPediTioN Slackware 2 09-18-2003 09:16 AM

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

All times are GMT -5. The time now is 03:27 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration