02 February 2021, 00:30 | #1 |
Registered User
Join Date: Jun 2020
Location: Druidia
Posts: 387
|
Investigating code in WinUAE
How do other people disassemble and debug in WinUAE?
I don't know my way around the Shift-F12 debug features. Is there a way to just dump the memory as code to a file and look it over in there? What are those tabs along the bottom used for? (OUT1, OUT2, MEM1, MEM2, DASM1, DASM2 etc) How do some of you experts dissect other peoples exe's and for that matter how do you patch them? |
02 February 2021, 01:00 | #2 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,211
|
The debugger in WinUAE is a nightmare to use properly. It's the most unfriendly interface ever... surprised nobody has offered to make it better to be honest...
I try to avoid using it, but when debugging my own code it's not so difficult, as I can have the source open in another window and follow it through easier that way |
02 February 2021, 01:29 | #3 | |||
Registered User
Join Date: Jan 2011
Location: -
Posts: 728
|
You press SHIFT+F12 and you're given the GUI debugger. Don't like the GUI? You can switch to the console by typing 'xx' (and go back to GUI if you want).
The GUI is essentially a frontend to the console. Yes there's some places where you can right click or double click for ease of use but realistically you'll be typing... a lot. First thing is learning that 'h' will give you help. You'll be using that pretty often. So let's say you want to search for a string in memory: s "blahblah" Quote:
Want to see where a memory address is references in memory? fa 1e6fe Quote:
Want to set a memory watchpoint on an address? (eg. find when lives are subtracted) w 0 1df0 1 w (watch only 1 byte that's being written to - r for reading, w for writing, rw for read/write) Want to save a bit of memory? S blah.dmp 2E8E 16 Quote:
etc. It's not easy when you're new to it, but once you've grasped how it all works, it's way more convenient than for example, Action Replay in my opinion. OUT1, OUT2, MEM1, MEM2, DASM1, DASM2, etc. can be accessed using the function keys (F1, F2, etc). They just give different debugging views. |
|||
02 February 2021, 01:31 | #4 | |
Registered User
Join Date: Jan 2011
Location: -
Posts: 728
|
Quote:
Initially it was purely console based. I believe Toni still uses it like this and he has no interest in updating the GUI (it's not his code). I'd love to see changes made to the GUI (scrollbars to scroll through memory and disassembly!) but I'm not holding my breath |
|
02 February 2021, 01:56 | #5 | |
Registered User
Join Date: Jun 2020
Location: Druidia
Posts: 387
|
Quote:
Fortunately for my own code I use Bartman's VSCode setup. You still need to jump through a few hoops so it'll show you the inline asm properly. But once you have it running you can single step through the asm line by line and watch the register and memory contents fairly well. At least until it crashes after a few minutes I've also used his profiler on other peoples running code which is nice if you want to see all the blitter and dma activity in a more digestible form. Using the WinUAE debugger is mostly so I can see what other people are doing. In the past I've only really investigated the chip ram contents. In the old days I had a ripper tool that let me scan the memory. Now I can save a state and use Maptapper in the same way. I can normally figure out how someone else has coded some effect just from the graphics layout. But obviously that doesn't help much for more code heavy effects. |
|
02 February 2021, 01:56 | #6 |
Registered User
Join Date: Jun 2020
Location: Druidia
Posts: 387
|
|
02 February 2021, 02:20 | #7 |
Registered User
Join Date: Jan 2011
Location: -
Posts: 728
|
I forgot to mention F11 and F12 to step through code. One steps into functions, while the other steps over them. I can't remember which is which, so experiment to find out
|
02 February 2021, 08:35 | #8 |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
I debug routines mainly with MonAm
For deep bugs i use the Winuae debugger with the uaedbg side loader, this allows for debugging non system code with symbols included. It also helps track if all kinds of stuff like memory allocations. Also useful is for when you have things like unitialised copper lists or pointers that read from low memory - the debugger will tell you even if it's something like Bitplanes or Sprites. Most used and useful is the watch points, I watch a low address and trigger it in my code. w 0 100 2 W ALL Then somewhere problematic in my code clr.w $100.w Agree it can be difficult to use but worth investing the time, not any harder than using the likes of gdb. Last edited by mcgeezer; 02 February 2021 at 09:21. Reason: typos. |
02 February 2021, 08:53 | #9 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
The only problem is still the same: some nice multi-window resizable GUI framework is needed. Anything that takes care of windowing stuff.
Without it: 99% of work would be implementing GUI code. The rest would be debugger functionality. |
02 February 2021, 09:22 | #10 |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
I would like to update the debugger, but then I also want to work on some Amiga code.
To much work, not enough time. |
02 February 2021, 14:40 | #11 | |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,039
|
Quote:
You know what's also -10? Its window's Y coord. It keeps crawling up every time it shows up until it finally gets under the taskbar (yeah, I have it on top, just like Amiga's screenbar) and you can't see D0/A0 any more. Just my way of saying: hi, Toni. :P |
|
02 February 2021, 14:45 | #12 | |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
|
Quote:
http://eab.abime.net/showthread.php?t=91321 |
|
02 February 2021, 15:54 | #13 |
BiO-sanitation Battalion
Join Date: Jun 2017
Location: Scotland
Posts: 151
|
I have to say that I don't quite get the hate for the GUI debugger. I find it to be easy enough to use. However, some kind of modern multi-window setup would certainly be an improvement.
Is there any chance at all that this might happen, in the future? B |
02 February 2021, 16:38 | #14 |
Registered User
Join Date: Jan 2011
Location: -
Posts: 728
|
Toni said he's looking for "some nice multi-window resizable GUI framework", so I guess that's the hold up. If someone can suggest something good that works to his requirements, then presumably it will be implemented.
|
02 February 2021, 17:25 | #15 | |
Registered User
Join Date: May 2017
Location: Munich/Bavaria
Posts: 2,294
|
Quote:
|
|
02 February 2021, 18:48 | #16 | |
Registered User
Join Date: Jun 2020
Location: Druidia
Posts: 387
|
Quote:
I was going to suggest DearImGui which I have used and is widely held in high regard. https://github.com/ocornut/imgui Last edited by Jobbo; 02 February 2021 at 19:13. |
|
02 February 2021, 18:56 | #17 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,215
|
Quote:
Also, step over/next should really be more careful for branches such that as "next" does not simply place a breakpoint behind a branch (where it might never get). That alone would improve the usefulness of the thing by 50%. Look at COP or its commands as an example what I would consider useful features. its "GUI" stinks as well, but that is not relevant. |
|
02 February 2021, 19:04 | #18 | |
Registered User
Join Date: May 2017
Location: Munich/Bavaria
Posts: 2,294
|
Quote:
|
|
02 February 2021, 19:17 | #19 | ||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Quote:
Console version does support evaluations, for example "d ra2+4" disassembles from contents of register A2 + 4. Quote:
|
||
02 February 2021, 19:27 | #20 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Quote:
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
native x86 code in WinUAE? | Falk | support.WinUAE | 20 | 21 January 2023 18:30 |
Profiling code under WinUAE? | deimos | Coders. General | 8 | 08 October 2018 17:55 |
Investigating Guru message | selco | support.WinUAE | 2 | 17 March 2016 12:03 |
Calling Windows code from WinUAE is risky! | Leandro Jardim | support.WinUAE | 2 | 22 January 2012 10:09 |
editing winuae source code | petee1979 | Coders. General | 2 | 22 April 2008 04:19 |
|
|