swiftlang / swiftlang/swift-java

Docs/guide about debugging crashes for java developers

Open
#683 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
Swift
Stars
1.2k
Forks
123
Avg merge
1d 7h
Merged PRs (30d)
16

Description

It's important to teach how java developers can debug crashes in swift.

E.g. a crash


     Stack: [0x000000016d7c8000,0x000000016d9cb000],  sp=0x000000016d9c5d10,  free space=2039k
     Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
     V  [libjvm.dylib+0x579b14]  jni_GetArrayLength+0x108
     C  [libSwiftJava.dylib+0x1a1dc4]  $sSa16SwiftJavaJNICoreAA0B5ValueRzlE7fromJNI2inSayxGSvSg_SpySPySo18JNINativeInterfaceVGSgGtcfC+0x118
     C  [libSwiftJava.dylib+0x1a4c24]  $sSayxG16SwiftJavaJNICore0B5ValueA2bCRzlAbCP7fromJNI2inx7JNITypeQz_SpySPySo18JNINativeInterfaceVGSgGtcfCTW+0x20
     C  [libSwiftJava.dylib+0x1a277c]  $sSa16SwiftJavaJNICoreAA0B5ValueRzlE7fromJNI2inSayxGSvSg_SpySPySo18JNINativeInterfaceVGSgGtcfcx7JNITypeQzXEfU2_+0xb8
     C  [libSwiftJava.dylib+0x1a27bc]  $sSa16SwiftJavaJNICoreAA0B5ValueRzlE7fromJNI2inSayxGSvSg_SpySPySo18JNINativeInterfaceVGSgGtcfcx7JNITypeQzXEfU2_TA+0x2c
     C  [libSwiftJava.dylib+0x1988]  $sSlsE3mapySayqd__Gqd__7ElementQzqd_0_YKXEqd_0_YKs5ErrorRd_0_r0_lF+0x400
     C  [libSwiftJava.dylib+0x1a2150]  $sSa16SwiftJavaJNICoreAA0B5ValueRzlE7fromJNI2inSayxGSvSg_SpySPySo18JNINativeInterfaceVGSgGtcfC+0x4a4
     C  [libMySwiftLibrary.dylib+0x36670]
     $s14MySwiftLibrary023Java_com_example_swift_abC29__00024nestedByteArray___3_3B11environment9thisClass5arraySvSgSpySPySo18JNINativeInterfaceVGSgGSg_SvAFtF+0xe8
     C  [libMySwiftLibrary.dylib+0x36580]  Java_com_example_swift_MySwiftLibrary__00024nestedByteArray___3_3B+0xc
     j  com.example.swift.MySwiftLibrary.$nestedByteArray([[B)[[B+0
     j  com.example.swift.MySwiftLibrary.nestedByteArray([[B)[[B+9
     j  com.example.swift.ArraysTest.lambda$nestedByteArray_null$1()V+24
     j  com.example.swift.ArraysTest$$Lambda+0x0000060001166dc0.execute()V+0
     j  org.junit.jupiter.api.AssertThrows.assertThrows(Ljava/lang/Class;Lorg/junit/jupiter/api/function/Executable;Ljava/lang/Object;)Ljava/lang/Throwable;+1
     j  org.junit.jupiter.api.AssertThrows.assertThrows(Ljava/lang/Class;Lorg/junit/jupiter/api/function/Executable;)Ljava/lang/Throwable;+3
     j  org.junit.jupiter.api.Assertions.assertThrows(Ljava/lang/Class;Lorg/junit/jupiter/api/function/Executable;)Ljava/lang/Throwable;+2
     j  com.example.swift.ArraysTest.nestedByteArray_null()V+18

can be demangled using cat ... | swift demangle but java developers may not know about this etc.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the crash output in the issue and the mentioned swift demangle command; no documentation file or test is identified in the payload. The guide should explain how Java developers can investigate Swift crashes and demangle the native stack frames, using the provided example as the reference for completion.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, swift
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.