LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-01-2014, 10:43 PM   #1
CeroZilch
LQ Newbie
 
Registered: Oct 2014
Posts: 2

Rep: Reputation: Disabled
Post vertical histogram on C giving segmentation error..


Solved

Last edited by CeroZilch; 10-02-2014 at 02:34 AM.
 
Old 10-02-2014, 12:09 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,863
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Guess you forgot to try gdb:

Code:
gcc -W -Wall -Wextra -Werror -o mycode -g mycode.c
gdb mycode
run
backtrace
 
Old 10-02-2014, 12:26 AM   #3
CeroZilch
LQ Newbie
 
Registered: Oct 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
Still :/

I did as you said and it still gives the segmentation error..

Code:
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /root/College/Prog/Practicals/Trials/histogram...(no debugging symbols found)...done.
(gdb) run
Starting program: /root/College/Prog/Practicals/Trials/histogram 
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
backtrace

Program received signal SIGSEGV, Segmentation fault.
0x0000000000400839 in computeFrequencies ()
(gdb)
 
Old 10-03-2014, 03:02 AM   #4
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,863
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
command 'backtrace' should come after SIGSEGV

Of course it won't help you if you keep compiling without option -g (I suggested it for a reason, not only because I am paid per characters)
 
  


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
code giving segmentation fault Anuradha12345 Programming 3 08-10-2012 02:37 AM
Why is my program giving me segmentation fault? Ahmad Mujtaba Programming 5 12-25-2010 07:33 AM
APT on FEDORA 1 giving SEGMENTATION FAULT prester john Linux - Software 3 03-05-2004 04:10 AM
APT on FEDORA 1 giving SEGMENTATION FAULT prester john Linux - Newbie 0 03-03-2004 10:14 PM
APT on FEDORA 1 giving SEGMENTATION FAULT prester john Fedora 0 03-03-2004 10:11 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:07 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