Login  •  Register


The time is now: Tue Oct 23, 2018 4:09 am

Emaculation wiki  •  Delete all board cookies



Post new topic  Reply to topic Page 1 of 1 [ 7 posts ]
Print view Previous topic  |  Next topic
Author Message
 Post subject: MacsBug on QEMU
PostPosted: Sun Jul 15, 2018 12:16 pm 
Offline
Inquisitive Elf

Joined: Sun Jan 08, 2017 4:31 pm
Posts: 26
Location: Russia
I'm trying to invoke MacsBug on QEMU, but cannot succeed. Well, I've got it successfully installed according to the manual - I see "Debugger installed" message during the system boot. But how can I launch MacsBug window? Everything I found is this:
Defining an 'FKEY' Resource to Invoke MacsBug 2
Another way to invoke MacsBug is to define an 'FKEY' resource using ResEdit or MPWS. Once you have defined this resource, you can use a Shift-Command-key combination to invoke MacsBug.
To define an 'FKEY' resource using ResEdit 2.1, follow these steps:
1. Launch ResEdit.
2. Open the 'FKEY' resource in the System File.
3. Choose “Create New Resource” from the Resource menu to create a new 'FKEY' resource.
4. Type the following numbers into the new resource exactly as shown:
A9FF 4E75
A9FF is machine code for the _Debugger trap; 4E75 is machine code for the RTS instruction.
Figure 2-6 shows what the resource looks like after you’ve entered the instruction.
Figure 2-6 Defining an 'FKEY' resource to invoke MacsBug
5. Choose Get Resource Info from the Resource menu and set its ID number to a number greater than 4 and less than or equal to 9. Please remember to use a number that is not already in use. The numbers 1, 2, 3, and 4 are reserved for system functions.
6. Close and save the System file.
7. To invoke MacsBug, press Command-Shift and the ID number you have assigned the resource. For example, if you’ve assigned the resource ID 7, press Command-Shift-7 to invoke MacsBug.
This method of invoking MacsBug will only work when the application is calling GetNextEvent or WaitNextEvent regularly, which it might not do if it’s hung or frozen.
That's the same instructions as in the MacsBug's official manual - MacsBug Reference and Debugging Guide.
But when I press Command+Shift+7 (I set FKEY ID to 7), nothing happens. My host OS is Windows 10 x64 1803, guest OS is Mac OS 9.2.2. With trial and error method I discovered that the Command/Clover key is Windows+Alt on my keyboard. Any standard hotkeys with Command key work just fine.

Any advices to try?


Top
 Profile  
Reply with quote Post a reply  
 Post subject: Re: MacsBug on QEMU
PostPosted: Sun Jul 15, 2018 3:36 pm 
Offline
Expert User
User avatar

Joined: Fri Feb 13, 2004 8:59 am
Posts: 4424
Location: Sittard, The Netherlands
Hi

You can at least get to the nanokernel log in this way (from qemu wiki):

In the command line set auto-boot? to false
Add this
-prom-env "aapl,debug=2000000"

In OpenBIOS type:
dev /
2000000 encode-int
“ AAPL,debug” property

Then, to boot from a hard drive image:
boot hd:,\\:tbxi

A forum search tells me pressing the Ctrl key before the splash screen appears might get you into macsbug when installed.
I don't know whether that will work.

Best,
Cat_7


Top
 Profile  
Reply with quote Post a reply  
 Post subject: Re: MacsBug on QEMU
PostPosted: Sun Jul 15, 2018 5:29 pm 
Offline
Inquisitive Elf

Joined: Sun Jan 08, 2017 4:31 pm
Posts: 26
Location: Russia
Thanks for the reply, Cat_7.

I tried this NanoKernel Log already and tried again with your advice, but it seems to be of no use for me, because it views QEMU's internal info and I need Mac OS internal info (even not all of it). I'm trying to debug old software and I need to get to its disassembly to step/trace, view stack/registers etc. Pretty the same thing as IDA does.
That's the log I get:
Image
What could I do with it?

