public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug pascal/11349] New: ansistring does not print correctly
@ 2010-03-04 14:43 sethdgrover at gmail dot com
  2010-03-04 15:03 ` [Bug pascal/11349] " vsnijders at vodafonevast dot nl
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: sethdgrover at gmail dot com @ 2010-03-04 14:43 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug pascal/11349] ansistring does not print correctly
  2010-03-04 14:43 [Bug pascal/11349] New: ansistring does not print correctly sethdgrover at gmail dot com
@ 2010-03-04 15:03 ` vsnijders at vodafonevast dot nl
  2010-03-04 23:29 ` sethdgrover at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vsnijders at vodafonevast dot nl @ 2010-03-04 15:03 UTC (permalink / raw)
  To: gdb-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vsnijders at vodafonevast
                   |                            |dot nl


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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug pascal/11349] ansistring does not print correctly
  2010-03-04 14:43 [Bug pascal/11349] New: ansistring does not print correctly sethdgrover at gmail dot com
  2010-03-04 15:03 ` [Bug pascal/11349] " vsnijders at vodafonevast dot nl
  2010-03-04 23:29 ` sethdgrover at gmail dot com
@ 2010-03-04 23:29 ` sethdgrover at gmail dot com
  2010-03-04 23:32 ` sethdgrover at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: sethdgrover at gmail dot com @ 2010-03-04 23:29 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From sethdgrover at gmail dot com  2010-03-04 23:29 -------
Created an attachment (id=4644)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=4644&action=view)
readelf -gw from compiled program

readelf -gw of binary in attachment 4643

-- 


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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug pascal/11349] ansistring does not print correctly
  2010-03-04 14:43 [Bug pascal/11349] New: ansistring does not print correctly sethdgrover at gmail dot com
  2010-03-04 15:03 ` [Bug pascal/11349] " vsnijders at vodafonevast dot nl
@ 2010-03-04 23:29 ` sethdgrover at gmail dot com
  2010-03-04 23:29 ` sethdgrover at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: sethdgrover at gmail dot com @ 2010-03-04 23:29 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From sethdgrover at gmail dot com  2010-03-04 23:29 -------
Created an attachment (id=4643)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=4643&action=view)
compiled program

Here's the same program using pchar instead of ansistring, along with the
compiled version of the program:

program project1;

procedure doit (var s : pchar);
begin
end;

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

-- 


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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug pascal/11349] ansistring does not print correctly
  2010-03-04 14:43 [Bug pascal/11349] New: ansistring does not print correctly sethdgrover at gmail dot com
                   ` (2 preceding siblings ...)
  2010-03-04 23:29 ` sethdgrover at gmail dot com
@ 2010-03-04 23:32 ` sethdgrover at gmail dot com
  2010-03-04 23:36 ` [Bug pascal/11349] pchar/ansistring " sethdgrover at gmail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: sethdgrover at gmail dot com @ 2010-03-04 23:32 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From sethdgrover at gmail dot com  2010-03-04 23:32 -------
Created an attachment (id=4645)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=4645&action=view)
program compiled to assembly

Assembly file generated by FPC from program in attachment 4643 (compiled with
"fpc -a -al -an -Px86_64 -g -gl -gw project1.lpr").

-- 


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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug pascal/11349] pchar/ansistring does not print correctly
  2010-03-04 14:43 [Bug pascal/11349] New: ansistring does not print correctly sethdgrover at gmail dot com
                   ` (3 preceding siblings ...)
  2010-03-04 23:32 ` sethdgrover at gmail dot com
@ 2010-03-04 23:36 ` sethdgrover at gmail dot com
  2010-04-01 20:03 ` sethdgrover at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: sethdgrover at gmail dot com @ 2010-03-04 23:36 UTC (permalink / raw)
  To: gdb-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ansistring does not print   |pchar/ansistring does not
                   |correctly                   |print correctly


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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug pascal/11349] pchar/ansistring does not print correctly
  2010-03-04 14:43 [Bug pascal/11349] New: ansistring does not print correctly sethdgrover at gmail dot com
                   ` (4 preceding siblings ...)
  2010-03-04 23:36 ` [Bug pascal/11349] pchar/ansistring " sethdgrover at gmail dot com
