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] |
Hello, We noticed that GDB was hanging when printing multi-dimensional arrays were one of the dimensions is null. You would think that this case makes little sense, and that's probably why we hadn't heard of it until now. But an array of empty strings made us aware of the issue... This has been reduced to: type Matrix is array (1 .. 10, 1 .. 0) of Character; type Wrapper is record M : Matrix; end record; My_Matrix : Wrapper := (M => (others => (others => 'a'))); If you try to print My_Matrix, GDB hangs. The problem is that we were doing a division by zero when trying to compute the number of elements in our array in val_print_array_elements: len = TYPE_LENGTH (type) / eltlen; This is because val_print_array_elements wasn't prepared to deal with arrays of zero-size elements. 2008-05-16 Joel Brobecker <brobecker@adacore.com> * valprint.h (get_array_bounds): Renames get_array_low_bound. * valprint.c (get_array_bounds): Renames get_array_low_bound. Return the proper bound value if the array index type is an enumerated type. Compute the high bound if requested. (val_print_array_elements): Handle the case when the array element has a null size. * ada-valprint.c (print_optional_low_bound): Add handling for empty arrays or arrays of zero-size elements. (ada_val_print_array): New function, extracted out from ada_val_print_1 case TYPE_CODE_ARRAY, and enhanced to handle empty arrays and arrays of zero-size elements. (ada_val_print_1)[case TYPE_CODE_ARRAY]: Replace extracted-out code by call to ada_val_print_array. (ada_value_print): Remove handling of null array. The handling was incomplete and is now better handled by ada_val_print_array. 2008-05-16 Joel Brobecker <brobecker@adacore.com> * gdb.ada/null_array/foo.adb: Add multi-dimensional array of zero-size elements. * gdb.ada/null_array.exp: Test printing this new array. Tested on x86-linux. I will commit in a week unless someone has some comments on the patch. -- Joel
Attachment:
empty_array.diff
Description: Text document
Attachment:
empty_array-tc.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |