LarsA
LarsA

Reputation: 637

Not able to set breakpoint in C++ code from static library

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;

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.

Upvotes: 1

Views: 46

Answers (0)

Related Questions