diff options
author | Phil Muldoon <pmuldoon@redhat.com> | 2009-09-21 09:32:28 +0000 |
---|---|---|
committer | Phil Muldoon <pmuldoon@redhat.com> | 2009-09-21 09:32:28 +0000 |
commit | 2e4d963fb27e10835c44564788b9c3d25bc21119 (patch) | |
tree | 86fc576d3de53a708a84367fd5300e3abfcba5ce /gdb/testsuite/gdb.python/py-value.c | |
parent | cdfbdf303db54c1ab1ef02a44872976e0f119530 (diff) | |
download | gdb-2e4d963fb27e10835c44564788b9c3d25bc21119.zip gdb-2e4d963fb27e10835c44564788b9c3d25bc21119.tar.gz gdb-2e4d963fb27e10835c44564788b9c3d25bc21119.tar.bz2 |
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.
Diffstat (limited to 'gdb/testsuite/gdb.python/py-value.c')
-rw-r--r-- | gdb/testsuite/gdb.python/py-value.c | 15 |
1 files changed, 15 insertions, 0 deletions
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 */ } |