aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r--gdb/gdbarch.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 90e3f47..3c5a282 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -130,6 +130,7 @@ struct gdbarch
*/
+ int bits_big_endian;
int short_bit;
int int_bit;
int long_bit;
@@ -251,6 +252,7 @@ struct gdbarch startup_gdbarch =
/*per-architecture data-pointers and swap regions */
0, NULL, NULL,
/* Multi-arch values */
+ 1, /* bits_big_endian */
8 * sizeof (short), /* short_bit */
8 * sizeof (int), /* int_bit */
8 * sizeof (long), /* long_bit */
@@ -382,6 +384,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
gdbarch->target_desc = info->target_desc;
/* Force the explicit initialization of these. */
+ gdbarch->bits_big_endian = (gdbarch->byte_order == BFD_ENDIAN_BIG);
gdbarch->short_bit = 2*TARGET_CHAR_BIT;
gdbarch->int_bit = 4*TARGET_CHAR_BIT;
gdbarch->long_bit = 4*TARGET_CHAR_BIT;
@@ -480,6 +483,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
if (gdbarch->bfd_arch_info == NULL)
fprintf_unfiltered (log, "\n\tbfd_arch_info");
/* Check those that need to be defined for the given multi-arch level. */
+ /* Skip verify of bits_big_endian, invalid_p == 0 */
/* Skip verify of short_bit, invalid_p == 0 */
/* Skip verify of int_bit, invalid_p == 0 */
/* Skip verify of long_bit, invalid_p == 0 */
@@ -648,6 +652,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: bfd_arch_info = %s\n",
gdbarch_bfd_arch_info (gdbarch)->printable_name);
fprintf_unfiltered (file,
+ "gdbarch_dump: bits_big_endian = %s\n",
+ paddr_d (gdbarch->bits_big_endian));
+ fprintf_unfiltered (file,
"gdbarch_dump: breakpoint_from_pc = <0x%lx>\n",
(long) gdbarch->breakpoint_from_pc);
fprintf_unfiltered (file,
@@ -1060,6 +1067,23 @@ gdbarch_target_desc (struct gdbarch *gdbarch)
}
int
+gdbarch_bits_big_endian (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ /* Skip verify of bits_big_endian, invalid_p == 0 */
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_bits_big_endian called\n");
+ return gdbarch->bits_big_endian;
+}
+
+void
+set_gdbarch_bits_big_endian (struct gdbarch *gdbarch,
+ int bits_big_endian)
+{
+ gdbarch->bits_big_endian = bits_big_endian;
+}
+
+int
gdbarch_short_bit (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);