Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] [ia64] No start when GDB built with  -lmcheck
@ 2009-08-16 21:19 Jan Kratochvil
  2009-08-17 18:50 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2009-08-16 21:19 UTC (permalink / raw)
  To: gdb-patches

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;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] [ia64] No start when GDB built with  -lmcheck
  2009-08-16 21:19 [patch] [ia64] No start when GDB built with -lmcheck Jan Kratochvil
@ 2009-08-17 18:50 ` Tom Tromey
  2009-08-25 14:18   ` Jan Kratochvil
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2009-08-17 18:50 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> 2009-08-16  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan> 	Fix ia64 start crash when GDB built with -lmcheck.
Jan> 	* ia64-tdep.c (ia64_gdbarch_init): Allocate TDEP as cleared.

I think if you go this route, you should remove the redundant
initializations a couple lines down:

  tdep->sigcontext_register_address = 0;
  tdep->pc_in_sigtramp = 0;

Or, initialize the new field there.

Either approach is pre-approved.

Tom


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] [ia64] No start when GDB built with  -lmcheck
  2009-08-17 18:50 ` Tom Tromey
@ 2009-08-25 14:18   ` Jan Kratochvil
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kratochvil @ 2009-08-25 14:18 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Mon, 17 Aug 2009 20:33:55 +0200, Tom Tromey wrote:
> I think if you go this route, you should remove the redundant
> initializations a couple lines down:
[...]
> Either approach is pre-approved.

I see I was too quick, checked it in with xzalloc.

Only simple ia64-rhel5-linux-gnu run was made.


Thanks,
Jan


http://sourceware.org/ml/gdb-cvs/2009-08/msg00122.html

--- src/gdb/ChangeLog	2009/08/25 00:23:06	1.10824
+++ src/gdb/ChangeLog	2009/08/25 14:06:44	1.10825
@@ -1,3 +1,10 @@
+2009-08-25  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.  Remove
+	specific clearing of TDEP SIGCONTEXT_REGISTER_ADDRESS and
+	PC_IN_SIGTRAMP.
+
 2009-08-24  Keith Seitz  <keiths@redhat.com>
 
 	* c-exp.y (tokentab3): Add new token, ARROW_STAR. Changed all users.
--- src/gdb/ia64-tdep.c	2009/07/30 16:29:53	1.195
+++ src/gdb/ia64-tdep.c	2009/08/25 14:06:47	1.196
@@ -3671,12 +3671,9 @@
   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;
-  tdep->pc_in_sigtramp = 0;
-
   /* According to the ia64 specs, instructions that store long double
      floats in memory use a long-double format different than that
      used in the floating registers.  The memory format matches the


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-08-25 14:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-16 21:19 [patch] [ia64] No start when GDB built with -lmcheck Jan Kratochvil
2009-08-17 18:50 ` Tom Tromey
2009-08-25 14:18   ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox