This is the mail archive of the
insight@sourceware.org
mailing list for the Insight project.
Re: segfault on opening a register window
- From: Yurij Grechishhev <yurij dot grechishhev at gmail dot com>
- To: insight at sourceware dot org, anemo at mba dot ocn dot ne dot jp
- Date: Tue, 13 Dec 2011 19:22:24 +0300
- Subject: Re: segfault on opening a register window
I had the same problem for insight-6.8-1 after specifying the target
registers using XML file (set tdesc filename).
It's my variant for insight-6.8-1 patch (the get_current_arch()
function is not supported):
--- insight-6.8-1/gdb/gdbtk/generic/gdbtk-register.c
+++ insight-6.8-1/gdb/gdbtk/generic/gdbtk-register.c
@@ -62,6 +62,7 @@
static char *old_regs = NULL;
static int *regformat = (int *)NULL;
static struct type **regtype = (struct type **)NULL;
+static struct gdbarch *cur_gdbarch = NULL;
int
Gdbtk_Register_Init (Tcl_Interp *interp)
@@ -146,6 +147,10 @@
return TCL_ERROR;
}
+ /* Check gdbarch change to avoid corruption of regformat/regtype array */
+ if (cur_gdbarch != current_gdbarch)
+ setup_architecture_data ();
+
/* Skip the option */
objc -= 2;
objv += 2;
@@ -459,6 +464,7 @@
{
int numregs;
+ cur_gdbarch = current_gdbarch;
xfree (old_regs);
xfree (regformat);
xfree (regtype);
--
With best regards!
____________________________
Yurij Grechishhev
Bauman State Technical University,
Department of Computer Systems and Networks