summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorfche <fche>2005-08-21 12:11:41 +0000
committerfche <fche>2005-08-21 12:11:41 +0000
commit5e309481a22d06f4565cb3cb751d0679db0595a7 (patch)
treee0715d1df3a3c0c6907927d84e938023c82b106d /runtime
parentc03e045877248e394ec05921b672c066bdba5696 (diff)
downloadsystemtap-steved-5e309481a22d06f4565cb3cb751d0679db0595a7.tar.gz
systemtap-steved-5e309481a22d06f4565cb3cb751d0679db0595a7.tar.xz
systemtap-steved-5e309481a22d06f4565cb3cb751d0679db0595a7.zip
2005-08-21 Frank Ch. Eigler <fche@redhat.com>
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 <fche@redhat.com> * arith.c (*): Adapt to last_error context variable.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/ChangeLog4
-rw-r--r--runtime/arith.c22
2 files changed, 15 insertions, 11 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog
index f4f791dd..b9c92140 100644
--- a/runtime/ChangeLog
+++ b/runtime/ChangeLog
@@ -1,3 +1,7 @@
+2005-08-21 Frank Ch. Eigler <fche@redhat.com>
+
+ * arith.c (*): Adapt to last_error context variable.
+
2005-08-19 Frank Ch. Eigler <fche@elastic.org>
* arith.c (_stp_random_pm): New function.
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;
}