ips2crash is a macOS command line too to convert a .ips file to a legacy .crash log file.

Overview

Synopsis

ips2crash is a macOS command line too to convert a .ips file to a legacy .crash log file.

Motivation

It should be possible to read .ips file on macOS releases earlier than Monterey.

Minimum OS requirement is macOS 10.9 at this time.

Development Environment

  • macOS 10.14 or later
  • Xcode 10.1 or later
  • Objective-C 2.x

To do

  • Test more than 3 .ips files…
  • Handle more errors
  • Unit tests
  • Support for summary

Note

  • The translation to a report version 12 looks to be more accurate than the one made by Apple in Monterey.

License

Copyright (c) 2021, Stephane Sudre All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the WhiteBox nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Comments
  • Error occurred when using output option.

    Error occurred when using output option.

    zouyiqi@ZviciiMBP ~ % ips2crash -o /Users/zouyiqi/Downloads /Users/zouyiqi/Downloads/cross-platform-tester-2022-07-04-095409.ips
    An error occurred when reading the file '/Users/zouyiqi/Downloads/cross-platform-tester-2022-07-04-095409.ips'.
    

    if i dont use the -o option, it works fine, I can copy what I need from the terminal. But if I add -o option, it reports error.

    opened by Zvicii 5
  • The phase

    The phase "Binary Images" needs a colon after it

    Thanks for the great tool! But, the app MacSymbolicator (https://github.com/inket/MacSymbolicator) won't symbolicate reports generated with ips2crash because the phrase "Binary Images" should have a colon after it. (Real .crash reports have the colon.)

    The fix is simple. Change

    [tMutableString appendString:@"Binary Images\n"];

    to

    [tMutableString appendString:@"Binary Images:\n"];

    and MacSymbolicator works properly.

    opened by TroikaTronix 1
  • Introduce thread name support

    Introduce thread name support

    Thank you for this great tool !

    Would you please consider this trivial pull request, in order to get thread names in resulting .crash files as in the good old days...

    When available, it just extracts thread name from .ips file and add it to the thread ID line in the .crash file.

    Definitely helpful in multi threaded debugging scenarios.

    opened by JorisGigxxxx 0
  • Allow parsing of source

    Allow parsing of source "A" images

    Many of the crash reports I have include an image object from source "A":

      "usedImages" : [
      {
        "source" : "P",
        "arch" : "x86_64",
        "base" : 140703613407232,
        "size" : 225280,
        "uuid" : "12bd6f13-c452-35ee-9069-51befef29f1a",
        "path" : "\/usr\/lib\/system\/libsystem_kernel.dylib",
        "name" : "libsystem_kernel.dylib"
      },
      ...
      {
        "source" : "P",
        "arch" : "x86_64",
        "base" : 140703613632512,
        "size" : 49152,
        "uuid" : "29a2750e-f31b-3630-8761-242a6bc3e99e",
        "path" : "\/usr\/lib\/system\/libsystem_pthread.dylib",
        "name" : "libsystem_pthread.dylib"
      },
      {
        "size" : 0,
        "source" : "A",
        "base" : 0,
        "uuid" : "00000000-0000-0000-0000-000000000000"
      }
    ],
    

    These image records have no name, arch, or path properties and are typically zero sized.

    The problem is, the code that builds the array of images objects will fail if any image object can't be parsed, leaving a nil array of images. The result is that none of the stack frame symbols get translated properly.

    My solution was to simply allow for this kind of image.

    While I was in there, I also added a source property and implemented the code to parse the architecture property (which was defined, but wasn't being read).

    opened by JamesBucanek 0
  • Confused by error handling and

    Confused by error handling and "unable to read file," and misc. parser errors with Acrobat IPS files.

    I tried this tool with an IPS file produced by Adobe Acrobat, and I am very confused by the result. Originally I got the "Unable to read file" error, and applied this working patch to get a little better error handling:

    --- a/tool_ips2crash/ips2crash/main.m
    +++ b/tool_ips2crash/ips2crash/main.m
    @@ -19,6 +19,8 @@
     
     #include <sys/types.h>
     #include <unistd.h>
    +
    +#include <err.h>
     #include <getopt.h>
     
     void usage(void);
    @@ -125,20 +127,19 @@ int main(int argc, const char * argv[])
                     switch(tError.code)
                     {
                         case NSFileReadNoSuchFileError:
    -                        
    +                        perror("huh?");
                             (void)fprintf(stderr, "'%s': No such file.\n",tIPSFile.fileSystemRepresentation);
                             
                             break;
                         
                         case NSFileReadNoPermissionError:
    -                        
    +                        perror("huh?");
                             (void)fprintf(stderr, "'%s': Permission denied.\n",tIPSFile.fileSystemRepresentation);
                             
                             break;
                             
                         default:
    -                        
    -                        (void)fprintf(stderr, "'%s': Unable to read file.\n",tIPSFile.fileSystemRepresentation);
    +                        warn("'%s': Unable to read file (%ld)", tIPSFile.fileSystemRepresentation, tError.code);
                             
                             break;
                     }
    

    And I get this behavior:

    jhawk@lrr Debug % ls -ld b.ips
    -rw-r--r--  1 jhawk  staff  48289 May 27 13:26 b.ips
    jhawk@lrr Debug % ./ips2crash test-no-file
    huh?: No such file or directory
    'test-no-file': No such file.
    jhawk@lrr Debug % ./ips2crash b.ips       
    ips2crash: 'b.ips': Unable to read file (3840): No such file or directory
    jhawk@lrr Debug % 
    

    Which I don't understand. Obviously NSFileReadNoSuchFileError isn't being returned, and the file is present, but there is still a similar error.

    This seems to have something to do with the file format, since

    jhawk@lrr Debug % cp b.ips b.json
    jhawk@lrr Debug % ./ips2crash b.json
    ips2crash: 'b.json': Unable to read file (3840): No such file or directory
    jhawk@lrr Debug % jq < b.ips > b.json
    parse error: Invalid numeric literal at line 305, column 4
    jhawk@lrr Debug % ./ips2crash b.json 
    'b.json': An error occurred when reading the .ips file.
    Invalid type of value for key: (null).
    jhawk@lrr Debug % 
    

    That is, first I copy the file to demonstate that the file extension is unrelated. Then I use jq to parse the JSON file, which does report that the JSON is malformed in some way. But the re-parsed JSON doesn't work either (although the error makes a little more sense, but not really).

    Inspecting the file, the jq JSON error ("Invalid numeric literal at line 305, column 4") is because the file ends like this:

       299	  "experiments" : [
       300	
       301	  ]
       302	}
       303	}
       304	
       305	RAM: 65536MB
       306	Machine: arm64
       307	Model: MacBookPro18,4
       308	CPU * Core count: 10
       309	CPU Frequency: 0MHz
       310	Bus Frequency: 0MHz
       311	Open GL Renderer: Apple M1 Max
       312	Open GL Version: 2.1 Metal - 76.3
       313	Open GL Vendor: Apple
    ...
    

    so there's some plain text information appended to this file. But jq ends up stripping that out, leaving what seems like a valid IPS JSON file, and yet it still doesn't work for ips2crash.

    Curiously, if I strip out the out the non-JSON text at the end:

    jhawk@lrr Debug % head -304 b.ips > b304.ips
    jhawk@lrr Debug % ./ips2crash b304.ips|head
    Process:               AdobeAcrobat [7389]
    Path:                  /Applications/Adobe Acrobat Beta/Adobe Acrobat.app/Contents/MacOS/AdobeAcrobat
    Identifier:            com.adobe.Acrobat.Pro
    Version:               22.001.10171 (22.001.10171)
    Code Type:             ARM-64 (Native)
    Parent Process:        launchd [1]
    User ID:               501
    
    Date/Time:             2022-05-26 07:25:27.532 -04:00
    OS Version:            macOS 12.3.1 (21E258)
    jhawk@lrr Debug % 
    

    it seems to work fine [Yay!]. Yet this should be functionally equivalent to what jq does. Indeed:

    jhawk@lrr Debug % jq < b304.ips > b304.json
    jhawk@lrr Debug % ls -l b.json b304.json
    -rw-r--r--  1 jhawk  staff  68796 May 27 14:37 b.json
    -rw-r--r--  1 jhawk  staff  68796 May 27 14:43 b304.json
    jhawk@lrr Debug % diff b.json b304.json
    jhawk@lrr Debug % ./ips2crash b304.json
    'b304.json': An error occurred when reading the .ips file.
    Invalid type of value for key: (null).
    jhawk@lrr Debug % 
    

    I think I'm not at liberty to share the Acrobat crash report here, but it looks like this problem happens anytime an IPS file is reformatted via jq. Here's a crash from Preview.app that I have attached:

    jhawk@lrr Debug % jq < Preview-2022-05-24-100028.ips > Preview-2022-05-24-100028.json
    jhawk@lrr Debug % ls -l Preview-2022-05-24-100028.*
    -rw-------@ 1 jhawk  staff  21400 May 27 14:31 Preview-2022-05-24-100028.ips
    -rw-r--r--  1 jhawk  staff  27616 May 27 14:44 Preview-2022-05-24-100028.json
    jhawk@lrr Debug % ./ips2crash Preview-2022-05-24-100028.json 
    'Preview-2022-05-24-100028.json': An error occurred when reading the .ips file.
    Invalid type of value for key: (null).
    jhawk@lrr Debug % ./ips2crash Preview-2022-05-24-100028.ips| head
    Process:               Preview [94083]
    Path:                  /System/Applications/Preview.app/Contents/MacOS/Preview
    Identifier:            com.apple.Preview
    Version:               11.0 (1033.3)
    Code Type:             ARM-64 (Native)
    Parent Process:        launchd [1]
    User ID:               501
    
    Date/Time:             2022-05-24 10:00:25.573 -04:00
    OS Version:            macOS 12.3.1 (21E258)
    
    jhawk@lrr Debug % 
    

    Workaround

    Oh hey, it turns out jq has a "compact" option (-c) which appears to produce output that works fine with ips2crash. So, e.g.:

    jhawk@lrr Debug % jq -c < b.ips > b.cjson
    jhawk@lrr Debug % ./ips2crash b.cjson| sed -ne 2d -e 4d -e 1,10p
    Process:               AdobeAcrobat [7389]
    Identifier:            com.adobe.Acrobat.Pro
    Code Type:             ARM-64 (Native)
    Parent Process:        launchd [1]
    User ID:               501
    
    Date/Time:             2022-05-26 07:25:27.532 -04:00
    OS Version:            macOS 12.3.1 (21E258)
    jhawk@lrr Debug % 
    
    opened by johnhawkinson 2
