Short: Configurable Os argument checker Author: thomas.richter@alumni.tu-berlin.de (Thomas Richter) Uploader: thomas ricther alumni tu-berlin de (Thomas Richter) Type: dev/debug Version: 40.4 Architecture: m68k-amigaos >= 2.0.4 OsGrind is a configurable/scriptable debugging tool to validate arguments of operating system calls against requirements specified in the Autodocs. In case the parameters are invalid, the tool creates debugging ouptut, including registers, stack retrace, hunk and segment information and generates a disassembly around the return path. OsGrind has similar goals than PatchWork by Richard Körber, but it does not have the checks built-in. Instead, all validation tests are configured through an external file which is compiled at run time to executable code. ---------------------------------------------------------------------- New in release 40.4: - OsGrind now also prints symbol/offset and source file/line number information if SegTracker v47 is available and has been started with the "LoadSymbols" parameter to extract such information from the loaded binary. ---------------------------------------------------------------------- New in release 40.3: - If the mmu.library is present and loaded, OsGrind now checks the address of the stack lines before it attempts to print them. This avoids MuForce hits in case the stack area of the traced process is protected by MuGuardianAngel, and OsGrind would then attempt to read beyond the end of the allocated stack area. ---------------------------------------------------------------------- New in release 40.2: - The AREGCHECK option missed to check register A2. - All calls through the dos.library check now whether A6 is loaded with DOSBase and create a warning if not so. While forgetting to load A6 with DOSBase was permissible in Kick 1.3 and before due to the BCPL nature of dos, it is expected this will be phased out in the future. - All calls through the public dos.library GlobVec create now a warning. Again, this was permissible in Kick 1.3 and before, though it is expected that BCPL legacy will be phased out. ---------------------------------------------------------------------- Release 40.1: First official (non-preview) release - The assembly syntax parser also attempted to contents of macros instead of skipping them, causing some confusion. - The assembly syntax parser did not recognize the ' operator. - The ##check block parser got confused on terminating blank spaces. In net effect, this caused parsing errors on . - OsGrind is now also prepared to patch functions that are used within the SetFunction() function itself. - The OsGrind.config file was extended to also check for the validity of the mode/type arguments of Open() and Lock(). - There was a bad bit check in AllocNamedObject() that was fixed in the default OsGrind.config. ---------------------------------------------------------------------- Release 40.0: This is an internal beta release. ---------------------------------------------------------------------- Installation: - Copy OsGrind to whereever you like, possibly C: - Copy OsGrind.config to ENVARC: The config file assumes that the following assigns are made: FD: shall point to the directory containing the library definition files, such as exec_lib.fd or dos_lib.fd. INCLUDE: shall point to the directory containing the operating system include files, preferably the V44 (Os 3.9) or later includes. It is recommended to install the following additional components: - SegTracker: If SegTracker is available and run upfront this tool, OsGrind will print hunk and offset information of the stack trace back. - disassembler.library (from the MuForce package): If present, OsGrind may be instructed to generate a disassembly around the faulty call path. - Sashimi: By default, OsGrind will report its debug output to the serial port, 9600 baud, 8 bit, no parity. With Sashimi, debug output can be redirected to a console. Optionally, with Os 3.2 or above, the system logger of the boot menu can be used to this end as well. - MuForce: To capture additional problems, installing this tool is recommended as well. OsGrind does, by default, not run in background, and aborts on ^C. To run it in background, use the "RUN" command, or the "&" (runback) operator of the shell. ---------------------------------------------------------------------- OsGrind command line arguments: OsGrind PATCHFILE,QUIT=OFF/S,DEBUG/S,STACKLINES/K/N, DREGCHECK/S,AREGCHECK/S,STACKCHECK/S, DISPC=SHOWDIS/S,DISRANGE/K/N,DISABLEBELL/S, LED/K/N,DRYRUN/S PATCHFILE: The file to read the configuration from. By default, the configuration is read from ENV:OsGrind.config. The syntax of the configuration file is discussed in Syntax.REAMDE QUIT=OFF: Stops a running instance of OsGrind. Alternatively, you can stop OsGrind via ^C (Control-C) from the console. DEBUG: Writes the run-time compiled code to the output stream to allow manual validation of the Os patches. Provide this output to allow me to debug OsGrind. STACKLINES:A numerical argument that specifies how many lines of stack OsGrind shall print as stack traceback, and optionally check for hunk/offset information by SegTracker. DREGCHECK: Test the data registers through SegTracker. AREGCHECK: Test the address registers through SegTracker. STACKCHECK:Test stack traceback through SegTracker. DISPC: Provide a disassembly around the faulty Os call. This argument requires the disassembler.library in LIBS:. DISRANGE: The size of the disassembled region in bytes. Disassembly starts roughly this number of bytes ahead of the PC, and continues approximately the same number of bytes below the PC. DISABLEBELL: Disable printing the BELL character upon hits, i.e. invalid function arguments. LED: Determines the delay for flashing the power LED upon a hit. If 0, the LED is not flashed. Larger numbers delay longer. DRYRUN: Only read the configuration file, test its syntax and optionally print the generated code, but do not install patches. ---------------------------------------------------------------------- The THOR-Software Licence (v3, January 2nd 2021) This License applies to the computer programs known as the "OsGrind". The "Program", below, refers to such program. The "Archive" refers to the package of distribution, as prepared by the author of the Program, Thomas Richter. Each licensee is addressed as "you". The Program and the data in the archive are freely distributable under the restrictions stated below, but are also Copyright (c) Thomas Richter. Distribution of the Program, the Archive and the data in the Archive by a commercial organization without written permission from the author to any third party is prohibited if any payment is made in connection with such distribution, whether directly (as in payment for a copy of the Program) or indirectly (as in payment for some service related to the Program, or payment for some product or service that includes a copy of the Program "without charge"; these are only examples, and not an exhaustive enumeration of prohibited activities). However, the following methods of distribution involving payment shall not in and of themselves be a violation of this restriction: (i) Distributing the Program on a physical data carrier (e.g. CD-ROM, DVD, USB-Stick, Disk...) provided that: a) the Archive is reproduced entirely and verbatim on such data carrier, including especially this licence agreement; b) the data carrier is made available to the public for a nominal fee only, i.e. for a fee that covers the costs of the data carrier, and shipment of the data carrier; c) a data carrier with the Program installed is made available to the author for free except for shipment costs, and d) provided further that all information on said data carrier is redistributable for non-commercial purposes without charge. Redistribution of a modified version of the Archive, the Program or the contents of the Archive is prohibited in any way, by any organization, regardless whether commercial or non-commercial. Everything must be kept together, in original and unmodified form. Limitations. THE PROGRAM IS PROVIDED TO YOU "AS IS", WITHOUT WARRANTY. THERE IS NO WARRANTY FOR THE PROGRAM, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. IF YOU DO NOT ACCEPT THIS LICENCE, YOU MUST DELETE THE PROGRAM, THE ARCHIVE AND ALL DATA OF THIS ARCHIVE FROM YOUR STORAGE SYSTEM. YOU ACCEPT THIS LICENCE BY USING OR REDISTRIBUTING THE PROGRAM. Thomas Richter ---------------------------------------------------------------------- Send ideas, improvements, bugreports (please as concrete as possible) to: Thomas Richter EMail: thomas.richter@alumni.tu-berlin.de ---------------------------------------------------------------------- Thomas Richter, March 2023