diff options
| author | Greg Clayton <gclayton@apple.com> | 2012-09-07 20:29:13 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2012-09-07 20:29:13 +0000 |
| commit | 0662d966dc6851ebaa7697ba70d8855c0464910e (patch) | |
| tree | bbc9d84eac692468a943286fb1ba909b793d6d27 | |
| parent | 1f57bcb1a0a8faa7d6646714d4421e8546decb00 (diff) | |
| download | bcm5719-llvm-0662d966dc6851ebaa7697ba70d8855c0464910e.tar.gz bcm5719-llvm-0662d966dc6851ebaa7697ba70d8855c0464910e.zip | |
Train LLDB to deal with bad linker N_SO entries that point to our source files for debug map + DWARF in .o file debugging.
llvm-svn: 163417
| -rw-r--r-- | lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 898f58123a6..f44f1856ace 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -1822,6 +1822,24 @@ ObjectFileMachO::ParseSymtab (bool minimize) if (so_path && so_path[0]) { std::string full_so_path (so_path); + const size_t double_slash_pos = full_so_path.find("//"); + if (double_slash_pos != std::string::npos) + { + // The linker has been generating bad N_SO entries with doubled up paths + // in the format "%s%s" where the first stirng in the DW_AT_comp_dir, + // and the second is the directory for the source file so you end up with + // a path that looks like "/tmp/src//tmp/src/" + FileSpec so_dir(so_path, false); + if (!so_dir.Exists()) + { + so_dir.SetFile(&full_so_path[double_slash_pos + 1], false); + if (so_dir.Exists()) + { + // Trim off the incorrect path + full_so_path.erase(0, double_slash_pos + 1); + } + } + } if (*full_so_path.rbegin() != '/') full_so_path += '/'; full_so_path += symbol_name; @@ -2545,6 +2563,24 @@ ObjectFileMachO::ParseSymtab (bool minimize) if (so_path && so_path[0]) { std::string full_so_path (so_path); + const size_t double_slash_pos = full_so_path.find("//"); + if (double_slash_pos != std::string::npos) + { + // The linker has been generating bad N_SO entries with doubled up paths + // in the format "%s%s" where the first stirng in the DW_AT_comp_dir, + // and the second is the directory for the source file so you end up with + // a path that looks like "/tmp/src//tmp/src/" + FileSpec so_dir(so_path, false); + if (!so_dir.Exists()) + { + so_dir.SetFile(&full_so_path[double_slash_pos + 1], false); + if (so_dir.Exists()) + { + // Trim off the incorrect path + full_so_path.erase(0, double_slash_pos + 1); + } + } + } if (*full_so_path.rbegin() != '/') full_so_path += '/'; full_so_path += symbol_name; |

