English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 20 June 2015, 13:27   #1
SparkyNZ
Registered User
 
Join Date: Oct 2014
Location: New Zealand
Posts: 62
Question WinUAE Debugger Stack Dump

Quick question.. Does the WinUAE debugger have a stack dump function? No WinUAE at the moment so I can't tell sorry.
SparkyNZ is offline  
Old 20 June 2015, 18:51   #2
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
"m ra7"? (what do you exactly mean?)
Toni Wilen is online now  
Old 20 June 2015, 22:01   #3
SparkyNZ
Registered User
 
Join Date: Oct 2014
Location: New Zealand
Posts: 62
Quote:
Originally Posted by Toni Wilen View Post
"m ra7"? (what do you exactly mean?)
I keep forgetting that A7 is the SP. Many years ago when we learnt 68k we used MOVEM D0-D7,SP.. It would have been more helpful if they had taught us MOVEM D0-D7,A7 instead.. or (A7) or.. whatever

Toni, do you have an up to date help list for the debugger that you could share please? The help text that I have (output of '?') is out of date.

What I was asking for it some means of walking back out of the stack. I am trying to figure out where the 'main loop' of a game is. I can identify small routines and understand them but other than starting from the program origin, I am trying to find different strategies to figuring out where the main loop is.

I was hoping that looking at PC addresses on the stack may help me find out where that is.. unless the code uses a JMP to the main loop of course.

So what does "m ra7" do exactly? Is doing a mem dump of all values that have been pushed onto the stack? What order would the output be in? My understanding is that pushing values onto the stack goes from high to low memory, so is the "m ra7" showing a mem dump in reverse order?

If anybody has any words of wisdom on my "find main loop" question, please join in .. although really I should ask this as a seperate question.

Is there any way to do a "step out of" with the debugger? I've been playing with "fi" and "m ra7" but a lot of the time I'm going around in circles. Perhaps this is what "fp <addr>" is for?

Last edited by SparkyNZ; 20 June 2015 at 22:30.
SparkyNZ is offline  
Old 21 June 2015, 08:16   #4
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
m ra7 just shows memory dump, like any m <something> command. It is your task to analyze the output

Automatic return address detection will get very fuzzy, there is no magic stack cookies to look out or something similar.

Debugger option that tracks all jsr/bsr and rts instructions probably would work. (but it also gets tricky to not get confused with OS task switching)

fi and other non-address break points have one problem: they don't check if RTS (or whatever) was done by current task or some other task or interrupt.

My usual method is to keep looking for next RTS (if it is not guaranteed interrupt can happen between current PC and next RTS) and then add break point
Toni Wilen is online now  
Old 06 July 2015, 09:52   #5
SparkyNZ
Registered User
 
Join Date: Oct 2014
Location: New Zealand
Posts: 62
Question

Quote:
Originally Posted by Toni Wilen View Post
m ra7 just shows memory dump, like any m <something> command. It is your task to analyze the output

My usual method is to keep looking for next RTS (if it is not guaranteed interrupt can happen between current PC and next RTS) and then add break point
Hi Toni - all the book extracts I read state that "BSR places the PC onto the stack". Below is some CPU history - at 47f7a BSR jumps to 4561e.

I've done m ra7 but I am not seeing 47f7a or an adjacent address in the memory dump.

Does BSR really put the PC onto the stack or an offset of some form instead?

Code:
H
 2 000411FE 6c00 ffba                BGE.W #$ffba == $000411ba (T)
 2 00041202 4e75                     RTS 
 2 000480E0 6100 95e6                BSR.W #$95e6 == $000416c8
 2 000416C8 4a79 0007 0104           TST.W $00070104
 2 000416CE 67f6                     BEQ.B #$fffffff6 == $000416c6 (F)
 2 000416C6 4e75                     RTS 
 2 000480E4 4a39 0006 2f00           TST.B $00062f00
 2 000480EA 6a00 fe8e                BPL.W #$fe8e == $00047f7a (T)
 2 00047F7A 6100 d6a2                BSR.W #$d6a2 == $0004561e
 2 0004561E 33fc 00ff 0006 2158      MOVE.W #$00ff,$00062158

m ra7 1
FFFFFFFC 001E 001F 0000 0000 0000 1450 00F8 09E2  ...........P....

m ra7
FFFFFFFC 001E 001F 0000 0000 0000 1450 00F8 09E2  ...........P....
0000000C 00F8 09E4 00F8 09E6 0004 3094 00F8 09EA  ..........0.....
0000001C 00F8 09EC 00F8 0ADE 00F8 09F0 00F8 09F3  ................
0000002C 00F8 09F4 00F8 09F6 00F8 09F8 00F8 09FA  ................
0000003C 00F8 09FC 00F8 09FE 00F8 0A00 00F8 0A02  ................
0000004C 00F8 0A04 00F8 0A06 00F8 0A08 00F8 0A0A  ................
0000005C 00F8 0A0C 00F8 0A0E 00F8 107C 00F8 10D4  ...........|....
0000006C 0004 314A 00F8 116C 00F8 120C 00F8 1256  ..1J...l.......V
0000007C 00F8 129A 0002 F5EA 00F8 0A7E 00F8 0A80  ...........~....
0000008C 00F8 0A82 00F8 0A84 00F8 0A86 00F8 0A88  ................
0000009C 00F8 0A8A 00F8 0A8C 00F8 0A8E 00F8 0A90  ................
000000AC 00F8 0A92 00F8 0A94 00F8 0A96 00F8 0A98  ................
000000BC 00F8 0A9A 00F8 0A9C 00F8 0A9E 00F8 0AA0  ................
000000CC 00F8 0AA2 00F8 0AA4 00F8 0AA6 00F8 0AA8  ................
000000DC 00F8 0AAA 00F8 0AAC 00F8 0AAE 00F8 0AB0  ................
000000EC 00F8 0AB2 00F8 0AB4 00F8 0AB6 00F8 0AB8  ................
000000FC 00F8 0ABA 0000 0000 0000 0000 0000 0000  ................
0000010C 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000011C 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000012C 0000 0000 0000 0000 0000 0000 0000 0000  ................
SparkyNZ is offline  
Old 07 July 2015, 19:35   #6
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,506
Your stack pointer seems to be invalid. Looks like it was zeroed and then next branch stack write changed it to "-4".
Toni Wilen is online now  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Register dump with WinUAE? JimDrew support.WinUAE 2 02 June 2015 07:52
Need help using the WinUAE Debugger Steve support.WinUAE 9 10 January 2009 20:00
WinUAE Debugger BippyM support.WinUAE 7 02 April 2008 07:59
Winuae 1.3 crash dump analysis Deckard support.WinUAE 1 29 July 2006 19:29
WinUAE Debugger ???? RetroMan support.WinUAE 2 27 January 2004 12:17

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 18:45.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.25299 seconds with 15 queries