Re: [Lazarus] Debugging libraries which define generics.

2017-12-15 Thread Donald Ziesig via Lazarus

On 12/15/2017 01:33 PM, Martin Frb via Lazarus wrote:

On 15/12/2017 18:29, Martin Frb via Lazarus wrote:

On 15/12/2017 15:46, Donald Ziesig via Lazarus wrote:


 1. When the mouse hovers over a variable, the debugger (and program
being debugged) frequently crashes with the error:
"-data-evaluate-expression TCQPiece(ITEM)^" did not return any
result.
This is particularly annoying because it inevitably happens just
as I am getting close to finding a problem and I move the mouse
across the editor window :'(.

These problems do not occur when debugging non-generic code.


This is an issue in gdb.

First make sure to use dward (debug info).

^^^ "dwarf"


You can try (if it currently compiles / its a package, install it)  
lazdebuggerfpgdbmi.lpk  (must be the one with gdbmi *and* fp)
just remembered, not sure if this works for libraries (.so). You may 
have to compile an app that includes the code directly.




Thanks Martin.  I changed all of the packages and the main project to 
use Dwarf3 and it looks as if it has solved the problem. 8-) I'll keep 
debugging and let you know if it reappears.


Don


-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Debugging libraries which define generics.

2017-12-15 Thread Martin Frb via Lazarus

On 15/12/2017 18:29, Martin Frb via Lazarus wrote:

On 15/12/2017 15:46, Donald Ziesig via Lazarus wrote:


 1. When the mouse hovers over a variable, the debugger (and program
being debugged) frequently crashes with the error:
"-data-evaluate-expression TCQPiece(ITEM)^" did not return any
result.
This is particularly annoying because it inevitably happens just
as I am getting close to finding a problem and I move the mouse
across the editor window :'(.

These problems do not occur when debugging non-generic code.


This is an issue in gdb.

First make sure to use dward (debug info).

^^^ "dwarf"


You can try (if it currently compiles / its a package, install it)  
lazdebuggerfpgdbmi.lpk  (must be the one with gdbmi *and* fp)
just remembered, not sure if this works for libraries (.so). You may 
have to compile an app that includes the code directly.


-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Debugging libraries which define generics.

2017-12-15 Thread Martin Frb via Lazarus

On 15/12/2017 15:46, Donald Ziesig via Lazarus wrote:


Hi All,

I have been working on some *serious* :-$ software libraries that 
declare generic subprograms and classes.


While debugging these I noticed:

 1. When single-stepping, the line being highlighted in the editor
window is almost always (but not exclusively) one line *after* the
line which is about to be executed.


This may be an issue in fpc.

IIRC
{$IFDEF unknownfoo}
 'unclosed string
{$ENDIF}
may also lead to wrong line info


 1. When the mouse hovers over a variable, the debugger (and program
being debugged) frequently crashes with the error:
"-data-evaluate-expression TCQPiece(ITEM)^" did not return any result.
This is particularly annoying because it inevitably happens just
as I am getting close to finding a problem and I move the mouse
across the editor window :'(.

These problems do not occur when debugging non-generic code.


This is an issue in gdb.

First make sure to use dward (debug info).
This must be done for ALL packages too (well all packages that have 
debug info).


But even then you will probably get this error.

You can try (if it currently compiles / its a package, install it) 
lazdebuggerfpgdbmi.lpk  (must be the one with gdbmi *and* fp)

And then change the debugger in Tools > Options

I dont know how good it will be

--
Also switch of the hint in the options, and use the watch window only. 
that way you can control which values you look at.



you may also try an older gdb (pre 7.6). But again not likely to help 
too much.


-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Qt Ws doesn't support properly GetWindowSize() and GetWindowRect()

2017-12-15 Thread Giuliano Colla via Lazarus

Il 15/12/2017 18:30, zeljko ha scritto:
It's bug in your code (range error). You're using aHandle: 
System.THandle (longint) instead of LCLIntf.THandle which is of 
ptruint type.
Best and correct usage would be to use HWND type which is what it 
needs to be on all platforms and widgetsets.
When aHandle type is corrected, or LCLType is included with it's 
THandle then everything works as expected.
Don't ask me my gtk2 works, in any case it's wrong on 64bit platform. 



Thanks a lot. With the proper type of aHandle it works fine both with Qt 
and GTk2.


