开发者

Pointer into table is causing symbols to not be loaded

开发者 https://www.devze.com 2023-04-05 11:15 出处:网络
I have several large tables in my program, and I\'m trying to write a class to provide a generic interface with these tables. Each table is in its own header file, and contains a const double array an

I have several large tables in my program, and I'm trying to write a class to provide a generic interface with these tables. Each table is in its own header file, and contains a const double array and several variables that describe the layout of the table. All of the tables are included in my precompiled header.

My class only has an initialize function where it determines which table to use, and then sets its member variables to the appropriate values, and sets its double pointer to the first element of the array. I have some #defines that determine which set of tables to use, and then an enum that I pass into the initialize function to determine which table in the given set to use. So my initialize function looks 开发者_如何学Pythonlike:

void CMyClass::initialize(enum mode)
{
#ifdef VERSION1
    switch (mode)
    {
        case mode1:
        m_Data = &tableVersion1Mode1[0];
        //set member variables
        break;

        case mode2:
        m_Data = &tableVersion1Mode2[0];
        //set member variables
        break;

        case mode3:
        m_Data = &tableVersion1Mode3[0];
        //set member variables
        break;
    }
#endif

#ifdef VERSION2
    switch(mode)
    {
        //same thing
    }
#endif

//etc etc
}

The problem is that under some situations, the debug symbols for this program aren't loaded and none of the breakpoints are being hit. I've narrowed the problem down to the double pointer in this class, since I can just comment out this member variable and the problem goes away. But I'm completely baffled by its behavior.

If I set the pointer to a different table in each case, like above, then no symbols are loaded.

If I comment out one of the pointer assignments, regardless of which, the symbols are loaded and everything works fine.

If I set the pointer to the same array for any two or all three cases, then the symbols are loaded and everything works fine.

I did some research on the subject, and I know that if the symbols aren't being loaded then it's probably an issue with the .pdb files. I've tried manually loading the .pdb, and it says that it doesn't match. But if I run ChkMatch.exe on the executable and the .pdb, it says they match. So what's going on?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号