This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] [CRIS] Don't internal error if forced big endian


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=114d7832b0e07452277d748c81d8bc0c5675a1bc

commit 114d7832b0e07452277d748c81d8bc0c5675a1bc
Author: Pedro Alves <palves@redhat.com>
Date:   Tue Mar 8 01:45:09 2016 +0000

    [CRIS] Don't internal error if forced big endian
    
    This fixes:
    
      $ ./gdb -q -ex "set endian big" -ex "set architecture cris"
      The target is assumed to be big endian
      .../src/gdb/cris-tdep.c:4051: internal-error: cris_gdbarch_init: big endian byte order in info
      A problem internal to GDB has been detected,
      further debugging may prove unreliable.
      Quit this debugging session? (y or n)
    
    The "set cris-version" command can likewise cause internal errors.
    
    The gdbarch init routine should be returning 0 to reject the
    architecture instead of internal erroring on user input.
    
    gdb/ChangeLog:
    2016-03-09  Pedro Alves  <palves@redhat.com>
    
    	* cris-tdep.c (cris_gdbarch_init): Return 0 if the info's byte
    	order is BFD_ENDIAN_BIG or if the cris version is unsupported.

Diff:
---
 gdb/ChangeLog   |  5 +++++
 gdb/cris-tdep.c | 16 +++++++---------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1718ff1..a6414c1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2016-03-09  Pedro Alves  <palves@redhat.com>
 
+	* cris-tdep.c (cris_gdbarch_init): Return 0 if the info's byte
+	order is BFD_ENDIAN_BIG or if the cris version is unsupported.
+
+2016-03-09  Pedro Alves  <palves@redhat.com>
+
 	* doublest.c: Extend comments.
 	(floatformat_to_doublest, floatformat_from_doublest): Copy the
 	floatformat's total size, not the host type's size.
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 971ee9f..d350ce8 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -4048,10 +4048,10 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       break;
 
     case BFD_ENDIAN_BIG:
-      internal_error (__FILE__, __LINE__,
-		      _("cris_gdbarch_init: big endian byte order in info"));
-      break;
-    
+      /* Cris is always little endian, but the user could have forced
+	 big endian with "set endian".  */
+      return 0;
+
     default:
       internal_error (__FILE__, __LINE__,
 		      _("cris_gdbarch_init: unknown byte order in info"));
@@ -4083,9 +4083,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     case 8:
     case 9:
       /* Old versions; not supported.  */
-      internal_error (__FILE__, __LINE__, 
-		      _("cris_gdbarch_init: unsupported CRIS version"));
-      break;
+      return 0;
 
     case 10:
     case 11: 
@@ -4125,8 +4123,8 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       break;
 
     default:
-      internal_error (__FILE__, __LINE__, 
-		      _("cris_gdbarch_init: unknown CRIS version"));
+      /* Unknown version.  */
+      return 0;
     }
 
   /* Dummy frame functions (shared between CRISv10 and CRISv32 since they


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]