Why I can’t include source index into bdb files in Relase build of CMake Project

Background

I have a large C++ CMake project where a crash reporter is used. The problem is that when a crash is reported, the exact line numbers in the report are not included. So instead of having a nice line number in the call stack, I see something like this:

0000008e`ccffee18 00007ff7`254497ab MyProduct!`anonymous namespace'::abortHandler
0000008e`ccffee20 00007ff7`25454bfc MyProduct!raise+0x227
0000008e`ccffee90 00007ff7`2511a7ba MyProduct!abort+0x18
(Inline Function) --------`-------- MyProduct!utils::levelDb::Database::fatalFailure+0x2d6
0000008e`ccffeec0 00007ff7`2506f231 MyProduct!utils::levelDb::Database::repair+0x44a
(Inline Function) --------`-------- MyProduct!utils::levelDb::Database::{ctor}+0xd1
0000008e`ccfff040 00007ff7`25077bd8 MyProduct!std::make_unique<utils::levelDb::Database,IReporting * &,boost::filesystem::path,0>+0x141
0000008e`ccfff100 00007ff7`25078712 MyProduct!`anonymous namespace'::openMetadataDb+0x118
0000008e`ccfff1c0 00007ff7`24f5b75b MyProduct!LevelDbModuleCache::LevelDbModuleCache+0x1e2

It would be nicer to see the exact file and line numbers in these reports instead of just the function name and some offset.

Problem

I’ve found this solution to this problem. It seems reasonable. Sadly, it doesn’t work for me. Invoking this command still doesn’t report that the source index is included in the pdb file.

"C:Program Files (x86)Windows Kits10Debuggersx64srcsrvpdbstr.exe" -r -p:MyProduct.pdb -s:srcsrv -i:srcsrv

Output is empty and ERRORLEVEL is 1. AFAIK this should print lots of data when source index is available.

Investigation

I’ve verified that flags are properly set. In build logs I can see something like this:

cmake --build . --config Release -v  -j 4 

....

 18>ClCompile:
         C:Program FilesMicrosoft Visual Studio2022ProfessionalVCToolsMSVC14.39.33519binHostX64x64CL.exe /c 
         /IF:reposMyProductSrcCMake........ /IF:reposMyProductSrcSomePart1 
         /IF:reposMyProductSrcCMake........SharedLibraryset_nod /IF:reposMyProductSrcCommonPart 
         /IF:reposMyProductSrcCommonPart.. /I"F:reposMyProductSrcCommonPart..3rdpartyMariaDB ConnectorCinclude" 
         /IF:reposMyProductSrcbuild_64CommonPart /IF:reposMyProductSrcbuild_64CommonPart.. 
         /IF:reposMyProductSrcbuild_64CommonPartmc /IF:reposMyProductSrcbuild_64CommonPartSqlStatements 
         /IF:reposMyProductSrcbuild_64CommonPartLocalization 
         /IF:reposMyProductSrcbuild_64CommonPartDatabaseUpdatersourceFiles 
         /IF:reposMyProductSrcbuild_64CommonPartEsetProtectIntegrationgRPC 
         /IF:reposMyProductSrcbuild_64CommonPartEpxIntegrationgRPC /IF:reposMyProductSrcCMake........SharedLibrary 
         /IF:reposMyProductSrcCommonPart2 /IF:reposMyProductSrcCommonPart2.. /Zi /nologo /W2 /WX- /diagnostics:column /MP /O2 
         /Ob2 /Oi /GL /D _UNICODE /D UNICODE /D WIN32 /D _WINDOWS /D NDEBUG /D _UPDATER_STATIC_LIB /D UNICODE /D _UNICODE /D _CONSOLE
         /D STRICT /D _SCL_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_WARNINGS /D _SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING /D 
         _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING /D _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING /D 
         _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING /D DONT_DISABLE_EXCEPTION_HANDLING /D _NOD_WINDOWS_API /D _NOD_DLL_WRAPPERS /D 
         DONT_USE_SRC_PRODUCTS /D NODCOMM_NO_NFC_PUMP /D AVVENDOR /D BOOST_DATE_TIME_NO_LIB /D BOOST_REGEX_NO_LIB /D PR_WINDOWS /D 
         "_NOD_FILE_VERSION=2,3,4253" /D _LIB /D NODCOMM_LEGACY /D ZLIB_CONST /D _ALLOW_DLL_MODULES /D AUTHENTICODE_MSI_SUPPORT /D 
         UPDATER_DLL_MODULES /D FMT_HEADER_ONLY=1 /D CARES_STATICLIB /D PUGIXML_WCHAR_MODE /D "CMAKE_INTDIR="Release"" /Gm- /EHsc /MT 
         /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /std:c++20 /permissive- 
         /Yu"F:/MyProduct/build_64/SomePart1/CMakeFiles/SomePart1.dir/Release/cmake_pch.hxx" 
         /Fp"F:/MyProduct/build_64/SomePart1/SomePart1.dir/Release/cmake_pch.pch" /Fo"SomePart1.dirRelease\" 
         /Fd"SomePart1.dirReleasevc143.pdb" /external:W0 /Gd /TP 
         /FIF:/MyProduct/build_64/SomePart1/CMakeFiles/SomePart1.dir/Release/cmake_pch.hxx /errorReport:queue  /external:I 
         "F:/MyProduct/build_64/vcpkg_installed/x64-windows-static/include" /external:I 
         "F:/MyProduct/build_64/vcpkg_installed/x64-windows-static/include/httpxx" /w15038 /execution-charset:utf-8 
         F:reposMyProductSrcSomePart1winService.cpp

.... 

18>ResourceCompile:
         All outputs are up-to-date.
       Link:
         C:Program FilesMicrosoft Visual Studio2022ProfessionalVCToolsMSVC14.39.33519binHostX64x64link.exe 
          /ERRORREPORT:QUEUE /OUT:"F:MyPorductx64ReleaseSomePart.exe" /INCREMENTAL:NO /NOLOGO 
          F:MyPorductx64ReleaseCommonPart1.lib F:MyPorductx64ReleaseCommonPart2.lib F:MyPorductx64ReleaseCommonPart1.lib 
          "..vcpkg_installedx64-windows-staticlibgrpc++.lib" "..vcpkg_installedx64-windows-staticlibgrpc.lib" 
          "..vcpkg_installedx64-windows-staticlibgpr.lib" "..vcpkg_installedx64-windows-staticlibabsl_random_distributions.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_random_seed_sequences.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_random_internal_pool_urbg.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_random_internal_randen.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_random_internal_randen_hwaes.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_random_internal_randen_hwaes_impl.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_random_internal_randen_slow.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_random_internal_platform.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_random_internal_seed_material.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_random_seed_gen_exception.lib" 
          "..vcpkg_installedx64-windows-staticlibupb.lib" "..vcpkg_installedx64-windows-staticlibcares.lib" 
          "..vcpkg_installedx64-windows-staticlibaddress_sorting.lib" "..vcpkg_installedx64-windows-staticlibre2.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_raw_hash_set.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_hashtablez_sampler.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_hash.lib" "..vcpkg_installedx64-windows-staticlibabsl_city.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_low_level_hash.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_statusor.lib" "..vcpkg_installedx64-windows-staticlibabsl_status.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_cord.lib" "..vcpkg_installedx64-windows-staticlibabsl_cordz_info.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_cord_internal.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_cordz_functions.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_exponential_biased.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_cordz_handle.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_synchronization.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_graphcycles_internal.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_time.lib" "..vcpkg_installedx64-windows-staticlibabsl_civil_time.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_time_zone.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_str_format_internal.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_bad_optional_access.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_stacktrace.lib" "..vcpkg_installedx64-windows-staticlibabsl_strerror.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_symbolize.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_malloc_internal.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_debugging_internal.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_demangle_internal.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_strings.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_strings_internal.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_base.lib" "..vcpkg_installedx64-windows-staticlibabsl_spinlock_wait.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_int128.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_bad_variant_access.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_throw_delegate.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_raw_logging_internal.lib" 
          "..vcpkg_installedx64-windows-staticlibabsl_log_severity.lib" "-ignore:4221" wsock32.lib gdi32.lib 
          "..vcpkg_installedx64-windows-staticlibpugixml.lib" F:MyPorductx64Releaseupdater.lib Mpr.lib Msi.lib 
          "..vcpkg_installedx64-windows-staticlibboost_url-vc140-mt.lib" "..vcpkg_installedx64-windows-staticlibgtest.lib" 
          "..vcpkg_installedx64-windows-staticlibhttpxx.lib" "..vcpkg_installedx64-windows-staticlibleveldb.lib" 
          "..vcpkg_installedx64-windows-staticliblibssl.lib" "..vcpkg_installedx64-windows-staticlibsigar.lib" 
          "..vcpkg_installedx64-windows-staticlibboost_filesystem-vc140-mt.lib" 
          "..vcpkg_installedx64-windows-staticlibboost_program_options-vc140-mt.lib" 
          "..vcpkg_installedx64-windows-staticlibboost_regex-vc140-mt.lib" 
          "..vcpkg_installedx64-windows-staticlibboost_system-vc140-mt.lib" "..vcpkg_installedx64-windows-staticlibgmock.lib" 
          "..vcpkg_installedx64-windows-staticliblibcrypto.lib" "F:MyPorductx64Releaseshared-library.lib" 
          "..vcpkg_installedx64-windows-staticliblibprotobuf.lib" "..vcpkg_installedx64-windows-staticlibzlib.lib" Tdh.lib 
          /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG 
          /PDB:"F:/MyPorduct/x64/Release/SomePart.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG:incremental 
          /LTCGOUT:"SomePart.dirReleaseSomePart.iobj" /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"F:/MyPorduct/x64/Release/SomePart.lib" 
          /MACHINE:X64  /machine:x64 SomePart.dirReleaseResource.res 
         
....

So all recommended flags are visible in logs, so it should work.

Questions

Why doesn’t the command pdbstr.exe ... print anything? Am I using this tool correctly to verify that I’ve fixed the missing source index problem?

If I am using this tool correctly, why doesn’t adding compilation and link flags resolve the issue? Should I use different flags? Is there an interaction with other flags that overrides something?

Or am I making some other mistake that I haven’t thought of?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật