Recent

Author Topic: Lazarus 1.6 - 2nd Release Candidate  (Read 86226 times)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus 1.6 - 2nd Release Candidate
« Reply #105 on: February 10, 2016, 06:06:43 pm »
Hi,

It look like there is a severe problem when using local functions in class methods:

Once I create a local function in a class method strange things happen. It seems like the pointer to a methods stack frame is lost/currupted or points to some improper place. Local variables of the method shows nonsense values during debugging, it is not possible to see some properties of the class (No symbol in current context reported) and the code is using clearly not proper values of the properties.

Is the code actually malfunctioning, or is the debugger just showing wrong values?

use debugln(var) to output the variables.
Either build with console -WC
or use --debug-log=file to log to a file.

It may be that fpc 3.0 has changes that the debugger does not understand

------------------- EDIT
just tested.

debug info has indeed changed in fpc 3.0.0

Apparently gdb does not report the correct result. The changes make it impossible to detect this from the IDE, so this can currently not be fixed.

All you can do is change the current stackframe in the stack window, and see what the variable is in the parent frame.

Added to wiki http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Nested_Procedures_.2F_Function

----- EDIT 2
http://lists.freepascal.org/pipermail/fpc-devel/2016-February/036677.html

----- EDIT 4 (bit embarrassed)
I posted to fast. Did further tests.

All works as it should.
In my test, "i" must have been declared a global var in another unit. gdb will find that, even if it is not correct by pascal scope.

But if gdb does find a global var with the same name, then the local var of the outer procedure is not shown (even if it should be by pascal scoping rules)


So if you have problems with what the debugger displays, double check by explicitly selecting the outer stack frame.
« Last Edit: February 10, 2016, 08:31:22 pm by Martin_fr »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4458
  • I like bugs.
Re: Lazarus 1.6 - 2nd Release Candidate
« Reply #106 on: February 10, 2016, 09:52:00 pm »
@dtoman, ok it was a debugger issue. I misinterpreted your message.
The Pascal debugger, fpdebug, becomes more and more urgent and important when FPC evolves.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus 1.6 - 2nd Release Candidate
« Reply #107 on: February 10, 2016, 09:55:41 pm »
Actually a basic example (like in my mail) works in fpdebug.

Except when you are paused on the line with "begin" of the procedure. It seems that this is not declared as part of the procedure. (Or in a way net yet understood)

dtoman

  • Newbie
  • Posts: 3
Re: Lazarus 1.6 - 2nd Release Candidate
« Reply #108 on: February 11, 2016, 11:14:08 am »

I am starting to be a little confused about the problem. It is probably a debugger related one (GDB showing improper values of local variables, class properties/members etc). When I removed nested functions/procedures from class method it seemed all is OK but it isn't. Another strange thing is I am using relatively large array declared as variable in a class. When the array was declared as having 2^24 rows debugger seemed to be confused when the array  was an order smaller the debugger behavior changed.
I checked the assembler code and it seems to be OK but the presentation of variable values is not.

Note the Assembler and Register window really need improvements (working breakpoints in assembler code, showing content of memory addresed by instructions, memory dump, register value in hex by default and when redefined then it should remain redefined, etc).

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus 1.6 - 2nd Release Candidate
« Reply #109 on: February 11, 2016, 12:57:08 pm »
Quote
I am starting to be a little confused about the problem. It is probably a debugger related one (GDB showing improper values of local variables, class
Read my update on the wiki.
If you are not sure if there is an issue with your code or if it is a problem with the debugger, then use debugln.

Quote
When the array was declared as having 2^24 rows debugger
GDB when told to inspect static arrays attempts to allocate the full memory.
So code like
Code: Pascal  [Select][+][-]
  1. type TFoo = array [0..$7FFFFFFF] of int64;
  2. var x: ^Foo;
  3. // x := GetMem(10*sizeof(int64))// alloc 10 entries only
will run the debugger out of memory.  (tested with gdb 7.2 / maybe newer gdb do better)

M+AUDIO

  • New Member
  • *
  • Posts: 48
Re: Lazarus 1.6 - 2nd Release Candidate
« Reply #110 on: February 15, 2016, 09:57:31 am »
Hello,
Please excuse me if it is mentioned before. didn't find any result after (little) searching.

Steps to reproduce:
Open Lazarus
Create a new GUI application
In object inspector change (check) a Boolean property (for example set AutoSize to true)
*Now in designer select the form
And hit Ctrl+Z or select Undo from Edit in main menu.

An (Unhandled?) exception occurs with message: "(false)" is not a valid boolean
I can re-test with latest trunk if needed.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4458
  • I like bugs.
Re: Lazarus 1.6 - 2nd Release Candidate
« Reply #111 on: February 15, 2016, 12:23:31 pm »
*Now in designer select the form
And hit Ctrl+Z or select Undo from Edit in main menu.

An (Unhandled?) exception occurs with message: "(false)" is not a valid boolean

Wow, I can reproduce that. Haven't noticed earlier. I will look at it ...

[Edit] Please try with r51634 (trunk).
« Last Edit: February 15, 2016, 01:47:06 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

M+AUDIO

  • New Member
  • *
  • Posts: 48
Re: Lazarus 1.6 - 2nd Release Candidate
« Reply #112 on: February 15, 2016, 06:09:05 pm »
[Edit] Please try with r51634 (trunk).
Tried and it works, thank you!
However, I think it still needs some cleanup:
After we undo the action, we can redo using shortcut keys (Shift+Ctrl+Z), but the corresponding submenu item in Edit menu remains disabled (and undo remains enabled forever).

 

TinyPortal © 2005-2018