diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-12-03 13:38:04 -0500 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-12-03 13:38:04 -0500 |
commit | 33d34a13b7632fada659a7ea2541c390dd31b541 (patch) | |
tree | 1949862da3b067056d7b8b978674bad4b2c703c9 /elaborate.cxx | |
parent | b5e66adadbad65fddc40a2143e3692e41cf6d1af (diff) | |
parent | 271d408e09e033857658c83cb722078fab02edda (diff) | |
download | systemtap-steved-33d34a13b7632fada659a7ea2541c390dd31b541.tar.gz systemtap-steved-33d34a13b7632fada659a7ea2541c390dd31b541.tar.xz systemtap-steved-33d34a13b7632fada659a7ea2541c390dd31b541.zip |
merged
* 'master' of ssh://sources.redhat.com/git/systemtap:
PR7053: Add checking empty aggregate and default print where @count==0.
Add man page entry for stap -B
Diffstat (limited to 'elaborate.cxx')
-rw-r--r-- | elaborate.cxx | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/elaborate.cxx b/elaborate.cxx index 84866c35..edd4668d 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -1243,7 +1243,43 @@ void add_global_var_display (systemtap_session& s) } else pf->args.push_back(g_sym); - b->statements.push_back(feb); + + /* PR7053: Checking empty aggregate for global variable */ + if (l->type == pe_stats) { + stat_op *so= new stat_op; + so->ctype = sc_count; + so->type = pe_long; + so->stat = g_sym; + so->tok = l->tok; + comparison *be = new comparison; + be->op = ">"; + be->tok = l->tok; + be->left = so; + be->right = new literal_number(0); + + /* Create printf @count=0x0 in else block */ + print_format* pf_0 = new print_format; + pf_0->print_to_stream = true; + pf_0->print_with_format = true; + pf_0->print_with_delim = false; + pf_0->print_with_newline = false; + pf_0->print_char = false; + pf_0->raw_components += l->name; + pf_0->raw_components += " @count=0x0\\n"; + pf_0->tok = print_tok; + pf_0->components = print_format::string_to_components(pf_0->raw_components); + expr_statement* feb_else = new expr_statement; + feb_else->value = pf_0; + feb_else->tok = print_tok; + if_statement *ifs = new if_statement; + ifs->tok = l->tok; + ifs->condition = be; + ifs->thenblock = feb ; + ifs->elseblock = feb_else; + b->statements.push_back(ifs); + } + else /* other non-stat cases */ + b->statements.push_back(feb); } else // Array { |