From: Hui Zhu <teawater@gmail.com>
To: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] tracepoint: add new trace command "printf"[1] gdbserver
Date: Fri, 28 Jan 2011 06:41:00 -0000 [thread overview]
Message-ID: <AANLkTim4+iQZHQhFrQBp-dz_jh65KsM45JZ6nR0qnHTi@mail.gmail.com> (raw)
In-Reply-To: <AANLkTikPdWq8kQWs0f4B3XdYmjHx5LshN5K_Xt=DMx29@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 630 bytes --]
On Tue, Jan 4, 2011 at 00:29, Hui Zhu <teawater@gmail.com> wrote:
> This patch is for the gdbserver.
>
> 2011-01-04 Hui Zhu <teawater@gmail.com>
>
> * tracepoint.c (gdb_agent_op): Add gdb_agent_op_printf.
> (gdb_agent_op_names): Add "printf".
> (tp_printf): New function.
> (eval_agent_expr): Handle gdb_agent_op_printf.
>
Fix a build error in i386.
Thanks,
Hui
2011-01-28 Hui Zhu <teawater@gmail.com>
* tracepoint.c (gdb_agent_op): Add gdb_agent_op_printf.
(gdb_agent_op_names): Add "printf".
(tp_printf): New function.
(eval_agent_expr): Handle gdb_agent_op_printf.
[-- Attachment #2: tp_print_server.txt --]
[-- Type: text/plain, Size: 1480 bytes --]
---
gdbserver/tracepoint.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
--- a/gdbserver/tracepoint.c
+++ b/gdbserver/tracepoint.c
@@ -517,6 +517,7 @@ enum gdb_agent_op
gdb_agent_op_setv = 0x2d,
gdb_agent_op_tracev = 0x2e,
gdb_agent_op_trace16 = 0x30,
+ gdb_agent_op_printf = 0x31,
gdb_agent_op_last
};
@@ -571,6 +572,7 @@ static const char *gdb_agent_op_names [g
"tracev",
"?undef?",
"trace16",
+ "printf",
};
struct agent_expr
@@ -4292,6 +4294,16 @@ unparse_agent_expr (struct agent_expr *a
#endif
+int
+tp_printf(const char *format, ...)
+{
+ va_list ap;
+ va_start (ap, format);
+ vprintf (format, ap);
+ va_end(ap);
+ return 0;
+}
+
/* The agent expression evaluator, as specified by the GDB docs. It
returns 0 if everything went OK, and a nonzero error code
otherwise. */
@@ -4634,6 +4646,22 @@ eval_agent_expr (struct tracepoint_hit_c
agent_tsv_read (tframe, arg);
break;
+ case gdb_agent_op_printf:
+ {
+ void *argv;
+ arg = aexpr->bytes[pc++];
+ argv = (void *)(unsigned long)top;
+ if (--sp >= 0)
+ top = stack[sp];
+
+ if (arg)
+ tp_printf ((char *)(aexpr->bytes + pc), argv);
+ else
+ tp_printf ((char *)(aexpr->bytes + pc));
+ pc += strlen ((char *)aexpr->bytes + pc) + 1;
+ }
+ break;
+
/* GDB never (currently) generates any of these ops. */
case gdb_agent_op_float:
case gdb_agent_op_ref_float:
next prev parent reply other threads:[~2011-01-28 5:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-03 16:29 Hui Zhu
2011-01-28 6:41 ` Hui Zhu [this message]
2011-02-04 16:01 ` Hui Zhu
2011-02-11 21:31 ` Tom Tromey
2011-02-17 9:54 ` Hui Zhu
2011-02-21 8:18 ` Hui Zhu
2011-02-24 7:46 ` Joel Brobecker
2011-02-24 8:37 ` Hui Zhu
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=AANLkTim4+iQZHQhFrQBp-dz_jh65KsM45JZ6nR0qnHTi@mail.gmail.com \
--to=teawater@gmail.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).