Index: 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 aed70c8af8eb62a558287b24678106abc37ff44b..4f8c27b4c9f597aa63203ab1adf1c3e7d2f71e0e 100644 |
--- a/gdb/testsuite/gdb.python/py-value.c |
+++ b/gdb/testsuite/gdb.python/py-value.c |
@@ -1,6 +1,6 @@ |
/* This testcase is part of GDB, the GNU debugger. |
- Copyright 2008-2012 Free Software Foundation, Inc. |
+ Copyright 2008-2013 Free Software Foundation, Inc. |
This program is free software; you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
@@ -16,6 +16,8 @@ |
along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
#include <stdio.h> |
+#include <stdlib.h> |
+#include <string.h> |
struct s |
{ |
@@ -39,6 +41,13 @@ typedef struct s *PTR; |
enum e evalue = TWO; |
+struct str |
+{ |
+ int length; |
+ /* Variable length. */ |
+ char text[1]; |
+}; |
+ |
#ifdef __cplusplus |
struct Base { |
@@ -86,6 +95,8 @@ main (int argc, char *argv[]) |
int i = 2; |
int *ptr_i = &i; |
const char *sn = 0; |
+ struct str *xstr; |
+ |
s.a = 3; |
s.b = 5; |
u.a = 7; |
@@ -96,6 +107,12 @@ main (int argc, char *argv[]) |
ptr_ref(ptr_i); |
#endif |
+#define STR_LENGTH 100 |
+ xstr = (struct str *) malloc (sizeof (*xstr) + STR_LENGTH); |
+ xstr->length = STR_LENGTH; |
+ memset (xstr->text, 'x', STR_LENGTH); |
+#undef STR_LENGTH |
+ |
save_argv = argv; /* break to inspect struct and union */ |
return 0; |
} |