[英]How can I set a breakpoint in a C++ static library from my C# project?
I have a static library written in C++, which can be downloaded in binary or compiled from source here . 我有一个用C ++编写的静态库,可以用二进制下载,也可以从此处进行编译。 In that static library, I would like to set a breakpoint at a function call . 在该静态库中,我想在函数调用处设置一个断点。 I have created a wrapper C++ DLL to that static library, and a C# unit test project that calls functions in that C++ DLL. 我已经为该静态库创建了一个包装C ++ DLL,并创建了一个调用该C ++ DLL中的函数的C#单元测试项目。 However, when I try to debug the static library, the functions are greyed out (see below), and I get a message that says "Source Not Available". 但是,当我尝试调试静态库时,这些功能显示为灰色(请参见下文),并且收到一条消息,指出“源不可用”。
How would it be possible to step into the source code and set a breakpoint? 如何进入源代码并设置断点? I tried using Debug > New Breakpoint > Function Breakpoint
, but if I type in a function like module_runtime_path
, it doesn't break at all. 我尝试使用Debug > New Breakpoint > Function Breakpoint
,但是如果我输入类似module_runtime_path
的函数,它根本不会中断。 Unfortunately, the current source doesn't allow for building from Visual Studio (it can only be built from Ninja). 不幸的是,当前资源不允许从Visual Studio构建(只能从Ninja构建)。 If I build using Ninja, I've also tried adding all sorts of PDB locations but to no avail. 如果我使用Ninja进行构建,那么我也尝试过添加各种PDB位置,但无济于事。
Is there any way for me to set a breakpoint in the static library? 我可以在静态库中设置断点吗?
I can't pinpoint the exact solution, but I ended up building from source and setting in my C++ DLL project, in Properties > Configuration Properties > Linker > Debugging
, I set Generate Debug Info=Optimize for debugging (/DEBUG)
. 我无法确定确切的解决方案,但最终还是从源代码构建并在C ++ DLL项目中的“ Properties > Configuration Properties > Linker > Debugging
设置,设置了“ Generate Debug Info=Optimize for debugging (/DEBUG)
。 After that, I was able to step into the static library. 之后,我就可以进入静态库了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.