public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* [patch] gdb_eval cleanup
@ 2002-05-15 16:40 Martin M. Hunt
  2002-05-15 16:43 ` Keith Seitz
  0 siblings, 1 reply; 2+ messages in thread
From: Martin M. Hunt @ 2002-05-15 16:40 UTC (permalink / raw)
  To: insight

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

I checked in this simple patch to delete the mem_file and free allocated 
memory in gdb_eval().

-- 
Martin Hunt
GDB Engineer
Red Hat, Inc.

2002-05-15  Martin M. Hunt  <hunt@redhat.com>

	* generic/gdbtk-cmds.c (gdb_eval): For mem_file stuff, delete
	the file when done and free memory.

[-- Attachment #2: p1 --]
[-- Type: text/x-diff, Size: 996 bytes --]

Index: generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.37
diff -u -u -r1.37 gdbtk-cmds.c
--- gdbtk-cmds.c	2002/04/05 23:31:58	1.37
+++ gdbtk-cmds.c	2002/05/15 23:20:44
@@ -622,6 +622,7 @@
   value_ptr val;
   struct ui_file *stb;
   long dummy;
+  char *result;
 
   if (objc != 2 && objc != 3)
     {
@@ -638,10 +639,13 @@
 
   /* "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, format, 0, 0, 0);
-  Tcl_SetObjResult (interp, Tcl_NewStringObj (ui_file_xstrdup (stb, &dummy), -1));
+  result = ui_file_xstrdup (stb, &dummy);
+  Tcl_SetObjResult (interp, Tcl_NewStringObj (result, -1));
+  xfree (result);
   result_ptr->flags |= GDBTK_IN_TCL_RESULT;
 
   do_cleanups (old_chain);

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

* Re: [patch] gdb_eval cleanup
  2002-05-15 16:40 [patch] gdb_eval cleanup Martin M. Hunt
@ 2002-05-15 16:43 ` Keith Seitz
  0 siblings, 0 replies; 2+ messages in thread
From: Keith Seitz @ 2002-05-15 16:43 UTC (permalink / raw)
  To: Martin M. Hunt; +Cc: insight

On Wed, 15 May 2002, Martin M. Hunt wrote:

> I checked in this simple patch to delete the mem_file and free allocated
> memory in gdb_eval().

Very good! Thanks!

Keith


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

end of thread, other threads:[~2002-05-15 23:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-15 16:40 [patch] gdb_eval cleanup Martin M. Hunt
2002-05-15 16:43 ` 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).