OK, here's a short explanation of Salem's debugging session:
Code:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000400b1a in insertIn (CPU_Burst=0x6030d0) at bar.c:297
297 if(currNode->PCB_Data->CPU_Burst >= newNode->PCB_Data->CPU_Burst)
(gdb) bt
#0 0x0000000000400b1a in insertIn (CPU_Burst=0x6030d0) at bar.c:297
#1 0x0000000000400949 in main () at bar.c:165
(gdb) list
292 trailNode = NULL;
293
294 /*traversal list to find insert location */
295 while(currNode !=NULL)
296 {
297 if(currNode->PCB_Data->CPU_Burst >= newNode->PCB_Data->CPU_Burst)
298 {
299
300 break;
301
The program crashes at line 297 in the insertIn() function (the command 'bt' gives a backtrace of all current frames).
Code:
(gdb) info locals
currNode = 0x6030f0
trailNode = 0x0
newNode = 0x6031b0
(gdb) print currNode->PCB_Data
$1 = (struct PCB *) 0x603010
(gdb) print *currNode->PCB_Data
$2 = {PCB_ID = 1111, ArrivalTime = 0, CPU_Burst = 0}
(gdb) print *newNode->PCB_Data
Cannot access memory at address 0x0
In a debugger you can look at the current values of your variables. In your case, "newNode->PCB_Data" is a NULL pointer which you try to dereference at line 297.
HTH, Andreas