xv6-riscv icon indicating copy to clipboard operation
xv6-riscv copied to clipboard

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

Open ttzytt opened this issue 2 years ago • 1 comments

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 avatar Aug 21 '22 03:08 ttzytt

My environment is an Ubuntu 22.04.1 LTS running on WSL2

ttzytt avatar Aug 21 '22 03:08 ttzytt