• Andrew Gallagher's avatar
    Various Dwarf::Path fixes · 3468cb59
    Andrew Gallagher authored
    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
    3468cb59
Dwarf.cpp 23.7 KB