public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] Fix regressions caused by agent expression C++-ification
@ 2023-06-30 14:14 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-06-30 14:14 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Simon pointed out that my agent expression C++-ification patches
caused a regression with the native-gdbserver target board.  The bug
is that append_const is supposed to write in big-endian order, but I
switched this by mistake.
---
 gdb/ax-general.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index 26a27a0bcad..24101c63749 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -41,11 +41,11 @@ static void generic_ext (struct agent_expr *x, enum agent_op op, int n);
 static void
 append_const (struct agent_expr *x, LONGEST val, int n)
 {
-  int i;
-
-  for (i = n - 1; i >= 0; i--)
+  size_t len = x->buf.size ();
+  x->buf.resize (len + n);
+  for (int i = n - 1; i >= 0; i--)
     {
-      x->buf.push_back (val & 0xff);
+      x->buf[len + i] = val & 0xff;
       val >>= 8;
     }
 }
-- 
2.41.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-30 14:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-30 14:14 [pushed] Fix regressions caused by agent expression C++-ification Tom Tromey

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).