From: Keith Seitz <keiths@redhat.com>
To: insight <insight@sourceware.org>
Subject: [PATCH] Fix cleanups
Date: Wed, 05 Jun 2013 20:23:00 -0000 [thread overview]
Message-ID: <51AF9E31.3060804@redhat.com> (raw)
[-- 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;
}
reply other threads:[~2013-06-05 20:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51AF9E31.3060804@redhat.com \
--to=keiths@redhat.com \
--cc=insight@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).