From: "Edgar E. Iglesias" <[email protected]> When mapping function parameters into argument value dictionaries, make sure to keep a 1-to-1 mapping between indexes.
For STOP parameters, we insert a ARGTYPE_NONE value to fill out the argument value dictionary. Mainting correct is important because the various param expressions refer to eachother based on indexes. Signed-off-by: Edgar E. Iglesias <[email protected]> --- lens_default.c | 7 +++++++ output.c | 25 ++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/lens_default.c b/lens_default.c index 81025b1..c39fce9 100644 --- a/lens_default.c +++ b/lens_default.c @@ -302,6 +302,9 @@ toplevel_format_lens(struct lens *lens, FILE *stream, enum int_fmt_t int_fmt) { switch (value->type->type) { + case ARGTYPE_NONE: + return 0; + case ARGTYPE_VOID: return fprintf(stream, "<void>"); @@ -406,6 +409,8 @@ bool_lens_format_cb(struct lens *lens, FILE *stream, struct value *value, struct value_dict *arguments) { switch (value->type->type) { + case ARGTYPE_NONE: + return 0; case ARGTYPE_VOID: case ARGTYPE_FLOAT: case ARGTYPE_DOUBLE: @@ -490,6 +495,8 @@ string_lens_format_cb(struct lens *lens, FILE *stream, return format_array(stream, value, arguments, value->type->u.array_info.length, options.strlen, 0, "\"", "\"", ""); + case ARGTYPE_NONE: + return 0; } abort(); } diff --git a/output.c b/output.c index 8e4e616..d861537 100644 --- a/output.c +++ b/output.c @@ -292,6 +292,17 @@ fetch_param_stop(struct value_dict *arguments, ssize_t *params_leftp) { if (*params_leftp == -1) *params_leftp = val_dict_count(arguments); + + /* Insert a dummy arg to make sure expression indexes match. */ + struct value none_val; + struct arg_type_info *none_type = type_get_simple(ARGTYPE_NONE); + + value_init_detached(&none_val, NULL, none_type, 0); + + if (val_dict_push_next(arguments, &none_val) < 0) { + value_destroy(&none_val); + return; + } } static int @@ -408,13 +419,21 @@ output_params(struct value_dict *arguments, size_t start, size_t end, size_t i; int need_delim = *need_delimp; for (i = start; i < end; ++i) { - if (need_delim + int output_val = 1; + struct value *value = val_dict_get_num(arguments, i); + + if (value->type->type == ARGTYPE_NONE) + output_val = 0; + + if (need_delim && output_val && account_output(fprintf(options.output, ", ")) < 0) return -1; - struct value *value = val_dict_get_num(arguments, i); if (value == NULL) return -1; - need_delim = output_one(value, arguments); + + if (output_val) + need_delim = output_one(value, arguments); + if (need_delim < 0) return -1; } -- 1.7.8.6 _______________________________________________ Ltrace-devel mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/ltrace-devel
