[binutils-gdb] XCNEW gdbarch_tdep in rl78 and rx

sergiodj+buildbot@sergiodj.net sergiodj+buildbot@sergiodj.net
Thu Apr 13 08:03:00 GMT 2017


*** TEST RESULTS FOR COMMIT e6ddc3bfedb4665c9d4baa2c85037af25167cdf3 ***

Author: Yao Qi <yao.qi@linaro.org>
Branch: master
Commit: e6ddc3bfedb4665c9d4baa2c85037af25167cdf3

XCNEW gdbarch_tdep in rl78 and rx

"struct gdbarch_tdep" is XNEW'ed in rl78 and rx, so the memory is not
cleared.  As the result, tdep->rl78_psw_type is never initialized
properly.

  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);

  if (tdep->rl78_psw_type == NULL)
    {
      tdep->rl78_psw_type = arch_flags_type (gdbarch,
					     "builtin_type_rl78_psw", 1);

The bug is found by my unit test in the following patch.

gdb:

2017-04-13  Yao Qi  <yao.qi@linaro.org>

	* rl78-tdep.c (rl78_gdbarch_init): Use XCNEW instead of XNEW.
	* rx-tdep.c (rx_gdbarch_init): Likewise.



More information about the Gdb-testers mailing list