From 1d6a078afaed8b33862818062afb554ba0ca023b Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Tue, 16 Oct 2018 10:00:45 +0900 Subject: [PATCH] mcexec: add --debug-mcexec We already have debug statements compiled in, add a toggle for it Also fix case indent for 's' Change-Id: I1104ee57d571b82ec5e061f22cd44033a5c7fc39 --- executer/user/mcexec.c | 43 ++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/executer/user/mcexec.c b/executer/user/mcexec.c index 181a4685..3a134d94 100644 --- a/executer/user/mcexec.c +++ b/executer/user/mcexec.c @@ -1874,6 +1874,12 @@ static struct option mcexec_options[] = { .flag = &enable_uti, .val = 1, }, + { + .name = "debug-mcexec", + .has_arg = no_argument, + .flag = &debug, + .val = 1, + }, /* end */ { NULL, 0, NULL, 0, }, }; @@ -2156,9 +2162,11 @@ int main(int argc, char **argv) /* Parse options ("+" denotes stop at the first non-option) */ #ifdef ADD_ENVS_OPTION - while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:e:s:m:u:", mcexec_options, NULL)) != -1) { + while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:e:s:m:u:", + mcexec_options, NULL)) != -1) { #else /* ADD_ENVS_OPTION */ - while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:s:m:u:", mcexec_options, NULL)) != -1) { + while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:s:m:u:", + mcexec_options, NULL)) != -1) { #endif /* ADD_ENVS_OPTION */ switch (opt) { char *tmp; @@ -2205,21 +2213,24 @@ int main(int argc, char **argv) break; #endif /* ADD_ENVS_OPTION */ - case 's': { - char *token, *dup, *line; - dup = strdup(optarg); - line = dup; - token = strsep(&line, ","); - if (token != NULL && *token != 0) { - stack_premap = atobytes(token); + case 's': { + char *token, *dup, *line; + + dup = strdup(optarg); + line = dup; + token = strsep(&line, ","); + if (token != NULL && *token != 0) { + stack_premap = atobytes(token); + } + token = strsep(&line, ","); + if (token != NULL && *token != 0) { + stack_max = atobytes(token); + } + free(dup); + __dprintf("stack_premap=%ld,stack_max=%ld\n", + stack_premap, stack_max); + break; } - token = strsep(&line, ","); - if (token != NULL && *token != 0) { - stack_max = atobytes(token); - } - free(dup); - __dprintf("stack_premap=%ld,stack_max=%ld\n", stack_premap, stack_max); - break; } case 'u': uti_thread_rank = atoi(optarg);