2009-09-21 Phil Muldoon <pmuldoon@redhat.com>

* python/py-value.c (valpy_getitem): Test value before allowing
	subscript operation.

2009-09-21  Phil Muldoon <pmuldoon@redhat.com>

	* gdb.python/py-value.exp (test_subscript_regression): New
	function.  Test for invalid subscripts.
	* gdb.python/py-value.c (main): Add test array, and pointer to it.
	(ptr_ref): New function.
This commit is contained in:
Phil Muldoon 2009-09-21 09:32:28 +00:00
parent cdfbdf303d
commit 2e4d963fb2
5 changed files with 113 additions and 1 deletions

View file

@ -37,6 +37,13 @@ typedef struct s *PTR;
enum e evalue = TWO;
#ifdef __cplusplus
void ptr_ref(int*& rptr_int)
{
return; /* break to inspect pointer by reference. */
}
#endif
int
main (int argc, char *argv[])
{
@ -46,10 +53,18 @@ main (int argc, char *argv[])
PTR x = &s;
char st[17] = "divide et impera";
char nullst[17] = "divide\0et\0impera";
int a[3] = {1,2,3};
int *p = a;
int i = 2;
int *ptr_i = &i;
s.a = 3;
s.b = 5;
u.a = 7;
#ifdef __cplusplus
ptr_ref(ptr_i);
#endif
return 0; /* break to inspect struct and union */
}