[PATCH] Fix MI crash with Ada string access

Joel Brobecker brobecker@adacore.com
Fri Aug 14 23:51:35 GMT 2020


Hi Tom,

On Thu, Aug 13, 2020 at 02:53:29PM -0600, Tom Tromey wrote:
> I happened to notice that using -var-create at a certain spot in an
> Ada program caused a crash.  This happens because
> ada_get_decoded_value can return NULL -- in particular, deeper in the
> code it can hit this return in ada_type_of_array:
> 
>       descriptor = desc_bounds (arr);
>       if (value_as_long (descriptor) == 0)
>         return NULL;
> 
> This patch avoids the crash by handling this NULL return.
> 
> gdb/ChangeLog
> 2020-08-13  Tom Tromey  <tromey@adacore.com>
> 
> 	* ada-varobj.c (ada_varobj_decode_var): Handle case where
> 	ada_get_decoded_value returns NULL.
> 
> gdb/testsuite/ChangeLog
> 2020-08-13  Tom Tromey  <tromey@adacore.com>
> 
> 	* gdb.ada/mi_var_access.exp: New file.
> 	* gdb.ada/mi_var_access/mi_access.adb: New file.
> 	* gdb.ada/mi_var_access/pck.adb: New file.
> 	* gdb.ada/mi_var_access/pck.ads: New file.

Since I reviewed this patch internally, and it touches Ada, I'll
approve it here too :).


-- 
Joel


More information about the Gdb-patches mailing list