portability issues with gdb-6.4

Peter O'Gorman gdb-patches@mlists.thewrittenword.com
Fri May 12 03:16:00 GMT 2006


(originally posted to bug-gdb@gnu.org)

Hi,
We've just built gdb-6.4, and ran into one or two issues.
1) In gdb/gdbserver/remote-utils.c a variable is declared not at the
beginiing of the block. This breaks on many non-recent gcc compilers.
2) Is mips-irix a gdb supported platform? If so the mips subdir does not
build with the native cc, I'll assume that it builds on this platform
with gcc, so added a GCC check to configure.
3) Similarly for powerpc-aix, xlc does not build the subdir, so I made
the dir dependent on gcc. I have not tested if it builds with gcc on
aix.
4) struct symtab_and_line cursal = { }; is not portable. I changed these
to { 0 }, which compiles with irix cc, but it seems likely that just
removing the '= { }' would also work.

Patch against 6.4 is attached.

Thank you,
Peter

-------------- next part --------------
Index: gdb/gdbserver/remote-utils.c
===================================================================
--- gdb/gdbserver/remote-utils.c.orig
+++ gdb/gdbserver/remote-utils.c
@@ -681,9 +681,9 @@ prepare_resume_reply (char *buf, char st
 
       if (using_threads)
 	{
+	  unsigned int gdb_id_from_wait = thread_to_gdb_id (current_inferior);
 	  /* FIXME right place to set this? */
 	  thread_from_wait = ((struct inferior_list_entry *)current_inferior)->id;
-	  unsigned int gdb_id_from_wait = thread_to_gdb_id (current_inferior);
 
 	  if (debug_threads)
 	    fprintf (stderr, "Writing resume reply for %ld\n\n", thread_from_wait);
Index: sim/configure.ac
===================================================================
--- sim/configure.ac.orig
+++ sim/configure.ac
@@ -89,10 +89,12 @@ if test "${enable_sim}" != no; then
 	   common=yes
 	   ;;
        mips*-*-*)
-           AC_CONFIG_SUBDIRS(mips)
-	   testsuite=yes
-	   common=yes
-	   igen=yes
+	   if test "$GCC" = yes; then
+             AC_CONFIG_SUBDIRS(mips)
+	     testsuite=yes
+	     common=yes
+	     igen=yes
+	   fi
 	   ;;
        mn10300*-*-*)
            AC_CONFIG_SUBDIRS(mn10300)
@@ -110,8 +112,10 @@ if test "${enable_sim}" != no; then
 	   common=yes
 	   ;;
        powerpc*-*-* )
-           AC_CONFIG_SUBDIRS(ppc)
-	   common=yes
+	   if test "$GCC" = yes; then
+             AC_CONFIG_SUBDIRS(ppc)
+	     common=yes
+	   fi
 	   ;;
        v850*-*-* )
            AC_CONFIG_SUBDIRS(v850)
Index: gdb/cli/cli-cmds.c
===================================================================
--- gdb/cli/cli-cmds.c.orig
+++ gdb/cli/cli-cmds.c
@@ -651,9 +651,9 @@ static void
 list_command (char *arg, int from_tty)
 {
   struct symtabs_and_lines sals, sals_end;
-  struct symtab_and_line sal = { };
-  struct symtab_and_line sal_end = { };
-  struct symtab_and_line cursal = { };
+  struct symtab_and_line sal = { 0 };
+  struct symtab_and_line sal_end = { 0 };
+  struct symtab_and_line cursal = { 0 };
   struct symbol *sym;
   char *arg1;
   int no_end = 1;
Index: gdb/source.c
===================================================================
--- gdb/source.c.orig
+++ gdb/source.c
@@ -142,7 +142,7 @@ get_lines_to_list (void)
 struct symtab_and_line
 get_current_source_symtab_and_line (void)
 {
-  struct symtab_and_line cursal = { };
+  struct symtab_and_line cursal = { 0 };
 
   cursal.symtab = current_source_symtab;
   cursal.line = current_source_line;
@@ -181,7 +181,7 @@ set_default_source_symtab_and_line (void
 struct symtab_and_line
 set_current_source_symtab_and_line (const struct symtab_and_line *sal)
 {
-  struct symtab_and_line cursal = { };
+  struct symtab_and_line cursal = { 0 };
   
   cursal.symtab = current_source_symtab;
   cursal.line = current_source_line;


More information about the Gdb-patches mailing list