[Mesa-dev] [PATCH] intel: aubinator: print out addresses of invalid instructions
Lionel Landwerlin
lionel.g.landwerlin at intel.com
Tue Apr 10 00:00:09 UTC 2018
On 09/04/18 17:04, Scott D Phillips wrote:
> Lionel Landwerlin <lionel.g.landwerlin at intel.com> writes:
>
>> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
>> ---
>> src/intel/tools/gen_batch_decoder.c | 22 +++++++++++++---------
>> 1 file changed, 13 insertions(+), 9 deletions(-)
>>
>> diff --git a/src/intel/tools/gen_batch_decoder.c b/src/intel/tools/gen_batch_decoder.c
>> index 1a8794c84e7..b56aea53f1d 100644
>> --- a/src/intel/tools/gen_batch_decoder.c
>> +++ b/src/intel/tools/gen_batch_decoder.c
>> @@ -57,6 +57,7 @@ gen_batch_decode_ctx_finish(struct gen_batch_decode_ctx *ctx)
>> }
>>
>> #define CSI "\e["
>> +#define RED_COLOR CSI "31m"
>> #define BLUE_HEADER CSI "0;44m"
>> #define GREEN_HEADER CSI "1;42m"
>> #define NORMAL CSI "0m"
>> @@ -734,14 +735,22 @@ gen_print_batch(struct gen_batch_decode_ctx *ctx,
>> length = gen_group_get_length(inst, p);
>> assert(inst == NULL || length > 0);
>> length = MAX2(1, length);
>> +
>> + const char *reset_color = ctx->flags & GEN_BATCH_DECODE_IN_COLOR ? NORMAL : "";
>> +
>> + uint64_t offset;
>> + if (ctx->flags & GEN_BATCH_DECODE_OFFSETS)
>> + offset = batch_addr + ((char *)p - (char *)batch);
>> + else
>> + offset = 0;
>> +
>> if (inst == NULL) {
>> - fprintf(ctx->fp, "unknown instruction %08x\n", p[0]);
>> + fprintf(ctx->fp, "%s0x%08"PRIx64": unknown instruction %08x%s\n",
>> + RED_COLOR, offset, p[0], reset_color);
> I guess the RED_COLOR here should conditionally be "" when
> !GEN_BATCH_DECODE_IN_COLOR, otherwise we'll print red and never stop.
> With that,
>
> Reviewed-by: Scott D Phillips <scott.d.phillips at intel.com>
Oops, will fix, thanks!
>
>> continue;
>> }
>>
>> - const char *color, *reset_color;
>> - uint64_t offset;
>> -
>> + const char *color;
>> const char *inst_name = gen_group_get_name(inst);
>> if (ctx->flags & GEN_BATCH_DECODE_IN_COLOR) {
>> reset_color = NORMAL;
>> @@ -759,11 +768,6 @@ gen_print_batch(struct gen_batch_decode_ctx *ctx,
>> reset_color = "";
>> }
>>
>> - if (ctx->flags & GEN_BATCH_DECODE_OFFSETS)
>> - offset = batch_addr + ((char *)p - (char *)batch);
>> - else
>> - offset = 0;
>> -
>> fprintf(ctx->fp, "%s0x%08"PRIx64": 0x%08x: %-80s%s\n",
>> color, offset, p[0], inst_name, reset_color);
>>
>> --
>> 2.17.0
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list