summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--tapsets.cxx14
2 files changed, 14 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index bd826548..81eb8b53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-11-10 David Smith <dsmith@redhat.com>
+
+ * tapsets.cxx
+ (dwarf_var_expanding_copy_visitor::visit_target_symbol): Minor
+ improvement to error handling by throwing exceptions before
+ allocations are done.
+
2006-11-10 Frank Ch. Eigler <fche@elastic.org>
* stap.1.in: On urging of Adam Jackson, add blurbs on array syntax
diff --git a/tapsets.cxx b/tapsets.cxx
index 01b4ef74..d8e068d8 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -2890,23 +2890,23 @@ dwarf_var_expanding_copy_visitor::visit_target_symbol (target_symbol *e)
{
assert(e->base_name.size() > 0 && e->base_name[0] == '$');
+ bool lvalue = is_active_lvalue(e);
+ if (lvalue && !q.sess.guru_mode)
+ throw semantic_error("write to target variable not permitted", e->tok);
+
+ if (q.has_return && e->base_name != "$return")
+ throw semantic_error("target variables not available to .return probes");
+
// Synthesize a function.
functiondecl *fdecl = new functiondecl;
fdecl->tok = e->tok;
embeddedcode *ec = new embeddedcode;
ec->tok = e->tok;
- bool lvalue = is_active_lvalue(e);
-
- if (lvalue && !q.sess.guru_mode)
- throw semantic_error("write to target variable not permitted", e->tok);
string fname = (string(lvalue ? "_dwarf_tvar_set" : "_dwarf_tvar_get")
+ "_" + e->base_name.substr(1)
+ "_" + lex_cast<string>(tick++));
- if (q.has_return && e->base_name != "$return")
- throw semantic_error ("target variables not available to .return probes");
-
try
{
if (q.has_return && e->base_name == "$return")