Recent

Author Topic: debugger not showing variable values  (Read 1303 times)

rohran

  • New member
  • *
  • Posts: 7
debugger not showing variable values
« on: April 23, 2025, 12:20:12 am »
It was for a  while, but then it stopped.  When I hover the cursor over a variable at a breakpoint, it gives the name and type but it stopped giving the value. Obviously I've set a parameter wrong some where.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11146
  • Debugger - SynEdit - and more
    • wiki
Re: debugger not showing variable values
« Reply #1 on: April 23, 2025, 12:34:52 am »
Please check this page: https://wiki.lazarus.freepascal.org/Debugger_Setup

Please additionally check in the "Project options" in the tree for the "Debugger page" and that the backend there is set to "IDE defaults" (if it is set to project, but says in red that it is using ide default, then that is fine)

Check if you have build modes, and if you use the release build mode?


Are you sure you hover over variables?

Not properties? (properties only work if they do directly access a field / if there is NO getter method).



If that does not help.

Your OS? Your CPU?

When you run the project, are there little blue dots next to the line numbers?

Does it stop on breakpoints (probably, otherwise inspecting variable would not be possible at all).


rohran

  • New member
  • *
  • Posts: 7
Re: debugger not showing variable values
« Reply #2 on: April 23, 2025, 01:39:01 am »
didn't seem to work.  it was working this way (without data) while I was trying to debug a program and something I did caused it to display values for the variables as well as the name and type but then something I did made it stop displaying the variable value

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11146
  • Debugger - SynEdit - and more
    • wiki
Re: debugger not showing variable values
« Reply #3 on: April 23, 2025, 01:44:13 am »
Quote
Your OS? Your CPU?

When you run the project, are there little blue dots next to the line numbers?


What does the locals window show and the stack?

Menu:
View > Debug Windows > Locals
View > Debug Windows > Stack


rohran

  • New member
  • *
  • Posts: 7
Re: debugger not showing variable values
« Reply #4 on: April 23, 2025, 03:46:20 am »
nothing in either the stack or local variables

440bx

  • Hero Member
  • *****
  • Posts: 5276
Re: debugger not showing variable values
« Reply #5 on: April 23, 2025, 04:37:31 am »
Just for good measure, check the setting of "Compiler Options->Debugging->Type of debug info" is set to one of the Dwarf options.    If it is set to Stabs, that's most likely the reason you're not seeing the information you expect.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

rohran

  • New member
  • *
  • Posts: 7
Re: debugger not showing variable values
« Reply #6 on: April 23, 2025, 05:16:57 am »
it is set to a beta copy of dwarf 3

rohran

  • New member
  • *
  • Posts: 7
Re: debugger not showing variable values
« Reply #7 on: April 23, 2025, 05:24:08 am »
I have no idea what I did, except reloading an older version from backdrive and exiting lazarus, but it is working now

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11146
  • Debugger - SynEdit - and more
    • wiki
Re: debugger not showing variable values
« Reply #8 on: April 23, 2025, 09:13:58 am »
Do you use "external debug info" (Project options > Debugger)?
If so, try to disable that.

External debug info create a dbg file. This may get outdated and if it does then it stops working.



Is the problem in all units?

Is the problem with a new project too (if you try and test a new project)?

rohran

  • New member
  • *
  • Posts: 7
Re: debugger not showing variable values
« Reply #9 on: April 23, 2025, 11:05:01 pm »
I didn't have the external debug info box checked.  I haven't tried it with any other units. This is my first attempt at lazarus. It's a video poker game..about 1500 lines of code.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11146
  • Debugger - SynEdit - and more
    • wiki
Re: debugger not showing variable values
« Reply #10 on: April 24, 2025, 12:56:14 am »
I ask again, what is your OS? (and CPU type? x86 / i386 / aarch / M1,M2...)

Also, I don't actually know which version of the IDE you are currently using?



Also please confirm
- your project pauses at breakpoints
  => That is the breakpoint is
  red
  has a green arrow on it
- but there is no data in inspect hints / nothing in the local windows
- nothing if you add a variable to the watches window
?


This also happens if you create a new app (console or gui) and just add a procedure with some local variables? (Make sure to assign something to the variable, or the compiler may leave it away)


You have "Optimization" turned off, or at level 1 ?

