public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Recent GDB prompt/bp API updates
@ 2011-08-01 22:10 Keith Seitz
  2011-08-02 18:50 ` Keith Seitz
  0 siblings, 1 reply; 3+ messages in thread
From: Keith Seitz @ 2011-08-01 22:10 UTC (permalink / raw)
  To: insight

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

Hi,

I've committed the attached patch which fixes some new build failures 
resulting from API updates in gdb.

If there are any problems, please let me know.

Keith

ChangeLog
2011-08-01  Keith Seitz  <keiths@redhat.com>

	* generic/gdbtk-bp.c (BREAKPOINT_IS_WATCHPOINT): Remove.
	(gdb_get_breakpoint_info): Update with recent GDB API changes.
	(gdb_actions_command): Likewise.
	(gdb_get_tracepoint_info): Likewise.
	(breakpoint_notify): Use get_breakpoint.

	* generic/gdbtk-cmds.c (gdb_prompt_command): Update with recent
	GDB API changes.

[-- Attachment #2: gdb-api-updates.patch --]
[-- Type: text/plain, Size: 6705 bytes --]

Index: generic/gdbtk-bp.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-bp.c,v
retrieving revision 1.41
diff -u -p -r1.41 gdbtk-bp.c
--- generic/gdbtk-bp.c	13 May 2011 00:36:26 -0000	1.41
+++ generic/gdbtk-bp.c	1 Aug 2011 22:07:03 -0000
@@ -73,13 +73,6 @@ char *bpdisp[] =
  || (bp)->type == bp_read_watchpoint     \
  || (bp)->type == bp_access_watchpoint)
 
-/* Is this breakpoint a watchpoint?  */
-#define BREAKPOINT_IS_WATCHPOINT(bp)					      \
-((bp)->type == bp_watchpoint						      \
- || (bp)->type == bp_hardware_watchpoint				      \
- || (bp)->type == bp_read_watchpoint					      \
- || (bp)->type == bp_access_watchpoint)
-
 /*
  * Forward declarations
  */
@@ -287,6 +280,7 @@ gdb_get_breakpoint_info (ClientData clie
   struct symtab_and_line sal;
   int bpnum;
   struct breakpoint *b;
+  struct watchpoint *w;
   char *funcname, *filename;
   int isPending = 0;
 
@@ -304,17 +298,15 @@ gdb_get_breakpoint_info (ClientData clie
       return TCL_ERROR;
     }
 
-  ALL_BREAKPOINTS (b)
-  {
-    if (b->number == bpnum)
-      break;
-  }
+  b = get_breakpoint (bpnum);
   if (!b || b->type != bp_breakpoint)
     {
       gdbtk_set_result (interp, "Breakpoint #%d does not exist.", bpnum);
       return TCL_ERROR;
     }
 
+  w = (is_watchpoint (b)) ? (struct watchpoint *) b : NULL;
+
   isPending = (b->loc == NULL);
   Tcl_SetListObj (result_ptr->obj_ptr, 0, NULL);
   /* Pending breakpoints will display "<PENDING>" as the file name and the 
@@ -371,8 +363,7 @@ gdb_get_breakpoint_info (ClientData clie
 			    Tcl_NewIntObj (b->hit_count));
 
   Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,
-			    Tcl_NewStringObj (BREAKPOINT_IS_WATCHPOINT (b)
-					      ? b->exp_string
+			    Tcl_NewStringObj (w ? w->exp_string
 					      : b->addr_string, -1));
 
   return TCL_OK;
@@ -604,11 +595,7 @@ breakpoint_notify (int num, const char *
   char *buf;
   struct breakpoint *b;
 
-  ALL_BREAKPOINTS (b)
-  {
-    if (num == b->number)
-      break;
-  }
+  b = get_breakpoint (num);
 
   if (b->number < 0
       /* FIXME: should not be so restrictive... */
@@ -642,8 +629,8 @@ static int
 gdb_actions_command (ClientData clientData, Tcl_Interp *interp,
 		     int objc, Tcl_Obj *CONST objv[])
 {
-  char *number;
-  struct breakpoint *tp;
+  int tpnum;
+  struct tracepoint *tp;
   struct command_line *commands;
 
   if (objc != 3)
@@ -652,12 +639,17 @@ gdb_actions_command (ClientData clientDa
       return TCL_ERROR;
     }
 
-  number = Tcl_GetStringFromObj (objv[1], NULL);
-  tp = get_tracepoint_by_number (&number, 0, 0);
+  if (Tcl_GetIntFromObj (NULL, objv[1], &tpnum) != TCL_OK)
+    {
+      result_ptr->flags |= GDBTK_IN_TCL_RESULT;
+      return TCL_ERROR;
+    }
+
+  tp = get_tracepoint (tpnum);
+
   if (tp == NULL)
     {
-      Tcl_AppendStringsToObj (result_ptr->obj_ptr, "Tracepoint \"",
-			      number, "\" does not exist", NULL);
+      gdbtk_set_result (interp, "Tracepoint #%d does not exist", tpnum);
       return TCL_ERROR;
     }
 
@@ -668,7 +660,7 @@ gdb_actions_command (ClientData clientDa
   commands = read_command_lines_1 (gdbtk_read_next_line, 1,
 				   check_tracepoint_command, tp);  
 
-  breakpoint_set_commands (tp, commands);
+  breakpoint_set_commands ((struct breakpoint *) tp, commands);
   return TCL_OK;
 }
 
@@ -693,7 +685,8 @@ gdb_get_tracepoint_info (ClientData clie
 {
   struct symtab_and_line sal;
   int tpnum;
-  struct breakpoint *tp;
+  struct tracepoint *tp;
+  struct breakpoint *bp;
   struct command_line *cl;
   Tcl_Obj *action_list;
   char *filename, *funcname;
@@ -711,7 +704,7 @@ gdb_get_tracepoint_info (ClientData clie
     }
 
   tp = get_tracepoint (tpnum);
-
+  bp = (struct breakpoint *) tp;
   if (tp == NULL)
     {
       gdbtk_set_result (interp, "Tracepoint #%d does not exist", tpnum);
@@ -719,37 +712,37 @@ gdb_get_tracepoint_info (ClientData clie
     }
 
   Tcl_SetListObj (result_ptr->obj_ptr, 0, NULL);
-  sal = find_pc_line (tp->loc->address, 0);
+  sal = find_pc_line (bp->loc->address, 0);
   filename = symtab_to_filename (sal.symtab);
   if (filename == NULL)
     filename = "N/A";
   Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr,
 			    Tcl_NewStringObj (filename, -1));
 
-  funcname = pc_function_name (tp->loc->address);
+  funcname = pc_function_name (bp->loc->address);
   Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr, Tcl_NewStringObj
 			    (funcname, -1));
 
   Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr,
 			    Tcl_NewIntObj (sal.line));
   Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr,
-			    Tcl_NewStringObj (core_addr_to_string (tp->loc->address), -1));
+			    Tcl_NewStringObj (core_addr_to_string (bp->loc->address), -1));
   Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr,
-			    Tcl_NewIntObj (tp->enable_state == bp_enabled));
+			    Tcl_NewIntObj (bp->enable_state == bp_enabled));
   Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr,
 			    Tcl_NewIntObj (tp->pass_count));
   Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr,
 			    Tcl_NewIntObj (tp->step_count));
   Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr,
-			    Tcl_NewIntObj (tp->thread));
+			    Tcl_NewIntObj (bp->thread));
   Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr,
-			    Tcl_NewIntObj (tp->hit_count));
+			    Tcl_NewIntObj (bp->hit_count));
 
   /* Append a list of actions */
   action_list = Tcl_NewObj ();
-  if (tp->commands != NULL)
+  if (bp->commands != NULL)
     {
-      for (cl = breakpoint_commands (tp); cl != NULL; cl = cl->next)
+      for (cl = breakpoint_commands (bp); cl != NULL; cl = cl->next)
 	{
 	  Tcl_ListObjAppendElement (interp, action_list,
 				    Tcl_NewStringObj (cl->line, -1));
Index: generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.120
diff -u -p -r1.120 gdbtk-cmds.c
--- generic/gdbtk-cmds.c	12 Apr 2011 05:11:08 -0000	1.120
+++ generic/gdbtk-cmds.c	1 Aug 2011 22:07:06 -0000
@@ -224,7 +224,6 @@ static int gdb_disassemble_driver (CORE_
 							      struct
 							      disassemble_info
 							      *));
-char *get_prompt (void);
 static int perror_with_name_wrapper (PTR args);
 static int wrapped_call (PTR opaque_args);
 static int hex2bin (const char *hex, char *bin, int count);
@@ -794,7 +793,7 @@ static int
 gdb_prompt_command (ClientData clientData, Tcl_Interp *interp,
 		    int objc, Tcl_Obj *CONST objv[])
 {
-  Tcl_SetStringObj (result_ptr->obj_ptr, get_prompt (), -1);
+  Tcl_SetStringObj (result_ptr->obj_ptr, get_prompt (0), -1);
   return TCL_OK;
 }
 \f

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

* Re: [PATCH] Recent GDB prompt/bp API updates
  2011-08-01 22:10 [PATCH] Recent GDB prompt/bp API updates Keith Seitz
@ 2011-08-02 18:50 ` Keith Seitz
  2011-08-11 10:31   ` Dave Murphy
  0 siblings, 1 reply; 3+ messages in thread
From: Keith Seitz @ 2011-08-02 18:50 UTC (permalink / raw)
  To: insight

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

On 08/01/2011 03:10 PM, Keith Seitz wrote:
> If there are any problems, please let me know.

There was a problem: breakpoints could not be set through the Source 
Window. I have committed the attach patch to correct this.

Keith

ChangeLog
2011-08-02  Keith Seitz  <keiths@redhat.com>

	* generic/gdbtk-bp.c (gdb_set_bp): Pass a valid breakpoint_ops
	to create_breakpoint.

[-- Attachment #2: breakpoint_ops.patch --]
[-- Type: text/plain, Size: 587 bytes --]

Index: generic/gdbtk-bp.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-bp.c,v
retrieving revision 1.42
diff -u -p -r1.42 gdbtk-bp.c
--- generic/gdbtk-bp.c	1 Aug 2011 22:08:20 -0000	1.42
+++ generic/gdbtk-bp.c	2 Aug 2011 18:05:04 -0000
@@ -540,7 +540,7 @@ gdb_set_bp (ClientData clientData, Tcl_I
 			 bp_breakpoint /* type wanted */,
 			 ignore_count,
 			 (pending ? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE),
-			 NULL	/* breakpoint ops */,
+			 &bkpt_breakpoint_ops,
 			 0	/* from_tty */,
 			 enabled, 0);
     }

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

* Re: [PATCH] Recent GDB prompt/bp API updates
  2011-08-02 18:50 ` Keith Seitz
@ 2011-08-11 10:31   ` Dave Murphy
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Murphy @ 2011-08-11 10:31 UTC (permalink / raw)
  To: Keith Seitz; +Cc: insight

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

On Tue, Aug 2, 2011 at 7:49 PM, Keith Seitz <keiths@redhat.com> wrote:
> On 08/01/2011 03:10 PM, Keith Seitz wrote:
>>
>> If there are any problems, please let me know.
>
> There was a problem: breakpoints could not be set through the Source Window.
> I have committed the attach patch to correct this.

>        * generic/gdbtk-bp.c (gdb_set_bp): Pass a valid breakpoint_ops
>        to create_breakpoint.

I see this change in CVS but a build of insight under msys/mingw still
can't seem to set breakpoints from the source window - this is for an
arm-eabi target if it makes any difference. Setting a breakpoint from
the console shows the red box in the source window and it can be
disabled from there just fine.

Also, oddly, some patching is needed to build with mingw/msys again
which I could have sworn was fixed some time ago. The patch is pretty
minor though. There's also a patch to config/tcl.m4 needed as well
which needs gdb/configure & gdb/gdbtk/plugins/configure regenerated -
does that belong to Insight or gdb? I've attached it here too.

2011-08-11  Dave Murphy  <davem@devkitpro.org>
       * libgui/configure.ac:  add mingw to win32 hosts
       * libgui/configure:     regenerate
       * tcl/win/tclWinChan.c  mark ESP/EBP as used
       * tcl/win/tclWinDde.c (Tcl_DdeObjCmd):  remove invalid lvalue cast

[-- Attachment #2: insight-mingw.patch --]
[-- Type: application/octet-stream, Size: 1918 bytes --]

Index: libgui/configure.ac
===================================================================
RCS file: /cvs/src/src/libgui/configure.ac,v
retrieving revision 1.4
diff -u -r1.4 configure.ac
--- libgui/configure.ac	2 Aug 2008 23:33:36 -0000	1.4
+++ libgui/configure.ac	11 Aug 2011 09:21:58 -0000
@@ -53,7 +53,7 @@
 fi
 
 case "${host}" in
-*-*-cygwin*)
+*-*-cygwin*|*-*-mingw*)
         touch ac$$.c
         if ${CC} -c -mwin32 ac$$.c >/dev/null 2>&1; then
             case "$LIBGUI_CFLAGS" in
@@ -65,7 +65,7 @@
         ;;
 esac
 case "${host}" in
-*-*-cygwin*)
+*-*-cygwin*|*-*-mingw*)
 	LIBGUI_CFLAGS="-DWIN32 $LIBGUI_CFLAGS" ;;
 esac
 AC_SUBST(LIBGUI_CFLAGS) 
@@ -93,7 +93,7 @@
 if test "${TCL_SRC_DIR}" = "${topdir}/tcl"; then
   # Using in-tree Tcl/Tk
   case "${host}" in
-    *-*-cygwin*) platDir="win" ;;
+    *-*-cygwin*|*-*-mingw*) platDir="win" ;;
     *) platDir="unix" ;;
   esac
 
Index: tcl/win/tclWinChan.c
===================================================================
RCS file: /cvs/src/src/tcl/win/tclWinChan.c,v
retrieving revision 1.6
diff -u -r1.6 tclWinChan.c
--- tcl/win/tclWinChan.c	2 Feb 2006 20:02:09 -0000	1.6
+++ tcl/win/tclWinChan.c	11 Aug 2011 09:22:06 -0000
@@ -122,8 +122,8 @@
 };
 
 #ifdef HAVE_NO_SEH
-static void *ESP;
-static void *EBP;
+static void *ESP __attribute__((used));
+static void *EBP __attribute__((used));
 #endif /* HAVE_NO_SEH */
 
 \f
Index: tcl/win/tclWinDde.c
===================================================================
RCS file: /cvs/src/src/tcl/win/tclWinDde.c,v
retrieving revision 1.5
diff -u -r1.5 tclWinDde.c
--- tcl/win/tclWinDde.c	21 Jan 2003 19:40:22 -0000	1.5
+++ tcl/win/tclWinDde.c	11 Aug 2011 09:22:06 -0000
@@ -1175,7 +1175,7 @@
 	}
 	case DDE_EVAL: {
 	    objc -= (async + 3);
-	    ((Tcl_Obj **) objv) += (async + 3);
+        objv += (async + 3);
 
             /*
 	     * See if the target interpreter is local.  If so, execute

[-- Attachment #3: tcl.m4.patch --]
[-- Type: application/octet-stream, Size: 775 bytes --]

Index: config/tcl.m4
===================================================================
RCS file: /cvs/src/src/config/tcl.m4,v
retrieving revision 1.3
diff -u -r1.3 tcl.m4
--- config/tcl.m4	2 Feb 2009 23:18:05 -0000	1.3
+++ config/tcl.m4	11 Aug 2011 10:24:29 -0000
@@ -33,7 +33,7 @@
 
 	    # First check to see if --with-tcl was specified.
 	    case "${host}" in
-		*-*-cygwin*) platDir="win" ;;
+		*-*-cygwin*|*-*-mingw*) platDir="win" ;;
 		*) platDir="unix" ;;
 	    esac
 	    if test x"${with_tclconfig}" != x ; then
@@ -165,7 +165,7 @@
 
 	    # then check for a private Tk library
 	    case "${host}" in
-		*-*-cygwin*) platDir="win" ;;
+		*-*-cygwin*|*-*-mingw*) platDir="win" ;;
 		*) platDir="unix" ;;
 	    esac
 	    if test x"${ac_cv_c_tkconfig}" = x ; then

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

end of thread, other threads:[~2011-08-11 10:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-01 22:10 [PATCH] Recent GDB prompt/bp API updates Keith Seitz
2011-08-02 18:50 ` Keith Seitz
2011-08-11 10:31   ` Dave Murphy

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).