public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* [RFA] ARI fix: remove xasprintf uses
@ 2009-03-25 23:08 Pierre Muller
  2009-03-25 23:12 ` Keith Seitz
  2009-03-25 23:16 ` Pedro Alves
  0 siblings, 2 replies; 6+ messages in thread
From: Pierre Muller @ 2009-03-25 23:08 UTC (permalink / raw)
  To: gdb-patches, insight

  This is a rather mechanical patch for which I
seek acceptance, because I don't know if the obvious rules
that exist for gdb also apply for insight.

  The idea afterwards would be to 
obsolete xasprintf function by renaming 
it deprecated_xasprintf, no?

  Is this OK to commit?


Pierre Muller
Pascal language support maintainer for GDB

gdb/gdbtk ChangeLog entry:

2009-03-25  Pierre Muller  <muller@ics.u-strasbg.fr>

	ARI fix: "xasprintf" rule.
	* generic/gdbtk-bp.c (gdb_set_bp): Replace xasprintf by xstrprintf.
	(breakpoint_notify, tracepoint_notify):Ditto.
	* generic/gdbtk-cmds.c (gdbtk_load_source, gdbtk_load_asm):Ditto.
	* generic/gdbtk-hooks.c (gdbtk_ignorable_warning): Ditto.
	(gdbtk_set_hook, gdbtk_load_hash): Ditto.
	(gdbtk_selected_frame_changed, gdbtk_annotate_signal): Ditto.
	* generic/gdbtk-register.c (get_register_types):Ditto.
	* generic/gdbtk-stack.c (gdb_get_blocks): Ditto.
	(gdb_selected_block, gdb_selected_frame): Ditto.
	* generic/gdbtk.c (gdbtk_init, view_command): Ditto.



Index: gdb/gdbtk/generic/gdbtk-bp.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-bp.c,v
retrieving revision 1.28
diff -u -p -r1.28 gdbtk-bp.c
--- gdb/gdbtk/generic/gdbtk-bp.c	19 Sep 2008 07:23:17 -0000	1.28
+++ gdb/gdbtk/generic/gdbtk-bp.c	25 Mar 2009 22:45:03 -0000
@@ -552,7 +552,7 @@ gdb_set_bp (ClientData clientData, Tcl_I
   b->thread = thread;
 
   /* FIXME: this won't work for duplicate basenames! */
-  xasprintf (&buf, "%s:%d", lbasename (Tcl_GetStringFromObj (objv[1],
NULL)),
+  buf = xstrprintf ("%s:%d", lbasename (Tcl_GetStringFromObj (objv[1],
NULL)),
 	     line);
   b->addr_string = xstrdup (buf);
   free(buf);
@@ -706,7 +706,7 @@ breakpoint_notify (int num, const char *
 
   /* We ensure that ACTION contains no special Tcl characters, so we
      can do this.  */
-  xasprintf (&buf, "gdbtk_tcl_breakpoint %s %d", action, num);
+  buf = xstrprintf ("gdbtk_tcl_breakpoint %s %d", action, num);
 
   if (Tcl_Eval (gdbtk_interp, buf) != TCL_OK)
     report_error ();
@@ -1004,7 +1004,7 @@ tracepoint_notify (int num, const char *
 
   /* We ensure that ACTION contains no special Tcl characters, so we
      can do this.  */
-  xasprintf (&buf, "gdbtk_tcl_tracepoint %s %d", action, num);
+  buf = xstrprintf ("gdbtk_tcl_tracepoint %s %d", action, num);
 
   if (Tcl_Eval (gdbtk_interp, buf) != TCL_OK)
     report_error ();
Index: gdb/gdbtk/generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.106
diff -u -p -r1.106 gdbtk-cmds.c
--- gdb/gdbtk/generic/gdbtk-cmds.c	15 Dec 2008 18:06:12 -0000
1.106
+++ gdb/gdbtk/generic/gdbtk-cmds.c	25 Mar 2009 22:45:04 -0000
@@ -1811,7 +1811,7 @@ gdbtk_load_source (ClientData clientData
 	      /* FIXME: Convert to Tcl_SetVar2Ex when we move to 8.2.  This
 		 will allow us avoid converting widget_line_no into a
string. */
 	      
-	      xasprintf (&buffer, "%d", client_data->widget_line_no);
+	      buffer = xstrprintf ("%d", client_data->widget_line_no);
 	      
 	      Tcl_SetVar2 (client_data->interp, client_data->map_arr,
 			   Tcl_DStringValue
(&client_data->src_to_line_prefix),
@@ -1927,7 +1927,7 @@ gdbtk_load_asm (ClientData clientData, C
       /* FIXME: Convert to Tcl_SetVar2Ex when we move to 8.2.  This
 	 will allow us avoid converting widget_line_no into a string. */
       
-      xasprintf (&buffer, "%d", client_data->widget_line_no);
+      buffer = xstrprintf ("%d", client_data->widget_line_no);
       
       Tcl_SetVar2 (client_data->interp, client_data->map_arr,
 		   Tcl_DStringValue (&client_data->pc_to_line_prefix),
Index: gdb/gdbtk/generic/gdbtk-hooks.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-hooks.c,v
retrieving revision 1.46
diff -u -p -r1.46 gdbtk-hooks.c
--- gdb/gdbtk/generic/gdbtk-hooks.c	18 Sep 2008 18:28:45 -0000	1.46
+++ gdb/gdbtk/generic/gdbtk-hooks.c	25 Mar 2009 22:45:04 -0000
@@ -379,7 +379,7 @@ void
 gdbtk_ignorable_warning (const char *class, const char *warning)
 {
   char *buf;
-  xasprintf (&buf, "gdbtk_tcl_ignorable_warning {%s} {%s}", class,
warning);
+  buf = xstrprintf ("gdbtk_tcl_ignorable_warning {%s} {%s}", class,
warning);
   if (Tcl_Eval (gdbtk_interp, buf) != TCL_OK)
     report_error ();
   free(buf);
@@ -599,12 +599,12 @@ gdbtk_set_hook (struct cmd_list_element 
 
     case var_uinteger:
     case var_zinteger:
-      xasprintf (&buffer, "%u", *(unsigned int *) cmdblk->var);
+      buffer = xstrprintf ("%u", *(unsigned int *) cmdblk->var);
       Tcl_DStringAppendElement (&cmd, buffer);
       break;
 
     case var_integer:
-      xasprintf (&buffer, "%d", *(int *) cmdblk->var);
+      buffer = xstrprintf ("%d", *(int *) cmdblk->var);
       Tcl_DStringAppendElement (&cmd, buffer);
       break;
 
@@ -629,7 +629,7 @@ int
 gdbtk_load_hash (const char *section, unsigned long num)
 {
   char *buf;
-  xasprintf (&buf, "Download::download_hash %s %ld", section, num);
+  buf = xstrprintf ("Download::download_hash %s %ld", section, num);
   if (Tcl_Eval (gdbtk_interp, buf) != TCL_OK)
     report_error ();
   free(buf);
@@ -753,7 +753,7 @@ gdbtk_selected_frame_changed (int level)
 {
 #if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 1
   char *a;
-  xasprintf (&a, "%d", level);
+  a = xstrprintf ("%d", level);
   Tcl_SetVar (gdbtk_interp, "gdb_selected_frame_level", a,
TCL_GLOBAL_ONLY);
   xfree (a);
 #else
@@ -806,7 +806,7 @@ gdbtk_annotate_signal (void)
      timeout. */
   Tcl_Eval (gdbtk_interp, "gdbtk_stop_idle_callback");
 
-  xasprintf (&buf, "gdbtk_signal %s {%s}",
+  buf = xstrprintf ("gdbtk_signal %s {%s}",
 	     target_signal_to_name (tp->stop_signal),
 	     target_signal_to_string (tp->stop_signal));
   if (Tcl_Eval (gdbtk_interp, buf) != TCL_OK)
Index: gdb/gdbtk/generic/gdbtk-register.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-register.c,v
retrieving revision 1.36
diff -u -p -r1.36 gdbtk-register.c
--- gdb/gdbtk/generic/gdbtk-register.c	15 Dec 2008 18:06:12 -0000	1.36
+++ gdb/gdbtk/generic/gdbtk-register.c	25 Mar 2009 22:45:05 -0000
@@ -237,7 +237,7 @@ get_register_types (int regnum, map_arg 
 	{
 	  Tcl_Obj *ar[3], *list;
 	  char *buff;
-	  xasprintf (&buff, "%lx", (long)TYPE_FIELD_TYPE (reg_vtype, i));
+	  buff = xstrprintf ("%lx", (long)TYPE_FIELD_TYPE (reg_vtype, i));
 	  ar[0] = Tcl_NewStringObj (TYPE_FIELD_NAME (reg_vtype, i), -1);
 	  ar[1] = Tcl_NewStringObj (buff, -1);
 	  if (TYPE_CODE (TYPE_FIELD_TYPE (reg_vtype, i)) == TYPE_CODE_FLT)
@@ -253,7 +253,7 @@ get_register_types (int regnum, map_arg 
     {
       Tcl_Obj *ar[3], *list;
       char *buff;
-      xasprintf (&buff, "%lx", (long)reg_vtype);
+      buff = xstrprintf ("%lx", (long)reg_vtype);
       ar[0] = Tcl_NewStringObj (TYPE_NAME(reg_vtype), -1);
       ar[1] = Tcl_NewStringObj (buff, -1);
       if (TYPE_CODE (reg_vtype) == TYPE_CODE_FLT)
Index: gdb/gdbtk/generic/gdbtk-stack.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-stack.c,v
retrieving revision 1.32
diff -u -p -r1.32 gdbtk-stack.c
--- gdb/gdbtk/generic/gdbtk-stack.c	2 Mar 2009 22:44:33 -0000	1.32
+++ gdb/gdbtk/generic/gdbtk-stack.c	25 Mar 2009 22:45:05 -0000
@@ -211,11 +211,11 @@ gdb_get_blocks (ClientData clientData, T
 	      char *addr;
 
 	      Tcl_Obj *elt = Tcl_NewListObj (0, NULL);
-	      xasprintf (&addr, "0x%s", paddr_nz (BLOCK_START (block)));
+	      addr = xstrprintf ("0x%s", paddr_nz (BLOCK_START (block)));
 	      Tcl_ListObjAppendElement (interp, elt,
 					Tcl_NewStringObj (addr, -1));
 	      free(addr);
-	      xasprintf (&addr, "0x%s", paddr_nz (BLOCK_END (block)));
+	      addr = xstrprintf ("0x%s", paddr_nz (BLOCK_END (block)));
 	      Tcl_ListObjAppendElement (interp, elt,
 					Tcl_NewStringObj (addr, -1));
 	      Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr, elt);
@@ -377,15 +377,15 @@ gdb_selected_block (ClientData clientDat
 
   if (!target_has_registers)
     {
-      xasprintf (&start, "%s", "");
-      xasprintf (&end, "%s", "");
+      start = xstrprintf ("%s", "");
+      end = xstrprintf ("%s", "");
     }
   else
     {
       struct block *block;
       block = get_frame_block (get_selected_frame (NULL), 0);
-      xasprintf (&start, "0x%s", paddr_nz (BLOCK_START (block)));
-      xasprintf (&end, "0x%s", paddr_nz (BLOCK_END (block)));
+      start = xstrprintf ("0x%s", paddr_nz (BLOCK_START (block)));
+      end = xstrprintf ("0x%s", paddr_nz (BLOCK_END (block)));
     }
 
   Tcl_SetListObj (result_ptr->obj_ptr, 0, NULL);
@@ -416,11 +416,11 @@ gdb_selected_frame (ClientData clientDat
   char *frame;
 
   if (!target_has_registers)
-    xasprintf (&frame, "%s","");
+    frame = xstrprintf ("%s","");
   else
     /* FIXME: cagney/2002-11-19: This should be using get_frame_id()
        to identify the frame and *NOT* get_frame_base().  */
-    xasprintf (&frame, "0x%s",
+    frame = xstrprintf ("0x%s",
 	       paddr_nz (get_frame_base (get_selected_frame (NULL))));
 
   Tcl_SetStringObj (result_ptr->obj_ptr, frame, -1);
Index: gdb/gdbtk/generic/gdbtk.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk.c,v
retrieving revision 1.47
diff -u -p -r1.47 gdbtk.c
--- gdb/gdbtk/generic/gdbtk.c	2 Aug 2008 22:08:32 -0000	1.47
+++ gdb/gdbtk/generic/gdbtk.c	25 Mar 2009 22:45:05 -0000
@@ -385,7 +385,7 @@ gdbtk_init (void)
 
   /* Set up some globals used by gdb to pass info to gdbtk
      for start up options and the like */
-  xasprintf (&s, "%d", inhibit_gdbinit);
+  s = xstrprintf ("%d", inhibit_gdbinit);
   Tcl_SetVar2 (gdbtk_interp, "GDBStartup", "inhibit_prefs", s,
TCL_GLOBAL_ONLY);
   free(s);
    
@@ -758,7 +758,7 @@ view_command (char *args, int from_tty)
 
   if (args != NULL)
     {
-      xasprintf (&script,
+      script = xstrprintf (
 		 "[lindex [ManagedWin::find SrcWin] 0] location BROWSE_TAG
[gdb_loc %s]",
 		 args);
       old_chain = make_cleanup (xfree, script);

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

* Re: [RFA] ARI fix: remove xasprintf uses
  2009-03-25 23:08 [RFA] ARI fix: remove xasprintf uses Pierre Muller
@ 2009-03-25 23:12 ` Keith Seitz
  2009-03-25 23:45   ` Pierre Muller
  2009-03-25 23:16 ` Pedro Alves
  1 sibling, 1 reply; 6+ messages in thread
From: Keith Seitz @ 2009-03-25 23:12 UTC (permalink / raw)
  To: Pierre Muller; +Cc: insight

Pierre Muller wrote:
>   This is a rather mechanical patch for which I
> seek acceptance, because I don't know if the obvious rules
> that exist for gdb also apply for insight.

I treat it the same way... I saw your patch on gdb-patches, and I was 
about to make the necessary changes myself, but it looks like you beat 
me to it: Thanks!

>   Is this OK to commit?

Absolutely!

Keith

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

* Re: [RFA] ARI fix: remove xasprintf uses
  2009-03-25 23:08 [RFA] ARI fix: remove xasprintf uses Pierre Muller
  2009-03-25 23:12 ` Keith Seitz
@ 2009-03-25 23:16 ` Pedro Alves
  1 sibling, 0 replies; 6+ messages in thread
From: Pedro Alves @ 2009-03-25 23:16 UTC (permalink / raw)
  To: gdb-patches; +Cc: Pierre Muller, insight

On Wednesday 25 March 2009 23:08:12, Pierre Muller wrote:
>   The idea afterwards would be to 
> obsolete xasprintf function by renaming 
> it deprecated_xasprintf, no?

If nobody's using xasprintf afterwards, just delete it.

-- 
Pedro Alves

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

* RE: [RFA] ARI fix: remove xasprintf uses
  2009-03-25 23:12 ` Keith Seitz
@ 2009-03-25 23:45   ` Pierre Muller
  2009-03-25 23:48     ` Keith Seitz
  0 siblings, 1 reply; 6+ messages in thread
From: Pierre Muller @ 2009-03-25 23:45 UTC (permalink / raw)
  To: 'Keith Seitz'; +Cc: insight

I checked that it still compiled and committed this,
but I tried to run insight compiled on cygwin,
and it doesn't seem to really start :(

Pierre

> -----Message d'origine-----
> De : insight-owner@sourceware.org [mailto:insight-owner@sourceware.org]
> De la part de Keith Seitz
> Envoyé : Thursday, March 26, 2009 12:12 AM
> À : Pierre Muller
> Cc : insight@sourceware.org
> Objet : Re: [RFA] ARI fix: remove xasprintf uses
> 
> Pierre Muller wrote:
> >   This is a rather mechanical patch for which I
> > seek acceptance, because I don't know if the obvious rules
> > that exist for gdb also apply for insight.
> 
> I treat it the same way... I saw your patch on gdb-patches, and I was
> about to make the necessary changes myself, but it looks like you beat
> me to it: Thanks!
> 
> >   Is this OK to commit?
> 
> Absolutely!
> 
> Keith

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

* Re: [RFA] ARI fix: remove xasprintf uses
  2009-03-25 23:45   ` Pierre Muller
@ 2009-03-25 23:48     ` Keith Seitz
  2009-03-26 16:33       ` Keith Seitz
  0 siblings, 1 reply; 6+ messages in thread
From: Keith Seitz @ 2009-03-25 23:48 UTC (permalink / raw)
  To: Pierre Muller; +Cc: insight

Pierre Muller wrote:
> I checked that it still compiled and committed this,
> but I tried to run insight compiled on cygwin,
> and it doesn't seem to really start :(

I'll take a look and see what I can come up with.

Keith

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

* Re: [RFA] ARI fix: remove xasprintf uses
  2009-03-25 23:48     ` Keith Seitz
@ 2009-03-26 16:33       ` Keith Seitz
  0 siblings, 0 replies; 6+ messages in thread
From: Keith Seitz @ 2009-03-26 16:33 UTC (permalink / raw)
  To: Pierre Muller; +Cc: insight

Keith Seitz wrote:
> Pierre Muller wrote:
>> I checked that it still compiled and committed this,
>> but I tried to run insight compiled on cygwin,
>> and it doesn't seem to really start :(
> 
> I'll take a look and see what I can come up with.

So I had my cygwin box build insight overnight (hey, it's an old 500MHz 
Pentium 3!), and, well, I really HATE to say this, but once again, "it 
works for me". I debugged gdb on it for a little while.

I used the in-tree copies of Tcl/Tk/Itcl. I checked the whole thing out 
immediately prior to build from CVS HEAD. I also updated my cygwin 
installation right before that.

What kind of problems are you having? [I wonder if I should just make my 
cygwin build available on the download page. Does sourceware.org allow 
that?]

Keith

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

end of thread, other threads:[~2009-03-26 16:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-25 23:08 [RFA] ARI fix: remove xasprintf uses Pierre Muller
2009-03-25 23:12 ` Keith Seitz
2009-03-25 23:45   ` Pierre Muller
2009-03-25 23:48     ` Keith Seitz
2009-03-26 16:33       ` Keith Seitz
2009-03-25 23:16 ` Pedro Alves

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