Re: [hatari-devel] Most wanted debugger/profiler feature or convenience? (DSP) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
Hi,
On torstai 11 huhtikuu 2013, Laurent Sallafranque wrote:
> I did first implement these options for DSP debugging itself (when I
> used to code it) and then to help me finding bugs in the DSP (by looking
> at the exchanges between the 68030 and the DSP).
> Of course, if someone has another needs, just ask and I'll see what I
> can do.
>
> Actually, I use the dsp_host_command and the dsp_host_interface commands
> (nearly never the SSI actually).
Attached is a patch to do the ring buffer thing, but I don't know
what information would be relevant to show.
Currently it looks like this:
---
> info dsp
DSP core information:
- SSH stack: 0000 0000 007b 00b3 00b9 00f2 0162 014e 01e1 01cf 01cb 0000
0000 0000 0000 0000
- SSL stack: 0000 0000 0010 8058 00ad 8055 0008 8051 8050 0001 8050 0000
0000 0000 0000 0000
- Interrupt IPL: 0003 0003 0003 0003 0003 0002 0002 0002 ffff ffff ffff ffff
- Pending ints: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
- Hostport: 80 12 06 0f 00 00 00 00 00 00 07 05
- Hostport IO history, from newest item to oldest (R=read,W=write,m=multi):
05 (W/m) 07 (W/m) 00 (W/m) 00 (W) 06 (R) 02 (W/m) 07 (W/m) 00 (W/m) 00 (W)
06 (R) ff (W/m) 06 (W/m)
---
As you can see, DSP core's hostport array seems to contain some of
same data bytes as what were stored in the hostport IO history ring-buffer.
What this (already shown) dsp_core.hostport array content is?
- Eero
>
> Best regards
> Laurent
>
> Le 11/04/2013 21:56, Eero Tamminen a écrit :
> > Hi,
> >
> > On torstai 11 huhtikuu 2013, Douglas Little wrote:
> >> Making it deeper can't solve problems where a block is several kwords
> >> in size and the fault happened near the start, and surfaced near the
> >> end. Nobody would search through that much history anyway, unless the
> >> debugger did sanity checks on the history itself (which is another
> >> possibility - some common faults are detectable)
> >
> > Note that Hatari has already quite a few options for tracing DSP
> > activity: $ hatari --trace help 2>&1 | grep dsp
> >
> > dsp_host_interface
> > dsp_host_command
> > dsp_host_ssi
> > dsp_interrupt
> > dsp_disasm
> > dsp_disasm_reg
> > dsp_disasm_mem
> > dsp_state
> > dsp_all
> > dsp_symbols
> >
> > For example for the freezing Stocasto demo:
> > --trace dsp_host_interface,dsp_host_command
> >
> > Will end at this:
> > -----------
> > Dsp: (Host->DSP): Direct Transfer 0x0006ff
> > Dsp: (Host->DSP): Dsp HRDF set
> > Dsp: (Host->DSP): Dsp HRDF cleared
> > Dsp: (Host->DSP): Direct Transfer 0x000702
> > Dsp: (Host->DSP): Dsp HRDF set
> > Dsp: (Host->DSP): Dsp HRDF cleared
> > Dsp: (Host->DSP): Direct Transfer 0x000705
> > Dsp: (Host->DSP): Dsp HRDF set
> > Dsp: (Host->DSP): Dsp HRDF cleared
> > -----------
> >
> > (Whereas SSI tracing output didn't end and was *much* more verbose.)
> >
> > Is that enough for what you were looking for, or what kind
> > of output you were wishing for?
> >
> >>> How short? Could it be fixed size (e.g. 20), or does it need to
> >>> be configurable?
> >>
> >> Good question. I think something like 20 would be enough to be useful.
> >
> > In that case I guess it could be added to the "info dsp" command
> > (implemented in falcon/dsp.c) I think, with a small ring buffer.
> >
> > Laurent, any comments on this?
> >
> > - Eero
diff -r 0227a8a7dd35 src/falcon/dsp.c
--- a/src/falcon/dsp.c Wed Apr 10 18:32:56 2013 +0300
+++ b/src/falcon/dsp.c Thu Apr 11 23:53:46 2013 +0300
@@ -64,6 +64,16 @@
"", "", "", "", "", "", "BCR", "IPR"
};
+typedef struct {
+ Uint8 value;
+ bool write;
+ bool multi;
+} host_io_t;
+
+/* ring buffer for extra debugger info */
+static int host_io_idx;
+static host_io_t host_io_buffer[ARRAYSIZE(dsp_core.hostport)];
+
/**
* Trigger HREQ interrupt at the host CPU.
@@ -405,6 +415,14 @@
return dsp_memdump_upper+1;
}
+static void add_host_io(Uint8 value, bool multi, bool write)
+{
+ host_io_buffer[host_io_idx].value = value;
+ host_io_buffer[host_io_idx].multi = multi;
+ host_io_buffer[host_io_idx].write = write;
+ host_io_idx = (host_io_idx + 1) % ARRAYSIZE(host_io_buffer);
+}
+
/**
* Show information on DSP core state which isn't
* shown by any of the other commands (dd, dm, dr).
@@ -442,6 +460,18 @@
fprintf(stderr, " %02x", dsp_core.hostport[i]);
}
fputs("\n", stderr);
+
+ fprintf(stderr, "- Hostport IO history, from newest item to oldest (R=read,W=write,m=multi):\n ");
+ for (i = 0; i < ARRAYSIZE(host_io_buffer); i++) {
+ if (--host_io_idx < 0) {
+ host_io_idx += ARRAYSIZE(host_io_buffer);
+ }
+ fprintf(stderr, " %02x (%c%s)",
+ host_io_buffer[host_io_idx].value,
+ host_io_buffer[host_io_idx].write ? 'W' : 'R',
+ host_io_buffer[host_io_idx].multi ? "/m": "");
+ }
+ fputs("\n", stderr);
#endif
}
@@ -759,6 +789,7 @@
{
#if ENABLE_DSP_EMU
value = dsp_core_read_host(addr-DSP_HW_OFFSET);
+ add_host_io(value, multi_access, false);
if (multi_access == true)
M68000_AddCycles(4);
multi_access = true;
@@ -788,6 +819,7 @@
value = IoMem_ReadByte(addr);
Dprintf(("HWput_b(0x%08x,0x%02x) at 0x%08x\n", addr, value, m68k_getpc()));
#if ENABLE_DSP_EMU
+ add_host_io(value, multi_access, true);
dsp_core_write_host(addr-DSP_HW_OFFSET, value);
if (multi_access == true)
M68000_AddCycles(4);