comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: Howto debug seg-faulting Ada 95 code?
Date: Mon, 2 Sep 2002 21:27:01 -0500
Date: 2002-09-02T21:27:01-05:00	[thread overview]
Message-ID: <mailman.1031020083.19482.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: 1f358d66.0208302358.6f1c6a39@posting.google.com

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" <karlran@hotmail.com>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
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
> 
> 





  parent reply	other threads:[~2002-09-03  2:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-31  7:58 Howto debug seg-faulting Ada 95 code? Karl Ran
2002-08-31  8:14 ` Florian Weimer
2002-09-02 15:05   ` Karl Ran
2002-09-02 16:25     ` Jeffrey Creem
2002-09-02 16:47       ` Pat Rogers
2002-09-02 22:40         ` Jeffrey Creem
2002-09-02 23:25           ` Pat Rogers
2002-09-03 11:20             ` Jeffrey Creem
2002-09-04 14:57               ` Pat Rogers
2002-09-03  8:51       ` Sergey Koshcheyev
2002-09-03 11:42         ` Samuel Tardieu
2002-09-07 18:50           ` Steven Deller
2002-09-02 21:35     ` Florian Weimer
2002-09-03  9:11       ` Karl Ran
2002-09-03  2:27 ` David C. Hoos, Sr. [this message]
2002-09-03  9:38   ` Karl Ran
2002-09-03 12:15     ` David C. Hoos, Sr.
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox