English Amiga Board


Go Back   English Amiga Board > Support > support.WinUAE

 
 
Thread Tools
Old 04 February 2021, 21:19   #41
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,216
COP has a relatively well-working stack traceback function. Take a value off the stack. If it's odd, refuse it. If it points to non-existing memory, refuse it. If it is a memory pointer, go back and check instructions prior to the address on the stack. If some of them decodes to jsr or bsr, it is assumed to be a return address. That is of course not a 100% bullet proof method, but it works well enough to provide useful information.
Thomas Richter is offline  
Old 04 February 2021, 21:43   #42
prb28
Registered User
 
Join Date: May 2018
Location: France
Posts: 246
First, as Toni said, there is a stack frame history storage in winuae with the registers. It reduces the calculation of the stacktrace (or backtrace as it is done gdb).

I think the best way to add a graphical debugger is by adding a remote protocol as the gdbserver protocol as used in the vscode or eclipse plugins. That way everyone can add an IDE of a new interface without messing with the winuae code.
prb28 is offline  
Old 05 February 2021, 15:36   #43
coldacid
WinUAE 4000/40, V4SA
 
coldacid's Avatar
 
Join Date: Apr 2020
Location: East of Oshawa
Posts: 538
@prb28 that's pretty much what I had suggested on the last page but it's already been pooh-poohed.
coldacid is offline  
Old 05 February 2021, 20:22   #44
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,507
Talking is cheap. Actually doing something is not.

GDB stuff is different thing, it is fine with me (when things stabilize enough) but it is just going to be GDB support, not any kind of debugger replacement. As I said, I am not going to create and support any kind of custom API that gets obsolete in next release.

Quote:
stack frame tracing
It uses CPU emulator to keep state of stack (every executed bsr,jsr,rts etc CPU instruction updates the state) so it should work quite nicely.
Toni Wilen is offline  
Old 08 March 2021, 19:20   #45
Rock'n Roll
German Translator
 
Rock'n Roll's Avatar
 
Join Date: Aug 2018
Location: Drübeck / Germany
Age: 49
Posts: 183
What I miss is a kind of rip-command (mr ?) what translate a part of memory to dc's.

Now I wrote my own short program.
I copy some part of copperlist and save it in a txt-file.
Then run this short processing sketch and I can take this for my programs.

