aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog16
-rw-r--r--gdb/gdbarch.c35
-rw-r--r--gdb/gdbarch.h29
-rwxr-xr-xgdb/gdbarch.sh16
-rw-r--r--gdb/gdbtypes.c2
-rw-r--r--gdb/printcmd.c6
-rw-r--r--gdb/symtab.c10
7 files changed, 97 insertions, 17 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ea26d61..e8a0a5d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,19 @@
+Fri Aug 25 12:11:21 2000 David Taylor <taylor@texas.cygnus.com>
+
+ * symtab.c (search_symbols): Fix off by one error in index for
+ initializing variables ourtype, ourtype2, ourtype3, and ourtype4.
+ (symtab_symbol_info): fix similar off by one error.
+
+Fri Aug 25 12:03:15 2000 David Taylor <taylor@texas.cygnus.com>
+
+ * gdbarch.sh (TARGET_ADDR_BIT): New macro for the number
+ of bits in gdb's representation of a target address.
+ * gdbarch.c, gdbarch.h: Regenerated.
+ * gdbtypes.c (build_gdbtypes): Use TARGET_ADDR_BIT instead of
+ TARGET_PTR_BIT when initializing builtin_type_CORE_ADDR.
+ * printcmd.c (print_address_numeric): Use TARGET_ADDR_BIT instead
+ of TARGET_PTR_BIT, because we're printing an address, not a pointer.
+
2000-08-25 Pierre Muller <muller@ics.u-strasbg.fr>
* Makefile.in: add rules to compile and link pascal specific files.
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index aa62d13..6bf83bb 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -22,13 +22,13 @@
/* This file was created with the aid of ``gdbarch.sh''.
- The bourn shell script ``gdbarch.sh'' creates the files
+ The Bourne shell script ``gdbarch.sh'' creates the files
``new-gdbarch.c'' and ``new-gdbarch.h and then compares them
against the existing ``gdbarch.[hc]''. Any differences found
being reported.
If editing this file, please also run gdbarch.sh and merge any
- changes into that script. Conversely, when makeing sweeping changes
+ changes into that script. Conversely, when making sweeping changes
to this file, modifying gdbarch.sh and using its output may prove
easier. */
@@ -136,6 +136,7 @@ struct gdbarch
int double_bit;
int long_double_bit;
int ptr_bit;
+ int addr_bit;
int bfd_vma_bit;
int ieee_float;
gdbarch_read_pc_ftype *read_pc;
@@ -258,6 +259,7 @@ struct gdbarch startup_gdbarch =
8 * sizeof (long double),
8 * sizeof (void*),
8 * sizeof (void*),
+ 8 * sizeof (void*),
0,
0,
0,
@@ -469,6 +471,8 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* 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 */
+ if (gdbarch->addr_bit == 0)
+ gdbarch->addr_bit = TARGET_PTR_BIT;
/* Skip verify of bfd_vma_bit, invalid_p == 0 */
/* Skip verify of ieee_float, invalid_p == 0 */
/* Skip verify of read_pc, invalid_p == 0 */
@@ -728,6 +732,11 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: TARGET_PTR_BIT # %s\n",
XSTRING (TARGET_PTR_BIT));
#endif
+#ifdef TARGET_ADDR_BIT
+ fprintf_unfiltered (file,
+ "gdbarch_dump: TARGET_ADDR_BIT # %s\n",
+ XSTRING (TARGET_ADDR_BIT));
+#endif
#ifdef TARGET_BFD_VMA_BIT
fprintf_unfiltered (file,
"gdbarch_dump: TARGET_BFD_VMA_BIT # %s\n",
@@ -1335,6 +1344,11 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: TARGET_PTR_BIT = %ld\n",
(long) TARGET_PTR_BIT);
#endif
+#ifdef TARGET_ADDR_BIT
+ fprintf_unfiltered (file,
+ "gdbarch_dump: TARGET_ADDR_BIT = %ld\n",
+ (long) TARGET_ADDR_BIT);
+#endif
#ifdef TARGET_BFD_VMA_BIT
fprintf_unfiltered (file,
"gdbarch_dump: TARGET_BFD_VMA_BIT = %ld\n",
@@ -2093,6 +2107,23 @@ set_gdbarch_ptr_bit (struct gdbarch *gdbarch,
}
int
+gdbarch_addr_bit (struct gdbarch *gdbarch)
+{
+ if (gdbarch->addr_bit == 0)
+ internal_error ("gdbarch: gdbarch_addr_bit invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_addr_bit called\n");
+ return gdbarch->addr_bit;
+}
+
+void
+set_gdbarch_addr_bit (struct gdbarch *gdbarch,
+ int addr_bit)
+{
+ gdbarch->addr_bit = addr_bit;
+}
+
+int
gdbarch_bfd_vma_bit (struct gdbarch *gdbarch)
{
/* Skip verify of bfd_vma_bit, invalid_p == 0 */
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 0b8b641..2fa2f6e 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -22,13 +22,13 @@
/* This file was created with the aid of ``gdbarch.sh''.
- The bourn shell script ``gdbarch.sh'' creates the files
+ The Bourne shell script ``gdbarch.sh'' creates the files
``new-gdbarch.c'' and ``new-gdbarch.h and then compares them
against the existing ``gdbarch.[hc]''. Any differences found
being reported.
If editing this file, please also run gdbarch.sh and merge any
- changes into that script. Conversely, when makeing sweeping changes
+ changes into that script. Conversely, when making sweeping changes
to this file, modifying gdbarch.sh and using its output may prove
easier. */
@@ -189,7 +189,15 @@ 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 */
+/* For most targets, a pointer on the target and its representation as an
+ address in GDB have the same size and "look the same". For such a
+ target, you need only set TARGET_PTR_BIT / ptr_bit and TARGET_ADDR_BIT
+ / addr_bit will be set from it.
+
+ If TARGET_PTR_BIT and TARGET_ADDR_BIT are different, you'll probably
+ also need to set POINTER_TO_ADDRESS and ADDRESS_TO_POINTER as well.
+
+ ptr_bit is the size of a pointer on the target */
/* Default (value) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (TARGET_PTR_BIT)
@@ -204,6 +212,21 @@ extern void set_gdbarch_ptr_bit (struct gdbarch *gdbarch, int ptr_bit);
#endif
#endif
+/* addr_bit is the size of a target address as represented in gdb */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_ADDR_BIT)
+#define TARGET_ADDR_BIT (TARGET_PTR_BIT)
+#endif
+
+extern int gdbarch_addr_bit (struct gdbarch *gdbarch);
+extern void set_gdbarch_addr_bit (struct gdbarch *gdbarch, int addr_bit);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_ADDR_BIT)
+#define TARGET_ADDR_BIT (gdbarch_addr_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. */
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 2cffe3e..069d277 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -319,8 +319,18 @@ v::TARGET_FLOAT_BIT:int:float_bit::::8 * sizeof (float):4*TARGET_CHAR_BIT::0
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
+# For most targets, a pointer on the target and its representation as an
+# address in GDB have the same size and "look the same". For such a
+# target, you need only set TARGET_PTR_BIT / ptr_bit and TARGET_ADDR_BIT
+# / addr_bit will be set from it.
+#
+# If TARGET_PTR_BIT and TARGET_ADDR_BIT are different, you'll probably
+# also need to set POINTER_TO_ADDRESS and ADDRESS_TO_POINTER as well.
+#
+# ptr_bit is the size of a pointer on the target
v::TARGET_PTR_BIT:int:ptr_bit::::8 * sizeof (void*):TARGET_INT_BIT::0
+# addr_bit is the size of a target address as represented in gdb
+v::TARGET_ADDR_BIT:int:addr_bit::::8 * sizeof (void*):0:TARGET_PTR_BIT:
# 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
#
@@ -515,13 +525,13 @@ cat <<EOF
/* This file was created with the aid of \`\`gdbarch.sh''.
- The bourn shell script \`\`gdbarch.sh'' creates the files
+ The Bourne shell script \`\`gdbarch.sh'' creates the files
\`\`new-gdbarch.c'' and \`\`new-gdbarch.h and then compares them
against the existing \`\`gdbarch.[hc]''. Any differences found
being reported.
If editing this file, please also run gdbarch.sh and merge any
- changes into that script. Conversely, when makeing sweeping changes
+ changes into that script. Conversely, when making sweeping changes
to this file, modifying gdbarch.sh and using its output may prove
easier. */
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 3fee0cf..63bd448 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -2929,7 +2929,7 @@ build_gdbtypes (void)
though the two can be different (cf d10v) */
builtin_type_ptr = make_pointer_type (builtin_type_void, NULL);
builtin_type_CORE_ADDR =
- init_type (TYPE_CODE_INT, TARGET_PTR_BIT / 8,
+ init_type (TYPE_CODE_INT, TARGET_ADDR_BIT / 8,
TYPE_FLAG_UNSIGNED,
"__CORE_ADDR", (struct objfile *) NULL);
builtin_type_bfd_vma =
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 8210b55..65621e3 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -726,9 +726,9 @@ print_address_numeric (CORE_ADDR addr, int use_local, struct ui_file *stream)
kept in the least significant bits of ADDR - the upper bits were
either zero or sign extended. Should ADDRESS_TO_POINTER() or
some ADDRESS_TO_PRINTABLE() be used to do the conversion? */
- int ptr_bit = TARGET_PTR_BIT;
- if (ptr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
- addr &= ((CORE_ADDR) 1 << ptr_bit) - 1;
+ int addr_bit = TARGET_ADDR_BIT;
+ if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
+ addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
print_longest (stream, 'x', use_local, (ULONGEST) addr);
}
diff --git a/gdb/symtab.c b/gdb/symtab.c
index b116375..f48368f 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3573,10 +3573,10 @@ search_symbols (regexp, kind, nfiles, files, matches)
if (kind < LABEL_NAMESPACE)
error ("must search on specific namespace");
- ourtype = types[(int) (kind - LABEL_NAMESPACE)];
- ourtype2 = types2[(int) (kind - LABEL_NAMESPACE)];
- ourtype3 = types3[(int) (kind - LABEL_NAMESPACE)];
- ourtype4 = types4[(int) (kind - LABEL_NAMESPACE)];
+ ourtype = types[(int) (kind - VARIABLES_NAMESPACE)];
+ ourtype2 = types2[(int) (kind - VARIABLES_NAMESPACE)];
+ ourtype3 = types3[(int) (kind - VARIABLES_NAMESPACE)];
+ ourtype4 = types4[(int) (kind - VARIABLES_NAMESPACE)];
sr = *matches = NULL;
tail = NULL;
@@ -3903,7 +3903,7 @@ symtab_symbol_info (char *regexp, namespace_enum kind, int from_tty)
printf_filtered (regexp
? "All %ss matching regular expression \"%s\":\n"
: "All defined %ss:\n",
- classnames[(int) (kind - LABEL_NAMESPACE - 1)], regexp);
+ classnames[(int) (kind - VARIABLES_NAMESPACE)], regexp);
for (p = symbols; p != NULL; p = p->next)
{