diff options
author | Tom Tromey <tom@tromey.com> | 2023-06-17 12:43:04 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-06-20 11:00:19 -0600 |
commit | 6f96f4854f1dcfa15c1ba87f76d868513bb14276 (patch) | |
tree | 172ad17431084c01adb3100bfcc981c0f70686a2 /gdb/remote.c | |
parent | 90db289d0d0f36d993788c9218bd1616f792eb08 (diff) | |
download | fsf-binutils-gdb-6f96f4854f1dcfa15c1ba87f76d868513bb14276.zip fsf-binutils-gdb-6f96f4854f1dcfa15c1ba87f76d868513bb14276.tar.gz fsf-binutils-gdb-6f96f4854f1dcfa15c1ba87f76d868513bb14276.tar.bz2 |
Use gdb::byte_vector in agent_expr
This changes agent_expr to use gdb::byte_vector rather than manually
reimplementing a vector.
Reviewed-by: John Baldwin <jhb@FreeBSD.org>
Diffstat (limited to 'gdb/remote.c')
-rw-r--r-- | gdb/remote.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index 513214c..7e3d6ad 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -10690,9 +10690,9 @@ remote_add_target_side_condition (struct gdbarch *gdbarch, /* Send conditions to the target. */ for (agent_expr *aexpr : bp_tgt->conditions) { - xsnprintf (buf, buf_end - buf, "X%x,", aexpr->len); + xsnprintf (buf, buf_end - buf, "X%x,", (int) aexpr->buf.size ()); buf += strlen (buf); - for (int i = 0; i < aexpr->len; ++i) + for (int i = 0; i < aexpr->buf.size (); ++i) buf = pack_hex_byte (buf, aexpr->buf[i]); *buf = '\0'; } @@ -10715,9 +10715,9 @@ remote_add_target_side_commands (struct gdbarch *gdbarch, cmds parameter. */ for (agent_expr *aexpr : bp_tgt->tcommands) { - sprintf (buf, "X%x,", aexpr->len); + sprintf (buf, "X%x,", (int) aexpr->buf.size ()); buf += strlen (buf); - for (int i = 0; i < aexpr->len; ++i) + for (int i = 0; i < aexpr->buf.size (); ++i) buf = pack_hex_byte (buf, aexpr->buf[i]); *buf = '\0'; } @@ -13383,7 +13383,7 @@ remote_target::download_tracepoint (struct bp_location *loc) size_left = buf.size () - strlen (buf.data ()); ret = snprintf (buf.data () + strlen (buf.data ()), - size_left, ":X%x,", aexpr->len); + size_left, ":X%x,", (int) aexpr->buf.size ()); if (ret < 0 || ret >= size_left) error ("%s", err_msg); @@ -13392,12 +13392,12 @@ remote_target::download_tracepoint (struct bp_location *loc) /* Two bytes to encode each aexpr byte, plus the terminating null byte. */ - if (aexpr->len * 2 + 1 > size_left) + if (aexpr->buf.size () * 2 + 1 > size_left) error ("%s", err_msg); pkt = buf.data () + strlen (buf.data ()); - for (int ndx = 0; ndx < aexpr->len; ++ndx) + for (int ndx = 0; ndx < aexpr->buf.size (); ++ndx) pkt = pack_hex_byte (pkt, aexpr->buf[ndx]); *pkt = '\0'; } |