[PATCH] Rotate ChangeLog, fix build issues

Keith Seitz <[email protected]>
Newsgroups gmane.comp.debugging.insight
Message-ID <[email protected]>
Hi,

Now that I have something to commit, it is time to rotate the ChangeLog 
for the year...

I've committed the attached patch, which should fix all the build 
problems that have been reported. Additionally, this should fix a 
crashing problem that I discovered (some time ago) in the register window.

If there are any problems, please let me know.

Keith

ChangeLog
2011-04-08  Keith Seitz  <[email protected]>

	* generic/gdbtk-bp.c (tracepoint_exists): Update for
	decode_line_1 API change.
	* generic/gdbtk-cmds.c (gdb_eval): Use comman_val_print
	instead of val_print.
	(gdb_get_line_command): Update for decode_line_1 API
	changes.
	(gdb_get_file_command): Likewise.
	(gdb_get_function_command): Likewise.
	* generic/gdbtk-register.c (get_register_types): Use
	get_frame_register_value instead of frame_register.
	(get_register): Pass valid VALUE to val_print.
	Consolidate calls to get_current_gdbarch.
	* generic/gdbtk-stack.c (gdb_get_vars_command): Update
	for decode_line_1 API change.
insight-gdb-api-updates.patch (text/plain, 7.8 KB)
Index: gdbtk-bp.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-bp.c,v
retrieving revision 1.38
diff -u -p -r1.38 gdbtk-bp.c
--- gdbtk-bp.c	13 Nov 2010 23:23:46 -0000	1.38
+++ gdbtk-bp.c	8 Apr 2011 23:25:01 -0000
@@ -1,5 +1,6 @@
 /* Tcl/Tk command definitions for Insight - Breakpoints.
-   Copyright (C) 2001, 2002, 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2008, 2009, 2010, 2011
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -826,12 +827,11 @@ tracepoint_exists (char *args)
   VEC(breakpoint_p) *tp_vec = NULL;
   int ix;
   struct breakpoint *tp;
-  char **canonical;
   struct symtabs_and_lines sals;
   char *file = NULL;
   int result = -1;
 
-  sals = decode_line_1 (&args, 1, NULL, 0, &canonical, NULL);
+  sals = decode_line_1 (&args, 1, NULL, 0, NULL, NULL);
   if (sals.nelts == 1)
     {
       resolve_sal_pc (&sals.sals[0]);
Index: gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.118
diff -u -p -r1.118 gdbtk-cmds.c
--- gdbtk-cmds.c	18 Jun 2010 22:25:26 -0000	1.118
+++ gdbtk-cmds.c	8 Apr 2011 23:25:01 -0000
@@ -1,5 +1,6 @@
 /* Tcl/Tk command definitions for Insight.
-   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2007, 2008, 2010
+   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004,
+   2007, 2008, 2010, 2011
    Free Software Foundation, Inc.
 
    Written by Stu Grossman <[email protected]> of Cygnus Support.
@@ -652,9 +653,7 @@ gdb_eval (ClientData clientData, Tcl_Int
   /* "Print" the result of the expression evaluation. */
   stb = mem_fileopen ();
   make_cleanup_ui_file_delete (stb);
-  val_print (value_type (val), value_contents (val),
-	     value_embedded_offset (val), value_address (val),
-	     stb, 0, val, &opts, current_language);
+  common_val_print (val, stb, 0, &opts, current_language);
   result = ui_file_xstrdup (stb, &dummy);
   Tcl_SetObjResult (interp, Tcl_NewStringObj (result, -1));
   xfree (result);
