summaryrefslogtreecommitdiffstats
path: root/src/error.c
diff options
context:
space:
mode:
authorjolsa@redhat.com <jolsa@redhat.com>2011-11-11 19:42:52 -0500
committerJiri Olsa <Jiri Olsa jolsa@redhat.com>2011-11-13 11:06:42 +0100
commit291cd946a26bfd3a6edf1a232e1a2bf7888ddf42 (patch)
tree5e1243a9ca2bf8328e6b5627ca7821df5599f402 /src/error.c
parent78a2fe366cf23632dd561e34d849e7fceaefd017 (diff)
downloadlatrace-error_simulation.tar.gz
latrace-error_simulation.tar.xz
latrace-error_simulation.zip
Diffstat (limited to 'src/error.c')
-rw-r--r--src/error.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/error.c b/src/error.c
index ec457be..4a99889 100644
--- a/src/error.c
+++ b/src/error.c
@@ -407,9 +407,9 @@ static int automated_get_all_syms(struct lt_config_app *cfg,
}
lt_list_for_each_entry(ret, &run->head_return, list_run) {
- struct lt_error_app_return_sym *sym;
+ struct lt_error_app_return_sym *sym, *n;
- lt_list_for_each_entry(sym, &ret->head_sym, list) {
+ lt_list_for_each_entry_safe(sym, n, &ret->head_sym, list) {
lt_list_move_tail(&sym->list, sym_all);
count++;
}
@@ -644,6 +644,8 @@ static int process_run_automated(struct lt_config_app *cfg,
return -1;
while(1) {
+ PRINT_VERBOSE(cfg, 1, "round %d\n", n);
+
if (dir_run(cfg, dir, dir_base, run, n))
break;
@@ -671,7 +673,7 @@ static int process_go_automated(struct lt_config_app *cfg, char *dir,
{
struct lt_error_app_run *run;
- if (!automated_get_all_syms(cfg, go) <= 0)
+ if (automated_get_all_syms(cfg, go) <= 0)
return -1;
run = lt_list_first_entry(&go->head_run, struct lt_error_app_run, list_go);
@@ -1044,6 +1046,8 @@ int lt_error_app_init(struct lt_error_app *app)
int lt_error_config_write(struct lt_config_app *cfg, int fd)
{
+ struct lt_list_head *sym_all = &cfg->error_symbols_all;
+ struct lt_error_app_return_sym *sym;
struct lt_error_config *cfg_err = cfg->error_config;
int size = sizeof(struct lt_error_config);
@@ -1051,10 +1055,32 @@ int lt_error_config_write(struct lt_config_app *cfg, int fd)
size += cfg_err->sym_cnt * sizeof(struct lt_error_config_sym);
+ PRINT_VERBOSE(cfg, 1, "sym_cnt %d\n", cfg_err->sym_cnt);
+
if (size != write(fd, cfg_err, size)) {
perror("write failed");
return -1;
}
+ if (!cfg_err->automated)
+ return 0;
+
+ PRINT_VERBOSE(cfg, 1, "writing automated list info\n");
+
+ lt_list_for_each_entry(sym, sym_all, list) {
+ char symbol[LT_MAXNAME];
+ int len;
+
+ len = snprintf(symbol, LT_MAXNAME, "%s", sym->name);
+ if (len != write(fd, symbol, len)) {
+ perror("write failed");
+ return -1;
+ }
+ len = 0;
+ write(fd, &len, 1);
+ }
+
+ PRINT_VERBOSE(cfg, 1, "OK\n");
+
return 0;
}