public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug server/13984] New: gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message
@ 2012-04-16  2:34 curty at ieee dot org
  2015-08-12 11:47 ` [Bug server/13984] " sarikayameh at gmail dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: curty at ieee dot org @ 2012-04-16  2:34 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13984

             Bug #: 13984
           Summary: gdb stops controlling a thread after "Remote 'g'
                    packet reply is too long: ..." error message
           Product: gdb
           Version: 7.4
            Status: NEW
          Severity: critical
          Priority: P2
         Component: server
        AssignedTo: unassigned@sourceware.org
        ReportedBy: curty@ieee.org
    Classification: Unclassified


Linux Kernel debugging running gdbserver at Eclipse causes gdbserver stop
receiving thread commands after "Remote 'g' packet reply is too long: ..."
error message. This message arrives after hit a tbreak at start_kernel()
function.

The state is "Thread [1] (Suspended)" but when I try to control this thread
(eg. execute, suspend, etc), a "Cannot execute this command while the selected
thread is running" message returns and it is not possible to continue debuging.

> QEMU Guest (Intel i7) command:

# /home/curtyc/000_HPC/usr/local/packages/qemu-devel/bin/qemu-system-x86_64
-smp 1 -kernel
'/home/curtyc/Linux_kernel_source/linux-3.3/arch/x86_64/boot/vmlinux'
/home/curtyc/QEMU/images/Fedora-x86_64-linux-3.3.0.raw -S -gdb tcp::1234


> GDB console at Eclipse:

------ cut here -------
.gdbinit: No such file or directory.
Reading symbols from /home/curtyc/Linux_kernel_source/linux-3.3/vmlinux...done.
866-gdb-set confirm off
866^done
(gdb) 
867-gdb-set width 0
867^done
(gdb) 
868-gdb-set height 0
868^done
(gdb) 
869-interpreter-exec console echo
869^done
(gdb) 
870-gdb-show prompt
870^done,value="(gdb) "
(gdb) 
871-gdb-set auto-solib-add off
871^done
(gdb) 
872-gdb-set stop-on-solib-events 0
872^done
(gdb) 
873-target-select remote localhost:1234
=thread-group-started,id="i1",pid="42000"
=thread-created,id="1",group-id="i1"
*stopped,frame={addr="0x0000000000000000",func="irq_stack_union",args=[]},thread-id="1",stopped-threads="all"
873^connected
(gdb) 
874 info proc
&"info proc\n"
&"Can't determine the current process's PID: you must name one.\n"
874^error,msg="Can't determine the current process's PID: you must name one."
(gdb) 
875-environment-cd /home/curtyc/Linux_kernel_source/linux-3.3
875^done
(gdb) 
876 info program
&"info program\n"
~"Debugging a target over a serial line.\n"
~"Program stopped at 0x0.\n"
~"It stopped with signal SIGTRAP, Trace/breakpoint trap.\n"
876^done
(gdb) 
877 info threads
&"info threads\n"
~"  Id   Target Id         Frame \n"
~"* 1    Thread 1 (CPU#0 [running]) 0x0000000000000000 in irq_stack_union ()\n"
877^done
(gdb) 
878-stack-info-depth
878^done,depth="2"
(gdb) 
879-stack-list-frames 0 2
879^done,stack=[frame={level="0",addr="0x0000000000000000",func="irq_stack_union"},frame={level="1",addr="0x0000000000000000",func="??"}]
(gdb) 
880-data-list-changed-registers
880^done,changed-registers=["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","73","74","75","76","77","78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","93","94","95","96","97","98","99","100","102","103","104","105","106","107","108","109","110","111","112","113","114","115","116","117","118","119","120","121","122","123","124","125"]
(gdb) 
881 info sharedlibrary
&"info sharedlibrary\n"
~"No shared libraries loaded at this time.\n"
881^done
(gdb) 
882-environment-directory

...
<many_directory_paths_excluded_without_problem_for_understanding>
...

(gdb) 
883-data-list-register-names
883^done,register-names=["rax","rbx","rcx","rdx","rsi","rdi","rbp","rsp","r8","r9","r10","r11","r12","r13","r14","r15","rip","eflags","cs","ss","ds","es","fs","gs","st0","st1","st2","st3","st4","st5","st6","st7","fctrl","fstat","ftag","fiseg","fioff","foseg","fooff","fop","xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7","xmm8","xmm9","xmm10","xmm11","xmm12","xmm13","xmm14","xmm15","mxcsr","","","","","","","","","","","","","","","","","orig_rax","al","bl","cl","dl","sil","dil","bpl","spl","r8l","r9l","r10l","r11l","r12l","r13l","r14l","r15l","ah","bh","ch","dh","ax","bx","cx","dx","si","di","bp","","r8w","r9w","r10w","r11w","r12w","r13w","r14w","r15w","eax","ebx","ecx","edx","esi","edi","ebp","esp","r8d","r9d","r10d","r11d","r12d","r13d","r14d","r15d"]
(gdb) 
884-break-insert -t init/main.c:start_kernel
884^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0xffffffff81cf083e",func="start_kernel",file="init/main.c",fullname="/home/curtyc/Linux_kernel_source/linux-3.3/init/main.c",line="464",times="0",original-location="init/main.c:start_kernel"}
(gdb) 
885-exec-continue
885^running
*running,thread-id="all"
(gdb) 
885^error,msg="Remote 'g' packet reply is too long:
00000000000000000090f700000000000090f70100000000020000000000000080dfd781ffffffffb0dfd781ffffffff781fc081ffffffff601fc081ffffffff0090f7000000000000000001000000000090f700000000000000000100000000200000000000000000f0dd81ffffffffa81fc081ffffffff00c00800000000003e08cf81ffffffff9600000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007f0300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000801f0000"
(gdb) 
886 info threads
&"info threads\n"
~"  Id   Target Id         Frame \n"
~"* 1    Thread 1 (CPU#0 [running]) (running)\n"
886^done
(gdb) 
887-stack-info-depth
887^error,msg="Target is executing."
(gdb) 
888-stack-info-depth
888^error,msg="Target is executing."
(gdb) 
889-stack-list-frames 0 1
889^error,msg="Target is executing."
(gdb) 
890-data-list-changed-registers
890^error,msg="Target is executing."
(gdb) 
------ cut here -------

Thanks in advance for your attention.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug server/13984] gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message
  2012-04-16  2:34 [Bug server/13984] New: gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message curty at ieee dot org
@ 2015-08-12 11:47 ` sarikayameh at gmail dot com
  2015-08-12 11:49 ` sarikayameh at gmail dot com
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sarikayameh at gmail dot com @ 2015-08-12 11:47 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=13984

Mehmet Ali SARIKAYA <sarikayameh at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sarikayameh at gmail dot com

--- Comment #1 from Mehmet Ali SARIKAYA <sarikayameh at gmail dot com> ---
Created attachment 8506
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8506&action=edit
gdb/remote.c change set

6064 /* Further sanity checks, with knowledge of the architecture. 
6065 //SunnyBeike
6066 
6067 // if (buf_len  > 2 * rsa->sizeof_g_packet) 
6068 // error (_("Remote 'g' packet reply is too long: %s"), rs->buf); 
6069 
6070    if(buf_len > 2 * rsa->sizeof_g_packet) {
6071         rsa->sizeof_g_packet = buf_len;
6072         for(i = 0; i < gdbarch_num_regs(gdbarch); i++){
6073             if(rsa->regs->pnum == -1)
6074                continue;
6075             if(rsa->regs->offset >= rsa->sizeof_g_packet)
6076                rsa->regs->in_g_packet = 0;
6077             else
6078                rsa->regs->in_g_packet = 1;
6079         } 
6080    }
6081

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug server/13984] gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message
  2012-04-16  2:34 [Bug server/13984] New: gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message curty at ieee dot org
  2015-08-12 11:47 ` [Bug server/13984] " sarikayameh at gmail dot com
