| title | date | categories | tags | ||||
|---|---|---|---|---|---|---|---|
QEMU 使用技巧 |
2024-05-21 17:30:00 +0800 |
|
|
-
中断响应
https://github.com/qemu/qemu/blob/master/docs/system/gdb.rst#changing-single-stepping-behaviour
-
默认状态
使用 stepi CPU 不会响应硬件产生的中断。
使用 nexti CPU 一小段时间不响应硬件产生的中断,然后会响应硬件产生的中断,响应过程直接省略,响应完成后,回到被中断的地方。
使用 step/next CPU 会响应硬件产生的中断,响应过程直接省略,响应完成后,回到被中断的地方。
-
可以通过设置改变默认状态
-
-
mtime 变大问题
-
elf-gdb linux-gnu-gdb
-
QEMU Monitor Protocol
https://qemu-project.gitlab.io/qemu/interop/qemu-qmp-ref.html
https://qemu-project.gitlab.io/qemu/qapi-qmp-index.html
https://wiki.qemu.org/Documentation/QMP
https://pypi.org/project/qemu.qmp/
-
How to set up
还有用 telnet 或者 socat rlwrap 的方法,不推荐。
-
Open Unix socket
-qmp unix:/tmp/qmp.sock,server=on,wait=off用
-qmp-pretty好像会出错。 -
Run
qmp-shellqmp-shell在 QEMU 仓库的scripts/qmp中。./qmp-shell /tmp/qmp.sock需要先安装 python library
qemu.qmp
-
-
Some useful commands
首先通过
query-commands查询当前 qemu target 支持的 command。qemu-system-riscv64 只支持以下和 cpu/machine 相关的指令:query-current-machine query-machines query-cpus-fast query-cpu-definitions query-cpu-model-expansion-
query-current-machine没什么作用 -
query-machines可以知道每个 machine 默认用的是什么 cpu。
-
query-cpus-fast没什么用作用 -
query-cpu-definitions给出来的是 qemu-system-riscv64 支持的 cpu 的一些基本信息,比如
static和deprecated。用
qemu-system-riscv64 -cpu help也可以得到 cpu name list。 -
query-cpu-model-expansionhttps://qemu-project.gitlab.io/qemu/system/arm/cpu-features.html#cpu-feature-probing
query-cpu-model-expansion type=full model={"name":"max"}可以了解 CPU 的具体信息,比如实现了什么扩展。
qemu-system-riscv64 好像不支持
type=static。
-
-