最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

debugging - Not able to set breakpoint in C++ code from static library - Stack Overflow

programmeradmin0浏览0评论

I have a C++17 console application that is built using VS2022 Professional on Windows 10.

The application is compiled and linked with external C++ static library that is compiled with /Z7. The application is compiled without optimalization and with /Zi and produces a .pdb file.

Building and running the software works great but I am not able to set a breakpoint in the source code that comes from the static library.

To investigate the issue I am using WinDbg. Opening the executable;

  • I can using "lm" command verify that "private pdb symbols" are loaded
  • I can using "x console_app!*" command verify that debugger can see symbols.

So I tried to open source file (from static library) and set breakpoint but that produced "Code not found, breakpoint not set" error message.

So I tried to add a breakpoint to method listed by "x console_app!* command. So I attempted the below command, but I get the error "Couldn't resolve error at.."

bp console_app!foo::Task<int, double>::operator()

Second attempt is to use the address listed by the "x" command and this is accepted by WinDbg.

bu 00007ff6'a37ea470

I then run the application (F5) and the debugger stops at the specified address. The call stack looks correct but the debugger is not able to map the specified address to the actual source code file for that method. So I am able to step through the disassembly code using F10 and F11 but I do not know which actual C++ code line each statement is related to.

So I am wondering what I am doing wrong.

  • How can I verify that static library contains all relevant debugging information including line numbers?
  • How can I verify that pdb files contain all relevant information including line numbers?
  • Any compiler or linker switch that can help resolve this issue?
发布评论

评论列表(0)

  1. 暂无评论