replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Wierd error starting SDBG
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 

Wierd error starting SDBG

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
KennyT



Joined: 02 Aug 2005
Posts: 318

PostPosted: Mon Sep 12, 2011 8:27 pm    Post subject: Wierd error starting SDBG Reply with quote

When SDBG starts, I get an error...

typing:

SDBG progname.exe

gives:

Failed to open file progname.exe, code = 2
Failed to open file progname.exe, code = 2

but running progname.exe works.

Anyone know what's causing it?

TIA

K
Back to top
View user's profile Send private message Visit poster's website
KennyT



Joined: 02 Aug 2005
Posts: 318

PostPosted: Tue Sep 13, 2011 1:42 pm    Post subject: Reply with quote

Some more information...In SDBG I get this:

Access violation
The instruction at address 10004a62 attempted to write to location 00001104

100047e6 load program(<ptr>constAchar,<ptr>constAchar)[+27c]
100094fb sdbg_main [+0cd3]
00401000 main [+0076]

If that helps at all!

K
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Tue Sep 13, 2011 2:58 pm    Post subject: Reply with quote

I sometimes get this kind of error and it goes away if I repeat the command a few times.

Otherwise, try a complete rebuild and/or use a new DOS box.
Also look at the Task Manager to check that the last run has fully terminated.
Back to top
View user's profile Send private message AIM Address
KennyT



Joined: 02 Aug 2005
Posts: 318

PostPosted: Wed Sep 14, 2011 11:55 am    Post subject: Reply with quote

OK, I've isolated the problem. It's a call to DOWNLOAD@ that fails with an access violation:

Exception 0x000006c5, and the crash is in kernel32.dll.

But only when I run it via the debugger. In ordinary running, it works OK.

Any ideas?

K
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Wed Sep 14, 2011 12:53 pm    Post subject: Reply with quote

If you know the routine that leads to a call to kernel32.dll then you can check its arguments before the call.

If you cannot locate any errors in your code then you might be able to bypass the problem when debugging by isolating this part of the code so that this part runs in "release" mode (i.e. without any debugging options).

You can do this by using something like OPTIONS(-debug) before the code for the given routine or by putting it in a different file that has appropriate compiler command line args.
Back to top
View user's profile Send private message AIM Address
KennyT



Joined: 02 Aug 2005
Posts: 318

PostPosted: Wed Sep 14, 2011 2:32 pm    Post subject: Re: Reply with quote

PaulLaidler wrote:
If you know the routine that leads to a call to kernel32.dll then you can check its arguments before the call.

If you cannot locate any errors in your code then you might be able to bypass the problem when debugging by isolating this part of the code so that this part runs in "release" mode (i.e. without any debugging options).

You can do this by using something like OPTIONS(-debug) before the code for the given routine or by putting it in a different file that has appropriate compiler command line args.

Sorry, not sure I follow what you mean. Are you saying that there's a flag that can be used to detect if the app is being RUN via the debugger (as opposed to a source file having been compiled with debug, which I know how to do) so it can "skip past" the offending code? If yes, what's the syntax? I can't see "OPTIONS(-debug)" described in the help system.

K
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Wed Sep 14, 2011 4:16 pm    Post subject: Reply with quote

OPTIONS is an FTN95 directive that you can include in your Fortran code.

It allows you to set compiler command line switches in your code.

You will find it described under "Complier directives" in the help file.
Back to top
View user's profile Send private message AIM Address
KennyT



Joined: 02 Aug 2005
Posts: 318

PostPosted: Wed Sep 14, 2011 4:45 pm    Post subject: Re: Reply with quote

PaulLaidler wrote:
OPTIONS is an FTN95 directive that you can include in your Fortran code.

It allows you to set compiler command line switches in your code.

You will find it described under "Complier directives" in the help file.

OK, found that, thanks, but I don't understand how it helps!

The problem is that even when the routine that calls DOWNLOAD@ is not compiled with debug, when the application is run under SDBG, it crashes in that routine. (Compiling the routine with /debug allowed me to see that it was the call to DOWNLOAD@ that was causing the grief.)

So, what I really need is an inline test that says something like

"IF(.NOT.RUN_BY_SDBG) THEN"

Is there something like that available?


K
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Thu Sep 15, 2011 7:00 am    Post subject: Reply with quote

Not that I know of.
Back to top
View user's profile Send private message AIM Address
KennyT



Joined: 02 Aug 2005
Posts: 318

PostPosted: Thu Sep 15, 2011 8:46 am    Post subject: Re: Reply with quote

PaulLaidler wrote:
Not that I know of.

OK, Sad, so I guess the only approach is to use a command line switch and a batch file:

RUN_SDBG.BAT:
sdbg %1 /p /sdbg %2 %3 %4 %5

And then in my app:
call command_line(CH)
ISDBG = index(CH,"/sdbg")
IF( ISDBG.GT.0 ) THEN
CH = CH(ISDBG+5: )
END IF

and surround any "dodgy code" with:
IF( ISDBG.EQ.0 ) THEN
.
.
END IF

Should that work?

K

EDIT: Yes it does - very nicely! Very Happy
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
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