Cat_7 wrote:
A forum search tells me pressing the Ctrl key before the splash screen appears might get you into macsbug when installed.
I don't know whether that will work.

It doesn't work as it should. Tried several times, but I get just this black window with the log text on the background:
Image
Nothing happens after this state, the system doesn't react to any keys. :sad:

As I see in the manual, there exists a way to view MacsBug with calling a Debugger trap like this:
Code:
Begin
thisnumber := $666;
Debugger;
newnumber := thisnumber
End

I wonder whether this solution works on QEMU. Could someone check this out?


Top
 Profile  
Reply with quote Post a reply  
 Post subject: Re: MacsBug on QEMU
PostPosted: Sun Jul 15, 2018 8:19 pm 
Offline
Granny Smith

Joined: Sun Nov 01, 2015 10:33 pm
Posts: 108
If you're using the newest builds (pre-3.0) with PMU support then you can break into MacsBug via the programmer switch. From the command line make sure that you enable both PMU and stdio monitor like this:

Code:
$ ./qemu-system-ppc -M mac99,via=pmu -monitor stdio ....


Then once you want to break in, simply issue "nmi" on the monitor which triggers the virtual programmer switch:

Code:
$ ./qemu-system-ppc -monitor stdio -M mac99,via=pmu -cdrom MacOS921-macsbug.iso -boot d
QEMU 2.12.90 monitor - type 'help' for more information
(qemu) nmi


A quick test here shows that it causes OS 9 to enter MacsBug without any issues.


Top
 Profile  
Reply with quote Post a reply  
 Post subject: Re: MacsBug on QEMU
PostPosted: Sun Jul 15, 2018 9:32 pm 
Offline
Expert User
User avatar

Joined: Fri Feb 13, 2004 8:59 am
Posts: 4424
Location: Sittard, The Netherlands
Thanks MCayland,

The monitor displays "nmi" as: (qemu) nnmnmi
but it still works.

For windows this also works: Just start qemu. At splash (or any moment required) press Ctrl-Alt-2 and enter "nmi".
Press Ctrl-Alt-2 again to get back into the graphical window.
At least you can see what you type ;-)

Best,
Cat_7


Top
 Profile  
Reply with quote Post a reply  
 Post subject: Re: MacsBug on QEMU
PostPosted: Mon Jul 16, 2018 4:35 pm 
Offline
Inquisitive Elf

Joined: Sun Jan 08, 2017 4:31 pm
Posts: 26
Location: Russia
Thanks a lot, mcayland and Cat_7!
With the recent QEMU 3.0.0-rc0 it works as a charm! Even pressing Ctrl key on the splash screen works also. Command+Shift+[Some number] still doesn't want to work, but it doesn't matter now.

By the way, I even don't need to invoke the monitor (serial0 console). As I run QEMU through a batch file, I just write "nmi" there and press Enter. It also works in PowerShell/cmd the same way.


Top
 Profile  
Reply with quote Post a reply  
 Post subject: Re: MacsBug on QEMU
PostPosted: Wed Jul 18, 2018 5:55 pm 
Offline
Inquisitive Elf

Joined: Sun Jan 08, 2017 4:31 pm
Posts: 26
Location: Russia
dadreamer wrote:
As I see in the manual, there exists a way to view MacsBug with calling a Debugger trap like this:
Code:
Begin
thisnumber := $666;
Debugger;
newnumber := thisnumber
End

I wonder whether this solution works on QEMU. Could someone check this out?

I checked this. Seems to work fine in MetroWerks CodeWarrior Pro 4 Pascal with both Debugger and DebugStr calls. But in LabVIEW it appears to hang the system completely if called from InterfaceLib.


Top
 Profile  
Reply with quote Post a reply  
Display posts from previous:  Sort by  
Post new topic  Reply to topic Page 1 of 1 [ 7 posts ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
 

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group