+Tue Jun 1 18:47:54 1999 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * parse.c (build_parse): New function. Initialize
+ msym_text_symbol_type, msym_data_symbol_type and
+ msym_unknown_symbol_type.
+ (_initialize_parse): Call build_parse.
+
+Tue Jun 1 10:45:24 1999 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * config/d10v/tm-d10v.h (REGISTER_CONVERTIBLE,
+ REGISTER_CONVERT_TO_RAW, REGISTER_CONVERT_TO_VIRTUAL): Convert
+ macros into functions.
+ * config/d10v/tm-d10v.h, d10v-tdep.c (d10v_register_convertable,
+ d10v_register_convert_to_virtual, d10v_register_convert_to_raw):
+ The new functions.
+
+1999-05-31 Fernando Nasser <fnasser@totem.to.cygnus.com>
+
+ * stack.c (print_args_stub): Add missing stream parameter.
+
+Mon May 31 15:50:08 1999 Andrew Cagney <cagney@b1.cygnus.com>
+
+ Fri May 28 16:51:00 1999 Martin Dorey <martin.dorey@madge.com>:
+ * valops.c, value.h (default_push_arguments): Fix order of
+ parameters to match PUSH_ARGUMENTS arguments.
+
+Thu May 27 11:42:55 1999 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * gdbarch.h (EXTRACT_STRUCT_VALUE_ADDRESS): Return 0.
+
+ * valops.c (value_assign): Delete redundant test of
+ REGISTER_CONVERTIBLE.
+
+Thu May 27 11:33:57 1999 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * config/w65/tm-w65.h, config/tic80/tm-tic80.h, config/sh/tm-sh.h,
+ config/i386/tm-i386m3.h, config/i386/tm-go32.h,
+ config/i386/tm-cygwin.h, config/h8500/tm-h8500.h,
+ config/d30v/tm-d30v.h, config/d10v/tm-d10v.h: Delete definition of
+ macro NAMES_HAVE_UNDERSCORE.
+
+Thu May 27 09:31:06 1999 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * gdbarch.h (EXTRACT_STRUCT_VALUE_ADDRESS,
+ EXTRACT_STRUCT_VALUE_ADDRESS_P): Provide default definitions.
+ * values.c (value_being_returned): Use
+ EXTRACT_STRUCT_VALUE_ADDRESS when EXTRACT_STRUCT_VALUE_ADDRESS_P.
+
+Wed May 26 13:51:25 1999 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * utils.c (tui_file_new, tui_file_delete, tui_fileopen): New
+ functions.
+ (tui_file_isatty): Rename gdb_file_isatty.
+ (gdb_file_init_astring): Use tui_file_new to create stream.
+ (gdb_file_get_strbuf, gdb_file_adjust_strbuf): Call gdb_file_data
+ to access the tui_stream.
+ (tui_file_flush): Rename gdb_flush. Call gdb_file_data to access
+ the tui_stream. Pass FILE and not STREAM down.
+
+ * utils.c (struct stdio_file, stdio_file_flush, stdio_file_fputs,
+ stdio_file_isatty, stdio_file_delete, stdio_file_new,
+ stdio_fileopen): Define type and functions. Implement a simple
+ STDIO based gdb_file.
+ (struct gdb_file, gdb_file_new, gdb_file_delete, null_file_isatty,
+ null_file_flush, null_file_fputs, null_file_delete, gdb_file_data,
+ set_gdb_file_flush, set_gdb_file_isatty, set_gdb_file_fputs,
+ set_gdb_file_data, fputs_unfiltered, gdb_flush, gdb_file_isatty):
+ Define type and functions. Implement virtual functions for
+ gdb_file.
+
+ * defs.h (struct gdb_file): Declare.
+ (GDB_FILE): Change type to struct gdb_file. Deprecate.
+ (gdb_file_flush_ftype, gdb_file_fputs_ftype,
+ gdb_file_isatty_ftype, gdb_file_delete_ftype): Add function type
+ declarations.
+
+ * defs.h (set_gdb_file_flush, set_gdb_file_fputs,
+ set_gdb_file_isatty, set_gdb_file_data, gdb_file_new,
+ gdb_file_delete, gdb_file_data, stdio_fileopen, tui_fileopen): Add
+ function declarations.
+ (gdb_fopen): Re-implement. Call stdio_file_new.
+ (gdb_fclose): Re-implement. Call gdb_file_delete.
+
+ * main.c (tui_file_fputs): Rename fputs_unfiltered. Use
+ gdb_file_data to gain access to the tui_stream data. Use FILE
+ instead of STREAM where applicable.
+ (main): Create gdb_stdout and gdb_stderr using tui_fileopen.
+
+ * defs.h (struct tui_stream): Add field ts_magic.
+ * utils.c (tui_file_magic): Local variable.
+ (tui_file_new): Set field ts_magic.
+ (tui_file_delete, tui_file_isatty, gdb_file_init_astring,
+ gdb_file_get_strbuf, gdb_file_adjust_strbuf, tui_file_flush):
+ Verify ts_magic.
+
+1999-05-25 Jim Blandy <jimb@zwingli.cygnus.com>
+
+ * breakpoint.c (insert_breakpoints, remove_breakpoint,
+ breakpoint_1): Add a 'default' case, which prints a warning
+ message, to remove EGCS warnings.
+
1999-05-25 Fernando Nasser <fnasser@totem.to.cygnus.com>
* utils.c (gdb_file_adjust_strbuf): Take into account the
ADD_FILES = $(REGEX) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES)
ADD_DEPS = $(REGEX1) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES)
-VERSION = 19990525
+VERSION = 19990601
DIST=gdb
LINT=/usr/5bin/lint
language.h m2-lang.h parser-defs.h $(symtab_h) $(value_h) \
$(bfd_h) objfiles.h symfile.h
+
### end of the gdb Makefile.in.
case bp_catch_exec :
val = target_insert_exec_catchpoint (inferior_pid);
break;
+ default:
+ warning ("GDB bug: breakpoint.c (insert_breakpoints): enclosing `if' does not protect `switch'");
+ break;
}
if (val < 0)
{
case bp_catch_exec :
val = target_remove_exec_catchpoint (inferior_pid);
break;
+ default:
+ warning ("GDB bug: breakpoint.c (remove_breakpoint): enclosing `if' does not protect `switch'");
+ break;
}
if (val)
return val;
/* Target-specific definition for the Mitsubishi D10V
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996,1999 Free Software Foundation, Inc.
This file is part of GDB.
/* Contributed by Martin Hunt, hunt@cygnus.com */
+
/* #define GDB_TARGET_IS_D10V - moved to gdbarch.h */
/* Define the bit, byte, and word ordering of the machine. */
/* convert $pc and $sp to/from virtual addresses */
-#define REGISTER_CONVERTIBLE(N) ((N) == PC_REGNUM || (N) == SP_REGNUM)
+extern int d10v_register_convertible PARAMS ((int nr));
+#define REGISTER_CONVERTIBLE(N) (d10v_register_convertible ((N)))
+extern void d10v_register_convert_to_virtual PARAMS ((int regnum, struct type *type, char *from, char *to));
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
-{ \
- ULONGEST x = extract_unsigned_integer ((FROM), REGISTER_RAW_SIZE (REGNUM)); \
- if (REGNUM == PC_REGNUM) x = (x << 2) | IMEM_START; \
- else x |= DMEM_START; \
- store_unsigned_integer ((TO), TYPE_LENGTH(TYPE), x); \
-}
+ d10v_register_convert_to_virtual ((REGNUM), (TYPE), (FROM), (TO))
+extern void d10v_register_convert_to_raw PARAMS ((struct type *type, int regnum, char *from, char *to));
#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
-{ \
- ULONGEST x = extract_unsigned_integer ((FROM), TYPE_LENGTH(TYPE)); \
- x &= 0x3ffff; \
- if (REGNUM == PC_REGNUM) x >>= 2; \
- store_unsigned_integer ((TO), 2, x); \
-}
+ d10v_register_convert_to_raw ((TYPE), (REGNUM), (FROM), (TO))
extern CORE_ADDR d10v_make_daddr PARAMS ((CORE_ADDR x));
#define D10V_MAKE_DADDR(x) (d10v_make_daddr (x))
extern void d10v_frame_find_saved_regs PARAMS ((struct frame_info *, struct frame_saved_regs *));
-#define NAMES_HAVE_UNDERSCORE
-
-
/* DUMMY FRAMES. Need these to support inferior function calls. They
work like this on D10V: First we set a breakpoint at 0 or __start.
Then we push all the registers onto the stack. Then put the
extern void d30v_frame_find_saved_regs PARAMS ((struct frame_info *, struct frame_saved_regs *));
-#define NAMES_HAVE_UNDERSCORE
-
/* DUMMY FRAMES. Need these to support inferior function calls.
They work like this on D30V:
First we set a breakpoint at 0 or __start.
#define SHORT_INT_MAX 32767
#define SHORT_INT_MIN -32768
-#define NAMES_HAVE_UNDERSCORE
-
typedef unsigned short INSN_WORD;
extern CORE_ADDR h8500_addr_bits_remove PARAMS ((CORE_ADDR));
((N < FP0_REGNUM) ? builtin_type_int : \
builtin_type_double)
-#define NAMES_HAVE_UNDERSCORE
-
#define IN_SOLIB_CALL_TRAMPOLINE(pc, name) skip_trampoline_code (pc, name)
#define SKIP_TRAMPOLINE_CODE(pc) skip_trampoline_code (pc, 0)
extern CORE_ADDR skip_trampoline_code PARAMS ((CORE_ADDR pc, char *name));
#undef TARGET_LONG_DOUBLE_BIT
#define TARGET_LONG_DOUBLE_BIT 96
-
-#define NAMES_HAVE_UNDERSCORE
/* we can do it */
#define ATTACH_DETACH 1
-/* Define this if the C compiler puts an underscore at the front
- of external names before giving them to the linker. */
-
-#define NAMES_HAVE_UNDERSCORE
-
/* Sigh. There should be a file for i386 but no sysv stuff in it */
#include "i386/tm-i386.h"
#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
sh_frame_find_saved_regs(frame_info, &(frame_saved_regs))
-#define NAMES_HAVE_UNDERSCORE
-
typedef unsigned short INSN_WORD;
extern CORE_ADDR sh_push_arguments PARAMS ((int nargs,
#define TARGET_BYTE_ORDER LITTLE_ENDIAN
-/* Define this if the C compiler puts an underscore at the front
- of external names before giving them to the linker. */
-
-#define NAMES_HAVE_UNDERSCORE
-
#define NUM_REGS 38
#define REGISTER_NAMES \
#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
frame_find_saved_regs(frame_info, &(frame_saved_regs))
-#define NAMES_HAVE_UNDERSCORE
-
typedef unsigned short INSN_WORD;
extern CORE_ADDR w65_addr_bits_remove PARAMS ((CORE_ADDR));
return builtin_type_short;
}
-#if 0
/* convert $pc and $sp to/from virtual addresses */
-#define REGISTER_CONVERTIBLE(N) ((N) == PC_REGNUM || (N) == SP_REGNUM)
-#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
-{ \
- ULONGEST x = extract_unsigned_integer ((FROM), REGISTER_RAW_SIZE (REGNUM)); \
- if (REGNUM == PC_REGNUM) x = (x << 2) | IMEM_START; \
- else x |= DMEM_START; \
- store_unsigned_integer ((TO), TYPE_LENGTH(TYPE), x); \
+int
+d10v_register_convertible (nr)
+ int nr;
+{
+ return ((nr) == PC_REGNUM || (nr) == SP_REGNUM);
+}
+
+void
+d10v_register_convert_to_virtual (regnum, type, from, to)
+ int regnum;
+ struct type *type;
+ char *from;
+ char *to;
+{
+ ULONGEST x = extract_unsigned_integer (from, REGISTER_RAW_SIZE (regnum));
+ if (regnum == PC_REGNUM)
+ x = (x << 2) | IMEM_START;
+ else
+ x |= DMEM_START;
+ store_unsigned_integer (to, TYPE_LENGTH (type), x);
}
-#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
-{ \
- ULONGEST x = extract_unsigned_integer ((FROM), TYPE_LENGTH(TYPE)); \
- x &= 0x3ffff; \
- if (REGNUM == PC_REGNUM) x >>= 2; \
- store_unsigned_integer ((TO), 2, x); \
+
+void
+d10v_register_convert_to_raw (type, regnum, from, to)
+ struct type *type;
+ int regnum;
+ char *from;
+ char *to;
+{
+ ULONGEST x = extract_unsigned_integer (from, TYPE_LENGTH (type));
+ x &= 0x3ffff;
+ if (regnum == PC_REGNUM)
+ x >>= 2;
+ store_unsigned_integer (to, 2, x);
}
-#endif
+
CORE_ADDR
d10v_make_daddr (x)
}
}
+
extern void (*target_resume_hook) PARAMS ((void));
extern void (*target_wait_loop_hook) PARAMS ((void));
};
/* new */
-typedef struct tui_stream
+struct tui_stream
{
+ int *ts_magic;
enum streamtype ts_streamtype;
FILE *ts_filestream;
char *ts_strbuf;
int ts_buflen;
-} GDB_FILE;
+};
+
+struct gdb_file;
+typedef struct gdb_file GDB_FILE; /* deprecated */
extern GDB_FILE *gdb_stdout;
extern GDB_FILE *gdb_stderr;
-#if 0
-typedef FILE GDB_FILE;
-#define gdb_stdout stdout
-#define gdb_stderr stderr
-#endif
-
#if defined(TUI)
#include "tui.h"
#include "tuiCommand.h"
#include "tuiWin.h"
#endif
+/* Create a new gdb_file with the specified methods. */
+
+typedef void (gdb_file_flush_ftype) PARAMS ((struct gdb_file *stream));
+extern void set_gdb_file_flush PARAMS ((struct gdb_file *stream, gdb_file_flush_ftype *flush));
+
+typedef void (gdb_file_fputs_ftype) PARAMS ((const char *, struct gdb_file *stream));
+extern void set_gdb_file_fputs PARAMS ((struct gdb_file *stream, gdb_file_fputs_ftype *fputs));
+
+typedef int (gdb_file_isatty_ftype) PARAMS ((struct gdb_file *stream));
+extern void set_gdb_file_isatty PARAMS ((struct gdb_file *stream, gdb_file_isatty_ftype *isatty));
+
+typedef void (gdb_file_delete_ftype) PARAMS ((struct gdb_file *stream));
+extern void set_gdb_file_data PARAMS ((struct gdb_file *stream, void *data, gdb_file_delete_ftype *delete));
+
+extern struct gdb_file *gdb_file_new PARAMS ((void));
+
+extern void gdb_file_delete PARAMS ((struct gdb_file *stream));
+
+extern void *gdb_file_data PARAMS ((struct gdb_file *file));
+
+/* Open the specified FILE as a gdb_file. */
+extern struct gdb_file *stdio_fileopen PARAMS ((FILE *));
+/* #if defined (TUI) */
+extern struct gdb_file *tui_fileopen PARAMS ((FILE *));
+/* #endif */
+
+/* deprecated - use gdb_file_delete */
extern void gdb_fclose PARAMS ((GDB_FILE **));
extern void gdb_flush PARAMS ((GDB_FILE *));
extern int gdb_file_isatty PARAMS ((GDB_FILE *));
+/* #if defined (TUI) */
extern GDB_FILE *gdb_file_init_astring PARAMS ((int));
+/* #endif */
extern void gdb_file_deallocate PARAMS ((GDB_FILE **));
+/* #if defined (TUI) */
extern char *gdb_file_get_strbuf PARAMS ((GDB_FILE *));
+/* #endif */
+/* #if defined (TUI) */
extern void gdb_file_adjust_strbuf PARAMS ((int, GDB_FILE *));
+/* #endif */
extern void print_spaces PARAMS ((int, GDB_FILE *));
+Tue Jun 1 15:04:15 1999 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * gdbint.texinfo (TARGET_COMPLEX_BIT, TARGET_DOUBLE_COMPLEX_BIT):
+ Document that these are not used.
+
+Thu May 27 09:28:15 1999 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * gdbint.texinfo (EXTRACT_STRUCT_VALUE_ADDRESS_P): Document.
+
Mon May 24 10:07:39 1999 Andrew Cagney <cagney@b1.cygnus.com>
* gdbint.texinfo (FRAME_NUM_ARGS): Update definition. Parameter
into @var{valbuf}.
@item EXTRACT_STRUCT_VALUE_ADDRESS(regbuf)
-Define this to extract from an array @var{regbuf} containing the (raw)
-register state, the address in which a function should return its
-structure value, as a CORE_ADDR (or an expression that can be used as
-one).
+When @var{EXTRACT_STRUCT_VALUE_ADDRESS_P} this is used to to extract
+from an array @var{regbuf} (containing the raw register state) the
+address in which a function should return its structure value, as a
+CORE_ADDR (or an expression that can be used as one).
+
+@item EXTRACT_STRUCT_VALUE_ADDRESS_P
+Predicate for @var{EXTRACT_STRUCT_VALUE_ADDRESS}.
@item FLOAT_INFO
If defined, then the `info float' command will print information about
@item TARGET_COMPLEX_BIT
Number of bits in a complex number; defaults to @code{2 * TARGET_FLOAT_BIT}.
+At present this macro is not used.
+
@item TARGET_DOUBLE_BIT
Number of bits in a double float; defaults to @code{8 * TARGET_CHAR_BIT}.
@item TARGET_DOUBLE_COMPLEX_BIT
Number of bits in a double complex; defaults to @code{2 * TARGET_DOUBLE_BIT}.
+At present this macro is not used.
+
@item TARGET_FLOAT_BIT
Number of bits in a float; defaults to @code{4 * TARGET_CHAR_BIT}.
#endif
+/* Fallback definition for EXTRACT_STRUCT_VALUE_ADDRESS */
+#ifndef EXTRACT_STRUCT_VALUE_ADDRESS
+#define EXTRACT_STRUCT_VALUE_ADDRESS_P (0)
+#define EXTRACT_STRUCT_VALUE_ADDRESS(X) (abort (), 0)
+#else
+#ifndef EXTRACT_STRUCT_VALUE_ADDRESS_P
+#define EXTRACT_STRUCT_VALUE_ADDRESS_P (1)
+#endif
+#endif
+
+
/* Set the dynamic target-system-dependant parameters (architecture,
byte-order, ...) using information found in the BFD */
getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
current_directory = gdb_dirbuf;
- gdb_file_size = sizeof(GDB_FILE);
-
- gdb_stdout = (GDB_FILE *)xmalloc (gdb_file_size);
- gdb_stdout->ts_streamtype = afile;
- gdb_stdout->ts_filestream = stdout;
- gdb_stdout->ts_strbuf = NULL;
- gdb_stdout->ts_buflen = 0;
-
- gdb_stderr = (GDB_FILE *)xmalloc (gdb_file_size);
- gdb_stderr->ts_streamtype = afile;
- gdb_stderr->ts_filestream = stderr;
- gdb_stderr->ts_strbuf = NULL;
- gdb_stderr->ts_buflen = 0;
+#if 0
+ /* not yet */
+ gdb_stdout = stdio_fileopen (stdout);
+ gdb_stderr = stdio_fileopen (stderr);
+#else
+ gdb_stdout = tui_fileopen (stdout);
+ gdb_stderr = tui_fileopen (stderr);
+#endif
/* Parse arguments and options. */
{
}
\f
-/* All I/O sent to the *_filtered and *_unfiltered functions eventually ends up
- here. The fputs_unfiltered_hook is primarily used by GUIs to collect all
- output and send it to the GUI, instead of the controlling terminal. Only
- output to gdb_stdout and gdb_stderr are sent to the hook. Everything else
- is sent on to fputs to allow file I/O to be handled appropriately. */
+/* All TUI I/O sent to the *_filtered and *_unfiltered functions
+ eventually ends up here. The fputs_unfiltered_hook is primarily
+ used by GUIs to collect all output and send it to the GUI, instead
+ of the controlling terminal. Only output to gdb_stdout and
+ gdb_stderr are sent to the hook. Everything else is sent on to
+ fputs to allow file I/O to be handled appropriately. */
+
+/* FIXME: Should be broken up and moved to a TUI specific file. */
void
-fputs_unfiltered (linebuffer, stream)
+tui_file_fputs (linebuffer, file)
const char *linebuffer;
- GDB_FILE *stream;
+ GDB_FILE *file;
{
+ struct tui_stream *stream = gdb_file_data (file);
#if defined(TUI)
extern int tui_owns_terminal;
#endif
* new (XDB style) scheme, we do not do that anymore... - RT
*/
if (fputs_unfiltered_hook
- && (stream == gdb_stdout
- || stream == gdb_stderr))
- fputs_unfiltered_hook (linebuffer, stream);
+ && (file == gdb_stdout
+ || file == gdb_stderr))
+ fputs_unfiltered_hook (linebuffer, file);
else
{
#if defined(TUI)
#else
if (stream->ts_streamtype == astring) {
- gdb_file_adjust_strbuf(strlen(linebuffer), stream);
+ gdb_file_adjust_strbuf(strlen(linebuffer), file);
strcat(stream->ts_strbuf, linebuffer);
} else fputs (linebuffer, stream->ts_filestream);
#endif
return follow_type;
}
\f
-void
-_initialize_parse ()
+static void build_parse PARAMS ((void));
+static void
+build_parse ()
{
- type_stack_size = 80;
- type_stack_depth = 0;
- type_stack = (union type_stack_elt *)
- xmalloc (type_stack_size * sizeof (*type_stack));
-
msym_text_symbol_type =
init_type (TYPE_CODE_FUNC, 1, 0, "<text variable, no debug info>", NULL);
TYPE_TARGET_TYPE (msym_text_symbol_type) = builtin_type_int;
init_type (TYPE_CODE_INT, 1, 0,
"<variable (not text or data), no debug info>",
NULL);
+}
+
+void
+_initialize_parse ()
+{
+ type_stack_size = 80;
+ type_stack_depth = 0;
+ type_stack = (union type_stack_elt *)
+ xmalloc (type_stack_size * sizeof (*type_stack));
+
+ build_parse ();
add_show_from_set (
add_set_cmd ("expressiondebug", class_maintenance, var_zinteger,
struct print_args_args {
struct symbol *func;
struct frame_info *fi;
+ GDB_FILE *stream;
};
static int print_args_stub PARAMS ((PTR));
struct print_args_args *p = (struct print_args_args *)args;
numargs = FRAME_NUM_ARGS (p->fi);
- print_frame_args (p->func, p->fi, numargs, gdb_stdout);
+ print_frame_args (p->func, p->fi, numargs, p->stream);
return 0;
}
struct print_args_args args;
args.fi = fi;
args.func = func;
+ args.stream = gdb_stdout;
catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL);
QUIT;
}
return
}
+
set prms_id 0
set bug_id 0
}
}
-int
-gdb_file_isatty (stream)
- GDB_FILE *stream;
+
+/* ``struct gdb_file'' implementation that maps directly onto
+ <stdio.h>'s FILE. */
+
+static gdb_file_fputs_ftype stdio_file_fputs;
+static gdb_file_isatty_ftype stdio_file_isatty;
+static gdb_file_delete_ftype stdio_file_delete;
+static struct gdb_file *stdio_file_new PARAMS ((FILE *file, int close_p));
+static gdb_file_flush_ftype stdio_file_flush;
+
+static int stdio_file_magic;
+
+struct stdio_file
+{
+ int *magic;
+ FILE *file;
+ int close_p;
+};
+
+static struct gdb_file *
+stdio_file_new (file, close_p)
+ FILE *file;
+ int close_p;
+{
+ struct gdb_file *gdb_file = gdb_file_new ();
+ struct stdio_file *stdio = xmalloc (sizeof (struct stdio_file));
+ stdio->magic = &stdio_file_magic;
+ stdio->file = file;
+ stdio->close_p = close_p;
+ set_gdb_file_data (gdb_file, stdio, stdio_file_delete);
+ set_gdb_file_flush (gdb_file, stdio_file_flush);
+ set_gdb_file_fputs (gdb_file, stdio_file_fputs);
+ set_gdb_file_isatty (gdb_file, stdio_file_isatty);
+ return gdb_file;
+}
+
+static void
+stdio_file_delete (file)
+ struct gdb_file *file;
+{
+ struct stdio_file *stdio = gdb_file_data (file);
+ if (stdio->magic != &stdio_file_magic)
+ error ("Internal error: bad magic number");
+ if (stdio->close_p)
+ {
+ fclose (stdio->file);
+ }
+ free (stdio);
+}
+
+static void
+stdio_file_flush (file)
+ struct gdb_file *file;
{
+ struct stdio_file *stdio = gdb_file_data (file);
+ if (stdio->magic != &stdio_file_magic)
+ error ("Internal error: bad magic number");
+ fflush (stdio->file);
+}
+
+static void
+stdio_file_fputs (linebuffer, file)
+ const char *linebuffer;
+ struct gdb_file *file;
+{
+ struct stdio_file *stdio = gdb_file_data (file);
+ if (stdio->magic != &stdio_file_magic)
+ error ("Internal error: bad magic number");
+ fputs (linebuffer, stdio->file);
+}
+
+static int
+stdio_file_isatty (file)
+ struct gdb_file *file;
+{
+ struct stdio_file *stdio = gdb_file_data (file);
+ if (stdio->magic != &stdio_file_magic)
+ error ("Internal error: bad magic number");
+ return (isatty (fileno (stdio->file)));
+}
+
+/* Like fdopen(). Create a gdb_file from a previously opened FILE. */
+
+struct gdb_file *
+stdio_fileopen (file)
+ FILE *file;
+{
+ return stdio_file_new (file, 0);
+}
+
+
+/* A ``struct gdb_file'' that is compatible with all the legacy
+ code. */
+static gdb_file_flush_ftype tui_file_flush;
+extern gdb_file_fputs_ftype tui_file_fputs;
+static gdb_file_isatty_ftype tui_file_isatty;
+static gdb_file_delete_ftype tui_file_delete;
+static struct gdb_file *tui_file_new PARAMS ((void));
+static int tui_file_magic;
+
+static struct gdb_file *
+tui_file_new ()
+{
+ struct tui_stream *tui = xmalloc (sizeof (struct tui_stream));
+ struct gdb_file *file = gdb_file_new ();
+ set_gdb_file_data (file, tui, tui_file_delete);
+ set_gdb_file_flush (file, tui_file_flush);
+ set_gdb_file_fputs (file, tui_file_fputs);
+ set_gdb_file_isatty (file, tui_file_isatty);
+ tui->ts_magic = &tui_file_magic;
+ return file;
+}
+
+static void
+tui_file_delete (file)
+ struct gdb_file *file;
+{
+ struct tui_stream *tmpstream = gdb_file_data (file);
+ if (tmpstream->ts_magic != &tui_file_magic)
+ error ("Internal error: bad magic number");
+ if ((tmpstream->ts_streamtype == astring) &&
+ (tmpstream->ts_strbuf != NULL))
+ {
+ free (tmpstream->ts_strbuf);
+ }
+ free (tmpstream);
+}
+
+struct gdb_file *
+tui_fileopen (stream)
+ FILE *stream;
+{
+ struct gdb_file *file = tui_file_new ();
+ struct tui_stream *tmpstream = gdb_file_data (file);
+ tmpstream->ts_streamtype = afile;
+ tmpstream->ts_filestream = stream;
+ tmpstream->ts_strbuf = NULL;
+ tmpstream->ts_buflen = 0;
+ return file;
+}
+
+static int
+tui_file_isatty (file)
+ struct gdb_file *file;
+{
+ struct tui_stream *stream = gdb_file_data (file);
+ if (stream->ts_magic != &tui_file_magic)
+ error ("Internal error: bad magic number");
if (stream->ts_streamtype == afile)
return (isatty(fileno(stream->ts_filestream)));
else return 0;
gdb_file_init_astring (n)
int n;
{
- GDB_FILE *tmpstream;
+ struct gdb_file *file = tui_file_new ();
+ struct tui_stream *tmpstream = gdb_file_data (file);
+ if (tmpstream->ts_magic != &tui_file_magic)
+ error ("Internal error: bad magic number");
- tmpstream = xmalloc (sizeof(GDB_FILE));
tmpstream->ts_streamtype = astring;
tmpstream->ts_filestream = NULL;
if (n > 0)
tmpstream->ts_strbuf = NULL;
tmpstream->ts_buflen = n;
- return tmpstream;
+ return file;
}
void
gdb_file_deallocate (streamptr)
GDB_FILE **streamptr;
{
- GDB_FILE *tmpstream;
-
- tmpstream = *streamptr;
- if ((tmpstream->ts_streamtype == astring) &&
- (tmpstream->ts_strbuf != NULL))
- {
- free (tmpstream->ts_strbuf);
- }
-
- free (tmpstream);
+ gdb_file_delete (*streamptr);
*streamptr = NULL;
}
char *
-gdb_file_get_strbuf (stream)
- GDB_FILE *stream;
+gdb_file_get_strbuf (file)
+ GDB_FILE *file;
{
+ struct tui_stream *stream = gdb_file_data (file);
+ if (stream->ts_magic != &tui_file_magic)
+ error ("Internal error: bad magic number");
return (stream->ts_strbuf);
}
/* adjust the length of the buffer by the amount necessary
to accomodate appending a string of length N to the buffer contents */
void
-gdb_file_adjust_strbuf (n, stream)
+gdb_file_adjust_strbuf (n, file)
int n;
- GDB_FILE *stream;
+ GDB_FILE *file;
{
+ struct tui_stream *stream = gdb_file_data (file);
int non_null_chars;
+ if (stream->ts_magic != &tui_file_magic)
+ error ("Internal error: bad magic number");
if (stream->ts_streamtype != astring)
return;
char * name;
char * mode;
{
- int gdb_file_size;
- GDB_FILE *tmp;
-
- gdb_file_size = sizeof(GDB_FILE);
- tmp = (GDB_FILE *) xmalloc (gdb_file_size);
- tmp->ts_streamtype = afile;
- tmp->ts_filestream = fopen (name, mode);
- tmp->ts_strbuf = NULL;
- tmp->ts_buflen = 0;
-
- return tmp;
+ FILE *f = fopen (name, mode);
+ if (f == NULL)
+ return NULL;
+ return stdio_file_new (f, 1);
}
-void
-gdb_flush (stream)
- GDB_FILE *stream;
+static void
+tui_file_flush (file)
+ GDB_FILE *file;
{
+ struct tui_stream *stream = gdb_file_data (file);
+ if (stream->ts_magic != &tui_file_magic)
+ error ("Internal error: bad magic number");
if (flush_hook
- && (stream == gdb_stdout
- || stream == gdb_stderr))
+ && (file == gdb_stdout
+ || file == gdb_stderr))
{
- flush_hook (stream);
+ flush_hook (file);
return;
}
gdb_fclose(streamptr)
GDB_FILE **streamptr;
{
- GDB_FILE *tmpstream;
+ gdb_file_delete (*streamptr);
+ *streamptr = NULL;
+}
+
+
+/* Implement the ``struct gdb_file'' object. */
+
+static gdb_file_isatty_ftype null_file_isatty;
+static gdb_file_fputs_ftype null_file_fputs;
+static gdb_file_flush_ftype null_file_flush;
+static gdb_file_delete_ftype null_file_delete;
+
+struct gdb_file
+{
+ gdb_file_flush_ftype *to_flush;
+ gdb_file_fputs_ftype *to_fputs;
+ gdb_file_delete_ftype *to_delete;
+ gdb_file_isatty_ftype *to_isatty;
+ void *to_data;
+};
+
+struct gdb_file *
+gdb_file_new ()
+{
+ struct gdb_file *file = xmalloc (sizeof (struct gdb_file));
+ set_gdb_file_data (file, NULL, null_file_delete);
+ set_gdb_file_flush (file, null_file_flush);
+ set_gdb_file_fputs (file, null_file_fputs);
+ set_gdb_file_isatty (file, null_file_isatty);
+ return file;
+}
- tmpstream = *streamptr;
- fclose (tmpstream->ts_filestream);
- gdb_file_deallocate (streamptr);
+void
+gdb_file_delete (file)
+ struct gdb_file *file;
+{
+ file->to_delete (file);
+ free (file);
+}
+
+static int
+null_file_isatty (file)
+ struct gdb_file *file;
+{
+ return 0;
+}
+
+static void
+null_file_flush (file)
+ struct gdb_file *file;
+{
+ return;
+}
+
+static void
+null_file_fputs (buf, file)
+ const char *buf;
+ struct gdb_file *file;
+{
+ return;
+}
+
+static void
+null_file_delete (file)
+ struct gdb_file *file;
+{
+ return;
+}
+
+void *
+gdb_file_data (file)
+ struct gdb_file *file;
+{
+ return file->to_data;
+}
+
+void
+gdb_flush (file)
+ struct gdb_file *file;
+{
+ file->to_flush (file);
+}
+
+int
+gdb_file_isatty (file)
+ struct gdb_file *file;
+{
+ return file->to_isatty (file);
+}
+
+void
+fputs_unfiltered (buf, file)
+ const char *buf;
+ struct gdb_file *file;
+{
+ file->to_fputs (buf, file);
+}
+
+void
+set_gdb_file_flush (file, flush)
+ struct gdb_file *file;
+ gdb_file_flush_ftype *flush;
+{
+ file->to_flush = flush;
+}
+
+void
+set_gdb_file_isatty (file, isatty)
+ struct gdb_file *file;
+ gdb_file_isatty_ftype *isatty;
+{
+ file->to_isatty = isatty;
+}
+
+void
+set_gdb_file_fputs (file, fputs)
+ struct gdb_file *file;
+ gdb_file_fputs_ftype *fputs;
+{
+ file->to_fputs = fputs;
+}
+
+void
+set_gdb_file_data (file, data, delete)
+ struct gdb_file *file;
+ void *data;
+ gdb_file_delete_ftype *delete;
+{
+ file->to_data = data;
+ file->to_delete = delete;
}
/* Like fputs but if FILTER is true, pause after every screenful.
convert FROMVAL's contents now, with result in `raw_buffer',
and set USE_BUFFER to the number of bytes to write. */
- if (VALUE_REGNO (toval) >= 0
- && REGISTER_CONVERTIBLE (VALUE_REGNO (toval)))
+ if (VALUE_REGNO (toval) >= 0)
{
int regno = VALUE_REGNO (toval);
if (REGISTER_CONVERTIBLE (regno))
#endif
CORE_ADDR
-default_push_arguments (nargs, args, struct_return, sp, struct_addr)
+default_push_arguments (nargs, args, sp, struct_return, struct_addr)
int nargs;
value_ptr *args;
- int struct_return;
CORE_ADDR sp;
+ int struct_return;
CORE_ADDR struct_addr;
{
/* ASSERT ( !struct_return); */
extern value_ptr value_allocate_space_in_inferior PARAMS ((int));
extern CORE_ADDR default_push_arguments PARAMS ((int nargs, value_ptr *args,
- int struct_return,
CORE_ADDR sp,
+ int struct_return,
CORE_ADDR struct_addr));
#endif /* !defined (VALUE_H) */
register value_ptr val;
CORE_ADDR addr;
-#if defined (EXTRACT_STRUCT_VALUE_ADDRESS)
/* If this is not defined, just use EXTRACT_RETURN_VALUE instead. */
- if (struct_return) {
- addr = EXTRACT_STRUCT_VALUE_ADDRESS (retbuf);
- if (!addr)
- error ("Function return value unknown");
- return value_at (valtype, addr, NULL);
- }
-#endif
+ if (EXTRACT_STRUCT_VALUE_ADDRESS_P)
+ if (struct_return)
+ {
+ addr = EXTRACT_STRUCT_VALUE_ADDRESS (retbuf);
+ if (!addr)
+ error ("Function return value unknown");
+ return value_at (valtype, addr, NULL);
+ }
val = allocate_value (valtype);
CHECK_TYPEDEF (valtype);
+1999-05-27 Michael Meissner <meissner@cygnus.com>
+
+ * d30v-insns (do_repeat): Print a warning if a REPEAT or REPEATI
+ instruction loop is too small.
+
1999-05-08 Felix Lee <flee@cygnus.com>
* configure: Regenerated to track ../common/aclocal.m4 changes.
// REPEAT
void::function::do_repeat:unsigned32 count, address_word pcaddr
+ address_word rpt_s = cia + 8;
+ address_word rpt_e = cia + pcaddr;
+
if (count == 0)
sim_engine_abort (SD, CPU, cia, "REPEAT with ra=0 and REPEATI with imm = 0 is forbidden.");
if (count > 1)
PSW_SET_QUEUE (PSW_RP, 1);
+ if (rpt_e < rpt_s + 0x18)
+ sim_io_eprintf (sd, "warning: 0x%lx: REPEAT or REPEATI loop is too small\n", cia);
WRITE32_QUEUE (&RPT_C, count - 1);
- WRITE32_QUEUE (&RPT_S, cia + 8);
- WRITE32_QUEUE (&RPT_E, cia + pcaddr);
+ WRITE32_QUEUE (&RPT_S, rpt_s);
+ WRITE32_QUEUE (&RPT_E, rpt_e);
_BRA,11000,00,6.RA,6.**,6.RC:BRA:short:mu:REPEAT
"repeat r<RA>, r<RC>"