diff options
Diffstat (limited to 'parse-events.c')
-rw-r--r-- | parse-events.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/parse-events.c b/parse-events.c index 53aad3e..406b28f 100644 --- a/parse-events.c +++ b/parse-events.c | |||
@@ -348,6 +348,27 @@ const char *pevent_find_function(struct pevent *pevent, unsigned long long addr) | |||
348 | } | 348 | } |
349 | 349 | ||
350 | /** | 350 | /** |
351 | * pevent_find_function_address - find a function address by a given address | ||
352 | * @pevent: handle for the pevent | ||
353 | * @addr: the address to find the function with | ||
354 | * | ||
355 | * Returns the address the function starts at. This can be used in | ||
356 | * conjunction with pevent_find_function to print both the function | ||
357 | * name and the function offset. | ||
358 | */ | ||
359 | unsigned long long | ||
360 | pevent_find_function_address(struct pevent *pevent, unsigned long long addr) | ||
361 | { | ||
362 | struct func_map *map; | ||
363 | |||
364 | map = find_func(pevent, addr); | ||
365 | if (!map) | ||
366 | return 0; | ||
367 | |||
368 | return map->addr; | ||
369 | } | ||
370 | |||
371 | /** | ||
351 | * pevent_register_function - register a function with a given address | 372 | * pevent_register_function - register a function with a given address |
352 | * @pevent: handle for the pevent | 373 | * @pevent: handle for the pevent |
353 | * @function: the function name to register | 374 | * @function: the function name to register |
@@ -3324,9 +3345,12 @@ const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid) | |||
3324 | void pevent_event_info(struct trace_seq *s, struct event_format *event, | 3345 | void pevent_event_info(struct trace_seq *s, struct event_format *event, |
3325 | struct record *record) | 3346 | struct record *record) |
3326 | { | 3347 | { |
3348 | int print_pretty = 1; | ||
3349 | |||
3327 | if (event->handler) | 3350 | if (event->handler) |
3328 | event->handler(s, record, event); | 3351 | print_pretty = event->handler(s, record, event); |
3329 | else | 3352 | |
3353 | if (print_pretty) | ||
3330 | pretty_print(s, record->data, record->size, event); | 3354 | pretty_print(s, record->data, record->size, event); |
3331 | 3355 | ||
3332 | trace_seq_terminate(s); | 3356 | trace_seq_terminate(s); |
@@ -3342,6 +3366,7 @@ void pevent_print_event(struct pevent *pevent, struct trace_seq *s, | |||
3342 | const char *comm; | 3366 | const char *comm; |
3343 | void *data = record->data; | 3367 | void *data = record->data; |
3344 | int size = record->size; | 3368 | int size = record->size; |
3369 | int print_pretty = 1; | ||
3345 | int type; | 3370 | int type; |
3346 | int pid; | 3371 | int pid; |
3347 | int len; | 3372 | int len; |
@@ -3376,8 +3401,9 @@ void pevent_print_event(struct pevent *pevent, struct trace_seq *s, | |||
3376 | trace_seq_printf(s, "%.*s", 20 - len, spaces); | 3401 | trace_seq_printf(s, "%.*s", 20 - len, spaces); |
3377 | 3402 | ||
3378 | if (event->handler) | 3403 | if (event->handler) |
3379 | event->handler(s, record, event); | 3404 | print_pretty = event->handler(s, record, event); |
3380 | else | 3405 | |
3406 | if (print_pretty) | ||
3381 | pretty_print(s, data, size, event); | 3407 | pretty_print(s, data, size, event); |
3382 | 3408 | ||
3383 | trace_seq_terminate(s); | 3409 | trace_seq_terminate(s); |