diff options
author | Przemyslaw Pawelczyk <przemyslaw@pawelczyk.it> | 2009-10-13 14:44:29 +0200 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-10-13 12:25:36 -0700 |
commit | b15c465c2238a4414925c8f6bce15c89bdd93e44 (patch) | |
tree | ac9b887721d27e0ed7971f4dcc6f9eed385c0a19 /translate.cxx | |
parent | b45283807e0fd961447cd5aa91d1fbff98e1940a (diff) | |
download | systemtap-steved-b15c465c2238a4414925c8f6bce15c89bdd93e44.tar.gz systemtap-steved-b15c465c2238a4414925c8f6bce15c89bdd93e44.tar.xz systemtap-steved-b15c465c2238a4414925c8f6bce15c89bdd93e44.zip |
PR10257: Add support for sprint[ln](@hist_*).
* parse.cxx (parser::parse_symbol): Add sprint[ln] to @hist_* hack.
* runtime/stat-common.c: Replace reprint with new reprint_buf, add more
generic _stp_stat_print_histogram_buf and call it from the older one.
Also correct some formatting issues.
* translate.cxx (c_unparser::visit_print_format): Add sprint case.
Diffstat (limited to 'translate.cxx')
-rw-r--r-- | translate.cxx | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/translate.cxx b/translate.cxx index 1278a8d5..bc5d6158 100644 --- a/translate.cxx +++ b/translate.cxx @@ -4083,6 +4083,14 @@ c_tmpcounter::visit_print_format (print_format* e) arr->indexes[i]->visit(this); } } + + // And the result for sprint[ln](@hist_*) + if (!e->print_to_stream) + { + exp_type ty = pe_string; + tmpvar res = parent->gensym(ty); + res.declare(*parent); + } } else { @@ -4145,8 +4153,18 @@ c_unparser::visit_print_format (print_format* e) o->newline() << "c->last_stmt = " << lex_cast_qstring(*e->tok) << ";"; o->newline() << "goto out;"; o->newline(-1) << "} else"; - o->newline(1) << "_stp_stat_print_histogram (" << v->hist() << ", " << agg.value() << ");"; - o->indent(-1); + if (e->print_to_stream) + { + o->newline(1) << "_stp_stat_print_histogram (" << v->hist() << ", " << agg.value() << ");"; + o->indent(-1); + } + else + { + exp_type ty = pe_string; + tmpvar res = gensym (ty); + o->newline(1) << "_stp_stat_print_histogram_buf (" << res.value() << ", MAXSTRINGLEN, " << v->hist() << ", " << agg.value() << ");"; + o->newline(-1) << res.value() << ";"; + } } delete v; |