summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/arch-utils.c20
-rw-r--r--gdb/gdbarch.c2
-rw-r--r--gdb/gdbarch.h12
-rwxr-xr-xgdb/gdbarch.sh14
-rw-r--r--gdb/rs6000-nat.c5
6 files changed, 44 insertions, 18 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 90fc8134421..e793492bcbf 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2000-08-10 Andrew Cagney <cagney@ops1.cygnus.com>
+
+ * rs6000-nat.c (set_host_arch): Check value returned by
+ gdbarch_update_p.
+ * gdbarch.sh (gdbarch_update_p): Rename gdbarch_update.
+ * gdbarch.h, gdbarch.c: Regenerate
+ * arch-utils.c (set_gdbarch_from_file,
+ initialize_current_architecture, set_endian): Update.
+
2000-08-10 Jimmy Guo <guo@cup.hp.com>
* c-lang.c: Set case sensitivity on for c_language_defn,
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 862b283f19e..5c9f070e59a 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -298,7 +298,10 @@ set_endian (char *ignore_args, int from_tty, struct cmd_list_element *c)
struct gdbarch_info info;
memset (&info, 0, sizeof info);
info.byte_order = LITTLE_ENDIAN;
- gdbarch_update (info);
+ if (! gdbarch_update_p (info))
+ {
+ printf_unfiltered ("Little endian target not supported by GDB\n");
+ }
}
else
{
@@ -313,7 +316,10 @@ set_endian (char *ignore_args, int from_tty, struct cmd_list_element *c)
struct gdbarch_info info;
memset (&info, 0, sizeof info);
info.byte_order = BIG_ENDIAN;
- gdbarch_update (info);
+ if (! gdbarch_update_p (info))
+ {
+ printf_unfiltered ("Big endian target not supported by GDB\n");
+ }
}
else
{
@@ -484,7 +490,7 @@ set_architecture (char *ignore_args, int from_tty, struct cmd_list_element *c)
info.bfd_arch_info = bfd_scan_arch (set_architecture_string);
if (info.bfd_arch_info == NULL)
internal_error ("set_architecture: bfd_scan_arch failed");
- if (gdbarch_update (info))
+ if (gdbarch_update_p (info))
target_architecture_auto = 0;
else
printf_unfiltered ("Architecture `%s' not reconized.\n",
@@ -546,7 +552,8 @@ set_gdbarch_from_file (bfd *abfd)
struct gdbarch_info info;
memset (&info, 0, sizeof info);
info.abfd = abfd;
- gdbarch_update (info);
+ if (! gdbarch_update_p (info))
+ error ("Architecture of file not reconized.\n");
}
else
{
@@ -641,7 +648,10 @@ initialize_current_architecture (void)
if (GDB_MULTI_ARCH)
{
- gdbarch_update (info);
+ if (! gdbarch_update_p (info))
+ {
+ internal_error ("initialize_current_architecture: Selection of initial architecture failed");
+ }
}
/* Create the ``set architecture'' command appending ``auto'' to the
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index d679f93f365..dccdb624c6b 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -4021,7 +4021,7 @@ gdbarch_list_lookup_by_info (struct gdbarch_list *arches,
failed. */
int
-gdbarch_update (struct gdbarch_info info)
+gdbarch_update_p (struct gdbarch_info info)
{
struct gdbarch *new_gdbarch;
struct gdbarch_list **list;
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 7f713c795ab..819d85c452d 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -1349,13 +1349,15 @@ extern void gdbarch_free (struct gdbarch *);
architecture manipulation commands.
The INFO parameter shall be fully initialized (``memset (&INFO,
- sizeof (info), 0)'' set relevant fields) before gdbarch_update() is
- called. gdbarch_update() shall initialize any ``default'' fields
- using information obtained from the previous architecture or
+ sizeof (info), 0)'' set relevant fields) before gdbarch_update_p()
+ is called. gdbarch_update_p() shall initialize any ``default''
+ fields using information obtained from the previous architecture or
INFO.ABFD (if specified) before calling the corresponding
- architectures INIT function. */
+ architectures INIT function.
-extern int gdbarch_update (struct gdbarch_info info);
+ Returns non-zero if the update succeeds */
+
+extern int gdbarch_update_p (struct gdbarch_info info);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 0c9bdfb027e..df4053ea038 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -789,13 +789,15 @@ extern void gdbarch_free (struct gdbarch *);
architecture manipulation commands.
The INFO parameter shall be fully initialized (\`\`memset (&INFO,
- sizeof (info), 0)'' set relevant fields) before gdbarch_update() is
- called. gdbarch_update() shall initialize any \`\`default'' fields
- using information obtained from the previous architecture or
+ sizeof (info), 0)'' set relevant fields) before gdbarch_update_p()
+ is called. gdbarch_update_p() shall initialize any \`\`default''
+ fields using information obtained from the previous architecture or
INFO.ABFD (if specified) before calling the corresponding
- architectures INIT function. */
+ architectures INIT function.
-extern int gdbarch_update (struct gdbarch_info info);
+ Returns non-zero if the update succeeds */
+
+extern int gdbarch_update_p (struct gdbarch_info info);
@@ -1723,7 +1725,7 @@ gdbarch_list_lookup_by_info (struct gdbarch_list *arches,
failed. */
int
-gdbarch_update (struct gdbarch_info info)
+gdbarch_update_p (struct gdbarch_info info)
{
struct gdbarch *new_gdbarch;
struct gdbarch_list **list;
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index 6afb4cf76c0..0bf1e32da03 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -908,7 +908,10 @@ set_host_arch (int pid)
memset (&info, 0, sizeof info);
info.bfd_arch_info = bfd_get_arch_info (&abfd);
- gdbarch_update (info);
+ if (!gdbarch_update_p (info))
+ {
+ internal_error ("set_host_arch: failed to select architecture");
+ }
}