Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to debug the C++ Kernel in VSCode from PyNEST program? #3168

Open
Wang-Ling-jie opened this issue Mar 27, 2024 · 2 comments
Open

How to debug the C++ Kernel in VSCode from PyNEST program? #3168

Wang-Ling-jie opened this issue Mar 27, 2024 · 2 comments
Labels
I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: Normal Handle this with default priority T: Discussion Still searching for the right way to proceed / suggestions welcome

Comments

@Wang-Ling-jie
Copy link

I'm developing on the source of nest and followed the Install from source in a conda environment. The multi-area model I tested uses the PyNEST interface of the C++ NEST Kernel.

When I was debugging the program, the debugger just stepped over line 150 of the following picture without getting into the sli_push(args) function. But what I want to see is the complete function call chain in the NEST Kernel and how the program is executed in C++ Kernel.
image

I noted that the functions sli_push and sli_pop was loaded from the file pynestkernel.so, and I'm wondering how this file is generated during installation and how I can trace into the source code of this file.

@jessica-mitchell jessica-mitchell added this to To do (open issues) in Kernel via automation Apr 4, 2024
@med-ayssar
Copy link
Contributor

Hey @Wang-Ling-jie,

You need to adjust your VSCode launch.json file to attach to the current python process running your script.

{ 
        "name": "(gdb) Attach",
        "type": "cppdbg",
        "request": "attach",
        "program": "path/to/python/executable",
        "processId": "${command:pickProcess}",
        "MIMode": "gdb",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ]
    }

By clicking on F5 to start debugging, a window will appear in VSCode, you have to enter the process ID of your python script (the python process running your script).

@terhorstd terhorstd added T: Discussion Still searching for the right way to proceed / suggestions welcome S: Normal Handle this with default priority I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) labels Apr 19, 2024
@terhorstd
Copy link
Contributor

Thanks for the good hint, @med-ayssar!

@jessica-mitchell, maybe we can put this setting into the docs of IDE settings?

@terhorstd terhorstd removed this from To do (open issues) in Kernel Apr 19, 2024
@terhorstd terhorstd added this to To do in Documentation via automation Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: Normal Handle this with default priority T: Discussion Still searching for the right way to proceed / suggestions welcome
Projects
Documentation
  
To do
Development

No branches or pull requests

3 participants