diff options
author | Jason Molenda <jmolenda@apple.com> | 1999-07-12 11:15:22 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 1999-07-12 11:15:22 +0000 |
commit | 43e526b9b4c9868d3cd90772a54f767f8d45cadd (patch) | |
tree | 4d68a4a2d3a6c7e4f6237bc04015fc182a8ced0c /gdb | |
parent | edac9bffc154855d959fcbc32e2fe0b073a9ec71 (diff) | |
download | fsf-binutils-gdb-43e526b9b4c9868d3cd90772a54f767f8d45cadd.zip fsf-binutils-gdb-43e526b9b4c9868d3cd90772a54f767f8d45cadd.tar.gz fsf-binutils-gdb-43e526b9b4c9868d3cd90772a54f767f8d45cadd.tar.bz2 |
import gdb-1999-07-12 snapshot
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 52 | ||||
-rw-r--r-- | gdb/Makefile.in | 9 | ||||
-rw-r--r-- | gdb/NEWS | 19 | ||||
-rw-r--r-- | gdb/blockframe.c | 2 | ||||
-rw-r--r-- | gdb/command.c | 3 | ||||
-rw-r--r-- | gdb/config/mips/tm-mips.h | 27 | ||||
-rw-r--r-- | gdb/configure.tgt | 1 | ||||
-rw-r--r-- | gdb/defs.h | 6 | ||||
-rw-r--r-- | gdb/mips-tdep.c | 83 | ||||
-rw-r--r-- | gdb/remote.c | 13 | ||||
-rw-r--r-- | gdb/serial.c | 2 | ||||
-rw-r--r-- | gdb/sparcl-tdep.c | 72 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/list.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/list0.h | 13 | ||||
-rw-r--r-- | gdb/utils.c | 68 |
16 files changed, 276 insertions, 106 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e0e094d..1694d94 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,55 @@ +Mon Jul 12 11:15:09 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * 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 <cagney@b1.cygnus.com>'' 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 <cagney@amy.cygnus.com> + + * 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 <keiths@cygnus.com> + + * 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 <shebs@andros.cygnus.com> + + * 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 <cagney@b1.cygnus.com> + + * 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 <shebs@andros.cygnus.com> * All C files except *-stub.c and *-share/*: Indent to GNU diff --git a/gdb/Makefile.in b/gdb/Makefile.in index a46d01a..772a6c7 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 @@ -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 +``|<program> <args>'' 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 26a26ae..6b8e83b 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 ad3e7e4..fd8b814 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 fd0ae23..bfdc945 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 3f23a73..bca34ac 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 ;; @@ -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 c00e584..73429dc 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 c431670..00b9661 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 6cb2030..dca48bc 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 7e5457d..d6fa160 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 <netdb.h> #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 1c56333..711e9f0 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +1999-07-08 Stan Shebs <shebs@andros.cygnus.com> + + * 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 <cagney@amy.cygnus.com> * 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 3652be9..d77ce53 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 c4d337c..d468330 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 f181d0c..23374cf 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. */ |