Advanced Question Debuging in 2006

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,683
Points
203
Location
Dallas, TX
Ok Now another vessel in 2006. Compiles good. But when I run debug I get these build errors:

------ Build started: Project: MOONBASEALPHA1, Configuration: Debug Win32 ------
Compiling...
MOONBASEALPHA1.cpp
c:\orbiter\orbitersdk\samples\moonbasealpha1\moonbasealpha1.cpp(116) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
c:\orbiter\orbitersdk\samples\moonbasealpha1\moonbasealpha1.cpp(3447) : warning C4244: 'argument' : conversion from 'double' to 'int', possible loss of data
c:\orbiter\orbitersdk\samples\moonbasealpha1\moonbasealpha1.cpp(3435) : warning C4101: 'apd' : unreferenced local variable
c:\orbiter\orbitersdk\samples\moonbasealpha1\moonbasealpha1.cpp(3434) : warning C4101: 'ap' : unreferenced local variable
Linking...
Creating library .\Debug/ShuttlePB.lib and object .\Debug/ShuttlePB.exp
MOONBASEALPHA1.obj : error LNK2019: unresolved external symbol "void * __cdecl operator new[](unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??_U@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z) referenced in function "public: char * __cdecl std::_DebugHeapAllocator<char>::allocate(unsigned int,void const *)" (?allocate@?$_DebugHeapAllocator@D@std@@QAAPADIPBX@Z)
MOONBASEALPHA1.obj : error LNK2019: unresolved external symbol "struct std::_DebugHeapTag_t const & __cdecl std::_DebugHeapTag_func(void)" (?_DebugHeapTag_func@std@@YAABU_DebugHeapTag_t@1@XZ) referenced in function "public: char * __cdecl std::_DebugHeapAllocator<char>::allocate(unsigned int,void const *)" (?allocate@?$_DebugHeapAllocator@D@std@@QAAPADIPBX@Z)
./../../../Modules/MOONBASEALPHA1.dll : fatal error LNK1120: 2 unresolved externals
Build log was saved at "file://c:\ORBITER\Orbitersdk\samples\MOONBASEALPHA1\Debug\BuildLog.htm"
MOONBASEALPHA1 - 3 error(s), 4 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,683
Points
203
Location
Dallas, TX
Now no errors but I get this break

Not sure where the mba.cpp and mba.h stuff is coming from
 
Last edited:

orb

New member
News Reporter
Joined
Oct 30, 2009
Messages
14,020
Reaction score
4
Points
0
You have passed NULL pointer either as a parameter or inside a class that was this parameter for Orbiter's function. You should break the execution and look at call stack backtrace to find your module's function causing this exception.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,683
Points
203
Location
Dallas, TX
You have passed NULL pointer either as a parameter or inside a class that was this parameter for Orbiter's function. You should break the execution and look at call stack backtrace to find your module's function causing this exception.

When I break I get a window that sys No symbols are loaded for any call stack frame. Press ok or show Dissassembly
 

computerex

Addon Developer
Addon Developer
Joined
Oct 16, 2007
Messages
1,282
Reaction score
17
Points
0
Location
Florida
Your crash seems to have occurred in Orbiter code because you may have given garbage data as input to some orbiter method. You can't step through Orbiter code, you can however step through the disassembly, but I am not sure if that will be much help to you. Just try to narrow the problem to some subroutine in your code, then step through it to figure out where the crash occurs.
 

orb

New member
News Reporter
Joined
Oct 30, 2009
Messages
14,020
Reaction score
4
Points
0
When I break I get a window that sys No symbols are loaded for any call stack frame. Press ok or show Dissassembly

So, press OK to show disassembly, and then look at Call Stack at the bottom-right of the debugger's window, and find last call from your module that has those symbols, and click (or double click - I don't remember) on it to show your code.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,683
Points
203
Location
Dallas, TX
So, press OK to show disassembly, and then look at Call Stack at the bottom-right of the debugger's window, and find last call from your module that has those symbols, and click (or double click - I don't remember) on it to show your code.


Look at them and none match. they are a lot of Orbiter.exe ... The top one is Orbiter.exe!0041da40
 

orb

New member
News Reporter
Joined
Oct 30, 2009
Messages
14,020
Reaction score
4
Points
0
The screenshot only shows that pointer to "this" class used by the method shown on the assembly listing is NULL (from the exception: 0x00000D70 = NULL + 0D70h), and that method might be at least 7 levels below the call from your module.

Is your module listed on the Call Stack somewhere down on the list at all?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,683
Points
203
Location
Dallas, TX
no the only things listed are:
orbiter.exe, user32.dll,kernel32.dll,ntdll.dll
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,683
Points
203
Location
Dallas, TX
This is what I get in the call back

This is odd. I can run the scenario with the MoonbaseAlpha which is what I am trying to debug. runs fine.
exit and load current state runs good.


But then run it in debug it breaks. if I exit the debuging. And rerun the current state I get a CTD.

But if I run it from the scenario I get no ctd although some of the data is wrong on the HUD. And no breakpoints

On the image you can see a breakpoint is defined. But in Orbiter the camera and pad info is wrong.
The pad should 1:
Code:
 //Rectangle (hdc, tx-2, ty-1, tx+120,ty+(yoff*7));
  SetTextColor (hdc, colRed);
  n3 = sprintf (cbuf, "PAD: %d", (PADSel));
  TextOut(hdc,tx,ty5,cbuf,n3 );


  n1 = sprintf (cbuf, "CAMERA: %d", (CAM));
  TextOut(hdc,tx,ty3,cbuf,n1 );
 // n1 = sprintf (cbuf, "CAMERA: " );
  //TextOut(hdc,tx,ty3,cbuf,n1 );
          SelectCockpitView(CAM);

   if (PADSel==0) {n=sprintf (cbuf, "External ");
  TextOut(hdc,tx+100,ty3,cbuf,n );}
  if ((CAM==0)&& (PADSel==1)){n=sprintf (cbuf, "Pad#1TOP ");
  TextOut(hdc,tx+100,ty3,cbuf,n );}
   if ((CAM==1)&& (PADSel==1)) {n=sprintf (cbuf, "Pad#1SIDEANGLE ");
  TextOut(hdc,tx+100,ty3,cbuf,n );}
  if ((CAM==2)&& (PADSel==1)) {n=sprintf (cbuf, "Pad#1SIDE");
  TextOut(hdc,tx+100,ty3,cbuf,n );}

But it is saved as
CWH -1163005939 -0.0000
TCCE 0 0.0000
TCCW 0 0.0000
PAD -1163005939 0.0000


Code:
sprintf (cbuf, "%d %0.4f",  PADSel);
        oapiWriteScenario_string (scn, "PAD", cbuf);
 

Attachments

  • compileerros2006.jpg
    compileerros2006.jpg
    148.4 KB · Views: 3
  • mbaissue.jpg
    mbaissue.jpg
    135 KB · Views: 6
Last edited:

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,683
Points
203
Location
Dallas, TX
I have a breakpoint set but it never stops. I have it set where the HUD is displayed.
 

Xyon

Puts the Fun in Dysfunctional
Administrator
Moderator
Orbiter Contributor
Addon Developer
Webmaster
GFX Staff
Beta Tester
Joined
Aug 9, 2009
Messages
6,926
Reaction score
794
Points
203
Location
10.0.0.1
Website
www.orbiter-radio.co.uk
Preferred Pronouns
she/her
If the breakpoint is not hit then either it's being jumped over by a conditional clause or there's an issue with the breakpoint, in which case Visual Studio will point that out by changing the icon for it.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,683
Points
203
Location
Dallas, TX
Ok when I set the breakpoint It is a red circle when I start to debug it is aempty circle with a yellow warning.
When I move over it is state the breakpoint will not be hit. No symbols have been loaded for this document
 

Xyon

Puts the Fun in Dysfunctional
Administrator
Moderator
Orbiter Contributor
Addon Developer
Webmaster
GFX Staff
Beta Tester
Joined
Aug 9, 2009
Messages
6,926
Reaction score
794
Points
203
Location
10.0.0.1
Website
www.orbiter-radio.co.uk
Preferred Pronouns
she/her
Let's try an exercise in independent thinking. Why do you think the breakpoint would not be hit? What would cause there to be no symbols loaded for the document?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,683
Points
203
Location
Dallas, TX
I guess it is in a conditional phrase that doesn't get hit. So I moved it into
MOONBASEALPHA1::MOONBASEALPHA1 (OBJHANDLE hObj, int fmodel)
: VESSEL2 (hObj, fmodel)
so it would get hit.

There are NO build errors.
 

Xyon

Puts the Fun in Dysfunctional
Administrator
Moderator
Orbiter Contributor
Addon Developer
Webmaster
GFX Staff
Beta Tester
Joined
Aug 9, 2009
Messages
6,926
Reaction score
794
Points
203
Location
10.0.0.1
Website
www.orbiter-radio.co.uk
Preferred Pronouns
she/her
Remember what I said before. Either the breakpoint is skipped over or there is a problem with it and Visual Studio reports an error with the point and displays that broken breakpoint icon.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,683
Points
203
Location
Dallas, TX
What the issue was the debug dll name was different than the dll that was being used.

Not it works. Thanks

But here is what I was hunting for. I have this.
If AL1A_proc==O then the AL1A door is shut. So if in the action area open the AL1 door.



As you can see action area is 8 and AL1A_proc is 0.000000000

But the door will not open.

It would before I put that statement in.
 

Attachments

  • mbaissue1.jpg
    mbaissue1.jpg
    177.8 KB · Views: 3

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,683
Points
203
Location
Dallas, TX
MOONBASE ALPHA debug AIRLOCKS

OK this isn't making sense to me.
There are 2 airlocks AL1 and AL1A
I have this set so if one of them is open AL1_proc==0 or AL1A_proc==0 then don't open the other.

Code:
else if(ActionAreaReturnCode==7) 
        //innerAIRLOCK1
        {
            if (AL1_proc==0)
            RevertAL1A ();
        }
else if(ActionAreaReturnCode==8) 
        //outerAIRLOCK1
        {
            if (AL1A_proc==0)
            RevertAL1 ();
        }


Then works great on AL1A. But If I open and close AL1A a couple of times and close it. walk down to AL1 it opens a bit. then I have to hit Enter again and it opens,.....

This is what I get from the debug

it shows AL1A Hatch Raising. and AL1 Hatch Up.
Al1a_proc was 0.00000000 and AL1 was .1000000


If I understand the code AL1A status should be Hatch UP meaning the door is closed. As the other doors are when shut.
Code:
AL1_status      = HATCH_UP;
AL1_proc        = 0.0;
AL1A_status      = HATCH_UP;
AL1A_proc        = 0.0;

Here is where the animation is set:
Code:
if (AL1_status >= HATCH_RAISING) {
        double da = simdt * LIFT_SPEED;
        if (AL1_status == HATCH_RAISING) {
            if (AL1_proc > 0.0) AL1_proc = max (0.0, AL1_proc-da);
            else                AL1_status = HATCH_UP;
        } else {
            if (AL1_proc < 1.0) AL1_proc = min (1.0, AL1_proc+da);
            else                AL1_status = HATCH_DOWN;
        }
        SetAnimation (anim_AL1, AL1_proc);
        


}
//inner airlock
if (AL1A_status >= HATCH_RAISING) {
        double da = simdt * LIFT_SPEED;
        if (AL1A_status == HATCH_RAISING) {
            if (AL1A_proc > 0.0) AL1A_proc = max (0.0, AL1A_proc-da);
            else                AL1_status = HATCH_UP;
        } else {
            if (AL1A_proc < 1.0) AL1A_proc = min (1.0, AL1A_proc+da);
            else                AL1A_status = HATCH_DOWN;
        }
        SetAnimation (anim_AL1A, AL1A_proc);
        


}

Code:
void MOONBASEALPHA1::RevertAL1 (void)
{
    AL1_status = ((AL1_status == HATCH_UP || AL1_status == HATCH_RAISING) ?
        HATCH_LOWERING : HATCH_RAISING);
}
//AIRLOCK1OUTER
void MOONBASEALPHA1::RevertAL1A (void)
{
    AL1A_status = ((AL1A_status == HATCH_UP || AL1A_status == HATCH_RAISING) ?
        HATCH_LOWERING : HATCH_RAISING);
}
 
Last edited:

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,707
Reaction score
2,683
Points
203
Location
Dallas, TX
This is kicking me. Here are some screen shots from the debug.

mbaissue2c.jpg


AL1 & AL1A status Hatch up meaning door closed.

mbaissue2d.jpg


both proc are 0

mbaissue2g.jpg


now AL1 door is messing up. AL1A_proc=0 but status is hatch raising. AL1 proc is .005 and status HAtch_up

I press enter and the door open alittle more
mbaissue2h.jpg


but the status for Al1 is still HAtch_up

---------- Post added at 09:14 PM ---------- Previous post was at 08:54 PM ----------

Fixed Yeah

It was missing an A
Code:
//inner airlock
if (AL1A_status >= HATCH_RAISING) {
        double da = simdt * LIFT_SPEED;
        if (AL1A_status == HATCH_RAISING) {
            if (AL1A_proc > 0.0) AL1A_proc = max (0.0, AL1A_proc-da);
            else                AL1[COLOR="Red"]A[/COLOR]_status = HATCH_UP;
        } else {
            if (AL1A_proc < 1.0) AL1A_proc = min (1.0, AL1A_proc+da);
            else                AL1A_status = HATCH_DOWN;
        }
        SetAnimation (anim_AL1A, AL1A_proc);
        


}
 
Top