Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help needed with Segmentation error

Status
Not open for further replies.

raghav

Junior Member level 3
Junior Member level 3
Joined
May 19, 2005
Messages
28
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,492
Friends, I require help with the segmentation error in GCC. I am trying to run my mos simulation program in GCC. No, actually I am running only one of arround 20 functions that I'll be using later.But each one has dynamic memory allocation [malloc()] several times. This I suppose is the reason for the segmentation error. I am in dire need for either a short term or a long term solution. Please help urgently.
 

Segmentation errors are almost always programmer errors. Most often, they indicate that you're trying to use a "bad" pointer. In another way, you got one or more major bugs in there.

There are several ways to debug them, one is by sprinkling your code with printf()s; another is to analyze the core dump, or use a debugger, There is also asserts, lint and purify, amongst other things.

For completeness sake, I should mention that hardware/library/compiler errors can also cause it, but don't even bother looking for those unless you're 200% certain that your code is correct.
 

    raghav

    Points: 2
    Helpful Answer Positive Rating
Since you are using malloc, check if you are getting valid pointer? Next thing check the size passed to malloc, is it > 0?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top