SEAL icon indicating copy to clipboard operation
SEAL copied to clipboard

How to Debug the SEAL examples?

Open EchizenG opened this issue 3 years ago • 6 comments

Hi there,

I am trying to understand the HE and its operation through debugging the code. I built the SEAL in debug mode successfully which was built up in /Debug folder. I also tried to build /native/examples in Debug mode but cannot use gdb to debug it.

What I did: cd native/examples cmake -DCMAKE_BUILD_TYPE=Debug -S . -B build cmake --build build I also write set(CMAKE_BUILD_TYPE Debug) to the CMakeList.txt for double insurances.

cd build/bin gdb sealexamples

What I see: When I try to add breakpoint or check the code. They just report cannot find files.

Thank you.

EchizenG avatar Mar 27 '23 19:03 EchizenG

because you can not only build /native/examples with Debug mode, also need with whole src to generate a debug seal library

peichao538 avatar Mar 31 '23 08:03 peichao538

You mean the SEAL's source code? I built it with debug mode, too.

because you can not only build /native/examples with Debug mode, also need with whole src to generate a debug seal library

EchizenG avatar Mar 31 '23 13:03 EchizenG

I think you need to build seal with -DSEAL_BUILD_EXAMPLES=ON

elkanatovey avatar Apr 03 '23 18:04 elkanatovey

I write the following contents in CMakeList.txt, and can debug the seal.

SET(CMAKE_BUILD_TYPE "Debug") SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb") SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

You can try it.

peichao538 avatar Apr 04 '23 02:04 peichao538

Try removing -03 that can cause problems with debug builds.

On Tue, Apr 4, 2023, 05:55 peichao @.***> wrote:

I write the following contents in CMakeList.txt, and can debug the seal.

SET(CMAKE_BUILD_TYPE "Debug") SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb") SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

You can try it.

— Reply to this email directly, view it on GitHub https://github.com/microsoft/SEAL/issues/627#issuecomment-1495270979, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJUJCAWXKOCU47S5CQA4UCTW7OES3ANCNFSM6AAAAAAWJSZFAA . You are receiving this because you commented.Message ID: @.***>

elkanatovey avatar Apr 04 '23 05:04 elkanatovey

SET(CMAKE_BUILD_TYPE "Debug") SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb") SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

I have succeeded in compiling the SEAL in debug mode. Thanks! After adding those content to the last few lines of CMakeList.txt, just compile SEAL according to the official document content.

harper-yuan avatar Jan 02 '24 08:01 harper-yuan