Question

Specifically what can be causing a segmentation fault at a fprintf call. The fprintf call is below. If there are too many possibilities that can cause this then please provide a generalized set of causes.

status = printf("Processing %u by %u image.  Please wait...\n", 3, 3);

When I debug my program "main.c" (.c not .cpp) the segmentation fault occurs and I get two prompts stating there is a segmentation fault by Dev-C++. status is set to 12 which corresponds to the first "3".

I am more interested in the Computer Science theory of handling this problem. If that is possible?

Edit:

What is the list of possible bugs that cause segmentation faults?

Is code review/ analysis the only way to find the problem?

Are there debugger tools that can do this and how do they work (in short)?

Was it helpful?

Solution

With mingw and gdb, I have found that unless you are using Application Verifier, that when the program halts, and where the error occurs, have basically no relation to each other whatsoever. With it running, however, I have found it to be pretty reliable at finding the problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top