public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Jonas Maebe <jonas.maebe@elis.ugent.be>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Joost van der Sluis <joost@cnoc.nl>,
	Project Archer <archer@sourceware.org>
Subject: Re: Patch for pascal-dynamic arrays
Date: Sun, 16 May 2010 21:49:00 -0000	[thread overview]
Message-ID: <9D126914-010D-4AE0-BFBA-DE55D17C9E61@elis.ugent.be> (raw)
In-Reply-To: <20100516172301.GA4685@host0.dyn.jankratochvil.net>


On 16 May 2010, at 19:23, Jan Kratochvil wrote:

> That's correct.  Both DW_AT_lower_bound and DW_AT_upper_bound express the
> boundaries inclusively.  Array of length 0 must have DW_AT_upper_bound equal
> to DW_AT_lower_bound minus one.

I've fixed this, thanks. I've also committed the patch to FPC svn.

> I am not sure where is a problem there but GDB handles non-pascal arrays of
> length zero right AFAIK.

Thanks to your patch, I can now successfully build the new gdb on SL54. In Pascal language mode, both empty arrays and strings are printed as '0x0'. That's probably an issue in the Pascal value printer. In C language mode (with the same binary), an empty string is (correctly) printed as '0x625418 ""', while an empty array is printed as just the address of the variable containing the pointer to the array (which looks a bit strange, but I guess it's consistent with how in C arrays and pointers are pretty much the same).

Array:

19	  setlength(a,8);
(gdb) set lang pascal
(gdb) ptype a
type = array [0..-1] of LongInt
(gdb) p a
$12 = 0x0
(gdb) set lang c
(gdb) ptype a
type = LongInt [0]
(gdb) p a
$13 = 0x625418
(gdb) n
20	  a[0]:=5;
(gdb) set lang pascal
(gdb) ptype a
type = array [0..7] of LongInt
(gdb) p a
$14 = {0, 0, 0, 0, 0, 0, 0, 0}
(gdb) set lang c
(gdb) ptype a
type = LongInt [8]
(gdb) p a
$15 = {0, 0, 0, 0, 0, 0, 0, 0}


String:

45	  setlength(s,8);
(gdb) set lang pascal
(gdb) ptype s
type = array [1..0] of Char
(gdb) p s
$16 = 0x0
(gdb) set lang c
(gdb) ptype s
type = Char [0]
(gdb) p s
$17 = 0x625428 ""
(gdb) n
46	  s[1]:=chr(5);
(gdb) set lang pascal
(gdb) ptype s
type = array [1..8] of Char
(gdb) p s
$18 = #0#0#0#0#0#0#0
(gdb) set lang c
(gdb) ptype s
type = Char [8]
(gdb) p s
$19 = "\000\000\000\000\000\000\000"


Jonas

  reply	other threads:[~2010-05-16 21:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-14 14:45 Joost van der Sluis
2009-09-16 15:45 ` Jan Kratochvil
2009-09-16 18:18   ` Joost van der Sluis
2009-09-16 18:41     ` Jan Kratochvil
2009-09-16 19:09       ` Joost van der Sluis
2009-09-30 16:00   ` Joost van der Sluis
2009-10-04 14:17     ` Jan Kratochvil
2009-10-05 10:08       ` Joost van der Sluis
     [not found]       ` <1254737231.3257.20.camel@wsjoost.cnoc.lan>
2009-10-05 14:43         ` Jan Kratochvil
2009-10-28 17:35       ` Joost van der Sluis
2009-10-30  9:47         ` Jan Kratochvil
2009-11-07 21:49           ` Joost van der Sluis
2010-04-12 11:25             ` Joost van der Sluis
2010-04-12 19:51               ` Jan Kratochvil
2010-04-14 10:35                 ` Joost van der Sluis
2010-05-06 23:05                   ` Jan Kratochvil
2010-05-14 21:58                     ` Joost van der Sluis
2010-05-14 22:46                       ` Jan Kratochvil
2010-05-15 20:24                         ` Joost van der Sluis
2010-05-15 21:44                           ` Jan Kratochvil
2010-05-16 12:04                             ` Jonas Maebe
2010-05-16 17:06                               ` Joost van der Sluis
2010-05-16 17:31                                 ` Jan Kratochvil
2010-05-16 21:49                                   ` Jonas Maebe [this message]
2010-05-16 21:55                                     ` Jonas Maebe
2010-05-16 18:31                               ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9D126914-010D-4AE0-BFBA-DE55D17C9E61@elis.ugent.be \
    --to=jonas.maebe@elis.ugent.be \
    --cc=archer@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=joost@cnoc.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).