woshiccm / RCBacktrace

Getting backtrace of any thread for Objective-C and Swift
MIT License
139 stars 24 forks source link

error: String(cString: info.dli_fname) #6

Open tangjianfengVS opened 1 year ago

tangjianfengVS commented 1 year ago

/// Address for which this struct was constructed static func create(address: UInt, index: Int) -> StackSymbol { var info = dl_info() dladdr(UnsafeRawPointer(bitPattern: address), &info)

    let stackSymbol = StackSymbol(symbol: symbol(info: info),
                                  file: String(cString: info.dli_fname),
                                  address: address,
                                  symbolAddress: unsafeBitCast(info.dli_saddr, to: UInt.self),
                                  image: image(info: info),
                                  offset: offset(info: info, address: address),
                                  index: index)
    return stackSymbol
}

error: String(cString: info.dli_fname) RCBacktrace/StackSymbol.swift:57: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value

hborders commented 1 year ago

I also see this issue.