@@ -953,7 +952,7 @@ gdb_get_line_command (ClientData clientD
 		      int objc, Tcl_Obj *CONST objv[])
 {
   struct symtabs_and_lines sals;
-  char *args, **canonical;
+  char *args;
 
   if (objc != 2)
     {
@@ -962,7 +961,7 @@ gdb_get_line_command (ClientData clientD
     }
 
   args = Tcl_GetStringFromObj (objv[1], NULL);
-  sals = decode_line_1 (&args, 1, NULL, 0, &canonical, NULL);
+  sals = decode_line_1 (&args, 1, NULL, 0, NULL, NULL);
   if (sals.nelts == 1)
     {
       Tcl_SetIntObj (result_ptr->obj_ptr, sals.sals[0].line);
@@ -989,7 +988,7 @@ gdb_get_file_command (ClientData clientD
 		      int objc, Tcl_Obj *CONST objv[])
 {
   struct symtabs_and_lines sals;
-  char *args, **canonical;
+  char *args;
 
   if (objc != 2)
     {
@@ -998,7 +997,7 @@ gdb_get_file_command (ClientData clientD
     }
 
   args = Tcl_GetStringFromObj (objv[1], NULL);
-  sals = decode_line_1 (&args, 1, NULL, 0, &canonical, NULL);
+  sals = decode_line_1 (&args, 1, NULL, 0, NULL, NULL);
   if (sals.nelts == 1)
     {
       Tcl_SetStringObj (result_ptr->obj_ptr,
@@ -1025,7 +1024,7 @@ gdb_get_function_command (ClientData cli
 {
   char *function;
   struct symtabs_and_lines sals;
-  char *args, **canonical;
+  char *args;
 
   if (objc != 2)
     {
@@ -1034,7 +1033,7 @@ gdb_get_function_command (ClientData cli
     }
 
   args = Tcl_GetStringFromObj (objv[1], NULL);
-  sals = decode_line_1 (&args, 1, NULL, 0, &canonical, NULL);
+  sals = decode_line_1 (&args, 1, NULL, 0, NULL, NULL);
   if (sals.nelts == 1)
     {
       resolve_sal_pc (&sals.sals[0]);
Index: gdbtk-register.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-register.c,v
retrieving revision 1.39
diff -u -p -r1.39 gdbtk-register.c
--- gdbtk-register.c	18 Jun 2010 22:25:26 -0000	1.39
+++ gdbtk-register.c	8 Apr 2011 23:25:01 -0000
@@ -1,5 +1,6 @@
 /* Tcl/Tk command definitions for Insight - Registers
-   Copyright (C) 2001, 2002, 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2004, 2007, 2010, 2011
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -272,17 +273,19 @@ get_register_types (int regnum, map_arg 
 static void
 get_register (int regnum, map_arg arg)
 {
-  int realnum;
   CORE_ADDR addr;
   enum lval_type lval;
   struct type *reg_vtype;
   gdb_byte buffer[MAX_REGISTER_SIZE];
-  int optim, format;
+  int format;
   struct cleanup *old_chain = NULL;
   struct ui_file *stb;
   long dummy;
   char *res;
- 
+  struct gdbarch *gdbarch;
+  struct value *val;
+  struct frame_info *frame;
+
   format = regformat[regnum];
   if (format == 0)
     format = 'x';
@@ -300,10 +303,11 @@ get_register (int regnum, map_arg arg)
       return;
     }
 
-  frame_register (get_selected_frame (NULL), regnum, &optim, &lval, 
-		  &addr, &realnum, buffer);
+  frame = get_selected_frame (NULL);
+  gdbarch = get_frame_arch (frame);
+  val = get_frame_register_value (frame, regnum);
 
-  if (optim)
+  if (value_optimized_out (val))
     {
       Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,
 				Tcl_NewStringObj ("Optimized out", -1));
@@ -318,13 +322,14 @@ get_register (int regnum, map_arg arg)
       /* shouldn't happen. raw format is deprecated */
       int j;
       char *ptr, buf[1024];
+      const gdb_byte *valaddr = value_contents_for_printing (val);
 
       strcpy (buf, "0x");
       ptr = buf + 2;
-      for (j = 0; j < register_size (get_current_arch (), regnum); j++)
+      for (j = 0; j < register_size (gdbarch, regnum); j++)
 	{
-	  int idx = ((gdbarch_byte_order (get_current_arch ()) == BFD_ENDIAN_BIG)
-		     ? j : register_size (get_current_arch (), regnum) - 1 - j);
+	  int idx = ((gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
+		     ? j : register_size (gdbarch, regnum) - 1 - j);
 	  sprintf (ptr, "%02x", (unsigned char) buffer[idx]);
 	  ptr += 2;
 	}
@@ -337,17 +342,9 @@ get_register (int regnum, map_arg arg)
       get_formatted_print_options (&opts, format);
       opts.deref_ref = 1;
       opts.pretty = Val_pretty_default;
-
-      if ((TYPE_CODE (reg_vtype) == TYPE_CODE_UNION)
-	  && (strcmp (FIELD_NAME (TYPE_FIELD (reg_vtype, 0)), 
-		      gdbarch_register_name (get_current_arch (), regnum)) == 0))
-	{
-	  val_print (FIELD_TYPE (TYPE_FIELD (reg_vtype, 0)), buffer, 0, 0,
-		     stb, 0, NULL, &opts, current_language);
-	}
-      else
-	val_print (reg_vtype, buffer, 0, 0,
-		   stb, 0, NULL, &opts, current_language);
+      val_print (reg_vtype, value_contents_for_printing (val),
+		 value_embedded_offset (val), 0,
+		 stb, 0, val, &opts, current_language);
     }
   
   res = ui_file_xstrdup (stb, &dummy);
Index: gdbtk-stack.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-stack.c,v
retrieving revision 1.34
diff -u -p -r1.34 gdbtk-stack.c
--- gdbtk-stack.c	7 Jul 2009 12:38:56 -0000	1.34
+++ gdbtk-stack.c	8 Apr 2011 23:25:01 -0000
@@ -1,5 +1,6 @@
 /* Tcl/Tk command definitions for Insight - Stack.
-   Copyright (C) 2001, 2002, 2003, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2008, 2011
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -277,7 +278,7 @@ gdb_get_vars_command (ClientData clientD
   struct symtabs_and_lines sals;
   struct symbol *sym;
   struct block *block;
-  char **canonical, *args;
+  char *args;
   struct dict_iterator iter;
   int i, arguments;
 
@@ -297,7 +298,7 @@ gdb_get_vars_command (ClientData clientD
   if (objc == 2)
     {
       args = Tcl_GetStringFromObj (objv[1], NULL);
-      sals = decode_line_1 (&args, 1, NULL, 0, &canonical, NULL);
+      sals = decode_line_1 (&args, 1, NULL, 0, NULL, NULL);
       if (sals.nelts == 0)
 	{
 	  gdbtk_set_result (interp, "error decoding line");
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.