From 43e526b9b4c9868d3cd90772a54f767f8d45cadd Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Mon, 12 Jul 1999 11:15:22 +0000 Subject: [PATCH] import gdb-1999-07-12 snapshot --- gdb/ChangeLog | 52 +++++++++++++++++++++ gdb/Makefile.in | 9 ++-- gdb/NEWS | 19 ++++++++ gdb/blockframe.c | 2 +- gdb/command.c | 3 +- gdb/config/mips/tm-mips.h | 27 +++++++++-- gdb/configure.tgt | 1 - gdb/defs.h | 6 ++- gdb/mips-tdep.c | 83 +++++++++++++++++++++++++++++++-- gdb/remote.c | 13 ++++-- gdb/serial.c | 2 + gdb/sparcl-tdep.c | 72 +++------------------------- gdb/testsuite/ChangeLog | 8 ++++ gdb/testsuite/gdb.base/list.exp | 4 -- gdb/testsuite/gdb.base/list0.h | 13 +++--- gdb/utils.c | 68 +++++++++++++++++++++------ sim/arm/ChangeLog | 1 + sim/arm/armdefs.h | 1 - sim/arm/armemu.c | 2 + sim/common/ChangeLog | 23 +++++++++ sim/common/nltvals.def | 24 ---------- sim/common/nrun.c | 49 ++++++++++--------- sim/common/sim-base.h | 5 ++ sim/common/sim-hload.c | 10 +--- sim/common/sim-options.c | 30 ++++++++++++ sim/common/sim-resume.c | 5 ++ sim/mips/ChangeLog | 14 ++++++ sim/mips/interp.c | 42 +++++++++++++++-- sim/mips/tconfig.in | 2 + 29 files changed, 423 insertions(+), 167 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e0e094d491..1694d94eea 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,55 @@ +Mon Jul 12 11:15:09 1999 Andrew Cagney + + * config/mips/tm-mips.h (REGISTER_CONVERT_TO_RAW, + REGISTER_CONVERT_TO_VIRTUAL, REGISTER_CONVERTIBLE): Define. + (REGISTER_RAW_SIZE): Re-define as mips_register_convert_to_raw. + * mips-tdep.c (mips_register_convert_to_raw, + mips_register_convert_to_virtual, ): New functions. + (mips_register_raw_size, mips_register_convertible): New + functions. Handle bug introduced by ``Wed Apr 1 23:13:23 1998 + Andrew Cagney '' where remote mips64 target + transfers SR as 64 bits yet GDB expected only 32 bits. + (mips64_transfers_32bit_regs): New static variable. + (_initialize_mips_tdep): Add obscure command ``set + remote-mips64-transfers-32bit-regs'' that provides backward + compatibility. + (do_gp_register_row): Extract register values from raw buffer. + + * NEWS: Document protocol change. + +Mon Jul 12 02:02:00 1999 Andrew Cagney + + * defs.h, utils.c (fputstrn_filtered, fputstrn_unfiltered, + fputstrnn_unfiltered): New functions. + (gdb_printchar): Delete. + + * remote.c (print_packet): Replace gdb_printchar with + fputstrn_filtered. + (getpkt): Use fputstrn_unfiltered to dump packet received. + (putpkt_binary): Use fputstrnn_unfiltered to dump packet sent. + +1999-07-09 Keith Seitz + + * blockframe.c (blockvector_for_pc_sect): When looking for a block, + we want the one whose end is greater than our PC, not greater or equal. + +1999-07-08 Stan Shebs + + * sparcl-tdep.c (init_sparclite_ops): Fix doc strings, remove + useless inits. + (sparclite_ops): Remove redundant decl. + +Thu Jul 8 16:48:40 1999 Andrew Cagney + + * ser-pipe.c (pipe_open): Bi-directional popen found on both + NetBSD and OpenBSD. + * ser-pipe.c: New file. Implement popen() style serial interface. + * NEWS: Mention. + * Makefile.in (ALLDEPFILES): Add ser-pipe.c. + (ser-pipe.o): Add new target. Specify dependencies. + (SER_HARDWIRE): Add ser-pipe.o. + * serial.c (serial_open): Recognize a serial pipe ``|''. + 1999-07-07 Stan Shebs * All C files except *-stub.c and *-share/*: Indent to GNU diff --git a/gdb/Makefile.in b/gdb/Makefile.in index a46d01a98b..772a6c7540 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -224,7 +224,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 = 19990707 +VERSION = 19990712 DIST=gdb LINT=/usr/5bin/lint @@ -242,7 +242,7 @@ RUNTESTFLAGS= # part of libiberty) a POSIX interface. But at least for now the # host-dependent makefile fragment might need to use something else # besides ser-unix.o -SER_HARDWIRE = ser-unix.o +SER_HARDWIRE = ser-unix.o ser-pipe.o # The `remote' debugging target is supported for most architectures, # but not all (e.g. 960) @@ -967,7 +967,8 @@ ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \ remote-st.c remote-utils.c dcache.c \ remote-udi.c remote-vx.c remote-vx29k.c \ rs6000-nat.c rs6000-tdep.c \ - ser-go32.c ser-ocd.c ser-tcp.c sh-tdep.c solib.c sparc-nat.c \ + ser-go32.c ser-pipe.c ser-ocd.c ser-tcp.c \ + sh-tdep.c solib.c sparc-nat.c \ sparc-tdep.c sparcl-tdep.c sun3-nat.c sun386-nat.c \ symm-tdep.c symm-nat.c \ tahoe-tdep.c ultra3-nat.c ultra3-xdep.c umax-xdep.c \ @@ -1492,6 +1493,8 @@ ser-mac.o: ser-mac.c $(defs_h) serial.h signals.h ser-ocd.o: ser-ocd.c $(defs_h) serial.h signals.h gdb_string.h +ser-pipe.o: ser-pipe.c $(defs_h) serial.h signals.h gdb_string.h + ser-tcp.o: ser-tcp.c $(defs_h) serial.h signals.h gdb_string.h ser-unix.o: ser-unix.c $(defs_h) serial.h diff --git a/gdb/NEWS b/gdb/NEWS index 9018d3cf0d..d08274bf90 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -3,6 +3,16 @@ *** Changes since GDB-4.18: +* Remote targets can connect to a sub-program + +A popen(3) style serial-device has been added. This device starts a +sub-process (such as a stand-alone simulator) and then communicates +with that. The sub-program to run is specified using the syntax +``| '' vis: + + (gdb) set remotedebug 1 + (gdb) target extended-remote |mn10300-elf-sim program-args + * New targets TI TMS320C80 tic80-*-* @@ -13,6 +23,15 @@ Altos 3068 m68*-altos-* Convex c1-*-*, c2-*-* Pyramid pyramid-*-* +* MIPS 64 remote protocol + +A long standing bug in the mips64 remote protocol where by GDB +expected certain 32 bit registers (ex SR) to be transfered as 32 +instead of 64 bits has been fixed. + +The command ``set remote-mips64-transfers-32bit-regs on'' has been +added to provide backward compatibility with older versions of GDB. + *** Changes in GDB-4.18: * New native configurations diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 26a26ae6f9..6b8e83ba82 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -656,7 +656,7 @@ blockvector_for_pc_sect (pc, section, pindex, symtab) while (bot >= 0) { b = BLOCKVECTOR_BLOCK (bl, bot); - if (BLOCK_END (b) >= pc) + if (BLOCK_END (b) > pc) { if (pindex) *pindex = bot; diff --git a/gdb/command.c b/gdb/command.c index ad3e7e490b..fd8b814528 100644 --- a/gdb/command.c +++ b/gdb/command.c @@ -1376,8 +1376,7 @@ do_setshow_command (arg, from_tty, c) fputs_filtered ("\"", gdb_stdout); if (*(unsigned char **) c->var) - for (p = *(unsigned char **) c->var; *p != '\0'; p++) - gdb_printchar (*p, gdb_stdout, '"'); + fputstr_filtered (*(unsigned char **) c->var, '"', gdb_stdout); fputs_filtered ("\"", gdb_stdout); } break; diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index fd0ae23e3e..bfdc94577f 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -236,10 +236,31 @@ extern void mips_do_registers_info PARAMS ((int, int)); #define REGISTER_BYTE(N) ((N) * MIPS_REGSIZE) -/* Number of bytes of storage in the actual machine representation - for register N. */ +/* Number of bytes of storage in the actual machine representation for + register N. NOTE: This indirectly defines the register size + transfered by the GDB protocol. */ + +extern int mips_register_raw_size PARAMS ((int reg_nr)); +#define REGISTER_RAW_SIZE(N) (mips_register_raw_size ((N))) + + +/* Covert between the RAW and VIRTUAL registers. + + Some MIPS (SR, FSR, FIR) have a `raw' size of MIPS_REGSIZE but are + really 32 bit registers. This is a legacy of the 64 bit MIPS GDB + protocol which transfers 64 bits for 32 bit registers. */ + +extern int mips_register_convertible PARAMS ((int reg_nr)); +#define REGISTER_CONVERTIBLE(N) (mips_register_convertible ((N))) + + +void mips_register_convert_to_virtual PARAMS ((int reg_nr, struct type *virtual_type, char *raw_buf, char *virt_buf)); +#define REGISTER_CONVERT_TO_VIRTUAL(N,VIRTUAL_TYPE,RAW_BUF,VIRT_BUF) \ + mips_register_convert_to_virtual (N,VIRTUAL_TYPE,RAW_BUF,VIRT_BUF) -#define REGISTER_RAW_SIZE(N) REGISTER_VIRTUAL_SIZE(N) +void mips_register_convert_to_raw PARAMS ((struct type *virtual_type, int reg_nr, char *virt_buf, char *raw_buf)); +#define REGISTER_CONVERT_TO_RAW(VIRTUAL_TYPE,N,VIRT_BUF,RAW_BUF) \ + mips_register_convert_to_raw (VIRTUAL_TYPE,N,VIRT_BUF,RAW_BUF) /* Number of bytes of storage in the program's representation for register N. */ diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 3f23a73409..bca34ac8e7 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -52,7 +52,6 @@ arc-*-*) gdb_target=arc ;; arm-*-* | thumb-*-* | strongarm-*-*) gdb_target=arm ;; - # OBSOLETE c1-*-*) gdb_target=convex ;; # OBSOLETE c2-*-*) gdb_target=convex ;; diff --git a/gdb/defs.h b/gdb/defs.h index 6ec961d593..0bfb61266d 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -500,7 +500,11 @@ extern void print_spaces_filtered PARAMS ((int, GDB_FILE *)); extern char *n_spaces PARAMS ((int)); -extern void gdb_printchar PARAMS ((int, GDB_FILE *, int)); +extern void fputstr_filtered PARAMS ((const char *str, int quotr, GDB_FILE *stream)); + +extern void fputstr_unfiltered PARAMS ((const char *str, int quotr, GDB_FILE *stream)); + +extern void fputstrn_unfiltered PARAMS ((const char *str, int n, int quotr, GDB_FILE *stream)); extern void gdb_print_address PARAMS ((void *, GDB_FILE *)); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index c00e58434f..73429dca1b 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -253,6 +253,66 @@ mips_print_extra_frame_info (fi) fi->extra_info->proc_desc->pdr.frameoffset); } +/* Convert between RAW and VIRTUAL registers. The RAW register size + defines the remote-gdb packet. */ + +static int mips64_transfers_32bit_regs_p = 0; + +int +mips_register_raw_size (reg_nr) + int reg_nr; +{ + if (mips64_transfers_32bit_regs_p) + return REGISTER_VIRTUAL_SIZE (reg_nr); + else + return MIPS_REGSIZE; +} + +int +mips_register_convertible (reg_nr) + int reg_nr; +{ + if (mips64_transfers_32bit_regs_p) + return 0; + else + return (REGISTER_RAW_SIZE (reg_nr) > REGISTER_VIRTUAL_SIZE (reg_nr)); +} + +void +mips_register_convert_to_virtual (n, virtual_type, raw_buf, virt_buf) + int n; + struct type *virtual_type; + char *raw_buf; + char *virt_buf; +{ + if (TARGET_BYTE_ORDER == BIG_ENDIAN) + memcpy (virt_buf, + raw_buf + (REGISTER_RAW_SIZE (n) - TYPE_LENGTH (virtual_type)), + TYPE_LENGTH (virtual_type)); + else + memcpy (virt_buf, + raw_buf, + TYPE_LENGTH (virtual_type)); +} + +void +mips_register_convert_to_raw (virtual_type, n, virt_buf, raw_buf) + struct type *virtual_type; + int n; + char *virt_buf; + char *raw_buf; +{ + memset (raw_buf, 0, REGISTER_RAW_SIZE (n)); + if (TARGET_BYTE_ORDER == BIG_ENDIAN) + memcpy (raw_buf + (REGISTER_RAW_SIZE (n) - TYPE_LENGTH (virtual_type)), + virt_buf, + TYPE_LENGTH (virtual_type)); + else + memcpy (raw_buf, + virt_buf, + TYPE_LENGTH (virtual_type)); +} + /* Should the upper word of 64-bit addresses be zeroed? */ static int mask_address_p = 1; @@ -2423,14 +2483,18 @@ do_gp_register_row (regnum) if (read_relative_register_raw_bytes (regnum, raw_buffer)) error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum)); /* pad small registers */ - for (byte = 0; byte < (MIPS_REGSIZE - REGISTER_RAW_SIZE (regnum)); byte++) + for (byte = 0; byte < (MIPS_REGSIZE - REGISTER_VIRTUAL_SIZE (regnum)); byte++) printf_filtered (" "); /* Now print the register value in hex, endian order. */ if (TARGET_BYTE_ORDER == BIG_ENDIAN) - for (byte = 0; byte < REGISTER_RAW_SIZE (regnum); byte++) + for (byte = REGISTER_RAW_SIZE (regnum) - REGISTER_VIRTUAL_SIZE (regnum); + byte < REGISTER_RAW_SIZE (regnum); + byte++) printf_filtered ("%02x", (unsigned char) raw_buffer[byte]); else - for (byte = REGISTER_RAW_SIZE (regnum) - 1; byte >= 0; byte--) + for (byte = REGISTER_VIRTUAL_SIZE (regnum) - 1; + byte >= 0; + byte--) printf_filtered ("%02x", (unsigned char) raw_buffer[byte]); printf_filtered (" "); col++; @@ -3571,4 +3635,17 @@ search. The only need to set it is when debugging a stripped executable.", Use \"on\" to enable the masking, and \"off\" to disable it.\n\ Without an argument, zeroing of upper address bits is enabled.", &setlist), &showlist); + + /* Allow the user to control the size of 32 bit registers within the + raw remote packet. */ + add_show_from_set (add_set_cmd ("remote-mips64-transfers-32bit-regs", + class_obscure, + var_boolean, + (char *)&mips64_transfers_32bit_regs_p, "\ +Set compatibility with MIPS targets that transfers 32 and 64 bit quantities.\n\ +Use \"on\" to enable backward compatibility with older MIPS 64 GDB+target\n\ +that would transfer 32 bits for some registers (e.g. SR, FSR) and\n\ +64 bits for others. Use \"off\" to disable compatibility mode", + &setlist), + &showlist); } diff --git a/gdb/remote.c b/gdb/remote.c index c431670b66..00b9661dc8 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -3294,8 +3294,7 @@ print_packet (buf) char *buf; { puts_filtered ("\""); - while (*buf) - gdb_printchar (*buf++, gdb_stdout, '"'); + fputstr_filtered (buf, '"', gdb_stdout); puts_filtered ("\""); } @@ -3352,7 +3351,9 @@ putpkt_binary (buf, cnt) if (remote_debug) { *p = '\0'; - fprintf_unfiltered (gdb_stdlog, "Sending packet: %s...", buf2); + fprintf_unfiltered (gdb_stdlog, "Sending packet: "); + fputstrn_unfiltered (buf2, p - buf2, 0, gdb_stdlog); + fprintf_unfiltered (gdb_stdlog, "...", buf2); gdb_flush (gdb_stdlog); } if (SERIAL_WRITE (remote_desc, buf2, p - buf2)) @@ -3618,7 +3619,11 @@ getpkt (buf, forever) if (val == 1) { if (remote_debug) - fprintf_unfiltered (gdb_stdlog, "Packet received: %s\n", buf); + { + fprintf_unfiltered (gdb_stdlog, "Packet received: "); + fputstr_unfiltered (buf, 0, gdb_stdlog); + fprintf_unfiltered (gdb_stdlog, "\n"); + } SERIAL_WRITE (remote_desc, "+", 1); return; } diff --git a/gdb/serial.c b/gdb/serial.c index 6cb203098b..dca48bcb3e 100644 --- a/gdb/serial.c +++ b/gdb/serial.c @@ -240,6 +240,8 @@ serial_open (name) ops = serial_interface_lookup ("tcp"); else if (strncmp (name, "lpt", 3) == 0) ops = serial_interface_lookup ("parallel"); + else if (strncmp (name, "|", 1) == 0) + ops = serial_interface_lookup ("pipe"); else ops = serial_interface_lookup ("hardwire"); diff --git a/gdb/sparcl-tdep.c b/gdb/sparcl-tdep.c index 7e5457d81f..d6fa160c30 100644 --- a/gdb/sparcl-tdep.c +++ b/gdb/sparcl-tdep.c @@ -1,5 +1,5 @@ /* Target dependent code for the Fujitsu SPARClite for GDB, the GNU debugger. - Copyright 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright 1994, 1995, 1996, 1999 Free Software Foundation, Inc. This file is part of GDB. @@ -34,8 +34,7 @@ #include #endif -extern struct target_ops sparclite_ops; /* Forward decl */ -extern struct target_ops remote_ops; +static struct target_ops sparclite_ops; static char *remote_target_name = NULL; static serial_t remote_desc = NULL; @@ -893,78 +892,21 @@ sparclite_download (filename, from_tty) sparclite_serial_start); } -/* Define the target subroutine names */ - -static struct target_ops sparclite_ops; +/* Set up the sparclite target vector. */ static void init_sparclite_ops (void) { sparclite_ops.to_shortname = "sparclite"; - sparclite_ops.to_longname = "SPARClite remote target"; - sparclite_ops.to_doc = "Use a remote SPARClite target board via a serial line; using a gdb-specific protocol.\n\ -Specify the serial device it is connected to (e.g. /dev/ttya)."; + sparclite_ops.to_longname = "SPARClite download target"; + sparclite_ops.to_doc = "Download to a remote SPARClite target board via serial of UDP.\n\ +Specify the device it is connected to (e.g. /dev/ttya)."; sparclite_ops.to_open = sparclite_open; sparclite_ops.to_close = sparclite_close; - sparclite_ops.to_attach = 0; - sparclite_ops.to_post_attach = NULL; - sparclite_ops.to_require_attach = NULL; - sparclite_ops.to_detach = 0; - sparclite_ops.to_require_detach = NULL; - sparclite_ops.to_resume = 0; - sparclite_ops.to_wait = 0; - sparclite_ops.to_post_wait = NULL; - sparclite_ops.to_fetch_registers = 0; - sparclite_ops.to_store_registers = 0; - sparclite_ops.to_prepare_to_store = 0; - sparclite_ops.to_xfer_memory = 0; - sparclite_ops.to_files_info = 0; - sparclite_ops.to_insert_breakpoint = 0; - sparclite_ops.to_remove_breakpoint = 0; - sparclite_ops.to_terminal_init = 0; - sparclite_ops.to_terminal_inferior = 0; - sparclite_ops.to_terminal_ours_for_output = 0; - sparclite_ops.to_terminal_ours = 0; - sparclite_ops.to_terminal_info = 0; - sparclite_ops.to_kill = 0; sparclite_ops.to_load = sparclite_download; - sparclite_ops.to_lookup_symbol = 0; - sparclite_ops.to_create_inferior = 0; - sparclite_ops.to_post_startup_inferior = NULL; - sparclite_ops.to_acknowledge_created_inferior = NULL; - sparclite_ops.to_clone_and_follow_inferior = NULL; - sparclite_ops.to_post_follow_inferior_by_clone = NULL; - sparclite_ops.to_insert_fork_catchpoint = NULL; - sparclite_ops.to_remove_fork_catchpoint = NULL; - sparclite_ops.to_insert_vfork_catchpoint = NULL; - sparclite_ops.to_remove_vfork_catchpoint = NULL; - sparclite_ops.to_has_forked = NULL; - sparclite_ops.to_has_vforked = NULL; - sparclite_ops.to_can_follow_vfork_prior_to_exec = NULL; - sparclite_ops.to_post_follow_vfork = NULL; - sparclite_ops.to_insert_exec_catchpoint = NULL; - sparclite_ops.to_remove_exec_catchpoint = NULL; - sparclite_ops.to_has_execd = NULL; - sparclite_ops.to_reported_exec_events_per_exec_call = NULL; - sparclite_ops.to_has_exited = NULL; - sparclite_ops.to_mourn_inferior = 0; - sparclite_ops.to_can_run = 0; - sparclite_ops.to_notice_signals = 0; - sparclite_ops.to_thread_alive = 0; - sparclite_ops.to_stop = 0; - sparclite_ops.to_pid_to_exec_file = NULL; - sparclite_ops.to_core_file_to_sym_file = NULL; sparclite_ops.to_stratum = download_stratum; - sparclite_ops.DONT_USE = 0; - sparclite_ops.to_has_all_memory = 0; - sparclite_ops.to_has_memory = 0; - sparclite_ops.to_has_stack = 0; - sparclite_ops.to_has_registers = 0; - sparclite_ops.to_has_execution = 0; - sparclite_ops.to_sections = 0; - sparclite_ops.to_sections_end = 0; sparclite_ops.to_magic = OPS_MAGIC; -} /* init_sparclite_ops */ +} void _initialize_sparcl_tdep () diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1c56333d76..711e9f0ec5 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +1999-07-08 Stan Shebs + + * gdb.base/callfwmall.c, gdb.base/callfwmall.exp: Renamed from + callfuncs2.c and callfuncs2.exp. + + * gdb.base/list.exp: Remove mistaken xfails. + * gdb.base/list0.h: Add optional prototypes. + Wed Jul 7 00:27:35 1999 Andrew Cagney * gdb.base/setvar.exp: Increase the time-out on tests indirectly diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp index 3652be9d43..d77ce53962 100644 --- a/gdb/testsuite/gdb.base/list.exp +++ b/gdb/testsuite/gdb.base/list.exp @@ -104,9 +104,7 @@ proc test_listsize {} { # Ensure we can limit printouts to one line if [set_listsize 1] { - if {!$hp_cc_compiler && !$hp_aCC_compiler} { setup_xfail "*-*-*" } gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 1" - if {!$hp_cc_compiler && !$hp_aCC_compiler} { setup_xfail "*-*-*" } gdb_test "list 2" "2\[ \t\]+" "list line 2 with listsize 1" } @@ -123,10 +121,8 @@ proc test_listsize {} { if [ set_listsize 3 ] { setup_xfail "*-*-*" gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"2\[ \t\]+" "list line 1 with listsize 3" - if {!$hp_cc_compiler && !$hp_aCC_compiler} { setup_xfail "*-*-*" } gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 2 with listsize 3" - if {!$hp_cc_compiler && !$hp_aCC_compiler} { setup_xfail "*-*-*" } gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[(\]+\[)\]+\r\n4\[ \t\]+\{" "list line 3 with listsize 3" } diff --git a/gdb/testsuite/gdb.base/list0.h b/gdb/testsuite/gdb.base/list0.h index c4d337c677..d46833060e 100644 --- a/gdb/testsuite/gdb.base/list0.h +++ b/gdb/testsuite/gdb.base/list0.h @@ -1,9 +1,10 @@ -/* An include file that actually causes code to be generated in the - including file. This is known to cause problems on some systems. */ - -static void -foo (x) -int x; +/* An include file that actually causes code to be generated in the including file. This is known to cause problems on some systems. */ +#ifdef PROTOTYPES +extern void bar(int); +static void foo (int x) +#else +static void foo (x) int x; +#endif { bar (x++); bar (x++); diff --git a/gdb/utils.c b/gdb/utils.c index f181d0cbdc..23374cf537 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1273,9 +1273,13 @@ parse_escape (string_ptr) be call for printing things which are independent of the language of the program being debugged. */ -void -gdb_printchar (c, stream, quoter) - register int c; +static void printchar PARAMS ((int c, void (*do_fputs) (const char *, GDB_FILE*), void (*do_fprintf) (GDB_FILE*, const char *, ...), GDB_FILE *stream, int quoter)); + +static void +printchar (c, do_fputs, do_fprintf, stream, quoter) + int c; + void (*do_fputs) PARAMS ((const char *, GDB_FILE*)); + void (*do_fprintf) PARAMS ((GDB_FILE*, const char *, ...)); GDB_FILE *stream; int quoter; { @@ -1289,38 +1293,76 @@ gdb_printchar (c, stream, quoter) switch (c) { case '\n': - fputs_filtered ("\\n", stream); + do_fputs ("\\n", stream); break; case '\b': - fputs_filtered ("\\b", stream); + do_fputs ("\\b", stream); break; case '\t': - fputs_filtered ("\\t", stream); + do_fputs ("\\t", stream); break; case '\f': - fputs_filtered ("\\f", stream); + do_fputs ("\\f", stream); break; case '\r': - fputs_filtered ("\\r", stream); + do_fputs ("\\r", stream); break; case '\033': - fputs_filtered ("\\e", stream); + do_fputs ("\\e", stream); break; case '\007': - fputs_filtered ("\\a", stream); + do_fputs ("\\a", stream); break; default: - fprintf_filtered (stream, "\\%.3o", (unsigned int) c); + do_fprintf (stream, "\\%.3o", (unsigned int) c); break; } } else { if (c == '\\' || c == quoter) - fputs_filtered ("\\", stream); - fprintf_filtered (stream, "%c", c); + do_fputs ("\\", stream); + do_fprintf (stream, "%c", c); } } + +/* Print the character C on STREAM as part of the contents of a + literal string whose delimiter is QUOTER. Note that these routines + should only be call for printing things which are independent of + the language of the program being debugged. */ + +void +fputstr_filtered (str, quoter, stream) + const char *str; + int quoter; + GDB_FILE *stream; +{ + while (*str) + printchar (*str++, fputs_filtered, fprintf_filtered, stream, quoter); +} + +void +fputstr_unfiltered (str, quoter, stream) + const char *str; + int quoter; + GDB_FILE *stream; +{ + while (*str) + printchar (*str++, fputs_unfiltered, fprintf_unfiltered, stream, quoter); +} + +void +fputstrn_unfiltered (str, n, quoter, stream) + const char *str; + int n; + int quoter; + GDB_FILE *stream; +{ + int i; + for (i = 0; i < n; i++) + printchar (str[i], fputs_unfiltered, fprintf_unfiltered, stream, quoter); +} + /* Number of lines per page or UINT_MAX if paging is disabled. */ diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog index db62bb2edc..1ec771b32c 100644 --- a/sim/arm/ChangeLog +++ b/sim/arm/ChangeLog @@ -1,3 +1,4 @@ + 1999-05-08 Felix Lee * configure: Regenerated to track ../common/aclocal.m4 changes. diff --git a/sim/arm/armdefs.h b/sim/arm/armdefs.h index 1e1f3527dd..1d832bc1b6 100644 --- a/sim/arm/armdefs.h +++ b/sim/arm/armdefs.h @@ -30,7 +30,6 @@ typedef char * VoidStar ; #endif typedef unsigned long ARMword ; /* must be 32 bits wide */ - typedef struct ARMul_State ARMul_State ; typedef unsigned ARMul_CPInits(ARMul_State *state) ; diff --git a/sim/arm/armemu.c b/sim/arm/armemu.c index 36b7bba4d1..fa994e06c2 100644 --- a/sim/arm/armemu.c +++ b/sim/arm/armemu.c @@ -464,6 +464,7 @@ ARMword ARMul_Emulate26(register ARMul_State *state) if (temp) { /* if the condition codes don't match, stop here */ mainswitch: + switch ((int)BITS(20,27)) { /***************************************************************************\ @@ -877,6 +878,7 @@ mainswitch: break ; case 0x10 : /* TST reg and MRS CPSR and SWP word */ + #ifdef MODET if (BITS(4,11) == 0xB) { /* STRH register offset, no write-back, down, pre indexed */ diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 5f702b0c6a..3c6a9f0e07 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,26 @@ +Sun Jul 11 23:47:20 1999 Andrew Cagney + + * sim-resume.c (sim_resume): Ensure that the siggnal [sic] is only + passed in when sim_resume is first entered - don't re-pass it + after a restart. + +Sun Jul 11 23:34:44 1999 Andrew Cagney + + * sim-options.c (standard_option_handler): Add OPTION_LOAD_VMA and + OPTION_LOAD_LMA but only when is defined. + (standard_options): When SIM_HANDLES_LMA is defined include + options --load-lma and --load-vma. + (standard_install): Initialize STATE_LOAD_AT_LMA_P. + + * sim-base.h (STATE_LOAD_AT_LMA_P): Define. + (struct sim_state_base): Add load_at_lma_p. + * sim-hload.c (sim_load): Replace SIM_HANDLES_LMA with + STATE_LOAD_AT_LMA_P. + +Sun Jul 11 12:03:36 1999 Andrew Cagney + + * nrun.c (main): Re-format loop gnu style. + Wed Jul 7 19:56:03 1999 Andrew Cagney * dv-sockser.c (connected_p): Initialize addrlen. diff --git a/sim/common/nltvals.def b/sim/common/nltvals.def index bed711cacf..b5e82fcfb4 100644 --- a/sim/common/nltvals.def +++ b/sim/common/nltvals.def @@ -416,27 +416,3 @@ /* end v850 sys target macros */ #endif #endif -#ifdef NL_TARGET_venus -#ifdef sys_defs -/* from syscall.h */ -/* begin venus sys target macros */ - { "SYS_argv", 13 }, - { "SYS_argvlen", 12 }, - { "SYS_chdir", 14 }, - { "SYS_chmod", 16 }, - { "SYS_close", 3 }, - { "SYS_exit", 1 }, - { "SYS_fstat", 10 }, - { "SYS_getpid", 8 }, - { "SYS_kill", 9 }, - { "SYS_lseek", 6 }, - { "SYS_open", 2 }, - { "SYS_read", 4 }, - { "SYS_stat", 15 }, - { "SYS_time", 18 }, - { "SYS_unlink", 7 }, - { "SYS_utime", 17 }, - { "SYS_write", 5 }, -/* end venus sys target macros */ -#endif -#endif diff --git a/sim/common/nrun.c b/sim/common/nrun.c index 2f13b1f91b..c5b43a25ee 100644 --- a/sim/common/nrun.c +++ b/sim/common/nrun.c @@ -137,41 +137,44 @@ main (int argc, char **argv) ((reason == sim_stopped) && (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT))); } - else do + else { + do + { #if defined (HAVE_SIGACTION) && defined (SA_RESTART) - struct sigaction sa, osa; - sa.sa_handler = cntrl_c; - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - sigaction (SIGINT, &sa, &osa); - prev_sigint = osa.sa_handler; + struct sigaction sa, osa; + sa.sa_handler = cntrl_c; + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + sigaction (SIGINT, &sa, &osa); + prev_sigint = osa.sa_handler; #else - prev_sigint = signal (SIGINT, cntrl_c); + prev_sigint = signal (SIGINT, cntrl_c); #endif - sim_resume (sd, 0, sigrc); - signal (SIGINT, prev_sigint); - sim_stop_reason (sd, &reason, &sigrc); - - if ((reason == sim_stopped) && - (sigrc == sim_signal_to_host (sd, SIM_SIGINT))) - break; /* exit on control-C */ - - /* remain on signals in oe mode */ - } while ((reason == sim_stopped) && - (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT)); - + sim_resume (sd, 0, sigrc); + signal (SIGINT, prev_sigint); + sim_stop_reason (sd, &reason, &sigrc); + + if ((reason == sim_stopped) && + (sigrc == sim_signal_to_host (sd, SIM_SIGINT))) + break; /* exit on control-C */ + + /* remain on signals in oe mode */ + } while ((reason == sim_stopped) && + (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT)); + + } /* Print any stats the simulator collected. */ sim_info (sd, 0); - + /* Shutdown the simulator. */ sim_close (sd, 0); - + /* If reason is sim_exited, then sigrc holds the exit code which we want to return. If reason is sim_stopped or sim_signalled, then sigrc holds the signal that the simulator received; we want to return that to indicate failure. */ - + #ifdef SIM_H8300 /* FIXME: Ugh. grep for SLEEP in compile.c */ if (sigrc == SIGILL) abort (); diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h index 3fe01b4a98..f3af30553a 100644 --- a/sim/common/sim-base.h +++ b/sim/common/sim-base.h @@ -237,6 +237,11 @@ typedef struct { #endif + /* Should image loads be performed using the LMA or VMA? Older + simulators use the VMA while newer simulators prefer the LMA. */ + int load_at_lma_p; +#define STATE_LOAD_AT_LMA_P(SD) ((SD)->base.load_at_lma_p) + /* Marker for those wanting to do sanity checks. This should remain the last member of this struct to help catch miscompilation errors. */ diff --git a/sim/common/sim-hload.c b/sim/common/sim-hload.c index e4016f454a..b8726ba783 100644 --- a/sim/common/sim-hload.c +++ b/sim/common/sim-hload.c @@ -45,20 +45,14 @@ sim_load (sd, prog_name, prog_bfd, from_tty) incorrectly write the program sections at LMA interpreted as a virtual address. This is still accommodated for backward compatibility reasons. */ - /* FIXME: The following simulators use this file as of 980313: - m32r, mips, v850 [grep for sim-hload in all Makefile.in's]. - Each of these should be properly using lma. When this is confirmed, - SIM_HANDLES_LMA can go away. */ -#ifndef SIM_HANDLES_LMA -#define SIM_HANDLES_LMA 0 -#endif result_bfd = sim_load_file (sd, STATE_MY_NAME (sd), STATE_CALLBACK (sd), prog_name, STATE_PROG_BFD (sd), STATE_OPEN_KIND (sd) == SIM_OPEN_DEBUG, - SIM_HANDLES_LMA, sim_write); + STATE_LOAD_AT_LMA_P (sd), + sim_write); if (result_bfd == NULL) { bfd_close (STATE_PROG_BFD (sd)); diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index b49256b1b2..8d0f923756 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -111,6 +111,8 @@ typedef enum { #ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */ OPTION_H8300, #endif + OPTION_LOAD_LMA, + OPTION_LOAD_VMA, } STANDARD_OPTIONS; static const OPTION standard_options[] = @@ -182,6 +184,19 @@ static const OPTION standard_options[] = '\0', "BFDNAME", "Specify the object-code format for the object files", standard_option_handler }, +#ifdef SIM_HANDLES_LMA + { {"load-lma", no_argument, NULL, OPTION_LOAD_LMA}, + '\0', NULL, +#if SIM_HANDLES_LMA + "Use VMA or LMA addresses when loading image (default LMA)", +#else + "Use VMA or LMA addresses when loading image (default VMA)", +#endif + standard_option_handler, "load-{lma,vma}" }, + { {"load-vma", no_argument, NULL, OPTION_LOAD_VMA}, + '\0', NULL, "", standard_option_handler, "" }, +#endif + { {NULL, no_argument, NULL, 0}, '\0', NULL, NULL, NULL } }; @@ -394,6 +409,18 @@ standard_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, break; } + case OPTION_LOAD_LMA: + { + STATE_LOAD_AT_LMA_P (sd) = 1; + break; + } + + case OPTION_LOAD_VMA: + { + STATE_LOAD_AT_LMA_P (sd) = 0; + break; + } + case OPTION_HELP: sim_print_help (sd, is_command); if (STATE_OPEN_KIND (sd) == SIM_OPEN_STANDALONE) @@ -413,6 +440,9 @@ standard_install (SIM_DESC sd) SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); if (sim_add_option_table (sd, NULL, standard_options) != SIM_RC_OK) return SIM_RC_FAIL; +#ifdef SIM_HANDLES_LMA + STATE_LOAD_AT_LMA_P (sd) = SIM_HANDLES_LMA; +#endif return SIM_RC_OK; } diff --git a/sim/common/sim-resume.c b/sim/common/sim-resume.c index 09b475ec5c..8cf75d5d80 100644 --- a/sim/common/sim-resume.c +++ b/sim/common/sim-resume.c @@ -70,6 +70,11 @@ sim_resume (SIM_DESC sd, if (next_cpu_nr >= nr_cpus) next_cpu_nr = 0; + /* Only deliver the siggnal ]sic] the first time through - don't + re-deliver any siggnal during a restart. */ + if (jmpval == sim_engine_restart_jmpval) + siggnal = 0; + #ifdef SIM_CPU_EXCEPTION_RESUME { sim_cpu* cpu = STATE_CPU (sd, next_cpu_nr); diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog index 04f0bc6521..34c2798a3e 100644 --- a/sim/mips/ChangeLog +++ b/sim/mips/ChangeLog @@ -1,3 +1,17 @@ +Mon Jul 12 00:02:27 1999 Andrew Cagney + + * interp.c (sim_monitor): Flush output before reading input. + +Sun Jul 11 19:28:11 1999 Andrew Cagney + + * tconfig.in (SIM_HANDLES_LMA): Always define. + +Thu Jul 8 16:06:59 1999 Andrew Cagney + + From Mark Salter : + * interp.c (BOARD_BSP): Define. Add to list of possible boards. + (sim_open): Add setup for BSP board. + Wed Jul 7 12:45:58 1999 Andrew Cagney * mips.igen (MULT, MULTU): Add syntax for two operand version. diff --git a/sim/mips/interp.c b/sim/mips/interp.c index a2ed20fb7b..04383d3f93 100644 --- a/sim/mips/interp.c +++ b/sim/mips/interp.c @@ -257,6 +257,8 @@ static const OPTION mips_options[] = "|" BOARD_JMR3904_PAL #define BOARD_JMR3904_DEBUG "jmr3904debug" "|" BOARD_JMR3904_DEBUG +#define BOARD_BSP "bsp" + "|" BOARD_BSP , "Customize simulation for a particular board.", mips_option_handler }, @@ -352,12 +354,40 @@ sim_open (kind, cb, abfd, argv) device_init(sd); } - + else if (board != NULL + && (strcmp(board, BOARD_BSP) == 0)) + { + int i; + + STATE_ENVIRONMENT (sd) = OPERATING_ENVIRONMENT; + + /* ROM: 0x9FC0_0000 - 0x9FFF_FFFF and 0xBFC0_0000 - 0xBFFF_FFFF */ + sim_do_commandf (sd, "memory alias 0x%lx@1,0x%lx,0x%0x", + 0x9FC00000, + 4 * 1024 * 1024, /* 4 MB */ + 0xBFC00000); + + /* SRAM: 0x8000_0000 - 0x803F_FFFF and 0xA000_0000 - 0xA03F_FFFF */ + sim_do_commandf (sd, "memory alias 0x%lx@1,0x%lx,0x%0x", + 0x80000000, + 4 * 1024 * 1024, /* 4 MB */ + 0xA0000000); + + /* DRAM: 0x8800_0000 - 0x89FF_FFFF and 0xA800_0000 - 0xA9FF_FFFF */ + for (i=0; i<8; i++) /* 32 MB total */ + { + unsigned size = 4 * 1024 * 1024; /* 4 MB */ + sim_do_commandf (sd, "memory alias 0x%lx@1,0x%lx,0x%0x", + 0x88000000 + (i * size), + size, + 0xA8000000 + (i * size)); + } + } #if (WITH_HW) - if (board != NULL - && (strcmp(board, BOARD_JMR3904) == 0 || - strcmp(board, BOARD_JMR3904_PAL) == 0 || - strcmp(board, BOARD_JMR3904_DEBUG) == 0)) + else if (board != NULL + && (strcmp(board, BOARD_JMR3904) == 0 || + strcmp(board, BOARD_JMR3904_PAL) == 0 || + strcmp(board, BOARD_JMR3904_DEBUG) == 0)) { /* match VIRTUAL memory layout of JMR-TX3904 board */ int i; @@ -973,6 +1003,8 @@ sim_monitor (SIM_DESC sd, case 11: /* char inbyte(void) */ { char tmp; + /* ensure that all output has gone... */ + sim_io_flush_stdout (sd); if (sim_io_read_stdin (sd, &tmp, sizeof(char)) != sizeof(char)) { sim_io_error(sd,"Invalid return from character read"); diff --git a/sim/mips/tconfig.in b/sim/mips/tconfig.in index e8062a3af6..d591474031 100644 --- a/sim/mips/tconfig.in +++ b/sim/mips/tconfig.in @@ -12,6 +12,8 @@ MODULE_INSTALL_FN dv_sockser_install; #define MODULE_LIST dv_sockser_install, +#else +#define SIM_HANDLES_LMA 0 #endif /* Define this if the simulator supports profiling. -- 2.34.1