Maybe it was working with gtk2 because there's an additional check on 
handle validity but I didn't investigate further. A bug of mine is a bug 
of mine.


Giuliano


--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Qt Ws doesn't support properly GetWindowSize() and GetWindowRect()

2017-12-15 Thread zeljko via Lazarus

On 15.12.2017 17:08, Giuliano Colla via Lazarus wrote:
This snippet of code, which executes as expected with GTK2 WS, fails 
with QT WS:



procedure TForm1.btnWsizeClick(Sender: TObject);
var  aHandle: THandle;
   aWidth,aHeight: Integer;
   aRect: TRect;
begin
   aHandle:= Form1.Handle;
   if GetWindowSize(aHandle,aWidth,aHeight) then begin
 Label3.Caption:= Format('Width: %d Height: %d',[aWidth,aHeight]);
   end
   else Label3.Caption:= 'Failed to get Window Size';
   GetWindowRect(aHandle,aRect);
   Label3.Caption:= Label3.Caption + Format(' Rect: %d,%d',[
   aRect.Right-aRect.Left,
   aRect.Bottom-aRect.Top]);
   Label3.Visible:= True;
end;


As it is, it crashes with an AV in the GetWindowSize call. The failing 
call is in TQtWidget.GetWidget: it executes Result := 
QWidgetH(TheObject) where TheObject appears to have taken a bogus value.


If I remove the offending call, then the subsequent GetWindowRect() 
returns bogus values, sort of -32704 and -85984614 instead of 689 and 522.


Under GTK2 both calls work as expected.

Tested under Linux x86_64 (CentOs 6) with Lazarus 1.8 - QT45 - fpc 3.0.4

It doesn't appear to be a regression, because it does the same even with 
a very old Lazarus 1.2.6 , qt45 and fpc 2.6.4


Should I report a bug or is it a known issue?


It's bug in your code (range error). You're using aHandle: 
System.THandle (longint) instead of LCLIntf.THandle which is of ptruint 
type.
Best and correct usage would be to use HWND type which is what it needs 
to be on all platforms and widgetsets.
When aHandle type is corrected, or LCLType is included with it's THandle 
then everything works as expected.

Don't ask me my gtk2 works, in any case it's wrong on 64bit platform.

zeljko
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Qt Ws doesn't support properly GetWindowSize() and GetWindowRect()

2017-12-15 Thread zeljko via Lazarus

On 15.12.2017 17:08, Giuliano Colla via Lazarus wrote:
This snippet of code, which executes as expected with GTK2 WS, fails 
with QT WS:



procedure TForm1.btnWsizeClick(Sender: TObject);
var  aHandle: THandle;
   aWidth,aHeight: Integer;
   aRect: TRect;
begin
   aHandle:= Form1.Handle;
   if GetWindowSize(aHandle,aWidth,aHeight) then begin
 Label3.Caption:= Format('Width: %d Height: %d',[aWidth,aHeight]);
   end
   else Label3.Caption:= 'Failed to get Window Size';
   GetWindowRect(aHandle,aRect);
   Label3.Caption:= Label3.Caption + Format(' Rect: %d,%d',[
   aRect.Right-aRect.Left,
   aRect.Bottom-aRect.Top]);
   Label3.Visible:= True;
end;


As it is, it crashes with an AV in the GetWindowSize call. The failing 
call is in TQtWidget.GetWidget: it executes Result := 
QWidgetH(TheObject) where TheObject appears to have taken a bogus value.


If I remove the offending call, then the subsequent GetWindowRect() 
returns bogus values, sort of -32704 and -85984614 instead of 689 and 522.


Under GTK2 both calls work as expected.

Tested under Linux x86_64 (CentOs 6) with Lazarus 1.8 - QT45 - fpc 3.0.4

It doesn't appear to be a regression, because it does the same even with 
a very old Lazarus 1.2.6 , qt45 and fpc 2.6.4


Should I report a bug or is it a known issue?


Of course, please do so, also attach example.

zeljko
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Qt Ws doesn't support properly GetWindowSize() and GetWindowRect()

2017-12-15 Thread Giuliano Colla via Lazarus
This snippet of code, which executes as expected with GTK2 WS, fails 
with QT WS:



procedure TForm1.btnWsizeClick(Sender: TObject);
var  aHandle: THandle;
   aWidth,aHeight: Integer;
   aRect: TRect;
