Skip to content

Conversation

@bewithgaurav
Copy link
Collaborator

@bewithgaurav bewithgaurav commented Jun 9, 2025

Summary

This pull request introduces changes to improve debugging support for the ddbc_bindings project by enabling PDB (Program Database) file generation and ensuring proper handling of these files during the build process. The changes primarily focus on updating the CMake configuration and build script.

Debugging Support Improvements:

  • Enabled PDB generation for MSVC builds in Release mode: Added compile and link options in CMakeLists.txt to ensure PDB files are generated when building with MSVC in Release mode. (mssql_python/pybind/CMakeLists.txt, mssql_python/pybind/CMakeLists.txtR8-R13)

  • Configured PDB properties for ddbc_bindings target: Set properties in CMakeLists.txt to specify the PDB file name and output directory for the ddbc_bindings target. (mssql_python/pybind/CMakeLists.txt, mssql_python/pybind/CMakeLists.txtR113-R119)

  • Handled PDB file copying in build script: Updated build.bat to check for the existence of the PDB file after the build, copy it to the appropriate directory if found, and log diagnostic messages for success or warnings if the file is missing. (mssql_python/pybind/build.bat, mssql_python/pybind/build.batR147-R155)

Issue Reference

Fixes AB#37472

Solution Implemented

  • Updated CMakeLists and build.bat to generate a PDB file for release

Checklist

  • Tests Passed (if applicable)
  • Code is formatted
  • Docs Updated (if necessary)

Testing Performed

  • Unit Tests
  • Manual Testing
    • Python Version: 3.13.3
    • OS: Windows

Copilot AI review requested due to automatic review settings June 9, 2025 11:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds PDB file generation for MSVC Release builds and updates the build script to copy PDBs alongside the generated PYD for improved debugging support.

  • Enable /Zi compile and /DEBUG link options for MSVC in Release mode
  • Set PDB name and output directory properties on the ddbc_bindings target
  • Extend build.bat to detect and copy the generated PDB file, logging success or warning

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
build.bat Added logic to copy %PDB_NAME% from output to source directory with diagnostic logs
CMakeLists.txt Enabled PDB generation via compile/link options and set target PDB properties
Comments suppressed due to low confidence (1)

mssql_python/pybind/build.bat:148

  • The batch variable %PYTAG% may not match ${PYTHON_VERSION} used in CMake for naming PDB files. Ensure the same version variable is used so the script looks for the correct file name.
set PDB_NAME=ddbc_bindings.cp%PYTAG%-%WHEEL_ARCH%.pdb

@sumitmsft sumitmsft merged commit 453faeb into main Jun 17, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants