#include "target.h"
#include <tcl.h>
#include <tk.h>
+#ifdef ANSI_PROTOTYPES
+#include <stdarg.h>
+#else
#include <varargs.h>
+#endif
#include <signal.h>
#include <fcntl.h>
#include <unistd.h>
static int disassemble_from_exec = -1;
+/* Supply malloc calls for tcl/tk. */
+
+char *
+Tcl_Malloc (size)
+ unsigned int size;
+{
+ return xmalloc (size);
+}
+
+char *
+Tcl_Realloc (ptr, size)
+ char *ptr;
+ unsigned int size;
+{
+ return xrealloc (ptr, size);
+}
+
+void
+Tcl_Free(ptr)
+ char *ptr;
+{
+ free (ptr);
+}
+
static void
null_routine(arg)
int arg;
FILE *stream;
{
if (result_ptr)
- Tcl_DStringAppend (result_ptr, ptr, -1);
+ Tcl_DStringAppend (result_ptr, (char *)ptr, -1);
else
{
Tcl_DString str;
Tcl_DStringInit (&str);
Tcl_DStringAppend (&str, "gdbtk_tcl_fputs", -1);
- Tcl_DStringAppendElement (&str, ptr);
+ Tcl_DStringAppendElement (&str, (char *)ptr);
Tcl_Eval (interp, Tcl_DStringValue (&str));
Tcl_DStringFree (&str);
}
static int
-gdbtk_query (args)
+gdbtk_query (query, args)
+ char *query;
va_list args;
{
- char *query;
char buf[200];
long val;
- query = va_arg (args, char *);
-
vsprintf (buf, query, args);
Tcl_VarEval (interp, "gdbtk_tcl_query ", "{", buf, "}", NULL);
}
\f
static void
+#ifdef ANSI_PROTOTYPES
+dsprintf_append_element (Tcl_DString *dsp, char *format, ...)
+#else
dsprintf_append_element (va_alist)
va_dcl
+#endif
{
va_list args;
+ char buf[1024];
+
+#ifdef ANSI_PROTOTYPES
+ va_start (args, format);
+#else
Tcl_DString *dsp;
char *format;
- char buf[1024];
va_start (args);
-
dsp = va_arg (args, Tcl_DString *);
format = va_arg (args, char *);
+#endif
vsprintf (buf, format, args);
if (disassemble_from_exec == -1)
if (strcmp (target_shortname, "child") == 0
- || strcmp (target_shortname, "procfs") == 0)
+ || strcmp (target_shortname, "procfs") == 0
+ || strcmp (target_shortname, "vxprocess") == 0)
disassemble_from_exec = 0; /* It's a child process, read inferior mem */
else
disassemble_from_exec = 1; /* It's remote, read the exec file */
if (ioctl (x_fd, FIOASYNC, &i))
perror_with_name ("gdbtk_init: ioctl FIOASYNC failed");
+#ifdef SIOCSPGRP
i = getpid();
if (ioctl (x_fd, SIOCSPGRP, &i))
perror_with_name ("gdbtk_init: ioctl SIOCSPGRP failed");
+
+#else
+#ifdef F_SETOWN
+ i = getpid();
+ if (fcntl (x_fd, F_SETOWN, i))
+ perror_with_name ("gdbtk_init: fcntl F_SETOWN failed");
+#endif /* F_SETOWN */
+#endif /* !SIOCSPGRP */
#else
if (ioctl (x_fd, I_SETSIG, S_INPUT|S_RDNORM) < 0)
perror_with_name ("gdbtk_init: ioctl I_SETSIG failed");