diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 101 | ||||
-rw-r--r-- | gdb/Makefile.in | 3 | ||||
-rw-r--r-- | gdb/breakpoint.c | 6 | ||||
-rw-r--r-- | gdb/config/d10v/tm-d10v.h | 25 | ||||
-rw-r--r-- | gdb/config/d30v/tm-d30v.h | 2 | ||||
-rw-r--r-- | gdb/config/h8500/tm-h8500.h | 2 | ||||
-rw-r--r-- | gdb/config/i386/tm-cygwin.h | 2 | ||||
-rw-r--r-- | gdb/config/i386/tm-go32.h | 2 | ||||
-rw-r--r-- | gdb/config/i386/tm-i386m3.h | 5 | ||||
-rw-r--r-- | gdb/config/sh/tm-sh.h | 2 | ||||
-rw-r--r-- | gdb/config/tic80/tm-tic80.h | 5 | ||||
-rw-r--r-- | gdb/config/w65/tm-w65.h | 2 | ||||
-rw-r--r-- | gdb/d10v-tdep.c | 50 | ||||
-rw-r--r-- | gdb/defs.h | 47 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/doc/gdbint.texinfo | 15 | ||||
-rw-r--r-- | gdb/gdbarch.h | 11 | ||||
-rw-r--r-- | gdb/main.c | 47 | ||||
-rw-r--r-- | gdb/parse.c | 21 | ||||
-rw-r--r-- | gdb/stack.c | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.disasm/hppa.exp | 1 | ||||
-rw-r--r-- | gdb/utils.c | 346 | ||||
-rw-r--r-- | gdb/valops.c | 7 | ||||
-rw-r--r-- | gdb/value.h | 2 | ||||
-rw-r--r-- | gdb/values.c | 16 |
25 files changed, 580 insertions, 153 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8bd37ad..26a138a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,104 @@ +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 diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 3a76eee..714981d 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -219,7 +219,7 @@ CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE) \ 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 @@ -1637,4 +1637,5 @@ m2-exp.tab.o: m2-exp.tab.c $(defs_h) $(expression_h) $(gdbtypes_h) \ language.h m2-lang.h parser-defs.h $(symtab_h) $(value_h) \ $(bfd_h) objfiles.h symfile.h + ### end of the gdb Makefile.in. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index b73305a..11caae0 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -877,6 +877,9 @@ which its expression is valid.\n", b->number); 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) { @@ -1191,6 +1194,9 @@ remove_breakpoint (b, is) 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; diff --git a/gdb/config/d10v/tm-d10v.h b/gdb/config/d10v/tm-d10v.h index f0760dc..85aa3ef 100644 --- a/gdb/config/d10v/tm-d10v.h +++ b/gdb/config/d10v/tm-d10v.h @@ -1,5 +1,5 @@ /* 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. @@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* 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. */ @@ -118,21 +119,14 @@ extern struct type *d10v_register_virtual_type PARAMS ((int reg_nr)); /* 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)) @@ -252,9 +246,6 @@ extern CORE_ADDR d10v_saved_pc_after_call PARAMS ((struct frame_info *frame)); 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 diff --git a/gdb/config/d30v/tm-d30v.h b/gdb/config/d30v/tm-d30v.h index dda61b6..124b8b4 100644 --- a/gdb/config/d30v/tm-d30v.h +++ b/gdb/config/d30v/tm-d30v.h @@ -253,8 +253,6 @@ extern int d30v_frame_chain_valid PARAMS ((CORE_ADDR, struct frame_info *)); 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. diff --git a/gdb/config/h8500/tm-h8500.h b/gdb/config/h8500/tm-h8500.h index 0f34a00..46ce2c3 100644 --- a/gdb/config/h8500/tm-h8500.h +++ b/gdb/config/h8500/tm-h8500.h @@ -247,8 +247,6 @@ extern void h8500_pop_frame PARAMS ((void)); #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)); diff --git a/gdb/config/i386/tm-cygwin.h b/gdb/config/i386/tm-cygwin.h index b1ad894..acca6b9 100644 --- a/gdb/config/i386/tm-cygwin.h +++ b/gdb/config/i386/tm-cygwin.h @@ -117,8 +117,6 @@ double_to_i387 PARAMS ((char *, char *)); ((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)); diff --git a/gdb/config/i386/tm-go32.h b/gdb/config/i386/tm-go32.h index 84b8292..3387ac2 100644 --- a/gdb/config/i386/tm-go32.h +++ b/gdb/config/i386/tm-go32.h @@ -208,5 +208,3 @@ extern void double_to_i387 PARAMS ((char *, char *)); #undef TARGET_LONG_DOUBLE_BIT #define TARGET_LONG_DOUBLE_BIT 96 - -#define NAMES_HAVE_UNDERSCORE diff --git a/gdb/config/i386/tm-i386m3.h b/gdb/config/i386/tm-i386m3.h index 2f97505..523dabb 100644 --- a/gdb/config/i386/tm-i386m3.h +++ b/gdb/config/i386/tm-i386m3.h @@ -40,11 +40,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* 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" diff --git a/gdb/config/sh/tm-sh.h b/gdb/config/sh/tm-sh.h index 3552300..2a94f58 100644 --- a/gdb/config/sh/tm-sh.h +++ b/gdb/config/sh/tm-sh.h @@ -227,8 +227,6 @@ extern void sh_frame_find_saved_regs PARAMS ((struct frame_info *fi, #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, diff --git a/gdb/config/tic80/tm-tic80.h b/gdb/config/tic80/tm-tic80.h index 567beb0..89aab87 100644 --- a/gdb/config/tic80/tm-tic80.h +++ b/gdb/config/tic80/tm-tic80.h @@ -31,11 +31,6 @@ struct frame_saved_regs; #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 \ diff --git a/gdb/config/w65/tm-w65.h b/gdb/config/w65/tm-w65.h index 05d93c3..412624d 100644 --- a/gdb/config/w65/tm-w65.h +++ b/gdb/config/w65/tm-w65.h @@ -187,8 +187,6 @@ extern CORE_ADDR w65_skip_prologue (); #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)); diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 0ceee9f..e5f4d6d 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -151,24 +151,43 @@ d10v_register_virtual_type (reg_nr) 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) @@ -1263,6 +1282,7 @@ display_trace (low, high) } } + extern void (*target_resume_hook) PARAMS ((void)); extern void (*target_wait_loop_hook) PARAMS ((void)); @@ -347,23 +347,21 @@ enum streamtype }; /* 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" @@ -373,6 +371,33 @@ typedef FILE GDB_FILE; #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 *)); @@ -427,13 +452,19 @@ extern void printf_unfiltered PARAMS ((const char *, ...)) 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 *)); diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 87c3920..52fe917 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,12 @@ +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 diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index d829958..322e53f 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -1318,10 +1318,13 @@ the raw register state @var{regbuf} and copy that, in virtual format, 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 @@ -1618,12 +1621,16 @@ Number of bits in a char; defaults to 8. @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}. diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 3caa044..f922efa 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -129,6 +129,17 @@ extern disassemble_info tm_print_insn_info; #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 */ @@ -157,19 +157,14 @@ main (argc, argv) 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. */ { @@ -715,17 +710,21 @@ Report bugs to \"bug-gdb@prep.ai.mit.edu\".\ } -/* 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 @@ -736,9 +735,9 @@ fputs_unfiltered (linebuffer, stream) * 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) @@ -772,7 +771,7 @@ fputs_unfiltered (linebuffer, stream) #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 diff --git a/gdb/parse.c b/gdb/parse.c index 42b0f3b..d0424ce 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -1317,14 +1317,10 @@ follow_types (follow_type) return follow_type; } -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; @@ -1335,6 +1331,17 @@ _initialize_parse () 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, diff --git a/gdb/stack.c b/gdb/stack.c index a3f302d..bae4711 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -305,6 +305,7 @@ print_only_stack_frame (fi, level, source) struct print_args_args { struct symbol *func; struct frame_info *fi; + GDB_FILE *stream; }; static int print_args_stub PARAMS ((PTR)); @@ -319,7 +320,7 @@ print_args_stub (args) 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; } @@ -504,6 +505,7 @@ print_frame_info_base (fi, level, source, args) 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; } diff --git a/gdb/testsuite/gdb.disasm/hppa.exp b/gdb/testsuite/gdb.disasm/hppa.exp index 4c679a9..7296a8a 100644 --- a/gdb/testsuite/gdb.disasm/hppa.exp +++ b/gdb/testsuite/gdb.disasm/hppa.exp @@ -29,6 +29,7 @@ if ![istarget "hppa*-*-*"] { return } + set prms_id 0 set bug_id 0 diff --git a/gdb/utils.c b/gdb/utils.c index 9ccdfed..b9b0a9e 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1536,11 +1536,155 @@ begin_line () } } -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; @@ -1550,9 +1694,11 @@ GDB_FILE * 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) @@ -1564,41 +1710,38 @@ gdb_file_init_astring (n) 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; @@ -1624,28 +1767,24 @@ gdb_fopen (name, mode) 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; } @@ -1656,11 +1795,136 @@ void 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. diff --git a/gdb/valops.c b/gdb/valops.c index 79f5b51..74dae8d 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -575,8 +575,7 @@ value_assign (toval, fromval) 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)) @@ -1096,11 +1095,11 @@ value_push (sp, arg) #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); */ diff --git a/gdb/value.h b/gdb/value.h index 1ea48d2..35db8be 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -567,8 +567,8 @@ extern value_ptr find_function_in_inferior PARAMS ((char *)); 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) */ diff --git a/gdb/values.c b/gdb/values.c index c7c4d80..68e0444 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -1498,15 +1498,15 @@ value_being_returned (valtype, retbuf, struct_return) 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); |