From: Simon Wright <simon@pushface.org>
Subject: Re: Memory Access
Date: Tue, 08 Nov 2011 18:33:02 +0000
Date: 2011-11-08T18:33:02+00:00 [thread overview]
Message-ID: <m239dycvmp.fsf@pushface.org> (raw)
In-Reply-To: c1d7b8a8-389e-4646-9633-9c811cc225ed@l19g2000yqc.googlegroups.com
awdorrin <awdorrin@gmail.com> writes:
> I think I have myself rather confused at the moment with all of
> this...
>
> Reviewing the code more - I now have a different understanding of what
> Dev_Table is meant to be.
>
> I think that Dev_Table is supposed to be an array of
> Dev_Table_Ptr_Type (an array of pointer addresses) that point to the
> Dev_Table_Type array of Config_Type records.
Yuo said:
The original code has the following statements:
type Dev_Table_Type is array (Device_Num_Type range <>) of Config_Type;
type Dev_Table_Ptr_Type is access Dev_Table_Type;
Dev_Table := Dev_Table_Ptr_Type;
Bounds_Ptr : Global_Types.Int_Ptr_Type;
which looks pretty clear to me! If that's what the original compiler
worked with, then .... oh. It can't possibly be what the original
compiler worked with; just look at
Dev_Table := Dev_Table_Ptr_Type;
.... perhaps the '=' is a typo?
Assuming it is, then Dev_Table is a pointer to an array of Config_Types.
> Stepping through the code with GDB has shed some light, although not a
> solution to my problem, quite yet.
>
> The problem I'm running into is a SegFault when the code tries to
> assign a value read from the data file.
>
> Dev_Table(Dev_Num).Dev_Name := Current_Dev_Name;
>
> GDB cannot resolve what Dev_Table(Dev_Num) is - I'm thinking because
> it and Ada isn't seeing Dev_Table as an array of pointers.
GDB doesn't always understand things completely.
Dev_Table(Dev_Num) is an implicit dereference of the pointer Dev_Table,
which desgnates the Dev_Num'th element of the array or Config_Types; and
.Dev_Name is the record component of that element. It could have been
written
Dev_Table.all(Dev_Num).Dev_Name := Current_Dev_Name;
In passing, I see someone with a C background was responsible for the
naming conventions. Why Dev_Name? just Name would have done
perfectly. Oh well, the least of your worries, I'm sure!
next prev parent reply other threads:[~2011-11-08 18:33 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-07 20:09 Memory Access awdorrin
2011-11-07 21:26 ` Simon Wright
2011-11-07 22:03 ` anon
2011-11-07 22:21 ` Adam Beneschan
2011-11-07 22:42 ` Adam Beneschan
2011-11-07 23:13 ` Simon Wright
2011-11-07 23:32 ` Adam Beneschan
2011-11-08 12:22 ` awdorrin
2011-11-08 16:00 ` Adam Beneschan
2011-11-08 17:46 ` awdorrin
2011-11-08 20:11 ` Adam Beneschan
2011-11-08 20:24 ` awdorrin
2011-11-09 14:42 ` awdorrin
2011-11-08 16:10 ` awdorrin
2011-11-08 18:33 ` Simon Wright [this message]
2011-11-08 18:34 ` Simon Wright
2011-11-08 20:18 ` awdorrin
2011-11-08 12:44 ` Simon Wright
2011-11-07 22:26 ` Niklas Holsti
2011-11-07 22:53 ` Adam Beneschan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox