From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7f18265ce67560b3 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.59.229 with SMTP id c5mr1217323pbr.6.1320777184692; Tue, 08 Nov 2011 10:33:04 -0800 (PST) Path: h5ni13492pba.0!nntp.google.com!news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Memory Access Date: Tue, 08 Nov 2011 18:33:02 +0000 Organization: A noiseless patient Spider Message-ID: References: <49f9578c-6f67-4af0-93b0-63120bfe23df@x28g2000prb.googlegroups.com> <35c7e403-6503-4e26-8764-9783caf84871@e2g2000vbb.googlegroups.com> Mime-Version: 1.0 Injection-Info: mx04.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="3860"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18jRjZ5X8aAfJjG/3kDA1BMQEHAjum7LW0=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (darwin) Cancel-Lock: sha1:H9glJssSK2rFI+Ep3ujVdHAO0Hw= sha1:dOvxZ/hH66Qf44nvbYIcxPmBH5M= Xref: news2.google.com comp.lang.ada:14351 Content-Type: text/plain; charset=us-ascii Date: 2011-11-08T18:33:02+00:00 List-Id: awdorrin 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!