diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-08-04 09:59:45 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-08-04 09:59:45 +0200 |
commit | 67bea7c5166a9fb930c12422a3e4f878b5227c5b (patch) | |
tree | be76c77435b9d8ad55bcea4c22f13474fca35f61 /tools | |
parent | 72bd143596c865428b8aa04435a4e4ede4c6a44c (diff) |
tools: fix etnaviv_gdb module load
A syntax error snuck in.
Also add beginnings of a gpu-inspect tool to inspect etna resource contents.
This is very primitive right now (used it to debug a blitter issue)
so don't add it to docs yet.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/etnaviv_gdb.py | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tools/etnaviv_gdb.py b/tools/etnaviv_gdb.py index 8b9cb94..d221cfd 100644 --- a/tools/etnaviv_gdb.py +++ b/tools/etnaviv_gdb.py @@ -378,7 +378,7 @@ class GPUTrace(gdb.Command): print("Unrecognized stop mode %s" % arg[1]) if self.bp: # if breakpoint currently exists, change parameter on the fly self.bp.do_stop = self.stop_on_commit - elif arg[0].startswith('out') # output + elif arg[0].startswith('out'): # output new_output = self.output if arg[1] == 'file': new_output = open(arg[2],'w') @@ -400,10 +400,36 @@ class GPUTrace(gdb.Command): ['disabled','enabled'][self.stop_on_commit], self.output or '<stdout>')) +### gpu-inspect ### +class GPUInspect(gdb.Command): + """Etnaviv: inspect etna resource + Usage: + gpu-inspect <resource> + """ + + def __init__ (self): + super(GPUInspect, self).__init__ ("gpu-inspect", gdb.COMMAND_USER) + + def invoke(self, arg, from_tty): + self.dont_repeat() + arg = gdb.string_to_argv(arg) + arg[0] = gdb.parse_and_eval(arg[0]) + etna_resource_type = gdb.lookup_type('struct etna_resource').pointer() + res = arg[0].cast(etna_resource_type) + # this is very, very primitive now + # dump first 128 bytes of level 0 by default, as floats + # XXX make this more flexible + logical = res['levels'][0]['logical'] + size = 128 + buffer = indirect_memcpy(logical, logical+size) + data = struct.unpack_from(b'%df' % (len(buffer)/4), buffer) + print(data) + state_xml = parse_rng_file(rnndb_path('state.xml')) isa_xml = parse_rng_file(rnndb_path('isa.xml')) GPUState(state_xml) GPUDisassemble(isa_xml) GPUTrace(state_xml) +GPUInspect() |