diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2011-10-11 13:14:02 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2011-10-17 13:46:46 +0200 |
commit | 73c2104070fc0e2cd8230075a75eed3a214bba06 (patch) | |
tree | 1cae7e683158fb3d28440bdcc960f69ad6954d19 /tools | |
parent | 1c6511f7fb9b0117d2a1f4ebe489e5a0221c6d7b (diff) |
tools/decode: retain the ring name
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/intel_error_decode.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/tools/intel_error_decode.c b/tools/intel_error_decode.c index caa35f3..0ad6645 100644 --- a/tools/intel_error_decode.c +++ b/tools/intel_error_decode.c @@ -261,6 +261,7 @@ read_data_file (FILE *file) uint32_t offset, value; uint32_t gtt_offset = 0, new_gtt_offset; char *buffer_type[2] = { "ringbuffer", "batchbuffer" }; + char *ring_name = NULL; int is_batch = 1; while (getline (&line, &line_size, file) > 0) { @@ -269,17 +270,25 @@ read_data_file (FILE *file) dashes = strstr(line, "---"); if (dashes) { + char *new_ring_name = malloc(dashes - line); + strncpy(new_ring_name, line, dashes - line); + new_ring_name[dashes - line - 1] = '\0'; + matched = sscanf (dashes, "--- gtt_offset = 0x%08x\n", &new_gtt_offset); if (matched == 1) { if (count) { - printf("%s at 0x%08x:\n", - buffer_type[is_batch], gtt_offset); + printf("%s (%s) at 0x%08x:\n", + buffer_type[is_batch], + ring_name, + gtt_offset); intel_decode (data, count, gtt_offset, devid, 0); count = 0; } gtt_offset = new_gtt_offset; is_batch = 1; + free(ring_name); + ring_name = new_ring_name; continue; } @@ -287,13 +296,17 @@ read_data_file (FILE *file) &new_gtt_offset); if (matched == 1) { if (count) { - printf("%s at 0x%08x:\n", - buffer_type[is_batch], gtt_offset); + printf("%s (%s) at 0x%08x:\n", + buffer_type[is_batch], + ring_name, + gtt_offset); intel_decode (data, count, gtt_offset, devid, 0); count = 0; } gtt_offset = new_gtt_offset; is_batch = 0; + free(ring_name); + ring_name = new_ring_name; continue; } } @@ -360,6 +373,7 @@ read_data_file (FILE *file) free (data); free (line); + free (ring_name); } int |