From: Jim Blandy <jimb@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: RFC: tracepoints: Use constant-size trace opcodes where possible
Date: Fri, 26 Oct 2007 23:18:00 -0000 [thread overview]
Message-ID: <m3r6jhbhgx.fsf@codesourcery.com> (raw)
The comments should explain what's going on here. The Linux
tracepoint agent was much simplified by restricting it to expressions
whose data size could be estimated in advance. This should have no
effect on other agents.
Okay to commit?
gdb/ChangeLog:
2007-10-25 Jim Blandy <jimb@codesourcery.com>
* ax-gdb.c (gen_traced_pop): Generate trace_quick or trace16
bytecodes whenever possible.
diff -r cdc626576c72 -r 84b7570f26f4 gdb/ax-gdb.c
--- a/gdb/ax-gdb.c Thu Oct 25 12:43:14 2007 -0700
+++ b/gdb/ax-gdb.c Thu Oct 25 12:47:24 2007 -0700
@@ -321,13 +321,22 @@ gen_traced_pop (struct agent_expr *ax, s
{
int length = TYPE_LENGTH (check_typedef (value->type));
- /* There's no point in trying to use a trace_quick bytecode
- here, since "trace_quick SIZE pop" is three bytes, whereas
- "const8 SIZE trace" is also three bytes, does the same
- thing, and the simplest code which generates that will also
- work correctly for objects with large sizes. */
- ax_const_l (ax, length);
- ax_simple (ax, aop_trace);
+ /* Try to generate a trace_quick here if we can. The
+ bytecode stream generated isn't any shorter ('quick <len>
+ pop' and 'const8 <len> trace' are both three bytes long),
+ but this simplifies agent expression evaluators that want
+ to be able to easily put an upper bound on the memory
+ that will be collected by an expression. */
+ if (length < 1 << 16)
+ {
+ ax_trace_quick (ax, length);
+ ax_simple (ax, aop_pop);
+ }
+ else
+ {
+ ax_const_l (ax, length);
+ ax_simple (ax, aop_trace);
+ }
}
break;
next reply other threads:[~2007-10-26 23:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-26 23:18 Jim Blandy [this message]
2007-10-27 8:17 ` Michael Snyder
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=m3r6jhbhgx.fsf@codesourcery.com \
--to=jimb@codesourcery.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