Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 367
Add logger runtime trace level change possibility#2965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
c01811b408aa4b4ffb31e2efa5c3f4a3d98277c839File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -3,6 +3,8 @@ | ||
| add_executable(sof-logger | ||
| logger.c | ||
| convert.c | ||
| filter.c | ||
| misc.c | ||
| ) | ||
| target_compile_options(sof-logger PRIVATE | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -5,7 +5,6 @@ | ||
| // Author: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com> | ||
| // Artur Kloniecki <arturx.kloniecki@linux.intel.com> | ||
| #include <stdarg.h> | ||
| #include <stdlib.h> | ||
| #include <stdint.h> | ||
| #include <string.h> | ||
| @@ -16,6 +15,8 @@ | ||
| #include <user/abi_dbg.h> | ||
| #include <user/trace.h> | ||
| #include "convert.h" | ||
| #include "filter.h" | ||
| #include "misc.h" | ||
| #define CEIL(a, b) ((a+b-1)/b) | ||
| @@ -52,67 +53,6 @@ struct proc_ldc_entry { | ||
| static const char *BAD_PTR_STR = "<bad uid ptr %x>"; | ||
| char *vasprintf(const char *format, va_list args) | ||
| { | ||
| va_list args_copy; | ||
| int size; | ||
| char localbuf[1]; | ||
| char *result; | ||
| va_copy(args_copy, args); | ||
| size = vsnprintf(localbuf, 1, format, args_copy); | ||
| va_end(args_copy); | ||
| result = calloc(1, size + 1); | ||
| if (result) | ||
| vsnprintf(result, size + 1, format, args); | ||
| return result; | ||
| } | ||
| char *asprintf(const char *format, ...) | ||
| { | ||
| va_list args; | ||
| char *result; | ||
| va_start(args, format); | ||
| result = vasprintf(format, args); | ||
| va_end(args); | ||
| return result; | ||
| } | ||
| static void log_err(FILE *out_fd, const char *fmt, ...) | ||
| { | ||
| static const char prefix[] = "error: "; | ||
| ssize_t needed_size; | ||
| va_list args, args_alloc; | ||
| char *buff; | ||
| va_start(args, fmt); | ||
| va_copy(args_alloc, args); | ||
| needed_size = vsnprintf(NULL, 0, fmt, args_alloc) + 1; | ||
| buff = malloc(needed_size); | ||
| va_end(args_alloc); | ||
| if (buff) { | ||
| vsprintf(buff, fmt, args); | ||
| fprintf(stderr, "%s%s", prefix, buff); | ||
| /* take care about out_fd validity and duplicated logging */ | ||
| if (out_fd && out_fd != stderr && out_fd != stdout) { | ||
| fprintf(out_fd, "%s%s", prefix, buff); | ||
| fflush(out_fd); | ||
| } | ||
| free(buff); | ||
| } else { | ||
| fprintf(stderr, "%s", prefix); | ||
| vfprintf(stderr, fmt, args); | ||
| } | ||
| va_end(args); | ||
| } | ||
| char *format_uid_raw(const struct sof_uuid_entry *uid_entry, int use_colors, | ||
| int name_first) | ||
| { | ||
| @@ -141,6 +81,25 @@ get_uuid_entry(const struct snd_sof_uids_header *uids_dict, uint32_t uid_ptr) | ||
| uids_dict->base_address); | ||
| } | ||
| /* | ||
| * Use uids dictionary content, to convert address of uuid `entry` from logger | ||
| * memory space to corresponding uuid key address used in firmware trace system | ||
| * (with base UUID_ENTRY_ELF_BASE, 0x1FFFA000 as usual). Function get_uuid_entry | ||
| * works in oppopsite direction. | ||
| */ | ||
| uint32_t get_uuid_key(const struct snd_sof_uids_header *uids_dict, | ||
ktrzcinx marked this conversation as resolved.
Outdated
Uh oh!There was an error while loading. Please reload this page. | ||
| const struct sof_uuid_entry *entry) | ||
| { | ||
| /* | ||
| * uids_dict->data_offset and uids_dict->base_address are both constants, | ||
| * related with given ldc file. | ||
| * Uuid address used in firmware, points unusable memory region, | ||
| * so its treated as key value. | ||
| */ | ||
| return (uintptr_t)entry - (uintptr_t)uids_dict - | ||
ktrzcinx marked this conversation as resolved.
Outdated
Uh oh!There was an error while loading. Please reload this page. | ||
| uids_dict->data_offset + uids_dict->base_address; | ||
| } | ||
| const char *format_uid(const struct snd_sof_uids_header *uids_dict, | ||
| uint32_t uid_ptr, | ||
| int use_colors) | ||
| @@ -715,8 +674,7 @@ static int dump_ldc_info(struct convert_config *config, | ||
| while (remaining > 0) { | ||
| name = format_uid_raw(&uid_ptr[cnt], 0, 0); | ||
| uid_addr = (uintptr_t)&uid_ptr[cnt] - (uintptr_t)uids_dict - | ||
| uids_dict->data_offset + uids_dict->base_address; | ||
| uid_addr = get_uuid_key(uids_dict, &uid_ptr[cnt]); | ||
| fprintf(out_fd, "\t0x%lX %s\n", uid_addr, name); | ||
| if (name) { | ||
| @@ -806,5 +764,15 @@ int convert(struct convert_config *config) | ||
| if (config->dump_ldc) | ||
| return dump_ldc_info(config, &snd); | ||
| if (config->filter_config) { | ||
| ret = filter_update_firmware(config->uids_dict, | ||
| config->filter_config); | ||
| if (ret) { | ||
| log_err(config->out_fd, | ||
| "failed to apply trace filter, %d.\n", ret); | ||
| return ret; | ||
| } | ||
| } | ||
| return logger_read(config, &snd); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -13,6 +13,7 @@ | ||
| #include <stdio.h> | ||
| #include <ipc/info.h> | ||
| #include <smex/ldc.h> | ||
| #include <sof/lib/uuid.h> | ||
| #define KNRM "\x1B[0m" | ||
| #define KRED "\x1B[31m" | ||
| @@ -29,6 +30,7 @@ struct convert_config { | ||
| int trace; | ||
| const char *ldc_file; | ||
| FILE* ldc_fd; | ||
| char *filter_config; | ||
| int input_std; | ||
| int version_fw; | ||
| char *version_file; | ||
| @@ -42,4 +44,6 @@ struct convert_config { | ||
| struct snd_sof_uids_header *uids_dict; | ||
| }; | ||
| uint32_t get_uuid_key(const struct snd_sof_uids_header *uids_dict, | ||
| const struct sof_uuid_entry *entry); | ||
| int convert(struct convert_config *config); | ||
ktrzcinx marked this conversation as resolved.
Outdated
Uh oh!There was an error while loading. Please reload this page. | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.