mit-pdos / xv6-riscv

Xv6 for RISC-V
Other
6.98k stars 2.58k forks source link

After adding -g3 compiler option in Makefile, a test in usertests.c doesn't pass #133

Open ttzytt opened 2 years ago

ttzytt commented 2 years ago

This problem was discovered when I used gdb to debug code in one of the labs (to be specific, mmap). Because I want to check the macros, I added the -g3 compiler option in Makefile like this:

CFLAGS = -Wall -Werror -g3 -O -fno-omit-frame-pointer -ggdb # this is line 94

Then I was not able to pass the writebig test in usertest.c. It says:

$ usertests writebig
usertests starting
test writebig: panic: balloc: out of blocks

To make sure that the modification for the lab does not cause this problem, I switched to another branch that hasn't been modified (util), then added the compiler option again. And the previous problem showed up again:

test writebig: panic: balloc: out of blocks

I wasn't sure if this was the right place to add compiler options, because I'm unfamiliar with Makefile. But if this is the place to put compiler options, then it could be a bug.

Hope this is helpful if you met this problem, and if you know why this is happening, please tell me because I'm very curious about this (this is a very unexpected place to affect usertests, and I stuck at this lab for a long time just because of this).

ttzytt commented 2 years ago

My environment is an Ubuntu 22.04.1 LTS running on WSL2