Input:
00000420 0180 005A 00E2 0000 0120 0000 0122 0C80 ...Z..... ..."..
00000430 0124 0000 0126 0478 0128 0000 012A 0478 .$...&.x.(...*.x
...
00000470 FFFE FFFF FFFF FFFE FE00 FF00 0000 0000 ................


Output:
copperlist:
dc.w $0180, $005A, $00E2, $0000, $0120, $0000, $0122, $0C80
dc.w $0124, $0000, $0126, $0478, $0128, $0000, $012A, $0478
...
dc.w $FFFE, $FFFF, $FFFF, $FFFE, $FE00, $FF00, $0000, $0000

Processing sketch:
Quote:
String[] textFileZeilen = loadStrings("copperlist.txt");
String text; String[] teile; char delimiter = ' ';
//------------------------------------------------------------------------------------
println("copperlist:");
for (int j= 0; j < textFileZeilen.length; j++) {
text = textFileZeilen[j].substring(9, 48);
teile = split(text, delimiter);
for (int i = 0; i < teile.length-1; i++) teile[i]="$"+teile[i]+", ";
for (int i = teile.length-1; i < teile.length; i++) teile[i]="$"+teile[i];
print("dc.w "); for (int i = 0; i < teile.length; i++) print(teile[i]); println();
}

Last edited by Rock'n Roll; 10 March 2021 at 18:00.
Rock'n Roll is offline  
Old 08 March 2021, 20:39   #46
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,173
I have written a bin2asm.py file to convert binary to dc.b: https://github.com/jotd666/amiga68kt...ols/bin2asm.py

For small blocks I use notepad++ column copy/paste/edit and it's pretty quick.

Toni did I miss the stack frame tracing feature in the debugger??
jotd is offline  
Old 13 April 2021, 13:26   #47
carrion
Registered User
 
carrion's Avatar
 
Join Date: Dec 2016
Location: Warsaw area
Posts: 152
Hi All
I was looking for some answers in other thread here:
http://eab.abime.net/showthread.php?t=106569

but I think this thread is probably better one to ask my question.
I have compiled file with all the symbols. What I want to do in debugger is to browse the memory using symbols with commands like:

Code:
d _main
m _coperList
is it possible?
What exactly uaedbg, you mentioned earlier does?

In the other thread I asked about fs-uae on Mac but I could switch to WinUAE if there's solution I'm looking for.
TIA
carrion is offline  
Old 23 October 2021, 15:59   #48
chadderack
Registered User
 
chadderack's Avatar
 
Join Date: Jul 2021
Location: Sandy, UT
Age: 55
Posts: 230
First of all, I'm glad there's even an emulator as fantastic as WinUAE to use. It makes it so my as yet unknown state Amiga 500--(does it even start up still?) isn't as urgent to get up and running.
The debugger is great; I like being able to easily break into code where the OS is shut off to see if values line up as expected.

...

It's not like I have all the time in the world--but if I can find an odd hour or two here or there, he's what I'd like to fix (in a branch) on the GUI debugger:
  • Persist starting address of memory watch views
  • Persist selected tab
  • Clicking on a tab switches to the tab.

The biggest annoyance for me is after breaking into the debugger, switching to a memory view and then plugging in the start address--is when it continues, then breaks back in--the tab selected is the first tab (always) and the memory watch is reset to $00000000.

These seem like changes I can do without changing debugger functionality at all. I did some Windows GUI coding back in the day (Charles Petzold style--pre C#) so I can probably handle those changes.

The last feature I'd like--and would consider the GUI debugger 100% workable for me--is the ability to scroll the disassembly. Up/down and pgup/pgdn. But that change would require code logic that could disassemble in each direction and align itself to legal instruction boundaries (if possible). If it can't find a legal instruction after up arrow/pgup, it would just display ILLEGAL.

Not sure I could get that implemented without digging into how the debugger itself works.

Currently, it works well enough for my use. Thank you, Toni!
chadderack is offline  
Old 23 October 2021, 17:18   #49
Rock'n Roll
German Translator
 
Rock'n Roll's Avatar
 
Join Date: Aug 2018
Location: Drübeck / Germany
Age: 49
Posts: 183
you can scroll the disassembling in GUI-Debugger with

Not really pagewise up/down but
Alt+Arrow Left/Right moves 8 lines up/down
Alt+Arrow Up/Down moves 1 line up/down
Rock'n Roll is offline  
Old 23 October 2021, 18:13   #50
chadderack
Registered User
 
chadderack's Avatar
 
Join Date: Jul 2021
Location: Sandy, UT
Age: 55
Posts: 230
Quote:
Originally Posted by Rock'n Roll View Post
you can scroll the disassembling in GUI-Debugger with

Not really pagewise up/down but
Alt+Arrow Left/Right moves 8 lines up/down
Alt+Arrow Up/Down moves 1 line up/down
Good to know. Thank you!
chadderack is offline  
Old 24 October 2021, 16:45   #51
Photon
Moderator
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
I use AsmTwo (a modded version of AsmOne 1.02) and it has an integrated debugger where I can step through my own code, set breakpoints and watches.

I write mostly non-OS-reliant code (games and demos), so almost all the code is running with interrupts off. To use the integrated debugger in that code, I have a flag that doesn't turn off all the interrupts on start.

I guess I should try the WinUAE debugger some more, but I don't have the need.

For disassembling I think Resource is the best program? I haven't used it a lot, but it seemed to have everything and very logical menus.
Photon is offline  
Old 27 October 2021, 00:47   #52
Radertified
Registered User
 
Join Date: Jan 2011
Location: -
Posts: 728
Quote:
Originally Posted by Rock'n Roll View Post
you can scroll the disassembling in GUI-Debugger with

Not really pagewise up/down but
Alt+Arrow Left/Right moves 8 lines up/down
Alt+Arrow Up/Down moves 1 line up/down
This allows you to scroll through memory. I have yet to find a way to easily scroll through the disassembly.
Radertified is offline  
Old 27 October 2021, 09:57   #53
Rock'n Roll
German Translator
 
Rock'n Roll's Avatar
 
Join Date: Aug 2018
Location: Drübeck / Germany
Age: 49
Posts: 183
with F5, F6 you can switch to DASM1, DASM2 in GUI-Debugger
Rock'n Roll is offline  
Old 27 October 2021, 16:49   #54
Radertified
Registered User
 
Join Date: Jan 2011
Location: -
Posts: 728
oh! I always stick to the first tab (disassembly + memory + console). It doesn't work there. I didn't know the other tabs supported it.

Very useful to know. Thanks Rock'n Roll!
Radertified is offline  
Old 03 March 2022, 21:36   #55
Rock'n Roll
German Translator
 
Rock'n Roll's Avatar
 
Join Date: Aug 2018
Location: Drübeck / Germany
Age: 49
Posts: 183
With command >e we get the content from all custom registers.
If I want rip the state, for instance the color regs for a programm
it is very laborious to convert them.

So, I wrote I small processing sketch that converts the output
from command >e to dc's. (a usefull command for this could be: >er)

Code:
08C COPINS      0000    180 COLOR00     005A
08E DIWSTRT     0581    182 COLOR01     0FFF
090 DIWSTOP     40C1    184 COLOR02     0002
to
Code:
dc.w  $180,$005A ; COLOR00
dc.w  $182,$0FFF ; COLOR01
dc.w  $184,$0002 ; COLOR02
Code:
String[] text_File_lines = loadStrings("HW-regs.txt");
String[] text1 = new String[114]; String[] text2 = new String[114]; 
String[] text3 = new String[114]; String[] text4 = new String[114];
String[] text5 = new String[114]; String[] text6 = new String[114];
//----------------------------------------------------------------- 
println("HWregs:"); // 000 BLTDDAT     0000    106 BPLCON3     0C00 
for (int j= 0; j < text_File_lines.length; j++) {
  text1[j]=text_File_lines[j].substring(0, 3);    // 000  
  text2[j]=text_File_lines[j].substring(4, 11);   // BLTDDAT
  text3[j]=text_File_lines[j].substring(16, 20);  // 0000  
  text4[j]=text_File_lines[j].substring(24, 27);  // 106  
  text5[j]=text_File_lines[j].substring(28, 35);  // BPLCON3 
  text6[j]=text_File_lines[j].substring(40, 44);  // 0C00
}
for (int j= 0; j < text_File_lines.length; j++) {
  println("dc.w  $"+text1[j]+",$"+text3[j]+" ; "+text2[j]); }

for (int j= 0; j < text_File_lines.length; j++) {
  println("dc.w  $"+text4[j]+",$"+text6[j]+" ; "+text5[j]); }
Rock'n Roll is offline  
Old 06 November 2023, 08:24   #56
hop
Registered User
 
Join Date: Apr 2019
Location: UK
Posts: 172
Does the WinUAE debugger support PC history? When I hit a breakpoint, it would be great to see the path the PC took to get there. Ideally it would be a list of PC value for last N instructions with disassembly of the instruction and (optionally) register values.

If this doesn't exist, 1.
is there another way of tracing the execution in the same way 2. Would it be possible to add this? (I might have a go)

Thanks
hop is offline  
Old 06 November 2023, 08:33   #57
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,173
There are H and HH commands

H 100

to enable it.

Then H 100

to get the latest 100 instructions (instruction prefetch is sometimes confusing, and I guess that JIT must be turned off)

Not sure if latest releases didn't break this feature, as last time I used it it was incoherent, but helped me a lot in the past.
jotd is offline  
Old 06 November 2023, 09:39   #58
hop
Registered User
 
Join Date: Apr 2019
Location: UK
Posts: 172
Thanks! You know, I had this noted down from years ago, but had forgotten it. I also had this written down:

Quote:
Must set a breakpoint first to enable history collection. Can use dummy one e.g. f 100 n.b. Can only use HH in console mode
I think the change that is required is to add it to the debugger help output so it can easily be found.

Thanks for the JIT tip too. I'm not very familiar with this.
hop is offline  
Old 06 November 2023, 10:20   #59
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,173
The debugger is super powerful but very poorly documented alas.
jotd is offline  
Old 06 November 2023, 21:37   #60
Rock'n Roll
German Translator
 
Rock'n Roll's Avatar
 
Join Date: Aug 2018
Location: Drübeck / Germany
Age: 49
Posts: 183
thats the reason why I wrote the lesson19 about the WinUAE Debugger. (ramjam course translation)
(all what I get out in this time and I'm not an expert and this lesson is not the bible.)
Rock'n Roll is offline  
 


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

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 08:08.

Top

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