begin
   aHandle:= Form1.Handle;
   if GetWindowSize(aHandle,aWidth,aHeight) then begin
     Label3.Caption:= Format('Width: %d Height: %d',[aWidth,aHeight]);
   end
   else Label3.Caption:= 'Failed to get Window Size';
   GetWindowRect(aHandle,aRect);
   Label3.Caption:= Label3.Caption + Format(' Rect: %d,%d',[
   aRect.Right-aRect.Left,
   aRect.Bottom-aRect.Top]);
   Label3.Visible:= True;
end;


As it is, it crashes with an AV in the GetWindowSize call. The failing 
call is in TQtWidget.GetWidget: it executes Result := 
QWidgetH(TheObject) where TheObject appears to have taken a bogus value.


If I remove the offending call, then the subsequent GetWindowRect() 
returns bogus values, sort of -32704 and -85984614 instead of 689 and 522.


Under GTK2 both calls work as expected.

Tested under Linux x86_64 (CentOs 6) with Lazarus 1.8 - QT45 - fpc 3.0.4

It doesn't appear to be a regression, because it does the same even with 
a very old Lazarus 1.2.6 , qt45 and fpc 2.6.4


Should I report a bug or is it a known issue?

Giuliano


--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Debugging libraries which define generics.

2017-12-15 Thread Donald Ziesig via Lazarus

Hi All,

I have been working on some *serious* :-$ software libraries that 
declare generic subprograms and classes.


While debugging these I noticed:

1. When single-stepping, the line being highlighted in the editor
   window is almost always (but not exclusively) one line *after* the
   line which is about to be executed.
2. When the mouse hovers over a variable, the debugger (and program
   being debugged) frequently crashes with the error:
   "-data-evaluate-expression TCQPiece(ITEM)^" did not return any result.
   This is particularly annoying because it inevitably happens just as
   I am getting close to finding a problem and I move the mouse across
   the editor window :'(.

These problems do not occur when debugging non-generic code.

I am currently using Linux Mint 18 on an Intel core-i5 processor with 
gdb 7.11.1 (the Ubuntu version).  IIRC, I have had similar problems with 
Lazarus versions back as far as 1.2 and earlier versions of Debian, but 
I never had major generic software to debug until now.


I found reports of similar problems caused by line endings (Windows vs. 
Unix).  Is it possible that the code generated by generic specialization 
does not observe the OS-specific line endings and confuses gdb?  This is 
beyond my abilities to fix.


Any suggestions and/or further speculations will be welcome :-).

Don Ziesig


-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Lazarus 1.8

2017-12-15 Thread R0b0t1 via Lazarus
These are true things.

On Thu, Dec 14, 2017 at 7:23 PM, Donald Ziesig via Lazarus
 wrote:
> Many thanks to all who worked on 1.8.0.  It looks great and works better.
>
> Don Ziesig
>
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus-ide.org
> https://lists.lazarus-ide.org/listinfo/lazarus
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Lazarus Release 1.8

2017-12-15 Thread Kostas Michalopoulos via Lazarus
On Fri, Dec 15, 2017 at 1:41 PM, Mattias Gaertner via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:
>
> At compile time it is CP_NONE, at runtime it can be any codepage.
>

My understanding (which, if it is wrong, sorry but not my fault since the
docs are a bit vague and all the names involved are totally unintuitive
:-P) is that RawByteString has basically no codebase so it is treated as a
byte string pretty much the same way AnsiString was treated pre-FPC3. So
i'd expect the codebase to always be CP_NONE and to change it, i'd have to
assign the RawByteString to some string type with an associated codepage
(basically, making the RBS an "escape hatch" to the whole conversion
machinery).
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Lazarus Release 1.8

2017-12-15 Thread Mattias Gaertner via Lazarus
On Fri, 15 Dec 2017 13:32:24 +0200
Kostas Michalopoulos via Lazarus  wrote:

> On Sun, Dec 10, 2017 at 4:17 PM, Luca Olivetti via Lazarus <
> lazarus@lists.lazarus-ide.org> wrote:
> > https://www.freepascal.org/docs-html/rtl/system/rawbytestring.html
> >
> > it's an ansistring.  
> 
> This is IMO misleading since nowadays AnsiString has codepage information
> and a plain AnsiString as shown in the page you linked can be any codepage
> whereas RawByteString is always CP_NONE.

