* [PATCH] Fix cleanups
@ 2013-06-05 20:23 Keith Seitz
0 siblings, 0 replies; only message in thread
From: Keith Seitz @ 2013-06-05 20:23 UTC (permalink / raw)
To: insight
[-- Attachment #1: Type: text/plain, Size: 476 bytes --]
Hi,
Gdb now asserts on dangling cleanups left in the code, so I've taken the
time to audit the gdbtk code to make sure that cleanups are handled
correctly.
I've committed the attached patch.
Keith
ChangeLog
2013-06-05 Keith Seitz <keiths@redhat.com>
* generic/gdbtk.c (tk_command): Use xfree instead of free.
* generic/gdbtk-hooks.c (gdbtk_call_command): Remove unused
cleanup.
* generic/gdbtk-cmds.c (gdb_load_info): If bfd_check_format
fails, run the cleanup.
[-- Attachment #2: cleanups.patch --]
[-- Type: text/x-patch, Size: 2898 bytes --]
Index: generic/gdbtk.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -p -r1.53 -r1.54
--- generic/gdbtk.c 30 Mar 2012 07:04:59 -0000 1.53
+++ generic/gdbtk.c 5 Jun 2013 20:19:46 -0000 1.54
@@ -1,5 +1,5 @@
/* Startup code for Insight
- Copyright (C) 1994-2012 Free Software Foundation, Inc.
+ Copyright (C) 1994-2013 Free Software Foundation, Inc.
Written by Stu Grossman <grossman@cygnus.com> of Cygnus Support.
@@ -739,7 +739,7 @@ tk_command (char *cmd, int from_tty)
result = xstrdup (Tcl_GetStringResult (gdbtk_interp));
- old_chain = make_cleanup (free, result);
+ old_chain = make_cleanup (xfree, result);
if (retval != TCL_OK)
error ("%s", result);
Index: generic/gdbtk-hooks.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-hooks.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -p -r1.58 -r1.59
--- generic/gdbtk-hooks.c 10 Nov 2012 17:49:57 -0000 1.58
+++ generic/gdbtk-hooks.c 5 Jun 2013 20:19:46 -0000 1.59
@@ -1,7 +1,7 @@
/* Startup code for Insight.
Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 200, 2002, 2003, 2004,
- 2008, 2010, 2011, 2012 Free Software Foundation, Inc.
+ 2008, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
Written by Stu Grossman <grossman@cygnus.com> of Cygnus Support.
@@ -528,9 +528,6 @@ static void
gdbtk_call_command (struct cmd_list_element *cmdblk,
char *arg, int from_tty)
{
- struct cleanup *old_chain;
-
- old_chain = make_cleanup (null_cleanup, 0);
running_now = 0;
if (cmdblk->class == class_run || cmdblk->class == class_trace)
{
@@ -545,8 +542,6 @@ gdbtk_call_command (struct cmd_list_elem
}
else
cmd_func (cmdblk, arg, from_tty);
-
- do_cleanups (old_chain);
}
/* Called after a `set' command succeeds. Runs the Tcl hook
Index: generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -p -r1.131 -r1.132
--- generic/gdbtk-cmds.c 13 Apr 2013 17:01:11 -0000 1.131
+++ generic/gdbtk-cmds.c 5 Jun 2013 20:19:46 -0000 1.132
@@ -1,5 +1,5 @@
/* Tcl/Tk command definitions for Insight.
- Copyright (C) 1994-2012 Free Software Foundation, Inc.
+ Copyright (C) 1994-2013 Free Software Foundation, Inc.
Written by Stu Grossman <grossman@cygnus.com> of Cygnus Support.
Substantially augmented by Martin Hunt, Keith Seitz & Jim Ingham of
@@ -969,6 +969,7 @@ gdb_load_info (ClientData clientData, Tc
if (!bfd_check_format (loadfile_bfd, bfd_object))
{
+ do_cleanups (old_cleanups);
gdbtk_set_result (interp, "Bad Object File");
return TCL_ERROR;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-06-05 20:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-05 20:23 [PATCH] Fix cleanups 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).