* target.h (TARGET_VIRTUAL_FRAME_POINTER): Delete, multi-arched.
[binutils-gdb.git] / gdb / arch-utils.c
1 /* Dynamic architecture support for GDB, the GNU debugger.
2 Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 #include "defs.h"
22
23 #if GDB_MULTI_ARCH
24 #include "gdbcmd.h"
25 #include "inferior.h" /* enum CALL_DUMMY_LOCATION et.al. */
26 #else
27 /* Just include everything in sight so that the every old definition
28 of macro is visible. */
29 #include "gdb_string.h"
30 #include "symtab.h"
31 #include "frame.h"
32 #include "inferior.h"
33 #include "breakpoint.h"
34 #include "gdb_wait.h"
35 #include "gdbcore.h"
36 #include "gdbcmd.h"
37 #include "target.h"
38 #include "annotate.h"
39 #endif
40 #include "regcache.h"
41 #include "gdb_assert.h"
42
43 #include "version.h"
44
45 #include "floatformat.h"
46
47 /* Use the program counter to determine the contents and size
48 of a breakpoint instruction. If no target-dependent macro
49 BREAKPOINT_FROM_PC has been defined to implement this function,
50 assume that the breakpoint doesn't depend on the PC, and
51 use the values of the BIG_BREAKPOINT and LITTLE_BREAKPOINT macros.
52 Return a pointer to a string of bytes that encode a breakpoint
53 instruction, stores the length of the string to *lenptr,
54 and optionally adjust the pc to point to the correct memory location
55 for inserting the breakpoint. */
56
57 unsigned char *
58 legacy_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr)
59 {
60 /* {BIG_,LITTLE_}BREAKPOINT is the sequence of bytes we insert for a
61 breakpoint. On some machines, breakpoints are handled by the
62 target environment and we don't have to worry about them here. */
63 #ifdef BIG_BREAKPOINT
64 if (TARGET_BYTE_ORDER == BIG_ENDIAN)
65 {
66 static unsigned char big_break_insn[] = BIG_BREAKPOINT;
67 *lenptr = sizeof (big_break_insn);
68 return big_break_insn;
69 }
70 #endif
71 #ifdef LITTLE_BREAKPOINT
72 if (TARGET_BYTE_ORDER != BIG_ENDIAN)
73 {
74 static unsigned char little_break_insn[] = LITTLE_BREAKPOINT;
75 *lenptr = sizeof (little_break_insn);
76 return little_break_insn;
77 }
78 #endif
79 #ifdef BREAKPOINT
80 {
81 static unsigned char break_insn[] = BREAKPOINT;
82 *lenptr = sizeof (break_insn);
83 return break_insn;
84 }
85 #endif
86 *lenptr = 0;
87 return NULL;
88 }
89
90 int
91 generic_frameless_function_invocation_not (struct frame_info *fi)
92 {
93 return 0;
94 }
95
96 int
97 generic_return_value_on_stack_not (struct type *type)
98 {
99 return 0;
100 }
101
102 char *
103 legacy_register_name (int i)
104 {
105 #ifdef REGISTER_NAMES
106 static char *names[] = REGISTER_NAMES;
107 if (i < 0 || i >= (sizeof (names) / sizeof (*names)))
108 return NULL;
109 else
110 return names[i];
111 #else
112 internal_error (__FILE__, __LINE__,
113 "legacy_register_name: called.");
114 return NULL;
115 #endif
116 }
117
118 #if defined (CALL_DUMMY)
119 LONGEST legacy_call_dummy_words[] = CALL_DUMMY;
120 #else
121 LONGEST legacy_call_dummy_words[1];
122 #endif
123 int legacy_sizeof_call_dummy_words = sizeof (legacy_call_dummy_words);
124
125 void
126 generic_remote_translate_xfer_address (CORE_ADDR gdb_addr, int gdb_len,
127 CORE_ADDR * rem_addr, int *rem_len)
128 {
129 *rem_addr = gdb_addr;
130 *rem_len = gdb_len;
131 }
132
133 int
134 generic_prologue_frameless_p (CORE_ADDR ip)
135 {
136 #ifdef SKIP_PROLOGUE_FRAMELESS_P
137 return ip == SKIP_PROLOGUE_FRAMELESS_P (ip);
138 #else
139 return ip == SKIP_PROLOGUE (ip);
140 #endif
141 }
142
143
144 /* Helper functions for INNER_THAN */
145
146 int
147 core_addr_lessthan (CORE_ADDR lhs, CORE_ADDR rhs)
148 {
149 return (lhs < rhs);
150 }
151
152 int
153 core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs)
154 {
155 return (lhs > rhs);
156 }
157
158
159 /* Helper functions for TARGET_{FLOAT,DOUBLE}_FORMAT */
160
161 const struct floatformat *
162 default_float_format (struct gdbarch *gdbarch)
163 {
164 #if GDB_MULTI_ARCH
165 int byte_order = gdbarch_byte_order (gdbarch);
166 #else
167 int byte_order = TARGET_BYTE_ORDER;
168 #endif
169 switch (byte_order)
170 {
171 case BIG_ENDIAN:
172 return &floatformat_ieee_single_big;
173 case LITTLE_ENDIAN:
174 return &floatformat_ieee_single_little;
175 default:
176 internal_error (__FILE__, __LINE__,
177 "default_float_format: bad byte order");
178 }
179 }
180
181
182 const struct floatformat *
183 default_double_format (struct gdbarch *gdbarch)
184 {
185 #if GDB_MULTI_ARCH
186 int byte_order = gdbarch_byte_order (gdbarch);
187 #else
188 int byte_order = TARGET_BYTE_ORDER;
189 #endif
190 switch (byte_order)
191 {
192 case BIG_ENDIAN:
193 return &floatformat_ieee_double_big;
194 case LITTLE_ENDIAN:
195 return &floatformat_ieee_double_little;
196 default:
197 internal_error (__FILE__, __LINE__,
198 "default_double_format: bad byte order");
199 }
200 }
201
202 /* Misc helper functions for targets. */
203
204 int
205 frame_num_args_unknown (struct frame_info *fi)
206 {
207 return -1;
208 }
209
210
211 int
212 generic_register_convertible_not (int num)
213 {
214 return 0;
215 }
216
217
218 int
219 default_register_sim_regno (int num)
220 {
221 return num;
222 }
223
224
225 CORE_ADDR
226 core_addr_identity (CORE_ADDR addr)
227 {
228 return addr;
229 }
230
231 int
232 no_op_reg_to_regnum (int reg)
233 {
234 return reg;
235 }
236
237 /* For use by frame_args_address and frame_locals_address. */
238 CORE_ADDR
239 default_frame_address (struct frame_info *fi)
240 {
241 return fi->frame;
242 }
243
244 /* Default prepare_to_procced(). */
245 int
246 default_prepare_to_proceed (int select_it)
247 {
248 return 0;
249 }
250
251 /* Generic prepare_to_proceed(). This one should be suitable for most
252 targets that support threads. */
253 int
254 generic_prepare_to_proceed (int select_it)
255 {
256 ptid_t wait_ptid;
257 struct target_waitstatus wait_status;
258
259 /* Get the last target status returned by target_wait(). */
260 get_last_target_status (&wait_ptid, &wait_status);
261
262 /* Make sure we were stopped either at a breakpoint, or because
263 of a Ctrl-C. */
264 if (wait_status.kind != TARGET_WAITKIND_STOPPED
265 || (wait_status.value.sig != TARGET_SIGNAL_TRAP &&
266 wait_status.value.sig != TARGET_SIGNAL_INT))
267 {
268 return 0;
269 }
270
271 if (!ptid_equal (wait_ptid, minus_one_ptid)
272 && !ptid_equal (inferior_ptid, wait_ptid))
273 {
274 /* Switched over from WAIT_PID. */
275 CORE_ADDR wait_pc = read_pc_pid (wait_ptid);
276
277 if (wait_pc != read_pc ())
278 {
279 if (select_it)
280 {
281 /* Switch back to WAIT_PID thread. */
282 inferior_ptid = wait_ptid;
283
284 /* FIXME: This stuff came from switch_to_thread() in
285 thread.c (which should probably be a public function). */
286 flush_cached_frames ();
287 registers_changed ();
288 stop_pc = wait_pc;
289 select_frame (get_current_frame (), 0);
290 }
291 /* We return 1 to indicate that there is a breakpoint here,
292 so we need to step over it before continuing to avoid
293 hitting it straight away. */
294 if (breakpoint_here_p (wait_pc))
295 {
296 return 1;
297 }
298 }
299 }
300 return 0;
301
302 }
303
304 void
305 init_frame_pc_noop (int fromleaf, struct frame_info *prev)
306 {
307 return;
308 }
309
310 void
311 init_frame_pc_default (int fromleaf, struct frame_info *prev)
312 {
313 if (fromleaf)
314 prev->pc = SAVED_PC_AFTER_CALL (prev->next);
315 else if (prev->next != NULL)
316 prev->pc = FRAME_SAVED_PC (prev->next);
317 else
318 prev->pc = read_pc ();
319 }
320
321 int
322 cannot_register_not (int regnum)
323 {
324 return 0;
325 }
326
327 /* Legacy version of target_virtual_frame_pointer(). Assumes that
328 there is an FP_REGNUM and that it is the same, cooked or raw. */
329
330 void
331 legacy_virtual_frame_pointer (CORE_ADDR pc,
332 int *frame_regnum,
333 LONGEST *frame_offset)
334 {
335 gdb_assert (FP_REGNUM >= 0);
336 *frame_regnum = FP_REGNUM;
337 *frame_offset = 0;
338 }
339 \f
340 /* Functions to manipulate the endianness of the target. */
341
342 #ifdef TARGET_BYTE_ORDER_SELECTABLE
343 /* compat - Catch old targets that expect a selectable byte-order to
344 default to BIG_ENDIAN */
345 #ifndef TARGET_BYTE_ORDER_DEFAULT
346 #define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN
347 #endif
348 #endif
349 #if !TARGET_BYTE_ORDER_SELECTABLE_P
350 #ifndef TARGET_BYTE_ORDER_DEFAULT
351 /* compat - Catch old non byte-order selectable targets that do not
352 define TARGET_BYTE_ORDER_DEFAULT and instead expect
353 TARGET_BYTE_ORDER to be used as the default. For targets that
354 defined neither TARGET_BYTE_ORDER nor TARGET_BYTE_ORDER_DEFAULT the
355 below will get a strange compiler warning. */
356 #define TARGET_BYTE_ORDER_DEFAULT TARGET_BYTE_ORDER
357 #endif
358 #endif
359 #ifndef TARGET_BYTE_ORDER_DEFAULT
360 #define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN /* arbitrary */
361 #endif
362 /* ``target_byte_order'' is only used when non- multi-arch.
363 Multi-arch targets obtain the current byte order using
364 TARGET_BYTE_ORDER which is controlled by gdbarch.*. */
365 int target_byte_order = TARGET_BYTE_ORDER_DEFAULT;
366 int target_byte_order_auto = 1;
367
368 static const char endian_big[] = "big";
369 static const char endian_little[] = "little";
370 static const char endian_auto[] = "auto";
371 static const char *endian_enum[] =
372 {
373 endian_big,
374 endian_little,
375 endian_auto,
376 NULL,
377 };
378 static const char *set_endian_string;
379
380 /* Called by ``show endian''. */
381
382 static void
383 show_endian (char *args, int from_tty)
384 {
385 if (TARGET_BYTE_ORDER_AUTO)
386 printf_unfiltered ("The target endianness is set automatically (currently %s endian)\n",
387 (TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little"));
388 else
389 printf_unfiltered ("The target is assumed to be %s endian\n",
390 (TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little"));
391 }
392
393 static void
394 set_endian (char *ignore_args, int from_tty, struct cmd_list_element *c)
395 {
396 if (!TARGET_BYTE_ORDER_SELECTABLE_P)
397 {
398 printf_unfiltered ("Byte order is not selectable.");
399 }
400 else if (set_endian_string == endian_auto)
401 {
402 target_byte_order_auto = 1;
403 }
404 else if (set_endian_string == endian_little)
405 {
406 target_byte_order_auto = 0;
407 if (GDB_MULTI_ARCH)
408 {
409 struct gdbarch_info info;
410 memset (&info, 0, sizeof info);
411 info.byte_order = LITTLE_ENDIAN;
412 if (! gdbarch_update_p (info))
413 {
414 printf_unfiltered ("Little endian target not supported by GDB\n");
415 }
416 }
417 else
418 {
419 target_byte_order = LITTLE_ENDIAN;
420 }
421 }
422 else if (set_endian_string == endian_big)
423 {
424 target_byte_order_auto = 0;
425 if (GDB_MULTI_ARCH)
426 {
427 struct gdbarch_info info;
428 memset (&info, 0, sizeof info);
429 info.byte_order = BIG_ENDIAN;
430 if (! gdbarch_update_p (info))
431 {
432 printf_unfiltered ("Big endian target not supported by GDB\n");
433 }
434 }
435 else
436 {
437 target_byte_order = BIG_ENDIAN;
438 }
439 }
440 else
441 internal_error (__FILE__, __LINE__,
442 "set_endian: bad value");
443 show_endian (NULL, from_tty);
444 }
445
446 /* Set the endianness from a BFD. */
447
448 static void
449 set_endian_from_file (bfd *abfd)
450 {
451 if (GDB_MULTI_ARCH)
452 internal_error (__FILE__, __LINE__,
453 "set_endian_from_file: not for multi-arch");
454 if (TARGET_BYTE_ORDER_SELECTABLE_P)
455 {
456 int want;
457
458 if (bfd_big_endian (abfd))
459 want = BIG_ENDIAN;
460 else
461 want = LITTLE_ENDIAN;
462 if (TARGET_BYTE_ORDER_AUTO)
463 target_byte_order = want;
464 else if (TARGET_BYTE_ORDER != want)
465 warning ("%s endian file does not match %s endian target.",
466 want == BIG_ENDIAN ? "big" : "little",
467 TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little");
468 }
469 else
470 {
471 if (bfd_big_endian (abfd)
472 ? TARGET_BYTE_ORDER != BIG_ENDIAN
473 : TARGET_BYTE_ORDER == BIG_ENDIAN)
474 warning ("%s endian file does not match %s endian target.",
475 bfd_big_endian (abfd) ? "big" : "little",
476 TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little");
477 }
478 }
479
480
481 /* Functions to manipulate the architecture of the target */
482
483 enum set_arch { set_arch_auto, set_arch_manual };
484
485 int target_architecture_auto = 1;
486
487 const char *set_architecture_string;
488
489 /* Old way of changing the current architecture. */
490
491 extern const struct bfd_arch_info bfd_default_arch_struct;
492 const struct bfd_arch_info *target_architecture = &bfd_default_arch_struct;
493 int (*target_architecture_hook) (const struct bfd_arch_info *ap);
494
495 static int
496 arch_ok (const struct bfd_arch_info *arch)
497 {
498 if (GDB_MULTI_ARCH)
499 internal_error (__FILE__, __LINE__,
500 "arch_ok: not multi-arched");
501 /* Should be performing the more basic check that the binary is
502 compatible with GDB. */
503 /* Check with the target that the architecture is valid. */
504 return (target_architecture_hook == NULL
505 || target_architecture_hook (arch));
506 }
507
508 static void
509 set_arch (const struct bfd_arch_info *arch,
510 enum set_arch type)
511 {
512 if (GDB_MULTI_ARCH)
513 internal_error (__FILE__, __LINE__,
514 "set_arch: not multi-arched");
515 switch (type)
516 {
517 case set_arch_auto:
518 if (!arch_ok (arch))
519 warning ("Target may not support %s architecture",
520 arch->printable_name);
521 target_architecture = arch;
522 break;
523 case set_arch_manual:
524 if (!arch_ok (arch))
525 {
526 printf_unfiltered ("Target does not support `%s' architecture.\n",
527 arch->printable_name);
528 }
529 else
530 {
531 target_architecture_auto = 0;
532 target_architecture = arch;
533 }
534 break;
535 }
536 if (gdbarch_debug)
537 gdbarch_dump (current_gdbarch, gdb_stdlog);
538 }
539
540 /* Set the architecture from arch/machine (deprecated) */
541
542 void
543 set_architecture_from_arch_mach (enum bfd_architecture arch,
544 unsigned long mach)
545 {
546 const struct bfd_arch_info *wanted = bfd_lookup_arch (arch, mach);
547 if (GDB_MULTI_ARCH)
548 internal_error (__FILE__, __LINE__,
549 "set_architecture_from_arch_mach: not multi-arched");
550 if (wanted != NULL)
551 set_arch (wanted, set_arch_manual);
552 else
553 internal_error (__FILE__, __LINE__,
554 "gdbarch: hardwired architecture/machine not recognized");
555 }
556
557 /* Set the architecture from a BFD (deprecated) */
558
559 static void
560 set_architecture_from_file (bfd *abfd)
561 {
562 const struct bfd_arch_info *wanted = bfd_get_arch_info (abfd);
563 if (GDB_MULTI_ARCH)
564 internal_error (__FILE__, __LINE__,
565 "set_architecture_from_file: not multi-arched");
566 if (target_architecture_auto)
567 {
568 set_arch (wanted, set_arch_auto);
569 }
570 else if (wanted != target_architecture)
571 {
572 warning ("%s architecture file may be incompatible with %s target.",
573 wanted->printable_name,
574 target_architecture->printable_name);
575 }
576 }
577
578
579 /* Called if the user enters ``show architecture'' without an
580 argument. */
581
582 static void
583 show_architecture (char *args, int from_tty)
584 {
585 const char *arch;
586 arch = TARGET_ARCHITECTURE->printable_name;
587 if (target_architecture_auto)
588 printf_filtered ("The target architecture is set automatically (currently %s)\n", arch);
589 else
590 printf_filtered ("The target architecture is assumed to be %s\n", arch);
591 }
592
593
594 /* Called if the user enters ``set architecture'' with or without an
595 argument. */
596
597 static void
598 set_architecture (char *ignore_args, int from_tty, struct cmd_list_element *c)
599 {
600 if (strcmp (set_architecture_string, "auto") == 0)
601 {
602 target_architecture_auto = 1;
603 }
604 else if (GDB_MULTI_ARCH)
605 {
606 struct gdbarch_info info;
607 memset (&info, 0, sizeof info);
608 info.bfd_arch_info = bfd_scan_arch (set_architecture_string);
609 if (info.bfd_arch_info == NULL)
610 internal_error (__FILE__, __LINE__,
611 "set_architecture: bfd_scan_arch failed");
612 if (gdbarch_update_p (info))
613 target_architecture_auto = 0;
614 else
615 printf_unfiltered ("Architecture `%s' not recognized.\n",
616 set_architecture_string);
617 }
618 else
619 {
620 const struct bfd_arch_info *arch
621 = bfd_scan_arch (set_architecture_string);
622 if (arch == NULL)
623 internal_error (__FILE__, __LINE__,
624 "set_architecture: bfd_scan_arch failed");
625 set_arch (arch, set_arch_manual);
626 }
627 show_architecture (NULL, from_tty);
628 }
629
630 /* Set the dynamic target-system-dependent parameters (architecture,
631 byte-order) using information found in the BFD */
632
633 void
634 set_gdbarch_from_file (bfd *abfd)
635 {
636 if (GDB_MULTI_ARCH)
637 {
638 struct gdbarch_info info;
639 memset (&info, 0, sizeof info);
640 info.abfd = abfd;
641 if (! gdbarch_update_p (info))
642 error ("Architecture of file not recognized.\n");
643 }
644 else
645 {
646 set_architecture_from_file (abfd);
647 set_endian_from_file (abfd);
648 }
649 }
650
651 /* Initialize the current architecture. Update the ``set
652 architecture'' command so that it specifies a list of valid
653 architectures. */
654
655 #ifdef DEFAULT_BFD_ARCH
656 extern const bfd_arch_info_type DEFAULT_BFD_ARCH;
657 static const bfd_arch_info_type *default_bfd_arch = &DEFAULT_BFD_ARCH;
658 #else
659 static const bfd_arch_info_type *default_bfd_arch;
660 #endif
661
662 #ifdef DEFAULT_BFD_VEC
663 extern const bfd_target DEFAULT_BFD_VEC;
664 static const bfd_target *default_bfd_vec = &DEFAULT_BFD_VEC;
665 #else
666 static const bfd_target *default_bfd_vec;
667 #endif
668
669 void
670 initialize_current_architecture (void)
671 {
672 const char **arches = gdbarch_printable_names ();
673
674 /* determine a default architecture and byte order. */
675 struct gdbarch_info info;
676 memset (&info, 0, sizeof (info));
677
678 /* Find a default architecture. */
679 if (info.bfd_arch_info == NULL
680 && default_bfd_arch != NULL)
681 info.bfd_arch_info = default_bfd_arch;
682 if (info.bfd_arch_info == NULL)
683 {
684 /* Choose the architecture by taking the first one
685 alphabetically. */
686 const char *chosen = arches[0];
687 const char **arch;
688 for (arch = arches; *arch != NULL; arch++)
689 {
690 if (strcmp (*arch, chosen) < 0)
691 chosen = *arch;
692 }
693 if (chosen == NULL)
694 internal_error (__FILE__, __LINE__,
695 "initialize_current_architecture: No arch");
696 info.bfd_arch_info = bfd_scan_arch (chosen);
697 if (info.bfd_arch_info == NULL)
698 internal_error (__FILE__, __LINE__,
699 "initialize_current_architecture: Arch not found");
700 }
701
702 /* take several guesses at a byte order. */
703 /* NB: can't use TARGET_BYTE_ORDER_DEFAULT as its definition is
704 forced above. */
705 if (info.byte_order == 0
706 && default_bfd_vec != NULL)
707 {
708 /* Extract BFD's default vector's byte order. */
709 switch (default_bfd_vec->byteorder)
710 {
711 case BFD_ENDIAN_BIG:
712 info.byte_order = BIG_ENDIAN;
713 break;
714 case BFD_ENDIAN_LITTLE:
715 info.byte_order = LITTLE_ENDIAN;
716 break;
717 default:
718 break;
719 }
720 }
721 if (info.byte_order == 0)
722 {
723 /* look for ``*el-*'' in the target name. */
724 const char *chp;
725 chp = strchr (target_name, '-');
726 if (chp != NULL
727 && chp - 2 >= target_name
728 && strncmp (chp - 2, "el", 2) == 0)
729 info.byte_order = LITTLE_ENDIAN;
730 }
731 if (info.byte_order == 0)
732 {
733 /* Wire it to big-endian!!! */
734 info.byte_order = BIG_ENDIAN;
735 }
736
737 if (GDB_MULTI_ARCH)
738 {
739 if (! gdbarch_update_p (info))
740 {
741 internal_error (__FILE__, __LINE__,
742 "initialize_current_architecture: Selection of initial architecture failed");
743 }
744 }
745 else
746 initialize_non_multiarch ();
747
748 /* Create the ``set architecture'' command appending ``auto'' to the
749 list of architectures. */
750 {
751 struct cmd_list_element *c;
752 /* Append ``auto''. */
753 int nr;
754 for (nr = 0; arches[nr] != NULL; nr++);
755 arches = xrealloc (arches, sizeof (char*) * (nr + 2));
756 arches[nr + 0] = "auto";
757 arches[nr + 1] = NULL;
758 /* FIXME: add_set_enum_cmd() uses an array of ``char *'' instead
759 of ``const char *''. We just happen to know that the casts are
760 safe. */
761 c = add_set_enum_cmd ("architecture", class_support,
762 arches, &set_architecture_string,
763 "Set architecture of target.",
764 &setlist);
765 c->function.sfunc = set_architecture;
766 add_alias_cmd ("processor", "architecture", class_support, 1, &setlist);
767 /* Don't use set_from_show - need to print both auto/manual and
768 current setting. */
769 add_cmd ("architecture", class_support, show_architecture,
770 "Show the current target architecture", &showlist);
771 }
772 }
773
774
775 /* */
776
777 extern initialize_file_ftype _initialize_gdbarch_utils;
778
779 void
780 _initialize_gdbarch_utils (void)
781 {
782 struct cmd_list_element *c;
783 c = add_set_enum_cmd ("endian", class_support,
784 endian_enum, &set_endian_string,
785 "Set endianness of target.",
786 &setlist);
787 c->function.sfunc = set_endian;
788 /* Don't use set_from_show - need to print both auto/manual and
789 current setting. */
790 add_cmd ("endian", class_support, show_endian,
791 "Show the current byte-order", &showlist);
792 }