Fix cached_frame allocation in py-unwind
authorAlan Hayward <alan.hayward@arm.com>
Thu, 22 Jun 2017 15:30:15 +0000 (16:30 +0100)
committerAlan Hayward <alan.hayward@arm.com>
Thu, 22 Jun 2017 15:30:15 +0000 (16:30 +0100)
gdb/
* python/py-unwind.c (pyuw_sniffer): Allocate space for
registers.

gdb/ChangeLog
gdb/python/py-unwind.c

index 1fad587c74b0f84175f89ae6dda21c79ba76a3e5..bf9e08d1d814ae6774cdbb7ce962c5839fc1edf9 100644 (file)
@@ -1,3 +1,8 @@
+2017-06-22  Alan Hayward  <alan.hayward@arm.com>
+
+       * python/py-unwind.c (pyuw_sniffer): Allocate space for
+       registers.
+
 2017-06-22  Alan Hayward  <alan.hayward@arm.com>
 
        * record-full.c (record_full_exec_insn): Use byte_vector.
index da1703ecf2b843d9a6790f095e64c2915280ae35..1d800a7b7861da6a168440b600fb2862c42b4e4b 100644 (file)
@@ -557,7 +557,10 @@ pyuw_sniffer (const struct frame_unwind *self, struct frame_info *this_frame,
     saved_reg *reg;
     int i;
 
-    cached_frame = XNEW (cached_frame_info);
+    cached_frame
+      = ((cached_frame_info *)
+        xmalloc (sizeof (*cached_frame)
+                 + reg_count * sizeof (cached_frame->reg[0])));
     cached_frame->gdbarch = gdbarch;
     cached_frame->frame_id = unwind_info->frame_id;
     cached_frame->reg_count = reg_count;