* arch-utils.c (selected_byte_order): Return target_byte_order_user.

(show_endian): Use target_byte_order_user if specified; otherwise
	use get_current_arch () instead of current_gdbarch.
	(show_architecture): Use set_architecture_string if specified;
	otherwise use get_current_arch () instead of current_gdbarch.
	(get_current_arch): New function.
	* arch-utils.h (get_current_arch): Add prototype.

	* osabi.c (show_osabi): Use get_current_arch () instead of
	current_gdbarch.

	* findcmd.c: Include "arch-utils.h".
	(parse_find_args): Add BIG_P argument.  Use it instead of byte order
	of current_gdbarch.
	(find_command): Use get_current_arch () instead of current_gdbarch.
	Pass byte order to parse_find_args.

	* maint.c: Include "arch-utils.h".
	(maintenance_print_architecture): Use get_current_arch () instead
	of current_gdbarch.

	* reggroups.c: Include "arch-utils.h".
	(maintenance_print_reggroups): Use get_current_arch () instead
	of current_gdbarch.

	* symfile.c: Include "arch-utils.h".
	(overlay_load_command): Use get_current_arch () instead of
	current_gdbarch.

	* value.c: Include "arch-utils.h".
	(show_convenience): Use get_current_arch () instead of
	current_gdbarch.

	* tui/tui-regs.c: Include "arch-utils.h".
	(tui_reg_next_command): Use get_current_arch () instead of
	current_gdbarch.

	* mi/mi-main.c: Include "arch-utils.h".
	(mi_cmd_data_read_memory): Use get_current_arch () instead of
	current_gdbarch.

	* parse.c: Include "arch-utils.h".
	(parse_exp_in_context): Use get_current_arch () instead of
	current_gdbarch.
This commit is contained in:
Ulrich Weigand
2009-07-02 17:02:35 +00:00
parent 5081068481
commit e17c207e88
12 changed files with 109 additions and 26 deletions

View File

@ -18,6 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "arch-utils.h"
#include <ctype.h>
#include "gdb_string.h"
#include "gdbcmd.h"
@ -50,7 +51,8 @@ put_bits (bfd_uint64_t data, char *buf, int bits, bfd_boolean big_p)
static void
parse_find_args (char *args, ULONGEST *max_countp,
char **pattern_bufp, ULONGEST *pattern_lenp,
CORE_ADDR *start_addrp, ULONGEST *search_space_lenp)
CORE_ADDR *start_addrp, ULONGEST *search_space_lenp,
bfd_boolean big_p)
{
/* Default to using the specified type. */
char size = '\0';
@ -67,7 +69,6 @@ parse_find_args (char *args, ULONGEST *max_countp,
CORE_ADDR start_addr;
ULONGEST search_space_len;
char *s = args;
bfd_boolean big_p = gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG;
struct cleanup *old_cleanups;
struct value *v;
@ -239,6 +240,8 @@ parse_find_args (char *args, ULONGEST *max_countp,
static void
find_command (char *args, int from_tty)
{
struct gdbarch *gdbarch = get_current_arch ();
bfd_boolean big_p = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG;
/* Command line parameters.
These are initialized to avoid uninitialized warnings from -Wall. */
ULONGEST max_count = 0;
@ -252,7 +255,7 @@ find_command (char *args, int from_tty)
struct cleanup *old_cleanups;
parse_find_args (args, &max_count, &pattern_buf, &pattern_len,
&start_addr, &search_space_len);
&start_addr, &search_space_len, big_p);
old_cleanups = make_cleanup (free_current_contents, &pattern_buf);
@ -294,7 +297,6 @@ find_command (char *args, int from_tty)
set_internalvar_integer (lookup_internalvar ("numfound"), found_count);
if (found_count > 0)
{
struct gdbarch *gdbarch = current_gdbarch;
struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
set_internalvar (lookup_internalvar ("_"),
value_from_pointer (ptr_type, last_found_addr));