[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] AHCC publishing libs / How to compile libs



Hi,

On perjantai 19 huhtikuu 2013, Ole wrote:
>  Am Freitag, den 19.04.2013, 02:34 +0200 schrieb Miro Kropáček
> > count...Why not take a look in a debugger? You can do a simple hellow
> > world (appl_init(), perhaps 2-3 more AES functions) and look it up in
> > the debugger how / what params / functions are called.
> 
>   - Of course I tried the debugger :) AFAIK the only debugging symbols I
>  get with AHCC are only function names,
>     At least that's what I see.
>     Maybe I had setup something wrong? Source Level debugging (stepping
>  through C code, looking at variables)
>     was not possible with the executables that I've compiled. It was
>  always at assembly level.  Did somebody get more
>     with executables created by AHCC?
> 
>   - It's a bit unusual to debug AES parameters, because they are not
>  pushed onto the stack, but they
>     are passed in via the AESPB... of course it's possible to debug all
>  that, but I'm not that familiar with ASM
>     and all in all, it's an serious job. :)

For serious jobs, use Hatari. :-)

[go into debugger with AltGr+Pause, then trace AES calls]
-------------------
> trace aes
-------------------

[set breakpoint on appl_init]
-------------------
> breakpoint AesOpcode = 10
CPU condition breakpoint 1 with 1 condition(s) added:
        AesOpcode = 10
-------------------

[continue]
-------------------
> c
Returning to emulation...
-------------------

[got a breakpoint]
-------------------
1. CPU breakpoint condition(s) matched 1 times.
        AesOpcode = 10

CPU=$218fe, VBL=75, FrameCycles=10164, HBL=45, LineCycles=84, DSP=N/A
-------------------

[trace shows calls only after trap instruction has been executed]
-------------------
> info aes 
No traced AES calls!
-------------------

[check where trap call returns]
-------------------
> d 
$0218fe : 4e42                                 trap      #2
$021900 : 4e75                                 rts
-------------------

[step into AES call to get its information]
-------------------
> s
AES call  10 appl_init()

CPU=$fdd43c, VBL=75, FrameCycles=10200, HBL=45, LineCycles=120, DSP=N/A
-------------------

[show AES info]
-------------------
> info aes
Latest AES Parameter block:
- Opcode:  10 (appl_init)
- Control:  0x21932
- Global:   0x2214a, 30 bytes
- Intin:    0x2194a, 0 words
- Intout:   0x21d4a, 1 words
- Addrin:   0x21b4a, 0 longs
- Addrout:  0x21f4a, 0 longs
-------------------

[check content of global array]
-------------------
> memdump 0x2214a
02214A: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
02215A: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
-------------------

[set breakpoint on AES call return]
-------------------
> a $021900
CPU condition breakpoint 2 with 1 condition(s) added:
        pc = $21900
$021900 : 4e75                                 rts       
-------------------

[continue until that]
-------------------
> c
Returning to emulation...
2. CPU breakpoint condition(s) matched 1 times.
        pc = $21900

CPU=$21900, VBL=74, FrameCycles=38264, HBL=170, LineCycles=184, DSP=N/A
-------------------

[check whether AES parameter block changed]
-------------------
> info aes
Latest AES Parameter block:
- Opcode:  10 (appl_init)
- Control:  0x21932
- Global:   0x2214a, 30 bytes
- Intin:    0x2194a, 0 words
- Intout:   0x21d4a, 1 words
- Addrin:   0x21b4a, 0 longs
- Addrout:  0x21f4a, 0 longs
-------------------

[see if there were changing in global array content]
-------------------
> memdump 0x2214a
02214A: 01 40 00 01 00 00 00 00 00 00 00 00 00 00 00 00   .@..............
02215A: 00 00 00 00 00 01 00 00 74 5e 00 00 00 00 00 00   ........t^......
-------------------

[see what was put into intout]
-------------------
> memdump 0x21d4a
021D4A: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
021D5A: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
-------------------


	- Eero