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/tracepoint.c | |
parent | 90db289d0d0f36d993788c9218bd1616f792eb08 (diff) | |
download | gdb-6f96f4854f1dcfa15c1ba87f76d868513bb14276.zip gdb-6f96f4854f1dcfa15c1ba87f76d868513bb14276.tar.gz 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/tracepoint.c')
-rw-r--r-- | gdb/tracepoint.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 0af7404..335df99 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -618,7 +618,7 @@ finalize_tracepoint_aexpr (struct agent_expr *aexpr) { ax_reqs (aexpr); - if (aexpr->len > MAX_AGENT_EXPR_LEN) + if (aexpr->buf.size () > MAX_AGENT_EXPR_LEN) error (_("Expression is too complicated.")); report_agent_reqs_errors (aexpr); @@ -885,7 +885,7 @@ collection_list::add_local_register (struct gdbarch *gdbarch, corresponding raw registers in the ax mask, but if this isn't the case add the expression that is generated to the collection list. */ - if (aexpr->len > 0) + if (aexpr->buf.size () > 0) add_aexpr (std::move (aexpr)); } } @@ -1215,18 +1215,19 @@ collection_list::stringify () for (i = 0; i < m_aexprs.size (); i++) { QUIT; /* Allow user to bail out with ^C. */ - if ((count + 10 + 2 * m_aexprs[i]->len) > MAX_AGENT_EXPR_LEN) + if ((count + 10 + 2 * m_aexprs[i]->buf.size ()) > MAX_AGENT_EXPR_LEN) { str_list.emplace_back (temp_buf.data (), count); count = 0; end = temp_buf.data (); } - sprintf (end, "X%08X,", m_aexprs[i]->len); + sprintf (end, "X%08X,", (int) m_aexprs[i]->buf.size ()); end += 10; /* 'X' + 8 hex digits + ',' */ count += 10; - end += 2 * bin2hex (m_aexprs[i]->buf, end, m_aexprs[i]->len); - count += 2 * m_aexprs[i]->len; + end += 2 * bin2hex (m_aexprs[i]->buf.data (), end, + m_aexprs[i]->buf.size ()); + count += 2 * m_aexprs[i]->buf.size (); } if (count != 0) |