[lldb-dev] [BUG?] Confusion between translation units?

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Tue Oct 20 17:22:33 PDT 2015

>> Are you pulling in data from two different copies of LLVM in your project? Or is something in here symlink to the other somewhere?
> Excellent find. Yes, 3p_mirror is a symlink to the 3p-tmw-osx location.
>> So to sum up: LLDB uniques types by decl file + decl line + byte size + fully qualified typename and that is failing because the decl files are different for these two types from the debug infos point of view. And these types could actually differ since they come from different files and we need to allow this so that we can display these types.
> I'm slightly confused: can't we ask Clang to tell us if the two types
> are structurally equivalent? Is this some short-cut? We need to
> account for symlinks then, it seems.

Yep. Try replacing Declaration::Compare() in lldb/source/Symbol/Declaration.cpp. You will need to include:

#include "lldb/Host/FileSystem.h"

Then replace Declaration::Compare() with this:

Declaration::Compare(const Declaration& a, const Declaration& b)
    int result = FileSpec::Compare(a.m_file, b.m_file, true);
    if (result)
        int symlink_result = result;
        if (a.m_file.GetFilename() == b.m_file.GetFilename())
            // Check if the directories in a and b are symlinks to each other
            FileSpec resolved_a;
            FileSpec resolved_b;
            if (FileSystem::ResolveSymbolicLink(a.m_file, resolved_a).Success() &&
                FileSystem::ResolveSymbolicLink(b.m_file, resolved_b).Success())
                symlink_result = FileSpec::Compare(resolved_a, resolved_b, true);
        if (symlink_result != 0)
            return symlink_result;
    if (a.m_line < b.m_line)
        return -1;
    else if (a.m_line > b.m_line)
        return 1;
    if (a.m_column < b.m_column)
        return -1;
    else if (a.m_column > b.m_column)
        return 1;
    return 0;

Then try running and let me know what your results are!

More information about the lldb-dev mailing list