This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix cached_frame allocation in py-unwind


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=16892a0323ce6cf41ca80e384dfba12524247902

commit 16892a0323ce6cf41ca80e384dfba12524247902
Author: Alan Hayward <alan.hayward@arm.com>
Date:   Thu Jun 22 16:30:15 2017 +0100

    Fix cached_frame allocation in py-unwind
    
    gdb/
    	* python/py-unwind.c (pyuw_sniffer): Allocate space for
    	registers.

Diff:
---
 gdb/ChangeLog          | 5 +++++
 gdb/python/py-unwind.c | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1fad587..bf9e08d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 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.
 
 2017-06-22  Yao Qi  <yao.qi@linaro.org>
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index da1703e..1d800a7 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]