diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-10-19 22:41:26 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-10-19 23:36:09 +0200 |
commit | 4636f4831c9430b1858d54539f0c0ddc1b4e564a (patch) | |
tree | d68f746357182df5422a90f69bcbebe2c0ca1b0e /lib.c | |
parent | 3edf942ac85a90707e57d9e251004459aa6b4cea (diff) |
lib: let die() report the calling function, not itself
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -578,9 +578,17 @@ static struct json_object * ut_die(struct ut_state *s, uint32_t off, struct json_object *args) { const char *msg = json_object_get_string(json_object_array_get_idx(args, 0)); - struct ut_op *op = ut_get_op(s, off); + struct ut_function *prev_fn; + struct json_object *ex; + + prev_fn = s->function; + s->function = s->callstack->function; + + ex = ut_new_exception(s, s->callstack->off, "%s", msg ? msg : "Died"); + + s->function = prev_fn; - return ut_new_exception(s, op->off, "%s", msg ? msg : "Died"); + return ex; } static struct json_object * |