[an error occurred while processing this directive]

Examing a Core File

We start with the new source simple6.c which produces a core dump due to a Segmentation fault. Like described for gdb we can copy the core and open it in totalview:

totalview ./simple6 core 
and see directly the line of code there the segmentation fault occurred.

We can dive and list values and recognize, that all values in trials look strange.

Caveat with Segmentation faults:
A segmentation fault is reported if the memory your code wants to access is outside the memory range given to your program. There is no complain, if your code modifies an adress within your memory range at an unintended place.

Thus, the segmentation fault occurred in line 33 but before that errors have overwritten the information in trials without causing a crash.
Anyway, there seems to be something wrong in the loop starting at line 32 and that the array index j exceeds the allowed range. We start totalview anew and want to look at j at line 33. A right mouse click on that line opens the context menu and allows us to specify Properties.

As shown on the right, we change to Evaluate and specify a conditional breakpoint. The program should stop, when j is out of the valid range of array a.

The source code window indicates this conditional breakpoint with EVAL. Instead of stopping, we could have jumped to another line of code, just to finish the execution and see, that we are really looking at the error that causes all problems.

Of cause you have since long recognized, that the 6th element of trialsis not initialized correct.