diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-11-16 11:01:36 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-11-16 11:01:36 -0500 |
commit | 112b5bb4a69dddf88a7d4607566e67ff80910083 (patch) | |
tree | 8ba76c25f56d5c169915c34b2f6e110dad9bbbc7 | |
parent | 93b3117efefb9d4f4b5b1fe751aa706f6d569af7 (diff) |
parse-events: Add PRINT_BPRINTK to separate bprintk strings from dynamic
When bprintk had a "%s",string format, the args for the bprintk used
a dynamic string arg for the string. Unfortunately, this would cause
the string to not be found and nothing would be printed.
This patch adds a special PRINT_BPRINTK type that lets the processing
do something special with the bprintk strings.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | parse-events.c | 10 | ||||
-rw-r--r-- | parse-events.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/parse-events.c b/parse-events.c index b6abd51..f0b0324 100644 --- a/parse-events.c +++ b/parse-events.c | |||
@@ -682,6 +682,7 @@ static void free_arg(struct print_arg *arg) | |||
682 | free_arg(arg->typecast.item); | 682 | free_arg(arg->typecast.item); |
683 | break; | 683 | break; |
684 | case PRINT_STRING: | 684 | case PRINT_STRING: |
685 | case PRINT_BSTRING: | ||
685 | free(arg->string.string); | 686 | free(arg->string.string); |
686 | break; | 687 | break; |
687 | case PRINT_DYNAMIC_ARRAY: | 688 | case PRINT_DYNAMIC_ARRAY: |
@@ -1983,6 +1984,7 @@ static long long arg_num_eval(struct print_arg *arg) | |||
1983 | case PRINT_NULL: | 1984 | case PRINT_NULL: |
1984 | case PRINT_FIELD ... PRINT_SYMBOL: | 1985 | case PRINT_FIELD ... PRINT_SYMBOL: |
1985 | case PRINT_STRING: | 1986 | case PRINT_STRING: |
1987 | case PRINT_BSTRING: | ||
1986 | default: | 1988 | default: |
1987 | die("invalid eval type %d", arg->type); | 1989 | die("invalid eval type %d", arg->type); |
1988 | 1990 | ||
@@ -2008,6 +2010,7 @@ static char *arg_eval (struct print_arg *arg) | |||
2008 | case PRINT_NULL: | 2010 | case PRINT_NULL: |
2009 | case PRINT_FIELD ... PRINT_SYMBOL: | 2011 | case PRINT_FIELD ... PRINT_SYMBOL: |
2010 | case PRINT_STRING: | 2012 | case PRINT_STRING: |
2013 | case PRINT_BSTRING: | ||
2011 | default: | 2014 | default: |
2012 | die("invalid eval type %d", arg->type); | 2015 | die("invalid eval type %d", arg->type); |
2013 | break; | 2016 | break; |
@@ -2884,6 +2887,7 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg | |||
2884 | val = eval_num_arg(data, size, event, arg->typecast.item); | 2887 | val = eval_num_arg(data, size, event, arg->typecast.item); |
2885 | return eval_type(val, arg, 0); | 2888 | return eval_type(val, arg, 0); |
2886 | case PRINT_STRING: | 2889 | case PRINT_STRING: |
2890 | case PRINT_BSTRING: | ||
2887 | return 0; | 2891 | return 0; |
2888 | case PRINT_FUNC: { | 2892 | case PRINT_FUNC: { |
2889 | struct trace_seq s; | 2893 | struct trace_seq s; |
@@ -3160,6 +3164,9 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, | |||
3160 | print_str_to_seq(s, format, len_arg, ((char *)data) + str_offset); | 3164 | print_str_to_seq(s, format, len_arg, ((char *)data) + str_offset); |
3161 | break; | 3165 | break; |
3162 | } | 3166 | } |
3167 | case PRINT_BSTRING: | ||
3168 | trace_seq_printf(s, format, arg->string.string); | ||
3169 | break; | ||
3163 | case PRINT_OP: | 3170 | case PRINT_OP: |
3164 | /* | 3171 | /* |
3165 | * The only op for string should be ? : | 3172 | * The only op for string should be ? : |
@@ -3341,7 +3348,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc | |||
3341 | case 's': | 3348 | case 's': |
3342 | arg = alloc_arg(); | 3349 | arg = alloc_arg(); |
3343 | arg->next = NULL; | 3350 | arg->next = NULL; |
3344 | arg->type = PRINT_STRING; | 3351 | arg->type = PRINT_BSTRING; |
3345 | arg->string.string = strdup(bptr); | 3352 | arg->string.string = strdup(bptr); |
3346 | bptr += strlen(bptr) + 1; | 3353 | bptr += strlen(bptr) + 1; |
3347 | *next = arg; | 3354 | *next = arg; |
@@ -4115,6 +4122,7 @@ static void print_args(struct print_arg *args) | |||
4115 | printf(")"); | 4122 | printf(")"); |
4116 | break; | 4123 | break; |
4117 | case PRINT_STRING: | 4124 | case PRINT_STRING: |
4125 | case PRINT_BSTRING: | ||
4118 | printf("__get_str(%s)", args->string.string); | 4126 | printf("__get_str(%s)", args->string.string); |
4119 | break; | 4127 | break; |
4120 | case PRINT_TYPE: | 4128 | case PRINT_TYPE: |
diff --git a/parse-events.h b/parse-events.h index efbf8d4..fe24ae7 100644 --- a/parse-events.h +++ b/parse-events.h | |||
@@ -192,6 +192,7 @@ enum print_arg_type { | |||
192 | PRINT_SYMBOL, | 192 | PRINT_SYMBOL, |
193 | PRINT_TYPE, | 193 | PRINT_TYPE, |
194 | PRINT_STRING, | 194 | PRINT_STRING, |
195 | PRINT_BSTRING, | ||
195 | PRINT_DYNAMIC_ARRAY, | 196 | PRINT_DYNAMIC_ARRAY, |
196 | PRINT_OP, | 197 | PRINT_OP, |
197 | PRINT_FUNC, | 198 | PRINT_FUNC, |