This involves:
- A new option: `-b`/`--breakpad`, for specifying the Breakpad symbols
directory.
- Code for finding particular `.sym` files within that directory.
- Adding a space before the address in output lines, so they don't match
the input regexp and thus won't be double processed.
- A new test, `test_breakpad`.
In JSON mode, an input filename like `c:\\foo\\bar\\baz` currently isn't
unescaped. This has two effects.
- Lookup will use `c:\\foo\\bar\\baz` instead of `c:\foo\bar\baz`. This
doesn't cause problems because repeated separators are treated the
same as single separators, but it is clumsy.
- If the file has errors, error messages will say `c:\\foo\\bar\\baz`
rather than `c:\foo\bar\baz`. Again, understandable but clumsy.
This commit fixes this by unescaping input filenames in JSON mode.
When `-j` is specified, any new strings produced by `fix-stacks` need
JSON escaping. However, any strings that come from the input and are
reused will already be escaped, and so should not be re-escaped.
This commit removes some erroneous escaping of input strings. As a
result, some Windows paths no longer get their backslashes escaped
twice.
This makes the output of `fix-stacks` more closely match the output of
(a) `fix_macosx_stack.py`, and (b) no fixer. This in turn makes it
easier to swap in `fix-stacks` for use with DMD and pass the existing
tests.
This is a lot more complex than the Linux and Windows support. First, we
must handle fat binaries, which contain code for multiple architectures,
using the `symbolic_debuginfo::Archive` type. Second, we must consult
the binary's symbol table and then read debug info from the object files
and archive files mentioned. We use the `goblin` crate for this.
The commit also removes the JSON test, because JSON escaping is now done
with the Windows test due to the use of backslashes in Windows path
names.
And it adds some documentation about how the test inputs were created,
because it's not obvious and worth recording.
Fixes#4.
This is necessary for DMD, which puts file names and function names
within JSON strings.
For testing I had to add a new test binary with the awkward name of
`example"json`, which requires escaping of the '"' char.
- Change the test to use C binary, which is 17 KB, compared to 2.6 MB
for the Rust binary. (Due to Rust's use of static linking.)
- Rename the binary from `example` to `example-linux`, to allow for
other platforms in the future. Likewise renames the test function from
`test1` to `test_linux`.
- Add (commented out) the `eprintln!` statements from which I
constructed the test.
- Change the `tests/EXAMPLE` entry to `tests/no-such-file`. On Windows
and Mac this test was failing because those OSes have case-insensitive
filenames, and so `EXAMPLE` was matching the existing `example` file!
(The abovementioned renaming of `example` to `example-linux` would
have been enough, but `no-such-file` is clearer in general.)
- Add a license notice to `src/tests.rs`.