From ba4a90fd18a9c94624a38d660c6e7ca6230c271f Mon Sep 17 00:00:00 2001 From: fche Date: Tue, 30 Aug 2005 01:54:44 +0000 Subject: 2005-08-29 Frank Ch. Eigler * stapprobes.5.in, stapfuncs.5.in, stapex.5.in: New man pages. * stap.1.in: Moved some content out. * Makefile.am (man_MANS): Add new man pages. * configure.ac (AC_CONFIG_FILES): Add them. * systemtap.spec.in: Package them. * Makefile.in, configure: Regenerated. * buildrun.cxx (run_pass): Pass "-r" to stpd. * translate.cxx (emit_common_header): Wrap try/catch around variable decls, to improve exception particularity. (visit_literal_number): Emit as unsigned literal, which is actually a subtle correctness issue. --- translate.cxx | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'translate.cxx') diff --git a/translate.cxx b/translate.cxx index 71241d00..a8d768ae 100644 --- a/translate.cxx +++ b/translate.cxx @@ -564,8 +564,15 @@ c_unparser::emit_common_header () for (unsigned j=0; jlocals.size(); j++) { vardecl* v = dp->locals[j]; - o->newline() << c_typename (v->type) << " " - << c_varname (v->name) << ";"; + try + { + o->newline() << c_typename (v->type) << " " + << c_varname (v->name) << ";"; + } catch (const semantic_error& e) { + semantic_error e2 (e); + if (e2.tok1 == 0) e2.tok1 = v->tok; + throw e2; + } } c_tmpcounter ct (this); dp->body->visit (& ct); @@ -580,15 +587,29 @@ c_unparser::emit_common_header () o->indent(1); for (unsigned j=0; jlocals.size(); j++) { - vardecl* v = fd->locals[j]; - o->newline() << c_typename (v->type) << " " - << c_varname (v->name) << ";"; + vardecl* v = fd->locals[j]; + try + { + o->newline() << c_typename (v->type) << " " + << c_varname (v->name) << ";"; + } catch (const semantic_error& e) { + semantic_error e2 (e); + if (e2.tok1 == 0) e2.tok1 = v->tok; + throw e2; + } } for (unsigned j=0; jformal_args.size(); j++) { vardecl* v = fd->formal_args[j]; - o->newline() << c_typename (v->type) << " " - << c_varname (v->name) << ";"; + try + { + o->newline() << c_typename (v->type) << " " + << c_varname (v->name) << ";"; + } catch (const semantic_error& e) { + semantic_error e2 (e); + if (e2.tok1 == 0) e2.tok1 = v->tok; + throw e2; + } } c_tmpcounter ct (this); fd->body->visit (& ct); @@ -1590,7 +1611,8 @@ c_unparser::visit_literal_number (literal_number* e) { // This looks ugly, but tries to be warning-free on 32- and 64-bit // hosts. - o->line() << "((uint64_t)" << e->value << "LL)"; + // NB: this needs to be signed! + o->line() << "((int64_t)" << e->value << "LL)"; } -- cgit