From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/6] Remove mem2hex
Date: Mon, 19 Jun 2023 15:06:39 -0600 [thread overview]
Message-ID: <20230619-ax-new-v1-1-b26175d997a9@tromey.com> (raw)
In-Reply-To: <20230619-ax-new-v1-0-b26175d997a9@tromey.com>
tracepoint.c has a 'mem2hex' function that is functionally equivalent
to bin2hex. This patch removes the redundancy.
---
gdb/tracepoint.c | 30 ++----------------------------
1 file changed, 2 insertions(+), 28 deletions(-)
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index f297cea5b43..0af7404aef1 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -69,7 +69,7 @@
the worst case of maximum length for each of the pieces of a
continuation packet.
- NOTE: expressions get mem2hex'ed otherwise this would be twice as
+ NOTE: expressions get bin2hex'ed otherwise this would be twice as
large. (400 - 31)/2 == 184 */
#define MAX_AGENT_EXPR_LEN 184
@@ -156,7 +156,6 @@ static std::string trace_stop_notes;
/* support routines */
struct collection_list;
-static char *mem2hex (gdb_byte *, char *, int);
static counted_command_line all_tracepoint_actions (struct breakpoint *);
@@ -1226,7 +1225,7 @@ collection_list::stringify ()
end += 10; /* 'X' + 8 hex digits + ',' */
count += 10;
- end = mem2hex (m_aexprs[i]->buf, end, m_aexprs[i]->len);
+ end += 2 * bin2hex (m_aexprs[i]->buf, end, m_aexprs[i]->len);
count += 2 * m_aexprs[i]->len;
}
@@ -2888,31 +2887,6 @@ set_trace_stop_notes (const char *args, int from_tty,
warning (_("Target does not support trace notes, stop note ignored"));
}
-/* Convert the memory pointed to by mem into hex, placing result in buf.
- * Return a pointer to the last char put in buf (null)
- * "stolen" from sparc-stub.c
- */
-
-static const char hexchars[] = "0123456789abcdef";
-
-static char *
-mem2hex (gdb_byte *mem, char *buf, int count)
-{
- gdb_byte ch;
-
- while (count-- > 0)
- {
- ch = *mem++;
-
- *buf++ = hexchars[ch >> 4];
- *buf++ = hexchars[ch & 0xf];
- }
-
- *buf = 0;
-
- return buf;
-}
-
int
get_traceframe_number (void)
{
--
2.39.2
next prev parent reply other threads:[~2023-06-19 21:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-19 21:06 [PATCH 0/6] C++-ify and simplify agent expressions Tom Tromey
2023-06-19 21:06 ` Tom Tromey [this message]
2023-06-19 21:06 ` [PATCH 2/6] Use gdb::byte_vector in agent_expr Tom Tromey
2023-06-19 21:06 ` [PATCH 3/6] Use std::vector<bool> for agent_expr::reg_mask Tom Tromey
2023-06-20 15:30 ` John Baldwin
2023-06-20 17:04 ` Tom Tromey
2023-06-19 21:06 ` [PATCH 4/6] Simplify agent_expr constructor Tom Tromey
2023-06-19 21:06 ` [PATCH 5/6] Use bool for agent_expr::tracing Tom Tromey
2023-06-20 15:31 ` John Baldwin
2023-06-20 17:04 ` Tom Tromey
2023-06-19 21:06 ` [PATCH 6/6] Make aop_map 'static' Tom Tromey
2023-06-20 15:39 ` John Baldwin
2023-06-20 17:12 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230619-ax-new-v1-1-b26175d997a9@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).