How to enable mixed mode debugging in Visual Studio Code?
Asked Answered
S

0

6

I have a C#.NET Core Web application that uses some C++ code for certain operations. This web application is running on Cent OS 8. (I am a Windows Developer and working on Linux for first time and so with VSCode)

I only have the option to debug using VSCode in CentOS. I am familiar with VS2019 Mixed mode debugging but I am not able to find that option in VSCode. Does it not support it? Launch.Json doesn't allow "profiles" to add to it, which was allowed in VisualStudio2019 which enabled the mixed mode debugging.

One work around I tried was making a Launch.json setting for gdb:

   "configurations": [
       {
           "name": "(gdb) Attach",
           "type": "cppdbg",
           "request": "attach",
           "program": "${workspaceFolder}/CSharpCodeBinary/ManagedCode.dll",
           "processId": "${command:pickProcess}",
           "MIMode": "gdb",
           "setupCommands": [
               {
                   "description": "Enable pretty-printing for gdb",
                   "text": "-enable-pretty-printing",
                   "ignoreFailures": true
               }
           ]
       }

Once I run the ManagedCode.dll on a terminal, I attach to "dotnet" application hoping to get a breakpoint hit in the unmanaged cpp file (that generates UnmanagedCode.so).

The "ManagedCode.dll" is the C# NetCore assembly which loads the native "UnmanagedCode.so" for accessing unmanaged code. I have built "UnmanagedCode.so" using g++ -Og switch to generate symbols.

Still I am getting no luck to hit the breakpoint.

I just want to somehow hit the breakpoint inside UnmanagedCode.so code. Any way is acceptable.

Sulfonation answered 23/8, 2020 at 9:3 Comment(3)
CORRECTION: I used "(gdb) Launch" instead of "(gdb) Attach" and breakpoint was hit! But still don't know how to debug both managed and un-managed code in one go.Sulfonation
Did you figure out something, or did you conclude it was unavailable feature ?Shockheaded
I concluded that it was an unavailable feature. Had to debug both separately.Sulfonation

© 2022 - 2024 — McMap. All rights reserved.