@ 2015-08-12 11:49 ` sarikayameh at gmail dot com
  2015-08-12 11:50 ` sarikayameh at gmail dot com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sarikayameh at gmail dot com @ 2015-08-12 11:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=13984

--- Comment #2 from Mehmet Ali SARIKAYA <sarikayameh at gmail dot com> ---
6064 /* Further sanity checks, with knowledge of the architecture. 
6065 //SunnyBeike
6066 
6067 // if (buf_len  > 2 * rsa->sizeof_g_packet) 
6068 // error (_("Remote 'g' packet reply is too long: %s"), rs->buf); 
6069 
6070    if(buf_len > 2 * rsa->sizeof_g_packet) {
6071         rsa->sizeof_g_packet = buf_len;
6072         for(i = 0; i < gdbarch_num_regs(gdbarch); i++){
6073             if(rsa->regs->pnum == -1)
6074                continue;
6075             if(rsa->regs->offset >= rsa->sizeof_g_packet)
6076                rsa->regs->in_g_packet = 0;
6077             else
6078                rsa->regs->in_g_packet = 1;
6079         } 
6080    }
6081


/* These changes solve problem for newer version of gdb like 7.8* and 7.9* */

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug server/13984] gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message
  2012-04-16  2:34 [Bug server/13984] New: gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message curty at ieee dot org
  2015-08-12 11:47 ` [Bug server/13984] " sarikayameh at gmail dot com
  2015-08-12 11:49 ` sarikayameh at gmail dot com
