GNU Binutils with patches for OS216
Revisión | 8503d6e1e564cb5ac61bc6e3f16c0b384c76661e (tree) |
---|---|
Tiempo | 2015-01-07 00:07:12 |
Autor | Joel Brobecker <brobecker@adac...> |
Commiter | Joel Brobecker |
gdb/python: exception trying to create empty array
The following python command fails:
The above is trying to create an empty array, which is fairly command
in Ada.
gdb/ChangeLog:
gdb/testsuite/ChangeLog:
@@ -1,3 +1,8 @@ | ||
1 | +2015-01-06 Joel Brobecker <brobecker@adacore.com> | |
2 | + | |
3 | + * python/py-type.c (typy_array_1): Do not raise negative-length | |
4 | + exception if N2 is equal to N1 - 1. | |
5 | + | |
1 | 6 | 2015-01-03 Doug Evans <xdje42@gmail.com> |
2 | 7 | |
3 | 8 | * c-exp.y: Whitespace cleanup. |
@@ -528,7 +528,7 @@ typy_array_1 (PyObject *self, PyObject *args, int is_vector) | ||
528 | 528 | n1 = 0; |
529 | 529 | } |
530 | 530 | |
531 | - if (n2 < n1) | |
531 | + if (n2 < n1 - 1) | |
532 | 532 | { |
533 | 533 | PyErr_SetString (PyExc_ValueError, |
534 | 534 | _("Array length must not be negative")); |
@@ -1,3 +1,8 @@ | ||
1 | +2015-01-06 Joel Brobecker <brobecker@adacore.com> | |
2 | + | |
3 | + * gdb.python/py-type.exp: Add a couple test about empty | |
4 | + array creation, and negative-length array creation. | |
5 | + | |
1 | 6 | 2015-01-02 Doug Evans <xdje42@gmail.com> |
2 | 7 | |
3 | 8 | * gdb.cp/nsalias.exp: Fix output of external/declaration flags. |
@@ -247,6 +247,12 @@ restart_gdb "${binfile}" | ||
247 | 247 | # Skip all tests if Python scripting is not enabled. |
248 | 248 | if { [skip_python_tests] } { continue } |
249 | 249 | |
250 | +gdb_test "python print gdb.lookup_type('char').array(1, 0)" \ | |
251 | + "char \\\[0\\\]" | |
252 | + | |
253 | +gdb_test "python print gdb.lookup_type('char').array(1, -1)" \ | |
254 | + "Array length must not be negative.*" | |
255 | + | |
250 | 256 | with_test_prefix "lang_c" { |
251 | 257 | runto_bp "break to inspect struct and array." |
252 | 258 | test_fields "c" |