This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug pascal/11349] New: ansistring does not print correctly


Given this example program:

--------------------------------------
program project1;

{$mode objfpc}{$H+}

 procedure doit (var s : ansistring);
 begin
   s := s + ' ' + s;
 end;

var
 s : ansistring;
begin
 s := 'test';
 doit(s);
end.
--------------------------------------

Compiled with Free Pascal 2.4.0 with the command line "fpc -Px86_64 -g -gl -gw
project1.lpr", when I set a breakpoint in "doit" and try to view the var
ansistring variable "s":

and set a breakpoint in "doit" in GDB, I see the following:

(gdb) whatis S
type = &ANSISTRING
(gdb) print S
$12 = (&ANSISTRING) @0x627130
(gdb) whatis S^
type = ANSISTRING
(gdb) print S^
$13 = 116 't'
(gdb) x/s S
0x74:    <Address 0x74 out of bounds>
(gdb) x/s S^
0x74:    <Address 0x74 out of bounds>

Debugging with GDB 6.8 with the exact same program and compiler options, I get
this instead:

(gdb) print S
$1 = (&ANSISTRING) @0x8069410: 0x8065074 'test'

It appears ansistring variables passed by reference are no longer working
correctly with "print" in GDB, and that this bug was introduced in GDB 7.0.

My system is Ubuntu 9.10 64-bit:

$ gdb --version
GNU gdb (GDB) 7.0-ubuntu

$ uname -a
Linux user-desktop 2.6.31-19-generic #56-Ubuntu SMP Thu Jan 28 02:39:34 UTC 2010
x86_64 GNU/Linux

$ fpc
Free Pascal Compiler version 2.4.0 [2010/02/09] for x86_64

-- 
           Summary: ansistring does not print correctly
           Product: gdb
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: pascal
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: sethdgrover at gmail dot com
                CC: gdb-prs at sourceware dot org
 GCC build triplet: x86_64-ubuntu-linux
  GCC host triplet: x86_64-ubuntu-linux
GCC target triplet: x86_64-ubuntu-linux


http://sourceware.org/bugzilla/show_bug.cgi?id=11349

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]