AminetAminet
Search:
84450 packages online
About
Recent
Browse
Search
Upload
Setup
Services

dev/debug/NoMoreDiv0_Debug.lha

Mirror:Random
Showing:m68k-amigaosppc-amigaosppc-morphosi386-arosi386-amithlonppc-warpupppc-powerupgeneric
No screenshot available
Short:Division by Zero Debugger
Author:Holger.Hippenstiel AT gmx.de
Uploader:Holger Hippenstiel nc-online de
Type:dev/debug
Version:1.7
Replaces:dev/debug/NoMoreDiv0_Debug.lha
Architecture:m68k-amigaos >= 2.0.0
Distribution:Aminet
Kurz:Geteilt Durch Null detailierte Ausgaben
Date:2021-01-10
Download:http://aminet.net/dev/debug/NoMoreDiv0_Debug.lha - View contents
Readme:http://aminet.net/dev/debug/NoMoreDiv0_Debug.readme
Downloads:841

NoMoreDiv0_Debug V1.7
=====================

TL;DR Install NoMoreDiv0_Debug in C:, Call in Startup-Sequence after SetPatch
or in User-Startup. Programs wont crash with "Division by Zero" anymore.

While working on http://aminet.net/package/util/boot/CopyMemAIO
i noticed for example "TestIt" from
http://aminet.net/package/util/misc/CopyMemQuicker crashes with Division by
Zero. The WinUAE-Emulation is so fast that nearly "no time" has passed,
which causes "TestIt" to try to divide by Zero (time).
And i remembered i had similar problems with other programs aswell,
the only solution was to change the speed to "Approximate A500/A1200 or
cycle exact" and +500% - but thats to slow for me. :P

So my idea was to replace the division by zero, if you think about it
smaller divisors means bigger results:
100/5 = 20, 100/2 = 50, 100/1 = 100 and finally 100/0 = Infinite
Ok, you cant calculate the other way: Infite * 0 = 100
But imho it is the best approximation.

Thats why i wrote http://aminet.net/package/util/boot/NoMoreDiv0
It exactly do that, patch the Division by Zero Exception
and change the "faulty" register to 0x7ffffff (Maximum positive Value).
In case of div(u/s)l.l with a Register for the Remainder, it will be cleared.

But it does this completly quiet just to fix old programs which cant cope
with a "4Ghz+ 680x0", thats why i added a "Warning-spoiler", because
noone should develop progams with it running.

This extended Version is able to show additional infos, where the Division
by Zero occured, showing the Programname (with SegTracker), view the
registers in the moment of the fault and even disassemble the faulty code.

Arguments are:
DS=DATA=DATESTAMP/S,SEG=SEGTRACKER/S,REGS=REGISTER/S,DIS=DISASSEM=
DISASSEMBLE/S,ALL/S,DEADLY/S,STDIO/S,CON=CONSOLE/S,WIN=WINDOW/K,
SER=RAW=RAWIO/S,QUIET/S

DATESTAMP   print Date & Time of the fault
SEGTRACKER  shows Owner of the Code-Segment, Hunknumber and Offset
REGISTER    shows all addres and data-registers while the error occured
DISASSEMBLE shows the code with disassembler.library
ALL         Switches on DATESTAMP, SEGTRACKER, REGISTER & DISASSEMBLE
DEADLY      sets the "faulty" register to 0 instead of MaxValue - possibly
            causing more Division by Zero errors
STDIO       Output Texts to Standard output (default), but only if CONSOLE
            or RAWIO are not used - can be used at the same time as RAWIO
CONSOLE     Output Texts in a Default 640/256/AUTO-Consolewindow
WINDOW      Define your own Window to use
RAWIO       Output Texts to Serial Port, can be used together with STDIO,
            CONSOLE or WINDOW
QUIET       Dont output anything at all

If you start it again, the Patch will be removed and Returncode 5 is given.

The output with ALL will look like this:

08-Aug-20 14:28:59 *** Div0 occured at Addr: 0x94D71EA ***
SegTracker-> Name: "Div0Test" Hunk #0 Offset $142
Addr: 094D7314 094D7334 094FBC2C 00000010 00000000 080128EC 0800089C 08002304
Data: D0D0D0D0 D1D1D1D1 D2D2D2D2 D3D3D3D3 D4D4D4D4 D5D5D5D5 D6D6D6D6 00000000
******************************** DISASSEMBLED ********************************
094d71e4 :  47f8 0010                  lea.l $10.w,a3
094d71e8 :  7e00                       moveq.l #$0,d7
094d71ea : *4c71 7007 7404             divu.l $4(a1,d7.w*4),d7 ;extended opcode
094d71f0 :  6150                       bsr.s $94d7242
094d71f2 :  663e                       bne.s $94d7232

You can create a Debug-Script or put something like this in your
Startup-Sequence (Description of the tools and where to get them below) :

MuProtectModules >NIL:
IF NOT WARN
 Run >NIL: MuGuardianAngel WAITFORMUFORCE TOMUFORCE AREGCHECK DREGCHECK +
  SHOWHUNK SHOWPC NAMETAG DISPC DATESTAMP LED 0 INTRO="*N*** GuardianAngel hit"
 Run >NIL: MuForce STACKCHECK AREGCHECK DREGCHECK DISPC DATESTAMP RAWIO LED 0 +
  INTRO="*N*** MuForce hit"
 Run >NIL: NoMoreDiv0_Debug ALL RAWIO
 Run >NIL: Sashimi CONSOLE WINDOW="CON:0/0/640/256/Something wrong ! +
  CTRL-E=Empty CTRL-F=File/AUTO/CLOSE/WAIT/INACTIVE" BUFK=64 +
  NOPROMPT ASKEXIT ASKSAVE
