Current OS/161 kernel fails to support effective gdb debugging, and you may encounter "No source file named xyz.c" issue when trying to use cs161-gdb to track and list the source file currently under track (see Debugging with GDB). The following instructions describe how to fix the issue and enable the ability to "list file:line" and "break file:line".
Edit kern/arch/mips/conf/ldscript, replace the last block of text from
/* DWARF debug sections */ /*.debug 0: { *(.debug) } .debug_srcinfo 0: { *(.debug_srcinfo) } .debug_aranges 0: { *(.debug_aranges) } .debug_pubnames 0: { *(.debug_pubnames) } .debug_sfnames 0: { *(.debug_sfnames) } .line 0: { *(.line) } */to the following snippet:
/* DWARF debug sections */ .debug 0: { *(.debug) } .debug_srcinfo 0: { *(.debug_srcinfo) } .debug_abbrev 0: { *(.debug_abbrev) } .debug_info 0: { *(.debug_info) } .debug_line 0: { *(.debug_line) } .debug_frame 0: { *(.debug_frame) } .debug_loc 0: { *(.debug_loc) } .debug_pubnames 0: { *(.debug_pubnames) } .debug_aranges 0: { *(.debug_aranges) } .debug_sfnames 0: { *(.debug_sfnames) } .debug_str 0: {*(.debug_str) } .line 0: { *(.line) }
Do the following:
% cd $HOME/os161/os161-1.11 % ./configure --debug --ostree=$HOME/os161/root
Assuming you are currently working on Project Assignment 1 (ASST1):
% cd kern/conf % ./config ASST1 % cd ../compile/ASST1 % make clean % make depends % make % make installNow, the cs161-gdb should be able to track the source file information.