custom-op icon indicating copy to clipboard operation
custom-op copied to clipboard

Create Op and perform mixed mode debugging with Visual Studio

Open SchmiederX opened this issue 5 years ago • 1 comments

Hey,

first of all, thank you for this great tutorial page, i was able to set up everything to build my own shared library under windows. But to further develop it, i want to have debugging capabilities. But if I build the .so (or .dll file) with the following command:

cd custom-op && bazel build --strip=never --compilation_mode dbg -c fastbuild tensorflow_my_MaxPool:python/ops/my_MaxPool_ops.so --verbose_failures

I can create a library file and the pdb file that is needed for debug, but if i then use this .so file to include in my python script: max_pooling_ops = tf.load_library('my_MaxPool_ops.so') and start mixed mode debuggin in Visual Studio i get the error

Exception thrown at 0x000007FEBBCBB108 (my_MaxPool_ops.so) in python.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

Is there any trick to create a working shared library with debugging capabilities under windows? Using the 'normal' building steps works fine, I can easily load the library into python with the above mentioned command (Path is the same of course).

would be very happy to receive an answer to my problem :)

greetings

SchmiederX avatar May 15 '20 08:05 SchmiederX

okay some further insights: The above mentioned error seems to be the follow up error. The error in tf.load_op_library is the following: Unhandled exception at 0x00007FFC27D0A799 in python.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x000000E2F15ED760.

if i compile with minimal debug informations the dll gets loaded but then i cant debug the code as those symbols arent loaded i guess, so i need the full debug informations.

any recommendations?

SchmiederX avatar May 28 '20 09:05 SchmiederX