Closed lxyscls closed 2 years ago
"info mem" in QEMU can't show the user program's pages too.
qemu-system-riscv64 -machine virt -bios none -kernel kernel/kernel -m 128M -smp 3 -nographic -drive file=fs.img,if=none,format=raw,id=x0 -device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0 -S -gdb tcp::25000
xv6 kernel is booting
hart 1 starting
hart 2 starting
init: starting sh
QEMU 4.2.1 monitor - type 'help' for more information
(qemu) info mem
vaddr paddr size attr
---------------- ---------------- ---------------- -------
000000000c000000 000000000c000000 0000000000001000 rw---ad
000000000c001000 000000000c001000 0000000000001000 rw-----
000000000c002000 000000000c002000 0000000000001000 rw---ad
000000000c003000 000000000c003000 00000000001fe000 rw-----
000000000c201000 000000000c201000 0000000000001000 rw---ad
000000000c202000 000000000c202000 0000000000001000 rw-----
000000000c203000 000000000c203000 0000000000001000 rw---ad
000000000c204000 000000000c204000 0000000000001000 rw-----
000000000c205000 000000000c205000 0000000000001000 rw---ad
000000000c206000 000000000c206000 00000000001fa000 rw-----
0000000010000000 0000000010000000 0000000000002000 rw---ad
0000000080000000 0000000080000000 0000000000007000 r-x--a-
0000000080007000 0000000080007000 0000000000001000 r-x----
0000000080008000 0000000080008000 0000000000005000 rw---ad
000000008000d000 000000008000d000 0000000000004000 rw-----
0000000080011000 0000000080011000 0000000000011000 rw---ad
0000000080022000 0000000080022000 0000000000001000 rw-----
0000000080023000 0000000080023000 0000000000003000 rw---ad
0000000080026000 0000000080026000 0000000007f36000 rw-----
0000000087f5c000 0000000087f5c000 000000000001c000 rw---ad
0000000087f78000 0000000087f78000 0000000000088000 rw-----
0000003ffff7f000 0000000087f78000 000000000003e000 rw-----
0000003fffffb000 0000000087fb6000 0000000000002000 rw---ad
0000003ffffff000 0000000080007000 0000000000001000 r-x--a-
I have the same problem in GDB can't step into ecall. First make sure in the .gdbinit.tmpl-riscv
file you have this line: set riscv use-compressed-breakpoints yes
, if this also cannot step into ecall, print the stvec
register value,and make a breakpointer in the stvec
address. In this way, it can trap into the kernel code. Hope it can help you.
I have the same problem in GDB can't step into ecall. First make sure in the
.gdbinit.tmpl-riscv
file you have this line:set riscv use-compressed-breakpoints yes
, if this also cannot step into ecall, print thestvec
register value,and make a breakpointer in thestvec
address. In this way, it can trap into the kernel code. Hope it can help you.
set riscv use-compressed-breakpoints yes
is the default value in .gdbinit.tmpl-riscv, and I have changed to riscv64-unknown-elf-gdb, everthing is ok now.
The output is as below, and ecall's address in sh.asm is 0xdec.
My system is Ubuntu 20.04 in WSL2, and GDB is gdb-multiarch.