]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix regressions caused by agent expression C++-ification
authorTom Tromey <tom@tromey.com>
Fri, 30 Jun 2023 01:38:10 +0000 (19:38 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 30 Jun 2023 14:11:20 +0000 (08:11 -0600)
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

index 26a27a0bcadc95b6097055c60428f519a5e8bca3..24101c637494eede5a6bcdab728ff673524e3dd7 100644 (file)
@@ -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;
     }
 }