[Mesa-dev] [PATCH 15/22] intel/tools/disasm: make sure that entire range is disassembled

kevin.rogovin at intel.com kevin.rogovin at intel.com
Mon Sep 25 10:34:15 UTC 2017


From: Kevin Rogovin <kevin.rogovin at intel.com>

Without this patch, if a shader has errors, the disassembly of the
shader often stops after the first opcode that has errors.

Signed-off-by: Kevin Rogovin <kevin.rogovin at intel.com>
---
 src/intel/tools/disasm.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/intel/tools/disasm.c b/src/intel/tools/disasm.c
index 6109727..aaad8a4 100644
--- a/src/intel/tools/disasm.c
+++ b/src/intel/tools/disasm.c
@@ -74,7 +74,7 @@ gen_disasm_disassemble(struct gen_disasm *disasm, const void *assembly,
                        int start, FILE *out)
 {
    struct gen_device_info *devinfo = &disasm->devinfo;
-   int end = gen_disasm_find_end(disasm, assembly, start);
+   int i, offset, end = gen_disasm_find_end(disasm, assembly, start);
 
    /* Make a dummy annotation structure that brw_validate_instructions
     * can work from.
@@ -92,15 +92,20 @@ gen_disasm_disassemble(struct gen_disasm *disasm, const void *assembly,
    brw_validate_instructions(devinfo, assembly, start, end, &annotation_info);
    struct annotation *annotation = annotation_info.ann;
 
-   for (int i = 0; i < annotation_info.ann_count; i++) {
-      int start_offset = annotation[i].offset;
+   for (i = 0, offset = start; i < annotation_info.ann_count; i++) {
       int end_offset = annotation[i + 1].offset;
 
-      brw_disassemble(devinfo, assembly, start_offset, end_offset, out);
+      brw_disassemble(devinfo, assembly, offset, end_offset, out);
 
       if (annotation[i].error) {
          fputs(annotation[i].error, out);
       }
+
+      offset = end_offset;
+   }
+
+   if (offset < end) {
+      brw_disassemble(devinfo, assembly, offset, end, out);
    }
 
    ralloc_free(annotation_info.mem_ctx);
-- 
2.7.4



More information about the mesa-dev mailing list