2015-04-06 64 views
0

當我測試基於HOCA系統的os類項目的中斷模塊時,遇到了一個非常奇怪的錯誤。GDB報告「當前文件中沒有行92」。但我實際上有92行

當我開始我的主要功能(這是從line66到line101),但是當我設置的斷點在line92,GDB說

No line 92 in the current file. Make breakpoint pending on future shared library load?

你們是否知道這是怎麼回事?

而且,當我設置的斷點線92,並繼續GDB,它會報告: 「

 trap: nonexistant memory 
    address: -1 
    memory size: 131072 
    ERROR: address greater than MEMORYSIZE 


    Program received signal SIGSEGV, Segmentation fault. 
    0x0000002e in ??() 

源代碼如下:

/* This module coordinates the initialization of the nucleus and it starts the execution 
* of the first process, p1(). It also provides a scheduling function. The module contains 
* two functions: main() and init(). init() is static. It also contains a function that it 
* exports: schedule(). 
*/ 

#include "../../h/const.h" 
#include "../../h/types.h" 
#include "../../h/util.h" 
#include "../../h/vpop.h" 

#include "../../h/procq.e" 
#include "../../h/asl.e" 
#include "../../h/trap.h" 
#include "../../h/int.h" 

proc_link RQ;  /* pointer to the tail of the Ready Queue */ 
state_t st;   /* the starting state_t */ 
extern int p1(); 

/* This function determines how much physical memory there is in the system. 
* It then calls initProc(), initSemd(), trapinit() and intinit(). 
*/ 
void static init(){ 

    STST(&st); 

    if(st.s_sp%PAGESIZE != 0){ 
     st.s_sp -= st.s_sp%PAGESIZE; 
    } 

    initProc(); 
    initSemd(); 

    trapinit(); 
    intinit(); 
} 


/* If the RQ is not empty this function calls intschedule() and loads the state of 
* the process at the head of the RQ. If the RQ is empty it calls intdeadlock(). 
*/ 
void schedule(){ 
    proc_t *front; 
    front = headQueue(RQ); 

    if (checkPointer(front)) { 
     intschedule(); 
     LDST(&(front->p_s)); 
    } 
    else { 
     intdeadlock(); 
    } 
} 


/* This function calls init(), sets up the processor state for p1(), adds p1() to the 
* RQ and calls schedule(). 
*/ 

void main(){ 
    proc_t *pp1; // pointer to process table entry 
    state_t pp1state; //process state 

    long curr_time; // to store the time 

    init(); // initialize the process table, semaphore... 

    /*setup the processor state for p1(), adds p1() to the ReadyQueue */ 
    RQ.next = (proc_t *) ENULL; 
    RQ.index = 1; 

    pp1 = allocProc(); 
    if(!checkPointer(pp1)){ 
     return; 
    } 

    pp1->parent = (proc_t *) ENULL; // ENULL is set to -1 
    pp1->child = (proc_t *) ENULL; 
    pp1->sibling_next = pp1; 
    pp1->sibling_prev = pp1; 

    pp1state.s_sp = st.s_sp - (PAGESIZE*2); 
    pp1state.s_pc = (int)p1; 
    pp1state.s_sr.ps_s = 1; // here should be line 92 

    STCK(&curr_time); //store the CPU time to curr_time 

    pp1->p_s = pp1state; 
    pp1->start_time = curr_time; 

    insertProc(&RQ, pp1); 

    schedule(); 

    return; 
} 
+0

您是否正在編譯完全優化? – usr2564301 2015-04-06 09:52:26

回答

1

編譯不優化。爲此使用O0 gcc標誌。

相關問題