Board index » cppbuilder » Program Run stops before main()

Program Run stops before main()


2008-04-01 04:42:35 AM
cppbuilder101
Running XP with latest service pak. BCB 2007 with Dec 2007 Update. Also, using a fixed linker from CodeGear from 4 days ago.
I got a big (about 250 .cpp files) project finally compiled and linked on CB 2007. Even got a new fixed linker from CodeGear to get this far (linker was crashing). But when I try to Run my exe it stops before entering main.
The IDE just says [Stopped]. It doesn't say an exception has been hit. I see the de{*word*81} stop here on the jmp instruction:
004010FC jmp $0040110e
004010FE bound di,[edx]
00401101 inc ebx
Why is it stopping on a jump? How can a jump cause an exception?
The Breakpoint List is empty. So a breakpoint can't be stopping execution.
Also, if I scroll up in that assembly language instruction window then bizarrely the display instructions change:
004010F9 add [eax],al
004010FB add bl,ch
004010FD adc [esi+$62],ah
So we no longer see the jmp instruction visible. The de{*word*81} has decided to shift its frame of reference.
If I hit Run again then it reports an exception:
'access violation at 0x00401247: read of address 0x00000000'
Suggestions?
Here's what the console output shows:
Process Start: Z:\Moe\2008Mar13Files\Debug\BCBVCIMain.exe. Base Address: $00400000. Process BCBVCIMain.exe (3564)
Module Load: BCBVCIMain.exe. Has Debug Info. Base Address: $00400000. Process BCBVCIMain.exe (3564)
Module Load: ntdll.dll. No Debug Info. Base Address: $7C900000. Process BCBVCIMain.exe (3564)
Module Load: KERNEL32.dll. No Debug Info. Base Address: $7C800000. Process BCBVCIMain.exe (3564)
Module Load: ADVAPI32.dll. No Debug Info. Base Address: $77DD0000. Process BCBVCIMain.exe (3564)
Module Load: RPCRT4.dll. No Debug Info. Base Address: $77E70000. Process BCBVCIMain.exe (3564)
Module Load: Secur32.dll. No Debug Info. Base Address: $77FE0000. Process BCBVCIMain.exe (3564)
Module Load: WSOCK32.dll. No Debug Info. Base Address: $71AD0000. Process BCBVCIMain.exe (3564)
Module Load: WS2_32.dll. No Debug Info. Base Address: $71AB0000. Process BCBVCIMain.exe (3564)
Module Load: msvcrt.dll. No Debug Info. Base Address: $77C10000. Process BCBVCIMain.exe (3564)
Module Load: WS2HELP.dll. No Debug Info. Base Address: $71AA0000. Process BCBVCIMain.exe (3564)
Module Load: cc3280mt.dll. No Debug Info. Base Address: $32800000. Process BCBVCIMain.exe (3564)
Module Load: USER32.dll. No Debug Info. Base Address: $7E410000. Process BCBVCIMain.exe (3564)
Module Load: GDI32.dll. No Debug Info. Base Address: $77F10000. Process BCBVCIMain.exe (3564)
Module Load: OLEAUT32.dll. No Debug Info. Base Address: $77120000. Process BCBVCIMain.exe (3564)
Module Load: ole32.dll. No Debug Info. Base Address: $774E0000. Process BCBVCIMain.exe (3564)
 
 

Re:Program Run stops before main()

In article <47f14cbb$ XXXX@XXXXX.COM >,
"Randall Parker" < XXXX@XXXXX.COM >wrote:
Quote
The IDE just says [Stopped]. It doesn't say an exception has been hit. I see
the de{*word*81} stop here on the jmp instruction:
This sounds like one of two known issues:
Logitech driver:
<support.codegear.com/article/37564>
or a missing .dll file. Try running the .exe outside the IDE to see if
it shows a message.
--
David Dean (CodeGear)
Lead C++ QA Engineer
 

Re:Program Run stops before main()

I
"David Dean [CodeGear]" < XXXX@XXXXX.COM >wrote in message
Quote
In article <47f14cbb$ XXXX@XXXXX.COM >,

or a missing .dll file. Try running the .exe outside the IDE to see if
it shows a message.
I don't think it has to be a missing .dll file - I think the start up code
will also break if a .dll (initialization code) returns a failure causing
the OS to not (complete the) load, even when the .dll is there...
You might try opening the modules pane, and/or viewing the event log (think
module loads will show there) and see what the last .dll/module loaded is
shown as. This may at least get you in the ballpark of what is causing the
problem.
 

{smallsort}

Re:Program Run stops before main()

In article < XXXX@XXXXX.COM >,
"dhoke" < XXXX@XXXXX.COM >wrote:
Quote
I don't think it has to be a missing .dll file - I think the start up code
will also break if a .dll (initialization code) returns a failure causing
the OS to not (complete the) load, even when the .dll is there...
That sounds like a good test case for QC.
--
David Dean (CodeGear)
Lead C++ QA Engineer
 

Re:Program Run stops before main()

"David Dean [CodeGear]" < XXXX@XXXXX.COM >wrote in message
Quote
In article < XXXX@XXXXX.COM >,
"dhoke" < XXXX@XXXXX.COM >wrote:

>I don't think it has to be a missing .dll file - I think the start up
>code
>will also break if a .dll (initialization code) returns a failure causing
>the OS to not (complete the) load, even when the .dll is there...

That sounds like a good test case for QC.
Randall: Try running your EXE by double-clicking it in explorer rather than
running it through the IDE.
If it is indeed a missing DLL file there is a somewhat related QC report
here:
qc.borland.com/wc/qcmain.aspx
Report #: 57704 Status: Open
Missing proper "dynamic library not found in path" message; breakpoint in
strange place.
Maybe that helps,
Jason
 

Re:Program Run stops before main()

"David Dean [CodeGear]" < XXXX@XXXXX.COM >wrote in message
Quote
In article < XXXX@XXXXX.COM >,
"dhoke" < XXXX@XXXXX.COM >wrote:

>I don't think it has to be a missing .dll file - I think the start up
>code
>will also break if a .dll (initialization code) returns a failure causing
>the OS to not (complete the) load, even when the .dll is there...

That sounds like a good test case for QC.
dhoke: This is also true, I actually have a test case for this already.
See "Re: Program Run stops before main()" in borland.public.attachments.
It's a DLL that fails during load, and the program uses it. Running the
program in the IDE will break in a weird spot (even though running the EXE
through the shell generates a proper "application failed to initialize"
message).
This is an additional case for QC 57704; although I can't edit that now that
it's open.
Jason
 

Re:Program Run stops before main()

In article <47f18804$ XXXX@XXXXX.COM >,
"Jason Cipriani" < XXXX@XXXXX.COM >wrote:
Quote
This is an additional case for QC 57704; although I can't edit that now that
it's open.
I'd actually like to see this entered as a separate case so that
regression testing can catch either instance in the future.
--
David Dean (CodeGear)
Lead C++ QA Engineer
 

Re:Program Run stops before main()

"David Dean [CodeGear]" < XXXX@XXXXX.COM >wrote:
Quote
In article <47f14cbb$ XXXX@XXXXX.COM >,
"Randall Parker" < XXXX@XXXXX.COM >wrote:

>The IDE just says [Stopped]. It doesn't say an exception has been hit. I see
>the de{*word*81} stop here on the jmp instruction:

This sounds like one of two known issues:
You are right sir. Running from the command prompt reports that it can not find one of the Boost DLLs.
Okay, but how to get that DLL's directory on the path inside the IDE? I do not see a place in Project Options for it.
I could just copy the Boost DLLs into the output dir where the exe gets placed.
Or I could edit the OS environment variables. But I do not want to have to do that every time I check a project out of Subversion at a new location.
So is there a place in the IDE to specify some environment variables? The Paths and Defines do not appear to have a control for that purpose. I hoped it would have used the Library paths.
Quote

Logitech driver:

<support.codegear.com/article/37564>

or a missing .dll file. Try running the .exe outside the IDE to see if
it shows a message.
--
David Dean (CodeGear)
Lead C++ QA Engineer
 

Re:Program Run stops before main()

"Randall Parker" < XXXX@XXXXX.COM >wrote in message
Quote

Okay, but how to get that DLL's directory on the path inside the IDE? I do
not see a place in Project Options for it.
bds2006 has Tools-Options-Environment Variables - but I don't think it
allows just adding to pre-existing, haven't tried that though... And I
expect its for the entire environment, any IDE session, not just the
project...
Quote

I could just copy the Boost DLLs into the output dir where the exe gets
placed.
This is the approach I tend to take...
Quote

Or I could edit the OS environment variables. But I do not want to have to
do that every time I check a project out of Subversion at a new location.

So is there a place in the IDE to specify some environment variables? The
Paths and Defines do not appear to have a>control for that purpose. I
hoped it would have used the Library paths.
see above
 

Re:Program Run stops before main()

"David Dean [CodeGear]" < XXXX@XXXXX.COM >wrote:
Quote
or a missing .dll file. Try running the .exe outside the IDE to
see if it shows a message.
I copied all the Boost DLLs into the EXE directory and now my EXE is finally running in the CG CB 2007 IDE. I'm shocked.
Thanks to you and all the others who helped me get to this point.
Quote
--
David Dean (CodeGear)
Lead C++ QA Engineer
 

Re:Program Run stops before main()

In article <47f24258$ XXXX@XXXXX.COM >,
"Randall Parker" < XXXX@XXXXX.COM >wrote:
Quote
Okay, but how to get that DLL's directory on the path inside the IDE? I do
not see a place in Project Options for it.
I'd edit the PATH environment variable or move the dll dpending on
the use case, but it is also possible to use the SetDllDirectory
function (XP SP1 or later)
DLL search order:
<msdn2.microsoft.com/en-us/library/ms682586(VS.85).aspx>
SetDllDirectory:
<msdn2.microsoft.com/en-us/library/ms686203.aspx>
--
David Dean (CodeGear)
Lead C++ QA Engineer
 

Re:Program Run stops before main()

David Dean [CodeGear] wrote:
Quote
SetDllDirectory:
<msdn2.microsoft.com/en-us/library/ms686203.aspx>
You would then want to use the Delay Load DLL
option under the Linker options.