@ 2010-04-01 20:03 ` sethdgrover at gmail dot com
  2010-05-08 15:19 ` muller at ics dot u-strasbg dot fr
  2010-05-10  2:32 ` sethdgrover at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: sethdgrover at gmail dot com @ 2010-04-01 20:03 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From sethdgrover at gmail dot com  2010-04-01 20:03 -------
gdb bugs sit for a month before anyone even looks at them?

-- 


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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug pascal/11349] pchar/ansistring does not print correctly
  2010-03-04 14:43 [Bug pascal/11349] New: ansistring does not print correctly sethdgrover at gmail dot com
                   ` (5 preceding siblings ...)
  2010-04-01 20:03 ` sethdgrover at gmail dot com
@ 2010-05-08 15:19 ` muller at ics dot u-strasbg dot fr
  2010-05-10  2:32 ` sethdgrover at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: muller at ics dot u-strasbg dot fr @ 2010-05-08 15:19 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2010-05-03 13:38 -------
Subject: Bug 11349

CVSROOT:	/cvs/src
Module name:	src
Changes by:	muller@sourceware.org	2010-05-03 13:38:27

Modified files:
	gdb            : ChangeLog p-valprint.c 

Log message:
	PR pascal/11349.
	* p-valprint.c (pascal_value_print): Always dereference a value with
	type code TYPE_CODE_REF.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.11713&r2=1.11714
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/p-valprint.c.diff?cvsroot=src&r1=1.69&r2=1.70


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2010-05-04 06:48 -------
Subject: Bug 11349

CVSROOT:	/cvs/src
Module name:	src
Changes by:	muller@sourceware.org	2010-05-04 06:48:27

Modified files:
	gdb            : ChangeLog printcmd.c 
	gdb/testsuite  : ChangeLog 
	gdb/testsuite/gdb.cp: ref-types.exp 

Log message:
	PR exp/11349.
	* printcmd.c (x_command): Only dereference once implicitly for
	TYPE_CODE_REF.
	
	testsuite dir:
	PR exp/11349.
	* testsuite/gdb.cp/ref-types.exp: Add test to examine
	use a reference local variable.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.11717&r2=1.11718
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/printcmd.c.diff?cvsroot=src&r1=1.176&r2=1.177
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2260&r2=1.2261
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/ref-types.exp.diff?cvsroot=src&r1=1.12&r2=1.13


------- Additional Comments From muller at ics dot u-strasbg dot fr  2010-05-08 15:19 -------
  The patches committed to trunk should solve the issue.
  Could you try it out and mark the issue as FIXED 
if all works correctly or report if you still get problems.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug pascal/11349] pchar/ansistring does not print correctly
  2010-03-04 14:43 [Bug pascal/11349] New: ansistring does not print correctly sethdgrover at gmail dot com
                   ` (6 preceding siblings ...)
  2010-05-08 15:19 ` muller at ics dot u-strasbg dot fr
@ 2010-05-10  2:32 ` sethdgrover at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: sethdgrover at gmail dot com @ 2010-05-10  2:32 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From sethdgrover at gmail dot com  2010-05-10 02:32 -------
Thanks, that seems to have done the trick. With the test program from comment 1,
here's what I get with the patched version:

============================
(gdb) break DOIT
Breakpoint 1 at 0x80480a9: file project1.pas, line 5.
(gdb) r
Starting program: /home/tlacuache/tmp/project1 

Breakpoint 1, DOIT (S=@0x8068240) at project1.pas:5
5	end;
(gdb) print S
$1 = (&PCHAR) @0x8068240: 0x806404c 'test'
============================

compared to what I used to get (with gdb 7.1 in the Ubuntu repositories):
============================
(gdb) break DOIT
Breakpoint 1 at 0x80480a9: file project1.pas, line 5.
(gdb) r
Starting program: /home/tlacuache/tmp/project1 

Breakpoint 1, DOIT (S=@0x8068240) at project1.pas:5
5	end;
(gdb) print S
$1 = (&PCHAR) @0x8068240
============================

So the new behavior is correct.

Thanks again.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |FIXED


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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-05-10  2:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-04 14:43 [Bug pascal/11349] New: ansistring does not print correctly sethdgrover at gmail dot com
2010-03-04 15:03 ` [Bug pascal/11349] " vsnijders at vodafonevast dot nl
2010-03-04 23:29 ` sethdgrover at gmail dot com
2010-03-04 23:29 ` sethdgrover at gmail dot com
2010-03-04 23:32 ` sethdgrover at gmail dot com
2010-03-04 23:36 ` [Bug pascal/11349] pchar/ansistring " sethdgrover at gmail dot com
2010-04-01 20:03 ` sethdgrover at gmail dot com
2010-05-08 15:19 ` muller at ics dot u-strasbg dot fr
2010-05-10  2:32 ` sethdgrover at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).