美文网首页
解决Remote 'g' packet reply is too

解决Remote 'g' packet reply is too

作者: Minority | 来源:发表于2020-05-20 20:08 被阅读0次

    一、Remote 'g' packet reply is too long的解决

    最近使用gdb调试Linux内核时,gdb出现Remote 'g' packet reply is too long的错误:

    经过查阅资料得知需要使用源码重新安装gdb,并修改gdb/remote.c文件的一段代码。

    二、gdb使用源码安装

    wget http://ftp.gnu.org/gnu/gdb/gdb-7.8.tar.xz
    tar -xf gdb-7.8.tar.xz    
    cd gdb-7.8/    
    ============================解决上述错误的附加步骤=========================
    vi gdb/remote.c
    // 把status 1处的代码替换为status 2
    
    //status 1
    if (buf_len > 2 * rsa->sizeof_g_packet)
        error (_("Remote 'g' packet reply is too long: %s"), rs->buf);
    
    //status 2
    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;
       }
    }
    =========================================================================
    ./configure
    make
    sudo make install
    sudo cp gdb/gdb /usr/bin
    

    参考文章:

    相关文章

      网友评论

          本文标题:解决Remote 'g' packet reply is too

          本文链接:https://www.haomeiwen.com/subject/trfoohtx.html