zoukankan      html  css  js  c++  java
  • gdb 8.0.1连接qemu时,出现“Remote 'g' packet reply is too long”

    1 原因

    Note that other tutorials also add a "-S" parameter so QEMU starts the kernel stopped, however this is ommitted deliberately. The "-S" parameter would allow gdb to set an initial breakpoint anywhere in the kernel before kernel execution begins. Unfortunately, a change made to the gdbserver in QEMU, to support debugging 32- and 16-bit guest code in an x86_64 session breaks the -S functionality. The symptoms are that gdb prints out "Remote 'g' packet reply is too long:", and fails to interact successfully with QEMU. The suggested fix is to run the QEMU until it is in 64-bit code (i.e. after the boot loader has finished and the kernel started) before connecting from gdb (omitting the -S parameter). To debug a running kernel, this is sufficient; it is the method we will take.”

    2 解决办法

    gdb源码根目录/gdb/remote.c里面,将

    if (buf_len > 2 * rsa->sizeof_g_packet)
    error (_(“Remote ‘g’ packet reply is too long: %s”), rs->buf);
    修改为
    if (buf_len > 2 * rsa->sizeof_g_packet) {
        rsa->sizeof_g_packet = buf_len ;
        for (i = 0; i < gdbarch_num_regs (gdbarch); i++) {
            if (rsa->regs->pnum == -1)
                continue;
            if (rsa->regs->offset >= rsa->sizeof_g_packet)
                rsa->regs->in_g_packet = 0;
            else  
                rsa->regs->in_g_packet = 1;
        }     
    }
    也就是说,不是作为error来处理,而是按照下面的处理方式进行处理。
     
    3 cpu是x86_64
     
     
     
  • 相关阅读:
    python-获取网页源码及保存网页图片到本地实例
    python-随机向文件中写入100个名字实例
    python-计算文件中每个字出现的次数
    python-序列类型
    python-字符串
    python示例1(基本知识巩固)
    python-示例(基本知识巩固)
    [leetcode] Binary Tree Upside Down
    Trie 树
    第K大问题
  • 原文地址:https://www.cnblogs.com/hustdc/p/8146117.html
Copyright © 2011-2022 走看看