This is the mail archive of the gdb-patches@sources.redhat.com 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]

[rfa/cli] Check for bad switch in defind_command


Hello,

To follow up the attatched e-mail.  The below should fix the HP build
problem.

	Andrew
Tue Jan 30 15:14:26 2001  Andrew Cagney  <cagney@skil>

	* cli/cli-script.c (define_command): Check for a bad hook value in
 	switch statement.

Index: cli/cli-script.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-script.c,v
retrieving revision 1.2
diff -p -r1.2 cli-script.c
*** cli-script.c	2000/12/15 01:01:51	1.2
--- cli-script.c	2001/01/30 23:16:29
*************** define_command (char *comname, int from_
*** 1169,1174 ****
--- 1169,1175 ----
            break;
          default:
            /* Should never come here as hookc would be 0. */
+ 	  internal_error ("%s:%d: bad switch", __FILE__, __LINE__);
          }
      }
  }


1. The HP-UX cc compiler does not seem to like seeing a default: case in
a switch without something after it; I inserted a break and the
compiler likes it.

2. Starting sub-processes in fork-child.c:fork_inferior is done
without the -f flag, which lets the shell run the startup scripts and
fork things.  The comments above the execlp seem to indicate that the
-f should be present, however, it's not there.  I would imagine that
the problem has been somehow fixed elsewhere, but became un-fixed for
hppa2.0w-hp-hpux11.00.  

I don't know what the "correct" fix here is; if there is only a
problem on this particular architecture, you probably only want the
change on that architecture.

Without the -f, the code starts the sub-shell, goes into
startup_inferior, sees a fork, and decrements the count, then sees a
SIGCHLD, tells the child to resume, but the whole thing wedges there.
	-Eric

Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.21
diff -c -3 -p -r1.21 top.c
*** top.c       2000/11/16 14:51:50     1.21
--- top.c       2000/11/23 02:04:42
*************** define_command (char *comname, int from_
*** 3104,3109 ****
--- 3104,3110 ----
            break;
          default:
            /* Should never come here as hookc would be 0. */
+           break;
          }
      }
  }

Index: fork-child.c
===================================================================
RCS file: /cvs/src/src/gdb/fork-child.c,v
retrieving revision 1.6
diff -c -3 -p -r1.6 fork-child.c
*** fork-child.c        2000/09/01 23:39:11     1.6
--- fork-child.c        2000/11/23 02:04:42
*************** fork_inferior (char *exec_file, char *al
*** 305,311 ****
         */
        if (shell)
        {
!         execlp (shell_file, shell_file, "-c", shell_command, (char *) 0);
  
          /* If we get here, it's an error */
          fprintf_unfiltered (gdb_stderr, "Cannot exec %s: %s.\n", shell_file,
--- 305,311 ----
         */
        if (shell)
        {
!         execlp (shell_file, shell_file, "-f", "-c", shell_command, (char *) 0)
;
  
          /* If we get here, it's an error */
          fprintf_unfiltered (gdb_stderr, "Cannot exec %s: %s.\n", shell_file,




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