public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
* Calculating array length
@ 2009-06-07 10:23 Joost van der Sluis
  2009-06-07 14:48 ` Jan Kratochvil
  0 siblings, 1 reply; 12+ messages in thread
From: Joost van der Sluis @ 2009-06-07 10:23 UTC (permalink / raw)
  To: archer

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.

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

end of thread, other threads:[~2009-06-22 12:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-07 10:23 Calculating array length Joost van der Sluis
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

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).