C++ 即使设置了断点(c+;+;),Xcode 4.5调试在单步执行代码时也会跳过函数的一部分
所以我这里有一个函数,据说它从.cfg文件中读取值,并且文件设置正确,但是我对文件所做的更改并没有反映我的值。所以我调试。问题是它跳过了寻找值的迭代!因此,我无法判断它是否只是接受默认值,或者是否有其他错误C++ 即使设置了断点(c+;+;),Xcode 4.5调试在单步执行代码时也会跳过函数的一部分,c++,xcode,debugging,C++,Xcode,Debugging,所以我这里有一个函数,据说它从.cfg文件中读取值,并且文件设置正确,但是我对文件所做的更改并没有反映我的值。所以我调试。问题是它跳过了寻找值的迭代!因此,我无法判断它是否只是接受默认值,或者是否有其他错误 bool ConfigReader::GetBool(const std::string theSection, const std::string theName, const bool theDefault) const {
bool ConfigReader::GetBool(const std::string theSection,
const std::string theName, const bool theDefault) const
{
bool anResult = theDefault; // this is the line where I have a breakpoint set
// Check if theSection really exists
std::map<const std::string, typeNameValue*>::const_iterator iter;
iter = mSections.find(theSection);
if(iter != mSections.end())
{
// Try to obtain the name, value pair
typeNameValue* anMap = iter->second;
if(NULL != anMap)
{
typeNameValueIter iterNameValue;
iterNameValue = anMap->find(theName);
if(iterNameValue != anMap->end())
{
anResult = ParseBool(iterNameValue->second, theDefault);
}
}
}
// Return the result found or theDefault assigned above
return anResult; // this is the line where it skips to (not much help)
}
bool ConfigReader::GetBool(const std::string)节,
const std::字符串名称,const bool theDefault)const
{
bool anResult=theDefault;//这是设置断点的行
//检查该部分是否确实存在
std::map::const_迭代器iter;
iter=mSections.find(theSection);
if(iter!=mSections.end())
{
//尝试获取名称、值对
typeNameValue*anMap=iter->second;
if(NULL!=anMap)
{
TypeNameValuerIterNameValue;
iterNameValue=anMap->find(名称);
如果(iterNameValue!=anMap->end())
{
anResult=ParseBool(itername值->秒,默认值);
}
}
}
//返回找到的结果或上面指定的默认值
返回anResult;//这是它跳到的行(没有太多帮助)
}
我尝试在跳过之间的行上放置断点,但它还是跳过了它们
我不确定我的问题是否与此相关,但听起来很相似:
有人知道这里会发生什么,或者我能做些什么来修复/避免它吗?
此外,如果我的帖子不正确,我会提前道歉
调用GetBool函数:
mProperties.Add<bool>("bMusicOn",
settingsConfig.GetAsset().GetBool("music", "on", true));
mproperty.Add(“bMusicOn”,
setingsconfig.GetAsset().GetBool(“音乐”,“打开”,true));
显然是一个不需要问的开放性问题:它确实是一个调试版本吗?发布版本并不总是按照最初呈现的顺序将1:1映射到源代码行。我应该想到这一点。我切换到release,因为链接器错误会运行模板而不是我的代码。我做了以下工作:现在它可以正常调试了。谢谢