1 (edited by Hojat.Badnava 29-01-2015 15:18:26)

Topic: OOFEM-2.3- Problem in debug mode with visual studio 2008

Hey,
I downloaded CMake and followed the instructions from "CMake Tutorial"on wiki for Windows (Visual Studio).
I configured the defaults. Compilation completed without error and oofem.exe was created. But the debug mode was just activated for oofem project, not for other project. For example, I cant use "step into" option for misesmat.c or other files when I run debug mode using "Mises01.in" example input file. When I tried to create a breakpoint in the any file this error appear:
“the breakpoint will not currently be hit. No symbols have been loaded for this document”

Post's attachments

main.jpg 377.84 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: OOFEM-2.3- Problem in debug mode with visual studio 2008

When you say debug mode was activated, do you mean the build type specified in CMake, or the debug option inside Visual Studio?

Unfortunately, very few of the devs are using windows machines (and even fewer are using Visual Studio), so I can't come with any good suggestions.

3 (edited by Hojat.Badnava 29-01-2015 15:19:22)

Re: OOFEM-2.3- Problem in debug mode with visual studio 2008

For Cmake the debug mode is default. But the debug option inside VS not work (It only works for oofem main.c file). I will try Ubuntu. Which IDE in Ubuntu can work similar to VS? How you create a project from oofem source files for IDEs?
thanks.

Post's attachments

misesmat.png 225.45 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: OOFEM-2.3- Problem in debug mode with visual studio 2008

If I recall correctly, the BUILD_TYPE in CMake isn't used for Visual Studio (since VS picks the build type later), so it makes no difference if you put in Debug in that field.
What I mean is the debug build setting inside VS. On the top bar, there should be a drop menu where one can select "Debug"
It's next to the Start option on in this screenshot
http://blogs.msdn.com/cfs-filesystemfil … a-Full.png

Under linux, some IDEs you can try are KDevelop, QT creator, and Eclipse CDT or Code::blocks

Re: OOFEM-2.3- Problem in debug mode with visual studio 2008

As I said before, debug just works for main.c inside visual studio. I have attached two photos to previous posts (post 1 and 3), please take a look at them.

Re: OOFEM-2.3- Problem in debug mode with visual studio 2008

I believe you missed the attached figures (there are none that I can see)
If there are problems attaching them, you can use something like:
http://picpaste.com/
and paste the links.

Re: OOFEM-2.3- Problem in debug mode with visual studio 2008

Sorry,
take a look at to these files:
http://picpaste.com/main-gJk6lkEB.png
http://picpaste.com/misesmat-JOV2tied.png

see the error (“the breakpoint will not currently be hit. No symbols have been loaded for this document”) in the second link.

8 (edited by johnnyontheweb 01-02-2015 11:28:20)

Re: OOFEM-2.3- Problem in debug mode with visual studio 2008

I had the same (unexpected) problem in some VS installation and I solved using USE_LIB=OFF in CMake. Let me know if it helps you; VS will generate an EXE without the DLL file.

Exact CMake entry: USE_SHARED_LIB

Re: OOFEM-2.3- Problem in debug mode with visual studio 2008

How can I use USE_LIB=OFF option in Cmake inside window?

Re: OOFEM-2.3- Problem in debug mode with visual studio 2008

Use Cmake to re-create the solution and the VS projects. In Cmake, deselect USE_SHARED_LIB and then Configure and Generate.

Re: OOFEM-2.3- Problem in debug mode with visual studio 2008

now it's ok!  thank you very much!

Re: OOFEM-2.3- Problem in debug mode with visual studio 2008

Hmm.
This is an ideal solution. The shared library is used for things like the python bindings, USE_SHARED_LIB=Off  limits this functionality. It's also in general the way you want to build OOFEM so that it can build multiple targets (like the standalone binary beam01 example)
The USE_SHARED_LIB was intended for a backwards compatibility mode, and it is something I would like to remove in the future.

If someone with Visual Studio can figure out if there is a change we can do to make VS automatically load symbols for the "oofem.dll", then it would be greatly appreciated.

Re: OOFEM-2.3- Problem in debug mode with visual studio 2008

Mikael,
I'm aware that the solution I proposed is temporary and not clean, but for now it's the only one also for me. I'll try to check deeper how to load the DLL debug symbols; in the meanwhile, I don't think it'll be a good idea to remove USE_SHARED_LIB, for 2 reasons:
- the python bindings are not documented yet, and there's not an urgent need to use them for many people;
- having a monolithic exe will help not only for debugging but also to use and debug OOFEM in clusters.

Re: OOFEM-2.3- Problem in debug mode with visual studio 2008

Hello, I am experiencing the same issue as the one you are describing above (some years ago). I am using VisualStudio 2022 though.
The compile has been done successfully and I can run the examples in both debug and release mode (both by using the oofem.exe).

But when I am debugging and setting a breakpoint, the analysis doesn't stop to a breakpoint. I cannot check the process as I want in order to understand how the code works. Again, as you described above, I can set a breakpoint to the main.C and the analysis will stop at the breakpoint (so it recognizes the breakpoint). But when i am running an example like Mises01.in and I am setting breakpoints in misesmat.c, the analysis goes straight to the output.

Am i doing something wrong? (I deselected the USE_SHARED_LIB). Where should i put a breakpoint-in which module the code reads the data (in case the problem is that I am setting the breakpoint in a wrong location)?

thank you and sorry for the long message.

15

Re: OOFEM-2.3- Problem in debug mode with visual studio 2008

Hard question for linux guy ;-)
I found useful this link: https://learn.microsoft.com/en-us/visua … ew=vs-2022

In solution explorer, right click on liboofem target, select Properties, then go to Linker->Debugging and set "Debuggable Assembly" to YES. Rebuild oofemlib target, rebuild oofem target, start debugging (make sure you have Debug mode active).

I tested on VS 2022 and it works.

16 (edited by ChristosM 03-11-2024 14:12:37)

Re: OOFEM-2.3- Problem in debug mode with visual studio 2008

Thank you so much for the reply. I know that you are a linux guy-please bear with me :)

I don't see a liboofem project in the solution explorer (you may see a picture attached). This code that relates to liboofem (like dof.c) exists in core. I can do the changes you described, only to the startup project (which is only the oofem). So right-click in oofem->properties->linker->Debugging->Dubuggable Assembly-Yes

It didn't solve my problem. Am I missing something for the installation steps?

Just to clarify, I run an example like this:
In the terminal of Visual Studio (Developer PowerShell or Developer Command Prompt), I navigate to the path of the debug folder (where the oofem.exe has been created) and then I write:
.\oofem -f C:\Users\...\oofem\tests\sm\Mises01.in

This action immediately is analysed successfully ignoring that I have put breakpoints in misesmat.c

Post's attachments

Capture_VS22.PNG 150.77 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: OOFEM-2.3- Problem in debug mode with visual studio 2008

I found the solution of my problem!!!
I was suspecting that I have to debug the code through VS and not through a terminal in order to stop to breakpoints.

So, right click in oofem->configuration properties-debugging and then in Command Arguments:
-f "C:\Users\...\source\repos\oofem\tests\sm\Mises01.in"

In this way, i am able to just run through VS the code and debug it (click F5 or the play button) by setting breakpoints in the code for the example of Mises01.

Maybe it was obvious eventually.

Thank you!