[PATCH umr] Allow specifying a zero size for --vm-disasm to have it size the shader automatically

Tom St Denis tom.stdenis at amd.com
Wed Apr 18 16:59:16 UTC 2018


Signed-off-by: Tom St Denis <tom.stdenis at amd.com>
---
 doc/umr.1      | 3 ++-
 src/app/main.c | 9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/doc/umr.1 b/doc/umr.1
index 83706b887894..f1f5fec55946 100644
--- a/doc/umr.1
+++ b/doc/umr.1
@@ -115,7 +115,8 @@ Write 'size' bytes (in hex) to the address specified (in hexadecimal) to VRAM
 from stdin.
 
 .IP "--vm-disasm, -vdis [<vmid>@]<address> <size>"
-Disassemble 'size' bytes (in hex) from a given address (in hex).
+Disassemble 'size' bytes (in hex) from a given address (in hex).  The size can be
+specified as zero to have umr try and compute the shader size.
 
 .IP "--update, -u" <filename>
 Specify update file to add, change, or delete registers from the register
diff --git a/src/app/main.c b/src/app/main.c
index 81ebc4c5bf42..600f3ca02988 100644
--- a/src/app/main.c
+++ b/src/app/main.c
@@ -489,6 +489,12 @@ int main(int argc, char **argv)
 					vmid |= UMR_USER_HUB;
 
 				sscanf(argv[i+2], "%"SCNx32, &size);
+				if (!size) {
+					struct umr_shaders_pgm shader;
+					shader.vmid = vmid;
+					shader.addr = address;
+					size = umr_compute_shader_size(asic, &shader);
+				}
 				umr_vm_disasm(asic, vmid, address, 0, size);
 
 				i += 2;
@@ -573,7 +579,8 @@ int main(int argc, char **argv)
 "\n\t--vm-write, -vw [<vmid>@]<address> <size>"
 	"\n\t\tWrite 'size' bytes (in hex) to a given address (in hex) from stdin.\n"
 "\n\t--vm-disasm, -vdis [<vmid>@]<address> <size>"
-	"\n\t\tDisassemble 'size' bytes (in hex) from a given address (in hex).\n"
+	"\n\t\tDisassemble 'size' bytes (in hex) from a given address (in hex).  The size can"
+	"\n\t\tbe specified as zero to have umr try and compute the shader size.\n"
 "\n\t--option -O <string>[,<string>,...]\n\t\tEnable various flags: bits, bitsfull, empty_log, follow, no_follow_ib, named, many,"
 	"\n\t\tuse_pci, use_colour, read_smc, quiet, no_kernel, verbose, halt_waves, disasm_early_term.\n"
 "\n\n", UMR_BUILD_VER, UMR_BUILD_REV);
-- 
2.14.3



More information about the amd-gfx mailing list