Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: markus.t.metzger@intel.com
To: jan.kratochvil@redhat.com
Cc: gdb-patches@sourceware.org, markus.t.metzger@gmail.com,
	       Markus Metzger <markus.t.metzger@intel.com>
Subject: [rfc 1/5] target: add add_deprecated_target_alias
Date: Fri, 08 Feb 2013 15:30:00 -0000	[thread overview]
Message-ID: <1360337423-27095-2-git-send-email-markus.t.metzger@intel.com> (raw)
In-Reply-To: <1360337423-27095-1-git-send-email-markus.t.metzger@intel.com>

From: Markus Metzger <markus.t.metzger@intel.com>

Add a new function to target.h to add an alias command for a target and mark it
deprecated.  This is useful when renaming targets.

2013-02-08 Markus Metzger <markus.t.metzger@intel.com>

	* target.h (add_deprecated_target_alias): New.
	* target.c (add_deprecated_target_alias): New.


---
 gdb/target.c |   14 ++++++++++++++
 gdb/target.h |    5 +++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/gdb/target.c b/gdb/target.c
index 10f69dc..25f4629 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -434,6 +434,20 @@ information on the arguments for a particular protocol, type\n\
   add_cmd (t->to_shortname, no_class, t->to_open, t->to_doc, &targetlist);
 }
 
+/* See target.h.  */
+
+void
+add_deprecated_target_alias (struct target_ops *t, char *alias)
+{
+  struct cmd_list_element *c;
+  char *alt;
+
+  /* If we use add_alias_cmd, here, we do not get the deprecated warning.  */
+  c = add_cmd (alias, no_class, t->to_open, t->to_doc, &targetlist);
+  alt = xstrprintf ("target %s", t->to_shortname);
+  deprecate_cmd (c, alt);
+}
+
 /* Stub functions */
 
 void
diff --git a/gdb/target.h b/gdb/target.h
index c543118..1d73336 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1779,6 +1779,11 @@ int target_verify_memory (const gdb_byte *data,
 
 extern void add_target (struct target_ops *);
 
+/* Adds a command ALIAS for target T and marks it deprecated.  This is useful
+   for maintaining backwards compatibility when renaming targets.  */
+
+extern void add_deprecated_target_alias (struct target_ops *t, char *alias);
+
 extern void push_target (struct target_ops *);
 
 extern int unpush_target (struct target_ops *);
-- 
1.7.0.7


  reply	other threads:[~2013-02-08 15:30 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-08 15:30 [rfc 0/5] record-btrace markus.t.metzger
2013-02-08 15:30 ` markus.t.metzger [this message]
2013-02-10 22:10   ` [rfc 1/5] target: add add_deprecated_target_alias Jan Kratochvil
2013-02-08 15:30 ` [rfc 5/5] record, disas: add record disassemble command markus.t.metzger
2013-02-10 22:11   ` Jan Kratochvil
2013-02-08 15:31 ` [rfc 4/5] record: default target methods markus.t.metzger
2013-02-10 22:11   ` Jan Kratochvil
2013-02-08 15:31 ` [rfc 3/5] record: make it build again markus.t.metzger
2013-02-10 22:11   ` Jan Kratochvil
2013-02-11 13:41     ` Metzger, Markus T
2013-02-11 14:15       ` Jan Kratochvil
2013-02-11 17:13         ` [draft patch] <unavailable> unwinder for btrace [Re: [rfc 3/5] record: make it build again] Jan Kratochvil
2013-02-11 21:24           ` Tom Tromey
2013-02-13  7:35           ` Metzger, Markus T
2013-02-13  7:58             ` Jan Kratochvil
2013-02-13  8:08               ` Metzger, Markus T
2013-03-27 18:09           ` Metzger, Markus T
2013-03-28 12:38             ` Markus Metzger
     [not found]               ` <20130328062747.GA27157@host2.jankratochvil.net>
2013-03-28 14:28                 ` Metzger, Markus T
2013-03-28 14:38                   ` Jan Kratochvil
2013-03-28 17:37                     ` Metzger, Markus T
2013-02-08 15:32 ` [rfc 2/5] record: split record markus.t.metzger
2013-02-10 22:11   ` Jan Kratochvil

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=1360337423-27095-2-git-send-email-markus.t.metzger@intel.com \
    --to=markus.t.metzger@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=markus.t.metzger@gmail.com \
    /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