summaryrefslogtreecommitdiffstats
path: root/translate.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'translate.cxx')
-rw-r--r--translate.cxx33
1 files changed, 24 insertions, 9 deletions
diff --git a/translate.cxx b/translate.cxx
index d81287ee..f7868ceb 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -4172,7 +4172,8 @@ c_unparser::visit_print_format (print_format* e)
int use_print = 0;
string format_string = print_format::components_to_string(components);
- if (tmp.size() == 0 || (tmp.size() == 1 && format_string == "%s"))
+ if ((tmp.size() == 0 && format_string.find("%%") == std::string::npos)
+ || (tmp.size() == 1 && format_string == "%s"))
use_print = 1;
else if (tmp.size() == 1
&& e->args[0]->tok->type == tok_string
@@ -4818,6 +4819,7 @@ dump_unwindsyms (Dwfl_Module *m,
// Emit symbol table & unwind data, plus any calls needed to register
// them with the runtime.
+void emit_symbol_data_done (unwindsym_dump_context*, systemtap_session&);
void
emit_symbol_data (systemtap_session& s)
@@ -4830,6 +4832,14 @@ emit_symbol_data (systemtap_session& s)
unwindsym_dump_context ctx = { s, kallsyms_out, 0, s.unwindsym_modules };
+ // Micro optimization, mainly to speed up tiny regression tests
+ // using just begin probe.
+ if (s.unwindsym_modules.size () == 0)
+ {
+ emit_symbol_data_done(&ctx, s);
+ return;
+ }
+
// XXX: copied from tapsets.cxx dwflpp::, sadly
static const char *debuginfo_path_arr = "+:.debug:/usr/lib/debug:build";
static const char *debuginfo_env_arr = getenv("SYSTEMTAP_DEBUGINFO_PATH");
@@ -4922,20 +4932,25 @@ emit_symbol_data (systemtap_session& s)
dwfl_end(dwfl);
}
+ emit_symbol_data_done (&ctx, s);
+}
+void
+emit_symbol_data_done (unwindsym_dump_context *ctx, systemtap_session& s)
+{
// Print out a definition of the runtime's _stp_modules[] globals.
- kallsyms_out << "\n";
- kallsyms_out << "static struct _stp_module *_stp_modules [] = {\n";
- for (unsigned i=0; i<ctx.stp_module_index; i++)
+ ctx->output << "\n";
+ ctx->output << "static struct _stp_module *_stp_modules [] = {\n";
+ for (unsigned i=0; i<ctx->stp_module_index; i++)
{
- kallsyms_out << "& _stp_module_" << i << ",\n";
+ ctx->output << "& _stp_module_" << i << ",\n";
}
- kallsyms_out << "};\n";
- kallsyms_out << "static unsigned _stp_num_modules = " << ctx.stp_module_index << ";\n";
+ ctx->output << "};\n";
+ ctx->output << "static unsigned _stp_num_modules = " << ctx->stp_module_index << ";\n";
// Some nonexistent modules may have been identified with "-d". Note them.
- for (set<string>::iterator it = ctx.undone_unwindsym_modules.begin();
- it != ctx.undone_unwindsym_modules.end();
+ for (set<string>::iterator it = ctx->undone_unwindsym_modules.begin();
+ it != ctx->undone_unwindsym_modules.end();
it ++)
{
s.print_warning ("missing unwind/symbol data for module '" + (*it) + "'");