At compile time it is CP_NONE, at runtime it can be any codepage.

> RawByteString and AnsiString are not equivalent.

True.

Mattias

-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Lazarus Release 1.8

2017-12-15 Thread Kostas Michalopoulos via Lazarus
On Sun, Dec 10, 2017 at 4:17 PM, Luca Olivetti via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:
> https://www.freepascal.org/docs-html/rtl/system/rawbytestring.html
>
> it's an ansistring.

This is IMO misleading since nowadays AnsiString has codepage information
and a plain AnsiString as shown in the page you linked can be any codepage
whereas RawByteString is always CP_NONE. RawByteString and AnsiString are
not equivalent.
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Lazarus Release 1.8

2017-12-15 Thread Mattias Gaertner via Lazarus
On Wed, 13 Dec 2017 12:44:19 +0100
Andrea Mauri via Lazarus  wrote:

> I am trying to update to lazarus 1.8 on my OSX (I was using 1.6.4).
> I downloaded and installed, fpc, fpc src and lazarus.
> First run is ok.
> Then if I recompile lazarus (clean build all) everything seems to be ok 
> but if I try to start lazarus I got an error message. See message1. I 
> close the message try to restart again lazarus and I got the message2.
> 
> What is going wrong?

Did you run Lazarus as the same user as it was installed?
Is the user an admin user?
How did you open the IDE?

Can you send me the text of IDE menu
View / IDE Internals / About IDE / General?

Mattias

-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Lazarus Release 1.8

2017-12-15 Thread coppolastudio via Lazarus
try to check the case of your .res files

Inviato tramite il client di Posta WPSIl Andrea Mauri via Lazarus , 15/dic/2017 08:33 AM ha scritto:Anyone has suggestions?
Il 13/12/2017 12:44, Andrea Mauri ha scritto:
> I am trying to update to lazarus 1.8 on my OSX (I was using 1.6.4).
> I downloaded and installed, fpc, fpc src and lazarus.
> First run is ok.
> Then if I recompile lazarus (clean build all) everything seems to be ok 
> but if I try to start lazarus I got an error message. See message1. I 
> close the message try to restart again lazarus and I got the message2.
> 
> What is going wrong?
> 
> Il 06/12/2017 20:15, Mattias Gaertner via Lazarus ha scritto:
>> The Lazarus team is glad to announce the release of Lazarus 1.8.
>>
>> The release was built with FPC 3.0.4.
>> The previous release Lazarus 1.6.4 was built with FPC 3.0.2.
>>
>> Here is the list of changes for Lazarus and Free Pascal:
>> http://wiki.lazarus.freepascal.org/Lazarus_1.8.0_release_notes
>> http://wiki.lazarus.freepascal.org/User_Changes_3.0.4
>>
>> Here is the list of fixes for Lazarus 1.8.x:
>> http://wiki.freepascal.org/Lazarus_1.8_fixes_branch
>>
>> The release is available for download on SourceForge:
>> http://sourceforge.net/projects/lazarus/files/
>>
>> Choose your CPU, OS, distro and then the "Lazarus 1.8.0" directory.
>>
>> Checksums for the SourceForge files:
>> http://www.lazarus-ide.org/index.php?page=checksums#1_8_0
>>
>> Minimum requirements:
>>
>> Windows:
>> 2k, XP, Vista, 7, 8, 8.1 and 10, 32 or 64bit.
>> optional qt 4.5 or 5.6 for qt apps
>>
>> FreeBSD/Linux:
>> gtk 2.8 for gtk2, qt4.5 for qt, qt5.6 for qt5, 32 or 64bit.
>>
>> Mac OS X:
>> 10.5 to 10.12; Carbon (32bit), Cocoa (64bit, not stable), qt and qt5 
>> (32 or 64bit).
>>
>> The svn tag is
>> http://svn.freepascal.org/svn/lazarus/tags/lazarus_1_8_0
>>
>> For people who are blocked by SF, the Lazarus releases from 
>> SourceForge are mirrored at:
>> ftp://ftp.freepascal.org/pub/lazarus/releases/
>> and later at (after some time for synchronization)
>> http://mirrors.iwi.me/lazarus/
>>
>>
>> Mattias
>>
>>
>>
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus