public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Joost van der Sluis <joost@cnoc.nl>
To: archer@sourceware.org
Subject: Calculating array length
Date: Sun, 07 Jun 2009 10:23:00 -0000	[thread overview]
Message-ID: <1244370173.22994.14.camel@wsjoost> (raw)

Hi all,

First a quick introduction. I'm using gdb to debug my pascal (fpc)
programs, on Linux,OSX and Windows. But there are quite some
difficulties with the gdb<->fpc combination which makes debugging hard.
There were a lot of discussions if some fpc-users should build their own
debugger, but imho it would be better to try to improve the combination
of fpc and gdb. (Although my knowledge of c is pretty bad)

In the past Pierre Muller worked on this but he is not that active
anymore, although he's still willing to help. And I thought that I could
take a look if I could help somewhere.

The archer project is very usefull in this, because with Dwarf-3 some
new things are introduced which can be used to generate better
debug-information for pascal-languages.

I can conclude now already that it's a good thing to look at gdb and fpc
together, because there are comments in the fpc-code like 'we have to
store all identifiers in uppercase into the debug-info, because gdb
needs that', while you can find a comment in the gdb-code like 'all
identifiers are written in capitals by fpc, we have to take care of
that'.

But I also have a lot of questions, I hope this is the right place for
them.

First question is the calculation of the length of an array-type in
type_length_get(), gdbtypes.c. (I'm using the archer-jankratochvil-sla
branch to improve the handling of arrays)

The length is calculated as follows: (count-1)*byte_stride+element_size.

Ok, so why 'count-1'? Count is the actual item-count, why substract it
with one? And why is the element_size added? byte_stride (when defined)
should replace the element_size?

It doesn't make sense to me, as it should be: 'count*byte_stride'?

Can anyone explain this to me?

Regards,

Joost van der Sluis.

             reply	other threads:[~2009-06-07 10:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-07 10:23 Joost van der Sluis [this message]
2009-06-07 14:48 ` Jan Kratochvil
2009-06-07 16:06   ` Joost van der Sluis
2009-06-07 17:49     ` Jan Kratochvil
2009-06-07 17:59       ` Jan Kratochvil
2009-06-12 21:24       ` Joost van der Sluis
2009-06-15 11:57         ` Jan Kratochvil
2009-06-15 12:16           ` Jan Kratochvil
2009-06-14 20:30       ` Joost van der Sluis
2009-06-20 22:34         ` Jan Kratochvil
2009-06-22 12:07           ` Joost van der Sluis
2009-06-22 12:15             ` 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=1244370173.22994.14.camel@wsjoost \
    --to=joost@cnoc.nl \
    --cc=archer@sourceware.org \
    /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).