Ubuntu を実行している自宅のコンピューターで作業している Pintos プロジェクトを始めたばかりです。
ディレクトリからプロジェクトをコンパイルできsrc/threads/
、最初のテストpintos run alarm-multiple
は問題なく動作しているようです (デフォルトで qemu が実行されることに注意してください)。
$:~/workspace/pintos/src/threads/build$ pintos run alarm-multiple
qemu -hda /tmp/ODhMQLwBNh.dsk -m 4 -net none -serial stdio
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
PiLo hda1
Loading..........
Kernel command line: run alarm-multiple
Pintos booting with 4,096 kB RAM...
383 pages available in kernel pool.
383 pages available in user pool.
Calibrating timer... 111,206,400 loops/s.
Boot complete.
Executing 'alarm-multiple':
(alarm-multiple) begin
(alarm-multiple) Creating 5 threads to sleep 7 times each.
...
(alarm-multiple) thread 4: duration=50, iteration=7, product=350
(alarm-multiple) end
Execution of 'alarm-multiple' complete.
しかし、bochsエミュレーターでこのテストを実行すると、printf()
から最初に呼び出されたように見える をヒットするとすぐにパニックになりread_command_line()
ます。
ピント:
$:~/workspace/pintos/src/threads/build$ pintos --gdb --bochs -- run alarm-multiple
squish-pty bochs -q
========================================================================
Bochs x86 Emulator 2.2.6
Build from CVS snapshot on January 29, 2006
========================================================================
00000000000i[ ] reading configuration from bochsrc.txt
00000000000e[ ] user_shortcut: old-style syntax detected
00000000000i[ ] Enabled gdbstub
00000000000i[ ] installing x module as the Bochs GUI
00000000000i[ ] using log file bochsout.txt
Waiting for gdb connection on localhost:1234
PiLo hda1
Loading..........
Kernel command lineTriple fault: stopping for gdb
ピントス-gdb:
$:~/workspace/pintos/src/threads/build$ pintos-gdb kernel.o
*** /usr/class/cs140/pintos/pintos/src/misc/gdb-macros does not exist ***
*** Pintos GDB macros will not be available ***
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/ozhu/workspace/pintos/src/threads/build/kernel.o...done.
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
warning: unrecognized item "ENN" in "qSupported" response
0x0000fff0 in ?? ()
qTStatus: Target returns error code 'NN'.
(gdb) break schedule
Breakpoint 1 at 0xc0020e7b: file ../../threads/thread.c, line 557.
qTStatus: Target returns error code 'NN'.
(gdb) c
Continuing.
qTStatus: Target returns error code 'NN'.
Program received signal SIGTRAP, Trace/breakpoint trap.
0xc0026a16 in __vprintf (format=<optimized out>, args=0xc000efa8 "\265\033", output=0xc002a094 <vprintf_helper>, aux=0xc000ef6c) at ../../lib/stdio.c:296
296 s = "(null)";
(gdb) bt
#0 0xc0026a16 in __vprintf (format=<optimized out>, args=0xc000efa8 "\265\033", output=0xc002a094 <vprintf_helper>, aux=0xc000ef6c) at ../../lib/stdio.c:296
#1 0xc002a160 in vprintf (format=0xc002e99b " %s", args=0xc000efa4 ">}") at ../../lib/kernel/console.c:131
#2 0xc0026377 in printf (format=0xc002e99b " %s") at ../../lib/stdio.c:85
#3 0xc00202a7 in read_command_line () at ../../threads/init.c:218
#4 main () at ../../threads/init.c:85
(gdb)
ご覧のとおり、gdb で (continue) コマンドを実行するとすぐに、 の呼び出し時にc
pintos がクラッシュします。read_command_line()
printf()
ベースラインの Pintos コードに大幅な変更を加えたとは思いません。この関数呼び出しで bochs をパニックに陥れている可能性があるのは何ですか? この同じテストを qemu で実行しても、この問題はないようです。