View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0023932 | Lazarus | Debugger | public | 2013-02-21 22:08 | 2013-02-23 05:17 |
Reporter | wayne | Assigned To | Martin Friebe | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | Win32 | OS | Windows | OS Version | XP |
Product Version | 1.0.6 | Product Build | SVN 40119 | ||
Target Version | 1.2.0 | Fixed in Version | 1.1 (SVN) | ||
Summary | 0023932: On fresh install of Lazarus 1.0.6, cannot make strings > 200 chars | ||||
Description | On a fresh install of Lazarus 1.0.6, trying to make strings longer than 200 characters is not possible. At the 201st character, the string is ended with '###(gdb unparsed remainder:...)###' If the debugging option is turned off, the string length can exceed 200 chars as expected. (CTRL+SHFT+F11 -> Project options -> Linking: disable "Generate debugging info for GDB..." | ||||
Steps To Reproduce | See attached sample program. | ||||
Additional Information | Problem is evident: if string is assigned from a const if string is global | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 40386 | ||||
LazTarget | 1.2 | ||||
Widgetset | Win32/Win64 | ||||
Attached Files |
|
|
main.pas (662 bytes)
unit Main; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls; type { TForm1 } TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { private declarations } public { public declarations } end; var Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject); var qs: string; i: Integer; begin qs := ''; for i:=0 to 30000 do qs := qs + 'a'; // at this point, string is corrupt beyond 200th character. ; ; ; end; end. |
|
Please confirm, if the problem is: - data incorrectly displayed in debugger, debugger cuts display. - application can not access string past 200. From your description it seems the first. -------------------- The debugger unfortunately is limited in how much data it can display. Lazarus is currently forced to relay on gdb as debugger. And gdb imposes certain limits, that we can not change. So this should not affect the actual data in your application. Your string may be longer than 200, "uncut remainder" means the debugger stopped displaying it. Someday this will be fixed, but unfortunately not soon. You can open the watch window and try something like @s[200] This will display from char 199 onwards. (another gdb issue, that strings sometimes are counted from zero). Actually it will display the data once from 199 (prefix PCHAR), and once from 200 (prefix STRING) |
|
GDB have parameter for this limit and can be set to unlimited, see here http://stackoverflow.com/questions/233328/how-do-i-print-the-full-value-of-a-long-string-in-gdb . Is it possible to set this parameter of GDB in Lazarus? |
|
It is! Set Debugger_Startup_Options in menu Tools -> Options -> Debugger to --eval-command="set print elements 0" |
|
I've checked and yes: it is only a GDB display issue. And blabulabul is right, that limit can be defeated using the --eval-command... option. I also needed to check "Reset Debugger after each run" for that option to take effect. |
|
I added an option "MaxDisplayLengthForString". It defaults to 2500. I believe this is high enough for most people. I did not set it to unlimited by default, as I can not predict all possible side effects: not terminated strings (million of chars); slower environments; remote debugging and/or platforms with limited resources. This is currently trunk (Laz 1.1) only. It may be merged to fixes later. --- Note: contrary to the linked page, this does not affect arrays(according to my tests). Pascal arrays do differ from c arrays. For static array, gdb always returns the full array (the length is part of the debug info) For dynamic arrays, gdb currently never returns content. (The IDE works around that, the default is just a few entries, as the workaround is extremely slow. The amount can be set for each watch (in the watch properties)) Open arrays are currently not supported. |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-02-21 22:08 | wayne | New Issue | |
2013-02-21 22:08 | wayne | File Added: main.pas | |
2013-02-22 01:52 | Maxim Ganetsky | LazTarget | => - |
2013-02-22 01:52 | Maxim Ganetsky | Category | Compiler => Debugger |
2013-02-22 03:39 | Martin Friebe | LazTarget | - => post 1.2 |
2013-02-22 03:39 | Martin Friebe | Note Added: 0065809 | |
2013-02-22 03:39 | Martin Friebe | Assigned To | => Martin Friebe |
2013-02-22 03:39 | Martin Friebe | Status | new => feedback |
2013-02-22 09:56 | blabulabul | Note Added: 0065811 | |
2013-02-22 10:05 | blabulabul | Note Edited: 0065811 | View Revisions |
2013-02-22 10:24 | blabulabul | Note Added: 0065812 | |
2013-02-22 15:09 | wayne | Note Added: 0065818 | |
2013-02-22 15:09 | wayne | Status | feedback => assigned |
2013-02-22 15:09 | wayne | Note Edited: 0065818 | View Revisions |
2013-02-22 15:10 | wayne | Note Edited: 0065818 | View Revisions |
2013-02-23 05:16 | Martin Friebe | Fixed in Revision | => 40386 |
2013-02-23 05:16 | Martin Friebe | LazTarget | post 1.2 => 1.2 |
2013-02-23 05:16 | Martin Friebe | Note Added: 0065826 | |
2013-02-23 05:16 | Martin Friebe | Status | assigned => resolved |
2013-02-23 05:16 | Martin Friebe | Fixed in Version | => 1.1 (SVN) |
2013-02-23 05:16 | Martin Friebe | Resolution | open => fixed |
2013-02-23 05:16 | Martin Friebe | Target Version | => 1.2.0 |
2013-02-23 05:17 | Martin Friebe | Note Edited: 0065826 | View Revisions |