aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMarcin Kościelnicki <koriakin@0x04.net>2015-11-02 02:12:58 +0100
committerMarcin Kościelnicki <koriakin@0x04.net>2015-11-04 15:26:59 +0100
commit394816ee10a85e3e0fa7c9b0a4ca29e7e160e63c (patch)
tree3e358b49f28689b4eab4a4ed71f8b98aff5bc7c5 /gdb
parentfe6052e1eeffd4e2e2210cebc480b90094429a16 (diff)
downloadgdb-394816ee10a85e3e0fa7c9b0a4ca29e7e160e63c.zip
gdb-394816ee10a85e3e0fa7c9b0a4ca29e7e160e63c.tar.gz
gdb-394816ee10a85e3e0fa7c9b0a4ca29e7e160e63c.tar.bz2
gdb/record-full: Use xmalloc instead of alloca for temporary memory storage.
On the newly added s390 target, it's possible for a single instruction to write practically unbounded amount of memory (eg. MVCLE). This caused a stack overflow when alloca was used. gdb/ChangeLog: * record-full.c (record_full_exec_insn): Use xmalloc for temporary memory storage.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/record-full.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a95fe4c..d286821 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-04 Marcin Kościelnicki <koriakin@0x04.net>
+
+ * record-full.c (record_full_exec_insn): Use xmalloc for temporary
+ memory storage.
+
2015-11-04 Markus Metzger <markus.t.metzger@intel.com>
* record.c (get_insn_history_modifiers): Set DISASSEMBLY_SOURCE
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 595e357..03b3d41 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -726,7 +726,8 @@ record_full_exec_insn (struct regcache *regcache,
/* Nothing to do if the entry is flagged not_accessible. */
if (!entry->u.mem.mem_entry_not_accessible)
{
- gdb_byte *mem = (gdb_byte *) alloca (entry->u.mem.len);
+ gdb_byte *mem = (gdb_byte *) xmalloc (entry->u.mem.len);
+ struct cleanup *cleanup = make_cleanup (xfree, mem);
if (record_debug > 1)
fprintf_unfiltered (gdb_stdlog,
@@ -771,6 +772,8 @@ record_full_exec_insn (struct regcache *regcache,
record_full_stop_reason = TARGET_STOPPED_BY_WATCHPOINT;
}
}
+
+ do_cleanups (cleanup);
}
}
break;