Skip to content

Commit

Permalink
gdb: fix remote reply packet length.
Browse files Browse the repository at this point in the history
From Ranjani in GDB 8.1, forward ported to 8.3.1

+From 90a51ab53bd761c4382f27ec1bbf8de0de215463 Mon Sep 17 00:00:00 2001
+From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
+Date: Thu, 11 Apr 2019 20:04:46 -0700
+Subject: [PATCH] fix error with packet reply too long

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
  • Loading branch information
lrgirdwo committed Feb 13, 2021
1 parent 498bf29 commit 03d056c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/gdb/8.3.1/0006-fix-remote-debug.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Index: gdb-8.3.1/gdb/remote.c
===================================================================
--- gdb-8.3.1.orig/gdb/remote.c
+++ gdb-8.3.1/gdb/remote.c
@@ -8035,11 +8035,17 @@ remote_target::process_g_packet (struct
buf_len = strlen (rs->buf.data ());

/* 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 ());
+ 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[i].pnum == -1)
+ continue;
+ if(rsa->regs[i].offset >= rsa->sizeof_g_packet)
+ rsa->regs[i].in_g_packet = 0;
+ else
+ rsa->regs[i].in_g_packet = 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

0 comments on commit 03d056c

Please sign in to comment.