@ 2015-08-12 11:50 ` sarikayameh at gmail dot com
  2015-08-12 12:55 ` ciro.santilli at gmail dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sarikayameh at gmail dot com @ 2015-08-12 11:50 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=13984

--- Comment #3 from Mehmet Ali SARIKAYA <sarikayameh at gmail dot com> ---
Comment on attachment 8506
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8506
gdb/remote.c change set

6064 /* Further sanity checks, with knowledge of the architecture. 
6065 //SunnyBeike
6066 
6067 // if (buf_len  > 2 * rsa->sizeof_g_packet) 
6068 // error (_("Remote 'g' packet reply is too long: %s"), rs->buf); 
6069 
6070    if(buf_len > 2 * rsa->sizeof_g_packet) {
6071         rsa->sizeof_g_packet = buf_len;
6072         for(i = 0; i < gdbarch_num_regs(gdbarch); i++){
6073             if(rsa->regs->pnum == -1)
6074                continue;
6075             if(rsa->regs->offset >= rsa->sizeof_g_packet)
6076                rsa->regs->in_g_packet = 0;
6077             else
6078                rsa->regs->in_g_packet = 1;
6079         } 
6080    }
6081

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug server/13984] gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message
  2012-04-16  2:34 [Bug server/13984] New: gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message curty at ieee dot org
                   ` (2 preceding siblings ...)
  2015-08-12 11:50 ` sarikayameh at gmail dot com
@ 2015-08-12 12:55 ` ciro.santilli at gmail dot com
  2015-08-12 12:57 ` ciro.santilli at gmail dot com
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ciro.santilli at gmail dot com @ 2015-08-12 12:55 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=13984

Ciro Santilli <ciro.santilli at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ciro.santilli at gmail dot com

--- Comment #4 from Ciro Santilli <ciro.santilli at gmail dot com> ---
@Mehmet can you please make a patch, send to the mailing list, and keep pinging
weekly until it gets reviewed?

I reproduce this by taking the following steps:

    # On kernel 4.1, set `CONFIG_DEBUG_INFO` and `CONFIG_GDB_SCRIPTS`.
    qemu-system-x86_64 -kernel ../build/arch/x86/boot/bzImage -initrd
rootfs.cpio.gz -S -s
    gdb -ex "add-auto-load-safe-path ${vmlinux_path}-gdb.py" \
        -ex "file ${vmlinux_path}" \
        -ex 'target remote localhost:1234'
    hbreak start_kernel
    continue

Then the:

    Remote 'g' packet reply is too long

message appears, QEMU stops (apparently at the right place) and for most
commands I run, e.g. continue, GDB says:

    (gdb) continue
    Continuing.
    Cannot execute this command while the selected thread is running.

`list` shows the wrong lines, not at `start_kernel` but around line 15. It is
the right file however: `init/main.c`.

If I do Ctrl + D GDB quits and QEMU continues booting as normal.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug server/13984] gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message
  2012-04-16  2:34 [Bug server/13984] New: gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message curty at ieee dot org
                   ` (3 preceding siblings ...)
  2015-08-12 12:55 ` ciro.santilli at gmail dot com
@ 2015-08-12 12:57 ` ciro.santilli at gmail dot com
  2015-08-12 13:07 ` ciro.santilli at gmail dot com
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ciro.santilli at gmail dot com @ 2015-08-12 12:57 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=13984

--- Comment #5 from Ciro Santilli <ciro.santilli at gmail dot com> ---
I'm on Ubuntu 14.04, GDB 7.7.1.

There has also been some discussion at:
https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/901944

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug server/13984] gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message
  2012-04-16  2:34 [Bug server/13984] New: gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message curty at ieee dot org
                   ` (4 preceding siblings ...)
  2015-08-12 12:57 ` ciro.santilli at gmail dot com
@ 2015-08-12 13:07 ` ciro.santilli at gmail dot com
  2015-08-12 17:08 ` sarikayameh at gmail dot com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ciro.santilli at gmail dot com @ 2015-08-12 13:07 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=13984

--- Comment #6 from Ciro Santilli <ciro.santilli at gmail dot com> ---
QEMU 2.0.0.

More related threads:

- http://stackoverflow.com/questions/8662468/remote-g-packet-reply-is-too-long
- https://bugzilla.redhat.com/show_bug.cgi?id=1097779
- https://www.sourceware.org/ml/gdb/2011-01/msg00001.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug server/13984] gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message
  2012-04-16  2:34 [Bug server/13984] New: gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message curty at ieee dot org
                   ` (5 preceding siblings ...)
  2015-08-12 13:07 ` ciro.santilli at gmail dot com
@ 2015-08-12 17:08 ` sarikayameh at gmail dot com
  2015-08-12 17:09 ` sarikayameh at gmail dot com
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sarikayameh at gmail dot com @ 2015-08-12 17:08 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=13984

--- Comment #7 from Mehmet Ali SARIKAYA <sarikayameh at gmail dot com> ---
Created attachment 8512
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8512&action=edit
gdb-7.9/gdb/remote.c patch file

I used this patch for solving "Remote 'g' packet reply is too long" error. This
patch solves problems if you take "Remote 'g' packet reply is too long" error. 
I tested it with gdb 7.9 but it can also be a solution for older version.

After applying this patch, gdb must recompile.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug server/13984] gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message
  2012-04-16  2:34 [Bug server/13984] New: gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message curty at ieee dot org
                   ` (6 preceding siblings ...)
  2015-08-12 17:08 ` sarikayameh at gmail dot com
@ 2015-08-12 17:09 ` sarikayameh at gmail dot com
  2015-08-12 21:01 ` ciro.santilli at gmail dot com
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sarikayameh at gmail dot com @ 2015-08-12 17:09 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=13984

Mehmet Ali SARIKAYA <sarikayameh at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Mehmet Ali SARIKAYA <sarikayameh at gmail dot com> ---
This patch will be a solution.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug server/13984] gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message
  2012-04-16  2:34 [Bug server/13984] New: gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message curty at ieee dot org
                   ` (7 preceding siblings ...)
  2015-08-12 17:09 ` sarikayameh at gmail dot com
@ 2015-08-12 21:01 ` ciro.santilli at gmail dot com
  2015-08-13 10:37 ` sarikayameh at gmail dot com
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ciro.santilli at gmail dot com @ 2015-08-12 21:01 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=13984

--- Comment #9 from Ciro Santilli <ciro.santilli at gmail dot com> ---
@Mehmet have you sent the patch to the mailing list / merged it yourself on the
tree? I could not find it. If not, this should not be marked as RESOLVED yet.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug server/13984] gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message
  2012-04-16  2:34 [Bug server/13984] New: gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message curty at ieee dot org
                   ` (8 preceding siblings ...)
  2015-08-12 21:01 ` ciro.santilli at gmail dot com
@ 2015-08-13 10:37 ` sarikayameh at gmail dot com
  2015-08-13 10:39 ` ciro.santilli at gmail dot com
  2023-09-12 14:49 ` konsolebox at gmail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: sarikayameh at gmail dot com @ 2015-08-13 10:37 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=13984

Mehmet Ali SARIKAYA <sarikayameh at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|FIXED                       |---
     Ever confirmed|1                           |0

--- Comment #10 from Mehmet Ali SARIKAYA <sarikayameh at gmail dot com> ---
I do not send it mail list. One of people should confirm this patch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug server/13984] gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message
  2012-04-16  2:34 [Bug server/13984] New: gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message curty at ieee dot org
                   ` (9 preceding siblings ...)
  2015-08-13 10:37 ` sarikayameh at gmail dot com
@ 2015-08-13 10:39 ` ciro.santilli at gmail dot com
  2023-09-12 14:49 ` konsolebox at gmail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: ciro.santilli at gmail dot com @ 2015-08-13 10:39 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=13984

--- Comment #11 from Ciro Santilli <ciro.santilli at gmail dot com> ---
@Mehmet from my (limited) experience, unless you ping the gdb-patches list
weekly, this patch is more likely to remain forgotten :-) Well if want let's
wait a bit and see, if it does not work I will email it myself and credit you
of course.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug server/13984] gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message
  2012-04-16  2:34 [Bug server/13984] New: gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message curty at ieee dot org
                   ` (10 preceding siblings ...)
  2015-08-13 10:39 ` ciro.santilli at gmail dot com
@ 2023-09-12 14:49 ` konsolebox at gmail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: konsolebox at gmail dot com @ 2023-09-12 14:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=13984

konsolebox <konsolebox at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |konsolebox at gmail dot com

--- Comment #16 from konsolebox <konsolebox at gmail dot com> ---
(In reply to Mehmet Ali SARIKAYA from comment #3)
> Comment on attachment 8506 [details]
> gdb/remote.c change set
> 
> 6064 /* Further sanity checks, with knowledge of the architecture. 
> 6065 //SunnyBeike
> 6066 
> 6067 // if (buf_len  > 2 * rsa->sizeof_g_packet) 
> 6068 // error (_("Remote 'g' packet reply is too long: %s"), rs->buf); 
> 6069 
> 6070    if(buf_len > 2 * rsa->sizeof_g_packet) {
> 6071         rsa->sizeof_g_packet = buf_len;
> 6072         for(i = 0; i < gdbarch_num_regs(gdbarch); i++){
> 6073             if(rsa->regs->pnum == -1)
> 6074                continue;
> 6075             if(rsa->regs->offset >= rsa->sizeof_g_packet)
> 6076                rsa->regs->in_g_packet = 0;
> 6077             else
> 6078                rsa->regs->in_g_packet = 1;
> 6079         } 
> 6080    }
> 6081

Hello Mehmet,

Thank you for sharing your patch.  It worked for me, at least by concept, but
did you miss adding index references to each rsa->regs element in the loop?

I modified it to make it work with 13.2 and also so that each loop refers to a
different rsa->regs element.  Kindly refer to it to see what I mean.

I also made it a bit simpler:

diff --git a/gdb/remote.c b/gdb/remote.c
index 218bca3..f715dec 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -8482,10 +8482,17 @@ remote_target::process_g_packet (struct regcache
*regcache)

   /* Further sanity checks, with knowledge of the architecture.  */
   if (buf_len > 2 * rsa->sizeof_g_packet)
