summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-inferior.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.python/py-inferior.c')
-rw-r--r--gdb/testsuite/gdb.python/py-inferior.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.python/py-inferior.c b/gdb/testsuite/gdb.python/py-inferior.c
index dd83ffc4767..04ec4769263 100644
--- a/gdb/testsuite/gdb.python/py-inferior.c
+++ b/gdb/testsuite/gdb.python/py-inferior.c
@@ -17,7 +17,11 @@ static int search_buf_size;
int f2 (int a)
{
- char *str = "hello, testsuite";
+ /* We use a `char[]' type below rather than the typical `char *'
+ to make sure that `str' gets allocated on the stack. Otherwise,
+ the compiler may place the "hello, testsuite" string inside
+ a read-only section, preventing us from over-writing it from GDB. */
+ char str[] = "hello, testsuite";
puts (str); /* Break here. */