default.natstepfilter 文件不允许我避免 Visual Studio 2019 中模板化/内联函数的 StepInto
在 Visual Studio 2019 中调试时,我使用 default.natstepfilter 来避免“步入”函数时遇到问题。
是文件中的相关行:
<Function><Name>PathFilename::PathFilename</Name><Action>NoStepInto</Action></Function>
<Function><Name>to_string_with_decimals</Name><Action>NoStepInto</Action></Function>
以下是我的源代码中的相关行:
Header.h
// Class with constructor
class PathFilename
{
public:
PathFilename(string i_Path_Filename = "", bool i_Ignore_Extension_Convention = false);
};
// inline function using templates
template <typename T>
inline string to_string_with_decimals(const T i_Value, const uint i_Precision = 1)
{
// Stepping Into should never reach here (but it does)!
std::ostringstream out;
out << std::setprecision(i_Precision) << std::fixed << i_Value;
return(out.str());
}
Main.cpp
PathFilename::PathFilename(string i_Path_Filename, bool i_Ignore_Extension_Convention)
{
// Do stuff
// Stepping Into should never reach here (and it doesn't)!
}
int main()
{
// Debugging here
PathFilename pf("foo.txt"); // Line A
cout << to_string_with_decimals(1.05030, 2); // Line B
}
以下 调试器在涉及 PathFilename::PathFilename() 时 - 在“A 行”上使用 StepInto 跳过构造函数,而不是进入构造函数。如果我从 default.natstepfilter 文件中删除该行,当然“A 行”上的 StepInto 会按预期工作并进入构造函数。
但是,即使使用 default.natstepfilter 的第二行,如果我在“B 行”上 StepInto,调试器也会进入 to_string_with_decimals(),而不是单步跳过它。
我做错了什么?我怀疑这与它是使用模板的函数这一事实有关,或者可能是因为它是头文件中定义的内联函数。但我不知道如何让它工作,所以在调试时我不会进入这个常用的实用函数。
任何帮助将不胜感激。谢谢!
I'm having problems using my default.natstepfilter to avoid "Stepping Into" functions when debugging in Visual Studio 2019.
Here are the relevant lines from the file:
<Function><Name>PathFilename::PathFilename</Name><Action>NoStepInto</Action></Function>
<Function><Name>to_string_with_decimals</Name><Action>NoStepInto</Action></Function>
Here are the relevant lines in my source code:
Header.h
// Class with constructor
class PathFilename
{
public:
PathFilename(string i_Path_Filename = "", bool i_Ignore_Extension_Convention = false);
};
// inline function using templates
template <typename T>
inline string to_string_with_decimals(const T i_Value, const uint i_Precision = 1)
{
// Stepping Into should never reach here (but it does)!
std::ostringstream out;
out << std::setprecision(i_Precision) << std::fixed << i_Value;
return(out.str());
}
Main.cpp
PathFilename::PathFilename(string i_Path_Filename, bool i_Ignore_Extension_Convention)
{
// Do stuff
// Stepping Into should never reach here (and it doesn't)!
}
int main()
{
// Debugging here
PathFilename pf("foo.txt"); // Line A
cout << to_string_with_decimals(1.05030, 2); // Line B
}
The default.natstepfilter is respected by the debugger when it comes to PathFilename::PathFilename() - using StepInto while on "Line A" steps past the constructor, rather than into it. If I remove that line from the default.natstepfilter file, of course StepInto on "Line A" works as expected and steps in to the constructor.
However, even with the second line of default.natstepfilter, if I StepInto while on "Line B," the debugger goes in to to_string_with_decimals(), rather than stepping past it.
What am I doing wrong? I suspect it has something to do with the fact that it's function using a template, or perhaps because it's an inline function defined in a header file. But I have no idea how to get it to work so I don't step into this frequently-used utility function when debugging.
Any help would be appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论