From 5e309481a22d06f4565cb3cb751d0679db0595a7 Mon Sep 17 00:00:00 2001 From: fche Date: Sun, 21 Aug 2005 12:11:41 +0000 Subject: 2005-08-21 Frank Ch. Eigler PR systemtap/1195, systemtap/1193 * elaborate.cxx (alias_expansion_builder): Set new block token. * parse.cxx (parse_symbol): Set new target_symbol token. * runtest.sh: Store more pertinent failure data. * tapsets.cxx (emit_probe_entries): Rewrite error-handling path. * translate.cxx (emit_common_header): Goodbye errorcount, hello last_error & last_stmt. (c_unparser::visit_statement): New "header" for all other stmts. (c_assignop, visit_binary_expression): Adapt to last_error. * tapset/builtin_logging.stp: Adapt to last_error. 2005-08-21 Frank Ch. Eigler * arith.c (*): Adapt to last_error context variable. --- runtime/arith.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'runtime/arith.c') diff --git a/runtime/arith.c b/runtime/arith.c index 0200afa6..b1759e2a 100644 --- a/runtime/arith.c +++ b/runtime/arith.c @@ -7,14 +7,14 @@ struct context; -void _stp_divmod64 (unsigned *errorcount, int64_t x, int64_t y, +void _stp_divmod64 (const char **error, int64_t x, int64_t y, int64_t *quo, int64_t *rem); /** Divide x by y. In case of overflow or division-by-zero, - * increment context errorcount, and return any old value. + * set context error string, and return any old value. */ -inline int64_t _stp_div64 (unsigned *errorcount, int64_t x, int64_t y) +inline int64_t _stp_div64 (const char **error, int64_t x, int64_t y) { if (likely ((x >= LONG_MIN && x <= LONG_MAX) && (y >= LONG_MIN && y <= LONG_MAX))) @@ -24,7 +24,7 @@ inline int64_t _stp_div64 (unsigned *errorcount, int64_t x, int64_t y) // check for division-by-zero and overflow if (unlikely (yy == 0 || (xx == LONG_MIN && yy == -1))) { - (*errorcount) ++; + *error = "divisor out of range"; return 0; } return xx / yy; @@ -32,16 +32,16 @@ inline int64_t _stp_div64 (unsigned *errorcount, int64_t x, int64_t y) else { int64_t quo = 0; - _stp_divmod64 (errorcount, x, y, &quo, NULL); + _stp_divmod64 (error, x, y, &quo, NULL); return quo; } } /** Modulo x by y. In case of overflow or division-by-zero, - * increment context errorcount, and return any old value. + * set context error string, and return any old value. */ -inline int64_t _stp_mod64 (unsigned *errorcount, int64_t x, int64_t y) +inline int64_t _stp_mod64 (const char **error, int64_t x, int64_t y) { if (likely ((x >= LONG_MIN && x <= LONG_MAX) && (y >= LONG_MIN && y <= LONG_MAX))) @@ -51,7 +51,7 @@ inline int64_t _stp_mod64 (unsigned *errorcount, int64_t x, int64_t y) // check for division-by-zero and overflow if (unlikely (yy == 0 || (xx == LONG_MIN && yy == -1))) { - (*errorcount) ++; + *error = "divisor out of range"; return 0; } return xx % yy; @@ -59,18 +59,18 @@ inline int64_t _stp_mod64 (unsigned *errorcount, int64_t x, int64_t y) else { int64_t rem = 0; - _stp_divmod64 (errorcount, x, y, NULL, &rem); + _stp_divmod64 (error, x, y, NULL, &rem); return rem; } } /** Perform general long division/modulus. */ -void _stp_divmod64 (unsigned *errorcount, int64_t x, int64_t y, +void _stp_divmod64 (const char **error, int64_t x, int64_t y, int64_t *quo, int64_t *rem) { // XXX: wimp out for now - (*errorcount) ++; + *error = "general division unsupported"; if (quo) *quo = 0; if (rem) *rem = 0; } -- cgit