8 Commits
Author SHA1 Message Date
tomer doron c085164685 update vendored copy of libbacktrace (#59)
motivation: catch up to fixes and improvments in underlying library

changes:
* vendor latest version of libbacktrace
* update vendoring script to exclude some new files that are not needed
2022-06-09 11:16:22 -07:00
Johannes Weiss 4353fd38d5 Merge branch 'main' into jw-error 2021-02-22 11:09:50 +00:00
Johannes Weiss 566d2454b2 determine the executable path automatically
Motivation:

Previously, we would use
`CommandLine.arguments[0]`/`argv[0]`/`getexecname()` as the preferred
ways to find the main binary. That sounds sensible, especially given
the fact that we'd fall back onto other methods (such as
`/proc/self/exe`) when the previous ones don't work.

There is however an unfortunate edge case. If you for example have your
app binary at `/app/app` and you start it with a relative path `./app`
from within `/app`, then `CommandLine.arguments[0]` will only contain
`./app`. If now the app changes its working directory to `/`, `./app`
would mean `/app` which is the directory. This would mean we will find
the target but instead of the binary we'd find the directory `/app`.
From then on, everything else fails.

A similar problem is if `argv[0]` was actually set incorrectly when
`exec*`ing the process. This has happened at least in one instance.

Modification:

Given that we only target Linux here, we can actually here, we can
change the order in which we try to find the main binary. We can start
by using `/proc/self/exe` which is a very high quality and almost
guaranteed to work way to find the main binary, nevermind the
information in `argv`.

Result:

More robust symbolications, especially in environments like Heroku/Dokku
where we've seen `argv` not being set correctly.
2021-02-21 18:28:38 +00:00
Johannes Weiss c8d8ddd88b better distinguish mmap errors & print errno
Motivation:

In case SwiftBacktrace fails, we get only very little output.
Unfortunately, some crucial information (like the errno) is missing and
in case `mmap` fails, we don't know if the problem is file I/O or
allocating memory.

Modification:

- print errnos
- distinguish the two mmaps

Result:

Easier debugging
2021-02-20 23:12:33 +00:00
Ian Partridge eaf2cef011 feat: cross-compilation (#17) 2019-09-03 14:28:12 +01:00
Ian Partridge fabd575ba5 feat: use libbacktrace (#8) 2019-07-09 15:30:38 +01:00
Ian Partridge 423feb0043 fix: Build CBacktrace as system library 2019-04-20 20:53:01 +01:00
Ian Partridge dd4aad9a1a Initial commit 2019-04-19 21:02:35 +01:00