简体   繁体   中英

Remote DLL Debugging from ctypes in Visual Studio

I'm making a dll for python using c++ and importing functions using ctypes library. I know that to do remote debugging you go to Debug -> Attach to Process. I put a breakpoint in python code before imported function is called, but I don't know what process to attach to. I tried attaching to python.exe, but that didn't work.

What process should I attach to or do I need to do remote debugging differently and if so then how? Thanks

The process which need to be attached to is the process that needs to call the dll. If you want to remote debug dll, I suggest that you could refer to this link about Remote Debugging a C++ Project in Visual Studio . Also, you could refer to this link about Debug DLLs in Visual Studio .

I suggest that you could look in the modules windows. There are several situations :

1.No Symbols have been loaded for this document Go to the Modules window (Debug > Windows > Modules) and check whether your module is loaded.

  • If your module is loaded, check the Symbol Status column to see whether symbols have been loaded.

a.If symbols are not loaded, check the symbol status to diagnose the issue. From the context menu on a module in the Modules window, click Symbol Load Information... to see where the debugger looked to try and load symbols. For more information about loading symbols, see Specify Symbol (.pdb) and Source Files.

b.If symbols are loaded, the PDB does not contain information about your source files. These are a few possible causes:

If your source files were recently added, confirm that an up-to-date version of the module is being loaded.

It is possible to create stripped PDBs using the /PDBSTRIPPED linker option. Stripped PDBs do not contain source file information. Confirm you are working with a full PDB and not a stripped PDB. The PDB file is partially corrupted. Delete the file and perform a clean build of the module to try to resolve the issue.

  • If your module is not loaded, check the following to find the cause:

a.Confirm that you are debugging the right process.

b.Check to see that you are debugging the right kind of code. You can find out what type of code the debugger is configured to debug in the Processes window (Debug > Windows > Processes). For example, if you are trying to debug C# code, confirm that your debugger is configured for the appropriate type and version of .NET (for example, Managed (v4*) versus Managed (v2*/v3*) versus Managed (CoreCLR)).

2.… the current source code is different from the version built into... You could go to Debug > Options and Settings . On the Debugging/General page, clear the Require source files that exactly match the original version option. Make sure to reenable this option when you are finished debugging.

In addition, it may be that the dll has not been loaded into the.exe. You could set Properties->Debugging->Working Directory .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM