[patch] [ia64] No start when GDB built with -lmcheck

Jan Kratochvil jan.kratochvil@redhat.com
Sun Aug 16 21:19:00 GMT 2009


Hi,

build GDB with -lmcheck (valgrind would be similar) to get:

$ gdb -nx -ex r --args ./gdb -nx -ex r true
...
Program received signal SIGSEGV, Segmentation fault.
0x40000000002725c0 in init_regcache_descr (gdbarch=0x6000000000114660) at regcache.c:132
132             descr->sizeof_register[i] = TYPE_LENGTH (descr->register_type[i]);
(gdb) p i
$1 = 128
(gdb) p descr->register_type[i]
$2 = (struct type *) 0x9393939393939393

#0  ia64_ext_type (gdbarch=0x6000000000114660) at ia64-tdep.c:303
303       struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
(gdb) n
305       if (!tdep->ia64_ext_type)
(gdb) p tdep->ia64_ext_type
$2 = (struct type *) 0x9393939393939393
(gdb) l
300     static struct type *
301     ia64_ext_type (struct gdbarch *gdbarch)
302     {
303       struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
304     
305       if (!tdep->ia64_ext_type)
306         tdep->ia64_ext_type
307           = arch_float_type (gdbarch, 128, "builtin_type_ia64_ext",
308                              floatformats_ia64_ext);
309     

The two conflictin lines:

commit c342e22343e36692fce21de338d3175cc33a3dc2
Author: Kevin Buettner <kevinb@redhat.com>
-  tdep = xmalloc (sizeof (struct gdbarch_tdep));

commit ec51d99d066d5d460b4f1722d894deeb7b4963e9
Author: Ulrich Weigand <uweigand@de.ibm.com>
305       if (!tdep->ia64_ext_type)


Thanks,
Jan

gdb/
2009-08-16  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix ia64 start crash when GDB built with -lmcheck.
	* ia64-tdep.c (ia64_gdbarch_init): Allocate TDEP as cleared.

--- gdb/ia64-tdep.c	30 Jul 2009 16:29:53 -0000	1.195
+++ gdb/ia64-tdep.c	16 Aug 2009 18:30:21 -0000
@@ -3671,7 +3671,7 @@ ia64_gdbarch_init (struct gdbarch_info i
   if (arches != NULL)
     return arches->gdbarch;
 
-  tdep = xmalloc (sizeof (struct gdbarch_tdep));
+  tdep = xzalloc (sizeof (struct gdbarch_tdep));
   gdbarch = gdbarch_alloc (&info, tdep);
 
   tdep->sigcontext_register_address = 0;



More information about the Gdb-patches mailing list