From: Paul Gilliam <pgilliam@us.ibm.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH]*3 Re: [RFC] "info powerpc"
Date: Thu, 15 Sep 2005 00:11:00 -0000 [thread overview]
Message-ID: <200509141710.39794.pgilliam@us.ibm.com> (raw)
In-Reply-To: <200509091633.02630.pgilliam@us.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1945 bytes --]
On Friday 09 September 2005 16:33, Paul Gilliam wrote:
> The "Info powerpc" command has no subcommands and does nothing.
>
> The testsuit tests "info powerpc altivec"
>
> So, should I depreciate 'info powerpc', just get rid of it, or add the 'altivec' subcommand and just point it to 'info vector'?
>
> -=# Paul #=-
>
>
Attached are three patches, each a different way to deal with this problem:
The first is 'easy_altivec.patch'. It adds the "info powerpc altivec" sub-command and has it call the same
routine as "info vector" does. The only down-side is that the routine 'vector_info' in infcmd.c has to be made global.
The second, 'altivec_alias.patch', functions like the first, except that infcmd.c is not touched. Instead, an 'info powerpc altivec' command
is added that turns itself into an alias for "info vector" the first time it's called. This can't be done with add_com_alias because the alias and
the command being aliased are on different command chains.
The final patch, 'no_more_altivec.patch' depreciates the "info powerpc" command prefix and changes the testsuite to use "info vector". To make
this work, 'lookup_cmd_composition' in cli/cli-decode.c had to be changed so that a prefix command that has no sub-commands
can be depreciated.
My personel favorite is the first one. It does the right thing while leaving "info powerpc" useable for other sub-commands. And it's simple.
My second favorite is the second one. It's like the first, except only the rs6000-tdep.c file need be changed. Well, maybe it's not so simple.
My least favorite is the third one. While it's a clean fix to the problem, it slams the door on any future 'info powerpc' sub-commands. It also
requires a fix so that prefix commands without any sub-commands can be depreciated. Of course, we could just get rid of the "info powerpc"
command without depreciating it for a while first....
Let me know what you think.
-=# Paul #=-
[-- Attachment #2: easy_altivec.patch --]
[-- Type: text/x-diff, Size: 1500 bytes --]
2005-09-14 Paul Gilliam <pgilliam@us.ibm.com>
* infcmd.c (vector_info): Make global.
* rs6000-tdep.c (_initialize_rs6000_tdep): Add the 'altivec' subcommand
of 'info powerpc', pointing it to 'info vector' to do the work.
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.140
diff -u -a -r1.140 infcmd.c
--- infcmd.c 17 Aug 2005 15:08:33 -0000 1.140
+++ infcmd.c 14 Sep 2005 21:52:00 -0000
@@ -1768,7 +1768,7 @@
}
}
-static void
+void
vector_info (char *args, int from_tty)
{
print_vector_info (current_gdbarch, gdb_stdout, deprecated_selected_frame, args);
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.242
diff -u -a -r1.242 rs6000-tdep.c
--- rs6000-tdep.c 1 Sep 2005 18:09:41 -0000 1.242
+++ rs6000-tdep.c 14 Sep 2005 21:52:00 -0000
@@ -3409,6 +3409,7 @@
/* Initialization code. */
extern initialize_file_ftype _initialize_rs6000_tdep; /* -Wmissing-prototypes */
+extern void vector_info (char *, int);
void
_initialize_rs6000_tdep (void)
@@ -3420,4 +3421,6 @@
add_prefix_cmd ("powerpc", class_info, rs6000_info_powerpc_command,
_("Various POWERPC info specific commands."),
&info_powerpc_cmdlist, "info powerpc ", 0, &infolist);
+ add_cmd ("altivec", class_info, vector_info,_("\
+Print the status of the altivec unit.\n") , &info_powerpc_cmdlist);
}
[-- Attachment #3: no_more_altivec.patch --]
[-- Type: text/x-diff, Size: 2546 bytes --]
2005-09-14 Paul Gilliam <pgilliam@us.ibm.com>
* rs6000-tdep.c (_initialize_rs6000_tdep): Mark 'info powerpc' as
deprecated.
* cli/cli-decode.c (lookup_cmd_composition): Only loop on the new
prefix list if it is non-empty.
* testsuite/gdb.arch/altivec-regs.exp ('info powerpc altivec' test):
Changed to 'info vector'.
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.242
diff -a -u -r1.242 rs6000-tdep.c
--- rs6000-tdep.c 1 Sep 2005 18:09:41 -0000 1.242
+++ rs6000-tdep.c 14 Sep 2005 23:27:22 -0000
@@ -3417,7 +3417,9 @@
gdbarch_register (bfd_arch_powerpc, rs6000_gdbarch_init, rs6000_dump_tdep);
/* Add root prefix command for "info powerpc" commands */
- add_prefix_cmd ("powerpc", class_info, rs6000_info_powerpc_command,
- _("Various POWERPC info specific commands."),
- &info_powerpc_cmdlist, "info powerpc ", 0, &infolist);
+ deprecate_cmd (add_prefix_cmd ("powerpc", class_info,
+ rs6000_info_powerpc_command,
+ _("Various POWERPC info specific commands."),
+ &info_powerpc_cmdlist, "info powerpc ", 0,
+ &infolist), "info vector");
}
Index: cli/cli-decode.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
retrieving revision 1.55
diff -a -u -r1.55 cli-decode.c
--- cli/cli-decode.c 26 May 2005 20:49:02 -0000 1.55
+++ cli/cli-decode.c 14 Sep 2005 23:27:22 -0000
@@ -1468,10 +1468,10 @@
}
*prefix_cmd = prev_cmd;
}
- if ((*cmd)->prefixlist)
- cur_list = *(*cmd)->prefixlist;
+ if ((*cmd)->prefixlist && *((*cmd)->prefixlist))
+ cur_list = *(*cmd)->prefixlist;
else
- return 1;
+ return 1;
text = p;
}
Index: testsuite/gdb.arch/altivec-regs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/altivec-regs.exp,v
retrieving revision 1.6
diff -a -u -r1.6 altivec-regs.exp
--- testsuite/gdb.arch/altivec-regs.exp 13 Sep 2005 23:13:50 -0000 1.6
+++ testsuite/gdb.arch/altivec-regs.exp 14 Sep 2005 23:27:22 -0000
@@ -140,8 +140,8 @@
append pattern$i $vector_register
}
-send_gdb "info powerpc altivec\n"
-gdb_expect_list "info powerpc altivec" ".*$gdb_prompt $" {
+send_gdb "info vector\n"
+gdb_expect_list "info vector" ".*$gdb_prompt $" {
[$pattern0]
[$pattern1]
[$pattern2]
[-- Attachment #4: altivec_alias.patch --]
[-- Type: text/x-diff, Size: 2572 bytes --]
2005-09-14 Paul Gilliam <pgilliam@us.ibm.com>
* rs6000-tdep.c (_initialize_rs6000_tdep): Remember the cmd_list_element
for the 'info powerpc altivec' command.
(rs6000_info_powerpc_altivec_command): New. Replaces itself with 'info
vector'.
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.242
diff -u -a -r1.242 rs6000-tdep.c
--- rs6000-tdep.c 1 Sep 2005 18:09:41 -0000 1.242
+++ rs6000-tdep.c 14 Sep 2005 21:29:04 -0000
@@ -59,6 +59,8 @@
#include "frame-unwind.h"
#include "frame-base.h"
+#include "cli/cli-decode.h"
+
#include "reggroups.h"
/* If the kernel has to deliver a signal, it pushes a sigcontext
@@ -3399,6 +3401,8 @@
}
static struct cmd_list_element *info_powerpc_cmdlist = NULL;
+static char inf_vec_name[] = "vector";
+static struct cmd_list_element *inf_ppc_altivec_cmd;
static void
rs6000_info_powerpc_command (char *args, int from_tty)
@@ -3406,6 +3410,32 @@
help_list (info_powerpc_cmdlist, "info powerpc ", class_info, gdb_stdout);
}
+static void
+rs6000_info_powerpc_altivec_command (char *args, int from_tty)
+{
+ char *copied_name;
+ struct cmd_list_element *inf_vec_cmd;
+ copied_name = (char *) alloca (strlen (inf_vec_name) + 1);
+ strcpy (copied_name, inf_vec_name);
+ inf_vec_cmd = lookup_cmd (&copied_name, infolist, "", 1, 1);
+
+ if (!inf_vec_cmd) {
+ help_list (info_powerpc_cmdlist, "info powerpc ", class_info, gdb_stdout);
+ return;
+ }
+
+ /* NOTE: Both FUNC and all the FUNCTIONs need to be copied. */
+ inf_ppc_altivec_cmd->func = inf_vec_cmd->func;
+ inf_ppc_altivec_cmd->function = inf_vec_cmd->function;
+ inf_ppc_altivec_cmd->prefixlist = inf_vec_cmd->prefixlist;
+ inf_ppc_altivec_cmd->prefixname = inf_vec_cmd->prefixname;
+ inf_ppc_altivec_cmd->allow_unknown = inf_vec_cmd->allow_unknown;
+ inf_ppc_altivec_cmd->abbrev_flag = 0;
+ inf_ppc_altivec_cmd->cmd_pointer = inf_vec_cmd;
+
+ (*inf_vec_cmd->func)(inf_vec_cmd, args, from_tty);
+}
+
/* Initialization code. */
extern initialize_file_ftype _initialize_rs6000_tdep; /* -Wmissing-prototypes */
@@ -3420,4 +3450,7 @@
add_prefix_cmd ("powerpc", class_info, rs6000_info_powerpc_command,
_("Various POWERPC info specific commands."),
&info_powerpc_cmdlist, "info powerpc ", 0, &infolist);
+ inf_ppc_altivec_cmd = add_cmd ("altivec", class_info,
+ rs6000_info_powerpc_altivec_command,
+ _("See 'info vector'"), &info_powerpc_cmdlist);
}
next prev parent reply other threads:[~2005-09-15 0:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-09 23:32 Paul Gilliam
2005-09-15 0:11 ` Paul Gilliam [this message]
2005-09-15 3:34 ` [PATCH]*3 " Eli Zaretskii
2005-09-15 19:06 ` [DOC PATCH] " Paul Gilliam
2005-09-16 10:26 ` Eli Zaretskii
2005-09-15 19:18 ` Mark Kettenis
2005-09-16 13:56 ` Daniel Jacobowitz
2005-09-16 17:45 ` Kevin Buettner
2005-09-16 18:51 ` Paul Gilliam
2005-09-16 19:40 ` Mark Kettenis
2005-09-16 19:47 ` Kevin Buettner
2005-09-19 17:50 ` [commit] "get rid of info powerpc" Paul Gilliam
2005-09-19 18:09 ` Daniel Jacobowitz
2005-09-20 20:05 ` Paul Gilliam
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=200509141710.39794.pgilliam@us.ibm.com \
--to=pgilliam@us.ibm.com \
--cc=gdb-patches@sources.redhat.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