[gvd-devel] RE: GVD 1.2.5 bug report; display erased attempting to examine ar ray formal parameter.

Goldman, S. MAJ EECS ds6826@usma.edu
Tue, 23 Apr 2002 08:35:15 -0400


All,

It's not a GVD issue -- it's a GDB issue.   It doesn't like the range of the
array -- Character.  It has something to do with the very first element of
Character.  For example, if you create a subtype of character that begins at
the first element, things run fine.  Throw that "0" element in, and both
debuggers (GDB, actually) cause a General Segmentation Fault.

For example,

	WITH Ada.Text_Io;         USE Ada.Text_Io;
	WITH Ada.Integer_Text_Io; USE Ada.Integer_Text_Io;
	WITH Ada.Strings;         USE Ada.Strings;
	WITH Ada.Strings.Fixed;   USE Ada.Strings.Fixed;

	PROCEDURE Test IS

	  SUBTYPE Small_Char IS Character RANGE
Character'Val(0)..Character'Last; -- 1.  Doesn't work
	-- SUBTYPE Small_Char IS Character RANGE
Character'Val(1)..Character'Last; -- 2.  Works
	  TYPE Test_Array_Type IS ARRAY (Small_Char) OF Integer;
	  T_Array : Test_Array_Type := (OTHERS => -1);
	  My_Int : Integer := Character'Pos(Small_char'First);

	BEGIN -- Test

	   FOR Lcv IN T_Array'Range LOOP
	      T_Array(Lcv) := My_Int;
	      Put_Line("Character " & Trim(Integer'Image(My_Int), Both) & "
= " & Lcv);
	      My_Int := My_Int + 1;
	   END LOOP;
	END Test;

I ran the program using GDB and the same thing occurred -- if line 1 is
commented and 2 is uncommented, I can display T_Array without incident.  If
I comment line 2 and uncomment line 1, I get a segmentation fault.

I used 

	Solaris 7
	GNAT version 3.11p
	GDB version 4.17

What's even more interesting is that when I run the same code using Win2K,
GNAT version 3.13p, and GVD version 1.2.5 for Windows, I don't have any
problem unless I remove the subtype range and make the range of
Test_Array_Type Character, i.e., TYPE Test_Array_Type is ARRAY (Character)
OF Integer, then it blows up.

Sincerely,

Stephen M. Goldman 
MAJ, Ordnance 
CS360/A Course Director
Department of Electrical Engineering and Computer Science 
Thayer 1112, (845) 938-5578, DSN: 688-5578 
"one BIT of JUICE & BYTES" 
e-mail:  ds6826 <mailto:ds6826@usma.edu>@usma.edu