swift-server / swift-backtrace

đŸ’Ĩ Backtraces for Swift on Linux and Windows
Apache License 2.0
295 stars 35 forks source link

Is it arm64 supported? #19

Open rmaqueda opened 4 years ago

rmaqueda commented 4 years ago

Hello,

First of all thanks for this tool, it would be amazing for me to have stack traces working on Linux.

I'm trying to use it in a Raspberry pi with Ubuntu (arm64), but I am not able to print the stack trace with Backtrace.print() or forcing a crash and see the stack.

Do you think it could work?

Thanks again.

ianpartridge commented 4 years ago

I'm afraid I don't know, I don't have any ARM64 hardware so I haven't tried it myself.

Your experience suggests that it probably doesn't work đŸ˜ĸ

Let me know if you manage to debug what the problem might be.

rmaqueda commented 4 years ago

Thanks for your quick answer.

I've tried the same code in Ubuntu x86_64 to discard any other kind of problems and is working as expected, so looks like something is wrong with ARM64 😞.

I'm trying to find out what's happening but my knowledges in C and debug in Linux are limited. Any suggestion is very appreciated

Many thanks!

ianpartridge commented 4 years ago

The backtracing code is based on https://github.com/ianlancetaylor/libbacktrace - I couldn't see at a quick glance whether that supports ARM64 or not.

Guang1234567 commented 4 years ago

@rmaqueda

I fork this project to support Android armv7 aarch64 x86 x86_64 arch. Maybe you can refer it, hope it give you some help.

https://github.com/Guang1234567/swift-backtrace

The swift-android-toolchain is here. Usage and Sample also in README.md


Snapshot:

https://github.com/Guang1234567/swift-android-architecture/blob/6542dd554a6f4b8fe622a16ec29da40b204ffe7f/todoapp/app/src/main/swift/Sources/TodoCore/TaskRepository.swift#L55

image

Guang1234567 commented 4 years ago

BTW, this project depends on libunwind.

So have two way to resolve it:

Install the libunwind.so to ubuntu arm64 OS. Maybe you need to compile it from source code by yourself (⊙īšâŠ™).

Then Fork this project and create new swift module name CUnwind like Clibunwind, and make CBacktrace depends on it.

Fork this project and create new swift module name CUnwind and build it from source code by SPM directly, and make CBacktrace depends on it.

ianpartridge commented 4 years ago

Hi @Guang1234567 thanks for the information - it's great to hear you've added ARM support in your fork! Would you be interested in contributing your changes back here in a pull request? I would be happy to merge support for Android.

grahamburgsma commented 2 years ago

Adding a +1 here. I noticed backtrace stopped working when I switched to AWS Graviton. Would be great to have arm64 support!

Guang1234567 commented 2 years ago

Adding a +1 here. I noticed backtrace stopped working when I switched to AWS Graviton. Would be great to have arm64 support!

@grahamburgsma

I fork this repo to support arm64 for android. Hope it save your time.

https://github.com/Guang1234567/swift-backtrace