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
     
     
     
  • 相关阅读:
    Linux调度器性能分析
    [ZJOI2009]假期的宿舍
    CH1601 【模板】前缀统计 (trie树)
    P2580 于是他错误的点名开始了
    P1608 路径统计
    P4779 【模板】单源最短路径
    [JLOI2014]松鼠的新家
    [NOI2015]软件包管理器
    [HAOI2015]树上操作
    P3386 【模板】二分图匹配
  • 原文地址:https://www.cnblogs.com/hustdc/p/8146117.html
Copyright © 2011-2022 走看看