EndIF

You can get other debug-components here:
disassembler.library - can disassemble code (Same version as in MMULib)
http://aminet.net/package/util/libs/DisLib

SegTracker - Keeps track to which application memoryblocks belong
http://aminet.net/package/dev/debug/SegTracker

Write-protects modules loaded by "LoadModules", so they cant be overwritten
http://aminet.net/package/util/boot/MuProtectModules

Contains MuGuardianAngel which will protect "free" memory from getting
overwritten or accessed at and MuForce watches illegal memory accesses like
"Enforcer"
http://aminet.net/package/util/libs/MMULib
also contains actual version of disassembler.library

Redirects all serial output to window
http://aminet.net/package/dev/debug/Sashimi

Or with WinUAE you can enable the IO Ports-> Serial Port TCP://0.0.0.0:1234
And telnet with TeraTerm or similar termimal programs to 127.0.0.1:1234

The Program "Div0Test" tests all currently supported modes.

Supported Modes are now:

div?l.l LongAddr.l,dy:dz
div?l.l #n,dy:dz
div?l.l Addr.w,dy:dz
div?l.l Addr(pc),dy:dz
div?l.l Addr(pc,dx.z*n),dy:dz
div?l.l off(ax,dx.z*n),dy:dz
div?l.l off(ax),dy:dz
div?l.l dx,dy:dz
div?l.l (ax),dy:dz
div?l.l (ax)+,dy:dz
div?l.l -(ax),dy:dz
div? LongAddr.l,dy
div? #n,dy
div? Addr.w,dy
div? Addr(pc),dy
div? Addr(pc,dx.z*n),dy
div? off(ax,dx.z*n),dy
div? off(ax),dy
div? dx,dy
div? (ax),dy
div? (ax)+,dy
div? -(ax),dy

? = u or s
All div?l.l with or without remainder-register.

*** Update V1.5:
Source included

*** Update V1.6:
Wasn't really OS2.0 compatible, fixed.
Can be started from WB now. Added Icon.
Args from WB are: ALL CONSOLE RAWIO

*** Update V1.7:
Oops, made some crazy bugs in V1.6, reworked the stuff.
Div0Test now also works with OS2.0

*** Known Bugs/Limitations:

Because the code in the exception has to check code -8 from current PC it
could cause enforcer-hits, very very very unlikely - but it can happen.

Memory Indirect Modes are not supported, no one should use crap like:
div(u/s)(l.l) ([Label1,ax/pc,dx.z*n],Label2),dy:dz
... anyway. :P

****************************************************************************
Not supported only means they are not changed, they will still show up in
the debugger-version, they are catched and wont crash your machine either.
****************************************************************************

Check out my other tools:
http://aminet.net/search?readme=%22Holger+Hippenstiel%22&sort=date&ord=DESC

    DISCLAIMER

        This software is subject to the "Standard Amiga FD-Software Copyright
        Note". It is Giftware as defined in paragraph 4g. If you like it and
		use it regulary, please send me a small gift.
		For more information please read "AFD-COPYRIGHT".

        Diese Software unterliegt der "Standard Amiga FD-Software Copyright
        Note". Sie ist Giftware wie definiert in Absatz 4g. Falls du sie magst
		und regelmaessig benutzt, sende bitte ein kleines Geschenk.
		Fuer mehr Informationen lies bitte "AFD-COPYRIGHT".

        (/pub/aminet/docs/misc/AFD-FilesV-XX.lha V=Version,XX=Languages)

    AUTHOR

        Please send comments, bug-reports or small gifts like a Vampire V4
        or a now "worthless :P" NVidia RTX 2080 Ti, or Paypal me to:

        Holger.Hippenstiel AT gmx.de
        Hauptstr. 38
        71229 Leonberg
        Germany


Contents of dev/debug/NoMoreDiv0_Debug.lha
PERMISSION  UID  GID    PACKED    SIZE  RATIO METHOD CRC     STAMP     NAME
---------- ----------- ------- ------- ------ ---------- ------------ ----------
[unknown]                 2898    7381  39.3% -lh5- d49c Sep 28 02:23 afd-copyright
[unknown]                  841    1611  52.2% -lh5- b804 Sep 28 02:23 AFD-COPYRIGHT.info
[unknown]                  633     828  76.4% -lh5- f4d1 Jan 10 17:59 Div0Test
[unknown]                 1853    2532  73.2% -lh5- f8d4 Jan 10 17:53 NoMoreDiv0_Debug
[unknown]                 1106    1327  83.3% -lh5- dc23 Jan  4 13:46 NoMoreDiv0_Debug.info
[unknown]                 3468    7377  47.0% -lh5- 6fed Jan 10 18:12 NoMoreDiv0_Debug.txt
[unknown]                 1601    5092  31.4% -lh5- 10fb Jan 10 17:58 source/Div0Test.s
[unknown]                 1299    3675  35.3% -lh5- b243 Dec  3 14:27 source/M68k_exceptions.s
[unknown]                 5862   19305  30.4% -lh5- 9eb6 Jan 10 17:53 source/NoMoreDiv0_Debug.s
---------- ----------- ------- ------- ------ ---------- ------------ ----------
 Total         9 files   19561   49128  39.8%            Jan 11 04:58

Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>