English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. Asm / Hardware (http://eab.abime.net/forumdisplay.php?f=112)
-   -   Hacking the fs-uae console debugger (http://eab.abime.net/showthread.php?t=82187)

alpine9000 28 March 2016 12:18

Hacking the fs-uae console debugger
 
Being a noob I need a debugger. I think the UAE console debugger is pretty cool.

So today I hacked some stuff into it that I was used to coming from GDB. I thought I'd share this here in case anyone else finds it useful.

Firstly I added gnu readline support. The main advantage this gives me is "up arrow" history. The history is saved to disk so each time I run FS-UAE, my commands from the previous run are there. You pretty much get all the features of the bash command editor (search, cut paste etc). I also made another small change so that hitting "enter" without a command runs the previous command, so if you're stepping through a bunch of code you can go "t" or "z", then just keep hitting enter.

Next I wanted symbols. I only debug bootblock run programs, so there are no symbols on the adf, so I added an option to tell fs-uae to load the symbols from a file. The file is just is list of names and addresses, that I generate with vlink or objdump.

So now, any command in the debugger that takes an address will optionally take a symbol:

Code:

>f Entry
Breakpoint added
>fl
00004008 (Entry)
>f Entry
Breakpoint removed

or

Code:

>d MainLoop
MainLoop:
00004078 4eb9 0000 4314          JSR $00004314 (WaitVerticalBlank)
0000407E 6100 0124                BSR.W #$0124 == $000041a4 (InstallPalette)
00004082 207a 0244                MOVEA.L (PC,$0244) == $000042c8 (offscreen),A0
00004086 7003                    MOVE.L #$00000003,D0
00004088 323c 000a                MOVE.W #$000a,D1
0000408C 243a 00a6                MOVE.L (PC,$00a6) == $00004134 (ypos),D2
00004090 4eb9 0001 8594          JSR $00018594 (BlitFillColor)

Whenever an address matches a symbol during disasm the symbol name (should) be shown.

The last thing I added was tab completion for symbol names. So if you type a command then the start of a symbol you can hit TAB and it will complete it, or show you a list of matches:

Code:

>d doy<TAB>
doy_full_000015  doy_lcopy_near  doy_literal      doy_mcopy        doy_mgetlen      doy_mrefill      doynaxdepack
doy_full_000018  doy_lendlen      doy_lsingle      doy_mendlen1    doy_mhalf        doy_return     
doy_lcopy        doy_lgetlen      doy_match        doy_mendlen2    doy_mprefix      doy_table

So far I am finding the hacks really useful. There might be some issues as I haven't exhaustively tested it yet, but the changes were all pretty simple.

Anyone have any other ideas for debugger hacks ?

Source is on my fork of FS-UAE:

https://github.com/alpine9000/fs-uae.git

idrougge 28 March 2016 16:45

Jolly good!


All times are GMT +2. The time now is 00:03.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.

Page generated in 0.08761 seconds with 11 queries