diff options
Diffstat (limited to 'src/error.c')
-rw-r--r-- | src/error.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/error.c b/src/error.c index 48afa23..7f0d985 100644 --- a/src/error.c +++ b/src/error.c @@ -548,6 +548,27 @@ static int add_error_symbol(struct lt_config_app *cfg, char *name) return index; } +static int copy_start_info(struct lt_config_app *cfg, + struct lt_error_config *cfg_err, + struct lt_error_app_run *run) +{ + struct lt_error_start *start = &run->start; + + cfg_err->start = *start; + + if (start->type == LT_ERROR_START_TYPE_AFTER) { + if (start->after.name.sym) { + int index = add_error_symbol(cfg, start->after.name.sym); + if (index < 0) + return -ENOMEM; + cfg_err->start.after.name.index = index; + } else + cfg_err->start.after.name.index = -1; + } + + return 0; +} + static int prepare_config_error(struct lt_config_app *cfg, struct lt_error_app_run *run) { @@ -591,6 +612,10 @@ static int prepare_config_error(struct lt_config_app *cfg, sym->name, cfg_sym->keep, cfg_sym->ret); } + /* copy the start information */ + if (copy_start_info(cfg, cfg_err, run)) + return -ENOMEM; + cfg_err->names_size = cfg->error_symbols_size_names; cfg->error_config = cfg_err; return 0; @@ -928,6 +953,31 @@ int lt_error_run_args(struct lt_config_app *cfg, return 0; } +int lt_error_run_start_after(struct lt_config_app *cfg, + struct lt_error_app_run **run, + int is_entries, long cnt, char *sym) +{ + struct lt_error_app_run *app_run = app_run_get(cfg, run); + struct lt_error_start *start; + + if (!app_run) + return -ENOMEM; + + PRINT_VERBOSE(cfg, 1, "is_entries %d, cnt %ld, sym %s\n", + is_entries, cnt, sym); + + start->type = LT_ERROR_START_TYPE_AFTER; + + start = &app_run->start; + if (is_entries) + start->after.entries = cnt; + else + start->after.exits = cnt; + + start->after.name.sym = sym; + return 0; +} + static struct lt_error_app_run *find_run(struct lt_config_app *cfg, struct lt_error_app *error_app, char *name) |