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.
This commit is contained in:
Marcin Kościelnicki 2015-11-02 02:12:58 +01:00
parent fe6052e1ee
commit 394816ee10
2 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -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;