forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Debugging a DLL missing the symbols
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
Werner



Joined: 23 Oct 2009
Posts: 12

PostPosted: Mon Oct 26, 2009 1:35 pm    Post subject: Debugging a DLL missing the symbols Reply with quote

I try to debugg a FTN95 DLL which is called by a C++ DLL. The C++ DLL is created with VisualStudioExpress and the FTN95 DLL with Silverforst FTN95 Express.
I can debugg with Viusual Studio the C++ part.
I try to open my Silverforst project and connect it to the runtime process. But if I start the process the progamm didn't stop at my breakpoints.
So I try to make an error inside (Division by 0 ) to force the start of a debugger. And a message comes from Silverforst debugger, but it looks like that he didn'T find the symbols. Only Disassembling code is possible to see.
How can the debugger find the symbols? I compile with /DEBUG and /FULL_DEBUG.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7926
Location: Salford, UK

PostPosted: Mon Oct 26, 2009 8:47 pm    Post subject: Reply with quote

See if you can compile and link the C++ DLL using SCC, the C++ compiler provided with FTN95. If you can then compile it using one of the debugging options /DEBUG etc. Then you should be able to step through your code.
Back to top
View user's profile Send private message AIM Address
Robert



Joined: 29 Nov 2006
Posts: 445
Location: Manchester

PostPosted: Tue Oct 27, 2009 1:51 am    Post subject: Reply with quote

Hmm, it should work. How are you debugging it, are you using sdbg?
Back to top
View user's profile Send private message Visit poster's website
Werner



Joined: 23 Oct 2009
Posts: 12

PostPosted: Tue Oct 27, 2009 8:07 am    Post subject: Reply with quote

In the properties of my FTN95 project I have tried for the debugger type (Compiler options - Debugging)
Salford SDBG and also Visual Studio Integrated.
But both have the same result as descriped before.

But I think the problem is somewhere else. For more explanation: I have a folder with my fortran-project. I compile it and get a LIB and a DLL. Then I copy the fortran.lib to my C++ project in another folder an compile that. The result is another DLL. These DLLs are for grafical programm that can use DLLs, if I put them in a certain folder of that programm I can use them.
So I copy the c++-DLL in that certain folder and that all run well I have to copy the Fortran-DLL in the root of my grafical programm.
I think that the debugger is missing the symbols. Is there a special file with the symbols and I have to copy it in the root folder where my fortan.dll is in ?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7926
Location: Salford, UK

PostPosted: Tue Oct 27, 2009 9:18 am    Post subject: Reply with quote

Can you confirm that you are using SCC to compile your C++ code rather than the Microsoft compiler?
Robert will be able to say if this is necessary but from my perspective it is certainly advisable.
Back to top
View user's profile Send private message AIM Address
Werner



Joined: 23 Oct 2009
Posts: 12

PostPosted: Tue Oct 27, 2009 9:24 am    Post subject: Reply with quote

I will try to use SCC, but I have to look how to do. I just tried to do all with PLATO. But in the moment I have a .DEF file that PLATO don't want.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7926
Location: Salford, UK

PostPosted: Tue Oct 27, 2009 6:24 pm    Post subject: Reply with quote

If the DEF file is for exports then all you need to link with SLINK and use exportall. You can do this from Plato.
Back to top
View user's profile Send private message AIM Address
Robert



Joined: 29 Nov 2006
Posts: 445
Location: Manchester

PostPosted: Mon Nov 02, 2009 10:36 am    Post subject: Reply with quote

Hi Werner

The debug information for a FTN95 DLL is in the DLL itself (so you cannot misplace it). A Visual C++ DLL quite often has a .pdb file present which contains the debug information -- but sdbg cannot read .pdb files anyway. It can read the COFF though which should be enough to allow you to debug the Fortran part.

Is your example fairly small and can you send it us to look at?
Back to top
View user's profile Send private message Visit poster's website
Werner



Joined: 23 Oct 2009
Posts: 12

PostPosted: Fri Nov 20, 2009 5:06 pm    Post subject: Reply with quote

