Re: segfault on opening a register window

Yurij Grechishhev <[email protected]>
Newsgroups gmane.comp.debugging.insight
Message-ID <CAAyhtXTo8wEAJ-HP=Hiba68Nq4W5vU+YakRNQMdmxnittfJr4Q@mail.gmail.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.