2

I found a bug in latest Xcode 7.0 that annoys us very much in our company because it makes most of our C++ code not debuggable. After lots of experiment, I was able to reproduce it with a minimum amount of code.

In some cases, it is impossible to see members inside a C++ class on LLDB. It seems that three conditions must be present for that bug to appear:

  • the class is forward declared
  • the class has a virtual method
  • the class is declared inside a precompiled header

I am asking whether somebody else already knowns about that bug and what is the recommended procedure to report that bug (to LLVM or Apple ?).

Steps to reproduce:

Create two source files with their content:

header.h

#ifndef HEADER_INCLUDED
#define HEADER_INCLUDED

class A; // forward declaration, has an effect on bug

class A
{
public :
    virtual ~A() {}
protected:
    int doYouSeeMe;
};

#endif

PCHAndFDbug.cpp

#include "header.h"

int main()
{
    A* a = new A();
    return 0;
}

Create a small Xcode 7 project with these two files. header.h must be set as a precompiled header (Prefix header setting in Xcode). As a reference, I am using Premake to generate that project and here is the premake5.lua source:

solution "PCHAndFDbug"
    configurations {"Debug"}
    xcodebuildsettings { MACOSX_DEPLOYMENT_TARGET = "10.7" }

project "WithPCH"
    language "C++"
    files {"PCHAndFDbug.cpp", "header.h"}
    kind "ConsoleApp"
    pchheader "header.h"

project "WithoutPCH"
    language "C++"
    files {"PCHAndFDbug.cpp", "header.h"}
    kind "ConsoleApp"

Place a breakpoint on the return 0 statement. Check if you can see member doYouSeeMe in a variable.

prapin
  • 6,395
  • 5
  • 26
  • 44

2 Answers2

2

For Apple at least, you should submit a bug report through the developer centre https://developer.apple.com/bug-reporting/

I've encountered this bug too and it is annoying.

jdtec
  • 51
  • 3
2

Same issue for me. Fixed by turning off "Enable Clang Module Debugging" in the Build Settings

K1w1Geek
  • 605
  • 5
  • 5