【问题标题】:How to watch memory access with gdb on guest machine in qemu?如何在 qemu 的来宾机器上使用 gdb 观察内存访问?
【发布时间】:2017-02-07 08:20:52
【问题描述】:

我可以在网上找到使用 gdb (Watch a memory range in gdb?) 中断对内存地址的访问的说明,但是当我使用 qemu 时,我不知道如何对客户机上的内存地址执行此操作。

【问题讨论】:

    标签: gdb qemu watchpoint


    【解决方案1】:

    您通过在 qemu 命令行中提供 -s 来启动 qemu,gdb 服务器在端口 1234 上进行监听。来自 qemu 手册页:

       -s  Shorthand for -gdb tcp::1234, i.e. open a gdbserver on TCP port
           1234.
    

    除此之外,您还可以使用选项 -S 来阻止 Qemu 继续运行,直到您将 gdb 连接到它并发出 continue 命令。

    -S  Do not start CPU at startup (you must type 'c' in the monitor).
    

    从 gdb,您连接到运行在 qemu 上的 gdb 服务器,方法是启动 gdb(适合您来宾架构的 gdb 版本)。然后通过命令连接gdb服务器(如果qemu在同一台机器上运行):

    (gdb) target remote :1234

    参考资料:

    1. http://wiki.qemu.org/Documentation/Debugging
    2. How to debug the Linux kernel with GDB and QEMU?

    【讨论】:

    猜你喜欢
    • 2016-06-03
    • 2018-03-07
    • 2019-01-07
    • 1970-01-01
    • 2014-11-03
    • 1970-01-01
    • 2018-12-08
    • 2017-04-23
    • 1970-01-01
    相关资源
    最近更新 更多