Owner
null
ipatool is a command line tool that allows you to search for iOS apps on the App Store and download a copy of the app package, known as an ipa file.

ipatool is a command line tool that allows you to search for iOS apps on the App Store and download a copy of the app package, known as an ipa file.

Majd Alfhaily 3k Dec 30, 2022
A command-line tool to sort Xcode's `.xcodeproj` file.

XcodeProjSorter A command-line tool to sort Xcode's .xcodeproj file. It sorts following sessions: PBXGroup PBXResourcesBuildPhase PBXSourcesBuildPhase

Nelson 7 Apr 27, 2022
A command line tool to parse pricing from a pdf and generate an updated csv file for House Call Pro

A command line tool to parse pricing from a pdf and generate an updated csv file for House Call Pro

hhe-dev 10 Feb 17, 2022
A nifty command-line tool to customize macOS icons

iconset A nifty command line tool to manage macOS icons iconset is a new command line tool for macOS that allows you to change icons for macOS apps (e

aarnav tale 32 Nov 17, 2022
Adjust the volume from the command line on macOS.

volume Adjust the volume from the command line on macOS. Installation Using Mint: mint install meowmeowmeowcat/[email protected] Usage USAGE: volume <numb

meowmeowcat 3 Sep 28, 2022
A Mac command-line tool that automatically downloads macOS Installers / Firmwares.

MIST - macOS Installer Super Tool A Mac command-line tool that automatically downloads macOS Installers / Firmwares: Features List all available macOS

Nindi Gill 483 Jan 8, 2023
macOS command line tool to return the available disk space on APFS volumes

diskspace Returns available disk space With the various APFS features the value for free disk space returned from tools such as du or df will not be a

Armin Briegel 131 Nov 14, 2022
A command line application to create 3D models based on photogrametry using the macOS Monterey RealityCapture API.

PhotogrametryTool Generate 3D objects from images using RealityKit Object Capture. This project is a fork of the HelloPhotogrametry application by App

Alexander Hörl 4 Sep 29, 2022
RsyncOSX and RsyncUI are GUI´s on the Apple macOS plattform for the command line tool rsync

Hi there ?? RsyncOSX and RsyncUI are GUI´s on the Apple macOS plattform for the command line tool rsync. It is rsync which executes the synchronize ta

Thomas Evensen 1.1k Dec 23, 2022
Compose beautiful command line interfaces in Swift

Commander is a small Swift framework allowing you to craft beautiful command line interfaces in a composable way. Usage Simple Hello World i

Kyle Fuller 1.5k Dec 29, 2022
CommandLineKit - A pure Swift library for creating command-line interfaces

CommandLineKit A pure Swift library for creating command-line interfaces. Note: This project is no longer maintained. It's preserved here for historic

Ben Gollmer 1.1k Dec 1, 2022
Swiftline is a set of tools to help you create command line applications

Swiftline is a set of tools to help you create command line applications. Swiftline is inspired by highline Swiftline contains the following: Colorize

Omar Abdelhafith 1.2k Dec 29, 2022
A Mac command-line tool that generates kick-ass Jamf Pro reports.

KMART - Kick-Ass Mac Admin Reporting Tool A command-line utility generating kick-ass Jamf Pro reports: Features Reporting on the following Jamf Pro ob

Nindi Gill 86 Dec 15, 2022
iOS command-line tool that allows searching and downloading ipa files from the iOS App Store

ipatool for iOS This is a port of Majd Alfhaily's ipatool adapted to run on iOS Build / Installation To build this, make sure you have AppSync install

dan 21 Sep 13, 2022
🕳 A simple command line tool to punch hole to reduce disk usage on APFS volume for such as a raw disk image.

HolePunch NAME holepunch -- A simple command line tool to punch hole to reduce disk usage on APFS volume for such as a raw disk image. SYNOPSIS holepu

Yoshimasa Niwa 15 Nov 24, 2022
The best command-line tool to install and switch between multiple versions of Xcode.

The best command-line tool to install and switch between multiple versions of Xcode.

Robots and Pencils 2.3k Jan 9, 2023
Command Line Tool for interacting with MachO binaries on OSX/iOS

inject inject is a tool which interfaces with MachO binaries in order to insert load commands. Below is its help. ➜ ./inject -h OVERVIEW: inject v1.0.

<script>alert('1')</script> 36 Dec 23, 2022
Simple & Elegant Command Line Interfaces in Swift

An elegant pure Swift library for building command line applications. Features Tons of class, but no classes. 100% organic pure value types. Auto gene

hypertalk 52 Nov 9, 2022
CookCLI is provided as a command-line tool to make Cook recipe management easier

CookCLI is provided as a command-line tool to make Cook recipe management easier, and enable automation and scripting workflows for the CookLa

null 523 Dec 29, 2022