diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | translate.cxx | 14 |
2 files changed, 16 insertions, 4 deletions
@@ -1,3 +1,9 @@ +2006-01-17 Josh Stone <joshua.i.stone@intel.com> + + PR 2156 + * translate.cxx (c_unparser::visit_foreach_loop): Check the return + value of _stp_pmap_agg() for NULL. + 2006-01-17 Frank Ch. Eigler <fche@elastic.org> * systemtap.spec.in: Remove explicit kernel-devel dependency, diff --git a/translate.cxx b/translate.cxx index 01179e2f..ba383682 100644 --- a/translate.cxx +++ b/translate.cxx @@ -2021,11 +2021,17 @@ c_unparser::visit_foreach_loop (foreach_loop *s) if (mv.is_parallel()) { varlock_w agg_and_maybe_sort_guard(*this, mv); - o->newline() << mv.calculate_aggregate() << ";"; + o->newline() << "if (unlikely(NULL == " << mv.calculate_aggregate() << "))"; + o->newline(1) << "c->last_error = \"unknown error while aggregating " << mv << "\";"; + o->indent(-1); + // sort array if desired - if (s->sort_direction) - o->newline() << "_stp_map_sort (" << mv.fetch_existing_aggregate() << ", " - << s->sort_column << ", " << - s->sort_direction << ");"; + if (s->sort_direction) { + o->newline() << "else"; // only sort if aggregation was ok + o->newline(1) << "_stp_map_sort (" << mv.fetch_existing_aggregate() << ", " + << s->sort_column << ", " << - s->sort_direction << ");"; + o->indent(-1); + } } else { |