Various Dwarf::Path fixes
authorAndrew Gallagher <agallagher@fb.com>
Sat, 20 Dec 2014 05:56:23 +0000 (21:56 -0800)
committerDave Watson <davejwatson@fb.com>
Mon, 29 Dec 2014 18:39:56 +0000 (10:39 -0800)
commit3468cb59a4676d26ebbb93ed80018d7a9a9ff262
tree88851fbd74b20a203f8bd67fc106878dd11a2ae5
parent5a65b2bd85abeb444218f2b0bf751518847bd632
Various Dwarf::Path fixes

Summary:
- Allow both `baseDir` and `subDir` to be empty.  This can happen
if DW_AT_comp_dir is `.` and gets simplified to the empty string.
(The DWARF standard doesn't appear to disallow relative dirs here,
but I couldn't find anthing definitive).
- Fix `./` prefix  stripping to avoid making paths like `.///hello` absolute.
- Fix `/` suffix stripping to avoid making the root dir reference (`/`) empty.
- Do `baseDir` and `subDir` swapping after simplification.

Test Plan: Added unittests.

Reviewed By: njormrod@fb.com

Subscribers: trunkagent, sdwilsh, folly-diffs@

FB internal diff: D1747978

Signature: t1:1747978:1419014942:87f14cb31b8c19b524d7a95b14d63cf5661a8634
folly/experimental/symbolizer/Dwarf.cpp
folly/experimental/symbolizer/test/DwarfTests.cpp [new file with mode: 0644]