Hello!
May problem still exists. Now I have had the time to compile and link all with PLATO. So for the first time the DLLs are compiled without an error. But now I must debugg it with PLATO.
May C++ DLL is called by another programm. So I want in the first step have a breakpoint in my C++ DLL.
In Visual C++ I can attach the DLL to a running process and than set my breakpoints etc.
How can I debug with PLATO? I don't find a possibility to set a breakpoint or to attach to a process.

Thanks
Werner
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7926
Location: Salford, UK

PostPosted: Fri Nov 20, 2009 5:52 pm    Post subject: Reply with quote

You will need to compile the exe and the DLL using one of the debugging options such as /check.

Then I would suggest that you start up the exe using SDBG directly.
Put the DLL in the same folder as the exe.
When SDBG starts up, open the source code for the DLL in SDBG and set your breakpoint manually.

I think that this should work.
Back to top
View user's profile Send private message AIM Address
Werner



Joined: 23 Oct 2009
Posts: 12

PostPosted: Fri Dec 04, 2009 12:09 pm    Post subject: Reply with quote

Again still big problems.
I try to explain my problem from the beginning;

I have a programm with no source code. It is a graphical programming tool. For that tool I have a DLL-Frame in C++ to make a AddOn to that tool. When I am finished with the creation of my AddOn-DLL, I have to put it in a certain folder of the Tool and after Start of the tool I can use the DLL-Function. That is the base scenario.

My AddOn calls from that Frame-DLL in C++ a function from a fortran DLL.

I create my Fortran-Dll with Plato. Than I also create my C++ Dll with Plato with a reference to my fortran-DLL. That looks all ok.
Than I but my C++ Dll in the certain folder of my Tool and the fortran-Dll in the base folder of my tool. That is necessary that all runs well.

But now I want to debug with SDBG, because I have an error somewehre in my DLLs, so that the tool is crashing.
Waht I have to do?
My C++ Dll is in the folder c:\xxx\server\dll
My Fortran DLL is in the folder c:\xxx\server
The sourcecode is in d:\silverfrost and the existing subfolders.

I try to start SDBG with "run to cursor" in my PLATO. but it didn't stop.
I try to start SDBG from the console. Than SDBG stops in NTDLL.DLL. But I only see some assembler code.
I also try to set SOURCEPATH to d:\silverfrost and all subfolders, also added the c:\xxx folders , but also no success.

Any idea?
Back to top
View user's profile Send private message
Robert



Joined: 29 Nov 2006
Posts: 445
Location: Manchester

PostPosted: Sun Dec 06, 2009 12:24 am    Post subject: Reply with quote

Werner

Can you send us the program so we can try and see what is going on? We don't need the source files at least not to find out why sdbg is stopping in ntdll.
Back to top
View user's profile Send private message Visit poster's website
Werner



Joined: 23 Oct 2009
Posts: 12

PostPosted: Sun Dec 06, 2009 7:28 pm    Post subject: Reply with quote

Hello Robert,

thank you for your answer. I think that I have to make tomorrow another try, because I have some new idea. I talked with the programmers of the Tool, and maybe I set my breakpoint to a wrong place. So I will try tomorrow and will write here the result.
Back to top
View user's profile Send private message
Werner



Joined: 23 Oct 2009
Posts: 12

PostPosted: Mon Dec 07, 2009 4:55 pm    Post subject: Reply with quote

ok, here next part of the endless story.
I sit together with the programmers of the Tool and we saw that the major problem in the moment is, that the stack is not correctly handled.
I delete all Fortran part and only have C++ DLL generate with PLATO and then the tool crashes, because a wrong stack. The programmers told me, that there is a problem that the stack is handeld outside and inside the procedure and it should only be done once. We try some "C" extern, stdcall and something else in the C++ Dll but all with the same result.

OK, so what can I do? Is there a possibility to download the source of my DLL somewhere? I don't know how to do.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7926
Location: Salford, UK

PostPosted: Mon Dec 07, 2009 8:30 pm    Post subject: Reply with quote

By default FTN95 does not use STDCALL and assumes that the DLLs it calls upon also do not use STDCALL.

If you want to use a third party DLL that uses STDCALL then the simplest approach is to import it using /import_lib on the command line.

Within a Plato project, a reference can be configured to use STDCALL.
In the Project Explorer wiindow, add a reference and then right click on it to change its properties.

For more general instructions, search for STDCALL in the FTN95 help file (FTN95.chm).
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group