-/* Cadillac interface routines.
- Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Energize (formerly known as Cadillac) interface routines.
+ Copyright 1991, 1992 Free Software Foundation, Inc.
This file is part of GDB.
#include <ttyconn.h>
#include <varargs.h>
#include <sys/stat.h>
+#ifdef USG
+#include <sys/file.h>
+#endif
#include <fcntl.h>
#include <sys/filio.h>
#include <setjmp.h>
#include <termios.h>
#include <strings.h>
+/* Non-zero means that we're doing the cadillac interface. */
+int cadillac = 0;
+
/* Connection block for debugger<=>kernel communications. */
static Connection *conn = 0;
extern char *source_path;
-extern int cadillac;
-
char **pprompt; /* Pointer to pointer to prompt */
/* Tell cadillac_command_line_input() where to get its text from */
#define PTY_EVENT 2
\f
-static void
-prompt()
-{
- fputs_filtered(*pprompt, stdout);
-}
-
/* This routine redirects the output of fputs_filtered to the kernel so that
the user can see what's going on in his debugger window. */
void
cadillac_fputs(ptr)
- char *ptr;
+ const char *ptr;
{
if (conn)
- CVWriteTranscriptInfo (conn, instance_id, ptr);
+ CVWriteTranscriptInfo (conn, instance_id, (char *)ptr);
else
fputs (ptr, stdout);
}
if (!symtab)
return NULL;
- pathlen = strlen(symtab->dirname) + strlen(symtab->filename);
+ if (symtab->fullname)
+ return savestring(symtab->fullname, strlen(symtab->fullname));
+
+ if (symtab->dirname)
+ pathlen = strlen(symtab->dirname);
+ else
+ pathlen = 0;
+ if (symtab->filename)
+ pathlen += strlen(symtab->filename);
+
filename = xmalloc(pathlen+1);
- sprintf(filename, "%s%s", symtab->dirname, symtab->filename);
+
+ if (symtab->dirname)
+ strcpy(filename, symtab->dirname);
+ else
+ *filename = '\000';
+ if (symtab->filename)
+ strcat(filename, symtab->filename);
return filename;
}
}
\f
+void
cadillac_symbol_file(objfile)
struct objfile *objfile;
{
\f
/* Open up a pty and its associated tty. Return the fd of the tty. */
-char *
-cadillac_getpty()
+static void
+getpty()
{
int n, ptyfd, ttyfd;
static char dev[30];
#define HIGHPTY (('z' - 'p') * 16 - 1)
- if (inferior_pty >= 0) /* Only do this once */
- return dev;
-
for (n = 0; n <= HIGHPTY; n++)
{
sprintf(dev, "/dev/pty%c%x", n/16 + 'p', n%16);
inferior_pty = ptyfd;
inferior_tty = ttyfd;
- return dev;
+ return;
}
error ("getpty: can't get a pty\n");
if (*text != '\000')
execute_command_1(0, queue, "%s", text);
else
- prompt(); /* User just typed a blank line */
+ print_prompt(); /* User just typed a blank line */
}
break;
case QueryResponseRType:
/* Tell the rest of the world that Cadillac is now set up. */
cadillac = 1;
+
+ getpty(); /* Setup the pty */
+ dup2(inferior_tty, 0); /* Attach all GDB I/O to the pty */
+ dup2(inferior_tty, 1);
+ dup2(inferior_tty, 2);
}
/* This is called from execute_command, and provides a wrapper around
else
(*cmdblk->function.cfunc)(arg, from_tty);
- prompt();
+ print_prompt();
}
void
/* All requests from the Cadillac kernel eventually end up here. */
void
-cadillac_main_loop(pp)
- char **pp;
+cadillac_main_loop()
{
CTtyRequest *req;
struct cleanup *old_chain;
- pprompt = pp;
-
doing_breakcommands_message = 0;
/* We will come thru here any time there is an error, so send status if
send_status();
- prompt();
+ print_prompt();
/* The actual event loop! */