![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Why not a segmentation fault?? | lagigliaivan | High Level Programming | 22 | 05-21-2008 08:07 AM |
| Segmentation Fault | compbug | UNIX for Dummies Questions & Answers | 3 | 04-21-2006 07:43 AM |
| segmentation fault | wojtyla | High Level Programming | 3 | 02-19-2005 11:53 AM |
| Segmentation fault | jshaulis | AIX | 1 | 06-01-2004 01:16 PM |
| segmentation fault | omran | High Level Programming | 2 | 08-01-2003 05:19 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
ive written my code in C for implementation of a simple lexical analyser using singly linked list hence am making use of dynamic allocation,but when run in linux it gives a segmentation fault is it cause of the malloc function that ive made use of????any suggestions as to what i could do???
thank you!! Last edited by rockgal; 12-02-2006 at 10:02 PM. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
I can't tell what your problem is from here.
The first problem is to find where in your code the segfault occurs - compile and run your code under a debugger (gdb) Code:
gcc -g -o myfile myfile.c gdb myfile gdb > r <command line arguments> <segfault happens here> ba |
|
#3
|
|||
|
|||
|
Ya will do that & get back to you...
thanks Last edited by rockgal; 12-02-2006 at 10:03 PM. |
|
#4
|
||||
|
||||
|
rockgal, please review the rules:
(9) Edit your posts if you see spelling or grammar errors (don't write in cyberchat or cyberpunk style). English only. |
|
#5
|
|||
|
|||
|
I tried out these commands gdb >r <myfile> & gdb bt <myfile> on fedora 4.0
and this is what i got bash: syntax error near unexpected token 'newline' Am not sure of the syntax of the command but i picked up 'bt' from the man pages. I did try all possibilities and this is what i got for all of them...! Please let me know if my command syntax is wrong or thats the error in my program and how can i debug it??? thank you, rockgal Last edited by rockgal; 12-02-2006 at 10:03 PM. |
|
#6
|
||||
|
||||
|
Quote:
Seems like you are typing this in bash "gdb >r <myfile> & gdb bt <myfile>" |
|
#7
|
|||
|
|||
|
Crashing in linux, as in, doesn't crash in windows?
Windows lets you get away with a lot of stupid stuff sometimes, but only temporarily. Instead of crashing immediately as Linux does, it silently corrupts the heap, causing inexplicable errors in the future in code that has nothing to do with whatever your code did wrong. It's frustrating, I know. It's only when I moved to linux did I find out how bad some of my code was! P.S: "U" is not a word! |
|||
| Google The UNIX and Linux Forums |