public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Update recent breakpoint build failures
@ 2010-03-25  7:07 Keith Seitz
  0 siblings, 0 replies; only message in thread
From: Keith Seitz @ 2010-03-25  7:07 UTC (permalink / raw)
  To: insight

[-- Attachment #1: Type: text/plain, Size: 736 bytes --]

Hi,

I've committed the attached patch which fixes several new build failures 
that have cropped up in the last week or two due to some API shifts 
inside GDB.

I have not tested the tracepoint stuff at all, so there might be issues.

In any case, if there are any further issues, please let me know.

Keith

ChangeLog
2010-03-24  Keith Seitz  <keiths@redhat.com>

	* generic/gdbtk-bp.c (gdb_set_bp): set_breakpoint is no more.
	Use create_breakpoint.
	(gdbtk_obj_array, gdbtk_obj_array_ptr, gdbtk_obj_array_cnt):
	New globals.
	(gdbtk_read_next_line): New function.
	(gdb_actions_command): Rewrite using new command_line
	infrastructure.
	(gdb_get_tracepoint_info): Actions are now stored in the breakpoint
	struct's commands element.

[-- Attachment #2: gdbtk-bp-update.patch --]
[-- Type: text/plain, Size: 4700 bytes --]

Index: generic/gdbtk-bp.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-bp.c,v
retrieving revision 1.33
diff -u -p -r1.33 gdbtk-bp.c
--- generic/gdbtk-bp.c	15 Jan 2010 22:37:18 -0000	1.33
+++ generic/gdbtk-bp.c	24 Mar 2010 20:17:48 -0000
@@ -1,5 +1,5 @@
 /* Tcl/Tk command definitions for Insight - Breakpoints.
-   Copyright (C) 2001, 2002, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2008, 2009, 2010 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -33,6 +33,11 @@
 #include "arch-utils.h"
 #include "exceptions.h"
 
+/* Globals to support action and breakpoint commands.  */
+static Tcl_Obj **gdbtk_obj_array;
+static int gdbtk_obj_array_cnt;
+static int gdbtk_obj_array_ptr;
+
 /* From breakpoint.c */
 extern struct breakpoint *breakpoint_chain;
 
@@ -156,6 +161,17 @@ Gdbtk_Breakpoint_Init (Tcl_Interp *inter
 
   return TCL_OK;
 }
+
+/* A line buffer for breakpoint commands and tracepoint actions
+   input validation.  */
+static char *
+gdbtk_read_next_line (void)
+{
+  if (gdbtk_obj_array_ptr == gdbtk_obj_array_cnt)
+    return NULL;
+
+  return  Tcl_GetStringFromObj (gdbtk_obj_array[gdbtk_obj_array_ptr++], NULL);
+}
 \f
 /*
  *  This section contains commands for manipulation of breakpoints.
@@ -530,9 +546,16 @@ gdb_set_bp (ClientData clientData, Tcl_I
 
   TRY_CATCH (e, RETURN_MASK_ALL)
     {
-      set_breakpoint (get_current_arch (), address, condition,
-		      0 /* hardwareflag */, temp, thread, ignore_count,
-		      pending, enabled);
+      create_breakpoint (get_current_arch (), address, condition, thread,
+			 0	/* condition and thread are valid */,
+			 temp,
+			 0	/* hardware flag */,
+			 0	/* trace flag */,
+			 ignore_count,
+			 (pending ? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE),
+			 NULL	/* breakpoint ops */,
+			 0	/* from_tty */,
+			 enabled);
     }
 
   if (e.reason < 0)
@@ -642,13 +665,9 @@ static int
 gdb_actions_command (ClientData clientData, Tcl_Interp *interp,
 		     int objc, Tcl_Obj *CONST objv[])
 {
+  char *number;
   struct breakpoint *tp;
-  Tcl_Obj **actions;
-  int nactions, i, len;
-  char *number, *args, *action;
-  long step_count;
-  struct action_line *next = NULL, *temp;
-  enum actionline_type linetype;
+  struct command_line *commands;
 
   if (objc != 3)
     {
@@ -656,8 +675,8 @@ gdb_actions_command (ClientData clientDa
       return TCL_ERROR;
     }
 
-  args = number = Tcl_GetStringFromObj (objv[1], NULL);
-  tp = get_tracepoint_by_number (&args, 0, 0);
+  number = Tcl_GetStringFromObj (objv[1], NULL);
+  tp = get_tracepoint_by_number (&number, 0, 0);
   if (tp == NULL)
     {
       Tcl_AppendStringsToObj (result_ptr->obj_ptr, "Tracepoint \"",
@@ -665,42 +684,17 @@ gdb_actions_command (ClientData clientDa
       return TCL_ERROR;
     }
 
-  /* Free any existing actions */
-  if (tp->actions != NULL)
-    free_actions (tp);
-
-  step_count = 0;
-
-  Tcl_ListObjGetElements (interp, objv[2], &nactions, &actions);
-
-  /* Add the actions to the tracepoint */
-  for (i = 0; i < nactions; i++)
-    {
-      temp = xmalloc (sizeof (struct action_line));
-      temp->next = NULL;
-      action = Tcl_GetStringFromObj (actions[i], &len);
-      temp->action = savestring (action, len);
-
-      linetype = validate_actionline (&(temp->action), tp);
+  /* Free any existing actions.  */
+  free_command_lines (&tp->commands);
 
-      if (linetype == BADLINE)
-	{
-	  free (temp);
-	  continue;
-	}
-
-      if (next == NULL)
-	{
-	  tp->actions = temp;
-	  next = temp;
-	}
-      else
-	{
-	  next->next = temp;
-	  next = temp;
-	}
-    }
+  /* Validate and set new tracepoint actions.  */
+  Tcl_ListObjGetElements (interp, objv[2], &gdbtk_obj_array_cnt,
+			  &gdbtk_obj_array);
+  gdbtk_obj_array_ptr = 1;
+  commands = read_command_lines_1 (gdbtk_read_next_line, 1,
+				   check_tracepoint_command, tp);  
 
+  breakpoint_set_commands (tp, commands);
   return TCL_OK;
 }
 
@@ -726,7 +720,7 @@ gdb_get_tracepoint_info (ClientData clie
   struct symtab_and_line sal;
   int tpnum;
   struct breakpoint *tp;
-  struct action_line *al;
+  struct command_line *cl;
   Tcl_Obj *action_list;
   char *filename, *funcname;
 
@@ -779,10 +773,10 @@ gdb_get_tracepoint_info (ClientData clie
 
   /* Append a list of actions */
   action_list = Tcl_NewObj ();
-  for (al = tp->actions; al != NULL; al = al->next)
+  for (cl = tp->commands; cl != NULL; cl = cl->next)
     {
       Tcl_ListObjAppendElement (interp, action_list,
-				Tcl_NewStringObj (al->action, -1));
+				Tcl_NewStringObj (cl->line, -1));
     }
   Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr, action_list);
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-03-24 20:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-25  7:07 [PATCH] Update recent breakpoint build failures Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).