* arm-tdep.c (arm_mode_strings, arm_fallback_mode_string)

(arm_force_mode_string, arm_show_fallback_mode)
	(arm_show_force_mode): New.
	(arm_pc_is_thumb): Honor fallback-mode and force-mode.  Use
	arm_frame_is_thumb.
	(_initialize_arm_tdep): Add "set arm fallback-mode"
	and "set arm force-mode".
	* NEWS: Document new commands.

	* gdb.texinfo (ARM): Document set/show arm fallback-mode
	and set/show arm force-mode.
This commit is contained in:
Daniel Jacobowitz 2008-05-02 16:00:36 +00:00
parent e76b98d759
commit 0428b8f567
5 changed files with 117 additions and 7 deletions

View file

@ -1,3 +1,14 @@
2008-05-02 Daniel Jacobowitz <dan@codesourcery.com>
* arm-tdep.c (arm_mode_strings, arm_fallback_mode_string)
(arm_force_mode_string, arm_show_fallback_mode)
(arm_show_force_mode): New.
(arm_pc_is_thumb): Honor fallback-mode and force-mode. Use
arm_frame_is_thumb.
(_initialize_arm_tdep): Add "set arm fallback-mode"
and "set arm force-mode".
* NEWS: Document new commands.
2008-05-02 Andrew Stubbs <andrew.stubbs@st.com>
* main.h (batch_silent): Declare.

View file

@ -53,6 +53,15 @@ show breakpoint always-inserted
them when resuming the target, and removing them when the target stops.
This option can improve debugger performance on slow remote targets.
set arm fallback-mode (arm|thumb|auto)
show arm fallback-mode
set arm force-mode (arm|thumb|auto)
show arm force-mode
These commands control how ARM GDB determines whether instructions
are ARM or Thumb. The default for both settings is auto, which uses
the current CPSR value for instructions without symbols; previous
versions of GDB behaved as if "set arm fallback-mode arm".
*** Changes in GDB 6.8
* New native configurations

View file

@ -101,6 +101,17 @@ static const char *arm_abi_strings[] =
static enum arm_abi_kind arm_abi_global = ARM_ABI_AUTO;
static const char *arm_abi_string = "auto";
/* The execution mode to assume. */
static const char *arm_mode_strings[] =
{
"auto",
"arm",
"thumb"
};
static const char *arm_fallback_mode_string = "auto";
static const char *arm_force_mode_string = "auto";
/* Number of different reg name sets (options). */
static int num_disassembly_options;
@ -240,16 +251,33 @@ arm_pc_is_thumb (CORE_ADDR memaddr)
if (IS_THUMB_ADDR (memaddr))
return 1;
/* If the user wants to override the symbol table, let him. */
if (strcmp (arm_force_mode_string, "arm") == 0)
return 0;
if (strcmp (arm_force_mode_string, "thumb") == 0)
return 1;
/* Thumb functions have a "special" bit set in minimal symbols. */
sym = lookup_minimal_symbol_by_pc (memaddr);
if (sym)
{
return (MSYMBOL_IS_SPECIAL (sym));
}
else
{
return 0;
}
return (MSYMBOL_IS_SPECIAL (sym));
/* If the user wants to override the fallback mode, let them. */
if (strcmp (arm_fallback_mode_string, "arm") == 0)
return 0;
if (strcmp (arm_fallback_mode_string, "thumb") == 0)
return 1;
/* If we couldn't find any symbol, but we're talking to a running
target, then trust the current value of $cpsr. This lets
"display/i $pc" always show the correct mode (though if there is
a symbol table we will not reach here, so it still may not be
displayed in the mode it will be executed). */
if (target_has_registers)
return arm_frame_is_thumb (get_current_frame ());
/* Otherwise we're out of luck; we assume ARM. */
return 0;
}
/* Remove useless bits from addresses in a running program. */
@ -2661,6 +2689,28 @@ The current ARM ABI is \"auto\" (currently \"%s\").\n"),
arm_abi_string);
}
static void
arm_show_fallback_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
fprintf_filtered (file, _("\
The current execution mode assumed (when symbols are unavailable) is \"%s\".\n"),
arm_fallback_mode_string);
}
static void
arm_show_force_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
fprintf_filtered (file, _("\
The current execution mode assumed (even when symbols are available) is \"%s\".\n"),
arm_force_mode_string);
}
/* 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
@ -3284,6 +3334,21 @@ vfp - VFP co-processor."),
NULL, arm_set_abi, arm_show_abi,
&setarmcmdlist, &showarmcmdlist);
/* Add two commands to allow the user to force the assumed
execution mode. */
add_setshow_enum_cmd ("fallback-mode", class_support,
arm_mode_strings, &arm_fallback_mode_string,
_("Set the mode assumed when symbols are unavailable."),
_("Show the mode assumed when symbols are unavailable."),
NULL, NULL, arm_show_fallback_mode,
&setarmcmdlist, &showarmcmdlist);
add_setshow_enum_cmd ("force-mode", class_support,
arm_mode_strings, &arm_force_mode_string,
_("Set the mode assumed even when symbols are available."),
_("Show the mode assumed even when symbols are available."),
NULL, NULL, arm_show_force_mode,
&setarmcmdlist, &showarmcmdlist);
/* Debugging flag. */
add_setshow_boolean_cmd ("arm", class_maintenance, &arm_debug,
_("Set ARM debugging."),

View file

@ -1,3 +1,8 @@
2008-05-02 Daniel Jacobowitz <dan@codesourcery.com>
* gdb.texinfo (ARM): Document set/show arm fallback-mode
and set/show arm force-mode.
2008-05-02 Andreas Schwab <schwab@suse.de>
* gdbint.texinfo (Algorithms): Describe

View file

@ -14894,6 +14894,26 @@ This command forces @value{GDBN} to use the specified ABI.
@item show arm abi
Show the currently used ABI.
@item set arm fallback-mode (arm|thumb|auto)
@value{GDBN} uses the symbol table, when available, to determine
whether instructions are ARM or Thumb. This command controls
@value{GDBN}'s default behavior when the symbol table is not
available. The default is @samp{auto}, which causes @value{GDBN} to
use the current execution mode (from the @code{T} bit in the @code{CPSR}
register).
@item show arm fallback-mode
Show the current fallback instruction mode.
@item set arm force-mode (arm|thumb|auto)
This command overrides use of the symbol table to determine whether
instructions are ARM or Thumb. The default is @samp{auto}, which
causes @value{GDBN} to use the symbol table and then the setting
of @samp{set arm fallback-mode}.
@item show arm force-mode
Show the current forced instruction mode.
@item set debug arm
Toggle whether to display ARM-specific debugging messages from the ARM
target support subsystem.