[RFC PATCH] Fix segmentation fault of listing kprocess.create
Wenji Huang
wenji.huang@oracle.com
Fri Nov 6 01:08:00 GMT 2009
fche@redhat.com wrote:
>>> /* trick from visit_target_symbol_context */
>>> target_symbol *tsym = new target_symbol;
>>> token *t = new token;
>>> tsym->tok = t;
>>> tsym->base_name = "$";
>>> tsym->base_name += arg_name;
>
> Right, such an empty token should not exist. (We may be able to
> remove this default constructor and force clients to fill in the
> fields immediately.)
>
> When synthesizing new parse tree structures, the token pointer
> assigned to the new objects usually relates to the original
> script-level object that caused the synthesis. So for example in a
> return probe that uses a saved entry-time $var, a whole new synthetic
> probe and global variables could all be assigned to the same "$var"
> token.
>
> Perhaps the recently introduced saveargs() function should be supplied
> with an appropriate token*, for examples q.base_probe->tok.
The empty token is from my patch for 10820, sorry for the
error. Maybe the following patch can fix that.
Regards,
Wenji
diff --git a/tapsets.cxx b/tapsets.cxx
index d2c3334..17e315e 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -2928,6 +2928,14 @@ dwarf_derived_probe::saveargs(dwarf_query& q,
Dwarf_Die* scope_die, dwarf_var_ex
/* trick from visit_target_symbol_context */
target_symbol *tsym = new target_symbol;
token *t = new token;
+ /* We hypothesize accessing the argument
+ * The source_loc will be base_loc since no real one */
+ t->content = "$";
+ t->content += arg_name;
+ t->type = tok_identifier;
+ t->location.file = q.base_loc->tok->location.file;
+ t->location.column = q.base_loc->tok->location.column;
+ t->location.line = q.base_loc->tok->location.line;
tsym->tok = t;
tsym->base_name = "$";
tsym->base_name += arg_name;
More information about the Systemtap
mailing list