Граф коммитов

33 Коммитов

Автор SHA1 Сообщение Дата
Nicholas Nethercote 1da10ce58f Handle multiple symbol dirs for a single binary. 2020-03-11 13:48:48 +11:00
Nicholas Nethercote e5b84627cb Add support for Breakpad symbols.
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`.
2020-03-10 17:10:47 +11:00
Nicholas Nethercote b0abef037e
Merge pull request #14 from nnethercote/fix-JSON-handling-more
Fix JSON handling more
2020-03-04 09:58:08 +11:00
Nicholas Nethercote cf9b748ffc JSON-unescape input text when necessary.
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.
2020-03-04 09:52:27 +11:00
Nicholas Nethercote 8933ac5f23 Use "JSON mode" as the name for running with `-j`. 2020-03-04 09:52:01 +11:00
Nicholas Nethercote d5591e4831 Fix a silly mistake in a `format!` call. 2020-03-03 17:35:40 +11:00
Nicholas Nethercote 74b4f4e3de
Merge pull request #13 from nnethercote/fix-JSON-handling
Fix JSON handling
2020-03-03 15:40:09 +11:00
Nicholas Nethercote 7d887fb1e0 Fix JSON handling.
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.
2020-03-03 15:36:24 +11:00
Nicholas Nethercote d84a0a89bc Fix the tests involving file errors.
They currently don't test file errors because the regex doesn't match!
2020-03-03 15:34:24 +11:00
Nicholas Nethercote 42449c2b55
Merge pull request #12 from nnethercote/preserve-file-address
Preserve the file address when a line number isn't known.
2020-03-02 15:35:57 +11:00
Nicholas Nethercote b033797d38 Preserve the file address when a line number isn't known.
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.
2020-03-02 15:19:05 +11:00
Nicholas Nethercote 3b1d4e952d Fix a clippy `single_char_pattern` complaint. 2019-12-06 17:32:18 +11:00
Nicholas Nethercote c65a2029b9
Merge pull request #10 from nnethercote/mac-support
Add Mac support
2019-12-06 11:27:24 +11:00
Nicholas Nethercote 56bf73b44e Add Mac support.
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.
2019-12-06 11:22:59 +11:00
Nicholas Nethercote d088f9e9e0 Change `FileInfo` field order.
Because I decided I prefer it this way.
2019-12-04 13:25:33 +11:00
Nicholas Nethercote e134f416cc Split up `build_file_info`.
This makes it easier to read, and will be helpful for adding Mac
support.
2019-12-04 13:16:41 +11:00
Nicholas Nethercote a28cb41769 Improve how input lines with bad files are handled.
For the reasons explained in the new comment.
2019-12-04 13:16:37 +11:00
Nicholas Nethercote 97cb23ef0b Eliminate the `msg` closure from `Fixer::build_file_info`.
This makes the code a little simpler, and will also make it easier to
split `build_file_info` into more functions.
2019-12-04 12:01:17 +11:00
Nicholas Nethercote 5f60163542
Merge pull request #9 from nnethercote/two-clean-ups
Two clean-ups
2019-12-03 12:15:30 +11:00
Nicholas Nethercote f5c0c05db2 Introduce `FuncInfo::new` and `LineInfo::new`. 2019-11-27 10:29:18 +11:00
Nicholas Nethercote 17f45a8cca Introduce `PRINT_LINES_AND_FUNCS`.
This is a nicer way of controlling the test-generating `eprintln!`
calls.
2019-11-27 10:12:51 +11:00
Nicholas Nethercote 29d5832809
Merge pull request #8 from nnethercote/add-windows-support
Add windows support
2019-11-27 09:55:58 +11:00
Nicholas Nethercote 2a25267ace Split `FileInfo::new` off from `Fixer::build_file_info`. 2019-11-27 09:47:07 +11:00
Nicholas Nethercote ce889579f8 Add windows support.
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.
2019-11-25 14:22:13 +11:00
Nicholas Nethercote 6a6f574b4e Sort func_infos when they are constructed.
They're mostly in order, but not entirely. This is important because we
later do binary search on them!
2019-11-22 15:13:39 +11:00
Nicholas Nethercote c6c9464211
Merge pull request #7 from nnethercote/fix-windows-test-problem
Fix a Windows-only problem with the test.
2019-11-22 09:44:06 +11:00
Nicholas Nethercote e7e135a920 Fix a Windows-only problem with the test.
Git on Windows can't handle the filename `example\"json.c`! Sigh.
2019-11-22 09:37:57 +11:00
Nicholas Nethercote 3a1c46bdf8
Merge pull request #6 from nnethercote/json-escaping
Add the ability to do JSON escaping of printed file and function names.
2019-11-22 08:58:46 +11:00
Nicholas Nethercote 6ac6cbdc27 Add the ability to do JSON escaping of printed file and function names.
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.
2019-11-22 08:55:51 +11:00
Nicholas Nethercote 311b2dafed
Merge pull request #5 from nnethercote/overhaul-test
Overhaul the test.
2019-11-20 08:51:16 +11:00
Nicholas Nethercote c13897f4fa Overhaul the test.
- 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`.
2019-11-19 13:42:33 +11:00
Nicholas Nethercote 6c28eb0788 Initial Linux support.
Mac and Windows are to be done later.
2019-11-18 10:33:41 +11:00
Nicholas Nethercote 128b5d5c07
Initial commit 2019-11-15 08:46:01 +11:00