From 67f05c0ce0cd1ee900313b1b2ffbe678f7502fd5 Mon Sep 17 00:00:00 2001 From: Junjie Mao Date: Thu, 12 Mar 2015 16:02:32 +0800 Subject: [PATCH] break on the physical address of brkfunc The kernel may panic early when paging is not yet configured. Breaking only on the virtual address of brkfunc does not work in this case and leads to timeouts during 'make grade'. Signed-off-by: Junjie Mao --- labcodes/lab1/tools/grade.sh | 5 ++++- labcodes/lab2/tools/grade.sh | 5 ++++- labcodes/lab3/tools/grade.sh | 5 ++++- labcodes/lab4/tools/grade.sh | 5 ++++- labcodes/lab5/tools/grade.sh | 5 ++++- labcodes/lab6/tools/grade.sh | 5 ++++- labcodes/lab7/tools/grade.sh | 5 ++++- labcodes/lab8/tools/grade.sh | 5 ++++- 8 files changed, 32 insertions(+), 8 deletions(-) diff --git a/labcodes/lab1/tools/grade.sh b/labcodes/lab1/tools/grade.sh index 1a1ca26..8ea2a23 100644 --- a/labcodes/lab1/tools/grade.sh +++ b/labcodes/lab1/tools/grade.sh @@ -146,9 +146,13 @@ run_qemu() { if [ -n "$brkfun" ]; then # find the address of the kernel $brkfun function brkaddr=`$grep " $brkfun\$" $sym_table | $sed -e's/ .*$//g'` + brkaddr_phys=`echo $brkaddr | sed "s/^c0/00/g"` ( echo "target remote localhost:$gdbport" echo "break *0x$brkaddr" + if [ "$brkaddr" != "$brkaddr_phys" ]; then + echo "break *0x$brkaddr_phys" + fi echo "continue" ) > $gdb_in @@ -345,4 +349,3 @@ quick_check 'check ticks' \ ## print final-score show_final - diff --git a/labcodes/lab2/tools/grade.sh b/labcodes/lab2/tools/grade.sh index ba0e162..5ab3e0e 100644 --- a/labcodes/lab2/tools/grade.sh +++ b/labcodes/lab2/tools/grade.sh @@ -146,9 +146,13 @@ run_qemu() { if [ -n "$brkfun" ]; then # find the address of the kernel $brkfun function brkaddr=`$grep " $brkfun\$" $sym_table | $sed -e's/ .*$//g'` + brkaddr_phys=`echo $brkaddr | sed "s/^c0/00/g"` ( echo "target remote localhost:$gdbport" echo "break *0x$brkaddr" + if [ "$brkaddr" != "$brkaddr_phys" ]; then + echo "break *0x$brkaddr_phys" + fi echo "continue" ) > $gdb_in @@ -337,4 +341,3 @@ quick_check 'check ticks' \ ## print final-score show_final - diff --git a/labcodes/lab3/tools/grade.sh b/labcodes/lab3/tools/grade.sh index c4c6cab..02fc22d 100644 --- a/labcodes/lab3/tools/grade.sh +++ b/labcodes/lab3/tools/grade.sh @@ -146,9 +146,13 @@ run_qemu() { if [ -n "$brkfun" ]; then # find the address of the kernel $brkfun function brkaddr=`$grep " $brkfun\$" $sym_table | $sed -e's/ .*$//g'` + brkaddr_phys=`echo $brkaddr | sed "s/^c0/00/g"` ( echo "target remote localhost:$gdbport" echo "break *0x$brkaddr" + if [ "$brkaddr" != "$brkaddr_phys" ]; then + echo "break *0x$brkaddr_phys" + fi echo "continue" ) > $gdb_in @@ -361,4 +365,3 @@ quick_check 'check ticks' \ ## print final-score show_final - diff --git a/labcodes/lab4/tools/grade.sh b/labcodes/lab4/tools/grade.sh index 5ad73b0..502ca6b 100644 --- a/labcodes/lab4/tools/grade.sh +++ b/labcodes/lab4/tools/grade.sh @@ -146,9 +146,13 @@ run_qemu() { if [ -n "$brkfun" ]; then # find the address of the kernel $brkfun function brkaddr=`$grep " $brkfun\$" $sym_table | $sed -e's/ .*$//g'` + brkaddr_phys=`echo $brkaddr | sed "s/^c0/00/g"` ( echo "target remote localhost:$gdbport" echo "break *0x$brkaddr" + if [ "$brkaddr" != "$brkaddr_phys" ]; then + echo "break *0x$brkaddr_phys" + fi echo "continue" ) > $gdb_in @@ -365,4 +369,3 @@ quick_check 'check initproc' \ ## print final-score show_final - diff --git a/labcodes/lab5/tools/grade.sh b/labcodes/lab5/tools/grade.sh index 29e7f14..382603e 100644 --- a/labcodes/lab5/tools/grade.sh +++ b/labcodes/lab5/tools/grade.sh @@ -146,9 +146,13 @@ run_qemu() { if [ -n "$brkfun" ]; then # find the address of the kernel $brkfun function brkaddr=`$grep " $brkfun\$" $sym_table | $sed -e's/ .*$//g'` + brkaddr_phys=`echo $brkaddr | sed "s/^c0/00/g"` ( echo "target remote localhost:$gdbport" echo "break *0x$brkaddr" + if [ "$brkaddr" != "$brkaddr_phys" ]; then + echo "break *0x$brkaddr_phys" + fi echo "continue" ) > $gdb_in @@ -552,4 +556,3 @@ run_test -prog 'forktree' -check default_check \ ## print final-score show_final - diff --git a/labcodes/lab6/tools/grade.sh b/labcodes/lab6/tools/grade.sh index bf48013..a30feee 100644 --- a/labcodes/lab6/tools/grade.sh +++ b/labcodes/lab6/tools/grade.sh @@ -146,9 +146,13 @@ run_qemu() { if [ -n "$brkfun" ]; then # find the address of the kernel $brkfun function brkaddr=`$grep " $brkfun\$" $sym_table | $sed -e's/ .*$//g'` + brkaddr_phys=`echo $brkaddr | sed "s/^c0/00/g"` ( echo "target remote localhost:$gdbport" echo "break *0x$brkaddr" + if [ "$brkaddr" != "$brkaddr_phys" ]; then + echo "break *0x$brkaddr_phys" + fi echo "continue" ) > $gdb_in @@ -578,4 +582,3 @@ run_test -prog 'priority' -check default_check \ ## print final-score show_final - diff --git a/labcodes/lab7/tools/grade.sh b/labcodes/lab7/tools/grade.sh index 7cd37cd..9fae5ad 100644 --- a/labcodes/lab7/tools/grade.sh +++ b/labcodes/lab7/tools/grade.sh @@ -146,9 +146,13 @@ run_qemu() { if [ -n "$brkfun" ]; then # find the address of the kernel $brkfun function brkaddr=`$grep " $brkfun\$" $sym_table | $sed -e's/ .*$//g'` + brkaddr_phys=`echo $brkaddr | sed "s/^c0/00/g"` ( echo "target remote localhost:$gdbport" echo "break *0x$brkaddr" + if [ "$brkaddr" != "$brkaddr_phys" ]; then + echo "break *0x$brkaddr_phys" + fi echo "continue" ) > $gdb_in @@ -632,4 +636,3 @@ run_test -prog 'matrix' -check default_check \ ## print final-score show_final - diff --git a/labcodes/lab8/tools/grade.sh b/labcodes/lab8/tools/grade.sh index 0010361..345effd 100644 --- a/labcodes/lab8/tools/grade.sh +++ b/labcodes/lab8/tools/grade.sh @@ -146,9 +146,13 @@ run_qemu() { if [ -n "$brkfun" ]; then # find the address of the kernel $brkfun function brkaddr=`$grep " $brkfun\$" $sym_table | $sed -e's/ .*$//g'` + brkaddr_phys=`echo $brkaddr | sed "s/^c0/00/g"` ( echo "target remote localhost:$gdbport" echo "break *0x$brkaddr" + if [ "$brkaddr" != "$brkaddr_phys" ]; then + echo "break *0x$brkaddr_phys" + fi echo "continue" ) > $gdb_in @@ -636,4 +640,3 @@ run_test -prog 'matrix' -check default_check \ ## print final-score show_final -