You have "Debug info type" set to "Dwarf..." e.g dwarf with sets, or dwarf 3?




If none of that work, then while testing with a new project
- make sure there is no debugger backend selected in the project options (by default there isn't)
- change the backend in the "Tools > Options > Debugger > Backend"

Well if you are on Mac, then there is nothing to change. You must have "LLDB + fpdebug)

If you are on Win or Linux (and x86 or i386) toggle between "FpDebug" and "Gnu debugger GDB" (some name like that). See if either of them works.



If that doesn't work, lets temporary remove config to have the IDE use defaults.

Your setting are in the "primary config path" Menu: VIew > IDE internals > About IDE
Linux ~/.lazarus
Win  C:\Users\USERNAME\AppData\Local\lazarus

Before starting the IDE, backup and remove the file debuggeroptions.xml

If that helps please post the problematic file.

If not, sorry nighttime now / tomorrow.

rohran

  • New member
  • *
  • Posts: 7
Re: debugger not showing variable values
« Reply #11 on: April 24, 2025, 02:44:52 am »
Lazarus IDE version 3.8   on windows 11, dell computer  I7 processor

did you catch that after I pulled on older version of the program off of a usb drive and restarted lazarus, the debuggerr is now working properly... it shows values of variables as well as a link to where they are defined. I don't know what I did to make it stop working. It might have been caused by my cat jumping on my keyboard.

It also shows information in the local variables and the stack windows where before it wasn't.  the watches all show data now whereas before they said <invalid>

I appreciate your help, Martin.  BTW where are you?  does the fr after your name mean france?

regards Richard Ohran, designer of the Lilith

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11146
  • Debugger - SynEdit - and more
    • wiki
Re: debugger not showing variable values
« Reply #12 on: April 24, 2025, 10:56:42 am »
did you catch that after I pulled on older version of the program off of a usb drive and restarted lazarus, the debuggerr is now working properly...

Ok, if the older version works, then it is not an IDE setting.

Yet to know what we are dealing with it would be good to know which "debugger backend" you are using. It should be FpDebug. Please check that, and let me know.

In that case I suggest to compare the 2 lpi files (and maybe the lps files too.


In the project options, you would have by now checked the settings
- Project Options > Debugger (in the upper half of the tree)
- Compiler Options > Debugging (in the lower half)
  Enabled and chosen DWARF
  NO "strip symbols"
  NO "external symbols"
  "Run uses debugger"
- "Compilation and Linking"
  Optimization off or 1


Check the page "Custom options". Report if there are any.

Check the page "Linking"
  NO "smart linking"


Feel free to attach your lpi and lps file, then I can check through the settings for you.


run lazarus with the following command line (create a shortcut, and edit the properties of the short cut)

Change the name of the logfile as you like

Code: Text  [Select][+][-]
  1.  --debug-log=c:\lazarus\logfile.txt   -dDBG_VERBOSE  -dDBG_WARNINGS  -dDBG_ERRORS  -dDBG_VERBOSE_BRKPOINT  -dDBG_STATE  -dDBG_EVENTS  -dDBG_COMMAND_ECHO  -dDBG_DATA_MONITORS  -dDBG_LOCATION_INFO  -dDBG_BREAKPOINTS  -dDBGMI_QUEUE_DEBUG  -dDBGMI_WITH_DISASS_OVERFLOW  -dDBG_WITH_DEBUGGER_DEBUG  -dDBGMI_TYPE_INFO  -dDBG_FPDEBUG_VERBOSE  -dFPDBG_BREAKPOINT_ERRORS  -dFPDBG_BREAKPOINTS  -dFPDBG_COMMANDS  -dFPDBG_THREADS  -dFPDBG_QUEUE  
  2.  

Submit the logfile please.


There is a file
C:\lazarus\fpc\3.2.2\bin\x86_64-win64\objdump.exe

When you compiled your project run
C:\lazarus\fpc\3.2.2\bin\x86_64-win64\objdump.exe -h  yourproject.exe > headers.txt
C:\lazarus\fpc\3.2.2\bin\x86_64-win64\objdump.exe --dwarf=info  yourproject.exe > dwarf.txt

Submit the 2 files

The 2nd file contains names of your procedures and variables. You may want to mail it in private if you do not want this to be public.

lazarus #a#t# mfriebe #.# de



Germany

 

TinyPortal © 2005-2018