-    error (_("Remote 'g' packet reply is too long (expected %ld bytes, got %d
"
-            "bytes): %s"),
-          rsa->sizeof_g_packet, buf_len / 2,
-          rs->buf.data ());
+    {
+      rsa->sizeof_g_packet = buf_len;
+
+      for (i = 0; i < gdbarch_num_regs (gdbarch); i++)
+       {
+         struct packet_reg *r = &rsa->regs[i];
+
+         if (r->pnum != -1)
+           r->in_g_packet = (r->offset >= rsa->sizeof_g_packet) ? 0 : 1;
+       }
+    }

   /* Save the size of the packet sent to us by the target.  It is used
      as a heuristic when determining the max size of packets that the

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-09-12 14:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-16  2:34 [Bug server/13984] New: gdb stops controlling a thread after "Remote 'g' packet reply is too long: ..." error message curty at ieee dot org
2015-08-12 11:47 ` [Bug server/13984] " sarikayameh at gmail dot com
2015-08-12 11:49 ` sarikayameh at gmail dot com
2015-08-12 11:50 ` sarikayameh at gmail dot com
2015-08-12 12:55 ` ciro.santilli at gmail dot com
2015-08-12 12:57 ` ciro.santilli at gmail dot com
2015-08-12 13:07 ` ciro.santilli at gmail dot com
2015-08-12 17:08 ` sarikayameh at gmail dot com
2015-08-12 17:09 ` sarikayameh at gmail dot com
2015-08-12 21:01 ` ciro.santilli at gmail dot com
2015-08-13 10:37 ` sarikayameh at gmail dot com
2015-08-13 10:39 ` ciro.santilli at gmail dot com
2023-09-12 14:49 ` konsolebox at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).