summaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-07-06 00:19:24 +0100
committerPedro Alves <palves@redhat.com>2017-07-06 00:19:24 +0100
commit8455d26243aef72f7b827ec0d8367b6b7816de07 (patch)
tree93ee5c19c6a006c57d0be94291a6447145611ff6 /gdb/python
parent1d827a720c9659cc8d54059ccc3efae24b875c03 (diff)
Fix Python unwinder frames regression
The gdb.python/py-unwind.exp test is crashing GDB / leaving core dumps in the test dir, even though it all passes cleanly. The crash is not visible in gdb.sum/gdb.log because it happens as side effect of the "quit" command, while flushing the frame cache. The problem is simply a typo in a 'for' loop's condition, introduced by a recent change [4fa847d78edd ("Remove MAX_REGISTER_SIZE from py-unwind.c")], resulting in infinite loop / double-free. The new test exposes the crash, like: Running src/gdb/testsuite/gdb.python/py-unwind.exp ... ERROR: Process no longer exists gdb/ChangeLog: 2017-07-06 Pedro Alves <palves@redhat.com> * python/py-unwind.c (pyuw_dealloc_cache): Fix for loop condition. gdb/testsuite/ChangeLog: 2017-07-06 Pedro Alves <palves@redhat.com> * gdb.python/py-unwind.exp: Test flushregs.
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-unwind.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index 1d800a7b78..acfce7d96c 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -595,7 +595,7 @@ pyuw_dealloc_cache (struct frame_info *this_frame, void *cache)
TRACE_PY_UNWIND (3, "%s: enter", __FUNCTION__);
cached_frame_info *cached_frame = (cached_frame_info *) cache;
- for (int i = 0; cached_frame->reg_count; i++)
+ for (int i = 0; i < cached_frame->reg_count; i++)
xfree (cached_frame->reg[i].data);
xfree (cache);