NcG
NcG

Reputation: 11

Breakpoints not beeing hit when debugging python CFFI with attached Visual Studio Debugger

Description

I have a c project for an embedded device. I want to call parts of this code from CFFI for testing and developement purposes.

Compiling and running the CFFI on its own works great. I get get attaching the visual studio debugger to the python.exe to work for debugging the c files.

System

I am on windows 10 using visual studio 2022 and visual studio build tools 2022.

Steps

These are the steps I took:

  1. I compile the cffi library with extra_compile_args = ['/Zi', '/Od', '/DEBUG'], extra_link_args = ['/DEBUG']

  2. I told visual studio code where to find the .pdb file by adding its path to Tools>Debugging>Symbols.

  3. I start the python code, making it tell me its process-id and pausing it.

  4. I attach visual studio code to this process.

  5. I add breakpoints in the code where i want them.

Problem

At this points these breakpoints have a small warning sign, telling me:

This breakpoint will currently not be hit. No symbols have been loaded for this document

I noticed compiling the cffi also creates a Release folder, with several .obj, .exp and .lib files. Am I missing some linking here?

Note, my code is located in different locations, so i dont know if this is causing issues for visual studio code to find stuff:

python-project/
│
├── src/
│   └── cffi/
│       ├── cffi_compile
│       └── cffi_run
│
├── src-cffi/
│   └── foo.c
│
└── Release/  
    └── ... # this is generated by cffi, contains .obj, .exp, .lib

c-project/
├── bar.c
└── bar.h

Upvotes: 1

Views: 43

Answers (0)

Related Questions