RESULT is not in context lazarus / 12-Debugger ---------------------------------------------------------------------- VBDavie · 2011-05-09 20:02 I set a break point in my function and at various places in the code (as I step thru line by line) I place the mouse over the RESULT variable that I have. It shows me NOTHING. It says something about the "result" variable is not in context or something like that.... AH  "No Symbol \"result\" in current context" So, don't really know what that means. I know that BORLANDS Delphi has SMART coding so that even though you have a line of code that says "result:=69;"  it may not actaully compile that into object code, because the compiler SEEEES that you have code comming up that RESETS the variable to something else AND you have no references to the variable in the mean time. So, it simply ELIMINATES that line of code logically from the compilation, which means that of couse the debugger can't show a value for it. But that is NOT my situation. I am setting the variable all over the place and in no place can I obtain the value for it ;((  Here is my code... function MsgWndProc(HWindow: HWnd; Message, WParam, LParam: Longint): Longint;stdcall; Var   Msg : TMsg; begin   Result:=0;   writeln(message,',',wm_special,',',lparam,',',wparam);   If (Message=WM_SPECIAL) then     begin       Case wParam Of            C_STARTPROGRAM: Begin              writeln('startprogram ',lparam,',',wparam,',',message);                            End;            C_ENDPROGRAM:   Begin              writeln('endprogram ',lparam,',',wparam,',',message);                            Form1.Close;                            End;            C_DUMPICONINFO: Begin              writeln('dumpiconinfo ',lparam,',',wparam,',',message);                            End;            end;       Result:=1;     end   else     Result:=DefWindowProc(HWindow,Message,WParam,LParam); end; So, maybe Lazarus doesn't like to give values for FUNCTION results? Hmmm. Davie ---------------------------------------------------------------------- Martin_fr · 2011-05-09 21:22 There is a page with general info on the debugger. http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Hardware_exceptio ns_under_Mac_OS_X However, your problem does not sound, like it is nay of the ones covered there. Please check in first, that: - you compile the with debug info.   Menu: "Project", "Project Options", Page "Linking"    Either the option with -g or -gw (in brackets at the end of the option text) MUST be checked.    Having only -gl may not be sufficient - Also ensure, that you:    do not "strip symbols",    do not "use external symbols"    do not use smart linking    do not use optimization (except -O1) * If that does not help:  Can you see the value of other variables?  Can you try to open the "watches" window and add Result there?  Can you open the stack window and see that the "current" stack is the one that points to the function in which you want to read the Result?    The current stack should be initially at the function where the execution stops. But maybe it went wrong?    You can try and change the current stack.     Try to open the "locals" window, and see if anything is in there? ---------------------------------------------------------------------- VBDavie · 2011-05-10 00:18 Smart linking didn't make any difference. It was setting the optimizations to "1". I had it set to "3", once I changed it to "1", then the variables started showing their values as I would expect, the smart linking on/off had no effect. ---------------------------------------------------------------------- Leledumbo · 2011-05-10 02:44 QuoteIt was setting the optimizations to "1". I had it set to "3", once I changed it to "1", then the variables started showing their values as I would expectAFAIK you shouldn't develop / debug with optimizations on, turn it off at all, and only turn it on when you're releasing. FPC can't (yet) give exact debugging info for optimized code.