aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2000-08-11 02:55:38 +0000
committerAndrew Cagney <cagney@redhat.com>2000-08-11 02:55:38 +0000
commit66b43ecb0f97cb826fa1595098a8fb0e7dc8a7c9 (patch)
tree04896aff206f334543ccd6c46e5da6cb15f5113b /gdb
parent6d0285024767ef31d27ee12ca048078824371c39 (diff)
downloadfsf-binutils-gdb-66b43ecb0f97cb826fa1595098a8fb0e7dc8a7c9.zip
fsf-binutils-gdb-66b43ecb0f97cb826fa1595098a8fb0e7dc8a7c9.tar.gz
fsf-binutils-gdb-66b43ecb0f97cb826fa1595098a8fb0e7dc8a7c9.tar.bz2
Move TARGET_*_PTR to gdbarch.h.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/defs.h45
-rw-r--r--gdb/gdbarch.c176
-rw-r--r--gdb/gdbarch.h101
-rwxr-xr-xgdb/gdbarch.sh48
5 files changed, 202 insertions, 178 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index da22361..a19064e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+Thu Aug 10 18:58:04 2000 Andrew Cagney <cagney@makita.cygnus.com>
+
+ * defs.h (TARGET_BFD_VMA_BIT, TARGET_SHORT_BIT, TARGET_INT_BIT,
+ TARGET_LONG_BIT, TARGET_LONG_LONG_BIT, TARGET_FLOAT_BIT,
+ TARGET_DOUBLE_BIT, TARGET_LONG_DOUBLE_BIT, TARGET_PTR_BIT): Move
+ non- multi-arch handling from here.
+ * gdbarch.sh: To here. Update printf gdbarch_update_p. Make more
+ portable.
+ * gdbarch.h, gdbarch.c: Regenerate.
+
2000-08-10 Andrew Cagney <cagney@ops1.cygnus.com>
* partial-stab.h (DBX_READ): Eliminate redundant check for null
diff --git a/gdb/defs.h b/gdb/defs.h
index 1ff7d66..7768ea6 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -1025,51 +1025,6 @@ extern char *alloca ();
#define TARGET_CHAR_BIT 8
#endif
-/* Number of bits in a short or unsigned short for the target machine. */
-#if !defined (TARGET_SHORT_BIT)
-#define TARGET_SHORT_BIT (2 * TARGET_CHAR_BIT)
-#endif
-
-/* Number of bits in an int or unsigned int for the target machine. */
-#if !defined (TARGET_INT_BIT)
-#define TARGET_INT_BIT (4 * TARGET_CHAR_BIT)
-#endif
-
-/* Number of bits in a long or unsigned long for the target machine. */
-#if !defined (TARGET_LONG_BIT)
-#define TARGET_LONG_BIT (4 * TARGET_CHAR_BIT)
-#endif
-
-/* Number of bits in a long long or unsigned long long for the target machine. */
-#if !defined (TARGET_LONG_LONG_BIT)
-#define TARGET_LONG_LONG_BIT (2 * TARGET_LONG_BIT)
-#endif
-
-/* Number of bits in a float for the target machine. */
-#if !defined (TARGET_FLOAT_BIT)
-#define TARGET_FLOAT_BIT (4 * TARGET_CHAR_BIT)
-#endif
-
-/* Number of bits in a double for the target machine. */
-#if !defined (TARGET_DOUBLE_BIT)
-#define TARGET_DOUBLE_BIT (8 * TARGET_CHAR_BIT)
-#endif
-
-/* Number of bits in a long double for the target machine. */
-#if !defined (TARGET_LONG_DOUBLE_BIT)
-#define TARGET_LONG_DOUBLE_BIT (2 * TARGET_DOUBLE_BIT)
-#endif
-
-/* Number of bits in a pointer for the target machine */
-#if !defined (TARGET_PTR_BIT)
-#define TARGET_PTR_BIT TARGET_INT_BIT
-#endif
-
-/* Number of bits in a BFD_VMA for the target object file format. */
-#if !defined (TARGET_BFD_VMA_BIT)
-#define TARGET_BFD_VMA_BIT TARGET_PTR_BIT
-#endif
-
/* If we picked up a copy of CHAR_BIT from a configuration file
(which may get it by including <limits.h>) then use it to set
the number of bits in a host char. If not, use the same size
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index dccdb62..31993f1 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -128,8 +128,6 @@ struct gdbarch
*/
- int bfd_vma_bit;
- int ptr_bit;
int short_bit;
int int_bit;
int long_bit;
@@ -137,6 +135,8 @@ struct gdbarch
int float_bit;
int double_bit;
int long_double_bit;
+ int ptr_bit;
+ int bfd_vma_bit;
int ieee_float;
gdbarch_read_pc_ftype *read_pc;
gdbarch_write_pc_ftype *write_pc;
@@ -249,8 +249,6 @@ struct gdbarch startup_gdbarch =
/*per-architecture data-pointers and swap regions */
0, NULL, NULL,
/* Multi-arch values */
- 8 * sizeof (void*),
- 8 * sizeof (void*),
8 * sizeof (short),
8 * sizeof (int),
8 * sizeof (long),
@@ -258,6 +256,8 @@ struct gdbarch startup_gdbarch =
8 * sizeof (float),
8 * sizeof (double),
8 * sizeof (long double),
+ 8 * sizeof (void*),
+ 8 * sizeof (void*),
0,
0,
0,
@@ -358,7 +358,7 @@ struct gdbarch startup_gdbarch =
struct gdbarch *current_gdbarch = &startup_gdbarch;
-/* Create a new ``struct gdbarch'' based in information provided by
+/* Create a new ``struct gdbarch'' based on information provided by
``struct gdbarch_info''. */
struct gdbarch *
@@ -374,6 +374,14 @@ gdbarch_alloc (const struct gdbarch_info *info,
gdbarch->byte_order = info->byte_order;
/* Force the explicit initialization of these. */
+ gdbarch->short_bit = 2*TARGET_CHAR_BIT;
+ gdbarch->int_bit = 4*TARGET_CHAR_BIT;
+ gdbarch->long_bit = 4*TARGET_CHAR_BIT;
+ gdbarch->long_long_bit = 2*TARGET_LONG_BIT;
+ gdbarch->float_bit = 4*TARGET_CHAR_BIT;
+ gdbarch->double_bit = 8*TARGET_CHAR_BIT;
+ gdbarch->long_double_bit = 2*TARGET_DOUBLE_BIT;
+ gdbarch->ptr_bit = TARGET_INT_BIT;
gdbarch->bfd_vma_bit = TARGET_ARCHITECTURE->bits_per_address;
gdbarch->num_regs = -1;
gdbarch->sp_regnum = -1;
@@ -447,31 +455,15 @@ verify_gdbarch (struct gdbarch *gdbarch)
if (gdbarch->bfd_arch_info == NULL)
internal_error ("verify_gdbarch: bfd_arch_info unset");
/* Check those that need to be defined for the given multi-arch level. */
+ /* Skip verify of short_bit, invalid_p == 0 */
+ /* Skip verify of int_bit, invalid_p == 0 */
+ /* Skip verify of long_bit, invalid_p == 0 */
+ /* Skip verify of long_long_bit, invalid_p == 0 */
+ /* Skip verify of float_bit, invalid_p == 0 */
+ /* Skip verify of double_bit, invalid_p == 0 */
+ /* Skip verify of long_double_bit, invalid_p == 0 */
+ /* Skip verify of ptr_bit, invalid_p == 0 */
/* Skip verify of bfd_vma_bit, invalid_p == 0 */
- if ((GDB_MULTI_ARCH >= 1)
- && (gdbarch->ptr_bit == 0))
- internal_error ("gdbarch: verify_gdbarch: ptr_bit invalid");
- if ((GDB_MULTI_ARCH >= 1)
- && (gdbarch->short_bit == 0))
- internal_error ("gdbarch: verify_gdbarch: short_bit invalid");
- if ((GDB_MULTI_ARCH >= 1)
- && (gdbarch->int_bit == 0))
- internal_error ("gdbarch: verify_gdbarch: int_bit invalid");
- if ((GDB_MULTI_ARCH >= 1)
- && (gdbarch->long_bit == 0))
- internal_error ("gdbarch: verify_gdbarch: long_bit invalid");
- if ((GDB_MULTI_ARCH >= 1)
- && (gdbarch->long_long_bit == 0))
- internal_error ("gdbarch: verify_gdbarch: long_long_bit invalid");
- if ((GDB_MULTI_ARCH >= 1)
- && (gdbarch->float_bit == 0))
- internal_error ("gdbarch: verify_gdbarch: float_bit invalid");
- if ((GDB_MULTI_ARCH >= 1)
- && (gdbarch->double_bit == 0))
- internal_error ("gdbarch: verify_gdbarch: double_bit invalid");
- if ((GDB_MULTI_ARCH >= 1)
- && (gdbarch->long_double_bit == 0))
- internal_error ("gdbarch: verify_gdbarch: long_double_bit invalid");
/* Skip verify of ieee_float, invalid_p == 0 */
if ((GDB_MULTI_ARCH >= 1)
&& (gdbarch->read_pc == 0))
@@ -702,16 +694,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: TARGET_BYTE_ORDER # %s\n",
XSTRING (TARGET_BYTE_ORDER));
#endif
-#ifdef TARGET_BFD_VMA_BIT
- fprintf_unfiltered (file,
- "gdbarch_dump: TARGET_BFD_VMA_BIT # %s\n",
- XSTRING (TARGET_BFD_VMA_BIT));
-#endif
-#ifdef TARGET_PTR_BIT
- fprintf_unfiltered (file,
- "gdbarch_dump: TARGET_PTR_BIT # %s\n",
- XSTRING (TARGET_PTR_BIT));
-#endif
#ifdef TARGET_SHORT_BIT
fprintf_unfiltered (file,
"gdbarch_dump: TARGET_SHORT_BIT # %s\n",
@@ -747,6 +729,16 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: TARGET_LONG_DOUBLE_BIT # %s\n",
XSTRING (TARGET_LONG_DOUBLE_BIT));
#endif
+#ifdef TARGET_PTR_BIT
+ fprintf_unfiltered (file,
+ "gdbarch_dump: TARGET_PTR_BIT # %s\n",
+ XSTRING (TARGET_PTR_BIT));
+#endif
+#ifdef TARGET_BFD_VMA_BIT
+ fprintf_unfiltered (file,
+ "gdbarch_dump: TARGET_BFD_VMA_BIT # %s\n",
+ XSTRING (TARGET_BFD_VMA_BIT));
+#endif
#ifdef IEEE_FLOAT
fprintf_unfiltered (file,
"gdbarch_dump: IEEE_FLOAT # %s\n",
@@ -1309,16 +1301,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: TARGET_BYTE_ORDER = %ld\n",
(long) TARGET_BYTE_ORDER);
#endif
-#ifdef TARGET_BFD_VMA_BIT
- fprintf_unfiltered (file,
- "gdbarch_dump: TARGET_BFD_VMA_BIT = %ld\n",
- (long) TARGET_BFD_VMA_BIT);
-#endif
-#ifdef TARGET_PTR_BIT
- fprintf_unfiltered (file,
- "gdbarch_dump: TARGET_PTR_BIT = %ld\n",
- (long) TARGET_PTR_BIT);
-#endif
#ifdef TARGET_SHORT_BIT
fprintf_unfiltered (file,
"gdbarch_dump: TARGET_SHORT_BIT = %ld\n",
@@ -1354,6 +1336,16 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: TARGET_LONG_DOUBLE_BIT = %ld\n",
(long) TARGET_LONG_DOUBLE_BIT);
#endif
+#ifdef TARGET_PTR_BIT
+ fprintf_unfiltered (file,
+ "gdbarch_dump: TARGET_PTR_BIT = %ld\n",
+ (long) TARGET_PTR_BIT);
+#endif
+#ifdef TARGET_BFD_VMA_BIT
+ fprintf_unfiltered (file,
+ "gdbarch_dump: TARGET_BFD_VMA_BIT = %ld\n",
+ (long) TARGET_BFD_VMA_BIT);
+#endif
#ifdef IEEE_FLOAT
fprintf_unfiltered (file,
"gdbarch_dump: IEEE_FLOAT = %ld\n",
@@ -1979,43 +1971,9 @@ gdbarch_byte_order (struct gdbarch *gdbarch)
}
int
-gdbarch_bfd_vma_bit (struct gdbarch *gdbarch)
-{
- /* Skip verify of bfd_vma_bit, invalid_p == 0 */
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_vma_bit called\n");
- return gdbarch->bfd_vma_bit;
-}
-
-void
-set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch,
- int bfd_vma_bit)
-{
- gdbarch->bfd_vma_bit = bfd_vma_bit;
-}
-
-int
-gdbarch_ptr_bit (struct gdbarch *gdbarch)
-{
- if (gdbarch->ptr_bit == 0)
- internal_error ("gdbarch: gdbarch_ptr_bit invalid");
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_ptr_bit called\n");
- return gdbarch->ptr_bit;
-}
-
-void
-set_gdbarch_ptr_bit (struct gdbarch *gdbarch,
- int ptr_bit)
-{
- gdbarch->ptr_bit = ptr_bit;
-}
-
-int
gdbarch_short_bit (struct gdbarch *gdbarch)
{
- if (gdbarch->short_bit == 0)
- internal_error ("gdbarch: gdbarch_short_bit invalid");
+ /* Skip verify of short_bit, invalid_p == 0 */
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_short_bit called\n");
return gdbarch->short_bit;
@@ -2031,8 +1989,7 @@ set_gdbarch_short_bit (struct gdbarch *gdbarch,
int
gdbarch_int_bit (struct gdbarch *gdbarch)
{
- if (gdbarch->int_bit == 0)
- internal_error ("gdbarch: gdbarch_int_bit invalid");
+ /* Skip verify of int_bit, invalid_p == 0 */
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_int_bit called\n");
return gdbarch->int_bit;
@@ -2048,8 +2005,7 @@ set_gdbarch_int_bit (struct gdbarch *gdbarch,
int
gdbarch_long_bit (struct gdbarch *gdbarch)
{
- if (gdbarch->long_bit == 0)
- internal_error ("gdbarch: gdbarch_long_bit invalid");
+ /* Skip verify of long_bit, invalid_p == 0 */
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_long_bit called\n");
return gdbarch->long_bit;
@@ -2065,8 +2021,7 @@ set_gdbarch_long_bit (struct gdbarch *gdbarch,
int
gdbarch_long_long_bit (struct gdbarch *gdbarch)
{
- if (gdbarch->long_long_bit == 0)
- internal_error ("gdbarch: gdbarch_long_long_bit invalid");
+ /* Skip verify of long_long_bit, invalid_p == 0 */
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_long_long_bit called\n");
return gdbarch->long_long_bit;
@@ -2082,8 +2037,7 @@ set_gdbarch_long_long_bit (struct gdbarch *gdbarch,
int
gdbarch_float_bit (struct gdbarch *gdbarch)
{
- if (gdbarch->float_bit == 0)
- internal_error ("gdbarch: gdbarch_float_bit invalid");
+ /* Skip verify of float_bit, invalid_p == 0 */
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_float_bit called\n");
return gdbarch->float_bit;
@@ -2099,8 +2053,7 @@ set_gdbarch_float_bit (struct gdbarch *gdbarch,
int
gdbarch_double_bit (struct gdbarch *gdbarch)
{
- if (gdbarch->double_bit == 0)
- internal_error ("gdbarch: gdbarch_double_bit invalid");
+ /* Skip verify of double_bit, invalid_p == 0 */
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_double_bit called\n");
return gdbarch->double_bit;
@@ -2116,8 +2069,7 @@ set_gdbarch_double_bit (struct gdbarch *gdbarch,
int
gdbarch_long_double_bit (struct gdbarch *gdbarch)
{
- if (gdbarch->long_double_bit == 0)
- internal_error ("gdbarch: gdbarch_long_double_bit invalid");
+ /* Skip verify of long_double_bit, invalid_p == 0 */
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_bit called\n");
return gdbarch->long_double_bit;
@@ -2131,6 +2083,38 @@ set_gdbarch_long_double_bit (struct gdbarch *gdbarch,
}
int
+gdbarch_ptr_bit (struct gdbarch *gdbarch)
+{
+ /* Skip verify of ptr_bit, invalid_p == 0 */
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_ptr_bit called\n");
+ return gdbarch->ptr_bit;
+}
+
+void
+set_gdbarch_ptr_bit (struct gdbarch *gdbarch,
+ int ptr_bit)
+{
+ gdbarch->ptr_bit = ptr_bit;
+}
+
+int
+gdbarch_bfd_vma_bit (struct gdbarch *gdbarch)
+{
+ /* Skip verify of bfd_vma_bit, invalid_p == 0 */
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_vma_bit called\n");
+ return gdbarch->bfd_vma_bit;
+}
+
+void
+set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch,
+ int bfd_vma_bit)
+{
+ gdbarch->bfd_vma_bit = bfd_vma_bit;
+}
+
+int
gdbarch_ieee_float (struct gdbarch *gdbarch)
{
/* Skip verify of ieee_float, invalid_p == 0 */
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 819d85c..fb07b93 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -79,29 +79,17 @@ extern int gdbarch_byte_order (struct gdbarch *gdbarch);
/* The following are initialized by the target dependant code. */
-/* Default (value) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (TARGET_BFD_VMA_BIT)
-#define TARGET_BFD_VMA_BIT (TARGET_ARCHITECTURE->bits_per_address)
-#endif
-
-extern int gdbarch_bfd_vma_bit (struct gdbarch *gdbarch);
-extern void set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch, int bfd_vma_bit);
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_BFD_VMA_BIT)
-#define TARGET_BFD_VMA_BIT (gdbarch_bfd_vma_bit (current_gdbarch))
-#endif
-#endif
+/* Number of bits in a char or unsigned char for the target machine.
+ Just like CHAR_BIT in <limits.h> but describes the target machine.
+ v::TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):8::0:
+
+ Number of bits in a short or unsigned short for the target machine. */
-extern int gdbarch_ptr_bit (struct gdbarch *gdbarch);
-extern void set_gdbarch_ptr_bit (struct gdbarch *gdbarch, int ptr_bit);
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_PTR_BIT)
-#define TARGET_PTR_BIT (gdbarch_ptr_bit (current_gdbarch))
-#endif
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_SHORT_BIT)
+#define TARGET_SHORT_BIT (2*TARGET_CHAR_BIT)
#endif
-/*v:1:TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):0 */
-
extern int gdbarch_short_bit (struct gdbarch *gdbarch);
extern void set_gdbarch_short_bit (struct gdbarch *gdbarch, int short_bit);
#if GDB_MULTI_ARCH
@@ -110,6 +98,13 @@ extern void set_gdbarch_short_bit (struct gdbarch *gdbarch, int short_bit);
#endif
#endif
+/* Number of bits in an int or unsigned int for the target machine. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_INT_BIT)
+#define TARGET_INT_BIT (4*TARGET_CHAR_BIT)
+#endif
+
extern int gdbarch_int_bit (struct gdbarch *gdbarch);
extern void set_gdbarch_int_bit (struct gdbarch *gdbarch, int int_bit);
#if GDB_MULTI_ARCH
@@ -118,6 +113,13 @@ extern void set_gdbarch_int_bit (struct gdbarch *gdbarch, int int_bit);
#endif
#endif
+/* Number of bits in a long or unsigned long for the target machine. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_LONG_BIT)
+#define TARGET_LONG_BIT (4*TARGET_CHAR_BIT)
+#endif
+
extern int gdbarch_long_bit (struct gdbarch *gdbarch);
extern void set_gdbarch_long_bit (struct gdbarch *gdbarch, int long_bit);
#if GDB_MULTI_ARCH
@@ -126,6 +128,14 @@ extern void set_gdbarch_long_bit (struct gdbarch *gdbarch, int long_bit);
#endif
#endif
+/* Number of bits in a long long or unsigned long long for the target
+ machine. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_LONG_LONG_BIT)
+#define TARGET_LONG_LONG_BIT (2*TARGET_LONG_BIT)
+#endif
+
extern int gdbarch_long_long_bit (struct gdbarch *gdbarch);
extern void set_gdbarch_long_long_bit (struct gdbarch *gdbarch, int long_long_bit);
#if GDB_MULTI_ARCH
@@ -134,6 +144,13 @@ extern void set_gdbarch_long_long_bit (struct gdbarch *gdbarch, int long_long_bi
#endif
#endif
+/* Number of bits in a float for the target machine. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_FLOAT_BIT)
+#define TARGET_FLOAT_BIT (4*TARGET_CHAR_BIT)
+#endif
+
extern int gdbarch_float_bit (struct gdbarch *gdbarch);
extern void set_gdbarch_float_bit (struct gdbarch *gdbarch, int float_bit);
#if GDB_MULTI_ARCH
@@ -142,6 +159,13 @@ extern void set_gdbarch_float_bit (struct gdbarch *gdbarch, int float_bit);
#endif
#endif
+/* Number of bits in a double for the target machine. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_DOUBLE_BIT)
+#define TARGET_DOUBLE_BIT (8*TARGET_CHAR_BIT)
+#endif
+
extern int gdbarch_double_bit (struct gdbarch *gdbarch);
extern void set_gdbarch_double_bit (struct gdbarch *gdbarch, int double_bit);
#if GDB_MULTI_ARCH
@@ -150,6 +174,13 @@ extern void set_gdbarch_double_bit (struct gdbarch *gdbarch, int double_bit);
#endif
#endif
+/* Number of bits in a long double for the target machine. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_LONG_DOUBLE_BIT)
+#define TARGET_LONG_DOUBLE_BIT (2*TARGET_DOUBLE_BIT)
+#endif
+
extern int gdbarch_long_double_bit (struct gdbarch *gdbarch);
extern void set_gdbarch_long_double_bit (struct gdbarch *gdbarch, int long_double_bit);
#if GDB_MULTI_ARCH
@@ -158,6 +189,36 @@ extern void set_gdbarch_long_double_bit (struct gdbarch *gdbarch, int long_doubl
#endif
#endif
+/* Number of bits in a pointer for the target machine */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_PTR_BIT)
+#define TARGET_PTR_BIT (TARGET_INT_BIT)
+#endif
+
+extern int gdbarch_ptr_bit (struct gdbarch *gdbarch);
+extern void set_gdbarch_ptr_bit (struct gdbarch *gdbarch, int ptr_bit);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_PTR_BIT)
+#define TARGET_PTR_BIT (gdbarch_ptr_bit (current_gdbarch))
+#endif
+#endif
+
+/* Number of bits in a BFD_VMA for the target object file format. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_BFD_VMA_BIT)
+#define TARGET_BFD_VMA_BIT (TARGET_ARCHITECTURE->bits_per_address)
+#endif
+
+extern int gdbarch_bfd_vma_bit (struct gdbarch *gdbarch);
+extern void set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch, int bfd_vma_bit);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_BFD_VMA_BIT)
+#define TARGET_BFD_VMA_BIT (gdbarch_bfd_vma_bit (current_gdbarch))
+#endif
+#endif
+
/* Default (value) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (IEEE_FLOAT)
#define IEEE_FLOAT (0)
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index df4053e..9f25818 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -1,4 +1,4 @@
-#!/usr/local/bin/bash -u
+#!/bin/sh -u
# Architecture commands for GDB, the GNU debugger.
# Copyright 1998-2000 Free Software Foundation, Inc.
@@ -22,7 +22,7 @@
compare_new ()
{
file=$1
- if ! test -r ${file}
+ if test ! -r ${file}
then
echo "${file} missing? cp new-${file} ${file}" 1>&2
elif diff -c ${file} new-${file}
@@ -300,17 +300,30 @@ function_list ()
i:2:TARGET_ARCHITECTURE:const struct bfd_arch_info *:bfd_arch_info::::&bfd_default_arch_struct::::%s:TARGET_ARCHITECTURE->printable_name:TARGET_ARCHITECTURE != NULL
#
i:2:TARGET_BYTE_ORDER:int:byte_order::::BIG_ENDIAN
+# Number of bits in a char or unsigned char for the target machine.
+# Just like CHAR_BIT in <limits.h> but describes the target machine.
+# v::TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):8::0:
+#
+# Number of bits in a short or unsigned short for the target machine.
+v::TARGET_SHORT_BIT:int:short_bit::::8 * sizeof (short):2*TARGET_CHAR_BIT::0
+# Number of bits in an int or unsigned int for the target machine.
+v::TARGET_INT_BIT:int:int_bit::::8 * sizeof (int):4*TARGET_CHAR_BIT::0
+# Number of bits in a long or unsigned long for the target machine.
+v::TARGET_LONG_BIT:int:long_bit::::8 * sizeof (long):4*TARGET_CHAR_BIT::0
+# Number of bits in a long long or unsigned long long for the target
+# machine.
+v::TARGET_LONG_LONG_BIT:int:long_long_bit::::8 * sizeof (LONGEST):2*TARGET_LONG_BIT::0
+# Number of bits in a float for the target machine.
+v::TARGET_FLOAT_BIT:int:float_bit::::8 * sizeof (float):4*TARGET_CHAR_BIT::0
+# Number of bits in a double for the target machine.
+v::TARGET_DOUBLE_BIT:int:double_bit::::8 * sizeof (double):8*TARGET_CHAR_BIT::0
+# Number of bits in a long double for the target machine.
+v::TARGET_LONG_DOUBLE_BIT:int:long_double_bit::::8 * sizeof (long double):2*TARGET_DOUBLE_BIT::0
+# Number of bits in a pointer for the target machine
+v::TARGET_PTR_BIT:int:ptr_bit::::8 * sizeof (void*):TARGET_INT_BIT::0
+# Number of bits in a BFD_VMA for the target object file format.
+v::TARGET_BFD_VMA_BIT:int:bfd_vma_bit::::8 * sizeof (void*):TARGET_ARCHITECTURE->bits_per_address::0
#
-v:1:TARGET_BFD_VMA_BIT:int:bfd_vma_bit::::8 * sizeof (void*):TARGET_ARCHITECTURE->bits_per_address::0
-v:1:TARGET_PTR_BIT:int:ptr_bit::::8 * sizeof (void*):0
-#v:1:TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):0
-v:1:TARGET_SHORT_BIT:int:short_bit::::8 * sizeof (short):0
-v:1:TARGET_INT_BIT:int:int_bit::::8 * sizeof (int):0
-v:1:TARGET_LONG_BIT:int:long_bit::::8 * sizeof (long):0
-v:1:TARGET_LONG_LONG_BIT:int:long_long_bit::::8 * sizeof (LONGEST):0
-v:1:TARGET_FLOAT_BIT:int:float_bit::::8 * sizeof (float):0
-v:1:TARGET_DOUBLE_BIT:int:double_bit::::8 * sizeof (double):0
-v:1:TARGET_LONG_DOUBLE_BIT:int:long_double_bit::::8 * sizeof (long double):0
v:1:IEEE_FLOAT:int:ieee_float::::0:0::0:::
#
f:1:TARGET_READ_PC:CORE_ADDR:read_pc:int pid:pid::0:0
@@ -320,6 +333,7 @@ f:1:TARGET_WRITE_FP:void:write_fp:CORE_ADDR val:val::0:0
f:1:TARGET_READ_SP:CORE_ADDR:read_sp:void:::0:0
f:1:TARGET_WRITE_SP:void:write_sp:CORE_ADDR val:val::0:0
#
+#
v:2:NUM_REGS:int:num_regs::::0:-1
# This macro gives the number of pseudo-registers that live in the
# register namespace but do not get fetched or stored on the target.
@@ -449,9 +463,9 @@ ${class} ${macro}(${actual})
staticdefault=${staticdefault}
predefault=${predefault}
postdefault=${postdefault}
- fallbackdefault=${fallbackdefault}
+ #fallbackdefault=${fallbackdefault}
invalid_p=${invalid_p}
- valid_p=${valid_p}
+ #valid_p=${valid_p}
fmt=${fmt}
print=${print}
print_p=${print_p}
@@ -459,7 +473,7 @@ ${class} ${macro}(${actual})
EOF
if class_is_predicate_p && fallback_default_p
then
- echo "Error: predicate function can not have a non- multi-arch default" 1>&2
+ echo "Error: predicate function ${macro} can not have a non- multi-arch default" 1>&2
kill $$
exit 1
fi
@@ -1134,7 +1148,7 @@ EOF
echo ""
echo ""
cat <<EOF
-/* Create a new \`\`struct gdbarch'' based in information provided by
+/* Create a new \`\`struct gdbarch'' based on information provided by
\`\`struct gdbarch_info''. */
EOF
echo ""
@@ -1273,7 +1287,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
EOF
function_list | while do_read
do
- if [ "${returntype}" == "void" ]
+ if [ "${returntype}" = "void" ]
then
echo "#if defined (${macro}) && GDB_MULTI_ARCH"
echo " /* Macro might contain \`[{}]' when not multi-arch */"