* PATCH ARM add new set/show arm commands
@ 2003-03-22 16:29 Richard Earnshaw
2003-03-22 22:20 ` Andrew Cagney
0 siblings, 1 reply; 7+ messages in thread
From: Richard Earnshaw @ 2003-03-22 16:29 UTC (permalink / raw)
To: gdb-patches; +Cc: Richard.Earnshaw
[-- Attachment #1: Type: text/plain, Size: 1355 bytes --]
This patch starts the process of moving the arm-specific set/show options
into a sub-group. For the moment I've only done this for the set/show
disassembly-flavor command, where I've also taken the opportunity to drop
"flavor" from the command (it's non-intuitive if you speak English-English
:-)
So we now have
set arm disassembly
and
show arm disassembly
The options to this command are identical to those we had before.
Finally, I've marked the old commands as deprecated, and in addition I've
marked the really old "othernames" command similarly.
Patches to move other arm-specific commands to this new style will follow
shortly.
R.
2003-03-22 Richard Earnshaw <rearnsha@arm.com>
* arm-tdep.c (setarmcmdlist, showarmcmdlist): New command lists.
(set_arm_command, show_arm_command): New functions.
(_initialize_arm_tdep): Add them.
(num_disassembly_options): Renamed from num_flavor_options.
(valid_disassembly_styles): Renamed from valid_flavors.
(disassembly_style): Renamed from disassembly_flavor.
(set_disassembly_style_sfunc): Renamed from
set_disassembly_flavor_sfunc.
(set_disassembly_style): Renamed from set_disassembly_flavor.
(arm_othernames): Updated.
(_initialize_arm_tdep): Deprecate "set/show disassembly-flavor"
command. Add "set/show arm disassembly" commands. Deprecate
"othernames" command.
[-- Attachment #2: gdb-setarm.patch --]
[-- Type: text/plain , Size: 12475 bytes --]
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.108
diff -p -r1.108 arm-tdep.c
*** arm-tdep.c 22 Mar 2003 14:31:30 -0000 1.108
--- arm-tdep.c 22 Mar 2003 16:12:32 -0000
***************
*** 28,34 ****
#include "gdbcore.h"
#include "symfile.h"
#include "gdb_string.h"
! #include "dis-asm.h" /* For register flavors. */
#include "regcache.h"
#include "doublest.h"
#include "value.h"
--- 28,34 ----
#include "gdbcore.h"
#include "symfile.h"
#include "gdb_string.h"
! #include "dis-asm.h" /* For register styles. */
#include "regcache.h"
#include "doublest.h"
#include "value.h"
*************** static int arm_debug;
*** 99,106 ****
#define MSYMBOL_SIZE(msym) \
((long) MSYMBOL_INFO (msym) & 0x7fffffff)
/* Number of different reg name sets (options). */
! static int num_flavor_options;
/* We have more registers than the disassembler as gdb can print the value
of special registers as well.
--- 99,110 ----
#define MSYMBOL_SIZE(msym) \
((long) MSYMBOL_INFO (msym) & 0x7fffffff)
+ /* The list of available "set arm ..." and "show arm ..." commands. */
+ static struct cmd_list_element *setarmcmdlist = NULL;
+ static struct cmd_list_element *showarmcmdlist = NULL;
+
/* Number of different reg name sets (options). */
! static int num_disassembly_options;
/* We have more registers than the disassembler as gdb can print the value
of special registers as well.
*************** static char * arm_register_name_strings[
*** 118,136 ****
"fps", "cpsr" }; /* 24 25 */
static char **arm_register_names = arm_register_name_strings;
! /* Valid register name flavors. */
! static const char **valid_flavors;
! /* Disassembly flavor to use. Default to "std" register names. */
! static const char *disassembly_flavor;
/* Index to that option in the opcodes table. */
static int current_option;
/* This is used to keep the bfd arch_info in sync with the disassembly
! flavor. */
! static void set_disassembly_flavor_sfunc(char *, int,
struct cmd_list_element *);
! static void set_disassembly_flavor (void);
static void convert_from_extended (const struct floatformat *, const void *,
void *);
--- 122,140 ----
"fps", "cpsr" }; /* 24 25 */
static char **arm_register_names = arm_register_name_strings;
! /* Valid register name styles. */
! static const char **valid_disassembly_styles;
! /* Disassembly style to use. Default to "std" register names. */
! static const char *disassembly_style;
/* Index to that option in the opcodes table. */
static int current_option;
/* This is used to keep the bfd arch_info in sync with the disassembly
! style. */
! static void set_disassembly_style_sfunc(char *, int,
struct cmd_list_element *);
! static void set_disassembly_style (void);
static void convert_from_extended (const struct floatformat *, const void *,
void *);
*************** arm_skip_stub (CORE_ADDR pc)
*** 2516,2531 ****
return 0; /* not a stub */
}
! /* If the user changes the register disassembly flavor used for info
! register and other commands, we have to also switch the flavor used
! in opcodes for disassembly output. This function is run in the set
! disassembly_flavor command, and does that. */
static void
! set_disassembly_flavor_sfunc (char *args, int from_tty,
struct cmd_list_element *c)
{
! set_disassembly_flavor ();
}
\f
/* Return the ARM register name corresponding to register I. */
--- 2520,2548 ----
return 0; /* not a stub */
}
! static void
! set_arm_command (char *args, int from_tty)
! {
! printf_unfiltered ("\"set arm\" must be followed by an apporpriate subcommand.\n");
! help_list (setarmcmdlist, "set arm ", all_commands, gdb_stdout);
! }
!
! static void
! show_arm_command (char *args, int from_tty)
! {
! help_list (showarmcmdlist, "show arm ", all_commands, gdb_stdout);
! }
!
! /* If the user changes the register disassembly style used for info
! register and other commands, we have to also switch the style used
! in opcodes for disassembly output. This function is run in the "set
! arm disassembly" command, and does that. */
static void
! set_disassembly_style_sfunc (char *args, int from_tty,
struct cmd_list_element *c)
{
! set_disassembly_style ();
}
\f
/* Return the ARM register name corresponding to register I. */
*************** arm_register_name (int i)
*** 2536,2551 ****
}
static void
! set_disassembly_flavor (void)
{
const char *setname, *setdesc, **regnames;
int numregs, j;
! /* Find the flavor that the user wants in the opcodes table. */
int current = 0;
numregs = get_arm_regnames (current, &setname, &setdesc, ®names);
! while ((disassembly_flavor != setname)
! && (current < num_flavor_options))
get_arm_regnames (++current, &setname, &setdesc, ®names);
current_option = current;
--- 2553,2568 ----
}
static void
! set_disassembly_style (void)
{
const char *setname, *setdesc, **regnames;
int numregs, j;
! /* Find the style that the user wants in the opcodes table. */
int current = 0;
numregs = get_arm_regnames (current, &setname, &setdesc, ®names);
! while ((disassembly_style != setname)
! && (current < num_disassembly_options))
get_arm_regnames (++current, &setname, &setdesc, ®names);
current_option = current;
*************** set_disassembly_flavor (void)
*** 2569,2587 ****
set_arm_regname_option (current);
}
! /* arm_othernames implements the "othernames" command. This is kind
! of hacky, and I prefer the set-show disassembly-flavor which is
! also used for the x86 gdb. I will keep this around, however, in
! case anyone is actually using it. */
static void
arm_othernames (char *names, int n)
{
/* Circle through the various flavors. */
! current_option = (current_option + 1) % num_flavor_options;
! disassembly_flavor = valid_flavors[current_option];
! set_disassembly_flavor ();
}
/* Fetch, and possibly build, an appropriate link_map_offsets structure
--- 2586,2602 ----
set_arm_regname_option (current);
}
! /* arm_othernames implements the "othernames" command. This is deprecated
! by the "set arm disassembly" command. */
static void
arm_othernames (char *names, int n)
{
/* Circle through the various flavors. */
! current_option = (current_option + 1) % num_disassembly_options;
! disassembly_style = valid_disassembly_styles[current_option];
! set_disassembly_style ();
}
/* Fetch, and possibly build, an appropriate link_map_offsets structure
*************** _initialize_arm_tdep (void)
*** 3026,3053 ****
tm_print_insn = gdb_print_insn_arm;
/* Get the number of possible sets of register names defined in opcodes. */
! num_flavor_options = get_arm_regname_num_options ();
/* Sync the opcode insn printer with our register viewer. */
parse_arm_disassembler_option ("reg-names-std");
/* Begin creating the help text. */
stb = mem_fileopen ();
! fprintf_unfiltered (stb, "Set the disassembly flavor.\n\
! The valid values are:\n");
/* Initialize the array that will be passed to add_set_enum_cmd(). */
! valid_flavors = xmalloc ((num_flavor_options + 1) * sizeof (char *));
! for (i = 0; i < num_flavor_options; i++)
{
numregs = get_arm_regnames (i, &setname, &setdesc, ®names);
! valid_flavors[i] = setname;
fprintf_unfiltered (stb, "%s - %s\n", setname,
setdesc);
/* Copy the default names (if found) and synchronize disassembler. */
if (!strcmp (setname, "std"))
{
! disassembly_flavor = setname;
current_option = i;
for (j = 0; j < numregs; j++)
arm_register_names[j] = (char *) regnames[j];
--- 3041,3078 ----
tm_print_insn = gdb_print_insn_arm;
/* Get the number of possible sets of register names defined in opcodes. */
! num_disassembly_options = get_arm_regname_num_options ();
!
! /* Add root prefix command for all "set arm"/"show arm" commands. */
! add_prefix_cmd ("arm", no_class, set_arm_command,
! "Various ARM-specific commands.",
! &setarmcmdlist, "set arm ", 0, &setlist);
!
! add_prefix_cmd ("arm", no_class, show_arm_command,
! "Various ARM-specific commands.",
! &showarmcmdlist, "show arm ", 0, &showlist);
/* Sync the opcode insn printer with our register viewer. */
parse_arm_disassembler_option ("reg-names-std");
/* Begin creating the help text. */
stb = mem_fileopen ();
! fprintf_unfiltered (stb, "Set the disassembly style.\n"
! "The valid values are:\n");
/* Initialize the array that will be passed to add_set_enum_cmd(). */
! valid_disassembly_styles
! = xmalloc ((num_disassembly_options + 1) * sizeof (char *));
! for (i = 0; i < num_disassembly_options; i++)
{
numregs = get_arm_regnames (i, &setname, &setdesc, ®names);
! valid_disassembly_styles[i] = setname;
fprintf_unfiltered (stb, "%s - %s\n", setname,
setdesc);
/* Copy the default names (if found) and synchronize disassembler. */
if (!strcmp (setname, "std"))
{
! disassembly_style = setname;
current_option = i;
for (j = 0; j < numregs; j++)
arm_register_names[j] = (char *) regnames[j];
*************** The valid values are:\n");
*** 3055,3075 ****
}
}
/* Mark the end of valid options. */
! valid_flavors[num_flavor_options] = NULL;
/* Finish the creation of the help text. */
fprintf_unfiltered (stb, "The default is \"std\".");
helptext = ui_file_xstrdup (stb, &length);
ui_file_delete (stb);
! /* Add the disassembly-flavor command. */
new_cmd = add_set_enum_cmd ("disassembly-flavor", no_class,
! valid_flavors,
! &disassembly_flavor,
helptext,
&setlist);
! set_cmd_sfunc (new_cmd, set_disassembly_flavor_sfunc);
! add_show_from_set (new_cmd, &showlist);
/* ??? Maybe this should be a boolean. */
add_show_from_set (add_set_cmd ("apcs32", no_class,
--- 3080,3108 ----
}
}
/* Mark the end of valid options. */
! valid_disassembly_styles[num_disassembly_options] = NULL;
/* Finish the creation of the help text. */
fprintf_unfiltered (stb, "The default is \"std\".");
helptext = ui_file_xstrdup (stb, &length);
ui_file_delete (stb);
! /* Add the deprecated disassembly-flavor command. */
new_cmd = add_set_enum_cmd ("disassembly-flavor", no_class,
! valid_disassembly_styles,
! &disassembly_style,
helptext,
&setlist);
! set_cmd_sfunc (new_cmd, set_disassembly_style_sfunc);
! deprecate_cmd (new_cmd, "set arm disassembly");
! deprecate_cmd (add_show_from_set (new_cmd, &showlist),
! "show arm disassembly");
!
! /* And now add the new interface. */
! new_cmd = add_set_enum_cmd ("disassembly", no_class, valid_disassembly_styles,
! &disassembly_style, helptext, &setarmcmdlist);
!
! add_show_from_set (new_cmd, &showarmcmdlist);
/* ??? Maybe this should be a boolean. */
add_show_from_set (add_set_cmd ("apcs32", no_class,
*************** The valid values are:\n");
*** 3078,3090 ****
&showlist);
/* Add the deprecated "othernames" command. */
!
! add_com ("othernames", class_obscure, arm_othernames,
! "Switch to the next set of register names.");
/* Debugging flag. */
add_show_from_set (add_set_cmd ("arm", class_maintenance, var_zinteger,
! &arm_debug, "Set arm debugging.\n\
! When non-zero, arm specific debugging is enabled.", &setdebuglist),
! &showdebuglist);
}
--- 3111,3123 ----
&showlist);
/* Add the deprecated "othernames" command. */
! deprecate_cmd (add_com ("othernames", class_obscure, arm_othernames,
! "Switch to the next set of register names."),
! "set arm disassembly");
/* Debugging flag. */
add_show_from_set (add_set_cmd ("arm", class_maintenance, var_zinteger,
! &arm_debug, "Set arm debugging.\n"
! "When non-zero, arm specific debugging is enabled.",
! &setdebuglist), &showdebuglist);
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH ARM add new set/show arm commands
2003-03-22 16:29 PATCH ARM add new set/show arm commands Richard Earnshaw
@ 2003-03-22 22:20 ` Andrew Cagney
2003-03-24 9:48 ` Richard Earnshaw
0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2003-03-22 22:20 UTC (permalink / raw)
To: Richard.Earnshaw; +Cc: gdb-patches
> This patch starts the process of moving the arm-specific set/show options
> into a sub-group. For the moment I've only done this for the set/show
> disassembly-flavor command, where I've also taken the opportunity to drop
> "flavor" from the command (it's non-intuitive if you speak English-English
> :-)
See: set [<arch>?] disassembler, replace disassembly-flavour or flavor[sic]
http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=548
enjoy,
Andrew
> So we now have
>
> set arm disassembly
>
> and
>
> show arm disassembly
>
> The options to this command are identical to those we had before.
>
> Finally, I've marked the old commands as deprecated, and in addition I've
> marked the really old "othernames" command similarly.
>
> Patches to move other arm-specific commands to this new style will follow
> shortly.
>
> R.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH ARM add new set/show arm commands
2003-03-22 22:20 ` Andrew Cagney
@ 2003-03-24 9:48 ` Richard Earnshaw
2003-03-24 17:10 ` Andrew Cagney
0 siblings, 1 reply; 7+ messages in thread
From: Richard Earnshaw @ 2003-03-24 9:48 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Richard.Earnshaw, gdb-patches
> > This patch starts the process of moving the arm-specific set/show options
> > into a sub-group. For the moment I've only done this for the set/show
> > disassembly-flavor command, where I've also taken the opportunity to drop
> > "flavor" from the command (it's non-intuitive if you speak English-English
> > :-)
>
> See: set [<arch>?] disassembler, replace disassembly-flavour or flavor[sic]
> http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=548
>
> enjoy,
> Andrew
>
>
> > So we now have
> >
> > set arm disassembly
> >
> > and
> >
> > show arm disassembly
Are you suggesting I should change the option name to "set arm
disassembler"? If so, I've no problem with that. If not, what are you
suggesting? Currently ARM does not support a "set arm architecture",
though it might be needed for supporting interworking binaries and calls
to functions from gdb.
R.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH ARM add new set/show arm commands
2003-03-24 9:48 ` Richard Earnshaw
@ 2003-03-24 17:10 ` Andrew Cagney
2003-03-25 12:24 ` Richard Earnshaw
0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2003-03-24 17:10 UTC (permalink / raw)
To: Richard.Earnshaw; +Cc: gdb-patches
> This patch starts the process of moving the arm-specific set/show options
>> > into a sub-group. For the moment I've only done this for the set/show
>> > disassembly-flavor command, where I've also taken the opportunity to drop
>> > "flavor" from the command (it's non-intuitive if you speak English-English
>> > :-)
>
>>
>> See: set [<arch>?] disassembler, replace disassembly-flavour or flavor[sic]
>> http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=548
>>
>> enjoy,
>> Andrew
>>
>>
>
>> > So we now have
>> >
>> > set arm disassembly
>> >
>> > and
>> >
>> > show arm disassembly
>
>
> Are you suggesting I should change the option name to "set arm
> disassembler"? If so, I've no problem with that. If not, what are you
Yes, just "set arm disassembler". Er, actually, is "set arm
disassembler-options" better? Either name is more in line with the
existing objdump --disassembler-options option.
Andrew
> suggesting? Currently ARM does not support a "set arm architecture",
> though it might be needed for supporting interworking binaries and calls
> to functions from gdb.
>
> R.
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH ARM add new set/show arm commands
2003-03-24 17:10 ` Andrew Cagney
@ 2003-03-25 12:24 ` Richard Earnshaw
2003-03-25 15:19 ` Andrew Cagney
0 siblings, 1 reply; 7+ messages in thread
From: Richard Earnshaw @ 2003-03-25 12:24 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Richard.Earnshaw, gdb-patches
> > Are you suggesting I should change the option name to "set arm
> > disassembler"? If so, I've no problem with that. If not, what are you
>
> Yes, just "set arm disassembler". Er, actually, is "set arm
> disassembler-options" better? Either name is more in line with the
> existing objdump --disassembler-options option.
I'm not entirely happy with the idea of forcing this method to be
identical to the objdump machinery. In particular, the current objdump
flags available to gdb are all prefixed by reg-names- and in gdb this is
not accepted by gdb.
Further, there is another option in the arm disassembler-options command
that is not available to gdb -- force-thumb. Something like this is
needed for gdb, but not at this level. For gdb a proper flag that is
visible to the rest of the debugger, not just the assembler is needed.
Further, that flag needs to be a 3-state one, ARM, Thumb and auto.
Forcing the state will affect things like breakpoint insertion etc.
I think I'd rather keep the option as "set arm disassembler" to make these
distinctions clear. Thoughts?
R.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH ARM add new set/show arm commands
2003-03-25 12:24 ` Richard Earnshaw
@ 2003-03-25 15:19 ` Andrew Cagney
2003-03-25 15:37 ` Richard Earnshaw
0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2003-03-25 15:19 UTC (permalink / raw)
To: Richard.Earnshaw; +Cc: gdb-patches
>> > Are you suggesting I should change the option name to "set arm
>> > disassembler"? If so, I've no problem with that. If not, what are you
>
>>
>> Yes, just "set arm disassembler". Er, actually, is "set arm
>> disassembler-options" better? Either name is more in line with the
>> existing objdump --disassembler-options option.
>
>
> I'm not entirely happy with the idea of forcing this method to be
> identical to the objdump machinery. In particular, the current objdump
> flags available to gdb are all prefixed by reg-names- and in gdb this is
> not accepted by gdb.
>
> Further, there is another option in the arm disassembler-options command
> that is not available to gdb -- force-thumb. Something like this is
> needed for gdb, but not at this level. For gdb a proper flag that is
> visible to the rest of the debugger, not just the assembler is needed.
> Further, that flag needs to be a 3-state one, ARM, Thumb and auto.
> Forcing the state will affect things like breakpoint insertion etc.
>
> I think I'd rather keep the option as "set arm disassembler" to make these
> distinctions clear. Thoughts?
M'kay. Can you add a note to that effect to the bug report (the i386
needs a similar treatment).
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH ARM add new set/show arm commands
2003-03-25 15:19 ` Andrew Cagney
@ 2003-03-25 15:37 ` Richard Earnshaw
0 siblings, 0 replies; 7+ messages in thread
From: Richard Earnshaw @ 2003-03-25 15:37 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Richard.Earnshaw, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 362 bytes --]
> > I think I'd rather keep the option as "set arm disassembler" to make these
> > distinctions clear. Thoughts?
>
> M'kay. Can you add a note to that effect to the bug report (the i386
> needs a similar treatment).
>
2003-03-25 Richard Earnshaw <rearnsha@arm.com>
PR cli/548
* arm-tdep.c (_initialize_arm_tdep): Command is "set arm disassembler".
[-- Attachment #2: gdb-disopt.patch --]
[-- Type: text/plain , Size: 812 bytes --]
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.113
diff -p -r1.113 arm-tdep.c
*** arm-tdep.c 25 Mar 2003 14:52:33 -0000 1.113
--- arm-tdep.c 25 Mar 2003 15:31:49 -0000
*************** _initialize_arm_tdep (void)
*** 3164,3170 ****
"show arm disassembly");
/* And now add the new interface. */
! new_set = add_set_enum_cmd ("disassembly", no_class,
valid_disassembly_styles, &disassembly_style,
helptext, &setarmcmdlist);
--- 3164,3170 ----
"show arm disassembly");
/* And now add the new interface. */
! new_set = add_set_enum_cmd ("disassembler", no_class,
valid_disassembly_styles, &disassembly_style,
helptext, &setarmcmdlist);
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-03-25 15:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-22 16:29 PATCH ARM add new set/show arm commands Richard Earnshaw
2003-03-22 22:20 ` Andrew Cagney
2003-03-24 9:48 ` Richard Earnshaw
2003-03-24 17:10 ` Andrew Cagney
2003-03-25 12:24 ` Richard Earnshaw
2003-03-25 15:19 ` Andrew Cagney
2003-03-25 15:37 ` Richard Earnshaw
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox