From 2e4d963fb27e10835c44564788b9c3d25bc21119 Mon Sep 17 00:00:00 2001 From: Phil Muldoon Date: Mon, 21 Sep 2009 09:32:28 +0000 Subject: 2009-09-21 Phil Muldoon * python/py-value.c (valpy_getitem): Test value before allowing subscript operation. 2009-09-21 Phil Muldoon * 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. --- gdb/testsuite/gdb.python/py-value.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gdb/testsuite/gdb.python/py-value.c') diff --git a/gdb/testsuite/gdb.python/py-value.c b/gdb/testsuite/gdb.python/py-value.c index f3d6284..023d830 100644 --- a/gdb/testsuite/gdb.python/py-value.c +++ b/gdb/testsuite/gdb.python/py-value.c @@ -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 */ } -- cgit v1.1