Viewing Variables while Debugging lazarus / 11-Options ---------------------------------------------------------------------- texasyen · 2012-05-24 17:50 Lazarus: 0.9.30.4; FPC: 2.6.1 (SVN revision: 37234) Once upon a time: While debugging my program, I can set a breakpoint, run to that point, and put my mouse cursor on a variable and a little window would pop up showing me the value of that variable. If the variable was a record, the value for all fields would be shown. If an array, all elements would be shown. I could then either "step into", "step over", or run from that breakpoint. I really liked both seeing the values and being able to move from the breakpoint. Now: I set a breakpoint and the program runs to that point. I set my mouse curson on a variable and all the pop up window shows for its value is '???'. I can't "step into", "step over", or run from that breakpoint. I have to stop the program. Between Once upon a time and now, I must have thrown a swith or something. I've gone through the Projects -> Options and the Tools -> Options but I can't reset Lazarus to what it did once upon a time. Does anybody have any ideas what I can do to reset the features that I really liked and had once upon a time? ---------------------------------------------------------------------- BigChimp · 2012-05-24 18:36 Could be that you set the debugging options in project options differently, IIRC, on Windows, use dwarf2 or dwarf with sets (or perhaps default); you can set either external debugging files but probably best to leave it as internal. On Linux, you can probably set debug options to automatic. There's a (IIRC very helpful) wiki page on debugging tips which you can have a look at. Good luck. Edit: oh another tip: you can set up 2 build modes (build mode in project options, one Default, and one called e.g. Debug). Set debugging to off in the default one and on (as above) in Debug. Now you can switch between the two modes, debug easily and also easily release your finished application.. ---------------------------------------------------------------------- Martin_fr · 2012-05-24 18:38 The debugger setup is described here: http://wiki.lazarus.freepascal.org/Debugger_Setup ---------------------------------------------------------------------- BigChimp · 2012-05-25 08:05 Thanks, Martin, and it is a very clear and helpful page! Regards, BigChimp ---------------------------------------------------------------------- marcov · 2012-05-25 08:22 Quote from: Martin_fr on May 24, 2012, 08:38:50 pmThe debugger setup is described here: http://wiki.lazarus.freepascal.org/Debugger_Setup What's the rationale behind the recommendation against -XX ? ---------------------------------------------------------------------- Martin_fr · 2012-05-25 14:33 Quote from: marcov on May 25, 2012, 10:22:21 amWhat's the rationale behind the recommendation against -XX ? IIRC ttp://bugs.freepascal.org/view.php?id=15281 Long back there definitely were problems (I had them myself, and I was able to narrow them to smart linking) I believe fpc, now ignores smart linking, if using dwarf on win (Every time I do set that up, there is a msg "not supported") ---------------------------------------------------------------------- texasyen · 2012-05-25 19:56 Gentlemen, It's not helping: I've tried Dwarf with sets, Dwarf2, Dwarf3, stabs, and automatic. I've tried closing Lazarus after each change, building the program, and then running the program. No help. I made sure to set everything according to the debugger setup that Martin refered to. Made sure everything was turned off that were supposed to be turned off (Strip/smart for examples). Made sure everything was turned on that were suppoesed to be turned on. No go. What's curious is that sometimes it does behave the way it did once upon a time. Usually, it doesn't. Also, I have had some compiler/debugger settings change (e.g., show exe info) without my involvement. Any other suggestions? ---------------------------------------------------------------------- Martin_fr · 2012-05-25 20:28 Are you sure you are referring to variables? http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Properties And those variables are defined in one of *your* units? If you try global variables from other units, then the other unit must have debug info. And if it is a variable from the RTL, then you need to rebuild fpc. Also you specify fpc 2.6.1: that is a "working version" everyday it is different. So no one knows what fpc you have. While the FPC you have is most likely OK, You might try 2.6.0, or try upgrade. However I do not think changing FPC will make a difference.... What may make a huge difference is using Lazarus 0.9.31 (current fixes branch). There are huge improvements in the debugger. You can also use Laz1.1, but it does not have much debugger related improvements over 0.9.31. And 0.9.31 is more stable than 1.1 --- Lets go step by step then: What OS are you on? 32 or 64 bit? Do you see blue dots in the gutter, next to the line numbers? (In lines without breakpoint, but with pascal code) If stopped at a breakpoint, and you open the "watch window" (Menu "View" > "Debug Windows"), and enter a local variable there, do you get a value? --- Provide the log-file AND the "debug output" as described on http://wik i.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session For the "debug output" it is important, that you open this window *before* you run your app. (And that the IDE has been fresh restarted) ---------------------------------------------------------------------- texasyen · 2012-05-25 21:00 Martin_fr, going step by step: Operating System: Windows XP SP3 32 bit. Do I see blue dots in the gutter next to the line number? I can't testify whether they're blue (the look black to me). I have line numbers every 5 lines. The dots occur only where there is no line number. So it looks like this. So there are no dots next to the line number. 785     .     .     .     .     . 790 In the watches window, regardless of the variable I get I'm going to work on getting the files. That might take some time. ---------------------------------------------------------------------- Martin_fr · 2012-05-25 21:12 http://imagebin.org/213870 lines 35 to 38 have blue dots. Normally the absence of them, means the file has no debug info. There may be some rare other causes. Lets have a look at the logs, once you have them ---------------------------------------------------------------------- texasyen · 2012-05-25 23:07 Opened every window possible (breakpoint window, call stack window, etc.), and all of a sudden--poof: the blue dots showed up. I was able to step into or step over methods. I put my mouse cursor on a variable and a pop up window would show me its value. In other words, I have a functioning debugger. To tell you the truth, I don't know what I did. I don't know how long I'll have it. But I spent some time debugging my program. I tried closing and then reopening Lazarus, and I still have it. I haven't tried a system's reboot. (Call me coward but darn I like having a debugger!) Like I said, I don't know why, I don't know for how long. I have the debug output attached. Still haven't figured out how to get log file. A few differences exist between my sytem and the suggestions made on wiki file you directed me to. I hope the attachment is what you were asking for. ---------------------------------------------------------------------- texasyen · 2012-05-25 23:28 Popped the top to my favorite brew, took a deep breath, performed a system's reboot. I still have a functioning debugger! Still don't know what I did. Still don't know how long I'll have it.  Still working on getting you the file that you wanted. I'm just stepping into every line of code! ---------------------------------------------------------------------- Martin_fr · 2012-05-26 00:11 Well it looks all very good in that file. But since the debugger started to work, I can't diagnose what happened before. I can see the line info was there, so the blue dots would have been there too. There were a few variables that you either triggered a hint or had in the watches window (vc, Diff, BAmt), they were not found.... ----- In case it happens again: - when you change settings (add/remove debug symbols, change stabs/dwarf or optimization level) and are not getting what you expect => do a "build all" to make sure it was applied to all files. Also make sure there is no old file, like an outdated project.dbg Also what Anti-virus do you use? Some reports say there is trouble with Comodo firewall and Bitdefender (I forgot to mention earlier) log-file: Do you have a desktop shortcut for Lazarus? You can edit it's properties: A field called TArget will point to the lazarus.exe and you can append the --debug-log If it happens again, please get the log and send, and I will look (you can send a pm on the forum) Also if it happens again go to your primary config path (on vista C:\Users\USERNAME\AppData\Local\lazarus // on XP something with "Documents and Settings" ....) - It has several XML files, like environmentoptions.xml => copy and attach - IF (it may not) it has a folder called projectsessions, open it find your projects .lpi file and attach find the *.lpi (and if you have lps) of your project and attach. Instead of attaching you can send in private mail to "lazarus (at symbol) mfriebe de" (no spaces, insert the dot before "de") It's a lot of info, but this should be all the relevant info, so hopefully enough to find what is going on.