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.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a59c0afeb6808e51 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-02 19:28:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!opentransit.net!wanadoo.fr!freenix!enst.fr!not-for-mail From: "David C. Hoos, Sr." Newsgroups: comp.lang.ada Subject: Re: Howto debug seg-faulting Ada 95 code? Date: Mon, 2 Sep 2002 21:27:01 -0500 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: <1f358d66.0208302358.6f1c6a39@posting.google.com> Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1031020083 68325 137.194.161.2 (3 Sep 2002 02:28:03 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Tue, 3 Sep 2002 02:28:03 +0000 (UTC) Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2711.0600 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.12 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Original-Cc: karlran@hotmail.com Xref: archiver1.google.com comp.lang.ada:28678 Date: 2002-09-02T21:27:01-05:00 This code runs perfectly well on my RedHat 7.2 GNAT 3.14 system under my normal shell environment which is tcsh with the following resource limits (obtained by issuing the "limit" command): cputime unlimited filesize unlimited datasize unlimited stacksize 8192 kbytes coredumpsize unlimited memoryuse unlimited descriptors 1024 memorylocked unlimited maxproc 1023 openfiles 1024 I can make it segfault if I set the stacksize limit to 6171 kbytes. With 6172 kbytes it runs OK. So, there is no "software defect" as has been suggested, but merely a case of failure to provide an execution environment in which the program is to execute, having adequate resources to accommodate the program's design. One could change the design to allocate on the heap, which would merely shift the resource requirement from stacksize to datasize. If you are using the bash shell, the command for adjusting per-process resource limits is "ulimit". ----- Original Message ----- From: "Karl Ran" Newsgroups: comp.lang.ada To: Sent: August 31, 2002 2:58 AM Subject: Howto debug seg-faulting Ada 95 code? > Hello, > > I've written this nice, but not very useful, Ada 95 program: > > ------------------------------------------------------------ > with Ada; use Ada; > with Ada.Text_IO; > > procedure segfault_city is > > type Unsigned_8 is mod 2**8; > for Unsigned_8'Size use 8; > type Data is array( 0 .. 100 ) of Unsigned_8; > type block is array( 0 .. 200 ) of Data; > > Buffers : array( 0 .. 310 ) of block; > > task type fifo_Task > is > end fifo_Task; > > My_fifo : fifo_Task; > > task body fifo_Task > is > begin > Text_IO.Put_line("fifo_task .."); > end fifo_Task; > > begin > Buffers( 0 )( 0 )( 0 ) := 0; > Text_IO.Put_line("Welcome to segfault city .."); > end Segfault_city; > ------------------------------------------------------------ > > It compiles fine with gnat 3.14p( options: -gnatwa -gnato -g ) > but it fails miserably when I run it. > > It either seg-faults immediately or it eats up all memory and > gets killed. I tried it on P1, Celeron, P4 systems with > Linux 2.4.18/Suse7.1/8.0. > > Some questions: > 1. How do I debug seg-faults( this case and in general )? > 2. Is this valid Ada 95 code? > 3. Is this segfault-code 'portable' or are these just my, maybe, ill > configured systems? > > Karl, > who is still using 'bleeding-edge' technology... > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada.eu.org > http://ada.eu.org/mailman/listinfo/comp.lang.ada > >