General Question HELP DEBUGGING

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
I am having an issue. I am trying to debug. I get a error that the pdb file can't be loaded. I tell it where it is: orbiter/modules

and it says no symbol

debugissue.jpg
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,931
Reaction score
2,944
Points
188
Website
github.com
I am having an issue. I am trying to debug. I get a error that the pdb file can't be loaded. I tell it where it is: orbiter/modules

and it says no symbol

debugissue.jpg

Yeah, we don't have access to the .pdb file for orbiter.exe, that basically says in what line the crash occurs. When the debugger stops inside orbiter.exe, we can't really tell what is going on.... 99.9% of the times the problem is in our code that is sending trash into orbiter somewhere... :facepalm:
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Thanks. So how can I tell short of delete my code til it works?
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,931
Reaction score
2,944
Points
188
Website
github.com
Thanks. So how can I tell short of delete my code til it works?

You can't. If you did some changes recently, that's a good place to start checking what you send to orbiter (propellant handles, thruster handles, thruster values, propellant masses, invalid addresses, etc.
 

dbeachy1

O-F Administrator
Administrator
Orbiter Contributor
Addon Developer
Donator
Beta Tester
Joined
Jan 14, 2008
Messages
9,218
Reaction score
1,566
Points
203
Location
VA
Website
alteaaerospace.com
Preferred Pronouns
he/him
You can look at the 'Call Stack' window in the debugger -- it will (hopefully) show you the most recent calls to or from your code (you don't need the Orbiter PDB for it to work). Here's an example of how it looks:



You can then double-click on a stack frame in the window and Visual Studio will bring up the code at that address (assuming it's your code and you have source for it -- otherwise it will just bring up the machine code in the disassembly window).

You can read about how to use the call stack window here: https://msdn.microsoft.com/en-us/library/a3694ts5.aspx?f=255&MSPPError=-2147217396
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
I get this:
DEBUG2.jpg

I am going to try to make a new project from scratch.
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,403
Reaction score
581
Points
153
Location
Vienna
Thanks. So how can I tell short of delete my code til it works?

A second approach to find and fix such bugs is static code analysis. Go over compiler warnings, review your code mentally in the order it gets executed, etc.

With this I often get much quicker results than with brute-force debugger sessions, especially if multi-threading is involved.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Thanks. I have run into this a couple of times. So it makes me think it is the way my is set up. I remember a tutorial on how to set up a project from start but couldn't find it

---------- Post added at 07:13 AM ---------- Previous post was at 06:19 AM ----------

I have royally messed things up.
I get these errors:
Error 17 error LNK1120: 15 unresolved externals C:\orbiter100830\Modules\ORION3.dll ORION3
Error 4 error LNK2001: unresolved external symbol "char const * __cdecl std::_Syserror_map(int)" (?_Syserror_map@std@@YAPBDH@Z) C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 3 error LNK2001: unresolved external symbol "char const * __cdecl std::_Winerror_map(int)" (?_Winerror_map@std@@YAPBDH@Z) C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 14 error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@) C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 15 error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 12 error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 5 error LNK2001: unresolved external symbol "void __cdecl std::_Xbad_alloc(void)" (?_Xbad_alloc@std@@YAXXZ) C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 7 error LNK2001: unresolved external symbol "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPBD@Z) C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 6 error LNK2001: unresolved external symbol "void __cdecl std::_Xout_of_range(char const *)" (?_Xout_of_range@std@@YAXPBD@Z) C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 2 error LNK2001: unresolved external symbol @__security_check_cookie@4 C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 16 error LNK2001: unresolved external symbol __DllMainCRTStartup@12 C:\orbiter100830\Orbitersdk\samples\ORION3\LINK ORION3
Error 13 error LNK2001: unresolved external symbol __hypot C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 11 error LNK2001: unresolved external symbol __purecall C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 10 error LNK2001: unresolved external symbol _atexit C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 9 error LNK2001: unresolved external symbol _memmove C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 8 error LNK2001: unresolved external symbol _sprintf_s C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
 
Last edited:

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Looks like some really big LOCV... did you ignore the wrong standard library in the linker stage? Does the error persist when you Clean&Build?
 

dbeachy1

O-F Administrator
Administrator
Orbiter Contributor
Addon Developer
Donator
Beta Tester
Joined
Jan 14, 2008
Messages
9,218
Reaction score
1,566
Points
203
Location
VA
Website
alteaaerospace.com
Preferred Pronouns
he/him
I get this:
DEBUG2.jpg

What do you see in the call stack window if you scroll down to see the additional (older) frames? Are all the frames inside orbiter.exe?
 

ADSWNJ

Scientist
Addon Developer
Joined
Aug 5, 2011
Messages
1,667
Reaction score
3
Points
38
Assuming you get the code back to compiling again, start putting in some breakpoints ... seeing if you have a stable addon to start with (e.g. in InitModule), and then working through your functions until you break it.

My guess is that you are overrunning your memory somewhere (i.e. running off the end of the memory you have declared), or using a pointer to a piece of local stack storage that has gone out of scope, so you are stomping on things on the call stack.

Revert back to when it was stable, and then retrace your steps. (You are saving intermediate commits, aren't you?)
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Looks like some really big LOCV... did you ignore the wrong standard library in the linker stage? Does the error persist when you Clean&Build?
Not sure about the ignore.

But I cleaned and rebuilt:
Error 7 error LNK2001: unresolved external symbol _sprintf_s C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 8 error LNK2001: unresolved external symbol _memmove C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 9 error LNK2001: unresolved external symbol _atexit C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 10 error LNK2001: unresolved external symbol __purecall C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 12 error LNK2001: unresolved external symbol __hypot C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 15 error LNK2001: unresolved external symbol __DllMainCRTStartup@12 C:\orbiter100830\Orbitersdk\samples\ORION3\LINK ORION3
Error 1 error LNK2001: unresolved external symbol @__security_check_cookie@4 C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 5 error LNK2001: unresolved external symbol "void __cdecl std::_Xout_of_range(char const *)" (?_Xout_of_range@std@@YAXPBD@Z) C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 6 error LNK2001: unresolved external symbol "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPBD@Z) C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 4 error LNK2001: unresolved external symbol "void __cdecl std::_Xbad_alloc(void)" (?_Xbad_alloc@std@@YAXXZ) C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 11 error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 14 error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 13 error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@) C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 2 error LNK2001: unresolved external symbol "char const * __cdecl std::_Winerror_map(int)" (?_Winerror_map@std@@YAPBDH@Z) C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 3 error LNK2001: unresolved external symbol "char const * __cdecl std::_Syserror_map(int)" (?_Syserror_map@std@@YAPBDH@Z) C:\orbiter100830\Orbitersdk\samples\ORION3\ORION3.obj ORION3
Error 16 error LNK1120: 15 unresolved externals C:\orbiter100830\Modules\ORION3.dll ORION3

linkerpages.jpg


---------- Post added at 01:48 PM ---------- Previous post was at 01:41 PM ----------

What do you see in the call stack window if you scroll down to see the additional (older) frames? Are all the frames inside orbiter.exe?
YES THEY ARE.

---------- Post added at 01:58 PM ---------- Previous post was at 01:48 PM ----------



No. The one I remember started with a whole new project.

---------- Post added at 02:13 PM ---------- Previous post was at 01:58 PM ----------

Well I got the debug to work. I guess I remove enough code. Thanks
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,635
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Well, the missing references are all from a standard library, suggesting your project is using a library of a different version than the header file or no library at all. That is what I would check then.
 
Top