This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Unbounded array support implemented (for Modula-2)


Hi Pierre,

"Pierre Muller" <muller@ics.u-strasbg.fr> writes:

>   Could you explain why you need to add 
> TSIZE as a synonym of SIZE?
>   Is it just a matter of parser shift/reduce conflicts?
>   Is TSIZE a modula-2 function?

yes a Modula-2 function in PIM-2 it was later replaced by SIZE
in PIM-4.  But GNU Modula-2 supports, PIM-[234] and users might
expect TSIZE to exist in the debugger.

>   Is your change in gdb.texinfo in a modula-2 specific
> area?

yes - in the Modula-2 example session.

> Modula-2 is not the only language supporting unbounded arrays, I
> would be interested in using the same kind of code for pascal
> language support.

sure, I'm all for refactoring code..

>   Maybe a more general approach would be useful?

maybe - although I suspect the devil is in the detail.  Basically
Modula-2 assumes that all unbounded arrays start at index 0 and the
caller can be legally access all indices 0..HIGH(a).  GNU Modula-2
implements unbounded arrays by creating a structure whose first field
is a pointer to type, and the second structure is the HIGH value
(unsigned int).  So the patches basically detect if the array
declaration matches a GNU Modula-2 unbounded structure (testing field
names and types and language).  If so then it maps any reference to
a[i] onto a->_m2_contents[i] and HIGH(a) onto a->_m2_high.  How does
GNU Pascal implement unbounded arrays?

>  One more remark: in m2_unbounded_array function, it would probably
> be better to honor the value of the show argument, and to only
> output something if show is non-zero.

many thanks for the spotting this - it is now implemented this in the
latest patch.

regards,
Gaius


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]