From 085dd6e638eca9d348100c8f0e8cae04e20d58a1 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Mon, 28 Jun 1999 16:06:02 +0000 Subject: [PATCH] import gdb-1999-06-28 snapshot --- gdb/ChangeLog | 106 + gdb/Makefile.in | 22 +- gdb/NEWS | 4 + gdb/altos-xdep.c | 326 ++-- gdb/arm-tdep.c | 72 +- gdb/ax-gdb.c | 5 +- gdb/config/convex/Convex.notes | 325 ++-- gdb/config/convex/convex.mh | 6 +- gdb/config/convex/convex.mt | 6 +- gdb/config/convex/tm-convex.h | 972 +++++----- gdb/config/convex/xm-convex.h | 70 +- gdb/config/m68k/altos.mh | 8 +- gdb/config/m68k/altos.mt | 6 +- gdb/config/m68k/tm-altos.h | 88 +- gdb/config/m68k/xm-altos.h | 404 ++-- gdb/configure.host | 6 +- gdb/configure.tgt | 8 +- gdb/convex-tdep.c | 2554 ++++++++++++------------- gdb/convex-xdep.c | 1926 +++++++++---------- gdb/doc/ChangeLog | 26 + gdb/doc/Makefile.in | 27 +- gdb/doc/gdbint.texinfo | 144 ++ gdb/doc/remote.texi | 649 ++++++- gdb/doc/stabs.texinfo | 4 +- gdb/event-loop.c | 43 +- gdb/event-loop.h | 19 +- gdb/event-top.c | 54 +- gdb/frame.h | 2 +- gdb/gdbserver/Makefile.in | 3 + gdb/main.c | 8 +- gdb/nlm/Makefile.in | 3 + gdb/rdi-share/Makefile.in | 3 + gdb/remote.c | 60 +- gdb/solib.c | 26 +- gdb/symtab.c | 2 + gdb/testsuite/ChangeLog | 102 + gdb/testsuite/Makefile.in | 2 + gdb/testsuite/gdb.base/all-bin.exp | 50 +- gdb/testsuite/gdb.base/annota1.c | 12 + gdb/testsuite/gdb.base/annota1.exp | 6 +- gdb/testsuite/gdb.base/bitfields.c | 2 +- gdb/testsuite/gdb.base/break.c | 19 + gdb/testsuite/gdb.base/break.exp | 148 +- gdb/testsuite/gdb.base/call-ar-st.c | 234 ++- gdb/testsuite/gdb.base/call-ar-st.exp | 292 ++- gdb/testsuite/gdb.base/call-rt-st.c | 109 +- gdb/testsuite/gdb.base/call-rt-st.exp | 6 +- gdb/testsuite/gdb.base/call-strs.c | 21 +- gdb/testsuite/gdb.base/call-strs.exp | 21 +- gdb/testsuite/gdb.base/callfuncs.c | 127 +- gdb/testsuite/gdb.base/callfuncs.exp | 79 +- gdb/testsuite/gdb.base/callfuncs2.c | 108 +- gdb/testsuite/gdb.base/callfuncs2.exp | 77 +- gdb/testsuite/gdb.base/commands.exp | 99 +- gdb/testsuite/gdb.base/completion.exp | 216 ++- gdb/testsuite/gdb.base/condbreak.c | 19 + gdb/testsuite/gdb.base/condbreak.exp | 36 +- gdb/testsuite/gdb.base/constvars.exp | 78 +- gdb/testsuite/gdb.base/corefile.exp | 5 +- gdb/testsuite/gdb.base/coremaker.c | 6 +- gdb/testsuite/gdb.base/default.exp | 23 +- gdb/testsuite/gdb.base/define.exp | 4 +- gdb/testsuite/gdb.base/display.exp | 17 +- gdb/testsuite/gdb.base/ena-dis-br.exp | 24 +- gdb/testsuite/gdb.base/ending-run.c | 8 +- gdb/testsuite/gdb.base/ending-run.exp | 53 +- gdb/testsuite/gdb.base/eval-skip.exp | 60 +- gdb/testsuite/gdb.base/exprs.c | 11 +- gdb/testsuite/gdb.base/exprs.exp | 189 +- gdb/testsuite/gdb.base/funcargs.c | 368 +++- gdb/testsuite/gdb.base/funcargs.exp | 121 +- gdb/testsuite/gdb.base/interrupt.c | 3 + gdb/testsuite/gdb.base/interrupt.exp | 13 +- gdb/testsuite/gdb.base/jump.c | 7 +- gdb/testsuite/gdb.base/jump.exp | 30 +- gdb/testsuite/gdb.base/langs.exp | 55 +- gdb/testsuite/gdb.base/langs0.c | 6 + gdb/testsuite/gdb.base/langs1.c | 8 + gdb/testsuite/gdb.base/langs2.c | 17 + gdb/testsuite/gdb.base/list.exp | 68 +- gdb/testsuite/gdb.base/list0.c | 3 +- gdb/testsuite/gdb.base/list1.c | 28 +- gdb/testsuite/gdb.base/logical.exp | 82 +- gdb/testsuite/gdb.base/long_long.c | 6 + gdb/testsuite/gdb.base/long_long.exp | 55 +- gdb/testsuite/gdb.base/mips_pro.c | 22 + gdb/testsuite/gdb.base/mips_pro.exp | 2 +- gdb/testsuite/gdb.base/miscexprs.exp | 29 +- gdb/testsuite/gdb.base/nodebug.c | 27 +- gdb/testsuite/gdb.base/nodebug.exp | 39 +- gdb/testsuite/gdb.base/opaque.exp | 30 +- gdb/testsuite/gdb.base/opaque0.c | 3 + gdb/testsuite/gdb.base/opaque1.c | 2 +- gdb/testsuite/gdb.base/pointers.exp | 15 +- gdb/testsuite/gdb.base/printcmds.c | 6 +- gdb/testsuite/gdb.base/ptype.c | 19 +- gdb/testsuite/gdb.base/ptype.exp | 44 +- gdb/testsuite/gdb.base/recurse.c | 8 +- gdb/testsuite/gdb.base/relational.exp | 65 +- gdb/testsuite/gdb.base/restore.c | 2 +- gdb/testsuite/gdb.base/return.c | 5 +- gdb/testsuite/gdb.base/run.c | 19 +- gdb/testsuite/gdb.base/scope.exp | 17 +- gdb/testsuite/gdb.base/scope0.c | 46 +- gdb/testsuite/gdb.base/scope1.c | 19 +- gdb/testsuite/gdb.base/sect-cmd.exp | 34 +- gdb/testsuite/gdb.base/setshow.c | 5 + gdb/testsuite/gdb.base/setvar.c | 7 + gdb/testsuite/gdb.base/setvar.exp | 7 + gdb/testsuite/gdb.base/shlib-call.exp | 8 +- gdb/testsuite/gdb.base/shmain.c | 31 +- gdb/testsuite/gdb.base/shr1.c | 16 + gdb/testsuite/gdb.base/shr2.c | 14 +- gdb/testsuite/gdb.base/sigall.c | 427 +++++ gdb/testsuite/gdb.base/signals.c | 6 + gdb/testsuite/gdb.base/signals.exp | 8 +- gdb/testsuite/gdb.base/so-impl-ld.c | 9 +- gdb/testsuite/gdb.base/so-impl-ld.exp | 25 +- gdb/testsuite/gdb.base/so-indr-cl.c | 9 +- gdb/testsuite/gdb.base/so-indr-cl.exp | 20 +- gdb/testsuite/gdb.base/solib.c | 5 +- gdb/testsuite/gdb.base/solib.exp | 41 + gdb/testsuite/gdb.base/solib1.c | 9 + gdb/testsuite/gdb.base/solib2.c | 10 + gdb/testsuite/gdb.base/step-test.c | 9 +- gdb/testsuite/gdb.base/step-test.exp | 25 +- gdb/testsuite/gdb.base/term.exp | 2 + gdb/testsuite/gdb.base/twice.c | 4 +- gdb/testsuite/gdb.base/twice.exp | 1 + gdb/testsuite/gdb.base/varargs.c | 5 +- gdb/testsuite/gdb.base/varargs.exp | 27 +- gdb/testsuite/gdb.base/volatile.exp | 98 +- gdb/testsuite/gdb.base/watchpoint.c | 50 + gdb/testsuite/gdb.base/watchpoint.exp | 289 ++- gdb/testsuite/gdb.base/whatis.c | 2 +- gdb/testsuite/gdb.base/whatis.exp | 79 +- gdb/testsuite/gdb.c++/member-ptr.exp | 14 + gdb/testsuite/gdb.chill/ChangeLog | 6 + gdb/testsuite/lib/gdb.exp | 83 +- gdb/top.c | 3 +- gdb/utils.c | 4 +- sim/common/ChangeLog | 7 + sim/common/cgen-engine.h | 2 +- sim/common/genmloop.sh | 9 +- sim/mcore/ChangeLog | 5 + sim/mcore/sysdep.h | 4 + 146 files changed, 8253 insertions(+), 4705 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6a4c613a48..f41bc52ed9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,109 @@ +1999-06-28 Jim Blandy + + * solib.c (clear_solib): Don't disable breakpoints if we're + running an a.out executable (Solaris's SunOS emulation). + +1999-06-25 Elena Zannoni + + * main.c (main): Remove intialization of command_loop_hook, it + is now done in _initialize_event_loop(). + * event-loop.c (gdb_do_one_event): Make static. + (start_event_loop): New function. Just start the event loop. + * event-top.c (cli_command_loop): New name for start_event_loop(). + (gdb_readline2): Make non static. + (_initialize_event_loop): Set command_loop_hook to cli_command_loop. + * event-loop.h: Adjust exported functions accordingly. + + * top.c (init_main): Move setting of async_command_editing_p from + here. + * event-top.c (_initialize_event_loop): To here. + (change_line_handler): Revert previous change. Add comment. + (_initialize_event_loop): Revert previous change. + (cli_command_loop): New name for start_event_loop(). + (start_event_loop): New function. This just starts up the event loop. + (gdb_readline2): Make non static. + (_initialize_event_loop): Set command_loop_hook to cli_command_loop. + +1999-06-25 Elena Zannoni + + * event-top.c (change_line_handler): Get rid of the global + variable input_fd, use `fileno (instream)' instead. + (_initialize_event_loop): Ditto + + * event-loop.c (add_file_handler): New function. Wrapper for + create_file_handler. + (create_file_handler): Make static. + * event-top.c (_initialize_event_loop): Call add_file_handler, + instead of create_file_handler. + (change_line_handler): Ditto. + Remove poll.h include. + * event-loop.h: Export add_file_handler instead of + create_file_handler. + +1999-06-24 Stan Shebs + + Declare Altos configuration obsolete. + * configure.host, configure.tgt: Comment out Altos config. + * Makefile.in: Comment out Altos-related actions. + * altos-xdep.c, config/m68k/altos.mh, altos.mt, tm-altos.h, + xm-altos.h: Comment out. + * NEWS: Mention obsolete status. + +1999-06-24 Jason Molenda (jsm@bugshack.cygnus.com) + + * Makefile.in: Add MAKEHTML and MAKEHTMLFLAGS; pass them down; + recognize html and install-html targets. + * gdbserver/Makefile.in: Add empty html and install-html targets. + * nlm/Makefile.in: Ditto. + * rdi-share/Makefile.in: Ditto. + +1999-06-24 Jim Blandy + + * ax-gdb.c (agent_command): Remove vestigial call to ax_reqs. + +1999-06-24 James Ingham + + * arm-tdep.c (arm_othernames): Change both gdb's register display + AND the opcode disassembly register naming if the othernames + command. Fixes the gdb part of CR 101177. + +1999-06-23 Stan Shebs + + Declare Convex configuration obsolete. + * configure.host, configure.tgt: Comment out Convex configs. + * Makefile.in: Comment out Convex-related actions. + * convex-xdep.c, convex-tdep.c, config/convex/*: Comment out. + * NEWS: Mention obsolete status. + +1999-06-23 Elena Zannoni + + * main.c: Turn on async by default by setting async_p to 1. + +Wed Jun 23 15:44:39 1999 Andrew Cagney + + From Jimmy Guo : + * frame.h (enum lval_type): Delcare when an __STDC__ compiler. + Reverts Mon Aug 11 16:08:52 1997 Fred Fish + change. + * utils.c (gdb_file_rewind, gdb_file_put): Fix. A void function + does not return a result. + +Wed Jun 23 15:30:46 1999 Andrew Cagney + + * remote.c (set_thread, remote_get_threadinfo, + remote_threads_info, remote_current_thread, remote_get_threadlist, + extended_remote_restart, get_offsets, remote_open_1, + remote_detach, remote_resume, remote_wait, remote_fetch_registers, + remote_store_registers, check_binary_download, remote_write_bytes, + remote_read_bytes, remote_search, putpkt_binary, putpkt_binary, + read_frame, compare_sections_command, remote_query, + packet_command, remote_info_process): Use alloca to create space + for arrays of size PBUFSIZ. + +1999-06-22 Jason Molenda (jsm@bugshack.cygnus.com) + + * top.c: Update copyright years to include 1999. + 1999-06-18 Elena Zannoni * top.c: Move include of event-loop.h, to avoid redefinition of diff --git a/gdb/Makefile.in b/gdb/Makefile.in index d2f2e4e31e..177333e515 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -39,6 +39,7 @@ man7dir = $(mandir)/man7 man8dir = $(mandir)/man8 man9dir = $(mandir)/man9 infodir = @infodir@ +htmldir = $(prefix)/html includedir = @includedir@ # This can be referenced by `INTLDEPS' as computed by CY_GNU_GETTEXT. @@ -89,6 +90,10 @@ YLWRAP = $(srcdir)/../ylwrap # where to find makeinfo, preferably one designed for texinfo-2 MAKEINFO=makeinfo +MAKEHTML = texi2html + +MAKEHTMLFLAGS = -glossary -menu -split_chapter + # Set this up with gcc if you have gnu ld and the loader will print out # line numbers for undefined references. #CC_LD=gcc -static @@ -219,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 = 19990621 +VERSION = 19990628 DIST=gdb LINT=/usr/5bin/lint @@ -276,6 +281,8 @@ FLAGS_TO_PASS = \ "DLLTOOL=$(DLLTOOL)" \ "RANLIB=$(RANLIB)" \ "MAKEINFO=$(MAKEINFO)" \ + "MAKEHTML=$(MAKEHTML)" \ + "MAKEHTMLFLAGS=$(MAKEHTMLFLAGS)" \ "INSTALL=$(INSTALL)" \ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ "INSTALL_DATA=$(INSTALL_DATA)" \ @@ -358,6 +365,7 @@ TARGET_FLAGS_TO_PASS = \ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ "INSTALL_DATA=$(INSTALL_DATA)" \ "MAKEINFO=$(MAKEINFO)" \ + "MAKEHTML=$(MAKEHTML)" \ "RUNTEST=$(RUNTEST)" \ "RUNTESTFLAGS=$(RUNTESTFLAGS)" @@ -557,7 +565,7 @@ check: force $(MAKE) $(TARGET_FLAGS_TO_PASS) check; \ else true; fi -info dvi install-info clean-info: force +info dvi install-info clean-info html install-html: force @$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do gdb.z:gdb.1 @@ -986,7 +994,7 @@ alpha-nat.o: alpha-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) target.h alpha-tdep.o: alpha-tdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \ $(inferior_h) $(symtab_h) $(dis-asm.h) gdb_string.h -altos-xdep.o: altos-xdep.c $(defs_h) $(gdbcore_h) $(inferior_h) +# OBSOLETE altos-xdep.o: altos-xdep.c $(defs_h) $(gdbcore_h) $(inferior_h) annotate.o: annotate.c $(defs_h) annotate.h $(value_h) target.h $(gdbtypes_h) @@ -1048,11 +1056,11 @@ command.o: command.c $(defs_h) $(expression_h) $(gdbcmd_h) \ complaints.o: complaints.c complaints.h $(defs_h) $(gdbcmd_h) -convex-tdep.o: convex-tdep.c $(wait_h) $(defs_h) $(gdbcmd_h) \ - $(gdbcore_h) $(inferior_h) +# OBSOLETE convex-tdep.o: convex-tdep.c $(wait_h) $(defs_h) $(gdbcmd_h) \ +# OBSOLETE $(gdbcore_h) $(inferior_h) -convex-xdep.o: convex-xdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \ - $(inferior_h) +# OBSOLETE convex-xdep.o: convex-xdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \ +# OBSOLETE $(inferior_h) copying.o: copying.c $(defs_h) $(gdbcmd_h) diff --git a/gdb/NEWS b/gdb/NEWS index 7ae2bbdf23..c6cf4c399a 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -7,6 +7,10 @@ TI TMS320C80 tic80-*-* +* OBSOLETE configurations + +Altos 3068 m68*-altos-* +Convex c1-*-*, c2-*-* *** Changes in GDB-4.18: diff --git a/gdb/altos-xdep.c b/gdb/altos-xdep.c index 272c581b8f..0704ddd5a2 100644 --- a/gdb/altos-xdep.c +++ b/gdb/altos-xdep.c @@ -1,163 +1,163 @@ -/* Low level interface to ptrace, for GDB when running under m68k SVR2 Unix - on Altos 3068. Report bugs to Jyrki Kuoppala - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" - -#ifdef USG -#include -#endif - -#include -#include -#include -#include -#include -#ifdef USG -#include -#ifdef ALTOS -#include -#include -#endif -#endif - -#include "gdbcore.h" -#include /* After a.out.h */ -#include -#include "gdb_stat.h" - - -/* Work with core dump and executable files, for GDB. - This code would be in corefile.c if it weren't machine-dependent. */ - -void -core_file_command (filename, from_tty) - char *filename; - int from_tty; -{ - int val; - - /* Discard all vestiges of any previous core file - and mark data and stack spaces as empty. */ - - if (corefile) - free (corefile); - corefile = 0; - - if (corechan >= 0) - close (corechan); - corechan = -1; - - data_start = 0; - data_end = 0; - stack_start = STACK_END_ADDR; - stack_end = STACK_END_ADDR; - - /* Now, if a new core file was specified, open it and digest it. */ - - if (filename) - { - filename = tilde_expand (filename); - make_cleanup (free, filename); - - if (have_inferior_p ()) - error ("To look at a core file, you must kill the program with \"kill\"."); - corechan = open (filename, O_RDONLY, 0); - if (corechan < 0) - perror_with_name (filename); - /* 4.2-style (and perhaps also sysV-style) core dump file. */ - { - struct user u; - - unsigned int reg_offset; - - val = myread (corechan, &u, sizeof u); - if (val < 0) - perror_with_name ("Not a core file: reading upage"); - if (val != sizeof u) - error ("Not a core file: could only read %d bytes", val); - data_start = exec_data_start; - -#if !defined (NBPG) -#define NBPG NBPP -#endif -#if !defined (UPAGES) -#define UPAGES USIZE -#endif - - data_end = data_start + NBPG * u.u_dsize; - stack_start = stack_end - NBPG * u.u_ssize; - data_offset = NBPG * UPAGES + exec_data_start % NBPG /* Not sure about this //jkp */; - stack_offset = NBPG * (UPAGES + u.u_dsize); - - /* Some machines put an absolute address in here and some put - the offset in the upage of the regs. */ - reg_offset = (int) u.u_state; - if (reg_offset > NBPG * UPAGES) - reg_offset -= KERNEL_U_ADDR; - - memcpy (&core_aouthdr, &u.u_exdata, sizeof (AOUTHDR)); - printf_unfiltered ("Core file is from \"%s\".\n", u.u_comm); - - /* I don't know where to find this info. - So, for now, mark it as not available. */ - N_SET_MAGIC (core_aouthdr, 0); - - /* Read the register values out of the core file and store - them where `read_register' will find them. */ - - { - register int regno; - - for (regno = 0; regno < NUM_REGS; regno++) - { - char buf[MAX_REGISTER_RAW_SIZE]; - - val = lseek (corechan, register_addr (regno, reg_offset), 0); - if (val < 0 - || (val = myread (corechan, buf, sizeof buf)) < 0) - { - char * buffer = (char *) alloca (strlen (REGISTER_NAME (regno)) - + 30); - strcpy (buffer, "Reading register "); - strcat (buffer, REGISTER_NAME (regno)); - - perror_with_name (buffer); - } - - supply_register (regno, buf); - } - } - } - if (filename[0] == '/') - corefile = savestring (filename, strlen (filename)); - else - { - corefile = concat (current_directory, "/", filename, NULL); - } - - flush_cached_frames (); - select_frame (get_current_frame (), 0); - validate_files (); - } - else if (from_tty) - printf_unfiltered ("No core file now.\n"); -} +/* OBSOLETE /* Low level interface to ptrace, for GDB when running under m68k SVR2 Unix */ +/* OBSOLETE on Altos 3068. Report bugs to Jyrki Kuoppala */ +/* OBSOLETE Copyright (C) 1989, 1991 Free Software Foundation, Inc. */ +/* OBSOLETE */ +/* OBSOLETE This file is part of GDB. */ +/* OBSOLETE */ +/* OBSOLETE This program is free software; you can redistribute it and/or modify */ +/* OBSOLETE it under the terms of the GNU General Public License as published by */ +/* OBSOLETE the Free Software Foundation; either version 2 of the License, or */ +/* OBSOLETE (at your option) any later version. */ +/* OBSOLETE */ +/* OBSOLETE This program is distributed in the hope that it will be useful, */ +/* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* OBSOLETE GNU General Public License for more details. */ +/* OBSOLETE */ +/* OBSOLETE You should have received a copy of the GNU General Public License */ +/* OBSOLETE along with this program; if not, write to the Free Software */ +/* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #include "defs.h" */ +/* OBSOLETE #include "frame.h" */ +/* OBSOLETE #include "inferior.h" */ +/* OBSOLETE */ +/* OBSOLETE #ifdef USG */ +/* OBSOLETE #include */ +/* OBSOLETE #endif */ +/* OBSOLETE */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #ifdef USG */ +/* OBSOLETE #include */ +/* OBSOLETE #ifdef ALTOS */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #endif */ +/* OBSOLETE #endif */ +/* OBSOLETE */ +/* OBSOLETE #include "gdbcore.h" */ +/* OBSOLETE #include /* After a.out.h *x/ */ +/* OBSOLETE #include */ +/* OBSOLETE #include "gdb_stat.h" */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE /* Work with core dump and executable files, for GDB. */ +/* OBSOLETE This code would be in corefile.c if it weren't machine-dependent. *x/ */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE core_file_command (filename, from_tty) */ +/* OBSOLETE char *filename; */ +/* OBSOLETE int from_tty; */ +/* OBSOLETE { */ +/* OBSOLETE int val; */ +/* OBSOLETE */ +/* OBSOLETE /* Discard all vestiges of any previous core file */ +/* OBSOLETE and mark data and stack spaces as empty. *x/ */ +/* OBSOLETE */ +/* OBSOLETE if (corefile) */ +/* OBSOLETE free (corefile); */ +/* OBSOLETE corefile = 0; */ +/* OBSOLETE */ +/* OBSOLETE if (corechan >= 0) */ +/* OBSOLETE close (corechan); */ +/* OBSOLETE corechan = -1; */ +/* OBSOLETE */ +/* OBSOLETE data_start = 0; */ +/* OBSOLETE data_end = 0; */ +/* OBSOLETE stack_start = STACK_END_ADDR; */ +/* OBSOLETE stack_end = STACK_END_ADDR; */ +/* OBSOLETE */ +/* OBSOLETE /* Now, if a new core file was specified, open it and digest it. *x/ */ +/* OBSOLETE */ +/* OBSOLETE if (filename) */ +/* OBSOLETE { */ +/* OBSOLETE filename = tilde_expand (filename); */ +/* OBSOLETE make_cleanup (free, filename); */ +/* OBSOLETE */ +/* OBSOLETE if (have_inferior_p ()) */ +/* OBSOLETE error ("To look at a core file, you must kill the program with \"kill\"."); */ +/* OBSOLETE corechan = open (filename, O_RDONLY, 0); */ +/* OBSOLETE if (corechan < 0) */ +/* OBSOLETE perror_with_name (filename); */ +/* OBSOLETE /* 4.2-style (and perhaps also sysV-style) core dump file. *x/ */ +/* OBSOLETE { */ +/* OBSOLETE struct user u; */ +/* OBSOLETE */ +/* OBSOLETE unsigned int reg_offset; */ +/* OBSOLETE */ +/* OBSOLETE val = myread (corechan, &u, sizeof u); */ +/* OBSOLETE if (val < 0) */ +/* OBSOLETE perror_with_name ("Not a core file: reading upage"); */ +/* OBSOLETE if (val != sizeof u) */ +/* OBSOLETE error ("Not a core file: could only read %d bytes", val); */ +/* OBSOLETE data_start = exec_data_start; */ +/* OBSOLETE */ +/* OBSOLETE #if !defined (NBPG) */ +/* OBSOLETE #define NBPG NBPP */ +/* OBSOLETE #endif */ +/* OBSOLETE #if !defined (UPAGES) */ +/* OBSOLETE #define UPAGES USIZE */ +/* OBSOLETE #endif */ +/* OBSOLETE */ +/* OBSOLETE data_end = data_start + NBPG * u.u_dsize; */ +/* OBSOLETE stack_start = stack_end - NBPG * u.u_ssize; */ +/* OBSOLETE data_offset = NBPG * UPAGES + exec_data_start % NBPG /* Not sure about this //jkp *x/; */ +/* OBSOLETE stack_offset = NBPG * (UPAGES + u.u_dsize); */ +/* OBSOLETE */ +/* OBSOLETE /* Some machines put an absolute address in here and some put */ +/* OBSOLETE the offset in the upage of the regs. *x/ */ +/* OBSOLETE reg_offset = (int) u.u_state; */ +/* OBSOLETE if (reg_offset > NBPG * UPAGES) */ +/* OBSOLETE reg_offset -= KERNEL_U_ADDR; */ +/* OBSOLETE */ +/* OBSOLETE memcpy (&core_aouthdr, &u.u_exdata, sizeof (AOUTHDR)); */ +/* OBSOLETE printf_unfiltered ("Core file is from \"%s\".\n", u.u_comm); */ +/* OBSOLETE */ +/* OBSOLETE /* I don't know where to find this info. */ +/* OBSOLETE So, for now, mark it as not available. *x/ */ +/* OBSOLETE N_SET_MAGIC (core_aouthdr, 0); */ +/* OBSOLETE */ +/* OBSOLETE /* Read the register values out of the core file and store */ +/* OBSOLETE them where `read_register' will find them. *x/ */ +/* OBSOLETE */ +/* OBSOLETE { */ +/* OBSOLETE register int regno; */ +/* OBSOLETE */ +/* OBSOLETE for (regno = 0; regno < NUM_REGS; regno++) */ +/* OBSOLETE { */ +/* OBSOLETE char buf[MAX_REGISTER_RAW_SIZE]; */ +/* OBSOLETE */ +/* OBSOLETE val = lseek (corechan, register_addr (regno, reg_offset), 0); */ +/* OBSOLETE if (val < 0 */ +/* OBSOLETE || (val = myread (corechan, buf, sizeof buf)) < 0) */ +/* OBSOLETE { */ +/* OBSOLETE char * buffer = (char *) alloca (strlen (REGISTER_NAME (regno)) */ +/* OBSOLETE + 30); */ +/* OBSOLETE strcpy (buffer, "Reading register "); */ +/* OBSOLETE strcat (buffer, REGISTER_NAME (regno)); */ +/* OBSOLETE */ +/* OBSOLETE perror_with_name (buffer); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE supply_register (regno, buf); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE if (filename[0] == '/') */ +/* OBSOLETE corefile = savestring (filename, strlen (filename)); */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE corefile = concat (current_directory, "/", filename, NULL); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE flush_cached_frames (); */ +/* OBSOLETE select_frame (get_current_frame (), 0); */ +/* OBSOLETE validate_files (); */ +/* OBSOLETE } */ +/* OBSOLETE else if (from_tty) */ +/* OBSOLETE printf_unfiltered ("No core file now.\n"); */ +/* OBSOLETE } */ diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 993e4bfe85..70db37eceb 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -45,7 +45,32 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ a power of two. */ #define ROUND_DOWN(n,a) ((n) & ~((a) - 1)) #define ROUND_UP(n,a) (((n) + (a) - 1) & ~((a) - 1)) - + +static char *APCS_register_names[] = +{ "a1", "a2", "a3", "a4", /* 0 1 2 3 */ + "v1", "v2", "v3", "v4", /* 4 5 6 7 */ + "v5", "v6", "sl", "fp", /* 8 9 10 11 */ + "ip", "sp", "lr", "pc", /* 12 13 14 15 */ + "f0", "f1", "f2", "f3", /* 16 17 18 19 */ + "f4", "f5", "f6", "f7", /* 20 21 22 23 */ + "fps","ps" } /* 24 25 */; + +/* These names are the ones which gcc emits, and + I find them less confusing. Toggle between them + using the `othernames' command. */ +static char *additional_register_names[] = +{ "r0", "r1", "r2", "r3", /* 0 1 2 3 */ + "r4", "r5", "r6", "r7", /* 4 5 6 7 */ + "r8", "r9", "r10", "r11", /* 8 9 10 11 */ + "r12", "r13", "r14", "pc", /* 12 13 14 15 */ + "f0", "f1", "f2", "f3", /* 16 17 18 19 */ + "f4", "f5", "f6", "f7", /* 20 21 22 23 */ + "fps","ps" } /* 24 25 */; + +/* By default use the APCS registers names */ + +char **arm_register_names = APCS_register_names; + /* Should call_function allocate stack space for a struct return? */ /* The system C compiler uses a similar structure return convention to gcc */ int @@ -1029,38 +1054,18 @@ arm_float_info () print_fpu_flags (status); } -static char *original_register_names[] = -{ "a1", "a2", "a3", "a4", /* 0 1 2 3 */ - "v1", "v2", "v3", "v4", /* 4 5 6 7 */ - "v5", "v6", "sl", "fp", /* 8 9 10 11 */ - "ip", "sp", "lr", "pc", /* 12 13 14 15 */ - "f0", "f1", "f2", "f3", /* 16 17 18 19 */ - "f4", "f5", "f6", "f7", /* 20 21 22 23 */ - "fps","ps" } /* 24 25 */; - -/* These names are the ones which gcc emits, and - I find them less confusing. Toggle between them - using the `othernames' command. */ -static char *additional_register_names[] = -{ "r0", "r1", "r2", "r3", /* 0 1 2 3 */ - "r4", "r5", "r6", "r7", /* 4 5 6 7 */ - "r8", "r9", "sl", "fp", /* 8 9 10 11 */ - "ip", "sp", "lr", "pc", /* 12 13 14 15 */ - "f0", "f1", "f2", "f3", /* 16 17 18 19 */ - "f4", "f5", "f6", "f7", /* 20 21 22 23 */ - "fps","ps" } /* 24 25 */; - -char **arm_register_names = original_register_names; - - static void arm_othernames () { - static int toggle; - arm_register_names = (toggle - ? additional_register_names - : original_register_names); - toggle = !toggle; + + if (arm_register_names == APCS_register_names) { + arm_register_names = additional_register_names; + arm_toggle_regnames (); + } else { + arm_register_names = APCS_register_names; + arm_toggle_regnames (); + } + } /* FIXME: Fill in with the 'right thing', see asm @@ -1616,8 +1621,15 @@ arm_skip_stub (pc) void _initialize_arm_tdep () { + int regname_is_APCS = (arm_register_names == APCS_register_names); + tm_print_insn = gdb_print_insn_arm; + + /* Sync the opcode insn printer with our register viewer: */ + if (arm_toggle_regnames () != regname_is_APCS) + arm_toggle_regnames (); + add_com ("othernames", class_obscure, arm_othernames, "Switch to the other set of register names."); diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index 8312031369..f9265e4471 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -1901,7 +1901,6 @@ agent_command (exp, from_tty) struct cleanup *old_chain = 0; struct expression *expr; struct agent_expr *agent; - struct agent_reqs reqs; struct frame_info *fi = get_current_frame (); /* need current scope */ /* We don't deal with overlay debugging at the moment. We need to @@ -1919,7 +1918,9 @@ agent_command (exp, from_tty) agent = gen_trace_for_expr (fi->pc, expr); make_cleanup ((make_cleanup_func) free_agent_expr, agent); ax_print (gdb_stdout, agent); - ax_reqs (agent, &reqs); + + /* It would be nice to call ax_reqs here to gather some general info + about the expression, and then print out the result. */ do_cleanups (old_chain); dont_repeat (); diff --git a/gdb/config/convex/Convex.notes b/gdb/config/convex/Convex.notes index 28d336bfed..828778cc89 100644 --- a/gdb/config/convex/Convex.notes +++ b/gdb/config/convex/Convex.notes @@ -1,163 +1,164 @@ +@c OBSOLETE +@c OBSOLETE @node Convex,,, Top +@c OBSOLETE @appendix Convex-specific info +@c OBSOLETE @cindex Convex notes +@c OBSOLETE +@c OBSOLETE Scalar registers are 64 bits long, which is a pain since +@c OBSOLETE left half of an S register frequently contains noise. +@c OBSOLETE Therefore there are two ways to obtain the value of an S register. +@c OBSOLETE +@c OBSOLETE @table @kbd +@c OBSOLETE @item $s0 +@c OBSOLETE returns the low half of the register as an int +@c OBSOLETE +@c OBSOLETE @item $S0 +@c OBSOLETE returns the whole register as a long long +@c OBSOLETE @end table +@c OBSOLETE +@c OBSOLETE You can print the value in floating point by using @samp{p/f $s0} or @samp{p/f $S0} +@c OBSOLETE to print a single or double precision value. +@c OBSOLETE +@c OBSOLETE @cindex vector registers +@c OBSOLETE Vector registers are handled similarly, with @samp{$V0} denoting the whole +@c OBSOLETE 64-bit register and @kbd{$v0} denoting the 32-bit low half; @samp{p/f $v0} +@c OBSOLETE or @samp{p/f $V0} can be used to examine the register in floating point. +@c OBSOLETE The length of the vector registers is taken from @samp{$vl}. +@c OBSOLETE +@c OBSOLETE Individual elements of a vector register are denoted in the obvious way; +@c OBSOLETE @samp{print $v3[9]} prints the tenth element of register @kbd{v3}, and +@c OBSOLETE @samp{set $v3[9] = 1234} alters it. +@c OBSOLETE +@c OBSOLETE @kbd{$vl} and @kbd{$vs} are int, and @kbd{$vm} is an int vector. +@c OBSOLETE Elements of @kbd{$vm} can't be assigned to. +@c OBSOLETE +@c OBSOLETE @cindex communication registers +@c OBSOLETE @kindex info comm-registers +@c OBSOLETE Communication registers have names @kbd{$C0 .. $C63}, with @kbd{$c0 .. $c63} +@c OBSOLETE denoting the low-order halves. @samp{info comm-registers} will print them +@c OBSOLETE all out, and tell which are locked. (A communication register is +@c OBSOLETE locked when a value is sent to it, and unlocked when the value is +@c OBSOLETE received.) Communication registers are, of course, global to all +@c OBSOLETE threads, so it does not matter what the currently selected thread is. +@c OBSOLETE @samp{info comm-reg @var{name}} prints just that one communication +@c OBSOLETE register; @samp{name} may also be a communication register number +@c OBSOLETE @samp{nn} or @samp{0xnn}. +@c OBSOLETE @samp{info comm-reg @var{address}} prints the contents of the resource +@c OBSOLETE structure at that address. +@c OBSOLETE +@c OBSOLETE @kindex info psw +@c OBSOLETE The command @samp{info psw} prints the processor status word @kbd{$ps} +@c OBSOLETE bit by bit. +@c OBSOLETE +@c OBSOLETE @kindex set base +@c OBSOLETE GDB normally prints all integers in base 10, but the leading +@c OBSOLETE @kbd{0x80000000} of pointers is intolerable in decimal, so the default +@c OBSOLETE output radix has been changed to try to print addresses appropriately. +@c OBSOLETE The @samp{set base} command can be used to change this. +@c OBSOLETE +@c OBSOLETE @table @code +@c OBSOLETE @item set base 10 +@c OBSOLETE Integer values always print in decimal. +@c OBSOLETE +@c OBSOLETE @item set base 16 +@c OBSOLETE Integer values always print in hex. +@c OBSOLETE +@c OBSOLETE @item set base +@c OBSOLETE Go back to the initial state, which prints integer values in hex if they +@c OBSOLETE look like pointers (specifically, if they start with 0x8 or 0xf in the +@c OBSOLETE stack), otherwise in decimal. +@c OBSOLETE @end table +@c OBSOLETE +@c OBSOLETE @kindex set pipeline +@c OBSOLETE When an exception such as a bus error or overflow happens, usually the PC +@c OBSOLETE is several instructions ahead by the time the exception is detected. +@c OBSOLETE The @samp{set pipe} command will disable this. +@c OBSOLETE +@c OBSOLETE @table @code +@c OBSOLETE @item set pipeline off +@c OBSOLETE Forces serial execution of instructions; no vector chaining and no +@c OBSOLETE scalar instruction overlap. With this, exceptions are detected with +@c OBSOLETE the PC pointing to the instruction after the one in error. +@c OBSOLETE +@c OBSOLETE @item set pipeline on +@c OBSOLETE Returns to normal, fast, execution. This is the default. +@c OBSOLETE @end table +@c OBSOLETE +@c OBSOLETE @cindex parallel +@c OBSOLETE In a parallel program, multiple threads may be executing, each +@c OBSOLETE with its own registers, stack, and local memory. When one of them +@c OBSOLETE hits a breakpoint, that thread is selected. Other threads do +@c OBSOLETE not run while the thread is in the breakpoint. +@c OBSOLETE +@c OBSOLETE @kindex 1cont +@c OBSOLETE The selected thread can be single-stepped, given signals, and so +@c OBSOLETE on. Any other threads remain stopped. When a @samp{cont} command is given, +@c OBSOLETE all threads are resumed. To resume just the selected thread, use +@c OBSOLETE the command @samp{1cont}. +@c OBSOLETE +@c OBSOLETE @kindex thread +@c OBSOLETE The @samp{thread} command will show the active threads and the +@c OBSOLETE instruction they are about to execute. The selected thread is marked +@c OBSOLETE with an asterisk. The command @samp{thread @var{n}} will select thread @var{n}, +@c OBSOLETE shifting the debugger's attention to it for single-stepping, +@c OBSOLETE registers, local memory, and so on. +@c OBSOLETE +@c OBSOLETE @kindex info threads +@c OBSOLETE The @samp{info threads} command will show what threads, if any, have +@c OBSOLETE invisibly hit breakpoints or signals and are waiting to be noticed. +@c OBSOLETE +@c OBSOLETE @kindex set parallel +@c OBSOLETE The @samp{set parallel} command controls how many threads can be active. +@c OBSOLETE +@c OBSOLETE @table @code +@c OBSOLETE @item set parallel off +@c OBSOLETE One thread. Requests by the program that other threads join in +@c OBSOLETE (spawn and pfork instructions) do not cause other threads to start up. +@c OBSOLETE This does the same thing as the @samp{limit concurrency 1} command. +@c OBSOLETE +@c OBSOLETE @item set parallel fixed +@c OBSOLETE All CPUs are assigned to your program whenever it runs. When it +@c OBSOLETE executes a pfork or spawn instruction, it begins parallel execution +@c OBSOLETE immediately. This does the same thing as the @samp{mpa -f} command. +@c OBSOLETE +@c OBSOLETE @item set parallel on +@c OBSOLETE One or more threads. Spawn and pfork cause CPUs to join in when and if +@c OBSOLETE they are free. This is the default. It is very good for system +@c OBSOLETE throughput, but not very good for finding bugs in parallel code. If you +@c OBSOLETE suspect a bug in parallel code, you probably want @samp{set parallel fixed.} +@c OBSOLETE @end table +@c OBSOLETE +@c OBSOLETE @subsection Limitations +@c OBSOLETE +@c OBSOLETE WARNING: Convex GDB evaluates expressions in long long, because S +@c OBSOLETE registers are 64 bits long. However, GDB expression semantics are not +@c OBSOLETE exactly C semantics. This is a bug, strictly speaking, but it's not one I +@c OBSOLETE know how to fix. If @samp{x} is a program variable of type int, then it +@c OBSOLETE is also type int to GDB, but @samp{x + 1} is long long, as is @samp{x + y} +@c OBSOLETE or any other expression requiring computation. So is the expression +@c OBSOLETE @samp{1}, or any other constant. You only really have to watch out for +@c OBSOLETE calls. The innocuous expression @samp{list_node (0x80001234)} has an +@c OBSOLETE argument of type long long. You must explicitly cast it to int. +@c OBSOLETE +@c OBSOLETE It is not possible to continue after an uncaught fatal signal by using +@c OBSOLETE @samp{signal 0}, @samp{return}, @samp{jump}, or anything else. The difficulty is with +@c OBSOLETE Unix, not GDB. +@c OBSOLETE +@c OBSOLETE I have made no big effort to make such things as single-stepping a +@c OBSOLETE @kbd{join} instruction do something reasonable. If the program seems to +@c OBSOLETE hang when doing this, type @kbd{ctrl-c} and @samp{cont}, or use +@c OBSOLETE @samp{thread} to shift to a live thread. Single-stepping a @kbd{spawn} +@c OBSOLETE instruction apparently causes new threads to be born with their T bit set; +@c OBSOLETE this is not handled gracefully. When a thread has hit a breakpoint, other +@c OBSOLETE threads may have invisibly hit the breakpoint in the background; if you +@c OBSOLETE clear the breakpoint gdb will be surprised when threads seem to continue +@c OBSOLETE to stop at it. All of these situations produce spurious signal 5 traps; +@c OBSOLETE if this happens, just type @samp{cont}. If it becomes a nuisance, use +@c OBSOLETE @samp{handle 5 nostop}. (It will ask if you are sure. You are.) +@c OBSOLETE +@c OBSOLETE There is no way in GDB to store a float in a register, as with +@c OBSOLETE @kbd{set $s0 = 3.1416}. The identifier @kbd{$s0} denotes an integer, +@c OBSOLETE and like any C expression which assigns to an integer variable, the +@c OBSOLETE right-hand side is casted to type int. If you should need to do +@c OBSOLETE something like this, you can assign the value to @kbd{@{float@} ($sp-4)} +@c OBSOLETE and then do @kbd{set $s0 = $sp[-4]}. Same deal with @kbd{set $v0[69] = 6.9}. -@node Convex,,, Top -@appendix Convex-specific info -@cindex Convex notes - -Scalar registers are 64 bits long, which is a pain since -left half of an S register frequently contains noise. -Therefore there are two ways to obtain the value of an S register. - -@table @kbd -@item $s0 -returns the low half of the register as an int - -@item $S0 -returns the whole register as a long long -@end table - -You can print the value in floating point by using @samp{p/f $s0} or @samp{p/f $S0} -to print a single or double precision value. - -@cindex vector registers -Vector registers are handled similarly, with @samp{$V0} denoting the whole -64-bit register and @kbd{$v0} denoting the 32-bit low half; @samp{p/f $v0} -or @samp{p/f $V0} can be used to examine the register in floating point. -The length of the vector registers is taken from @samp{$vl}. - -Individual elements of a vector register are denoted in the obvious way; -@samp{print $v3[9]} prints the tenth element of register @kbd{v3}, and -@samp{set $v3[9] = 1234} alters it. - -@kbd{$vl} and @kbd{$vs} are int, and @kbd{$vm} is an int vector. -Elements of @kbd{$vm} can't be assigned to. - -@cindex communication registers -@kindex info comm-registers -Communication registers have names @kbd{$C0 .. $C63}, with @kbd{$c0 .. $c63} -denoting the low-order halves. @samp{info comm-registers} will print them -all out, and tell which are locked. (A communication register is -locked when a value is sent to it, and unlocked when the value is -received.) Communication registers are, of course, global to all -threads, so it does not matter what the currently selected thread is. -@samp{info comm-reg @var{name}} prints just that one communication -register; @samp{name} may also be a communication register number -@samp{nn} or @samp{0xnn}. -@samp{info comm-reg @var{address}} prints the contents of the resource -structure at that address. - -@kindex info psw -The command @samp{info psw} prints the processor status word @kbd{$ps} -bit by bit. - -@kindex set base -GDB normally prints all integers in base 10, but the leading -@kbd{0x80000000} of pointers is intolerable in decimal, so the default -output radix has been changed to try to print addresses appropriately. -The @samp{set base} command can be used to change this. - -@table @code -@item set base 10 -Integer values always print in decimal. - -@item set base 16 -Integer values always print in hex. - -@item set base -Go back to the initial state, which prints integer values in hex if they -look like pointers (specifically, if they start with 0x8 or 0xf in the -stack), otherwise in decimal. -@end table - -@kindex set pipeline -When an exception such as a bus error or overflow happens, usually the PC -is several instructions ahead by the time the exception is detected. -The @samp{set pipe} command will disable this. - -@table @code -@item set pipeline off -Forces serial execution of instructions; no vector chaining and no -scalar instruction overlap. With this, exceptions are detected with -the PC pointing to the instruction after the one in error. - -@item set pipeline on -Returns to normal, fast, execution. This is the default. -@end table - -@cindex parallel -In a parallel program, multiple threads may be executing, each -with its own registers, stack, and local memory. When one of them -hits a breakpoint, that thread is selected. Other threads do -not run while the thread is in the breakpoint. - -@kindex 1cont -The selected thread can be single-stepped, given signals, and so -on. Any other threads remain stopped. When a @samp{cont} command is given, -all threads are resumed. To resume just the selected thread, use -the command @samp{1cont}. - -@kindex thread -The @samp{thread} command will show the active threads and the -instruction they are about to execute. The selected thread is marked -with an asterisk. The command @samp{thread @var{n}} will select thread @var{n}, -shifting the debugger's attention to it for single-stepping, -registers, local memory, and so on. - -@kindex info threads -The @samp{info threads} command will show what threads, if any, have -invisibly hit breakpoints or signals and are waiting to be noticed. - -@kindex set parallel -The @samp{set parallel} command controls how many threads can be active. - -@table @code -@item set parallel off -One thread. Requests by the program that other threads join in -(spawn and pfork instructions) do not cause other threads to start up. -This does the same thing as the @samp{limit concurrency 1} command. - -@item set parallel fixed -All CPUs are assigned to your program whenever it runs. When it -executes a pfork or spawn instruction, it begins parallel execution -immediately. This does the same thing as the @samp{mpa -f} command. - -@item set parallel on -One or more threads. Spawn and pfork cause CPUs to join in when and if -they are free. This is the default. It is very good for system -throughput, but not very good for finding bugs in parallel code. If you -suspect a bug in parallel code, you probably want @samp{set parallel fixed.} -@end table - -@subsection Limitations - -WARNING: Convex GDB evaluates expressions in long long, because S -registers are 64 bits long. However, GDB expression semantics are not -exactly C semantics. This is a bug, strictly speaking, but it's not one I -know how to fix. If @samp{x} is a program variable of type int, then it -is also type int to GDB, but @samp{x + 1} is long long, as is @samp{x + y} -or any other expression requiring computation. So is the expression -@samp{1}, or any other constant. You only really have to watch out for -calls. The innocuous expression @samp{list_node (0x80001234)} has an -argument of type long long. You must explicitly cast it to int. - -It is not possible to continue after an uncaught fatal signal by using -@samp{signal 0}, @samp{return}, @samp{jump}, or anything else. The difficulty is with -Unix, not GDB. - -I have made no big effort to make such things as single-stepping a -@kbd{join} instruction do something reasonable. If the program seems to -hang when doing this, type @kbd{ctrl-c} and @samp{cont}, or use -@samp{thread} to shift to a live thread. Single-stepping a @kbd{spawn} -instruction apparently causes new threads to be born with their T bit set; -this is not handled gracefully. When a thread has hit a breakpoint, other -threads may have invisibly hit the breakpoint in the background; if you -clear the breakpoint gdb will be surprised when threads seem to continue -to stop at it. All of these situations produce spurious signal 5 traps; -if this happens, just type @samp{cont}. If it becomes a nuisance, use -@samp{handle 5 nostop}. (It will ask if you are sure. You are.) - -There is no way in GDB to store a float in a register, as with -@kbd{set $s0 = 3.1416}. The identifier @kbd{$s0} denotes an integer, -and like any C expression which assigns to an integer variable, the -right-hand side is casted to type int. If you should need to do -something like this, you can assign the value to @kbd{@{float@} ($sp-4)} -and then do @kbd{set $s0 = $sp[-4]}. Same deal with @kbd{set $v0[69] = 6.9}. diff --git a/gdb/config/convex/convex.mh b/gdb/config/convex/convex.mh index 35a121fdcf..5ec3bfec56 100644 --- a/gdb/config/convex/convex.mh +++ b/gdb/config/convex/convex.mh @@ -1,3 +1,3 @@ -# Host: Convex Unix (4bsd) -XDEPFILES= convex-xdep.o -XM_FILE= xm-convex.h +# OBSOLETE # Host: Convex Unix (4bsd) +# OBSOLETE XDEPFILES= convex-xdep.o +# OBSOLETE XM_FILE= xm-convex.h diff --git a/gdb/config/convex/convex.mt b/gdb/config/convex/convex.mt index eefbeb3ee4..425b171a15 100644 --- a/gdb/config/convex/convex.mt +++ b/gdb/config/convex/convex.mt @@ -1,3 +1,3 @@ -# Target: Convex Unix (4bsd) -TDEPFILES= convex-tdep.o -TM_FILE= tm-convex.h +# OBSOLETE # Target: Convex Unix (4bsd) +# OBSOLETE TDEPFILES= convex-tdep.o +# OBSOLETE TM_FILE= tm-convex.h diff --git a/gdb/config/convex/tm-convex.h b/gdb/config/convex/tm-convex.h index 212f39da29..953f767c04 100644 --- a/gdb/config/convex/tm-convex.h +++ b/gdb/config/convex/tm-convex.h @@ -1,486 +1,486 @@ -/* Definitions to make GDB run on Convex Unix (4bsd) - Copyright 1989, 1991, 1993 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define TARGET_BYTE_ORDER BIG_ENDIAN - -/* There is come problem with the debugging symbols generated by the - compiler such that the debugging symbol for the first line of a - function overlap with the function prologue. */ -#define PROLOGUE_FIRSTLINE_OVERLAP - -/* When convex pcc says CHAR or SHORT, it provides the correct address. */ - -#define BELIEVE_PCC_PROMOTION 1 - -/* Symbol types to ignore. */ -/* 0xc4 is N_MONPT. Use the numeric value for the benefit of people - with (rather) old OS's. */ -#define IGNORE_SYMBOL(TYPE) \ - (((TYPE) & ~N_EXT) == N_TBSS \ - || ((TYPE) & ~N_EXT) == N_TDATA \ - || ((TYPE) & ~N_EXT) == 0xc4) - -/* Offset from address of function to start of its code. - Zero on most machines. */ - -#define FUNCTION_START_OFFSET 0 - -/* Advance PC across any function entry prologue instructions - to reach some "real" code. - Convex prolog is: - [sub.w #-,sp] in one of 3 possible sizes - [mov psw,- fc/vc main program prolog - and #-,- (skip it because the "mov psw" saves the - mov -,psw] T bit, so continue gets a surprise trap) - [and #-,sp] fc/vc O2 main program prolog - [ld.- -(ap),-] pcc/gcc register arg loads -*/ - -extern CORE_ADDR convex_skip_prologue PARAMS ((CORE_ADDR pc)); -#define SKIP_PROLOGUE(pc) (convex_skip_prologue (pc)) - -/* Immediately after a function call, return the saved pc. - (ignore frame and return *$sp so we can handle both calls and callq) */ - -#define SAVED_PC_AFTER_CALL(frame) \ - read_memory_integer (read_register (SP_REGNUM), 4) - -/* Address of end of stack space. - This is ((USRSTACK + 0xfff) & -0x1000)) from but - that expression depends on the kernel version; instead, fetch a - page-zero pointer and get it from that. This will be invalid if - they ever change the way bkpt signals are delivered. */ - -#define STACK_END_ADDR (0xfffff000 & *(unsigned *) 0x80000050) - -/* User-mode traps push an extended rtn block, - then fault with one of the following PCs */ - -#define is_trace_pc(pc) ((unsigned) ((pc) - (*(int *) 0x80000040)) <= 4) -#define is_arith_pc(pc) ((unsigned) ((pc) - (*(int *) 0x80000044)) <= 4) -#define is_break_pc(pc) ((unsigned) ((pc) - (*(int *) 0x80000050)) <= 4) - -/* We need to manipulate trap bits in the psw */ - -#define PSW_TRAP_FLAGS 0x69670000 -#define PSW_T_BIT 0x08000000 -#define PSW_S_BIT 0x01000000 - -/* Stack grows downward. */ - -#define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) - -/* Sequence of bytes for breakpoint instruction. (bkpt) */ - -#define BREAKPOINT {0x7d,0x50} - -/* Amount PC must be decremented by after a breakpoint. - This is often the number of bytes in BREAKPOINT but not always. - (The break PC needs to be decremented by 2, but we do it when the - break frame is recognized and popped. That way gdb can tell breaks - from trace traps with certainty.) */ - -#define DECR_PC_AFTER_BREAK 0 - -/* Say how long (ordinary) registers are. This is a piece of bogosity - used in push_word and a few other places; REGISTER_RAW_SIZE is the - real way to know how big a register is. */ - -#define REGISTER_SIZE 8 - -/* Number of machine registers */ - -#define NUM_REGS 26 - -/* Initializer for an array of names of registers. - There should be NUM_REGS strings in this initializer. */ - -#define REGISTER_NAMES {"pc","psw","fp","ap","a5","a4","a3","a2","a1","sp",\ - "s7","s6","s5","s4","s3","s2","s1","s0",\ - "S7","S6","S5","S4","S3","S2","S1","S0"} - -/* Register numbers of various important registers. - Note that some of these values are "real" register numbers, - and correspond to the general registers of the machine, - and some are "phony" register numbers which are too large - to be actual register numbers as far as the user is concerned - but do serve to get the desired values when passed to read_register. */ - -#define S0_REGNUM 25 /* the real S regs */ -#define S7_REGNUM 18 -#define s0_REGNUM 17 /* low-order halves of S regs */ -#define s7_REGNUM 10 -#define SP_REGNUM 9 /* A regs */ -#define A1_REGNUM 8 -#define A5_REGNUM 4 -#define AP_REGNUM 3 -#define FP_REGNUM 2 /* Contains address of executing stack frame */ -#define PS_REGNUM 1 /* Contains processor status */ -#define PC_REGNUM 0 /* Contains program counter */ - -/* convert dbx stab register number (from `r' declaration) to a gdb REGNUM */ - -#define STAB_REG_TO_REGNUM(value) \ - ((value) < 8 ? S0_REGNUM - (value) : SP_REGNUM - ((value) - 8)) - -/* Vector register numbers, not handled as ordinary regs. - They are treated as convenience variables whose values are read - from the inferior when needed. */ - -#define V0_REGNUM 0 -#define V7_REGNUM 7 -#define VM_REGNUM 8 -#define VS_REGNUM 9 -#define VL_REGNUM 10 - -/* Total amount of space needed to store our copies of the machine's - register state, the array `registers'. */ -#define REGISTER_BYTES (4*10 + 8*8) - -/* Index within `registers' of the first byte of the space for - register N. - NB: must match structure of struct syscall_context for correct operation */ - -#define REGISTER_BYTE(N) ((N) < s7_REGNUM ? 4*(N) : \ - (N) < S7_REGNUM ? 44 + 8 * ((N)-s7_REGNUM) : \ - 40 + 8 * ((N)-S7_REGNUM)) - -/* Number of bytes of storage in the actual machine representation - for register N. */ - -#define REGISTER_RAW_SIZE(N) ((N) < S7_REGNUM ? 4 : 8) - -/* Number of bytes of storage in the program's representation - for register N. */ - -#define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N) - -/* Largest value REGISTER_RAW_SIZE can have. */ - -#define MAX_REGISTER_RAW_SIZE 8 - -/* Largest value REGISTER_VIRTUAL_SIZE can have. */ - -#define MAX_REGISTER_VIRTUAL_SIZE 8 - -/* Return the GDB type object for the "standard" data type - of data in register N. */ - -#define REGISTER_VIRTUAL_TYPE(N) \ - ((N) < S7_REGNUM ? builtin_type_int : builtin_type_long_long) - -/* Store the address of the place in which to copy the structure the - subroutine will return. This is called from call_function. */ - -#define STORE_STRUCT_RETURN(ADDR, SP) \ - { write_register (A1_REGNUM, (ADDR)); } - -/* Extract from an array REGBUF containing the (raw) register state - a function return value of type TYPE, and copy that, in virtual format, - into VALBUF. */ - -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ - memcpy (VALBUF, &((char *) REGBUF) [REGISTER_BYTE (S0_REGNUM) + \ - 8 - TYPE_LENGTH (TYPE)],\ - TYPE_LENGTH (TYPE)) - -/* Write into appropriate registers a function return value - of type TYPE, given in virtual format. */ - -#define STORE_RETURN_VALUE(TYPE,VALBUF) \ - write_register_bytes (REGISTER_BYTE (S0_REGNUM), VALBUF, 8) - -/* Extract from an array 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). */ - -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ - (*(int *) & ((char *) REGBUF) [REGISTER_BYTE (s0_REGNUM)]) - -/* Define trapped internal variable hooks to read and write - vector and communication registers. */ - -#define IS_TRAPPED_INTERNALVAR is_trapped_internalvar -#define VALUE_OF_TRAPPED_INTERNALVAR value_of_trapped_internalvar -#define SET_TRAPPED_INTERNALVAR set_trapped_internalvar - -extern struct value *value_of_trapped_internalvar (); - -/* Hooks to read data from soff exec and core files, - and to describe the files. */ - -#define FILES_INFO_HOOK print_maps - -/* Hook to call to print a typeless integer value, normally printed in decimal. - For convex, use hex instead if the number looks like an address. */ - -#define PRINT_TYPELESS_INTEGER decout - -/* For the native compiler, variables for a particular lexical context - are listed after the beginning LBRAC instead of before in the - executables list of symbols. Using "gcc_compiled." to distinguish - between GCC and native compiler doesn't work on Convex because the - linker sorts the symbols to put "gcc_compiled." in the wrong place. - desc is nonzero for native, zero for gcc. */ -#define VARIABLES_INSIDE_BLOCK(desc, gcc_p) (desc != 0) - -/* Pcc occaisionally puts an SO where there should be an SOL. */ -#define PCC_SOL_BROKEN - -/* Describe the pointer in each stack frame to the previous stack frame - (its caller). */ - -/* FRAME_CHAIN takes a frame_info with a frame's nominal address in fi->frame, - and produces the frame's chain-pointer. */ - -/* (caller fp is saved at 8(fp)) */ - -#define FRAME_CHAIN(fi) (read_memory_integer ((fi)->frame + 8, 4)) - -/* Define other aspects of the stack frame. */ - -/* We need the boundaries of the text in the exec file, as a kludge, - for FRAMELESS_FUNCTION_INVOCATION and CALL_DUMMY_LOCATION. */ - -#define NEED_TEXT_START_END 1 - -/* An expression that tells us whether the function invocation represented - by FI does not have a frame on the stack associated with it. - On convex, check at the return address for `callq' -- if so, frameless, - otherwise, not. */ - -extern int convex_frameless_function_invocation PARAMS ((struct frame_info *fi)); -#define FRAMELESS_FUNCTION_INVOCATION(FI) (convex_frameless_function_invocatio (FI)) - -#define FRAME_SAVED_PC(fi) (read_memory_integer ((fi)->frame, 4)) - -#define FRAME_ARGS_ADDRESS(fi) (read_memory_integer ((fi)->frame + 12, 4)) - -#define FRAME_LOCALS_ADDRESS(fi) (fi)->frame - -/* Return number of args passed to a frame. - Can return -1, meaning no way to tell. */ - -extern int convex_frame_num_args PARAMS ((struct frame_info *fi)); -#define FRAME_NUM_ARGS(fi) (convex_frame_num_args ((fi))) - -/* Return number of bytes at start of arglist that are not really args. */ - -#define FRAME_ARGS_SKIP 0 - -/* Put here the code to store, into a struct frame_saved_regs, - the addresses of the saved registers of frame described by FRAME_INFO. - This includes special registers such as pc and fp saved in special - ways in the stack frame. sp is even more special: - the address we return for it IS the sp for the next frame. */ - -/* Normal (short) frames save only PC, FP, (callee's) AP. To reasonably - handle gcc and pcc register variables, scan the code following the - call for the instructions the compiler inserts to reload register - variables from stack slots and record the stack slots as the saved - locations of those registers. This will occasionally identify some - random load as a saved register; this is harmless. vc does not - declare its register allocation actions in the stabs. */ - -#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ -{ register int regnum; \ - register int frame_length = /* 3 short, 2 long, 1 extended, 0 context */\ - (read_memory_integer ((frame_info)->frame + 4, 4) >> 25) & 3; \ - register CORE_ADDR frame_fp = \ - read_memory_integer ((frame_info)->frame + 8, 4); \ - register CORE_ADDR next_addr; \ - memset (&frame_saved_regs, '\0', sizeof frame_saved_regs); \ - (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 0; \ - (frame_saved_regs).regs[PS_REGNUM] = (frame_info)->frame + 4; \ - (frame_saved_regs).regs[FP_REGNUM] = (frame_info)->frame + 8; \ - (frame_saved_regs).regs[AP_REGNUM] = frame_fp + 12; \ - next_addr = (frame_info)->frame + 12; \ - if (frame_length < 3) \ - for (regnum = A5_REGNUM; regnum < SP_REGNUM; ++regnum) \ - (frame_saved_regs).regs[regnum] = (next_addr += 4); \ - if (frame_length < 2) \ - (frame_saved_regs).regs[SP_REGNUM] = (next_addr += 4); \ - next_addr -= 4; \ - if (frame_length < 3) \ - for (regnum = S7_REGNUM; regnum < S0_REGNUM; ++regnum) \ - (frame_saved_regs).regs[regnum] = (next_addr += 8); \ - if (frame_length < 2) \ - (frame_saved_regs).regs[S0_REGNUM] = (next_addr += 8); \ - else \ - (frame_saved_regs).regs[SP_REGNUM] = next_addr + 8; \ - if (frame_length == 3) { \ - CORE_ADDR pc = read_memory_integer ((frame_info)->frame, 4); \ - int op, ix, disp; \ - op = read_memory_integer (pc, 2); \ - if ((op & 0xffc7) == 0x1480) pc += 4; /* add.w #-,sp */ \ - else if ((op & 0xffc7) == 0x58c0) pc += 2; /* add.w #-,sp */ \ - op = read_memory_integer (pc, 2); \ - if ((op & 0xffc7) == 0x2a06) pc += 4; /* ld.w -,ap */ \ - for (;;) { \ - op = read_memory_integer (pc, 2); \ - ix = (op >> 3) & 7; \ - if ((op & 0xfcc0) == 0x2800) { /* ld.- -,ak */ \ - regnum = SP_REGNUM - (op & 7); \ - disp = read_memory_integer (pc + 2, 2); \ - pc += 4;} \ - else if ((op & 0xfcc0) == 0x2840) { /* ld.- -,ak */ \ - regnum = SP_REGNUM - (op & 7); \ - disp = read_memory_integer (pc + 2, 4); \ - pc += 6;} \ - if ((op & 0xfcc0) == 0x3000) { /* ld.- -,sk */ \ - regnum = S0_REGNUM - (op & 7); \ - disp = read_memory_integer (pc + 2, 2); \ - pc += 4;} \ - else if ((op & 0xfcc0) == 0x3040) { /* ld.- -,sk */ \ - regnum = S0_REGNUM - (op & 7); \ - disp = read_memory_integer (pc + 2, 4); \ - pc += 6;} \ - else if ((op & 0xff00) == 0x7100) { /* br crossjump */ \ - pc += 2 * (char) op; \ - continue;} \ - else if (op == 0x0140) { /* jmp crossjump */ \ - pc = read_memory_integer (pc + 2, 4); \ - continue;} \ - else break; \ - if ((frame_saved_regs).regs[regnum]) \ - break; \ - if (ix == 7) disp += frame_fp; \ - else if (ix == 6) disp += read_memory_integer (frame_fp + 12, 4); \ - else if (ix != 0) break; \ - (frame_saved_regs).regs[regnum] = \ - disp - 8 + (1 << ((op >> 8) & 3)); \ - if (regnum >= S7_REGNUM) \ - (frame_saved_regs).regs[regnum - S0_REGNUM + s0_REGNUM] = \ - disp - 4 + (1 << ((op >> 8) & 3)); \ - } \ - } \ -} - -/* Things needed for making the inferior call functions. */ - -#define CALL_DUMMY_LOCATION BEFORE_TEXT_END - -/* Push an empty stack frame, to record the current PC, etc. */ - -#define PUSH_DUMMY_FRAME \ -{ register CORE_ADDR sp = read_register (SP_REGNUM); \ - register int regnum; \ - char buf[8]; \ - long word; \ - for (regnum = S0_REGNUM; regnum >= S7_REGNUM; --regnum) { \ - read_register_bytes (REGISTER_BYTE (regnum), buf, 8); \ - sp = push_bytes (sp, buf, 8);} \ - for (regnum = SP_REGNUM; regnum >= FP_REGNUM; --regnum) { \ - word = read_register (regnum); \ - sp = push_bytes (sp, &word, 4);} \ - word = (read_register (PS_REGNUM) &~ (3<<25)) | (1<<25); \ - sp = push_bytes (sp, &word, 4); \ - word = read_register (PC_REGNUM); \ - sp = push_bytes (sp, &word, 4); \ - write_register (SP_REGNUM, sp); \ - write_register (FP_REGNUM, sp); \ - write_register (AP_REGNUM, sp);} - -/* Discard from the stack the innermost frame, restoring all registers. */ - -#define POP_FRAME do {\ - register CORE_ADDR fp = read_register (FP_REGNUM); \ - register int regnum; \ - register int frame_length = /* 3 short, 2 long, 1 extended, 0 context */ \ - (read_memory_integer (fp + 4, 4) >> 25) & 3; \ - char buf[8]; \ - write_register (PC_REGNUM, read_memory_integer (fp, 4)); \ - write_register (PS_REGNUM, read_memory_integer (fp += 4, 4)); \ - write_register (FP_REGNUM, read_memory_integer (fp += 4, 4)); \ - write_register (AP_REGNUM, read_memory_integer (fp += 4, 4)); \ - if (frame_length < 3) \ - for (regnum = A5_REGNUM; regnum < SP_REGNUM; ++regnum) \ - write_register (regnum, read_memory_integer (fp += 4, 4)); \ - if (frame_length < 2) \ - write_register (SP_REGNUM, read_memory_integer (fp += 4, 4)); \ - fp -= 4; \ - if (frame_length < 3) \ - for (regnum = S7_REGNUM; regnum < S0_REGNUM; ++regnum) { \ - read_memory (fp += 8, buf, 8); \ - write_register_bytes (REGISTER_BYTE (regnum), buf, 8);} \ - if (frame_length < 2) { \ - read_memory (fp += 8, buf, 8); \ - write_register_bytes (REGISTER_BYTE (regnum), buf, 8);} \ - else write_register (SP_REGNUM, fp + 8); \ - flush_cached_frames (); \ -} while (0) - -/* This sequence of words is the instructions - mov sp,ap - pshea 69696969 - calls 32323232 - bkpt - Note this is 16 bytes. */ - -#define CALL_DUMMY {0x50860d4069696969LL,0x2140323232327d50LL} - -#define CALL_DUMMY_LENGTH 16 - -#define CALL_DUMMY_START_OFFSET 0 - -/* Insert the specified number of args and function address - into a call sequence of the above form stored at DUMMYNAME. */ - -#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ -{ *(int *)((char *) dummyname + 4) = nargs; \ - *(int *)((char *) dummyname + 10) = fun; } - -/* Defs to read soff symbol tables, see dbxread.c */ - -#define NUMBER_OF_SYMBOLS ((long) opthdr.o_nsyms) -#define STRING_TABLE_OFFSET ((long) filehdr.h_strptr) -#define SYMBOL_TABLE_OFFSET ((long) opthdr.o_symptr) -#define STRING_TABLE_SIZE ((long) filehdr.h_strsiz) -#define SIZE_OF_TEXT_SEGMENT ((long) txthdr.s_size) -#define ENTRY_POINT ((long) opthdr.o_entry) - -#define READ_STRING_TABLE_SIZE(BUFFER) \ - (BUFFER = STRING_TABLE_SIZE) - -#define DECLARE_FILE_HEADERS \ - FILEHDR filehdr; \ - OPTHDR opthdr; \ - SCNHDR txthdr - -#define READ_FILE_HEADERS(DESC,NAME) \ -{ \ - int n; \ - val = myread (DESC, &filehdr, sizeof filehdr); \ - if (val < 0) \ - perror_with_name (NAME); \ - if (! IS_SOFF_MAGIC (filehdr.h_magic)) \ - error ("%s: not an executable file.", NAME); \ - lseek (DESC, 0L, 0); \ - if (myread (DESC, &filehdr, sizeof filehdr) < 0) \ - perror_with_name (NAME); \ - if (myread (DESC, &opthdr, filehdr.h_opthdr) <= 0) \ - perror_with_name (NAME); \ - for (n = 0; n < filehdr.h_nscns; n++) \ - { \ - if (myread (DESC, &txthdr, sizeof txthdr) < 0) \ - perror_with_name (NAME); \ - if ((txthdr.s_flags & S_TYPMASK) == S_TEXT) \ - break; \ - } \ -} +/* OBSOLETE /* Definitions to make GDB run on Convex Unix (4bsd) */ +/* OBSOLETE Copyright 1989, 1991, 1993 Free Software Foundation, Inc. */ +/* OBSOLETE */ +/* OBSOLETE This file is part of GDB. */ +/* OBSOLETE */ +/* OBSOLETE This program is free software; you can redistribute it and/or modify */ +/* OBSOLETE it under the terms of the GNU General Public License as published by */ +/* OBSOLETE the Free Software Foundation; either version 2 of the License, or */ +/* OBSOLETE (at your option) any later version. */ +/* OBSOLETE */ +/* OBSOLETE This program is distributed in the hope that it will be useful, */ +/* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* OBSOLETE GNU General Public License for more details. */ +/* OBSOLETE */ +/* OBSOLETE You should have received a copy of the GNU General Public License */ +/* OBSOLETE along with this program; if not, write to the Free Software */ +/* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define TARGET_BYTE_ORDER BIG_ENDIAN */ +/* OBSOLETE */ +/* OBSOLETE /* There is come problem with the debugging symbols generated by the */ +/* OBSOLETE compiler such that the debugging symbol for the first line of a */ +/* OBSOLETE function overlap with the function prologue. *x/ */ +/* OBSOLETE #define PROLOGUE_FIRSTLINE_OVERLAP */ +/* OBSOLETE */ +/* OBSOLETE /* When convex pcc says CHAR or SHORT, it provides the correct address. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define BELIEVE_PCC_PROMOTION 1 */ +/* OBSOLETE */ +/* OBSOLETE /* Symbol types to ignore. *x/ */ +/* OBSOLETE /* 0xc4 is N_MONPT. Use the numeric value for the benefit of people */ +/* OBSOLETE with (rather) old OS's. *x/ */ +/* OBSOLETE #define IGNORE_SYMBOL(TYPE) \ */ +/* OBSOLETE (((TYPE) & ~N_EXT) == N_TBSS \ */ +/* OBSOLETE || ((TYPE) & ~N_EXT) == N_TDATA \ */ +/* OBSOLETE || ((TYPE) & ~N_EXT) == 0xc4) */ +/* OBSOLETE */ +/* OBSOLETE /* Offset from address of function to start of its code. */ +/* OBSOLETE Zero on most machines. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define FUNCTION_START_OFFSET 0 */ +/* OBSOLETE */ +/* OBSOLETE /* Advance PC across any function entry prologue instructions */ +/* OBSOLETE to reach some "real" code. */ +/* OBSOLETE Convex prolog is: */ +/* OBSOLETE [sub.w #-,sp] in one of 3 possible sizes */ +/* OBSOLETE [mov psw,- fc/vc main program prolog */ +/* OBSOLETE and #-,- (skip it because the "mov psw" saves the */ +/* OBSOLETE mov -,psw] T bit, so continue gets a surprise trap) */ +/* OBSOLETE [and #-,sp] fc/vc O2 main program prolog */ +/* OBSOLETE [ld.- -(ap),-] pcc/gcc register arg loads */ +/* OBSOLETE *x/ */ +/* OBSOLETE */ +/* OBSOLETE extern CORE_ADDR convex_skip_prologue PARAMS ((CORE_ADDR pc)); */ +/* OBSOLETE #define SKIP_PROLOGUE(pc) (convex_skip_prologue (pc)) */ +/* OBSOLETE */ +/* OBSOLETE /* Immediately after a function call, return the saved pc. */ +/* OBSOLETE (ignore frame and return *$sp so we can handle both calls and callq) *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define SAVED_PC_AFTER_CALL(frame) \ */ +/* OBSOLETE read_memory_integer (read_register (SP_REGNUM), 4) */ +/* OBSOLETE */ +/* OBSOLETE /* Address of end of stack space. */ +/* OBSOLETE This is ((USRSTACK + 0xfff) & -0x1000)) from but */ +/* OBSOLETE that expression depends on the kernel version; instead, fetch a */ +/* OBSOLETE page-zero pointer and get it from that. This will be invalid if */ +/* OBSOLETE they ever change the way bkpt signals are delivered. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define STACK_END_ADDR (0xfffff000 & *(unsigned *) 0x80000050) */ +/* OBSOLETE */ +/* OBSOLETE /* User-mode traps push an extended rtn block, */ +/* OBSOLETE then fault with one of the following PCs *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define is_trace_pc(pc) ((unsigned) ((pc) - (*(int *) 0x80000040)) <= 4) */ +/* OBSOLETE #define is_arith_pc(pc) ((unsigned) ((pc) - (*(int *) 0x80000044)) <= 4) */ +/* OBSOLETE #define is_break_pc(pc) ((unsigned) ((pc) - (*(int *) 0x80000050)) <= 4) */ +/* OBSOLETE */ +/* OBSOLETE /* We need to manipulate trap bits in the psw *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define PSW_TRAP_FLAGS 0x69670000 */ +/* OBSOLETE #define PSW_T_BIT 0x08000000 */ +/* OBSOLETE #define PSW_S_BIT 0x01000000 */ +/* OBSOLETE */ +/* OBSOLETE /* Stack grows downward. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) */ +/* OBSOLETE */ +/* OBSOLETE /* Sequence of bytes for breakpoint instruction. (bkpt) *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define BREAKPOINT {0x7d,0x50} */ +/* OBSOLETE */ +/* OBSOLETE /* Amount PC must be decremented by after a breakpoint. */ +/* OBSOLETE This is often the number of bytes in BREAKPOINT but not always. */ +/* OBSOLETE (The break PC needs to be decremented by 2, but we do it when the */ +/* OBSOLETE break frame is recognized and popped. That way gdb can tell breaks */ +/* OBSOLETE from trace traps with certainty.) *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define DECR_PC_AFTER_BREAK 0 */ +/* OBSOLETE */ +/* OBSOLETE /* Say how long (ordinary) registers are. This is a piece of bogosity */ +/* OBSOLETE used in push_word and a few other places; REGISTER_RAW_SIZE is the */ +/* OBSOLETE real way to know how big a register is. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define REGISTER_SIZE 8 */ +/* OBSOLETE */ +/* OBSOLETE /* Number of machine registers *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define NUM_REGS 26 */ +/* OBSOLETE */ +/* OBSOLETE /* Initializer for an array of names of registers. */ +/* OBSOLETE There should be NUM_REGS strings in this initializer. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define REGISTER_NAMES {"pc","psw","fp","ap","a5","a4","a3","a2","a1","sp",\ */ +/* OBSOLETE "s7","s6","s5","s4","s3","s2","s1","s0",\ */ +/* OBSOLETE "S7","S6","S5","S4","S3","S2","S1","S0"} */ +/* OBSOLETE */ +/* OBSOLETE /* Register numbers of various important registers. */ +/* OBSOLETE Note that some of these values are "real" register numbers, */ +/* OBSOLETE and correspond to the general registers of the machine, */ +/* OBSOLETE and some are "phony" register numbers which are too large */ +/* OBSOLETE to be actual register numbers as far as the user is concerned */ +/* OBSOLETE but do serve to get the desired values when passed to read_register. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define S0_REGNUM 25 /* the real S regs *x/ */ +/* OBSOLETE #define S7_REGNUM 18 */ +/* OBSOLETE #define s0_REGNUM 17 /* low-order halves of S regs *x/ */ +/* OBSOLETE #define s7_REGNUM 10 */ +/* OBSOLETE #define SP_REGNUM 9 /* A regs *x/ */ +/* OBSOLETE #define A1_REGNUM 8 */ +/* OBSOLETE #define A5_REGNUM 4 */ +/* OBSOLETE #define AP_REGNUM 3 */ +/* OBSOLETE #define FP_REGNUM 2 /* Contains address of executing stack frame *x/ */ +/* OBSOLETE #define PS_REGNUM 1 /* Contains processor status *x/ */ +/* OBSOLETE #define PC_REGNUM 0 /* Contains program counter *x/ */ +/* OBSOLETE */ +/* OBSOLETE /* convert dbx stab register number (from `r' declaration) to a gdb REGNUM *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define STAB_REG_TO_REGNUM(value) \ */ +/* OBSOLETE ((value) < 8 ? S0_REGNUM - (value) : SP_REGNUM - ((value) - 8)) */ +/* OBSOLETE */ +/* OBSOLETE /* Vector register numbers, not handled as ordinary regs. */ +/* OBSOLETE They are treated as convenience variables whose values are read */ +/* OBSOLETE from the inferior when needed. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define V0_REGNUM 0 */ +/* OBSOLETE #define V7_REGNUM 7 */ +/* OBSOLETE #define VM_REGNUM 8 */ +/* OBSOLETE #define VS_REGNUM 9 */ +/* OBSOLETE #define VL_REGNUM 10 */ +/* OBSOLETE */ +/* OBSOLETE /* Total amount of space needed to store our copies of the machine's */ +/* OBSOLETE register state, the array `registers'. *x/ */ +/* OBSOLETE #define REGISTER_BYTES (4*10 + 8*8) */ +/* OBSOLETE */ +/* OBSOLETE /* Index within `registers' of the first byte of the space for */ +/* OBSOLETE register N. */ +/* OBSOLETE NB: must match structure of struct syscall_context for correct operation *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define REGISTER_BYTE(N) ((N) < s7_REGNUM ? 4*(N) : \ */ +/* OBSOLETE (N) < S7_REGNUM ? 44 + 8 * ((N)-s7_REGNUM) : \ */ +/* OBSOLETE 40 + 8 * ((N)-S7_REGNUM)) */ +/* OBSOLETE */ +/* OBSOLETE /* Number of bytes of storage in the actual machine representation */ +/* OBSOLETE for register N. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define REGISTER_RAW_SIZE(N) ((N) < S7_REGNUM ? 4 : 8) */ +/* OBSOLETE */ +/* OBSOLETE /* Number of bytes of storage in the program's representation */ +/* OBSOLETE for register N. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N) */ +/* OBSOLETE */ +/* OBSOLETE /* Largest value REGISTER_RAW_SIZE can have. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define MAX_REGISTER_RAW_SIZE 8 */ +/* OBSOLETE */ +/* OBSOLETE /* Largest value REGISTER_VIRTUAL_SIZE can have. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define MAX_REGISTER_VIRTUAL_SIZE 8 */ +/* OBSOLETE */ +/* OBSOLETE /* Return the GDB type object for the "standard" data type */ +/* OBSOLETE of data in register N. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define REGISTER_VIRTUAL_TYPE(N) \ */ +/* OBSOLETE ((N) < S7_REGNUM ? builtin_type_int : builtin_type_long_long) */ +/* OBSOLETE */ +/* OBSOLETE /* Store the address of the place in which to copy the structure the */ +/* OBSOLETE subroutine will return. This is called from call_function. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define STORE_STRUCT_RETURN(ADDR, SP) \ */ +/* OBSOLETE { write_register (A1_REGNUM, (ADDR)); } */ +/* OBSOLETE */ +/* OBSOLETE /* Extract from an array REGBUF containing the (raw) register state */ +/* OBSOLETE a function return value of type TYPE, and copy that, in virtual format, */ +/* OBSOLETE into VALBUF. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ */ +/* OBSOLETE memcpy (VALBUF, &((char *) REGBUF) [REGISTER_BYTE (S0_REGNUM) + \ */ +/* OBSOLETE 8 - TYPE_LENGTH (TYPE)],\ */ +/* OBSOLETE TYPE_LENGTH (TYPE)) */ +/* OBSOLETE */ +/* OBSOLETE /* Write into appropriate registers a function return value */ +/* OBSOLETE of type TYPE, given in virtual format. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define STORE_RETURN_VALUE(TYPE,VALBUF) \ */ +/* OBSOLETE write_register_bytes (REGISTER_BYTE (S0_REGNUM), VALBUF, 8) */ +/* OBSOLETE */ +/* OBSOLETE /* Extract from an array REGBUF containing the (raw) register state */ +/* OBSOLETE the address in which a function should return its structure value, */ +/* OBSOLETE as a CORE_ADDR (or an expression that can be used as one). *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ */ +/* OBSOLETE (*(int *) & ((char *) REGBUF) [REGISTER_BYTE (s0_REGNUM)]) */ +/* OBSOLETE */ +/* OBSOLETE /* Define trapped internal variable hooks to read and write */ +/* OBSOLETE vector and communication registers. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define IS_TRAPPED_INTERNALVAR is_trapped_internalvar */ +/* OBSOLETE #define VALUE_OF_TRAPPED_INTERNALVAR value_of_trapped_internalvar */ +/* OBSOLETE #define SET_TRAPPED_INTERNALVAR set_trapped_internalvar */ +/* OBSOLETE */ +/* OBSOLETE extern struct value *value_of_trapped_internalvar (); */ +/* OBSOLETE */ +/* OBSOLETE /* Hooks to read data from soff exec and core files, */ +/* OBSOLETE and to describe the files. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define FILES_INFO_HOOK print_maps */ +/* OBSOLETE */ +/* OBSOLETE /* Hook to call to print a typeless integer value, normally printed in decimal. */ +/* OBSOLETE For convex, use hex instead if the number looks like an address. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define PRINT_TYPELESS_INTEGER decout */ +/* OBSOLETE */ +/* OBSOLETE /* For the native compiler, variables for a particular lexical context */ +/* OBSOLETE are listed after the beginning LBRAC instead of before in the */ +/* OBSOLETE executables list of symbols. Using "gcc_compiled." to distinguish */ +/* OBSOLETE between GCC and native compiler doesn't work on Convex because the */ +/* OBSOLETE linker sorts the symbols to put "gcc_compiled." in the wrong place. */ +/* OBSOLETE desc is nonzero for native, zero for gcc. *x/ */ +/* OBSOLETE #define VARIABLES_INSIDE_BLOCK(desc, gcc_p) (desc != 0) */ +/* OBSOLETE */ +/* OBSOLETE /* Pcc occaisionally puts an SO where there should be an SOL. *x/ */ +/* OBSOLETE #define PCC_SOL_BROKEN */ +/* OBSOLETE */ +/* OBSOLETE /* Describe the pointer in each stack frame to the previous stack frame */ +/* OBSOLETE (its caller). *x/ */ +/* OBSOLETE */ +/* OBSOLETE /* FRAME_CHAIN takes a frame_info with a frame's nominal address in fi->frame, */ +/* OBSOLETE and produces the frame's chain-pointer. *x/ */ +/* OBSOLETE */ +/* OBSOLETE /* (caller fp is saved at 8(fp)) *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define FRAME_CHAIN(fi) (read_memory_integer ((fi)->frame + 8, 4)) */ +/* OBSOLETE */ +/* OBSOLETE /* Define other aspects of the stack frame. *x/ */ +/* OBSOLETE */ +/* OBSOLETE /* We need the boundaries of the text in the exec file, as a kludge, */ +/* OBSOLETE for FRAMELESS_FUNCTION_INVOCATION and CALL_DUMMY_LOCATION. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define NEED_TEXT_START_END 1 */ +/* OBSOLETE */ +/* OBSOLETE /* An expression that tells us whether the function invocation represented */ +/* OBSOLETE by FI does not have a frame on the stack associated with it. */ +/* OBSOLETE On convex, check at the return address for `callq' -- if so, frameless, */ +/* OBSOLETE otherwise, not. *x/ */ +/* OBSOLETE */ +/* OBSOLETE extern int convex_frameless_function_invocation PARAMS ((struct frame_info *fi)); */ +/* OBSOLETE #define FRAMELESS_FUNCTION_INVOCATION(FI) (convex_frameless_function_invocatio (FI)) */ +/* OBSOLETE */ +/* OBSOLETE #define FRAME_SAVED_PC(fi) (read_memory_integer ((fi)->frame, 4)) */ +/* OBSOLETE */ +/* OBSOLETE #define FRAME_ARGS_ADDRESS(fi) (read_memory_integer ((fi)->frame + 12, 4)) */ +/* OBSOLETE */ +/* OBSOLETE #define FRAME_LOCALS_ADDRESS(fi) (fi)->frame */ +/* OBSOLETE */ +/* OBSOLETE /* Return number of args passed to a frame. */ +/* OBSOLETE Can return -1, meaning no way to tell. *x/ */ +/* OBSOLETE */ +/* OBSOLETE extern int convex_frame_num_args PARAMS ((struct frame_info *fi)); */ +/* OBSOLETE #define FRAME_NUM_ARGS(fi) (convex_frame_num_args ((fi))) */ +/* OBSOLETE */ +/* OBSOLETE /* Return number of bytes at start of arglist that are not really args. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define FRAME_ARGS_SKIP 0 */ +/* OBSOLETE */ +/* OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, */ +/* OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO. */ +/* OBSOLETE This includes special registers such as pc and fp saved in special */ +/* OBSOLETE ways in the stack frame. sp is even more special: */ +/* OBSOLETE the address we return for it IS the sp for the next frame. *x/ */ +/* OBSOLETE */ +/* OBSOLETE /* Normal (short) frames save only PC, FP, (callee's) AP. To reasonably */ +/* OBSOLETE handle gcc and pcc register variables, scan the code following the */ +/* OBSOLETE call for the instructions the compiler inserts to reload register */ +/* OBSOLETE variables from stack slots and record the stack slots as the saved */ +/* OBSOLETE locations of those registers. This will occasionally identify some */ +/* OBSOLETE random load as a saved register; this is harmless. vc does not */ +/* OBSOLETE declare its register allocation actions in the stabs. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ */ +/* OBSOLETE { register int regnum; \ */ +/* OBSOLETE register int frame_length = /* 3 short, 2 long, 1 extended, 0 context *x/\ */ +/* OBSOLETE (read_memory_integer ((frame_info)->frame + 4, 4) >> 25) & 3; \ */ +/* OBSOLETE register CORE_ADDR frame_fp = \ */ +/* OBSOLETE read_memory_integer ((frame_info)->frame + 8, 4); \ */ +/* OBSOLETE register CORE_ADDR next_addr; \ */ +/* OBSOLETE memset (&frame_saved_regs, '\0', sizeof frame_saved_regs); \ */ +/* OBSOLETE (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 0; \ */ +/* OBSOLETE (frame_saved_regs).regs[PS_REGNUM] = (frame_info)->frame + 4; \ */ +/* OBSOLETE (frame_saved_regs).regs[FP_REGNUM] = (frame_info)->frame + 8; \ */ +/* OBSOLETE (frame_saved_regs).regs[AP_REGNUM] = frame_fp + 12; \ */ +/* OBSOLETE next_addr = (frame_info)->frame + 12; \ */ +/* OBSOLETE if (frame_length < 3) \ */ +/* OBSOLETE for (regnum = A5_REGNUM; regnum < SP_REGNUM; ++regnum) \ */ +/* OBSOLETE (frame_saved_regs).regs[regnum] = (next_addr += 4); \ */ +/* OBSOLETE if (frame_length < 2) \ */ +/* OBSOLETE (frame_saved_regs).regs[SP_REGNUM] = (next_addr += 4); \ */ +/* OBSOLETE next_addr -= 4; \ */ +/* OBSOLETE if (frame_length < 3) \ */ +/* OBSOLETE for (regnum = S7_REGNUM; regnum < S0_REGNUM; ++regnum) \ */ +/* OBSOLETE (frame_saved_regs).regs[regnum] = (next_addr += 8); \ */ +/* OBSOLETE if (frame_length < 2) \ */ +/* OBSOLETE (frame_saved_regs).regs[S0_REGNUM] = (next_addr += 8); \ */ +/* OBSOLETE else \ */ +/* OBSOLETE (frame_saved_regs).regs[SP_REGNUM] = next_addr + 8; \ */ +/* OBSOLETE if (frame_length == 3) { \ */ +/* OBSOLETE CORE_ADDR pc = read_memory_integer ((frame_info)->frame, 4); \ */ +/* OBSOLETE int op, ix, disp; \ */ +/* OBSOLETE op = read_memory_integer (pc, 2); \ */ +/* OBSOLETE if ((op & 0xffc7) == 0x1480) pc += 4; /* add.w #-,sp *x/ \ */ +/* OBSOLETE else if ((op & 0xffc7) == 0x58c0) pc += 2; /* add.w #-,sp *x/ \ */ +/* OBSOLETE op = read_memory_integer (pc, 2); \ */ +/* OBSOLETE if ((op & 0xffc7) == 0x2a06) pc += 4; /* ld.w -,ap *x/ \ */ +/* OBSOLETE for (;;) { \ */ +/* OBSOLETE op = read_memory_integer (pc, 2); \ */ +/* OBSOLETE ix = (op >> 3) & 7; \ */ +/* OBSOLETE if ((op & 0xfcc0) == 0x2800) { /* ld.- -,ak *x/ \ */ +/* OBSOLETE regnum = SP_REGNUM - (op & 7); \ */ +/* OBSOLETE disp = read_memory_integer (pc + 2, 2); \ */ +/* OBSOLETE pc += 4;} \ */ +/* OBSOLETE else if ((op & 0xfcc0) == 0x2840) { /* ld.- -,ak *x/ \ */ +/* OBSOLETE regnum = SP_REGNUM - (op & 7); \ */ +/* OBSOLETE disp = read_memory_integer (pc + 2, 4); \ */ +/* OBSOLETE pc += 6;} \ */ +/* OBSOLETE if ((op & 0xfcc0) == 0x3000) { /* ld.- -,sk *x/ \ */ +/* OBSOLETE regnum = S0_REGNUM - (op & 7); \ */ +/* OBSOLETE disp = read_memory_integer (pc + 2, 2); \ */ +/* OBSOLETE pc += 4;} \ */ +/* OBSOLETE else if ((op & 0xfcc0) == 0x3040) { /* ld.- -,sk *x/ \ */ +/* OBSOLETE regnum = S0_REGNUM - (op & 7); \ */ +/* OBSOLETE disp = read_memory_integer (pc + 2, 4); \ */ +/* OBSOLETE pc += 6;} \ */ +/* OBSOLETE else if ((op & 0xff00) == 0x7100) { /* br crossjump *x/ \ */ +/* OBSOLETE pc += 2 * (char) op; \ */ +/* OBSOLETE continue;} \ */ +/* OBSOLETE else if (op == 0x0140) { /* jmp crossjump *x/ \ */ +/* OBSOLETE pc = read_memory_integer (pc + 2, 4); \ */ +/* OBSOLETE continue;} \ */ +/* OBSOLETE else break; \ */ +/* OBSOLETE if ((frame_saved_regs).regs[regnum]) \ */ +/* OBSOLETE break; \ */ +/* OBSOLETE if (ix == 7) disp += frame_fp; \ */ +/* OBSOLETE else if (ix == 6) disp += read_memory_integer (frame_fp + 12, 4); \ */ +/* OBSOLETE else if (ix != 0) break; \ */ +/* OBSOLETE (frame_saved_regs).regs[regnum] = \ */ +/* OBSOLETE disp - 8 + (1 << ((op >> 8) & 3)); \ */ +/* OBSOLETE if (regnum >= S7_REGNUM) \ */ +/* OBSOLETE (frame_saved_regs).regs[regnum - S0_REGNUM + s0_REGNUM] = \ */ +/* OBSOLETE disp - 4 + (1 << ((op >> 8) & 3)); \ */ +/* OBSOLETE } \ */ +/* OBSOLETE } \ */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Things needed for making the inferior call functions. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define CALL_DUMMY_LOCATION BEFORE_TEXT_END */ +/* OBSOLETE */ +/* OBSOLETE /* Push an empty stack frame, to record the current PC, etc. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define PUSH_DUMMY_FRAME \ */ +/* OBSOLETE { register CORE_ADDR sp = read_register (SP_REGNUM); \ */ +/* OBSOLETE register int regnum; \ */ +/* OBSOLETE char buf[8]; \ */ +/* OBSOLETE long word; \ */ +/* OBSOLETE for (regnum = S0_REGNUM; regnum >= S7_REGNUM; --regnum) { \ */ +/* OBSOLETE read_register_bytes (REGISTER_BYTE (regnum), buf, 8); \ */ +/* OBSOLETE sp = push_bytes (sp, buf, 8);} \ */ +/* OBSOLETE for (regnum = SP_REGNUM; regnum >= FP_REGNUM; --regnum) { \ */ +/* OBSOLETE word = read_register (regnum); \ */ +/* OBSOLETE sp = push_bytes (sp, &word, 4);} \ */ +/* OBSOLETE word = (read_register (PS_REGNUM) &~ (3<<25)) | (1<<25); \ */ +/* OBSOLETE sp = push_bytes (sp, &word, 4); \ */ +/* OBSOLETE word = read_register (PC_REGNUM); \ */ +/* OBSOLETE sp = push_bytes (sp, &word, 4); \ */ +/* OBSOLETE write_register (SP_REGNUM, sp); \ */ +/* OBSOLETE write_register (FP_REGNUM, sp); \ */ +/* OBSOLETE write_register (AP_REGNUM, sp);} */ +/* OBSOLETE */ +/* OBSOLETE /* Discard from the stack the innermost frame, restoring all registers. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define POP_FRAME do {\ */ +/* OBSOLETE register CORE_ADDR fp = read_register (FP_REGNUM); \ */ +/* OBSOLETE register int regnum; \ */ +/* OBSOLETE register int frame_length = /* 3 short, 2 long, 1 extended, 0 context *x/ \ */ +/* OBSOLETE (read_memory_integer (fp + 4, 4) >> 25) & 3; \ */ +/* OBSOLETE char buf[8]; \ */ +/* OBSOLETE write_register (PC_REGNUM, read_memory_integer (fp, 4)); \ */ +/* OBSOLETE write_register (PS_REGNUM, read_memory_integer (fp += 4, 4)); \ */ +/* OBSOLETE write_register (FP_REGNUM, read_memory_integer (fp += 4, 4)); \ */ +/* OBSOLETE write_register (AP_REGNUM, read_memory_integer (fp += 4, 4)); \ */ +/* OBSOLETE if (frame_length < 3) \ */ +/* OBSOLETE for (regnum = A5_REGNUM; regnum < SP_REGNUM; ++regnum) \ */ +/* OBSOLETE write_register (regnum, read_memory_integer (fp += 4, 4)); \ */ +/* OBSOLETE if (frame_length < 2) \ */ +/* OBSOLETE write_register (SP_REGNUM, read_memory_integer (fp += 4, 4)); \ */ +/* OBSOLETE fp -= 4; \ */ +/* OBSOLETE if (frame_length < 3) \ */ +/* OBSOLETE for (regnum = S7_REGNUM; regnum < S0_REGNUM; ++regnum) { \ */ +/* OBSOLETE read_memory (fp += 8, buf, 8); \ */ +/* OBSOLETE write_register_bytes (REGISTER_BYTE (regnum), buf, 8);} \ */ +/* OBSOLETE if (frame_length < 2) { \ */ +/* OBSOLETE read_memory (fp += 8, buf, 8); \ */ +/* OBSOLETE write_register_bytes (REGISTER_BYTE (regnum), buf, 8);} \ */ +/* OBSOLETE else write_register (SP_REGNUM, fp + 8); \ */ +/* OBSOLETE flush_cached_frames (); \ */ +/* OBSOLETE } while (0) */ +/* OBSOLETE */ +/* OBSOLETE /* This sequence of words is the instructions */ +/* OBSOLETE mov sp,ap */ +/* OBSOLETE pshea 69696969 */ +/* OBSOLETE calls 32323232 */ +/* OBSOLETE bkpt */ +/* OBSOLETE Note this is 16 bytes. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define CALL_DUMMY {0x50860d4069696969LL,0x2140323232327d50LL} */ +/* OBSOLETE */ +/* OBSOLETE #define CALL_DUMMY_LENGTH 16 */ +/* OBSOLETE */ +/* OBSOLETE #define CALL_DUMMY_START_OFFSET 0 */ +/* OBSOLETE */ +/* OBSOLETE /* Insert the specified number of args and function address */ +/* OBSOLETE into a call sequence of the above form stored at DUMMYNAME. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ */ +/* OBSOLETE { *(int *)((char *) dummyname + 4) = nargs; \ */ +/* OBSOLETE *(int *)((char *) dummyname + 10) = fun; } */ +/* OBSOLETE */ +/* OBSOLETE /* Defs to read soff symbol tables, see dbxread.c *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define NUMBER_OF_SYMBOLS ((long) opthdr.o_nsyms) */ +/* OBSOLETE #define STRING_TABLE_OFFSET ((long) filehdr.h_strptr) */ +/* OBSOLETE #define SYMBOL_TABLE_OFFSET ((long) opthdr.o_symptr) */ +/* OBSOLETE #define STRING_TABLE_SIZE ((long) filehdr.h_strsiz) */ +/* OBSOLETE #define SIZE_OF_TEXT_SEGMENT ((long) txthdr.s_size) */ +/* OBSOLETE #define ENTRY_POINT ((long) opthdr.o_entry) */ +/* OBSOLETE */ +/* OBSOLETE #define READ_STRING_TABLE_SIZE(BUFFER) \ */ +/* OBSOLETE (BUFFER = STRING_TABLE_SIZE) */ +/* OBSOLETE */ +/* OBSOLETE #define DECLARE_FILE_HEADERS \ */ +/* OBSOLETE FILEHDR filehdr; \ */ +/* OBSOLETE OPTHDR opthdr; \ */ +/* OBSOLETE SCNHDR txthdr */ +/* OBSOLETE */ +/* OBSOLETE #define READ_FILE_HEADERS(DESC,NAME) \ */ +/* OBSOLETE { \ */ +/* OBSOLETE int n; \ */ +/* OBSOLETE val = myread (DESC, &filehdr, sizeof filehdr); \ */ +/* OBSOLETE if (val < 0) \ */ +/* OBSOLETE perror_with_name (NAME); \ */ +/* OBSOLETE if (! IS_SOFF_MAGIC (filehdr.h_magic)) \ */ +/* OBSOLETE error ("%s: not an executable file.", NAME); \ */ +/* OBSOLETE lseek (DESC, 0L, 0); \ */ +/* OBSOLETE if (myread (DESC, &filehdr, sizeof filehdr) < 0) \ */ +/* OBSOLETE perror_with_name (NAME); \ */ +/* OBSOLETE if (myread (DESC, &opthdr, filehdr.h_opthdr) <= 0) \ */ +/* OBSOLETE perror_with_name (NAME); \ */ +/* OBSOLETE for (n = 0; n < filehdr.h_nscns; n++) \ */ +/* OBSOLETE { \ */ +/* OBSOLETE if (myread (DESC, &txthdr, sizeof txthdr) < 0) \ */ +/* OBSOLETE perror_with_name (NAME); \ */ +/* OBSOLETE if ((txthdr.s_flags & S_TYPMASK) == S_TEXT) \ */ +/* OBSOLETE break; \ */ +/* OBSOLETE } \ */ +/* OBSOLETE } */ diff --git a/gdb/config/convex/xm-convex.h b/gdb/config/convex/xm-convex.h index cfcee4e8a5..8552a3a956 100644 --- a/gdb/config/convex/xm-convex.h +++ b/gdb/config/convex/xm-convex.h @@ -1,35 +1,35 @@ -/* Definitions to make GDB run on Convex Unix (4bsd) - Copyright 1989, 1991, 1992, 1996 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define HOST_BYTE_ORDER BIG_ENDIAN - -#define ATTACH_DETACH -#define HAVE_WAIT_STRUCT -#define NO_SIGINTERRUPT - -/* Use SIGCONT rather than SIGTSTP because convex Unix occasionally - turkeys SIGTSTP. I think. */ - -#define STOP_SIGNAL SIGCONT - -/* Hook to call after creating inferior process. Now init_trace_fun - is in the same place. So re-write this to use the init_trace_fun - (making convex a debugging target). FIXME. */ - -#define CREATE_INFERIOR_HOOK create_inferior_hook +/* OBSOLETE /* Definitions to make GDB run on Convex Unix (4bsd) */ +/* OBSOLETE Copyright 1989, 1991, 1992, 1996 Free Software Foundation, Inc. */ +/* OBSOLETE */ +/* OBSOLETE This file is part of GDB. */ +/* OBSOLETE */ +/* OBSOLETE This program is free software; you can redistribute it and/or modify */ +/* OBSOLETE it under the terms of the GNU General Public License as published by */ +/* OBSOLETE the Free Software Foundation; either version 2 of the License, or */ +/* OBSOLETE (at your option) any later version. */ +/* OBSOLETE */ +/* OBSOLETE This program is distributed in the hope that it will be useful, */ +/* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* OBSOLETE GNU General Public License for more details. */ +/* OBSOLETE */ +/* OBSOLETE You should have received a copy of the GNU General Public License */ +/* OBSOLETE along with this program; if not, write to the Free Software */ +/* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define HOST_BYTE_ORDER BIG_ENDIAN */ +/* OBSOLETE */ +/* OBSOLETE #define ATTACH_DETACH */ +/* OBSOLETE #define HAVE_WAIT_STRUCT */ +/* OBSOLETE #define NO_SIGINTERRUPT */ +/* OBSOLETE */ +/* OBSOLETE /* Use SIGCONT rather than SIGTSTP because convex Unix occasionally */ +/* OBSOLETE turkeys SIGTSTP. I think. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define STOP_SIGNAL SIGCONT */ +/* OBSOLETE */ +/* OBSOLETE /* Hook to call after creating inferior process. Now init_trace_fun */ +/* OBSOLETE is in the same place. So re-write this to use the init_trace_fun */ +/* OBSOLETE (making convex a debugging target). FIXME. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define CREATE_INFERIOR_HOOK create_inferior_hook */ diff --git a/gdb/config/m68k/altos.mh b/gdb/config/m68k/altos.mh index 1073751fd7..51415beec1 100644 --- a/gdb/config/m68k/altos.mh +++ b/gdb/config/m68k/altos.mh @@ -1,5 +1,5 @@ -# Host: Altos 3068 (m68k, System V release 2) - -XM_FILE= xm-altos.h -XDEPFILES= infptrace.o inftarg.o fork-child.o altos-xdep.o +# OBSOLETE # Host: Altos 3068 (m68k, System V release 2) +# OBSOLETE +# OBSOLETE XM_FILE= xm-altos.h +# OBSOLETE XDEPFILES= infptrace.o inftarg.o fork-child.o altos-xdep.o diff --git a/gdb/config/m68k/altos.mt b/gdb/config/m68k/altos.mt index 521e958bfe..7dc654b2ac 100644 --- a/gdb/config/m68k/altos.mt +++ b/gdb/config/m68k/altos.mt @@ -1,3 +1,3 @@ -# Target: Altos 3068 (m68k, System V release 2) -TDEPFILES= m68k-tdep.o -TM_FILE= tm-altos.h +# OBSOLETE # Target: Altos 3068 (m68k, System V release 2) +# OBSOLETE TDEPFILES= m68k-tdep.o +# OBSOLETE TM_FILE= tm-altos.h diff --git a/gdb/config/m68k/tm-altos.h b/gdb/config/m68k/tm-altos.h index 23c565306d..4483aa00df 100644 --- a/gdb/config/m68k/tm-altos.h +++ b/gdb/config/m68k/tm-altos.h @@ -1,44 +1,44 @@ -/* Target definitions for GDB on an Altos 3068 (m68k running SVR2) - Copyright 1987, 1989, 1991, 1993 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* The child target can't deal with floating registers. */ -#define CANNOT_STORE_REGISTER(regno) ((regno) >= FP0_REGNUM) - -/* Define BPT_VECTOR if it is different than the default. - This is the vector number used by traps to indicate a breakpoint. */ - -#define BPT_VECTOR 0xe - -/* Address of end of stack space. */ - -/*#define STACK_END_ADDR (0xffffff)*/ -#define STACK_END_ADDR (0x1000000) - -/* Amount PC must be decremented by after a breakpoint. - On the Altos, the kernel resets the pc to the trap instr */ - -#define DECR_PC_AFTER_BREAK 0 - -/* The only reason this is here is the tm-altos.h reference below. It - was moved back here from tm-m68k.h. FIXME? */ - -extern CORE_ADDR altos_skip_prologue PARAMS ((CORE_ADDR)); -#define SKIP_PROLOGUE(pc) (altos_skip_prologue (pc)) - -#include "m68k/tm-m68k.h" +/* OBSOLETE /* Target definitions for GDB on an Altos 3068 (m68k running SVR2) */ +/* OBSOLETE Copyright 1987, 1989, 1991, 1993 Free Software Foundation, Inc. */ +/* OBSOLETE */ +/* OBSOLETE This file is part of GDB. */ +/* OBSOLETE */ +/* OBSOLETE This program is free software; you can redistribute it and/or modify */ +/* OBSOLETE it under the terms of the GNU General Public License as published by */ +/* OBSOLETE the Free Software Foundation; either version 2 of the License, or */ +/* OBSOLETE (at your option) any later version. */ +/* OBSOLETE */ +/* OBSOLETE This program is distributed in the hope that it will be useful, */ +/* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* OBSOLETE GNU General Public License for more details. */ +/* OBSOLETE */ +/* OBSOLETE You should have received a copy of the GNU General Public License */ +/* OBSOLETE along with this program; if not, write to the Free Software */ +/* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *x/ */ +/* OBSOLETE */ +/* OBSOLETE /* The child target can't deal with floating registers. *x/ */ +/* OBSOLETE #define CANNOT_STORE_REGISTER(regno) ((regno) >= FP0_REGNUM) */ +/* OBSOLETE */ +/* OBSOLETE /* Define BPT_VECTOR if it is different than the default. */ +/* OBSOLETE This is the vector number used by traps to indicate a breakpoint. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define BPT_VECTOR 0xe */ +/* OBSOLETE */ +/* OBSOLETE /* Address of end of stack space. *x/ */ +/* OBSOLETE */ +/* OBSOLETE /*#define STACK_END_ADDR (0xffffff)*x/ */ +/* OBSOLETE #define STACK_END_ADDR (0x1000000) */ +/* OBSOLETE */ +/* OBSOLETE /* Amount PC must be decremented by after a breakpoint. */ +/* OBSOLETE On the Altos, the kernel resets the pc to the trap instr *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define DECR_PC_AFTER_BREAK 0 */ +/* OBSOLETE */ +/* OBSOLETE /* The only reason this is here is the tm-altos.h reference below. It */ +/* OBSOLETE was moved back here from tm-m68k.h. FIXME? *x/ */ +/* OBSOLETE */ +/* OBSOLETE extern CORE_ADDR altos_skip_prologue PARAMS ((CORE_ADDR)); */ +/* OBSOLETE #define SKIP_PROLOGUE(pc) (altos_skip_prologue (pc)) */ +/* OBSOLETE */ +/* OBSOLETE #include "m68k/tm-m68k.h" */ diff --git a/gdb/config/m68k/xm-altos.h b/gdb/config/m68k/xm-altos.h index ca93bd1b7a..008f769eaa 100644 --- a/gdb/config/m68k/xm-altos.h +++ b/gdb/config/m68k/xm-altos.h @@ -1,202 +1,202 @@ -/* Definitions to make GDB run on an Altos 3068 (m68k running SVR2) - Copyright (C) 1987,1989 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define HOST_BYTE_ORDER BIG_ENDIAN - -/* The altos support would make a good base for a port to other USGR2 systems - (like the 3b1 and the Convergent miniframe). */ - -/* This is only needed in one file, but it's cleaner to put it here than - putting in more #ifdef's. */ -#include -#include - -#define USG - -#define HAVE_TERMIO - -#define CBREAK XTABS /* It takes all kinds... */ - -#ifndef R_OK -#define R_OK 4 -#define W_OK 2 -#define X_OK 1 -#define F_OK 0 -#endif - -/* Get sys/wait.h ie. from a Sun and edit it a little (mc68000 to m68k) */ -/* Why bother? */ -#if 0 -#define HAVE_WAIT_STRUCT -#endif - -/* This is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ - -#define KERNEL_U_ADDR 0x1fbf000 - -#define REGISTER_U_ADDR(addr, blockend, regno) \ -{ if (regno <= SP_REGNUM) \ - addr = blockend + regno * 4; \ - else if (regno == PS_REGNUM) \ - addr = blockend + regno * 4 + 4; \ - else if (regno == PC_REGNUM) \ - addr = blockend + regno * 4 + 2; \ -} - -#define REGISTER_ADDR(u_ar0, regno) \ - (((regno) < PS_REGNUM) \ - ? (&((struct exception_stack *) (u_ar0))->e_regs[(regno + R0)]) \ - : (((regno) == PS_REGNUM) \ - ? ((int *) (&((struct exception_stack *) (u_ar0))->e_PS)) \ - : (&((struct exception_stack *) (u_ar0))->e_PC))) - -#define FP_REGISTER_ADDR(u, regno) \ - (((char *) \ - (((regno) < FPC_REGNUM) \ - ? (&u.u_pcb.pcb_mc68881[FMC68881_R0 + (((regno) - FP0_REGNUM) * 3)]) \ - : (&u.u_pcb.pcb_mc68881[FMC68881_C + ((regno) - FPC_REGNUM)]))) \ - - ((char *) (& u))) - - -#ifndef __GNUC__ -#undef USE_GAS -#define ALTOS_AS -#else -#define USE_GAS -#endif - -/* Motorola assembly format */ -#if !defined(USE_GAS) && !defined(ALTOS) -#define MOTOROLA -#endif - -/* Interface definitions for kernel debugger KDB. */ - -/* Map machine fault codes into signal numbers. - First subtract 0, divide by 4, then index in a table. - Faults for which the entry in this table is 0 - are not handled by KDB; the program's own trap handler - gets to handle then. */ - -#define FAULT_CODE_ORIGIN 0 -#define FAULT_CODE_UNITS 4 -#define FAULT_TABLE \ -{ 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \ - 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \ - 0, 0, 0, 0, 0, 0, 0, 0, \ - SIGILL } - -/* Start running with a stack stretching from BEG to END. - BEG and END should be symbols meaningful to the assembler. - This is used only for kdb. */ - -#ifdef MOTOROLA -#define INIT_STACK(beg, end) \ -{ asm (".globl end"); \ - asm ("move.l $ end, sp"); \ - asm ("clr.l fp"); } -#else -#ifdef ALTOS_AS -#define INIT_STACK(beg, end) \ -{ asm ("global end"); \ - asm ("mov.l &end,%sp"); \ - asm ("clr.l %fp"); } -#else -#define INIT_STACK(beg, end) \ -{ asm (".globl end"); \ - asm ("movel $ end, sp"); \ - asm ("clrl fp"); } -#endif -#endif - -/* Push the frame pointer register on the stack. */ -#ifdef MOTOROLA -#define PUSH_FRAME_PTR \ - asm ("move.l fp, -(sp)"); -#else -#ifdef ALTOS_AS -#define PUSH_FRAME_PTR \ - asm ("mov.l %fp, -(%sp)"); -#else -#define PUSH_FRAME_PTR \ - asm ("movel fp, -(sp)"); -#endif -#endif - -/* Copy the top-of-stack to the frame pointer register. */ -#ifdef MOTOROLA -#define POP_FRAME_PTR \ - asm ("move.l (sp), fp"); -#else -#ifdef ALTOS_AS -#define POP_FRAME_PTR \ - asm ("mov.l (%sp), %fp"); -#else -#define POP_FRAME_PTR \ - asm ("movl (sp), fp"); -#endif -#endif - -/* After KDB is entered by a fault, push all registers - that GDB thinks about (all NUM_REGS of them), - so that they appear in order of ascending GDB register number. - The fault code will be on the stack beyond the last register. */ - -#ifdef MOTOROLA -#define PUSH_REGISTERS \ -{ asm ("clr.w -(sp)"); \ - asm ("pea (10,sp)"); \ - asm ("movem $ 0xfffe,-(sp)"); } -#else -#ifdef ALTOS_AS -#define PUSH_REGISTERS \ -{ asm ("clr.w -(%sp)"); \ - asm ("pea (10,%sp)"); \ - asm ("movm.l &0xfffe,-(%sp)"); } -#else -#define PUSH_REGISTERS \ -{ asm ("clrw -(sp)"); \ - asm ("pea 10(sp)"); \ - asm ("movem $ 0xfffe,-(sp)"); } -#endif -#endif - -/* Assuming the registers (including processor status) have been - pushed on the stack in order of ascending GDB register number, - restore them and return to the address in the saved PC register. */ - -#ifdef MOTOROLA -#define POP_REGISTERS \ -{ asm ("subi.l $8,28(sp)"); \ - asm ("movem (sp),$ 0xffff"); \ - asm ("rte"); } -#else -#ifdef ALTOS_AS -#define POP_REGISTERS \ -{ asm ("sub.l &8,28(%sp)"); \ - asm ("movem (%sp),&0xffff"); \ - asm ("rte"); } -#else -#define POP_REGISTERS \ -{ asm ("subil $8,28(sp)"); \ - asm ("movem (sp),$ 0xffff"); \ - asm ("rte"); } -#endif -#endif +/* OBSOLETE /* Definitions to make GDB run on an Altos 3068 (m68k running SVR2) */ +/* OBSOLETE Copyright (C) 1987,1989 Free Software Foundation, Inc. */ +/* OBSOLETE */ +/* OBSOLETE This file is part of GDB. */ +/* OBSOLETE */ +/* OBSOLETE This program is free software; you can redistribute it and/or modify */ +/* OBSOLETE it under the terms of the GNU General Public License as published by */ +/* OBSOLETE the Free Software Foundation; either version 2 of the License, or */ +/* OBSOLETE (at your option) any later version. */ +/* OBSOLETE */ +/* OBSOLETE This program is distributed in the hope that it will be useful, */ +/* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* OBSOLETE GNU General Public License for more details. */ +/* OBSOLETE */ +/* OBSOLETE You should have received a copy of the GNU General Public License */ +/* OBSOLETE along with this program; if not, write to the Free Software */ +/* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define HOST_BYTE_ORDER BIG_ENDIAN */ +/* OBSOLETE */ +/* OBSOLETE /* The altos support would make a good base for a port to other USGR2 systems */ +/* OBSOLETE (like the 3b1 and the Convergent miniframe). *x/ */ +/* OBSOLETE */ +/* OBSOLETE /* This is only needed in one file, but it's cleaner to put it here than */ +/* OBSOLETE putting in more #ifdef's. *x/ */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE */ +/* OBSOLETE #define USG */ +/* OBSOLETE */ +/* OBSOLETE #define HAVE_TERMIO */ +/* OBSOLETE */ +/* OBSOLETE #define CBREAK XTABS /* It takes all kinds... *x/ */ +/* OBSOLETE */ +/* OBSOLETE #ifndef R_OK */ +/* OBSOLETE #define R_OK 4 */ +/* OBSOLETE #define W_OK 2 */ +/* OBSOLETE #define X_OK 1 */ +/* OBSOLETE #define F_OK 0 */ +/* OBSOLETE #endif */ +/* OBSOLETE */ +/* OBSOLETE /* Get sys/wait.h ie. from a Sun and edit it a little (mc68000 to m68k) *x/ */ +/* OBSOLETE /* Why bother? *x/ */ +/* OBSOLETE #if 0 */ +/* OBSOLETE #define HAVE_WAIT_STRUCT */ +/* OBSOLETE #endif */ +/* OBSOLETE */ +/* OBSOLETE /* This is the amount to subtract from u.u_ar0 */ +/* OBSOLETE to get the offset in the core file of the register values. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define KERNEL_U_ADDR 0x1fbf000 */ +/* OBSOLETE */ +/* OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \ */ +/* OBSOLETE { if (regno <= SP_REGNUM) \ */ +/* OBSOLETE addr = blockend + regno * 4; \ */ +/* OBSOLETE else if (regno == PS_REGNUM) \ */ +/* OBSOLETE addr = blockend + regno * 4 + 4; \ */ +/* OBSOLETE else if (regno == PC_REGNUM) \ */ +/* OBSOLETE addr = blockend + regno * 4 + 2; \ */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE #define REGISTER_ADDR(u_ar0, regno) \ */ +/* OBSOLETE (((regno) < PS_REGNUM) \ */ +/* OBSOLETE ? (&((struct exception_stack *) (u_ar0))->e_regs[(regno + R0)]) \ */ +/* OBSOLETE : (((regno) == PS_REGNUM) \ */ +/* OBSOLETE ? ((int *) (&((struct exception_stack *) (u_ar0))->e_PS)) \ */ +/* OBSOLETE : (&((struct exception_stack *) (u_ar0))->e_PC))) */ +/* OBSOLETE */ +/* OBSOLETE #define FP_REGISTER_ADDR(u, regno) \ */ +/* OBSOLETE (((char *) \ */ +/* OBSOLETE (((regno) < FPC_REGNUM) \ */ +/* OBSOLETE ? (&u.u_pcb.pcb_mc68881[FMC68881_R0 + (((regno) - FP0_REGNUM) * 3)]) \ */ +/* OBSOLETE : (&u.u_pcb.pcb_mc68881[FMC68881_C + ((regno) - FPC_REGNUM)]))) \ */ +/* OBSOLETE - ((char *) (& u))) */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE #ifndef __GNUC__ */ +/* OBSOLETE #undef USE_GAS */ +/* OBSOLETE #define ALTOS_AS */ +/* OBSOLETE #else */ +/* OBSOLETE #define USE_GAS */ +/* OBSOLETE #endif */ +/* OBSOLETE */ +/* OBSOLETE /* Motorola assembly format *x/ */ +/* OBSOLETE #if !defined(USE_GAS) && !defined(ALTOS) */ +/* OBSOLETE #define MOTOROLA */ +/* OBSOLETE #endif */ +/* OBSOLETE */ +/* OBSOLETE /* Interface definitions for kernel debugger KDB. *x/ */ +/* OBSOLETE */ +/* OBSOLETE /* Map machine fault codes into signal numbers. */ +/* OBSOLETE First subtract 0, divide by 4, then index in a table. */ +/* OBSOLETE Faults for which the entry in this table is 0 */ +/* OBSOLETE are not handled by KDB; the program's own trap handler */ +/* OBSOLETE gets to handle then. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define FAULT_CODE_ORIGIN 0 */ +/* OBSOLETE #define FAULT_CODE_UNITS 4 */ +/* OBSOLETE #define FAULT_TABLE \ */ +/* OBSOLETE { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \ */ +/* OBSOLETE 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \ */ +/* OBSOLETE 0, 0, 0, 0, 0, 0, 0, 0, \ */ +/* OBSOLETE SIGILL } */ +/* OBSOLETE */ +/* OBSOLETE /* Start running with a stack stretching from BEG to END. */ +/* OBSOLETE BEG and END should be symbols meaningful to the assembler. */ +/* OBSOLETE This is used only for kdb. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #ifdef MOTOROLA */ +/* OBSOLETE #define INIT_STACK(beg, end) \ */ +/* OBSOLETE { asm (".globl end"); \ */ +/* OBSOLETE asm ("move.l $ end, sp"); \ */ +/* OBSOLETE asm ("clr.l fp"); } */ +/* OBSOLETE #else */ +/* OBSOLETE #ifdef ALTOS_AS */ +/* OBSOLETE #define INIT_STACK(beg, end) \ */ +/* OBSOLETE { asm ("global end"); \ */ +/* OBSOLETE asm ("mov.l &end,%sp"); \ */ +/* OBSOLETE asm ("clr.l %fp"); } */ +/* OBSOLETE #else */ +/* OBSOLETE #define INIT_STACK(beg, end) \ */ +/* OBSOLETE { asm (".globl end"); \ */ +/* OBSOLETE asm ("movel $ end, sp"); \ */ +/* OBSOLETE asm ("clrl fp"); } */ +/* OBSOLETE #endif */ +/* OBSOLETE #endif */ +/* OBSOLETE */ +/* OBSOLETE /* Push the frame pointer register on the stack. *x/ */ +/* OBSOLETE #ifdef MOTOROLA */ +/* OBSOLETE #define PUSH_FRAME_PTR \ */ +/* OBSOLETE asm ("move.l fp, -(sp)"); */ +/* OBSOLETE #else */ +/* OBSOLETE #ifdef ALTOS_AS */ +/* OBSOLETE #define PUSH_FRAME_PTR \ */ +/* OBSOLETE asm ("mov.l %fp, -(%sp)"); */ +/* OBSOLETE #else */ +/* OBSOLETE #define PUSH_FRAME_PTR \ */ +/* OBSOLETE asm ("movel fp, -(sp)"); */ +/* OBSOLETE #endif */ +/* OBSOLETE #endif */ +/* OBSOLETE */ +/* OBSOLETE /* Copy the top-of-stack to the frame pointer register. *x/ */ +/* OBSOLETE #ifdef MOTOROLA */ +/* OBSOLETE #define POP_FRAME_PTR \ */ +/* OBSOLETE asm ("move.l (sp), fp"); */ +/* OBSOLETE #else */ +/* OBSOLETE #ifdef ALTOS_AS */ +/* OBSOLETE #define POP_FRAME_PTR \ */ +/* OBSOLETE asm ("mov.l (%sp), %fp"); */ +/* OBSOLETE #else */ +/* OBSOLETE #define POP_FRAME_PTR \ */ +/* OBSOLETE asm ("movl (sp), fp"); */ +/* OBSOLETE #endif */ +/* OBSOLETE #endif */ +/* OBSOLETE */ +/* OBSOLETE /* After KDB is entered by a fault, push all registers */ +/* OBSOLETE that GDB thinks about (all NUM_REGS of them), */ +/* OBSOLETE so that they appear in order of ascending GDB register number. */ +/* OBSOLETE The fault code will be on the stack beyond the last register. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #ifdef MOTOROLA */ +/* OBSOLETE #define PUSH_REGISTERS \ */ +/* OBSOLETE { asm ("clr.w -(sp)"); \ */ +/* OBSOLETE asm ("pea (10,sp)"); \ */ +/* OBSOLETE asm ("movem $ 0xfffe,-(sp)"); } */ +/* OBSOLETE #else */ +/* OBSOLETE #ifdef ALTOS_AS */ +/* OBSOLETE #define PUSH_REGISTERS \ */ +/* OBSOLETE { asm ("clr.w -(%sp)"); \ */ +/* OBSOLETE asm ("pea (10,%sp)"); \ */ +/* OBSOLETE asm ("movm.l &0xfffe,-(%sp)"); } */ +/* OBSOLETE #else */ +/* OBSOLETE #define PUSH_REGISTERS \ */ +/* OBSOLETE { asm ("clrw -(sp)"); \ */ +/* OBSOLETE asm ("pea 10(sp)"); \ */ +/* OBSOLETE asm ("movem $ 0xfffe,-(sp)"); } */ +/* OBSOLETE #endif */ +/* OBSOLETE #endif */ +/* OBSOLETE */ +/* OBSOLETE /* Assuming the registers (including processor status) have been */ +/* OBSOLETE pushed on the stack in order of ascending GDB register number, */ +/* OBSOLETE restore them and return to the address in the saved PC register. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #ifdef MOTOROLA */ +/* OBSOLETE #define POP_REGISTERS \ */ +/* OBSOLETE { asm ("subi.l $8,28(sp)"); \ */ +/* OBSOLETE asm ("movem (sp),$ 0xffff"); \ */ +/* OBSOLETE asm ("rte"); } */ +/* OBSOLETE #else */ +/* OBSOLETE #ifdef ALTOS_AS */ +/* OBSOLETE #define POP_REGISTERS \ */ +/* OBSOLETE { asm ("sub.l &8,28(%sp)"); \ */ +/* OBSOLETE asm ("movem (%sp),&0xffff"); \ */ +/* OBSOLETE asm ("rte"); } */ +/* OBSOLETE #else */ +/* OBSOLETE #define POP_REGISTERS \ */ +/* OBSOLETE { asm ("subil $8,28(sp)"); \ */ +/* OBSOLETE asm ("movem (sp),$ 0xffff"); \ */ +/* OBSOLETE asm ("rte"); } */ +/* OBSOLETE #endif */ +/* OBSOLETE #endif */ diff --git a/gdb/configure.host b/gdb/configure.host index 0a4695fde3..50e4f6beb1 100644 --- a/gdb/configure.host +++ b/gdb/configure.host @@ -11,7 +11,7 @@ case "${host_cpu}" in alpha*) gdb_host_cpu=alpha ;; -c[12]) gdb_host_cpu=convex ;; +# OBSOLETE c[12]) gdb_host_cpu=convex ;; hppa*) gdb_host_cpu=pa ;; i[3456]86*) gdb_host_cpu=i386 ;; m68*) gdb_host_cpu=m68k ;; @@ -37,7 +37,7 @@ alpha*-*-linux*) gdb_host=alpha-linux ;; arm-*-*) gdb_host=arm ;; -c[12]-*-*) gdb_host=convex ;; +# OBSOLETE c[12]-*-*) gdb_host=convex ;; hppa*-*-bsd*) gdb_host=hppabsd ;; hppa*-*-hiux*) gdb_host=hppahpux ;; @@ -82,7 +82,7 @@ m680[01]0-sun-sunos3*) gdb_host=sun2os3 ;; m680[01]0-sun-sunos4*) gdb_host=sun2os4 ;; m68030-sony-*) gdb_host=news1000 ;; -m68*-altos-*) gdb_host=altos ;; +# OBSOLETE m68*-altos-*) gdb_host=altos ;; m68*-apollo*-sysv*) gdb_host=apollo68v ;; m68*-apollo*-bsd*) gdb_host=apollo68b ;; m68*-att-*) gdb_host=3b1 ;; diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 38ac1e97c7..dbe822ab23 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -13,7 +13,7 @@ case "${target_cpu}" in alpha*) gdb_target_cpu=alpha ;; -c[12]) gdb_target_cpu=convex ;; +# OBSOLETE c[12]) gdb_target_cpu=convex ;; hppa*) gdb_target_cpu=pa ;; i[3456]86*) gdb_target_cpu=i386 ;; m68*) gdb_target_cpu=m68k ;; @@ -53,8 +53,8 @@ arc-*-*) gdb_target=arc ;; arm-*-* | thumb-*-* | strongarm-*-*) gdb_target=arm ;; -c1-*-*) gdb_target=convex ;; -c2-*-*) gdb_target=convex ;; +# OBSOLETE c1-*-*) gdb_target=convex ;; +# OBSOLETE c2-*-*) gdb_target=convex ;; d10v-*-*) gdb_target=d10v ;; d30v-*-*) gdb_target=d30v ;; @@ -126,7 +126,7 @@ m68*-apollo*-bsd*) gdb_target=apollo68b ;; m68*-bull-sysv*) gdb_target=dpx2 ;; m68*-hp-bsd*) gdb_target=hp300bsd ;; m68*-hp-hpux*) gdb_target=hp300hpux ;; -m68*-altos-*) gdb_target=altos ;; +# OBSOLETE m68*-altos-*) gdb_target=altos ;; m68*-att-*) gdb_target=3b1 ;; m68*-cisco*-*) gdb_target=cisco ;; m68*-ericsson-*) gdb_target=es1800 ;; diff --git a/gdb/convex-tdep.c b/gdb/convex-tdep.c index 66161e7930..4e388d1a63 100644 --- a/gdb/convex-tdep.c +++ b/gdb/convex-tdep.c @@ -1,1277 +1,1277 @@ -/* Convex stuff for GDB. - Copyright (C) 1990, 1991, 1996 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "command.h" -#include "symtab.h" -#include "value.h" -#include "frame.h" -#include "inferior.h" -#include "wait.h" - -#include -#include - -#include "gdbcore.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "gdb_stat.h" -#include - -#include "gdbcmd.h" - -CORE_ADDR -convex_skip_prologue (pc) - CORE_ADDR pc; -{ - int op, ix; - op = read_memory_integer (pc, 2); - if ((op & 0xffc7) == 0x5ac0) - pc += 2; - else if (op == 0x1580) - pc += 4; - else if (op == 0x15c0) - pc += 6; - if ((read_memory_integer (pc, 2) & 0xfff8) == 0x7c40 - && (read_memory_integer (pc + 2, 2) & 0xfff8) == 0x1240 - && (read_memory_integer (pc + 8, 2) & 0xfff8) == 0x7c48) - pc += 10; - if (read_memory_integer (pc, 2) == 0x1240) - pc += 6; - for (;;) - { - op = read_memory_integer (pc, 2); - ix = (op >> 3) & 7; - if (ix != 6) - break; - if ((op & 0xfcc0) == 0x3000) - pc += 4; - else if ((op & 0xfcc0) == 0x3040) - pc += 6; - else if ((op & 0xfcc0) == 0x2800) - pc += 4; - else if ((op & 0xfcc0) == 0x2840) - pc += 6; - else - break; - } - return pc; -} - -int -convex_frameless_function_invocation (fi) - struct frame_info *fi; -{ - int frameless; - extern CORE_ADDR text_start, text_end; - CORE_ADDR call_addr = SAVED_PC_AFTER_CALL (FI); - frameless = (call_addr >= text_start && call_addr < text_end - && read_memory_integer (call_addr - 6, 1) == 0x22); - return frameless; -} - -int -convex_frame_num_args (fi) - struct frame_info *fi; -{ - int numargs = read_memory_integer (FRAME_ARGS_ADDRESS (fi) - 4, 4); - if (numargs < 0 || numargs >= 256) - numargs = -1; - return numargs; -} - -exec_file_command (filename, from_tty) - char *filename; - int from_tty; -{ - int val; - int n; - struct stat st_exec; - - /* Eliminate all traces of old exec file. - Mark text segment as empty. */ - - if (execfile) - free (execfile); - execfile = 0; - data_start = 0; - data_end = 0; - text_start = 0; - text_end = 0; - exec_data_start = 0; - exec_data_end = 0; - if (execchan >= 0) - close (execchan); - execchan = -1; - - n_exec = 0; - - /* Now open and digest the file the user requested, if any. */ - - if (filename) - { - filename = tilde_expand (filename); - make_cleanup (free, filename); - - execchan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0, - &execfile); - if (execchan < 0) - perror_with_name (filename); - - if (myread (execchan, &filehdr, sizeof filehdr) < 0) - perror_with_name (filename); - - if (! IS_SOFF_MAGIC (filehdr.h_magic)) - error ("%s: not an executable file.", filename); - - if (myread (execchan, &opthdr, filehdr.h_opthdr) <= 0) - perror_with_name (filename); - - /* Read through the section headers. - For text, data, etc, record an entry in the exec file map. - Record text_start and text_end. */ - - lseek (execchan, (long) filehdr.h_scnptr, 0); - - for (n = 0; n < filehdr.h_nscns; n++) - { - if (myread (execchan, &scnhdr, sizeof scnhdr) < 0) - perror_with_name (filename); - - if ((scnhdr.s_flags & S_TYPMASK) >= S_TEXT - && (scnhdr.s_flags & S_TYPMASK) <= S_COMON) - { - exec_map[n_exec].mem_addr = scnhdr.s_vaddr; - exec_map[n_exec].mem_end = scnhdr.s_vaddr + scnhdr.s_size; - exec_map[n_exec].file_addr = scnhdr.s_scnptr; - exec_map[n_exec].type = scnhdr.s_flags & S_TYPMASK; - n_exec++; - - if ((scnhdr.s_flags & S_TYPMASK) == S_TEXT) - { - text_start = scnhdr.s_vaddr; - text_end = scnhdr.s_vaddr + scnhdr.s_size; - } - } - } - - fstat (execchan, &st_exec); - exec_mtime = st_exec.st_mtime; - - validate_files (); - } - else if (from_tty) - printf_filtered ("No executable file now.\n"); - - /* Tell display code (if any) about the changed file name. */ - if (exec_file_display_hook) - (*exec_file_display_hook) (filename); -} - -#if 0 -/* Read data from SOFF exec or core file. - Return 0 on success, EIO if address out of bounds. */ - -int -xfer_core_file (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - register int i; - register int n; - register int val; - int xferchan; - char **xferfile; - int fileptr; - int returnval = 0; - - while (len > 0) - { - xferfile = 0; - xferchan = 0; - - /* Determine which file the next bunch of addresses reside in, - and where in the file. Set the file's read/write pointer - to point at the proper place for the desired address - and set xferfile and xferchan for the correct file. - If desired address is nonexistent, leave them zero. - i is set to the number of bytes that can be handled - along with the next address. */ - - i = len; - - for (n = 0; n < n_core; n++) - { - if (memaddr >= core_map[n].mem_addr && memaddr < core_map[n].mem_end - && (core_map[n].thread == -1 - || core_map[n].thread == inferior_thread)) - { - i = min (len, core_map[n].mem_end - memaddr); - fileptr = core_map[n].file_addr + memaddr - core_map[n].mem_addr; - if (core_map[n].file_addr) - { - xferfile = &corefile; - xferchan = corechan; - } - break; - } - else if (core_map[n].mem_addr >= memaddr - && core_map[n].mem_addr < memaddr + i) - i = core_map[n].mem_addr - memaddr; - } - - if (!xferfile) - for (n = 0; n < n_exec; n++) - { - if (memaddr >= exec_map[n].mem_addr - && memaddr < exec_map[n].mem_end) - { - i = min (len, exec_map[n].mem_end - memaddr); - fileptr = exec_map[n].file_addr + memaddr - - exec_map[n].mem_addr; - if (exec_map[n].file_addr) - { - xferfile = &execfile; - xferchan = execchan; - } - break; - } - else if (exec_map[n].mem_addr >= memaddr - && exec_map[n].mem_addr < memaddr + i) - i = exec_map[n].mem_addr - memaddr; - } - - /* Now we know which file to use. - Set up its pointer and transfer the data. */ - if (xferfile) - { - if (*xferfile == 0) - if (xferfile == &execfile) - error ("No program file to examine."); - else - error ("No core dump file or running program to examine."); - val = lseek (xferchan, fileptr, 0); - if (val < 0) - perror_with_name (*xferfile); - val = myread (xferchan, myaddr, i); - if (val < 0) - perror_with_name (*xferfile); - } - /* If this address is for nonexistent memory, - read zeros if reading, or do nothing if writing. */ - else - { - memset (myaddr, '\0', i); - returnval = EIO; - } - - memaddr += i; - myaddr += i; - len -= i; - } - return returnval; -} -#endif - -/* Here from info files command to print an address map. */ - -print_maps () -{ - struct pmap ptrs[200]; - int n; - - /* ID strings for core and executable file sections */ - - static char *idstr[] = - { - "0", "text", "data", "tdata", "bss", "tbss", - "common", "ttext", "ctx", "tctx", "10", "11", "12", - }; - - for (n = 0; n < n_core; n++) - { - core_map[n].which = 0; - ptrs[n] = core_map[n]; - } - for (n = 0; n < n_exec; n++) - { - exec_map[n].which = 1; - ptrs[n_core+n] = exec_map[n]; - } - - qsort (ptrs, n_core + n_exec, sizeof *ptrs, ptr_cmp); - - for (n = 0; n < n_core + n_exec; n++) - { - struct pmap *p = &ptrs[n]; - if (n > 0) - { - if (p->mem_addr < ptrs[n-1].mem_end) - p->mem_addr = ptrs[n-1].mem_end; - if (p->mem_addr >= p->mem_end) - continue; - } - printf_filtered ("%08x .. %08x %-6s %s\n", - p->mem_addr, p->mem_end, idstr[p->type], - p->which ? execfile : corefile); - } -} - -/* Compare routine to put file sections in order. - Sort into increasing order on address, and put core file sections - before exec file sections if both files contain the same addresses. */ - -static ptr_cmp (a, b) - struct pmap *a, *b; -{ - if (a->mem_addr != b->mem_addr) return a->mem_addr - b->mem_addr; - return a->which - b->which; -} - -/* Trapped internal variables are used to handle special registers. - A trapped i.v. calls a hook here every time it is dereferenced, - to provide a new value for the variable, and it calls a hook here - when a new value is assigned, to do something with the value. - - The vector registers are $vl, $vs, $vm, $vN, $VN (N in 0..7). - The communication registers are $cN, $CN (N in 0..63). - They not handled as regular registers because it's expensive to - read them, and their size varies, and they have too many names. */ - - -/* Return 1 if NAME is a trapped internal variable, else 0. */ - -int -is_trapped_internalvar (name) - char *name; -{ - if ((name[0] == 'c' || name[0] == 'C') - && name[1] >= '0' && name[1] <= '9' - && (name[2] == '\0' - || (name[2] >= '0' && name[2] <= '9' - && name[3] == '\0' && name[1] != '0')) - && atoi (&name[1]) < 64) return 1; - - if ((name[0] == 'v' || name[0] == 'V') - && (((name[1] & -8) == '0' && name[2] == '\0') - || STREQ (name, "vl") - || STREQ (name, "vs") - || STREQ (name, "vm"))) - return 1; - else return 0; -} - -/* Return the value of trapped internal variable VAR */ - -value -value_of_trapped_internalvar (var) - struct internalvar *var; -{ - char *name = var->name; - value val; - struct type *type; - struct type *range_type; - long len = *read_vector_register (VL_REGNUM); - if (len <= 0 || len > 128) len = 128; - - if (STREQ (name, "vl")) - { - val = value_from_longest (builtin_type_int, - (LONGEST) *read_vector_register_1 (VL_REGNUM)); - } - else if (STREQ (name, "vs")) - { - val = value_from_longest (builtin_type_int, - (LONGEST) *read_vector_register_1 (VS_REGNUM)); - } - else if (STREQ (name, "vm")) - { - long vm[4]; - long i, *p; - memcpy (vm, read_vector_register_1 (VM_REGNUM), sizeof vm); - range_type = - create_range_type ((struct type *) NULL, builtin_type_int, 0, len - 1); - type = - create_array_type ((struct type *) NULL, builtin_type_int, range_type); - val = allocate_value (type); - p = (long *) VALUE_CONTENTS (val); - for (i = 0; i < len; i++) - *p++ = !! (vm[3 - (i >> 5)] & (1 << (i & 037))); - } - else if (name[0] == 'V') - { - range_type = - create_range_type ((struct type *) NULL, builtin_type_int 0, len - 1); - type = - create_array_type ((struct type *) NULL, builtin_type_long_long, - range_type); - val = allocate_value (type); - memcpy (VALUE_CONTENTS (val), - read_vector_register_1 (name[1] - '0'), - TYPE_LENGTH (type)); - } - else if (name[0] == 'v') - { - long *p1, *p2; - range_type = - create_range_type ((struct type *) NULL, builtin_type_int 0, len - 1); - type = - create_array_type ((struct type *) NULL, builtin_type_long, - range_type); - val = allocate_value (type); - p1 = read_vector_register_1 (name[1] - '0'); - p2 = (long *) VALUE_CONTENTS (val); - while (--len >= 0) {p1++; *p2++ = *p1++;} - } - - else if (name[0] == 'c') - val = value_from_longest (builtin_type_int, - read_comm_register (atoi (&name[1]))); - else if (name[0] == 'C') - val = value_from_longest (builtin_type_long_long, - read_comm_register (atoi (&name[1]))); - - VALUE_LVAL (val) = lval_internalvar; - VALUE_INTERNALVAR (val) = var; - return val; -} - -/* Handle a new value assigned to a trapped internal variable */ - -void -set_trapped_internalvar (var, val, bitpos, bitsize, offset) - struct internalvar *var; - value val; - int bitpos, bitsize, offset; -{ - char *name = var->name; - long long newval = value_as_long (val); - - if (STREQ (name, "vl")) - write_vector_register (VL_REGNUM, 0, newval); - else if (STREQ (name, "vs")) - write_vector_register (VS_REGNUM, 0, newval); - else if (name[0] == 'c' || name[0] == 'C') - write_comm_register (atoi (&name[1]), newval); - else if (STREQ (name, "vm")) - error ("can't assign to $vm"); - else - { - offset /= bitsize / 8; - write_vector_register (name[1] - '0', offset, newval); - } -} - -/* Print an integer value when no format was specified. gdb normally - prints these values in decimal, but the the leading 0x80000000 of - pointers produces intolerable 10-digit negative numbers. - If it looks like an address, print it in hex instead. */ - -decout (stream, type, val) - GDB_FILE *stream; - struct type *type; - LONGEST val; -{ - long lv = val; - - switch (output_radix) - { - case 0: - if ((lv == val || (unsigned) lv == val) - && ((lv & 0xf0000000) == 0x80000000 - || ((lv & 0xf0000000) == 0xf0000000 && lv < STACK_END_ADDR))) - { - print_longest (stream, "x", 0, val); - return; - } - - case 10: - print_longest (stream, TYPE_UNSIGNED (type) ? "u" : "d", 0, val); - return; - - case 8: - print_longest (stream, "o", 0, val); - return; - - case 16: - print_longest (stream, "x", 0, val); - return; - } -} - -/* Change the default output radix to 10 or 16, or set it to 0 (heuristic). - This command is mostly obsolete now that the print command allows - formats to apply to aggregates, but is still handy occasionally. */ - -static void -set_base_command (arg) - char *arg; -{ - int new_radix; - - if (!arg) - output_radix = 0; - else - { - new_radix = atoi (arg); - if (new_radix != 10 && new_radix != 16 && new_radix != 8) - error ("base must be 8, 10 or 16, or null"); - else output_radix = new_radix; - } -} - -/* Turn pipelining on or off in the inferior. */ - -static void -set_pipelining_command (arg) - char *arg; -{ - if (!arg) - { - sequential = !sequential; - printf_filtered ("%s\n", sequential ? "off" : "on"); - } - else if (STREQ (arg, "on")) - sequential = 0; - else if (STREQ (arg, "off")) - sequential = 1; - else error ("valid args are `on', to allow instructions to overlap, or\n\ -`off', to prevent it and thereby pinpoint exceptions."); -} - -/* Enable, disable, or force parallel execution in the inferior. */ - -static void -set_parallel_command (arg) - char *arg; -{ - struct rlimit rl; - int prevparallel = parallel; - - if (!strncmp (arg, "fixed", strlen (arg))) - parallel = 2; - else if (STREQ (arg, "on")) - parallel = 1; - else if (STREQ (arg, "off")) - parallel = 0; - else error ("valid args are `on', to allow multiple threads, or\n\ -`fixed', to force multiple threads, or\n\ -`off', to run with one thread only."); - - if ((prevparallel == 0) != (parallel == 0) && inferior_pid) - printf_filtered ("will take effect at next run.\n"); - - getrlimit (RLIMIT_CONCUR, &rl); - rl.rlim_cur = parallel ? rl.rlim_max : 1; - setrlimit (RLIMIT_CONCUR, &rl); - - if (inferior_pid) - set_fixed_scheduling (inferior_pid, parallel == 2); -} - -/* Add a new name for an existing command. */ - -static void -alias_command (arg) - char *arg; -{ - static char *aliaserr = "usage is `alias NEW OLD', no args allowed"; - char *newname = arg; - struct cmd_list_element *new, *old; - - if (!arg) - error_no_arg ("newname oldname"); - - new = lookup_cmd (&arg, cmdlist, "", -1); - if (new && !strncmp (newname, new->name, strlen (new->name))) - { - newname = new->name; - if (!(*arg == '-' - || (*arg >= 'a' && *arg <= 'z') - || (*arg >= 'A' && *arg <= 'Z') - || (*arg >= '0' && *arg <= '9'))) - error (aliaserr); - } - else - { - arg = newname; - while (*arg == '-' - || (*arg >= 'a' && *arg <= 'z') - || (*arg >= 'A' && *arg <= 'Z') - || (*arg >= '0' && *arg <= '9')) - arg++; - if (*arg != ' ' && *arg != '\t') - error (aliaserr); - *arg = '\0'; - arg++; - } - - old = lookup_cmd (&arg, cmdlist, "", 0); - - if (*arg != '\0') - error (aliaserr); - - if (new && !strncmp (newname, new->name, strlen (new->name))) - { - char *tem; - if (new->class == (int) class_user || new->class == (int) class_alias) - tem = "Redefine command \"%s\"? "; - else - tem = "Really redefine built-in command \"%s\"? "; - if (!query (tem, new->name)) - error ("Command \"%s\" not redefined.", new->name); - } - - add_com (newname, class_alias, old->function, old->doc); -} - - - -/* Print the current thread number, and any threads with signals in the - queue. */ - -thread_info () -{ - struct threadpid *p; - - if (have_inferior_p ()) - { - ps.pi_buffer = (char *) &comm_registers; - ps.pi_nbytes = sizeof comm_registers; - ps.pi_offset = 0; - ps.pi_thread = inferior_thread; - ioctl (inferior_fd, PIXRDCREGS, &ps); - } - - /* FIXME: stop_signal is from target.h but stop_sigcode is a - convex-specific thing. */ - printf_filtered ("Current thread %d stopped with signal %d.%d (%s).\n", - inferior_thread, stop_signal, stop_sigcode, - subsig_name (stop_signal, stop_sigcode)); - - for (p = signal_stack; p->pid; p--) - printf_filtered ("Thread %d stopped with signal %d.%d (%s).\n", - p->thread, p->signo, p->subsig, - subsig_name (p->signo, p->subsig)); - - if (iscrlbit (comm_registers.crctl.lbits.cc, 64+13)) - printf_filtered ("New thread start pc %#x\n", - (long) (comm_registers.crreg.pcpsw >> 32)); -} - -/* Return string describing a signal.subcode number */ - -static char * -subsig_name (signo, subcode) - int signo, subcode; -{ - static char *subsig4[] = { - "error exit", "privileged instruction", "unknown", - "unknown", "undefined opcode", - 0}; - static char *subsig5[] = {0, - "breakpoint", "single step", "fork trap", "exec trap", "pfork trap", - "join trap", "idle trap", "last thread", "wfork trap", - "process breakpoint", "trap instruction", - 0}; - static char *subsig8[] = {0, - "int overflow", "int divide check", "float overflow", - "float divide check", "float underflow", "reserved operand", - "sqrt error", "exp error", "ln error", "sin error", "cos error", - 0}; - static char *subsig10[] = {0, - "invalid inward ring address", "invalid outward ring call", - "invalid inward ring return", "invalid syscall gate", - "invalid rtn frame length", "invalid comm reg address", - "invalid trap gate", - 0}; - static char *subsig11[] = {0, - "read access denied", "write access denied", "execute access denied", - "segment descriptor fault", "page table fault", "data reference fault", - "i/o access denied", "levt pte invalid", - 0}; - - static char **subsig_list[] = - {0, 0, 0, 0, subsig4, subsig5, 0, 0, subsig8, 0, subsig10, subsig11, 0}; - - int i; - char *p; - - if ((p = strsignal (signo)) == NULL) - p = "unknown"; - if (signo >= (sizeof subsig_list / sizeof *subsig_list) - || !subsig_list[signo]) - return p; - for (i = 1; subsig_list[signo][i]; i++) - if (i == subcode) - return subsig_list[signo][subcode]; - return p; -} - - -/* Print a compact display of thread status, essentially x/i $pc - for all active threads. */ - -static void -threadstat () -{ - int t; - - for (t = 0; t < n_threads; t++) - if (thread_state[t] == PI_TALIVE) - { - printf_filtered ("%d%c %08x%c %d.%d ", t, - (t == inferior_thread ? '*' : ' '), thread_pc[t], - (thread_is_in_kernel[t] ? '#' : ' '), - thread_signal[t], thread_sigcode[t]); - print_insn (thread_pc[t], stdout); - printf_filtered ("\n"); - } -} - -/* Change the current thread to ARG. */ - -set_thread_command (arg) - char *arg; -{ - int thread; - - if (!arg) - { - threadstat (); - return; - } - - thread = parse_and_eval_address (arg); - - if (thread < 0 || thread > n_threads || thread_state[thread] != PI_TALIVE) - error ("no such thread."); - - select_thread (thread); - - stop_pc = read_pc (); - flush_cached_frames (); - select_frame (get_current_frame (), 0); - print_stack_frame (selected_frame, selected_frame_level, -1); -} - -/* Here on CONT command; gdb's dispatch address is changed to come here. - Set global variable ALL_CONTINUE to tell resume() that it should - start up all threads, and that a thread switch will not blow gdb's - mind. */ - -static void -convex_cont_command (proc_count_exp, from_tty) - char *proc_count_exp; - int from_tty; -{ - all_continue = 1; - cont_command (proc_count_exp, from_tty); -} - -/* Here on 1CONT command. Resume only the current thread. */ - -one_cont_command (proc_count_exp, from_tty) - char *proc_count_exp; - int from_tty; -{ - cont_command (proc_count_exp, from_tty); -} - -/* Print the contents and lock bits of all communication registers, - or just register ARG if ARG is a communication register, - or the 3-word resource structure in memory at address ARG. */ - -comm_registers_info (arg) - char *arg; -{ - int i, regnum; - - if (arg) - { - if (sscanf (arg, "$c%d", ®num) == 1) { - ; - } else if (sscanf (arg, "$C%d", ®num) == 1) { - ; - } else { - regnum = parse_and_eval_address (arg); - if (regnum > 0) - regnum &= ~0x8000; - } - - if (regnum >= 64) - error ("%s: invalid register name.", arg); - - /* if we got a (user) address, examine the resource struct there */ - - if (regnum < 0) - { - static int buf[3]; - read_memory (regnum, buf, sizeof buf); - printf_filtered ("%08x %08x%08x%s\n", regnum, buf[1], buf[2], - buf[0] & 0xff ? " locked" : ""); - return; - } - } - - ps.pi_buffer = (char *) &comm_registers; - ps.pi_nbytes = sizeof comm_registers; - ps.pi_offset = 0; - ps.pi_thread = inferior_thread; - ioctl (inferior_fd, PIXRDCREGS, &ps); - - for (i = 0; i < 64; i++) - if (!arg || i == regnum) - printf_filtered ("%2d 0x8%03x %016llx%s\n", i, i, - comm_registers.crreg.r4[i], - (iscrlbit (comm_registers.crctl.lbits.cc, i) - ? " locked" : "")); -} - -/* Print the psw */ - -static void -psw_info (arg) - char *arg; -{ - struct pswbit - { - int bit; - int pos; - char *text; - }; - - static struct pswbit pswbit[] = - { - { 0x80000000, -1, "A carry" }, - { 0x40000000, -1, "A integer overflow" }, - { 0x20000000, -1, "A zero divide" }, - { 0x10000000, -1, "Integer overflow enable" }, - { 0x08000000, -1, "Trace" }, - { 0x06000000, 25, "Frame length" }, - { 0x01000000, -1, "Sequential" }, - { 0x00800000, -1, "S carry" }, - { 0x00400000, -1, "S integer overflow" }, - { 0x00200000, -1, "S zero divide" }, - { 0x00100000, -1, "Zero divide enable" }, - { 0x00080000, -1, "Floating underflow" }, - { 0x00040000, -1, "Floating overflow" }, - { 0x00020000, -1, "Floating reserved operand" }, - { 0x00010000, -1, "Floating zero divide" }, - { 0x00008000, -1, "Floating error enable" }, - { 0x00004000, -1, "Floating underflow enable" }, - { 0x00002000, -1, "IEEE" }, - { 0x00001000, -1, "Sequential stores" }, - { 0x00000800, -1, "Intrinsic error" }, - { 0x00000400, -1, "Intrinsic error enable" }, - { 0x00000200, -1, "Trace thread creates" }, - { 0x00000100, -1, "Thread init trap" }, - { 0x000000e0, 5, "Reserved" }, - { 0x0000001f, 0, "Intrinsic error code" }, - {0, 0, 0}, - }; - - long psw; - struct pswbit *p; - - if (arg) - psw = parse_and_eval_address (arg); - else - psw = read_register (PS_REGNUM); - - for (p = pswbit; p->bit; p++) - { - if (p->pos < 0) - printf_filtered ("%08x %s %s\n", p->bit, - (psw & p->bit) ? "yes" : "no ", p->text); - else - printf_filtered ("%08x %3d %s\n", p->bit, - (psw & p->bit) >> p->pos, p->text); - } -} - -#include "symtab.h" - -/* reg (fmt_field, inst_field) -- - the {first,second,third} operand of instruction as fmt_field = [ijk] - gets the value of the field from the [ijk] position of the instruction */ - -#define reg(a,b) ((char (*)[3])(op[fmt->a]))[inst.f0.b] - -/* lit (fmt_field) -- field [ijk] is a literal (PSW, VL, eg) */ - -#define lit(i) op[fmt->i] - -/* aj[j] -- name for A register j */ - -#define aj ((char (*)[3])(op[A])) - -union inst { - struct { - unsigned : 7; - unsigned i : 3; - unsigned j : 3; - unsigned k : 3; - unsigned : 16; - unsigned : 32; - } f0; - struct { - unsigned : 8; - unsigned indir : 1; - unsigned len : 1; - unsigned j : 3; - unsigned k : 3; - unsigned : 16; - unsigned : 32; - } f1; - unsigned char byte[8]; - unsigned short half[4]; - char signed_byte[8]; - short signed_half[4]; -}; - -struct opform { - int mask; /* opcode mask */ - int shift; /* opcode align */ - struct formstr *formstr[3]; /* ST, E0, E1 */ -}; - -struct formstr { - unsigned lop:8, rop:5; /* opcode */ - unsigned fmt:5; /* inst format */ - unsigned i:5, j:5, k:2; /* operand formats */ -}; - -#include "opcode/convex.h" - -CONST unsigned char formdecode [] = { - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, - 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, - 4,4,4,4,4,4,4,4,5,5,5,5,6,6,7,8, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -}; - -CONST struct opform opdecode[] = { - 0x7e00, 9, format0, e0_format0, e1_format0, - 0x3f00, 8, format1, e0_format1, e1_format1, - 0x1fc0, 6, format2, e0_format2, e1_format2, - 0x0fc0, 6, format3, e0_format3, e1_format3, - 0x0700, 8, format4, e0_format4, e1_format4, - 0x03c0, 6, format5, e0_format5, e1_format5, - 0x01f8, 3, format6, e0_format6, e1_format6, - 0x00f8, 3, format7, e0_format7, e1_format7, - 0x0000, 0, formatx, formatx, formatx, - 0x0f80, 7, formatx, formatx, formatx, - 0x0f80, 7, formatx, formatx, formatx, -}; - -/* Print the instruction at address MEMADDR in debugged memory, - on STREAM. Returns length of the instruction, in bytes. */ - -int -convex_print_insn (memaddr, stream) - CORE_ADDR memaddr; - FILE *stream; -{ - union inst inst; - struct formstr *fmt; - register int format, op1, pfx; - int l; - - read_memory (memaddr, &inst, sizeof inst); - - /* Remove and note prefix, if present */ - - pfx = inst.half[0]; - if ((pfx & 0xfff0) == 0x7ef0) - { - pfx = ((pfx >> 3) & 1) + 1; - *(long long *) &inst = *(long long *) &inst.half[1]; - } - else pfx = 0; - - /* Split opcode into format.op1 and look up in appropriate table */ - - format = formdecode[inst.byte[0]]; - op1 = (inst.half[0] & opdecode[format].mask) >> opdecode[format].shift; - if (format == 9) - { - if (pfx) - fmt = formatx; - else if (inst.f1.j == 0) - fmt = &format1a[op1]; - else if (inst.f1.j == 1) - fmt = &format1b[op1]; - else - fmt = formatx; - } - else - fmt = &opdecode[format].formstr[pfx][op1]; - - /* Print it */ - - if (fmt->fmt == xxx) - { - /* noninstruction */ - fprintf (stream, "0x%04x", pfx ? pfx : inst.half[0]); - return 2; - } - - if (pfx) - pfx = 2; - - fprintf (stream, "%s%s%s", lop[fmt->lop], rop[fmt->rop], - &" "[strlen(lop[fmt->lop]) + strlen(rop[fmt->rop])]); - - switch (fmt->fmt) - { - case rrr: /* three register */ - fprintf (stream, "%s,%s,%s", reg(i,i), reg(j,j), reg(k,k)); - return pfx + 2; - - case rr: /* two register */ - fprintf (stream, "%s,%s", reg(i,j), reg(j,k)); - return pfx + 2; - - case rxr: /* two register, reversed i and j fields */ - fprintf (stream, "%s,%s", reg(i,k), reg(j,j)); - return pfx + 2; - - case r: /* one register */ - fprintf (stream, "%s", reg(i,k)); - return pfx + 2; - - case nops: /* no operands */ - return pfx + 2; - - case nr: /* short immediate, one register */ - fprintf (stream, "#%d,%s", inst.f0.j, reg(i,k)); - return pfx + 2; - - case pcrel: /* pc relative */ - print_address (memaddr + 2 * inst.signed_byte[1], stream); - return pfx + 2; - - case lr: /* literal, one register */ - fprintf (stream, "%s,%s", lit(i), reg(j,k)); - return pfx + 2; - - case rxl: /* one register, literal */ - fprintf (stream, "%s,%s", reg(i,k), lit(j)); - return pfx + 2; - - case rlr: /* register, literal, register */ - fprintf (stream, "%s,%s,%s", reg(i,j), lit(j), reg(k,k)); - return pfx + 2; - - case rrl: /* register, register, literal */ - fprintf (stream, "%s,%s,%s", reg(i,j), reg(j,k), lit(k)); - return pfx + 2; - - case iml: /* immediate, literal */ - if (inst.f1.len) - { - fprintf (stream, "#%#x,%s", - (inst.signed_half[1] << 16) + inst.half[2], lit(i)); - return pfx + 6; - } - else - { - fprintf (stream, "#%d,%s", inst.signed_half[1], lit(i)); - return pfx + 4; - } - - case imr: /* immediate, register */ - if (inst.f1.len) - { - fprintf (stream, "#%#x,%s", - (inst.signed_half[1] << 16) + inst.half[2], reg(i,k)); - return pfx + 6; - } - else - { - fprintf (stream, "#%d,%s", inst.signed_half[1], reg(i,k)); - return pfx + 4; - } - - case a1r: /* memory, register */ - l = print_effa (inst, stream); - fprintf (stream, ",%s", reg(i,k)); - return pfx + l; - - case a1l: /* memory, literal */ - l = print_effa (inst, stream); - fprintf (stream, ",%s", lit(i)); - return pfx + l; - - case a2r: /* register, memory */ - fprintf (stream, "%s,", reg(i,k)); - return pfx + print_effa (inst, stream); - - case a2l: /* literal, memory */ - fprintf (stream, "%s,", lit(i)); - return pfx + print_effa (inst, stream); - - case a3: /* memory */ - return pfx + print_effa (inst, stream); - - case a4: /* system call */ - l = 29; goto a4a5; - case a5: /* trap */ - l = 27; - a4a5: - if (inst.f1.len) - { - unsigned int m = (inst.signed_half[1] << 16) + inst.half[2]; - fprintf (stream, "#%d,#%d", m >> l, m & (-1 >> (32-l))); - return pfx + 6; - } - else - { - unsigned int m = inst.signed_half[1]; - fprintf (stream, "#%d,#%d", m >> l, m & (-1 >> (32-l))); - return pfx + 4; - } - } -} - - -/* print effective address @nnn(aj), return instruction length */ - -int print_effa (inst, stream) - union inst inst; - FILE *stream; -{ - int n, l; - - if (inst.f1.len) - { - n = (inst.signed_half[1] << 16) + inst.half[2]; - l = 6; - } - else - { - n = inst.signed_half[1]; - l = 4; - } - - if (inst.f1.indir) - printf ("@"); - - if (!inst.f1.j) - { - print_address (n, stream); - return l; - } - - fprintf (stream, (n & 0xf0000000) == 0x80000000 ? "%#x(%s)" : "%d(%s)", - n, aj[inst.f1.j]); - - return l; -} - - -void -_initialize_convex_dep () -{ - add_com ("alias", class_support, alias_command, - "Add a new name for an existing command."); - - add_cmd ("base", class_vars, set_base_command, - "Change the integer output radix to 8, 10 or 16\n\ -or use just `set base' with no args to return to the ad-hoc default,\n\ -which is 16 for integers that look like addresses, 10 otherwise.", - &setlist); - - add_cmd ("pipeline", class_run, set_pipelining_command, - "Enable or disable overlapped execution of instructions.\n\ -With `set pipe off', exceptions are reported with\n\ -$pc pointing at the instruction after the faulting one.\n\ -The default is `set pipe on', which runs faster.", - &setlist); - - add_cmd ("parallel", class_run, set_parallel_command, - "Enable or disable multi-threaded execution of parallel code.\n\ -`set parallel off' means run the program on a single CPU.\n\ -`set parallel fixed' means run the program with all CPUs assigned to it.\n\ -`set parallel on' means run the program on any CPUs that are available.", - &setlist); - - add_com ("1cont", class_run, one_cont_command, - "Continue the program, activating only the current thread.\n\ -Args are the same as the `cont' command."); - - add_com ("thread", class_run, set_thread_command, - "Change the current thread, the one under scrutiny and control.\n\ -With no arg, show the active threads, the current one marked with *."); - - add_info ("threads", thread_info, - "List status of active threads."); - - add_info ("comm-registers", comm_registers_info, - "List communication registers and their contents.\n\ -A communication register name as argument means describe only that register.\n\ -An address as argument means describe the resource structure at that address.\n\ -`Locked' means that the register has been sent to but not yet received from."); - - add_info ("psw", psw_info, - "Display $ps, the processor status word, bit by bit.\n\ -An argument means display that value's interpretation as a psw."); - - add_cmd ("convex", no_class, 0, "Convex-specific commands.\n\ -32-bit registers $pc $ps $sp $ap $fp $a1-5 $s0-7 $v0-7 $vl $vs $vm $c0-63\n\ -64-bit registers $S0-7 $V0-7 $C0-63\n\ -\n\ -info threads display info on stopped threads waiting to signal\n\ -thread display list of active threads\n\ -thread N select thread N (its registers, stack, memory, etc.)\n\ -step, next, etc step selected thread only\n\ -1cont continue selected thread only\n\ -cont continue all threads\n\ -info comm-registers display contents of comm register(s) or a resource struct\n\ -info psw display processor status word $ps\n\ -set base N change integer radix used by `print' without a format\n\ -set pipeline off exceptions are precise, $pc points after the faulting insn\n\ -set pipeline on normal mode, $pc is somewhere ahead of faulting insn\n\ -set parallel off program runs on a single CPU\n\ -set parallel fixed all CPUs are assigned to the program\n\ -set parallel on normal mode, parallel execution on random available CPUs\n\ -", - &cmdlist); - -} +/* OBSOLETE /* Convex stuff for GDB. */ +/* OBSOLETE Copyright (C) 1990, 1991, 1996 Free Software Foundation, Inc. */ +/* OBSOLETE */ +/* OBSOLETE This file is part of GDB. */ +/* OBSOLETE */ +/* OBSOLETE This program is free software; you can redistribute it and/or modify */ +/* OBSOLETE it under the terms of the GNU General Public License as published by */ +/* OBSOLETE the Free Software Foundation; either version 2 of the License, or */ +/* OBSOLETE (at your option) any later version. */ +/* OBSOLETE */ +/* OBSOLETE This program is distributed in the hope that it will be useful, */ +/* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* OBSOLETE GNU General Public License for more details. */ +/* OBSOLETE */ +/* OBSOLETE You should have received a copy of the GNU General Public License */ +/* OBSOLETE along with this program; if not, write to the Free Software */ +/* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #include "defs.h" */ +/* OBSOLETE #include "command.h" */ +/* OBSOLETE #include "symtab.h" */ +/* OBSOLETE #include "value.h" */ +/* OBSOLETE #include "frame.h" */ +/* OBSOLETE #include "inferior.h" */ +/* OBSOLETE #include "wait.h" */ +/* OBSOLETE */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE */ +/* OBSOLETE #include "gdbcore.h" */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include "gdb_stat.h" */ +/* OBSOLETE #include */ +/* OBSOLETE */ +/* OBSOLETE #include "gdbcmd.h" */ +/* OBSOLETE */ +/* OBSOLETE CORE_ADDR */ +/* OBSOLETE convex_skip_prologue (pc) */ +/* OBSOLETE CORE_ADDR pc; */ +/* OBSOLETE { */ +/* OBSOLETE int op, ix; */ +/* OBSOLETE op = read_memory_integer (pc, 2); */ +/* OBSOLETE if ((op & 0xffc7) == 0x5ac0) */ +/* OBSOLETE pc += 2; */ +/* OBSOLETE else if (op == 0x1580) */ +/* OBSOLETE pc += 4; */ +/* OBSOLETE else if (op == 0x15c0) */ +/* OBSOLETE pc += 6; */ +/* OBSOLETE if ((read_memory_integer (pc, 2) & 0xfff8) == 0x7c40 */ +/* OBSOLETE && (read_memory_integer (pc + 2, 2) & 0xfff8) == 0x1240 */ +/* OBSOLETE && (read_memory_integer (pc + 8, 2) & 0xfff8) == 0x7c48) */ +/* OBSOLETE pc += 10; */ +/* OBSOLETE if (read_memory_integer (pc, 2) == 0x1240) */ +/* OBSOLETE pc += 6; */ +/* OBSOLETE for (;;) */ +/* OBSOLETE { */ +/* OBSOLETE op = read_memory_integer (pc, 2); */ +/* OBSOLETE ix = (op >> 3) & 7; */ +/* OBSOLETE if (ix != 6) */ +/* OBSOLETE break; */ +/* OBSOLETE if ((op & 0xfcc0) == 0x3000) */ +/* OBSOLETE pc += 4; */ +/* OBSOLETE else if ((op & 0xfcc0) == 0x3040) */ +/* OBSOLETE pc += 6; */ +/* OBSOLETE else if ((op & 0xfcc0) == 0x2800) */ +/* OBSOLETE pc += 4; */ +/* OBSOLETE else if ((op & 0xfcc0) == 0x2840) */ +/* OBSOLETE pc += 6; */ +/* OBSOLETE else */ +/* OBSOLETE break; */ +/* OBSOLETE } */ +/* OBSOLETE return pc; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE int */ +/* OBSOLETE convex_frameless_function_invocation (fi) */ +/* OBSOLETE struct frame_info *fi; */ +/* OBSOLETE { */ +/* OBSOLETE int frameless; */ +/* OBSOLETE extern CORE_ADDR text_start, text_end; */ +/* OBSOLETE CORE_ADDR call_addr = SAVED_PC_AFTER_CALL (FI); */ +/* OBSOLETE frameless = (call_addr >= text_start && call_addr < text_end */ +/* OBSOLETE && read_memory_integer (call_addr - 6, 1) == 0x22); */ +/* OBSOLETE return frameless; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE int */ +/* OBSOLETE convex_frame_num_args (fi) */ +/* OBSOLETE struct frame_info *fi; */ +/* OBSOLETE { */ +/* OBSOLETE int numargs = read_memory_integer (FRAME_ARGS_ADDRESS (fi) - 4, 4); */ +/* OBSOLETE if (numargs < 0 || numargs >= 256) */ +/* OBSOLETE numargs = -1; */ +/* OBSOLETE return numargs; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE exec_file_command (filename, from_tty) */ +/* OBSOLETE char *filename; */ +/* OBSOLETE int from_tty; */ +/* OBSOLETE { */ +/* OBSOLETE int val; */ +/* OBSOLETE int n; */ +/* OBSOLETE struct stat st_exec; */ +/* OBSOLETE */ +/* OBSOLETE /* Eliminate all traces of old exec file. */ +/* OBSOLETE Mark text segment as empty. *x/ */ +/* OBSOLETE */ +/* OBSOLETE if (execfile) */ +/* OBSOLETE free (execfile); */ +/* OBSOLETE execfile = 0; */ +/* OBSOLETE data_start = 0; */ +/* OBSOLETE data_end = 0; */ +/* OBSOLETE text_start = 0; */ +/* OBSOLETE text_end = 0; */ +/* OBSOLETE exec_data_start = 0; */ +/* OBSOLETE exec_data_end = 0; */ +/* OBSOLETE if (execchan >= 0) */ +/* OBSOLETE close (execchan); */ +/* OBSOLETE execchan = -1; */ +/* OBSOLETE */ +/* OBSOLETE n_exec = 0; */ +/* OBSOLETE */ +/* OBSOLETE /* Now open and digest the file the user requested, if any. *x/ */ +/* OBSOLETE */ +/* OBSOLETE if (filename) */ +/* OBSOLETE { */ +/* OBSOLETE filename = tilde_expand (filename); */ +/* OBSOLETE make_cleanup (free, filename); */ +/* OBSOLETE */ +/* OBSOLETE execchan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0, */ +/* OBSOLETE &execfile); */ +/* OBSOLETE if (execchan < 0) */ +/* OBSOLETE perror_with_name (filename); */ +/* OBSOLETE */ +/* OBSOLETE if (myread (execchan, &filehdr, sizeof filehdr) < 0) */ +/* OBSOLETE perror_with_name (filename); */ +/* OBSOLETE */ +/* OBSOLETE if (! IS_SOFF_MAGIC (filehdr.h_magic)) */ +/* OBSOLETE error ("%s: not an executable file.", filename); */ +/* OBSOLETE */ +/* OBSOLETE if (myread (execchan, &opthdr, filehdr.h_opthdr) <= 0) */ +/* OBSOLETE perror_with_name (filename); */ +/* OBSOLETE */ +/* OBSOLETE /* Read through the section headers. */ +/* OBSOLETE For text, data, etc, record an entry in the exec file map. */ +/* OBSOLETE Record text_start and text_end. *x/ */ +/* OBSOLETE */ +/* OBSOLETE lseek (execchan, (long) filehdr.h_scnptr, 0); */ +/* OBSOLETE */ +/* OBSOLETE for (n = 0; n < filehdr.h_nscns; n++) */ +/* OBSOLETE { */ +/* OBSOLETE if (myread (execchan, &scnhdr, sizeof scnhdr) < 0) */ +/* OBSOLETE perror_with_name (filename); */ +/* OBSOLETE */ +/* OBSOLETE if ((scnhdr.s_flags & S_TYPMASK) >= S_TEXT */ +/* OBSOLETE && (scnhdr.s_flags & S_TYPMASK) <= S_COMON) */ +/* OBSOLETE { */ +/* OBSOLETE exec_map[n_exec].mem_addr = scnhdr.s_vaddr; */ +/* OBSOLETE exec_map[n_exec].mem_end = scnhdr.s_vaddr + scnhdr.s_size; */ +/* OBSOLETE exec_map[n_exec].file_addr = scnhdr.s_scnptr; */ +/* OBSOLETE exec_map[n_exec].type = scnhdr.s_flags & S_TYPMASK; */ +/* OBSOLETE n_exec++; */ +/* OBSOLETE */ +/* OBSOLETE if ((scnhdr.s_flags & S_TYPMASK) == S_TEXT) */ +/* OBSOLETE { */ +/* OBSOLETE text_start = scnhdr.s_vaddr; */ +/* OBSOLETE text_end = scnhdr.s_vaddr + scnhdr.s_size; */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE fstat (execchan, &st_exec); */ +/* OBSOLETE exec_mtime = st_exec.st_mtime; */ +/* OBSOLETE */ +/* OBSOLETE validate_files (); */ +/* OBSOLETE } */ +/* OBSOLETE else if (from_tty) */ +/* OBSOLETE printf_filtered ("No executable file now.\n"); */ +/* OBSOLETE */ +/* OBSOLETE /* Tell display code (if any) about the changed file name. *x/ */ +/* OBSOLETE if (exec_file_display_hook) */ +/* OBSOLETE (*exec_file_display_hook) (filename); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE #if 0 */ +/* OBSOLETE /* Read data from SOFF exec or core file. */ +/* OBSOLETE Return 0 on success, EIO if address out of bounds. *x/ */ +/* OBSOLETE */ +/* OBSOLETE int */ +/* OBSOLETE xfer_core_file (memaddr, myaddr, len) */ +/* OBSOLETE CORE_ADDR memaddr; */ +/* OBSOLETE char *myaddr; */ +/* OBSOLETE int len; */ +/* OBSOLETE { */ +/* OBSOLETE register int i; */ +/* OBSOLETE register int n; */ +/* OBSOLETE register int val; */ +/* OBSOLETE int xferchan; */ +/* OBSOLETE char **xferfile; */ +/* OBSOLETE int fileptr; */ +/* OBSOLETE int returnval = 0; */ +/* OBSOLETE */ +/* OBSOLETE while (len > 0) */ +/* OBSOLETE { */ +/* OBSOLETE xferfile = 0; */ +/* OBSOLETE xferchan = 0; */ +/* OBSOLETE */ +/* OBSOLETE /* Determine which file the next bunch of addresses reside in, */ +/* OBSOLETE and where in the file. Set the file's read/write pointer */ +/* OBSOLETE to point at the proper place for the desired address */ +/* OBSOLETE and set xferfile and xferchan for the correct file. */ +/* OBSOLETE If desired address is nonexistent, leave them zero. */ +/* OBSOLETE i is set to the number of bytes that can be handled */ +/* OBSOLETE along with the next address. *x/ */ +/* OBSOLETE */ +/* OBSOLETE i = len; */ +/* OBSOLETE */ +/* OBSOLETE for (n = 0; n < n_core; n++) */ +/* OBSOLETE { */ +/* OBSOLETE if (memaddr >= core_map[n].mem_addr && memaddr < core_map[n].mem_end */ +/* OBSOLETE && (core_map[n].thread == -1 */ +/* OBSOLETE || core_map[n].thread == inferior_thread)) */ +/* OBSOLETE { */ +/* OBSOLETE i = min (len, core_map[n].mem_end - memaddr); */ +/* OBSOLETE fileptr = core_map[n].file_addr + memaddr - core_map[n].mem_addr; */ +/* OBSOLETE if (core_map[n].file_addr) */ +/* OBSOLETE { */ +/* OBSOLETE xferfile = &corefile; */ +/* OBSOLETE xferchan = corechan; */ +/* OBSOLETE } */ +/* OBSOLETE break; */ +/* OBSOLETE } */ +/* OBSOLETE else if (core_map[n].mem_addr >= memaddr */ +/* OBSOLETE && core_map[n].mem_addr < memaddr + i) */ +/* OBSOLETE i = core_map[n].mem_addr - memaddr; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE if (!xferfile) */ +/* OBSOLETE for (n = 0; n < n_exec; n++) */ +/* OBSOLETE { */ +/* OBSOLETE if (memaddr >= exec_map[n].mem_addr */ +/* OBSOLETE && memaddr < exec_map[n].mem_end) */ +/* OBSOLETE { */ +/* OBSOLETE i = min (len, exec_map[n].mem_end - memaddr); */ +/* OBSOLETE fileptr = exec_map[n].file_addr + memaddr */ +/* OBSOLETE - exec_map[n].mem_addr; */ +/* OBSOLETE if (exec_map[n].file_addr) */ +/* OBSOLETE { */ +/* OBSOLETE xferfile = &execfile; */ +/* OBSOLETE xferchan = execchan; */ +/* OBSOLETE } */ +/* OBSOLETE break; */ +/* OBSOLETE } */ +/* OBSOLETE else if (exec_map[n].mem_addr >= memaddr */ +/* OBSOLETE && exec_map[n].mem_addr < memaddr + i) */ +/* OBSOLETE i = exec_map[n].mem_addr - memaddr; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Now we know which file to use. */ +/* OBSOLETE Set up its pointer and transfer the data. *x/ */ +/* OBSOLETE if (xferfile) */ +/* OBSOLETE { */ +/* OBSOLETE if (*xferfile == 0) */ +/* OBSOLETE if (xferfile == &execfile) */ +/* OBSOLETE error ("No program file to examine."); */ +/* OBSOLETE else */ +/* OBSOLETE error ("No core dump file or running program to examine."); */ +/* OBSOLETE val = lseek (xferchan, fileptr, 0); */ +/* OBSOLETE if (val < 0) */ +/* OBSOLETE perror_with_name (*xferfile); */ +/* OBSOLETE val = myread (xferchan, myaddr, i); */ +/* OBSOLETE if (val < 0) */ +/* OBSOLETE perror_with_name (*xferfile); */ +/* OBSOLETE } */ +/* OBSOLETE /* If this address is for nonexistent memory, */ +/* OBSOLETE read zeros if reading, or do nothing if writing. *x/ */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE memset (myaddr, '\0', i); */ +/* OBSOLETE returnval = EIO; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE memaddr += i; */ +/* OBSOLETE myaddr += i; */ +/* OBSOLETE len -= i; */ +/* OBSOLETE } */ +/* OBSOLETE return returnval; */ +/* OBSOLETE } */ +/* OBSOLETE #endif */ +/* OBSOLETE */ +/* OBSOLETE /* Here from info files command to print an address map. *x/ */ +/* OBSOLETE */ +/* OBSOLETE print_maps () */ +/* OBSOLETE { */ +/* OBSOLETE struct pmap ptrs[200]; */ +/* OBSOLETE int n; */ +/* OBSOLETE */ +/* OBSOLETE /* ID strings for core and executable file sections *x/ */ +/* OBSOLETE */ +/* OBSOLETE static char *idstr[] = */ +/* OBSOLETE { */ +/* OBSOLETE "0", "text", "data", "tdata", "bss", "tbss", */ +/* OBSOLETE "common", "ttext", "ctx", "tctx", "10", "11", "12", */ +/* OBSOLETE }; */ +/* OBSOLETE */ +/* OBSOLETE for (n = 0; n < n_core; n++) */ +/* OBSOLETE { */ +/* OBSOLETE core_map[n].which = 0; */ +/* OBSOLETE ptrs[n] = core_map[n]; */ +/* OBSOLETE } */ +/* OBSOLETE for (n = 0; n < n_exec; n++) */ +/* OBSOLETE { */ +/* OBSOLETE exec_map[n].which = 1; */ +/* OBSOLETE ptrs[n_core+n] = exec_map[n]; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE qsort (ptrs, n_core + n_exec, sizeof *ptrs, ptr_cmp); */ +/* OBSOLETE */ +/* OBSOLETE for (n = 0; n < n_core + n_exec; n++) */ +/* OBSOLETE { */ +/* OBSOLETE struct pmap *p = &ptrs[n]; */ +/* OBSOLETE if (n > 0) */ +/* OBSOLETE { */ +/* OBSOLETE if (p->mem_addr < ptrs[n-1].mem_end) */ +/* OBSOLETE p->mem_addr = ptrs[n-1].mem_end; */ +/* OBSOLETE if (p->mem_addr >= p->mem_end) */ +/* OBSOLETE continue; */ +/* OBSOLETE } */ +/* OBSOLETE printf_filtered ("%08x .. %08x %-6s %s\n", */ +/* OBSOLETE p->mem_addr, p->mem_end, idstr[p->type], */ +/* OBSOLETE p->which ? execfile : corefile); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Compare routine to put file sections in order. */ +/* OBSOLETE Sort into increasing order on address, and put core file sections */ +/* OBSOLETE before exec file sections if both files contain the same addresses. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static ptr_cmp (a, b) */ +/* OBSOLETE struct pmap *a, *b; */ +/* OBSOLETE { */ +/* OBSOLETE if (a->mem_addr != b->mem_addr) return a->mem_addr - b->mem_addr; */ +/* OBSOLETE return a->which - b->which; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Trapped internal variables are used to handle special registers. */ +/* OBSOLETE A trapped i.v. calls a hook here every time it is dereferenced, */ +/* OBSOLETE to provide a new value for the variable, and it calls a hook here */ +/* OBSOLETE when a new value is assigned, to do something with the value. */ +/* OBSOLETE */ +/* OBSOLETE The vector registers are $vl, $vs, $vm, $vN, $VN (N in 0..7). */ +/* OBSOLETE The communication registers are $cN, $CN (N in 0..63). */ +/* OBSOLETE They not handled as regular registers because it's expensive to */ +/* OBSOLETE read them, and their size varies, and they have too many names. *x/ */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE /* Return 1 if NAME is a trapped internal variable, else 0. *x/ */ +/* OBSOLETE */ +/* OBSOLETE int */ +/* OBSOLETE is_trapped_internalvar (name) */ +/* OBSOLETE char *name; */ +/* OBSOLETE { */ +/* OBSOLETE if ((name[0] == 'c' || name[0] == 'C') */ +/* OBSOLETE && name[1] >= '0' && name[1] <= '9' */ +/* OBSOLETE && (name[2] == '\0' */ +/* OBSOLETE || (name[2] >= '0' && name[2] <= '9' */ +/* OBSOLETE && name[3] == '\0' && name[1] != '0')) */ +/* OBSOLETE && atoi (&name[1]) < 64) return 1; */ +/* OBSOLETE */ +/* OBSOLETE if ((name[0] == 'v' || name[0] == 'V') */ +/* OBSOLETE && (((name[1] & -8) == '0' && name[2] == '\0') */ +/* OBSOLETE || STREQ (name, "vl") */ +/* OBSOLETE || STREQ (name, "vs") */ +/* OBSOLETE || STREQ (name, "vm"))) */ +/* OBSOLETE return 1; */ +/* OBSOLETE else return 0; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Return the value of trapped internal variable VAR *x/ */ +/* OBSOLETE */ +/* OBSOLETE value */ +/* OBSOLETE value_of_trapped_internalvar (var) */ +/* OBSOLETE struct internalvar *var; */ +/* OBSOLETE { */ +/* OBSOLETE char *name = var->name; */ +/* OBSOLETE value val; */ +/* OBSOLETE struct type *type; */ +/* OBSOLETE struct type *range_type; */ +/* OBSOLETE long len = *read_vector_register (VL_REGNUM); */ +/* OBSOLETE if (len <= 0 || len > 128) len = 128; */ +/* OBSOLETE */ +/* OBSOLETE if (STREQ (name, "vl")) */ +/* OBSOLETE { */ +/* OBSOLETE val = value_from_longest (builtin_type_int, */ +/* OBSOLETE (LONGEST) *read_vector_register_1 (VL_REGNUM)); */ +/* OBSOLETE } */ +/* OBSOLETE else if (STREQ (name, "vs")) */ +/* OBSOLETE { */ +/* OBSOLETE val = value_from_longest (builtin_type_int, */ +/* OBSOLETE (LONGEST) *read_vector_register_1 (VS_REGNUM)); */ +/* OBSOLETE } */ +/* OBSOLETE else if (STREQ (name, "vm")) */ +/* OBSOLETE { */ +/* OBSOLETE long vm[4]; */ +/* OBSOLETE long i, *p; */ +/* OBSOLETE memcpy (vm, read_vector_register_1 (VM_REGNUM), sizeof vm); */ +/* OBSOLETE range_type = */ +/* OBSOLETE create_range_type ((struct type *) NULL, builtin_type_int, 0, len - 1); */ +/* OBSOLETE type = */ +/* OBSOLETE create_array_type ((struct type *) NULL, builtin_type_int, range_type); */ +/* OBSOLETE val = allocate_value (type); */ +/* OBSOLETE p = (long *) VALUE_CONTENTS (val); */ +/* OBSOLETE for (i = 0; i < len; i++) */ +/* OBSOLETE *p++ = !! (vm[3 - (i >> 5)] & (1 << (i & 037))); */ +/* OBSOLETE } */ +/* OBSOLETE else if (name[0] == 'V') */ +/* OBSOLETE { */ +/* OBSOLETE range_type = */ +/* OBSOLETE create_range_type ((struct type *) NULL, builtin_type_int 0, len - 1); */ +/* OBSOLETE type = */ +/* OBSOLETE create_array_type ((struct type *) NULL, builtin_type_long_long, */ +/* OBSOLETE range_type); */ +/* OBSOLETE val = allocate_value (type); */ +/* OBSOLETE memcpy (VALUE_CONTENTS (val), */ +/* OBSOLETE read_vector_register_1 (name[1] - '0'), */ +/* OBSOLETE TYPE_LENGTH (type)); */ +/* OBSOLETE } */ +/* OBSOLETE else if (name[0] == 'v') */ +/* OBSOLETE { */ +/* OBSOLETE long *p1, *p2; */ +/* OBSOLETE range_type = */ +/* OBSOLETE create_range_type ((struct type *) NULL, builtin_type_int 0, len - 1); */ +/* OBSOLETE type = */ +/* OBSOLETE create_array_type ((struct type *) NULL, builtin_type_long, */ +/* OBSOLETE range_type); */ +/* OBSOLETE val = allocate_value (type); */ +/* OBSOLETE p1 = read_vector_register_1 (name[1] - '0'); */ +/* OBSOLETE p2 = (long *) VALUE_CONTENTS (val); */ +/* OBSOLETE while (--len >= 0) {p1++; *p2++ = *p1++;} */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE else if (name[0] == 'c') */ +/* OBSOLETE val = value_from_longest (builtin_type_int, */ +/* OBSOLETE read_comm_register (atoi (&name[1]))); */ +/* OBSOLETE else if (name[0] == 'C') */ +/* OBSOLETE val = value_from_longest (builtin_type_long_long, */ +/* OBSOLETE read_comm_register (atoi (&name[1]))); */ +/* OBSOLETE */ +/* OBSOLETE VALUE_LVAL (val) = lval_internalvar; */ +/* OBSOLETE VALUE_INTERNALVAR (val) = var; */ +/* OBSOLETE return val; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Handle a new value assigned to a trapped internal variable *x/ */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE set_trapped_internalvar (var, val, bitpos, bitsize, offset) */ +/* OBSOLETE struct internalvar *var; */ +/* OBSOLETE value val; */ +/* OBSOLETE int bitpos, bitsize, offset; */ +/* OBSOLETE { */ +/* OBSOLETE char *name = var->name; */ +/* OBSOLETE long long newval = value_as_long (val); */ +/* OBSOLETE */ +/* OBSOLETE if (STREQ (name, "vl")) */ +/* OBSOLETE write_vector_register (VL_REGNUM, 0, newval); */ +/* OBSOLETE else if (STREQ (name, "vs")) */ +/* OBSOLETE write_vector_register (VS_REGNUM, 0, newval); */ +/* OBSOLETE else if (name[0] == 'c' || name[0] == 'C') */ +/* OBSOLETE write_comm_register (atoi (&name[1]), newval); */ +/* OBSOLETE else if (STREQ (name, "vm")) */ +/* OBSOLETE error ("can't assign to $vm"); */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE offset /= bitsize / 8; */ +/* OBSOLETE write_vector_register (name[1] - '0', offset, newval); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Print an integer value when no format was specified. gdb normally */ +/* OBSOLETE prints these values in decimal, but the the leading 0x80000000 of */ +/* OBSOLETE pointers produces intolerable 10-digit negative numbers. */ +/* OBSOLETE If it looks like an address, print it in hex instead. *x/ */ +/* OBSOLETE */ +/* OBSOLETE decout (stream, type, val) */ +/* OBSOLETE GDB_FILE *stream; */ +/* OBSOLETE struct type *type; */ +/* OBSOLETE LONGEST val; */ +/* OBSOLETE { */ +/* OBSOLETE long lv = val; */ +/* OBSOLETE */ +/* OBSOLETE switch (output_radix) */ +/* OBSOLETE { */ +/* OBSOLETE case 0: */ +/* OBSOLETE if ((lv == val || (unsigned) lv == val) */ +/* OBSOLETE && ((lv & 0xf0000000) == 0x80000000 */ +/* OBSOLETE || ((lv & 0xf0000000) == 0xf0000000 && lv < STACK_END_ADDR))) */ +/* OBSOLETE { */ +/* OBSOLETE print_longest (stream, "x", 0, val); */ +/* OBSOLETE return; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE case 10: */ +/* OBSOLETE print_longest (stream, TYPE_UNSIGNED (type) ? "u" : "d", 0, val); */ +/* OBSOLETE return; */ +/* OBSOLETE */ +/* OBSOLETE case 8: */ +/* OBSOLETE print_longest (stream, "o", 0, val); */ +/* OBSOLETE return; */ +/* OBSOLETE */ +/* OBSOLETE case 16: */ +/* OBSOLETE print_longest (stream, "x", 0, val); */ +/* OBSOLETE return; */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Change the default output radix to 10 or 16, or set it to 0 (heuristic). */ +/* OBSOLETE This command is mostly obsolete now that the print command allows */ +/* OBSOLETE formats to apply to aggregates, but is still handy occasionally. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE set_base_command (arg) */ +/* OBSOLETE char *arg; */ +/* OBSOLETE { */ +/* OBSOLETE int new_radix; */ +/* OBSOLETE */ +/* OBSOLETE if (!arg) */ +/* OBSOLETE output_radix = 0; */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE new_radix = atoi (arg); */ +/* OBSOLETE if (new_radix != 10 && new_radix != 16 && new_radix != 8) */ +/* OBSOLETE error ("base must be 8, 10 or 16, or null"); */ +/* OBSOLETE else output_radix = new_radix; */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Turn pipelining on or off in the inferior. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE set_pipelining_command (arg) */ +/* OBSOLETE char *arg; */ +/* OBSOLETE { */ +/* OBSOLETE if (!arg) */ +/* OBSOLETE { */ +/* OBSOLETE sequential = !sequential; */ +/* OBSOLETE printf_filtered ("%s\n", sequential ? "off" : "on"); */ +/* OBSOLETE } */ +/* OBSOLETE else if (STREQ (arg, "on")) */ +/* OBSOLETE sequential = 0; */ +/* OBSOLETE else if (STREQ (arg, "off")) */ +/* OBSOLETE sequential = 1; */ +/* OBSOLETE else error ("valid args are `on', to allow instructions to overlap, or\n\ */ +/* OBSOLETE `off', to prevent it and thereby pinpoint exceptions."); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Enable, disable, or force parallel execution in the inferior. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE set_parallel_command (arg) */ +/* OBSOLETE char *arg; */ +/* OBSOLETE { */ +/* OBSOLETE struct rlimit rl; */ +/* OBSOLETE int prevparallel = parallel; */ +/* OBSOLETE */ +/* OBSOLETE if (!strncmp (arg, "fixed", strlen (arg))) */ +/* OBSOLETE parallel = 2; */ +/* OBSOLETE else if (STREQ (arg, "on")) */ +/* OBSOLETE parallel = 1; */ +/* OBSOLETE else if (STREQ (arg, "off")) */ +/* OBSOLETE parallel = 0; */ +/* OBSOLETE else error ("valid args are `on', to allow multiple threads, or\n\ */ +/* OBSOLETE `fixed', to force multiple threads, or\n\ */ +/* OBSOLETE `off', to run with one thread only."); */ +/* OBSOLETE */ +/* OBSOLETE if ((prevparallel == 0) != (parallel == 0) && inferior_pid) */ +/* OBSOLETE printf_filtered ("will take effect at next run.\n"); */ +/* OBSOLETE */ +/* OBSOLETE getrlimit (RLIMIT_CONCUR, &rl); */ +/* OBSOLETE rl.rlim_cur = parallel ? rl.rlim_max : 1; */ +/* OBSOLETE setrlimit (RLIMIT_CONCUR, &rl); */ +/* OBSOLETE */ +/* OBSOLETE if (inferior_pid) */ +/* OBSOLETE set_fixed_scheduling (inferior_pid, parallel == 2); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Add a new name for an existing command. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE alias_command (arg) */ +/* OBSOLETE char *arg; */ +/* OBSOLETE { */ +/* OBSOLETE static char *aliaserr = "usage is `alias NEW OLD', no args allowed"; */ +/* OBSOLETE char *newname = arg; */ +/* OBSOLETE struct cmd_list_element *new, *old; */ +/* OBSOLETE */ +/* OBSOLETE if (!arg) */ +/* OBSOLETE error_no_arg ("newname oldname"); */ +/* OBSOLETE */ +/* OBSOLETE new = lookup_cmd (&arg, cmdlist, "", -1); */ +/* OBSOLETE if (new && !strncmp (newname, new->name, strlen (new->name))) */ +/* OBSOLETE { */ +/* OBSOLETE newname = new->name; */ +/* OBSOLETE if (!(*arg == '-' */ +/* OBSOLETE || (*arg >= 'a' && *arg <= 'z') */ +/* OBSOLETE || (*arg >= 'A' && *arg <= 'Z') */ +/* OBSOLETE || (*arg >= '0' && *arg <= '9'))) */ +/* OBSOLETE error (aliaserr); */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE arg = newname; */ +/* OBSOLETE while (*arg == '-' */ +/* OBSOLETE || (*arg >= 'a' && *arg <= 'z') */ +/* OBSOLETE || (*arg >= 'A' && *arg <= 'Z') */ +/* OBSOLETE || (*arg >= '0' && *arg <= '9')) */ +/* OBSOLETE arg++; */ +/* OBSOLETE if (*arg != ' ' && *arg != '\t') */ +/* OBSOLETE error (aliaserr); */ +/* OBSOLETE *arg = '\0'; */ +/* OBSOLETE arg++; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE old = lookup_cmd (&arg, cmdlist, "", 0); */ +/* OBSOLETE */ +/* OBSOLETE if (*arg != '\0') */ +/* OBSOLETE error (aliaserr); */ +/* OBSOLETE */ +/* OBSOLETE if (new && !strncmp (newname, new->name, strlen (new->name))) */ +/* OBSOLETE { */ +/* OBSOLETE char *tem; */ +/* OBSOLETE if (new->class == (int) class_user || new->class == (int) class_alias) */ +/* OBSOLETE tem = "Redefine command \"%s\"? "; */ +/* OBSOLETE else */ +/* OBSOLETE tem = "Really redefine built-in command \"%s\"? "; */ +/* OBSOLETE if (!query (tem, new->name)) */ +/* OBSOLETE error ("Command \"%s\" not redefined.", new->name); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE add_com (newname, class_alias, old->function, old->doc); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE /* Print the current thread number, and any threads with signals in the */ +/* OBSOLETE queue. *x/ */ +/* OBSOLETE */ +/* OBSOLETE thread_info () */ +/* OBSOLETE { */ +/* OBSOLETE struct threadpid *p; */ +/* OBSOLETE */ +/* OBSOLETE if (have_inferior_p ()) */ +/* OBSOLETE { */ +/* OBSOLETE ps.pi_buffer = (char *) &comm_registers; */ +/* OBSOLETE ps.pi_nbytes = sizeof comm_registers; */ +/* OBSOLETE ps.pi_offset = 0; */ +/* OBSOLETE ps.pi_thread = inferior_thread; */ +/* OBSOLETE ioctl (inferior_fd, PIXRDCREGS, &ps); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* FIXME: stop_signal is from target.h but stop_sigcode is a */ +/* OBSOLETE convex-specific thing. *x/ */ +/* OBSOLETE printf_filtered ("Current thread %d stopped with signal %d.%d (%s).\n", */ +/* OBSOLETE inferior_thread, stop_signal, stop_sigcode, */ +/* OBSOLETE subsig_name (stop_signal, stop_sigcode)); */ +/* OBSOLETE */ +/* OBSOLETE for (p = signal_stack; p->pid; p--) */ +/* OBSOLETE printf_filtered ("Thread %d stopped with signal %d.%d (%s).\n", */ +/* OBSOLETE p->thread, p->signo, p->subsig, */ +/* OBSOLETE subsig_name (p->signo, p->subsig)); */ +/* OBSOLETE */ +/* OBSOLETE if (iscrlbit (comm_registers.crctl.lbits.cc, 64+13)) */ +/* OBSOLETE printf_filtered ("New thread start pc %#x\n", */ +/* OBSOLETE (long) (comm_registers.crreg.pcpsw >> 32)); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Return string describing a signal.subcode number *x/ */ +/* OBSOLETE */ +/* OBSOLETE static char * */ +/* OBSOLETE subsig_name (signo, subcode) */ +/* OBSOLETE int signo, subcode; */ +/* OBSOLETE { */ +/* OBSOLETE static char *subsig4[] = { */ +/* OBSOLETE "error exit", "privileged instruction", "unknown", */ +/* OBSOLETE "unknown", "undefined opcode", */ +/* OBSOLETE 0}; */ +/* OBSOLETE static char *subsig5[] = {0, */ +/* OBSOLETE "breakpoint", "single step", "fork trap", "exec trap", "pfork trap", */ +/* OBSOLETE "join trap", "idle trap", "last thread", "wfork trap", */ +/* OBSOLETE "process breakpoint", "trap instruction", */ +/* OBSOLETE 0}; */ +/* OBSOLETE static char *subsig8[] = {0, */ +/* OBSOLETE "int overflow", "int divide check", "float overflow", */ +/* OBSOLETE "float divide check", "float underflow", "reserved operand", */ +/* OBSOLETE "sqrt error", "exp error", "ln error", "sin error", "cos error", */ +/* OBSOLETE 0}; */ +/* OBSOLETE static char *subsig10[] = {0, */ +/* OBSOLETE "invalid inward ring address", "invalid outward ring call", */ +/* OBSOLETE "invalid inward ring return", "invalid syscall gate", */ +/* OBSOLETE "invalid rtn frame length", "invalid comm reg address", */ +/* OBSOLETE "invalid trap gate", */ +/* OBSOLETE 0}; */ +/* OBSOLETE static char *subsig11[] = {0, */ +/* OBSOLETE "read access denied", "write access denied", "execute access denied", */ +/* OBSOLETE "segment descriptor fault", "page table fault", "data reference fault", */ +/* OBSOLETE "i/o access denied", "levt pte invalid", */ +/* OBSOLETE 0}; */ +/* OBSOLETE */ +/* OBSOLETE static char **subsig_list[] = */ +/* OBSOLETE {0, 0, 0, 0, subsig4, subsig5, 0, 0, subsig8, 0, subsig10, subsig11, 0}; */ +/* OBSOLETE */ +/* OBSOLETE int i; */ +/* OBSOLETE char *p; */ +/* OBSOLETE */ +/* OBSOLETE if ((p = strsignal (signo)) == NULL) */ +/* OBSOLETE p = "unknown"; */ +/* OBSOLETE if (signo >= (sizeof subsig_list / sizeof *subsig_list) */ +/* OBSOLETE || !subsig_list[signo]) */ +/* OBSOLETE return p; */ +/* OBSOLETE for (i = 1; subsig_list[signo][i]; i++) */ +/* OBSOLETE if (i == subcode) */ +/* OBSOLETE return subsig_list[signo][subcode]; */ +/* OBSOLETE return p; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE /* Print a compact display of thread status, essentially x/i $pc */ +/* OBSOLETE for all active threads. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE threadstat () */ +/* OBSOLETE { */ +/* OBSOLETE int t; */ +/* OBSOLETE */ +/* OBSOLETE for (t = 0; t < n_threads; t++) */ +/* OBSOLETE if (thread_state[t] == PI_TALIVE) */ +/* OBSOLETE { */ +/* OBSOLETE printf_filtered ("%d%c %08x%c %d.%d ", t, */ +/* OBSOLETE (t == inferior_thread ? '*' : ' '), thread_pc[t], */ +/* OBSOLETE (thread_is_in_kernel[t] ? '#' : ' '), */ +/* OBSOLETE thread_signal[t], thread_sigcode[t]); */ +/* OBSOLETE print_insn (thread_pc[t], stdout); */ +/* OBSOLETE printf_filtered ("\n"); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Change the current thread to ARG. *x/ */ +/* OBSOLETE */ +/* OBSOLETE set_thread_command (arg) */ +/* OBSOLETE char *arg; */ +/* OBSOLETE { */ +/* OBSOLETE int thread; */ +/* OBSOLETE */ +/* OBSOLETE if (!arg) */ +/* OBSOLETE { */ +/* OBSOLETE threadstat (); */ +/* OBSOLETE return; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE thread = parse_and_eval_address (arg); */ +/* OBSOLETE */ +/* OBSOLETE if (thread < 0 || thread > n_threads || thread_state[thread] != PI_TALIVE) */ +/* OBSOLETE error ("no such thread."); */ +/* OBSOLETE */ +/* OBSOLETE select_thread (thread); */ +/* OBSOLETE */ +/* OBSOLETE stop_pc = read_pc (); */ +/* OBSOLETE flush_cached_frames (); */ +/* OBSOLETE select_frame (get_current_frame (), 0); */ +/* OBSOLETE print_stack_frame (selected_frame, selected_frame_level, -1); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Here on CONT command; gdb's dispatch address is changed to come here. */ +/* OBSOLETE Set global variable ALL_CONTINUE to tell resume() that it should */ +/* OBSOLETE start up all threads, and that a thread switch will not blow gdb's */ +/* OBSOLETE mind. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE convex_cont_command (proc_count_exp, from_tty) */ +/* OBSOLETE char *proc_count_exp; */ +/* OBSOLETE int from_tty; */ +/* OBSOLETE { */ +/* OBSOLETE all_continue = 1; */ +/* OBSOLETE cont_command (proc_count_exp, from_tty); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Here on 1CONT command. Resume only the current thread. *x/ */ +/* OBSOLETE */ +/* OBSOLETE one_cont_command (proc_count_exp, from_tty) */ +/* OBSOLETE char *proc_count_exp; */ +/* OBSOLETE int from_tty; */ +/* OBSOLETE { */ +/* OBSOLETE cont_command (proc_count_exp, from_tty); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Print the contents and lock bits of all communication registers, */ +/* OBSOLETE or just register ARG if ARG is a communication register, */ +/* OBSOLETE or the 3-word resource structure in memory at address ARG. *x/ */ +/* OBSOLETE */ +/* OBSOLETE comm_registers_info (arg) */ +/* OBSOLETE char *arg; */ +/* OBSOLETE { */ +/* OBSOLETE int i, regnum; */ +/* OBSOLETE */ +/* OBSOLETE if (arg) */ +/* OBSOLETE { */ +/* OBSOLETE if (sscanf (arg, "$c%d", ®num) == 1) { */ +/* OBSOLETE ; */ +/* OBSOLETE } else if (sscanf (arg, "$C%d", ®num) == 1) { */ +/* OBSOLETE ; */ +/* OBSOLETE } else { */ +/* OBSOLETE regnum = parse_and_eval_address (arg); */ +/* OBSOLETE if (regnum > 0) */ +/* OBSOLETE regnum &= ~0x8000; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE if (regnum >= 64) */ +/* OBSOLETE error ("%s: invalid register name.", arg); */ +/* OBSOLETE */ +/* OBSOLETE /* if we got a (user) address, examine the resource struct there *x/ */ +/* OBSOLETE */ +/* OBSOLETE if (regnum < 0) */ +/* OBSOLETE { */ +/* OBSOLETE static int buf[3]; */ +/* OBSOLETE read_memory (regnum, buf, sizeof buf); */ +/* OBSOLETE printf_filtered ("%08x %08x%08x%s\n", regnum, buf[1], buf[2], */ +/* OBSOLETE buf[0] & 0xff ? " locked" : ""); */ +/* OBSOLETE return; */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE ps.pi_buffer = (char *) &comm_registers; */ +/* OBSOLETE ps.pi_nbytes = sizeof comm_registers; */ +/* OBSOLETE ps.pi_offset = 0; */ +/* OBSOLETE ps.pi_thread = inferior_thread; */ +/* OBSOLETE ioctl (inferior_fd, PIXRDCREGS, &ps); */ +/* OBSOLETE */ +/* OBSOLETE for (i = 0; i < 64; i++) */ +/* OBSOLETE if (!arg || i == regnum) */ +/* OBSOLETE printf_filtered ("%2d 0x8%03x %016llx%s\n", i, i, */ +/* OBSOLETE comm_registers.crreg.r4[i], */ +/* OBSOLETE (iscrlbit (comm_registers.crctl.lbits.cc, i) */ +/* OBSOLETE ? " locked" : "")); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Print the psw *x/ */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE psw_info (arg) */ +/* OBSOLETE char *arg; */ +/* OBSOLETE { */ +/* OBSOLETE struct pswbit */ +/* OBSOLETE { */ +/* OBSOLETE int bit; */ +/* OBSOLETE int pos; */ +/* OBSOLETE char *text; */ +/* OBSOLETE }; */ +/* OBSOLETE */ +/* OBSOLETE static struct pswbit pswbit[] = */ +/* OBSOLETE { */ +/* OBSOLETE { 0x80000000, -1, "A carry" }, */ +/* OBSOLETE { 0x40000000, -1, "A integer overflow" }, */ +/* OBSOLETE { 0x20000000, -1, "A zero divide" }, */ +/* OBSOLETE { 0x10000000, -1, "Integer overflow enable" }, */ +/* OBSOLETE { 0x08000000, -1, "Trace" }, */ +/* OBSOLETE { 0x06000000, 25, "Frame length" }, */ +/* OBSOLETE { 0x01000000, -1, "Sequential" }, */ +/* OBSOLETE { 0x00800000, -1, "S carry" }, */ +/* OBSOLETE { 0x00400000, -1, "S integer overflow" }, */ +/* OBSOLETE { 0x00200000, -1, "S zero divide" }, */ +/* OBSOLETE { 0x00100000, -1, "Zero divide enable" }, */ +/* OBSOLETE { 0x00080000, -1, "Floating underflow" }, */ +/* OBSOLETE { 0x00040000, -1, "Floating overflow" }, */ +/* OBSOLETE { 0x00020000, -1, "Floating reserved operand" }, */ +/* OBSOLETE { 0x00010000, -1, "Floating zero divide" }, */ +/* OBSOLETE { 0x00008000, -1, "Floating error enable" }, */ +/* OBSOLETE { 0x00004000, -1, "Floating underflow enable" }, */ +/* OBSOLETE { 0x00002000, -1, "IEEE" }, */ +/* OBSOLETE { 0x00001000, -1, "Sequential stores" }, */ +/* OBSOLETE { 0x00000800, -1, "Intrinsic error" }, */ +/* OBSOLETE { 0x00000400, -1, "Intrinsic error enable" }, */ +/* OBSOLETE { 0x00000200, -1, "Trace thread creates" }, */ +/* OBSOLETE { 0x00000100, -1, "Thread init trap" }, */ +/* OBSOLETE { 0x000000e0, 5, "Reserved" }, */ +/* OBSOLETE { 0x0000001f, 0, "Intrinsic error code" }, */ +/* OBSOLETE {0, 0, 0}, */ +/* OBSOLETE }; */ +/* OBSOLETE */ +/* OBSOLETE long psw; */ +/* OBSOLETE struct pswbit *p; */ +/* OBSOLETE */ +/* OBSOLETE if (arg) */ +/* OBSOLETE psw = parse_and_eval_address (arg); */ +/* OBSOLETE else */ +/* OBSOLETE psw = read_register (PS_REGNUM); */ +/* OBSOLETE */ +/* OBSOLETE for (p = pswbit; p->bit; p++) */ +/* OBSOLETE { */ +/* OBSOLETE if (p->pos < 0) */ +/* OBSOLETE printf_filtered ("%08x %s %s\n", p->bit, */ +/* OBSOLETE (psw & p->bit) ? "yes" : "no ", p->text); */ +/* OBSOLETE else */ +/* OBSOLETE printf_filtered ("%08x %3d %s\n", p->bit, */ +/* OBSOLETE (psw & p->bit) >> p->pos, p->text); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE #include "symtab.h" */ +/* OBSOLETE */ +/* OBSOLETE /* reg (fmt_field, inst_field) -- */ +/* OBSOLETE the {first,second,third} operand of instruction as fmt_field = [ijk] */ +/* OBSOLETE gets the value of the field from the [ijk] position of the instruction *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define reg(a,b) ((char (*)[3])(op[fmt->a]))[inst.f0.b] */ +/* OBSOLETE */ +/* OBSOLETE /* lit (fmt_field) -- field [ijk] is a literal (PSW, VL, eg) *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define lit(i) op[fmt->i] */ +/* OBSOLETE */ +/* OBSOLETE /* aj[j] -- name for A register j *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define aj ((char (*)[3])(op[A])) */ +/* OBSOLETE */ +/* OBSOLETE union inst { */ +/* OBSOLETE struct { */ +/* OBSOLETE unsigned : 7; */ +/* OBSOLETE unsigned i : 3; */ +/* OBSOLETE unsigned j : 3; */ +/* OBSOLETE unsigned k : 3; */ +/* OBSOLETE unsigned : 16; */ +/* OBSOLETE unsigned : 32; */ +/* OBSOLETE } f0; */ +/* OBSOLETE struct { */ +/* OBSOLETE unsigned : 8; */ +/* OBSOLETE unsigned indir : 1; */ +/* OBSOLETE unsigned len : 1; */ +/* OBSOLETE unsigned j : 3; */ +/* OBSOLETE unsigned k : 3; */ +/* OBSOLETE unsigned : 16; */ +/* OBSOLETE unsigned : 32; */ +/* OBSOLETE } f1; */ +/* OBSOLETE unsigned char byte[8]; */ +/* OBSOLETE unsigned short half[4]; */ +/* OBSOLETE char signed_byte[8]; */ +/* OBSOLETE short signed_half[4]; */ +/* OBSOLETE }; */ +/* OBSOLETE */ +/* OBSOLETE struct opform { */ +/* OBSOLETE int mask; /* opcode mask *x/ */ +/* OBSOLETE int shift; /* opcode align *x/ */ +/* OBSOLETE struct formstr *formstr[3]; /* ST, E0, E1 *x/ */ +/* OBSOLETE }; */ +/* OBSOLETE */ +/* OBSOLETE struct formstr { */ +/* OBSOLETE unsigned lop:8, rop:5; /* opcode *x/ */ +/* OBSOLETE unsigned fmt:5; /* inst format *x/ */ +/* OBSOLETE unsigned i:5, j:5, k:2; /* operand formats *x/ */ +/* OBSOLETE }; */ +/* OBSOLETE */ +/* OBSOLETE #include "opcode/convex.h" */ +/* OBSOLETE */ +/* OBSOLETE CONST unsigned char formdecode [] = { */ +/* OBSOLETE 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, */ +/* OBSOLETE 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, */ +/* OBSOLETE 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, */ +/* OBSOLETE 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, */ +/* OBSOLETE 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, */ +/* OBSOLETE 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, */ +/* OBSOLETE 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, */ +/* OBSOLETE 4,4,4,4,4,4,4,4,5,5,5,5,6,6,7,8, */ +/* OBSOLETE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, */ +/* OBSOLETE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, */ +/* OBSOLETE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, */ +/* OBSOLETE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, */ +/* OBSOLETE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, */ +/* OBSOLETE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, */ +/* OBSOLETE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, */ +/* OBSOLETE 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, */ +/* OBSOLETE }; */ +/* OBSOLETE */ +/* OBSOLETE CONST struct opform opdecode[] = { */ +/* OBSOLETE 0x7e00, 9, format0, e0_format0, e1_format0, */ +/* OBSOLETE 0x3f00, 8, format1, e0_format1, e1_format1, */ +/* OBSOLETE 0x1fc0, 6, format2, e0_format2, e1_format2, */ +/* OBSOLETE 0x0fc0, 6, format3, e0_format3, e1_format3, */ +/* OBSOLETE 0x0700, 8, format4, e0_format4, e1_format4, */ +/* OBSOLETE 0x03c0, 6, format5, e0_format5, e1_format5, */ +/* OBSOLETE 0x01f8, 3, format6, e0_format6, e1_format6, */ +/* OBSOLETE 0x00f8, 3, format7, e0_format7, e1_format7, */ +/* OBSOLETE 0x0000, 0, formatx, formatx, formatx, */ +/* OBSOLETE 0x0f80, 7, formatx, formatx, formatx, */ +/* OBSOLETE 0x0f80, 7, formatx, formatx, formatx, */ +/* OBSOLETE }; */ +/* OBSOLETE */ +/* OBSOLETE /* Print the instruction at address MEMADDR in debugged memory, */ +/* OBSOLETE on STREAM. Returns length of the instruction, in bytes. *x/ */ +/* OBSOLETE */ +/* OBSOLETE int */ +/* OBSOLETE convex_print_insn (memaddr, stream) */ +/* OBSOLETE CORE_ADDR memaddr; */ +/* OBSOLETE FILE *stream; */ +/* OBSOLETE { */ +/* OBSOLETE union inst inst; */ +/* OBSOLETE struct formstr *fmt; */ +/* OBSOLETE register int format, op1, pfx; */ +/* OBSOLETE int l; */ +/* OBSOLETE */ +/* OBSOLETE read_memory (memaddr, &inst, sizeof inst); */ +/* OBSOLETE */ +/* OBSOLETE /* Remove and note prefix, if present *x/ */ +/* OBSOLETE */ +/* OBSOLETE pfx = inst.half[0]; */ +/* OBSOLETE if ((pfx & 0xfff0) == 0x7ef0) */ +/* OBSOLETE { */ +/* OBSOLETE pfx = ((pfx >> 3) & 1) + 1; */ +/* OBSOLETE *(long long *) &inst = *(long long *) &inst.half[1]; */ +/* OBSOLETE } */ +/* OBSOLETE else pfx = 0; */ +/* OBSOLETE */ +/* OBSOLETE /* Split opcode into format.op1 and look up in appropriate table *x/ */ +/* OBSOLETE */ +/* OBSOLETE format = formdecode[inst.byte[0]]; */ +/* OBSOLETE op1 = (inst.half[0] & opdecode[format].mask) >> opdecode[format].shift; */ +/* OBSOLETE if (format == 9) */ +/* OBSOLETE { */ +/* OBSOLETE if (pfx) */ +/* OBSOLETE fmt = formatx; */ +/* OBSOLETE else if (inst.f1.j == 0) */ +/* OBSOLETE fmt = &format1a[op1]; */ +/* OBSOLETE else if (inst.f1.j == 1) */ +/* OBSOLETE fmt = &format1b[op1]; */ +/* OBSOLETE else */ +/* OBSOLETE fmt = formatx; */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE fmt = &opdecode[format].formstr[pfx][op1]; */ +/* OBSOLETE */ +/* OBSOLETE /* Print it *x/ */ +/* OBSOLETE */ +/* OBSOLETE if (fmt->fmt == xxx) */ +/* OBSOLETE { */ +/* OBSOLETE /* noninstruction *x/ */ +/* OBSOLETE fprintf (stream, "0x%04x", pfx ? pfx : inst.half[0]); */ +/* OBSOLETE return 2; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE if (pfx) */ +/* OBSOLETE pfx = 2; */ +/* OBSOLETE */ +/* OBSOLETE fprintf (stream, "%s%s%s", lop[fmt->lop], rop[fmt->rop], */ +/* OBSOLETE &" "[strlen(lop[fmt->lop]) + strlen(rop[fmt->rop])]); */ +/* OBSOLETE */ +/* OBSOLETE switch (fmt->fmt) */ +/* OBSOLETE { */ +/* OBSOLETE case rrr: /* three register *x/ */ +/* OBSOLETE fprintf (stream, "%s,%s,%s", reg(i,i), reg(j,j), reg(k,k)); */ +/* OBSOLETE return pfx + 2; */ +/* OBSOLETE */ +/* OBSOLETE case rr: /* two register *x/ */ +/* OBSOLETE fprintf (stream, "%s,%s", reg(i,j), reg(j,k)); */ +/* OBSOLETE return pfx + 2; */ +/* OBSOLETE */ +/* OBSOLETE case rxr: /* two register, reversed i and j fields *x/ */ +/* OBSOLETE fprintf (stream, "%s,%s", reg(i,k), reg(j,j)); */ +/* OBSOLETE return pfx + 2; */ +/* OBSOLETE */ +/* OBSOLETE case r: /* one register *x/ */ +/* OBSOLETE fprintf (stream, "%s", reg(i,k)); */ +/* OBSOLETE return pfx + 2; */ +/* OBSOLETE */ +/* OBSOLETE case nops: /* no operands *x/ */ +/* OBSOLETE return pfx + 2; */ +/* OBSOLETE */ +/* OBSOLETE case nr: /* short immediate, one register *x/ */ +/* OBSOLETE fprintf (stream, "#%d,%s", inst.f0.j, reg(i,k)); */ +/* OBSOLETE return pfx + 2; */ +/* OBSOLETE */ +/* OBSOLETE case pcrel: /* pc relative *x/ */ +/* OBSOLETE print_address (memaddr + 2 * inst.signed_byte[1], stream); */ +/* OBSOLETE return pfx + 2; */ +/* OBSOLETE */ +/* OBSOLETE case lr: /* literal, one register *x/ */ +/* OBSOLETE fprintf (stream, "%s,%s", lit(i), reg(j,k)); */ +/* OBSOLETE return pfx + 2; */ +/* OBSOLETE */ +/* OBSOLETE case rxl: /* one register, literal *x/ */ +/* OBSOLETE fprintf (stream, "%s,%s", reg(i,k), lit(j)); */ +/* OBSOLETE return pfx + 2; */ +/* OBSOLETE */ +/* OBSOLETE case rlr: /* register, literal, register *x/ */ +/* OBSOLETE fprintf (stream, "%s,%s,%s", reg(i,j), lit(j), reg(k,k)); */ +/* OBSOLETE return pfx + 2; */ +/* OBSOLETE */ +/* OBSOLETE case rrl: /* register, register, literal *x/ */ +/* OBSOLETE fprintf (stream, "%s,%s,%s", reg(i,j), reg(j,k), lit(k)); */ +/* OBSOLETE return pfx + 2; */ +/* OBSOLETE */ +/* OBSOLETE case iml: /* immediate, literal *x/ */ +/* OBSOLETE if (inst.f1.len) */ +/* OBSOLETE { */ +/* OBSOLETE fprintf (stream, "#%#x,%s", */ +/* OBSOLETE (inst.signed_half[1] << 16) + inst.half[2], lit(i)); */ +/* OBSOLETE return pfx + 6; */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE fprintf (stream, "#%d,%s", inst.signed_half[1], lit(i)); */ +/* OBSOLETE return pfx + 4; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE case imr: /* immediate, register *x/ */ +/* OBSOLETE if (inst.f1.len) */ +/* OBSOLETE { */ +/* OBSOLETE fprintf (stream, "#%#x,%s", */ +/* OBSOLETE (inst.signed_half[1] << 16) + inst.half[2], reg(i,k)); */ +/* OBSOLETE return pfx + 6; */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE fprintf (stream, "#%d,%s", inst.signed_half[1], reg(i,k)); */ +/* OBSOLETE return pfx + 4; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE case a1r: /* memory, register *x/ */ +/* OBSOLETE l = print_effa (inst, stream); */ +/* OBSOLETE fprintf (stream, ",%s", reg(i,k)); */ +/* OBSOLETE return pfx + l; */ +/* OBSOLETE */ +/* OBSOLETE case a1l: /* memory, literal *x/ */ +/* OBSOLETE l = print_effa (inst, stream); */ +/* OBSOLETE fprintf (stream, ",%s", lit(i)); */ +/* OBSOLETE return pfx + l; */ +/* OBSOLETE */ +/* OBSOLETE case a2r: /* register, memory *x/ */ +/* OBSOLETE fprintf (stream, "%s,", reg(i,k)); */ +/* OBSOLETE return pfx + print_effa (inst, stream); */ +/* OBSOLETE */ +/* OBSOLETE case a2l: /* literal, memory *x/ */ +/* OBSOLETE fprintf (stream, "%s,", lit(i)); */ +/* OBSOLETE return pfx + print_effa (inst, stream); */ +/* OBSOLETE */ +/* OBSOLETE case a3: /* memory *x/ */ +/* OBSOLETE return pfx + print_effa (inst, stream); */ +/* OBSOLETE */ +/* OBSOLETE case a4: /* system call *x/ */ +/* OBSOLETE l = 29; goto a4a5; */ +/* OBSOLETE case a5: /* trap *x/ */ +/* OBSOLETE l = 27; */ +/* OBSOLETE a4a5: */ +/* OBSOLETE if (inst.f1.len) */ +/* OBSOLETE { */ +/* OBSOLETE unsigned int m = (inst.signed_half[1] << 16) + inst.half[2]; */ +/* OBSOLETE fprintf (stream, "#%d,#%d", m >> l, m & (-1 >> (32-l))); */ +/* OBSOLETE return pfx + 6; */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE unsigned int m = inst.signed_half[1]; */ +/* OBSOLETE fprintf (stream, "#%d,#%d", m >> l, m & (-1 >> (32-l))); */ +/* OBSOLETE return pfx + 4; */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE /* print effective address @nnn(aj), return instruction length *x/ */ +/* OBSOLETE */ +/* OBSOLETE int print_effa (inst, stream) */ +/* OBSOLETE union inst inst; */ +/* OBSOLETE FILE *stream; */ +/* OBSOLETE { */ +/* OBSOLETE int n, l; */ +/* OBSOLETE */ +/* OBSOLETE if (inst.f1.len) */ +/* OBSOLETE { */ +/* OBSOLETE n = (inst.signed_half[1] << 16) + inst.half[2]; */ +/* OBSOLETE l = 6; */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE n = inst.signed_half[1]; */ +/* OBSOLETE l = 4; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE if (inst.f1.indir) */ +/* OBSOLETE printf ("@"); */ +/* OBSOLETE */ +/* OBSOLETE if (!inst.f1.j) */ +/* OBSOLETE { */ +/* OBSOLETE print_address (n, stream); */ +/* OBSOLETE return l; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE fprintf (stream, (n & 0xf0000000) == 0x80000000 ? "%#x(%s)" : "%d(%s)", */ +/* OBSOLETE n, aj[inst.f1.j]); */ +/* OBSOLETE */ +/* OBSOLETE return l; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE _initialize_convex_dep () */ +/* OBSOLETE { */ +/* OBSOLETE add_com ("alias", class_support, alias_command, */ +/* OBSOLETE "Add a new name for an existing command."); */ +/* OBSOLETE */ +/* OBSOLETE add_cmd ("base", class_vars, set_base_command, */ +/* OBSOLETE "Change the integer output radix to 8, 10 or 16\n\ */ +/* OBSOLETE or use just `set base' with no args to return to the ad-hoc default,\n\ */ +/* OBSOLETE which is 16 for integers that look like addresses, 10 otherwise.", */ +/* OBSOLETE &setlist); */ +/* OBSOLETE */ +/* OBSOLETE add_cmd ("pipeline", class_run, set_pipelining_command, */ +/* OBSOLETE "Enable or disable overlapped execution of instructions.\n\ */ +/* OBSOLETE With `set pipe off', exceptions are reported with\n\ */ +/* OBSOLETE $pc pointing at the instruction after the faulting one.\n\ */ +/* OBSOLETE The default is `set pipe on', which runs faster.", */ +/* OBSOLETE &setlist); */ +/* OBSOLETE */ +/* OBSOLETE add_cmd ("parallel", class_run, set_parallel_command, */ +/* OBSOLETE "Enable or disable multi-threaded execution of parallel code.\n\ */ +/* OBSOLETE `set parallel off' means run the program on a single CPU.\n\ */ +/* OBSOLETE `set parallel fixed' means run the program with all CPUs assigned to it.\n\ */ +/* OBSOLETE `set parallel on' means run the program on any CPUs that are available.", */ +/* OBSOLETE &setlist); */ +/* OBSOLETE */ +/* OBSOLETE add_com ("1cont", class_run, one_cont_command, */ +/* OBSOLETE "Continue the program, activating only the current thread.\n\ */ +/* OBSOLETE Args are the same as the `cont' command."); */ +/* OBSOLETE */ +/* OBSOLETE add_com ("thread", class_run, set_thread_command, */ +/* OBSOLETE "Change the current thread, the one under scrutiny and control.\n\ */ +/* OBSOLETE With no arg, show the active threads, the current one marked with *."); */ +/* OBSOLETE */ +/* OBSOLETE add_info ("threads", thread_info, */ +/* OBSOLETE "List status of active threads."); */ +/* OBSOLETE */ +/* OBSOLETE add_info ("comm-registers", comm_registers_info, */ +/* OBSOLETE "List communication registers and their contents.\n\ */ +/* OBSOLETE A communication register name as argument means describe only that register.\n\ */ +/* OBSOLETE An address as argument means describe the resource structure at that address.\n\ */ +/* OBSOLETE `Locked' means that the register has been sent to but not yet received from."); */ +/* OBSOLETE */ +/* OBSOLETE add_info ("psw", psw_info, */ +/* OBSOLETE "Display $ps, the processor status word, bit by bit.\n\ */ +/* OBSOLETE An argument means display that value's interpretation as a psw."); */ +/* OBSOLETE */ +/* OBSOLETE add_cmd ("convex", no_class, 0, "Convex-specific commands.\n\ */ +/* OBSOLETE 32-bit registers $pc $ps $sp $ap $fp $a1-5 $s0-7 $v0-7 $vl $vs $vm $c0-63\n\ */ +/* OBSOLETE 64-bit registers $S0-7 $V0-7 $C0-63\n\ */ +/* OBSOLETE \n\ */ +/* OBSOLETE info threads display info on stopped threads waiting to signal\n\ */ +/* OBSOLETE thread display list of active threads\n\ */ +/* OBSOLETE thread N select thread N (its registers, stack, memory, etc.)\n\ */ +/* OBSOLETE step, next, etc step selected thread only\n\ */ +/* OBSOLETE 1cont continue selected thread only\n\ */ +/* OBSOLETE cont continue all threads\n\ */ +/* OBSOLETE info comm-registers display contents of comm register(s) or a resource struct\n\ */ +/* OBSOLETE info psw display processor status word $ps\n\ */ +/* OBSOLETE set base N change integer radix used by `print' without a format\n\ */ +/* OBSOLETE set pipeline off exceptions are precise, $pc points after the faulting insn\n\ */ +/* OBSOLETE set pipeline on normal mode, $pc is somewhere ahead of faulting insn\n\ */ +/* OBSOLETE set parallel off program runs on a single CPU\n\ */ +/* OBSOLETE set parallel fixed all CPUs are assigned to the program\n\ */ +/* OBSOLETE set parallel on normal mode, parallel execution on random available CPUs\n\ */ +/* OBSOLETE ", */ +/* OBSOLETE &cmdlist); */ +/* OBSOLETE */ +/* OBSOLETE } */ diff --git a/gdb/convex-xdep.c b/gdb/convex-xdep.c index ad128c117e..60117ce7ce 100644 --- a/gdb/convex-xdep.c +++ b/gdb/convex-xdep.c @@ -1,963 +1,963 @@ -/* Convex host-dependent code for GDB. - Copyright 1990, 1991, 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "command.h" -#include "symtab.h" -#include "value.h" -#include "frame.h" -#include "inferior.h" -#include "wait.h" - -#include -#include -#include "gdbcore.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include "gdb_stat.h" -#include - -#include -#include -#include -#include -#include - -/* Per-thread data, read from the inferior at each stop and written - back at each resume. */ - -/* Number of active threads. - Tables are valid for thread numbers less than this. */ - -static int n_threads; - -#define MAXTHREADS 8 - -/* Thread state. The remaining data is valid only if this is PI_TALIVE. */ - -static int thread_state[MAXTHREADS]; - -/* Stop pc, signal, signal subcode */ - -static int thread_pc[MAXTHREADS]; -static int thread_signal[MAXTHREADS]; -static int thread_sigcode[MAXTHREADS]; - -/* Thread registers. - If thread is selected, the regs are in registers[] instead. */ - -static char thread_regs[MAXTHREADS][REGISTER_BYTES]; - -/* 1 if the top frame on the thread's stack was a context frame, - meaning that the kernel is up to something and we should not - touch the thread at all except to resume it. */ - -static char thread_is_in_kernel[MAXTHREADS]; - -/* The currently selected thread's number. */ - -static int inferior_thread; - -/* Inferior process's file handle and a process control block - to feed args to ioctl with. */ - -static int inferior_fd; -static struct pcntl ps; - -/* SOFF file headers for exec or core file. */ - -static FILEHDR filehdr; -static OPTHDR opthdr; -static SCNHDR scnhdr; - -/* Address maps constructed from section headers of exec and core files. - Defines process address -> file address translation. */ - -struct pmap -{ - long mem_addr; /* process start address */ - long mem_end; /* process end+1 address */ - long file_addr; /* file start address */ - long thread; /* -1 shared; 0,1,... thread-local */ - long type; /* S_TEXT S_DATA S_BSS S_TBSS etc */ - long which; /* used to sort map for info files */ -}; - -static int n_exec, n_core; -static struct pmap exec_map[100]; -static struct pmap core_map[100]; - -/* Offsets in the core file of core_context and core_tcontext blocks. */ - -static int context_offset; -static int tcontext_offset[MAXTHREADS]; - -/* Core file control blocks. */ - -static struct core_context_v70 c; -static struct core_tcontext_v70 tc; -static struct user u; -static thread_t th; -static proc_t pr; - - -/* Vector and communication registers from core dump or from inferior. - These are read on demand, ie, not normally valid. */ - -static struct vecst vector_registers; -static struct creg_ctx comm_registers; - -/* Flag, set on a vanilla CONT command and cleared when the inferior - is continued. */ - -static int all_continue; - -/* Flag, set when the inferior is continued by a vanilla CONT command, - cleared if it is continued for any other purpose. */ - -static int thread_switch_ok; - -/* Stack of signals recieved from threads but not yet delivered to gdb. */ - -struct threadpid -{ - int pid; - int thread; - int signo; - int subsig; - int pc; -}; - -static struct threadpid signal_stack_bot[100]; -static struct threadpid *signal_stack = signal_stack_bot; - -/* How to detect empty stack -- bottom frame is all zero. */ - -#define signal_stack_is_empty() (signal_stack->pid == 0) - -/* Mode controlled by SET PIPE command, controls the psw SEQ bit - which forces each instruction to complete before the next one starts. */ - -static int sequential = 0; - -/* Mode controlled by the SET PARALLEL command. Values are: - 0 concurrency limit 1 thread, dynamic scheduling - 1 no concurrency limit, dynamic scheduling - 2 no concurrency limit, fixed scheduling */ - -static int parallel = 1; - -/* Mode controlled by SET BASE command, output radix for unformatted - integer typeout, as in argument lists, aggregates, and so on. - Zero means guess whether it's an address (hex) or not (decimal). */ - -static int output_radix = 0; - -/* Signal subcode at last thread stop. */ - -static int stop_sigcode; - -/* Hack, see wait() below. */ - -static int exec_trap_timer; - -#include "gdbcmd.h" - -static struct type *vector_type (); -static long *read_vector_register (); -static long *read_vector_register_1 (); -static void write_vector_register (); -static ULONGEST read_comm_register (); -static void write_comm_register (); -static void convex_cont_command (); -static void thread_continue (); -static void select_thread (); -static void scan_stack (); -static void set_fixed_scheduling (); -static char *subsig_name (); -static void psw_info (); -static sig_noop (); -static ptr_cmp (); - - -/* Execute ptrace. Convex V7 replaced ptrace with pattach. - Allow ptrace (0) as a no-op. */ - -int -call_ptrace (request, pid, procaddr, buf) - int request, pid; - PTRACE_ARG3_TYPE procaddr; - int buf; -{ - if (request == 0) - return; - error ("no ptrace"); -} - -/* Replacement for system execle routine. - Convert it to an equivalent exect, which pattach insists on. */ - -execle (name, argv) - char *name, *argv; -{ - char ***envp = (char ***) &argv; - while (*envp++) ; - - signal (SIGTRAP, sig_noop); - exect (name, &argv, *envp); -} - -/* Stupid handler for stupid trace trap that otherwise causes - startup to stupidly hang. */ - -static sig_noop () -{} - -/* Read registers from inferior into registers[] array. - For convex, they are already there, read in when the inferior stops. */ - -void -fetch_inferior_registers (regno) - int regno; -{ -} - -/* Store our register values back into the inferior. - For Convex, do this only once, right before resuming inferior. */ - -void -store_inferior_registers (regno) - int regno; -{ -} - -/* Copy LEN bytes from inferior's memory starting at MEMADDR - to debugger memory starting at MYADDR. - On failure (cannot read from inferior, usually because address is out - of bounds) returns the value of errno. */ - -int -read_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - errno = 0; - while (len > 0) - { - /* little-known undocumented max request size */ - int i = (len < 12288) ? len : 12288; - - lseek (inferior_fd, memaddr, 0); - read (inferior_fd, myaddr, i); - - memaddr += i; - myaddr += i; - len -= i; - } - if (errno) - memset (myaddr, '\0', len); - return errno; -} - -/* Copy LEN bytes of data from debugger memory at MYADDR - to inferior's memory at MEMADDR. - Returns errno on failure (cannot write the inferior) */ - -int -write_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - errno = 0; - lseek (inferior_fd, memaddr, 0); - write (inferior_fd, myaddr, len); - return errno; -} - -/* Here from create_inferior when the inferior process has been created - and started up. We must do a pattach to grab it for debugging. - - Also, intercept the CONT command by altering its dispatch address. */ -/* FIXME: This used to be called from a macro CREATE_INFERIOR_HOOK. - But now init_trace_fun is in the same place. So re-write this to - use the init_trace_fun (making convex a debugging target). */ - -create_inferior_hook (pid) - int pid; -{ - static char cont[] = "cont"; - static char cont1[] = "c"; - char *linep = cont; - char *linep1 = cont1; - char **line = &linep; - char **line1 = &linep1; - struct cmd_list_element *c; - - c = lookup_cmd (line, cmdlist, "", 0); - c->function = convex_cont_command; - c = lookup_cmd (line1, cmdlist, "", 0); - c->function = convex_cont_command; - - inferior_fd = pattach (pid, O_EXCL); - if (inferior_fd < 0) - perror_with_name ("pattach"); - inferior_thread = 0; - set_fixed_scheduling (pid, parallel == 2); -} - -/* Attach process PID for debugging. */ - -attach (pid) - int pid; -{ - int fd = pattach (pid, O_EXCL); - if (fd < 0) - perror_with_name ("pattach"); - attach_flag = 1; - /* wait for strange kernel reverberations to go away */ - sleep (1); - - setpgrp (pid, pid); - - inferior_fd = fd; - inferior_thread = 0; - return pid; -} - -/* Stop debugging the process whose number is PID - and continue it with signal number SIGNAL. - SIGNAL = 0 means just continue it. */ - -void -detach (signal) - int signal; -{ - signal_stack = signal_stack_bot; - thread_continue (-1, 0, signal); - ioctl (inferior_fd, PIXDETACH, &ps); - close (inferior_fd); - inferior_fd = 0; - attach_flag = 0; -} - -/* Kill off the inferior process. */ - -kill_inferior () -{ - if (inferior_pid == 0) - return; - ioctl (inferior_fd, PIXTERMINATE, 0); - wait (0); - target_mourn_inferior (); -} - -/* Read vector register REG, and return a pointer to the value. */ - -static long * -read_vector_register (reg) - int reg; -{ - if (have_inferior_p ()) - { - errno = 0; - ps.pi_buffer = (char *) &vector_registers; - ps.pi_nbytes = sizeof vector_registers; - ps.pi_offset = 0; - ps.pi_thread = inferior_thread; - ioctl (inferior_fd, PIXRDVREGS, &ps); - if (errno) - memset (&vector_registers, '\0', sizeof vector_registers); - } - else if (corechan >= 0) - { - lseek (corechan, tcontext_offset[inferior_thread], 0); - if (myread (corechan, &tc, sizeof tc) < 0) - perror_with_name (corefile); - lseek (corechan, tc.core_thread_p, 0); - if (myread (corechan, &th, sizeof th) < 0) - perror_with_name (corefile); - lseek (corechan, tc.core_vregs_p, 0); - if (myread (corechan, &vector_registers, 16*128) < 0) - perror_with_name (corefile); - vector_registers.vm[0] = th.t_vect_ctx.vc_vm[0]; - vector_registers.vm[1] = th.t_vect_ctx.vc_vm[1]; - vector_registers.vls = th.t_vect_ctx.vc_vls; - } - - return read_vector_register_1 (reg); -} - -/* Return a pointer to vector register REG, which must already have been - fetched from the inferior or core file. */ - -static long * -read_vector_register_1 (reg) - int reg; -{ - switch (reg) - { - case VM_REGNUM: - return (long *) vector_registers.vm; - case VS_REGNUM: - return (long *) &vector_registers.vls; - case VL_REGNUM: - return 1 + (long *) &vector_registers.vls; - default: - return (long *) &vector_registers.vr[reg]; - } -} - -/* Write vector register REG, element ELEMENT, new value VAL. - NB: must use read-modify-write on the entire vector state, - since pattach does not do offsetted writes correctly. */ - -static void -write_vector_register (reg, element, val) - int reg, element; - ULONGEST val; -{ - if (have_inferior_p ()) - { - errno = 0; - ps.pi_thread = inferior_thread; - ps.pi_offset = 0; - ps.pi_buffer = (char *) &vector_registers; - ps.pi_nbytes = sizeof vector_registers; - - ioctl (inferior_fd, PIXRDVREGS, &ps); - - switch (reg) - { - case VL_REGNUM: - vector_registers.vls = - (vector_registers.vls & 0xffffffff00000000LL) - + (unsigned long) val; - break; - - case VS_REGNUM: - vector_registers.vls = - (val << 32) + (unsigned long) vector_registers.vls; - break; - - default: - vector_registers.vr[reg].el[element] = val; - break; - } - - ioctl (inferior_fd, PIXWRVREGS, &ps); - - if (errno) - perror_with_name ("writing vector register"); - } -} - -/* Return the contents of communication register NUM. */ - -static ULONGEST -read_comm_register (num) - int num; -{ - if (have_inferior_p ()) - { - ps.pi_buffer = (char *) &comm_registers; - ps.pi_nbytes = sizeof comm_registers; - ps.pi_offset = 0; - ps.pi_thread = inferior_thread; - ioctl (inferior_fd, PIXRDCREGS, &ps); - } - return comm_registers.crreg.r4[num]; -} - -/* Store a new value VAL into communication register NUM. - NB: Must use read-modify-write on the whole comm register set - since pattach does not do offsetted writes correctly. */ - -static void -write_comm_register (num, val) - int num; - ULONGEST val; -{ - if (have_inferior_p ()) - { - ps.pi_buffer = (char *) &comm_registers; - ps.pi_nbytes = sizeof comm_registers; - ps.pi_offset = 0; - ps.pi_thread = inferior_thread; - ioctl (inferior_fd, PIXRDCREGS, &ps); - comm_registers.crreg.r4[num] = val; - ioctl (inferior_fd, PIXWRCREGS, &ps); - } -} - -/* Resume execution of the inferior process. - If STEP is nonzero, single-step it. - If SIGNAL is nonzero, give it that signal. */ - -void -resume (step, signal) - int step; - int signal; -{ - errno = 0; - if (step || signal) - thread_continue (inferior_thread, step, signal); - else - thread_continue (-1, 0, 0); -} - -/* Maybe resume some threads. - THREAD is which thread to resume, or -1 to resume them all. - STEP and SIGNAL are as in resume. - - Global variable ALL_CONTINUE is set when we are here to do a - `cont' command; otherwise we may be doing `finish' or a call or - something else that will not tolerate an automatic thread switch. - - If there are stopped threads waiting to deliver signals, and - ALL_CONTINUE, do not actually resume anything. gdb will do a wait - and see one of the stopped threads in the queue. */ - -static void -thread_continue (thread, step, signal) - int thread, step, signal; -{ - int n; - - /* If we are to continue all threads, but not for the CONTINUE command, - pay no attention and continue only the selected thread. */ - - if (thread < 0 && ! all_continue) - thread = inferior_thread; - - /* If we are not stepping, we have now executed the continue part - of a CONTINUE command. */ - - if (! step) - all_continue = 0; - - /* Allow wait() to switch threads if this is an all-out continue. */ - - thread_switch_ok = thread < 0; - - /* If there are threads queued up, don't resume. */ - - if (thread_switch_ok && ! signal_stack_is_empty ()) - return; - - /* OK, do it. */ - - for (n = 0; n < n_threads; n++) - if (thread_state[n] == PI_TALIVE) - { - select_thread (n); - - if ((thread < 0 || n == thread) && ! thread_is_in_kernel[n]) - { - /* Blam the trace bits in the stack's saved psws to match - the desired step mode. This is required so that - single-stepping a return doesn't restore a psw with a - clear trace bit and fly away, and conversely, - proceeding through a return in a routine that was - stepped into doesn't cause a phantom break by restoring - a psw with the trace bit set. */ - scan_stack (PSW_T_BIT, step); - scan_stack (PSW_S_BIT, sequential); - } - - ps.pi_buffer = registers; - ps.pi_nbytes = REGISTER_BYTES; - ps.pi_offset = 0; - ps.pi_thread = n; - if (! thread_is_in_kernel[n]) - if (ioctl (inferior_fd, PIXWRREGS, &ps)) - perror_with_name ("PIXWRREGS"); - - if (thread < 0 || n == thread) - { - ps.pi_pc = 1; - ps.pi_signo = signal; - if (ioctl (inferior_fd, step ? PIXSTEP : PIXCONTINUE, &ps) < 0) - perror_with_name ("PIXCONTINUE"); - } - } - - if (ioctl (inferior_fd, PIXRUN, &ps) < 0) - perror_with_name ("PIXRUN"); -} - -/* Replacement for system wait routine. - - The system wait returns with one or more threads stopped by - signals. Put stopped threads on a stack and return them one by - one, so that it appears that wait returns one thread at a time. - - Global variable THREAD_SWITCH_OK is set when gdb can tolerate wait - returning a new thread. If it is false, then only one thread is - running; we will do a real wait, the thread will do something, and - we will return that. */ - -pid_t -wait (w) - union wait *w; -{ - int pid; - - if (!w) - return wait3 (0, 0, 0); - - /* Do a real wait if we were told to, or if there are no queued threads. */ - - if (! thread_switch_ok || signal_stack_is_empty ()) - { - int thread; - - pid = wait3 (w, 0, 0); - - if (!WIFSTOPPED (*w) || pid != inferior_pid) - return pid; - - /* The inferior has done something and stopped. Read in all the - threads' registers, and queue up any signals that happened. */ - - if (ioctl (inferior_fd, PIXGETTHCOUNT, &ps) < 0) - perror_with_name ("PIXGETTHCOUNT"); - - n_threads = ps.pi_othdcnt; - for (thread = 0; thread < n_threads; thread++) - { - ps.pi_thread = thread; - if (ioctl (inferior_fd, PIXGETSUBCODE, &ps) < 0) - perror_with_name ("PIXGETSUBCODE"); - thread_state[thread] = ps.pi_otstate; - - if (ps.pi_otstate == PI_TALIVE) - { - select_thread (thread); - ps.pi_buffer = registers; - ps.pi_nbytes = REGISTER_BYTES; - ps.pi_offset = 0; - ps.pi_thread = thread; - if (ioctl (inferior_fd, PIXRDREGS, &ps) < 0) - perror_with_name ("PIXRDREGS"); - - registers_fetched (); - - thread_pc[thread] = read_pc (); - thread_signal[thread] = ps.pi_osigno; - thread_sigcode[thread] = ps.pi_osigcode; - - /* If the thread's stack has a context frame - on top, something fucked is going on. I do not - know what, but do I know this: the only thing you - can do with such a thread is continue it. */ - - thread_is_in_kernel[thread] = - ((read_register (PS_REGNUM) >> 25) & 3) == 0; - - /* Signals push an extended frame and then fault - with a ridiculous pc. Pop the frame. */ - - if (thread_pc[thread] > STACK_END_ADDR) - { - POP_FRAME; - if (is_break_pc (thread_pc[thread])) - thread_pc[thread] = read_pc () - 2; - else - thread_pc[thread] = read_pc (); - write_register (PC_REGNUM, thread_pc[thread]); - } - - if (ps.pi_osigno || ps.pi_osigcode) - { - signal_stack++; - signal_stack->pid = pid; - signal_stack->thread = thread; - signal_stack->signo = thread_signal[thread]; - signal_stack->subsig = thread_sigcode[thread]; - signal_stack->pc = thread_pc[thread]; - } - - /* The following hackery is caused by a unix 7.1 feature: - the inferior's fixed scheduling mode is cleared when - it execs the shell (since the shell is not a parallel - program). So, note the 5.4 trap we get when - the shell does its exec, then catch the 5.0 trap - that occurs when the debuggee starts, and set fixed - scheduling mode properly. */ - - if (ps.pi_osigno == 5 && ps.pi_osigcode == 4) - exec_trap_timer = 1; - else - exec_trap_timer--; - - if (ps.pi_osigno == 5 && exec_trap_timer == 0) - set_fixed_scheduling (pid, parallel == 2); - } - } - - if (signal_stack_is_empty ()) - error ("no active threads?!"); - } - - /* Select the thread that stopped, and return *w saying why. */ - - select_thread (signal_stack->thread); - - FIXME: need to convert from host sig. - stop_signal = signal_stack->signo; - stop_sigcode = signal_stack->subsig; - - WSETSTOP (*w, signal_stack->signo); - w->w_thread = signal_stack->thread; - return (signal_stack--)->pid; -} - -/* Select thread THREAD -- its registers, stack, per-thread memory. - This is the only routine that may assign to inferior_thread - or thread_regs[]. */ - -static void -select_thread (thread) - int thread; -{ - if (thread == inferior_thread) - return; - - memcpy (thread_regs[inferior_thread], registers, REGISTER_BYTES); - ps.pi_thread = inferior_thread = thread; - if (have_inferior_p ()) - ioctl (inferior_fd, PISETRWTID, &ps); - memcpy (registers, thread_regs[thread], REGISTER_BYTES); -} - -/* Routine to set or clear a psw bit in the psw and also all psws - saved on the stack. Quits when we get to a frame in which the - saved psw is correct. */ - -static void -scan_stack (bit, val) - long bit, val; -{ - long ps = read_register (PS_REGNUM); - long fp; - if (val ? !(ps & bit) : (ps & bit)) - { - ps ^= bit; - write_register (PS_REGNUM, ps); - - fp = read_register (FP_REGNUM); - while (fp & 0x80000000) - { - ps = read_memory_integer (fp + 4, 4); - if (val ? (ps & bit) : !(ps & bit)) - break; - ps ^= bit; - write_memory (fp + 4, &ps, 4); - fp = read_memory_integer (fp + 8, 4); - } - } -} - -/* Set fixed scheduling (alliant mode) of process PID to ARG (0 or 1). */ - -static void -set_fixed_scheduling (pid, arg) - int arg; -{ - struct pattributes pattr; - getpattr (pid, &pattr); - pattr.pattr_pfixed = arg; - setpattr (pid, &pattr); -} - -void -core_file_command (filename, from_tty) - char *filename; - int from_tty; -{ - int n; - - /* Discard all vestiges of any previous core file - and mark data and stack spaces as empty. */ - - if (corefile) - free (corefile); - corefile = 0; - - if (corechan >= 0) - close (corechan); - corechan = -1; - - data_start = 0; - data_end = 0; - stack_start = STACK_END_ADDR; - stack_end = STACK_END_ADDR; - n_core = 0; - - /* Now, if a new core file was specified, open it and digest it. */ - - if (filename) - { - filename = tilde_expand (filename); - make_cleanup (free, filename); - - if (have_inferior_p ()) - error ("To look at a core file, you must kill the program with \"kill\"."); - corechan = open (filename, O_RDONLY, 0); - if (corechan < 0) - perror_with_name (filename); - - if (myread (corechan, &filehdr, sizeof filehdr) < 0) - perror_with_name (filename); - - if (!IS_CORE_SOFF_MAGIC (filehdr.h_magic)) - error ("%s: not a core file.\n", filename); - - if (myread (corechan, &opthdr, filehdr.h_opthdr) < 0) - perror_with_name (filename); - - /* Read through the section headers. - For text, data, etc, record an entry in the core file map. - For context and tcontext, record the file address of - the context blocks. */ - - lseek (corechan, (long) filehdr.h_scnptr, 0); - - n_threads = 0; - for (n = 0; n < filehdr.h_nscns; n++) - { - if (myread (corechan, &scnhdr, sizeof scnhdr) < 0) - perror_with_name (filename); - if ((scnhdr.s_flags & S_TYPMASK) >= S_TEXT - && (scnhdr.s_flags & S_TYPMASK) <= S_COMON) - { - core_map[n_core].mem_addr = scnhdr.s_vaddr; - core_map[n_core].mem_end = scnhdr.s_vaddr + scnhdr.s_size; - core_map[n_core].file_addr = scnhdr.s_scnptr; - core_map[n_core].type = scnhdr.s_flags & S_TYPMASK; - if (core_map[n_core].type != S_TBSS - && core_map[n_core].type != S_TDATA - && core_map[n_core].type != S_TTEXT) - core_map[n_core].thread = -1; - else if (n_core == 0 - || core_map[n_core-1].mem_addr != scnhdr.s_vaddr) - core_map[n_core].thread = 0; - else - core_map[n_core].thread = core_map[n_core-1].thread + 1; - n_core++; - } - else if ((scnhdr.s_flags & S_TYPMASK) == S_CONTEXT) - context_offset = scnhdr.s_scnptr; - else if ((scnhdr.s_flags & S_TYPMASK) == S_TCONTEXT) - tcontext_offset[n_threads++] = scnhdr.s_scnptr; - } - - /* Read the context block, struct user, struct proc, - and the comm regs. */ - - lseek (corechan, context_offset, 0); - if (myread (corechan, &c, sizeof c) < 0) - perror_with_name (filename); - lseek (corechan, c.core_user_p, 0); - if (myread (corechan, &u, sizeof u) < 0) - perror_with_name (filename); - lseek (corechan, c.core_proc_p, 0); - if (myread (corechan, &pr, sizeof pr) < 0) - perror_with_name (filename); - comm_registers = pr.p_creg; - - /* Core file apparently is really there. Make it really exist - for xfer_core_file so we can do read_memory on it. */ - - if (filename[0] == '/') - corefile = savestring (filename, strlen (filename)); - else - corefile = concat (current_directory, "/", filename, NULL); - - printf_filtered ("Program %s ", u.u_comm); - - /* Read the thread registers and fill in the thread_xxx[] data. */ - - for (n = 0; n < n_threads; n++) - { - select_thread (n); - - lseek (corechan, tcontext_offset[n], 0); - if (myread (corechan, &tc, sizeof tc) < 0) - perror_with_name (corefile); - lseek (corechan, tc.core_thread_p, 0); - if (myread (corechan, &th, sizeof th) < 0) - perror_with_name (corefile); - - lseek (corechan, tc.core_syscall_context_p, 0); - if (myread (corechan, registers, REGISTER_BYTES) < 0) - perror_with_name (corefile); - - thread_signal[n] = th.t_cursig; - thread_sigcode[n] = th.t_code; - thread_state[n] = th.t_state; - thread_pc[n] = read_pc (); - - if (thread_pc[n] > STACK_END_ADDR) - { - POP_FRAME; - if (is_break_pc (thread_pc[n])) - thread_pc[n] = read_pc () - 2; - else - thread_pc[n] = read_pc (); - write_register (PC_REGNUM, thread_pc[n]); - } - - printf_filtered ("thread %d received signal %d, %s\n", - n, thread_signal[n], - safe_strsignal (thread_signal[n])); - } - - /* Select an interesting thread -- also-rans died with SIGKILL, - so find one that didn't. */ - - for (n = 0; n < n_threads; n++) - if (thread_signal[n] != 0 && thread_signal[n] != SIGKILL) - { - select_thread (n); - stop_signal = thread_signal[n]; - stop_sigcode = thread_sigcode[n]; - break; - } - - core_aouthdr.a_magic = 0; - - flush_cached_frames (); - select_frame (get_current_frame (), 0); - validate_files (); - - print_stack_frame (selected_frame, selected_frame_level, -1); - } - else if (from_tty) - printf_filtered ("No core file now.\n"); -} +/* OBSOLETE /* Convex host-dependent code for GDB. */ +/* OBSOLETE Copyright 1990, 1991, 1992 Free Software Foundation, Inc. */ +/* OBSOLETE */ +/* OBSOLETE This file is part of GDB. */ +/* OBSOLETE */ +/* OBSOLETE This program is free software; you can redistribute it and/or modify */ +/* OBSOLETE it under the terms of the GNU General Public License as published by */ +/* OBSOLETE the Free Software Foundation; either version 2 of the License, or */ +/* OBSOLETE (at your option) any later version. */ +/* OBSOLETE */ +/* OBSOLETE This program is distributed in the hope that it will be useful, */ +/* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* OBSOLETE GNU General Public License for more details. */ +/* OBSOLETE */ +/* OBSOLETE You should have received a copy of the GNU General Public License */ +/* OBSOLETE along with this program; if not, write to the Free Software */ +/* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #include "defs.h" */ +/* OBSOLETE #include "command.h" */ +/* OBSOLETE #include "symtab.h" */ +/* OBSOLETE #include "value.h" */ +/* OBSOLETE #include "frame.h" */ +/* OBSOLETE #include "inferior.h" */ +/* OBSOLETE #include "wait.h" */ +/* OBSOLETE */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include "gdbcore.h" */ +/* OBSOLETE */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include "gdb_stat.h" */ +/* OBSOLETE #include */ +/* OBSOLETE */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE */ +/* OBSOLETE /* Per-thread data, read from the inferior at each stop and written */ +/* OBSOLETE back at each resume. *x/ */ +/* OBSOLETE */ +/* OBSOLETE /* Number of active threads. */ +/* OBSOLETE Tables are valid for thread numbers less than this. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static int n_threads; */ +/* OBSOLETE */ +/* OBSOLETE #define MAXTHREADS 8 */ +/* OBSOLETE */ +/* OBSOLETE /* Thread state. The remaining data is valid only if this is PI_TALIVE. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static int thread_state[MAXTHREADS]; */ +/* OBSOLETE */ +/* OBSOLETE /* Stop pc, signal, signal subcode *x/ */ +/* OBSOLETE */ +/* OBSOLETE static int thread_pc[MAXTHREADS]; */ +/* OBSOLETE static int thread_signal[MAXTHREADS]; */ +/* OBSOLETE static int thread_sigcode[MAXTHREADS]; */ +/* OBSOLETE */ +/* OBSOLETE /* Thread registers. */ +/* OBSOLETE If thread is selected, the regs are in registers[] instead. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static char thread_regs[MAXTHREADS][REGISTER_BYTES]; */ +/* OBSOLETE */ +/* OBSOLETE /* 1 if the top frame on the thread's stack was a context frame, */ +/* OBSOLETE meaning that the kernel is up to something and we should not */ +/* OBSOLETE touch the thread at all except to resume it. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static char thread_is_in_kernel[MAXTHREADS]; */ +/* OBSOLETE */ +/* OBSOLETE /* The currently selected thread's number. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static int inferior_thread; */ +/* OBSOLETE */ +/* OBSOLETE /* Inferior process's file handle and a process control block */ +/* OBSOLETE to feed args to ioctl with. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static int inferior_fd; */ +/* OBSOLETE static struct pcntl ps; */ +/* OBSOLETE */ +/* OBSOLETE /* SOFF file headers for exec or core file. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static FILEHDR filehdr; */ +/* OBSOLETE static OPTHDR opthdr; */ +/* OBSOLETE static SCNHDR scnhdr; */ +/* OBSOLETE */ +/* OBSOLETE /* Address maps constructed from section headers of exec and core files. */ +/* OBSOLETE Defines process address -> file address translation. *x/ */ +/* OBSOLETE */ +/* OBSOLETE struct pmap */ +/* OBSOLETE { */ +/* OBSOLETE long mem_addr; /* process start address *x/ */ +/* OBSOLETE long mem_end; /* process end+1 address *x/ */ +/* OBSOLETE long file_addr; /* file start address *x/ */ +/* OBSOLETE long thread; /* -1 shared; 0,1,... thread-local *x/ */ +/* OBSOLETE long type; /* S_TEXT S_DATA S_BSS S_TBSS etc *x/ */ +/* OBSOLETE long which; /* used to sort map for info files *x/ */ +/* OBSOLETE }; */ +/* OBSOLETE */ +/* OBSOLETE static int n_exec, n_core; */ +/* OBSOLETE static struct pmap exec_map[100]; */ +/* OBSOLETE static struct pmap core_map[100]; */ +/* OBSOLETE */ +/* OBSOLETE /* Offsets in the core file of core_context and core_tcontext blocks. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static int context_offset; */ +/* OBSOLETE static int tcontext_offset[MAXTHREADS]; */ +/* OBSOLETE */ +/* OBSOLETE /* Core file control blocks. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static struct core_context_v70 c; */ +/* OBSOLETE static struct core_tcontext_v70 tc; */ +/* OBSOLETE static struct user u; */ +/* OBSOLETE static thread_t th; */ +/* OBSOLETE static proc_t pr; */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE /* Vector and communication registers from core dump or from inferior. */ +/* OBSOLETE These are read on demand, ie, not normally valid. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static struct vecst vector_registers; */ +/* OBSOLETE static struct creg_ctx comm_registers; */ +/* OBSOLETE */ +/* OBSOLETE /* Flag, set on a vanilla CONT command and cleared when the inferior */ +/* OBSOLETE is continued. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static int all_continue; */ +/* OBSOLETE */ +/* OBSOLETE /* Flag, set when the inferior is continued by a vanilla CONT command, */ +/* OBSOLETE cleared if it is continued for any other purpose. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static int thread_switch_ok; */ +/* OBSOLETE */ +/* OBSOLETE /* Stack of signals recieved from threads but not yet delivered to gdb. *x/ */ +/* OBSOLETE */ +/* OBSOLETE struct threadpid */ +/* OBSOLETE { */ +/* OBSOLETE int pid; */ +/* OBSOLETE int thread; */ +/* OBSOLETE int signo; */ +/* OBSOLETE int subsig; */ +/* OBSOLETE int pc; */ +/* OBSOLETE }; */ +/* OBSOLETE */ +/* OBSOLETE static struct threadpid signal_stack_bot[100]; */ +/* OBSOLETE static struct threadpid *signal_stack = signal_stack_bot; */ +/* OBSOLETE */ +/* OBSOLETE /* How to detect empty stack -- bottom frame is all zero. *x/ */ +/* OBSOLETE */ +/* OBSOLETE #define signal_stack_is_empty() (signal_stack->pid == 0) */ +/* OBSOLETE */ +/* OBSOLETE /* Mode controlled by SET PIPE command, controls the psw SEQ bit */ +/* OBSOLETE which forces each instruction to complete before the next one starts. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static int sequential = 0; */ +/* OBSOLETE */ +/* OBSOLETE /* Mode controlled by the SET PARALLEL command. Values are: */ +/* OBSOLETE 0 concurrency limit 1 thread, dynamic scheduling */ +/* OBSOLETE 1 no concurrency limit, dynamic scheduling */ +/* OBSOLETE 2 no concurrency limit, fixed scheduling *x/ */ +/* OBSOLETE */ +/* OBSOLETE static int parallel = 1; */ +/* OBSOLETE */ +/* OBSOLETE /* Mode controlled by SET BASE command, output radix for unformatted */ +/* OBSOLETE integer typeout, as in argument lists, aggregates, and so on. */ +/* OBSOLETE Zero means guess whether it's an address (hex) or not (decimal). *x/ */ +/* OBSOLETE */ +/* OBSOLETE static int output_radix = 0; */ +/* OBSOLETE */ +/* OBSOLETE /* Signal subcode at last thread stop. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static int stop_sigcode; */ +/* OBSOLETE */ +/* OBSOLETE /* Hack, see wait() below. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static int exec_trap_timer; */ +/* OBSOLETE */ +/* OBSOLETE #include "gdbcmd.h" */ +/* OBSOLETE */ +/* OBSOLETE static struct type *vector_type (); */ +/* OBSOLETE static long *read_vector_register (); */ +/* OBSOLETE static long *read_vector_register_1 (); */ +/* OBSOLETE static void write_vector_register (); */ +/* OBSOLETE static ULONGEST read_comm_register (); */ +/* OBSOLETE static void write_comm_register (); */ +/* OBSOLETE static void convex_cont_command (); */ +/* OBSOLETE static void thread_continue (); */ +/* OBSOLETE static void select_thread (); */ +/* OBSOLETE static void scan_stack (); */ +/* OBSOLETE static void set_fixed_scheduling (); */ +/* OBSOLETE static char *subsig_name (); */ +/* OBSOLETE static void psw_info (); */ +/* OBSOLETE static sig_noop (); */ +/* OBSOLETE static ptr_cmp (); */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE /* Execute ptrace. Convex V7 replaced ptrace with pattach. */ +/* OBSOLETE Allow ptrace (0) as a no-op. *x/ */ +/* OBSOLETE */ +/* OBSOLETE int */ +/* OBSOLETE call_ptrace (request, pid, procaddr, buf) */ +/* OBSOLETE int request, pid; */ +/* OBSOLETE PTRACE_ARG3_TYPE procaddr; */ +/* OBSOLETE int buf; */ +/* OBSOLETE { */ +/* OBSOLETE if (request == 0) */ +/* OBSOLETE return; */ +/* OBSOLETE error ("no ptrace"); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Replacement for system execle routine. */ +/* OBSOLETE Convert it to an equivalent exect, which pattach insists on. *x/ */ +/* OBSOLETE */ +/* OBSOLETE execle (name, argv) */ +/* OBSOLETE char *name, *argv; */ +/* OBSOLETE { */ +/* OBSOLETE char ***envp = (char ***) &argv; */ +/* OBSOLETE while (*envp++) ; */ +/* OBSOLETE */ +/* OBSOLETE signal (SIGTRAP, sig_noop); */ +/* OBSOLETE exect (name, &argv, *envp); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Stupid handler for stupid trace trap that otherwise causes */ +/* OBSOLETE startup to stupidly hang. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static sig_noop () */ +/* OBSOLETE {} */ +/* OBSOLETE */ +/* OBSOLETE /* Read registers from inferior into registers[] array. */ +/* OBSOLETE For convex, they are already there, read in when the inferior stops. *x/ */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE fetch_inferior_registers (regno) */ +/* OBSOLETE int regno; */ +/* OBSOLETE { */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Store our register values back into the inferior. */ +/* OBSOLETE For Convex, do this only once, right before resuming inferior. *x/ */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE store_inferior_registers (regno) */ +/* OBSOLETE int regno; */ +/* OBSOLETE { */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Copy LEN bytes from inferior's memory starting at MEMADDR */ +/* OBSOLETE to debugger memory starting at MYADDR. */ +/* OBSOLETE On failure (cannot read from inferior, usually because address is out */ +/* OBSOLETE of bounds) returns the value of errno. *x/ */ +/* OBSOLETE */ +/* OBSOLETE int */ +/* OBSOLETE read_inferior_memory (memaddr, myaddr, len) */ +/* OBSOLETE CORE_ADDR memaddr; */ +/* OBSOLETE char *myaddr; */ +/* OBSOLETE int len; */ +/* OBSOLETE { */ +/* OBSOLETE errno = 0; */ +/* OBSOLETE while (len > 0) */ +/* OBSOLETE { */ +/* OBSOLETE /* little-known undocumented max request size *x/ */ +/* OBSOLETE int i = (len < 12288) ? len : 12288; */ +/* OBSOLETE */ +/* OBSOLETE lseek (inferior_fd, memaddr, 0); */ +/* OBSOLETE read (inferior_fd, myaddr, i); */ +/* OBSOLETE */ +/* OBSOLETE memaddr += i; */ +/* OBSOLETE myaddr += i; */ +/* OBSOLETE len -= i; */ +/* OBSOLETE } */ +/* OBSOLETE if (errno) */ +/* OBSOLETE memset (myaddr, '\0', len); */ +/* OBSOLETE return errno; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Copy LEN bytes of data from debugger memory at MYADDR */ +/* OBSOLETE to inferior's memory at MEMADDR. */ +/* OBSOLETE Returns errno on failure (cannot write the inferior) *x/ */ +/* OBSOLETE */ +/* OBSOLETE int */ +/* OBSOLETE write_inferior_memory (memaddr, myaddr, len) */ +/* OBSOLETE CORE_ADDR memaddr; */ +/* OBSOLETE char *myaddr; */ +/* OBSOLETE int len; */ +/* OBSOLETE { */ +/* OBSOLETE errno = 0; */ +/* OBSOLETE lseek (inferior_fd, memaddr, 0); */ +/* OBSOLETE write (inferior_fd, myaddr, len); */ +/* OBSOLETE return errno; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Here from create_inferior when the inferior process has been created */ +/* OBSOLETE and started up. We must do a pattach to grab it for debugging. */ +/* OBSOLETE */ +/* OBSOLETE Also, intercept the CONT command by altering its dispatch address. *x/ */ +/* OBSOLETE /* FIXME: This used to be called from a macro CREATE_INFERIOR_HOOK. */ +/* OBSOLETE But now init_trace_fun is in the same place. So re-write this to */ +/* OBSOLETE use the init_trace_fun (making convex a debugging target). *x/ */ +/* OBSOLETE */ +/* OBSOLETE create_inferior_hook (pid) */ +/* OBSOLETE int pid; */ +/* OBSOLETE { */ +/* OBSOLETE static char cont[] = "cont"; */ +/* OBSOLETE static char cont1[] = "c"; */ +/* OBSOLETE char *linep = cont; */ +/* OBSOLETE char *linep1 = cont1; */ +/* OBSOLETE char **line = &linep; */ +/* OBSOLETE char **line1 = &linep1; */ +/* OBSOLETE struct cmd_list_element *c; */ +/* OBSOLETE */ +/* OBSOLETE c = lookup_cmd (line, cmdlist, "", 0); */ +/* OBSOLETE c->function = convex_cont_command; */ +/* OBSOLETE c = lookup_cmd (line1, cmdlist, "", 0); */ +/* OBSOLETE c->function = convex_cont_command; */ +/* OBSOLETE */ +/* OBSOLETE inferior_fd = pattach (pid, O_EXCL); */ +/* OBSOLETE if (inferior_fd < 0) */ +/* OBSOLETE perror_with_name ("pattach"); */ +/* OBSOLETE inferior_thread = 0; */ +/* OBSOLETE set_fixed_scheduling (pid, parallel == 2); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Attach process PID for debugging. *x/ */ +/* OBSOLETE */ +/* OBSOLETE attach (pid) */ +/* OBSOLETE int pid; */ +/* OBSOLETE { */ +/* OBSOLETE int fd = pattach (pid, O_EXCL); */ +/* OBSOLETE if (fd < 0) */ +/* OBSOLETE perror_with_name ("pattach"); */ +/* OBSOLETE attach_flag = 1; */ +/* OBSOLETE /* wait for strange kernel reverberations to go away *x/ */ +/* OBSOLETE sleep (1); */ +/* OBSOLETE */ +/* OBSOLETE setpgrp (pid, pid); */ +/* OBSOLETE */ +/* OBSOLETE inferior_fd = fd; */ +/* OBSOLETE inferior_thread = 0; */ +/* OBSOLETE return pid; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Stop debugging the process whose number is PID */ +/* OBSOLETE and continue it with signal number SIGNAL. */ +/* OBSOLETE SIGNAL = 0 means just continue it. *x/ */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE detach (signal) */ +/* OBSOLETE int signal; */ +/* OBSOLETE { */ +/* OBSOLETE signal_stack = signal_stack_bot; */ +/* OBSOLETE thread_continue (-1, 0, signal); */ +/* OBSOLETE ioctl (inferior_fd, PIXDETACH, &ps); */ +/* OBSOLETE close (inferior_fd); */ +/* OBSOLETE inferior_fd = 0; */ +/* OBSOLETE attach_flag = 0; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Kill off the inferior process. *x/ */ +/* OBSOLETE */ +/* OBSOLETE kill_inferior () */ +/* OBSOLETE { */ +/* OBSOLETE if (inferior_pid == 0) */ +/* OBSOLETE return; */ +/* OBSOLETE ioctl (inferior_fd, PIXTERMINATE, 0); */ +/* OBSOLETE wait (0); */ +/* OBSOLETE target_mourn_inferior (); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Read vector register REG, and return a pointer to the value. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static long * */ +/* OBSOLETE read_vector_register (reg) */ +/* OBSOLETE int reg; */ +/* OBSOLETE { */ +/* OBSOLETE if (have_inferior_p ()) */ +/* OBSOLETE { */ +/* OBSOLETE errno = 0; */ +/* OBSOLETE ps.pi_buffer = (char *) &vector_registers; */ +/* OBSOLETE ps.pi_nbytes = sizeof vector_registers; */ +/* OBSOLETE ps.pi_offset = 0; */ +/* OBSOLETE ps.pi_thread = inferior_thread; */ +/* OBSOLETE ioctl (inferior_fd, PIXRDVREGS, &ps); */ +/* OBSOLETE if (errno) */ +/* OBSOLETE memset (&vector_registers, '\0', sizeof vector_registers); */ +/* OBSOLETE } */ +/* OBSOLETE else if (corechan >= 0) */ +/* OBSOLETE { */ +/* OBSOLETE lseek (corechan, tcontext_offset[inferior_thread], 0); */ +/* OBSOLETE if (myread (corechan, &tc, sizeof tc) < 0) */ +/* OBSOLETE perror_with_name (corefile); */ +/* OBSOLETE lseek (corechan, tc.core_thread_p, 0); */ +/* OBSOLETE if (myread (corechan, &th, sizeof th) < 0) */ +/* OBSOLETE perror_with_name (corefile); */ +/* OBSOLETE lseek (corechan, tc.core_vregs_p, 0); */ +/* OBSOLETE if (myread (corechan, &vector_registers, 16*128) < 0) */ +/* OBSOLETE perror_with_name (corefile); */ +/* OBSOLETE vector_registers.vm[0] = th.t_vect_ctx.vc_vm[0]; */ +/* OBSOLETE vector_registers.vm[1] = th.t_vect_ctx.vc_vm[1]; */ +/* OBSOLETE vector_registers.vls = th.t_vect_ctx.vc_vls; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE return read_vector_register_1 (reg); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Return a pointer to vector register REG, which must already have been */ +/* OBSOLETE fetched from the inferior or core file. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static long * */ +/* OBSOLETE read_vector_register_1 (reg) */ +/* OBSOLETE int reg; */ +/* OBSOLETE { */ +/* OBSOLETE switch (reg) */ +/* OBSOLETE { */ +/* OBSOLETE case VM_REGNUM: */ +/* OBSOLETE return (long *) vector_registers.vm; */ +/* OBSOLETE case VS_REGNUM: */ +/* OBSOLETE return (long *) &vector_registers.vls; */ +/* OBSOLETE case VL_REGNUM: */ +/* OBSOLETE return 1 + (long *) &vector_registers.vls; */ +/* OBSOLETE default: */ +/* OBSOLETE return (long *) &vector_registers.vr[reg]; */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Write vector register REG, element ELEMENT, new value VAL. */ +/* OBSOLETE NB: must use read-modify-write on the entire vector state, */ +/* OBSOLETE since pattach does not do offsetted writes correctly. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE write_vector_register (reg, element, val) */ +/* OBSOLETE int reg, element; */ +/* OBSOLETE ULONGEST val; */ +/* OBSOLETE { */ +/* OBSOLETE if (have_inferior_p ()) */ +/* OBSOLETE { */ +/* OBSOLETE errno = 0; */ +/* OBSOLETE ps.pi_thread = inferior_thread; */ +/* OBSOLETE ps.pi_offset = 0; */ +/* OBSOLETE ps.pi_buffer = (char *) &vector_registers; */ +/* OBSOLETE ps.pi_nbytes = sizeof vector_registers; */ +/* OBSOLETE */ +/* OBSOLETE ioctl (inferior_fd, PIXRDVREGS, &ps); */ +/* OBSOLETE */ +/* OBSOLETE switch (reg) */ +/* OBSOLETE { */ +/* OBSOLETE case VL_REGNUM: */ +/* OBSOLETE vector_registers.vls = */ +/* OBSOLETE (vector_registers.vls & 0xffffffff00000000LL) */ +/* OBSOLETE + (unsigned long) val; */ +/* OBSOLETE break; */ +/* OBSOLETE */ +/* OBSOLETE case VS_REGNUM: */ +/* OBSOLETE vector_registers.vls = */ +/* OBSOLETE (val << 32) + (unsigned long) vector_registers.vls; */ +/* OBSOLETE break; */ +/* OBSOLETE */ +/* OBSOLETE default: */ +/* OBSOLETE vector_registers.vr[reg].el[element] = val; */ +/* OBSOLETE break; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE ioctl (inferior_fd, PIXWRVREGS, &ps); */ +/* OBSOLETE */ +/* OBSOLETE if (errno) */ +/* OBSOLETE perror_with_name ("writing vector register"); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Return the contents of communication register NUM. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static ULONGEST */ +/* OBSOLETE read_comm_register (num) */ +/* OBSOLETE int num; */ +/* OBSOLETE { */ +/* OBSOLETE if (have_inferior_p ()) */ +/* OBSOLETE { */ +/* OBSOLETE ps.pi_buffer = (char *) &comm_registers; */ +/* OBSOLETE ps.pi_nbytes = sizeof comm_registers; */ +/* OBSOLETE ps.pi_offset = 0; */ +/* OBSOLETE ps.pi_thread = inferior_thread; */ +/* OBSOLETE ioctl (inferior_fd, PIXRDCREGS, &ps); */ +/* OBSOLETE } */ +/* OBSOLETE return comm_registers.crreg.r4[num]; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Store a new value VAL into communication register NUM. */ +/* OBSOLETE NB: Must use read-modify-write on the whole comm register set */ +/* OBSOLETE since pattach does not do offsetted writes correctly. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE write_comm_register (num, val) */ +/* OBSOLETE int num; */ +/* OBSOLETE ULONGEST val; */ +/* OBSOLETE { */ +/* OBSOLETE if (have_inferior_p ()) */ +/* OBSOLETE { */ +/* OBSOLETE ps.pi_buffer = (char *) &comm_registers; */ +/* OBSOLETE ps.pi_nbytes = sizeof comm_registers; */ +/* OBSOLETE ps.pi_offset = 0; */ +/* OBSOLETE ps.pi_thread = inferior_thread; */ +/* OBSOLETE ioctl (inferior_fd, PIXRDCREGS, &ps); */ +/* OBSOLETE comm_registers.crreg.r4[num] = val; */ +/* OBSOLETE ioctl (inferior_fd, PIXWRCREGS, &ps); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Resume execution of the inferior process. */ +/* OBSOLETE If STEP is nonzero, single-step it. */ +/* OBSOLETE If SIGNAL is nonzero, give it that signal. *x/ */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE resume (step, signal) */ +/* OBSOLETE int step; */ +/* OBSOLETE int signal; */ +/* OBSOLETE { */ +/* OBSOLETE errno = 0; */ +/* OBSOLETE if (step || signal) */ +/* OBSOLETE thread_continue (inferior_thread, step, signal); */ +/* OBSOLETE else */ +/* OBSOLETE thread_continue (-1, 0, 0); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Maybe resume some threads. */ +/* OBSOLETE THREAD is which thread to resume, or -1 to resume them all. */ +/* OBSOLETE STEP and SIGNAL are as in resume. */ +/* OBSOLETE */ +/* OBSOLETE Global variable ALL_CONTINUE is set when we are here to do a */ +/* OBSOLETE `cont' command; otherwise we may be doing `finish' or a call or */ +/* OBSOLETE something else that will not tolerate an automatic thread switch. */ +/* OBSOLETE */ +/* OBSOLETE If there are stopped threads waiting to deliver signals, and */ +/* OBSOLETE ALL_CONTINUE, do not actually resume anything. gdb will do a wait */ +/* OBSOLETE and see one of the stopped threads in the queue. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE thread_continue (thread, step, signal) */ +/* OBSOLETE int thread, step, signal; */ +/* OBSOLETE { */ +/* OBSOLETE int n; */ +/* OBSOLETE */ +/* OBSOLETE /* If we are to continue all threads, but not for the CONTINUE command, */ +/* OBSOLETE pay no attention and continue only the selected thread. *x/ */ +/* OBSOLETE */ +/* OBSOLETE if (thread < 0 && ! all_continue) */ +/* OBSOLETE thread = inferior_thread; */ +/* OBSOLETE */ +/* OBSOLETE /* If we are not stepping, we have now executed the continue part */ +/* OBSOLETE of a CONTINUE command. *x/ */ +/* OBSOLETE */ +/* OBSOLETE if (! step) */ +/* OBSOLETE all_continue = 0; */ +/* OBSOLETE */ +/* OBSOLETE /* Allow wait() to switch threads if this is an all-out continue. *x/ */ +/* OBSOLETE */ +/* OBSOLETE thread_switch_ok = thread < 0; */ +/* OBSOLETE */ +/* OBSOLETE /* If there are threads queued up, don't resume. *x/ */ +/* OBSOLETE */ +/* OBSOLETE if (thread_switch_ok && ! signal_stack_is_empty ()) */ +/* OBSOLETE return; */ +/* OBSOLETE */ +/* OBSOLETE /* OK, do it. *x/ */ +/* OBSOLETE */ +/* OBSOLETE for (n = 0; n < n_threads; n++) */ +/* OBSOLETE if (thread_state[n] == PI_TALIVE) */ +/* OBSOLETE { */ +/* OBSOLETE select_thread (n); */ +/* OBSOLETE */ +/* OBSOLETE if ((thread < 0 || n == thread) && ! thread_is_in_kernel[n]) */ +/* OBSOLETE { */ +/* OBSOLETE /* Blam the trace bits in the stack's saved psws to match */ +/* OBSOLETE the desired step mode. This is required so that */ +/* OBSOLETE single-stepping a return doesn't restore a psw with a */ +/* OBSOLETE clear trace bit and fly away, and conversely, */ +/* OBSOLETE proceeding through a return in a routine that was */ +/* OBSOLETE stepped into doesn't cause a phantom break by restoring */ +/* OBSOLETE a psw with the trace bit set. *x/ */ +/* OBSOLETE scan_stack (PSW_T_BIT, step); */ +/* OBSOLETE scan_stack (PSW_S_BIT, sequential); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE ps.pi_buffer = registers; */ +/* OBSOLETE ps.pi_nbytes = REGISTER_BYTES; */ +/* OBSOLETE ps.pi_offset = 0; */ +/* OBSOLETE ps.pi_thread = n; */ +/* OBSOLETE if (! thread_is_in_kernel[n]) */ +/* OBSOLETE if (ioctl (inferior_fd, PIXWRREGS, &ps)) */ +/* OBSOLETE perror_with_name ("PIXWRREGS"); */ +/* OBSOLETE */ +/* OBSOLETE if (thread < 0 || n == thread) */ +/* OBSOLETE { */ +/* OBSOLETE ps.pi_pc = 1; */ +/* OBSOLETE ps.pi_signo = signal; */ +/* OBSOLETE if (ioctl (inferior_fd, step ? PIXSTEP : PIXCONTINUE, &ps) < 0) */ +/* OBSOLETE perror_with_name ("PIXCONTINUE"); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE if (ioctl (inferior_fd, PIXRUN, &ps) < 0) */ +/* OBSOLETE perror_with_name ("PIXRUN"); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Replacement for system wait routine. */ +/* OBSOLETE */ +/* OBSOLETE The system wait returns with one or more threads stopped by */ +/* OBSOLETE signals. Put stopped threads on a stack and return them one by */ +/* OBSOLETE one, so that it appears that wait returns one thread at a time. */ +/* OBSOLETE */ +/* OBSOLETE Global variable THREAD_SWITCH_OK is set when gdb can tolerate wait */ +/* OBSOLETE returning a new thread. If it is false, then only one thread is */ +/* OBSOLETE running; we will do a real wait, the thread will do something, and */ +/* OBSOLETE we will return that. *x/ */ +/* OBSOLETE */ +/* OBSOLETE pid_t */ +/* OBSOLETE wait (w) */ +/* OBSOLETE union wait *w; */ +/* OBSOLETE { */ +/* OBSOLETE int pid; */ +/* OBSOLETE */ +/* OBSOLETE if (!w) */ +/* OBSOLETE return wait3 (0, 0, 0); */ +/* OBSOLETE */ +/* OBSOLETE /* Do a real wait if we were told to, or if there are no queued threads. *x/ */ +/* OBSOLETE */ +/* OBSOLETE if (! thread_switch_ok || signal_stack_is_empty ()) */ +/* OBSOLETE { */ +/* OBSOLETE int thread; */ +/* OBSOLETE */ +/* OBSOLETE pid = wait3 (w, 0, 0); */ +/* OBSOLETE */ +/* OBSOLETE if (!WIFSTOPPED (*w) || pid != inferior_pid) */ +/* OBSOLETE return pid; */ +/* OBSOLETE */ +/* OBSOLETE /* The inferior has done something and stopped. Read in all the */ +/* OBSOLETE threads' registers, and queue up any signals that happened. *x/ */ +/* OBSOLETE */ +/* OBSOLETE if (ioctl (inferior_fd, PIXGETTHCOUNT, &ps) < 0) */ +/* OBSOLETE perror_with_name ("PIXGETTHCOUNT"); */ +/* OBSOLETE */ +/* OBSOLETE n_threads = ps.pi_othdcnt; */ +/* OBSOLETE for (thread = 0; thread < n_threads; thread++) */ +/* OBSOLETE { */ +/* OBSOLETE ps.pi_thread = thread; */ +/* OBSOLETE if (ioctl (inferior_fd, PIXGETSUBCODE, &ps) < 0) */ +/* OBSOLETE perror_with_name ("PIXGETSUBCODE"); */ +/* OBSOLETE thread_state[thread] = ps.pi_otstate; */ +/* OBSOLETE */ +/* OBSOLETE if (ps.pi_otstate == PI_TALIVE) */ +/* OBSOLETE { */ +/* OBSOLETE select_thread (thread); */ +/* OBSOLETE ps.pi_buffer = registers; */ +/* OBSOLETE ps.pi_nbytes = REGISTER_BYTES; */ +/* OBSOLETE ps.pi_offset = 0; */ +/* OBSOLETE ps.pi_thread = thread; */ +/* OBSOLETE if (ioctl (inferior_fd, PIXRDREGS, &ps) < 0) */ +/* OBSOLETE perror_with_name ("PIXRDREGS"); */ +/* OBSOLETE */ +/* OBSOLETE registers_fetched (); */ +/* OBSOLETE */ +/* OBSOLETE thread_pc[thread] = read_pc (); */ +/* OBSOLETE thread_signal[thread] = ps.pi_osigno; */ +/* OBSOLETE thread_sigcode[thread] = ps.pi_osigcode; */ +/* OBSOLETE */ +/* OBSOLETE /* If the thread's stack has a context frame */ +/* OBSOLETE on top, something fucked is going on. I do not */ +/* OBSOLETE know what, but do I know this: the only thing you */ +/* OBSOLETE can do with such a thread is continue it. *x/ */ +/* OBSOLETE */ +/* OBSOLETE thread_is_in_kernel[thread] = */ +/* OBSOLETE ((read_register (PS_REGNUM) >> 25) & 3) == 0; */ +/* OBSOLETE */ +/* OBSOLETE /* Signals push an extended frame and then fault */ +/* OBSOLETE with a ridiculous pc. Pop the frame. *x/ */ +/* OBSOLETE */ +/* OBSOLETE if (thread_pc[thread] > STACK_END_ADDR) */ +/* OBSOLETE { */ +/* OBSOLETE POP_FRAME; */ +/* OBSOLETE if (is_break_pc (thread_pc[thread])) */ +/* OBSOLETE thread_pc[thread] = read_pc () - 2; */ +/* OBSOLETE else */ +/* OBSOLETE thread_pc[thread] = read_pc (); */ +/* OBSOLETE write_register (PC_REGNUM, thread_pc[thread]); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE if (ps.pi_osigno || ps.pi_osigcode) */ +/* OBSOLETE { */ +/* OBSOLETE signal_stack++; */ +/* OBSOLETE signal_stack->pid = pid; */ +/* OBSOLETE signal_stack->thread = thread; */ +/* OBSOLETE signal_stack->signo = thread_signal[thread]; */ +/* OBSOLETE signal_stack->subsig = thread_sigcode[thread]; */ +/* OBSOLETE signal_stack->pc = thread_pc[thread]; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* The following hackery is caused by a unix 7.1 feature: */ +/* OBSOLETE the inferior's fixed scheduling mode is cleared when */ +/* OBSOLETE it execs the shell (since the shell is not a parallel */ +/* OBSOLETE program). So, note the 5.4 trap we get when */ +/* OBSOLETE the shell does its exec, then catch the 5.0 trap */ +/* OBSOLETE that occurs when the debuggee starts, and set fixed */ +/* OBSOLETE scheduling mode properly. *x/ */ +/* OBSOLETE */ +/* OBSOLETE if (ps.pi_osigno == 5 && ps.pi_osigcode == 4) */ +/* OBSOLETE exec_trap_timer = 1; */ +/* OBSOLETE else */ +/* OBSOLETE exec_trap_timer--; */ +/* OBSOLETE */ +/* OBSOLETE if (ps.pi_osigno == 5 && exec_trap_timer == 0) */ +/* OBSOLETE set_fixed_scheduling (pid, parallel == 2); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE if (signal_stack_is_empty ()) */ +/* OBSOLETE error ("no active threads?!"); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Select the thread that stopped, and return *w saying why. *x/ */ +/* OBSOLETE */ +/* OBSOLETE select_thread (signal_stack->thread); */ +/* OBSOLETE */ +/* OBSOLETE FIXME: need to convert from host sig. */ +/* OBSOLETE stop_signal = signal_stack->signo; */ +/* OBSOLETE stop_sigcode = signal_stack->subsig; */ +/* OBSOLETE */ +/* OBSOLETE WSETSTOP (*w, signal_stack->signo); */ +/* OBSOLETE w->w_thread = signal_stack->thread; */ +/* OBSOLETE return (signal_stack--)->pid; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Select thread THREAD -- its registers, stack, per-thread memory. */ +/* OBSOLETE This is the only routine that may assign to inferior_thread */ +/* OBSOLETE or thread_regs[]. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE select_thread (thread) */ +/* OBSOLETE int thread; */ +/* OBSOLETE { */ +/* OBSOLETE if (thread == inferior_thread) */ +/* OBSOLETE return; */ +/* OBSOLETE */ +/* OBSOLETE memcpy (thread_regs[inferior_thread], registers, REGISTER_BYTES); */ +/* OBSOLETE ps.pi_thread = inferior_thread = thread; */ +/* OBSOLETE if (have_inferior_p ()) */ +/* OBSOLETE ioctl (inferior_fd, PISETRWTID, &ps); */ +/* OBSOLETE memcpy (registers, thread_regs[thread], REGISTER_BYTES); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Routine to set or clear a psw bit in the psw and also all psws */ +/* OBSOLETE saved on the stack. Quits when we get to a frame in which the */ +/* OBSOLETE saved psw is correct. *x/ */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE scan_stack (bit, val) */ +/* OBSOLETE long bit, val; */ +/* OBSOLETE { */ +/* OBSOLETE long ps = read_register (PS_REGNUM); */ +/* OBSOLETE long fp; */ +/* OBSOLETE if (val ? !(ps & bit) : (ps & bit)) */ +/* OBSOLETE { */ +/* OBSOLETE ps ^= bit; */ +/* OBSOLETE write_register (PS_REGNUM, ps); */ +/* OBSOLETE */ +/* OBSOLETE fp = read_register (FP_REGNUM); */ +/* OBSOLETE while (fp & 0x80000000) */ +/* OBSOLETE { */ +/* OBSOLETE ps = read_memory_integer (fp + 4, 4); */ +/* OBSOLETE if (val ? (ps & bit) : !(ps & bit)) */ +/* OBSOLETE break; */ +/* OBSOLETE ps ^= bit; */ +/* OBSOLETE write_memory (fp + 4, &ps, 4); */ +/* OBSOLETE fp = read_memory_integer (fp + 8, 4); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Set fixed scheduling (alliant mode) of process PID to ARG (0 or 1). *x/ */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE set_fixed_scheduling (pid, arg) */ +/* OBSOLETE int arg; */ +/* OBSOLETE { */ +/* OBSOLETE struct pattributes pattr; */ +/* OBSOLETE getpattr (pid, &pattr); */ +/* OBSOLETE pattr.pattr_pfixed = arg; */ +/* OBSOLETE setpattr (pid, &pattr); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE core_file_command (filename, from_tty) */ +/* OBSOLETE char *filename; */ +/* OBSOLETE int from_tty; */ +/* OBSOLETE { */ +/* OBSOLETE int n; */ +/* OBSOLETE */ +/* OBSOLETE /* Discard all vestiges of any previous core file */ +/* OBSOLETE and mark data and stack spaces as empty. *x/ */ +/* OBSOLETE */ +/* OBSOLETE if (corefile) */ +/* OBSOLETE free (corefile); */ +/* OBSOLETE corefile = 0; */ +/* OBSOLETE */ +/* OBSOLETE if (corechan >= 0) */ +/* OBSOLETE close (corechan); */ +/* OBSOLETE corechan = -1; */ +/* OBSOLETE */ +/* OBSOLETE data_start = 0; */ +/* OBSOLETE data_end = 0; */ +/* OBSOLETE stack_start = STACK_END_ADDR; */ +/* OBSOLETE stack_end = STACK_END_ADDR; */ +/* OBSOLETE n_core = 0; */ +/* OBSOLETE */ +/* OBSOLETE /* Now, if a new core file was specified, open it and digest it. *x/ */ +/* OBSOLETE */ +/* OBSOLETE if (filename) */ +/* OBSOLETE { */ +/* OBSOLETE filename = tilde_expand (filename); */ +/* OBSOLETE make_cleanup (free, filename); */ +/* OBSOLETE */ +/* OBSOLETE if (have_inferior_p ()) */ +/* OBSOLETE error ("To look at a core file, you must kill the program with \"kill\"."); */ +/* OBSOLETE corechan = open (filename, O_RDONLY, 0); */ +/* OBSOLETE if (corechan < 0) */ +/* OBSOLETE perror_with_name (filename); */ +/* OBSOLETE */ +/* OBSOLETE if (myread (corechan, &filehdr, sizeof filehdr) < 0) */ +/* OBSOLETE perror_with_name (filename); */ +/* OBSOLETE */ +/* OBSOLETE if (!IS_CORE_SOFF_MAGIC (filehdr.h_magic)) */ +/* OBSOLETE error ("%s: not a core file.\n", filename); */ +/* OBSOLETE */ +/* OBSOLETE if (myread (corechan, &opthdr, filehdr.h_opthdr) < 0) */ +/* OBSOLETE perror_with_name (filename); */ +/* OBSOLETE */ +/* OBSOLETE /* Read through the section headers. */ +/* OBSOLETE For text, data, etc, record an entry in the core file map. */ +/* OBSOLETE For context and tcontext, record the file address of */ +/* OBSOLETE the context blocks. *x/ */ +/* OBSOLETE */ +/* OBSOLETE lseek (corechan, (long) filehdr.h_scnptr, 0); */ +/* OBSOLETE */ +/* OBSOLETE n_threads = 0; */ +/* OBSOLETE for (n = 0; n < filehdr.h_nscns; n++) */ +/* OBSOLETE { */ +/* OBSOLETE if (myread (corechan, &scnhdr, sizeof scnhdr) < 0) */ +/* OBSOLETE perror_with_name (filename); */ +/* OBSOLETE if ((scnhdr.s_flags & S_TYPMASK) >= S_TEXT */ +/* OBSOLETE && (scnhdr.s_flags & S_TYPMASK) <= S_COMON) */ +/* OBSOLETE { */ +/* OBSOLETE core_map[n_core].mem_addr = scnhdr.s_vaddr; */ +/* OBSOLETE core_map[n_core].mem_end = scnhdr.s_vaddr + scnhdr.s_size; */ +/* OBSOLETE core_map[n_core].file_addr = scnhdr.s_scnptr; */ +/* OBSOLETE core_map[n_core].type = scnhdr.s_flags & S_TYPMASK; */ +/* OBSOLETE if (core_map[n_core].type != S_TBSS */ +/* OBSOLETE && core_map[n_core].type != S_TDATA */ +/* OBSOLETE && core_map[n_core].type != S_TTEXT) */ +/* OBSOLETE core_map[n_core].thread = -1; */ +/* OBSOLETE else if (n_core == 0 */ +/* OBSOLETE || core_map[n_core-1].mem_addr != scnhdr.s_vaddr) */ +/* OBSOLETE core_map[n_core].thread = 0; */ +/* OBSOLETE else */ +/* OBSOLETE core_map[n_core].thread = core_map[n_core-1].thread + 1; */ +/* OBSOLETE n_core++; */ +/* OBSOLETE } */ +/* OBSOLETE else if ((scnhdr.s_flags & S_TYPMASK) == S_CONTEXT) */ +/* OBSOLETE context_offset = scnhdr.s_scnptr; */ +/* OBSOLETE else if ((scnhdr.s_flags & S_TYPMASK) == S_TCONTEXT) */ +/* OBSOLETE tcontext_offset[n_threads++] = scnhdr.s_scnptr; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Read the context block, struct user, struct proc, */ +/* OBSOLETE and the comm regs. *x/ */ +/* OBSOLETE */ +/* OBSOLETE lseek (corechan, context_offset, 0); */ +/* OBSOLETE if (myread (corechan, &c, sizeof c) < 0) */ +/* OBSOLETE perror_with_name (filename); */ +/* OBSOLETE lseek (corechan, c.core_user_p, 0); */ +/* OBSOLETE if (myread (corechan, &u, sizeof u) < 0) */ +/* OBSOLETE perror_with_name (filename); */ +/* OBSOLETE lseek (corechan, c.core_proc_p, 0); */ +/* OBSOLETE if (myread (corechan, &pr, sizeof pr) < 0) */ +/* OBSOLETE perror_with_name (filename); */ +/* OBSOLETE comm_registers = pr.p_creg; */ +/* OBSOLETE */ +/* OBSOLETE /* Core file apparently is really there. Make it really exist */ +/* OBSOLETE for xfer_core_file so we can do read_memory on it. *x/ */ +/* OBSOLETE */ +/* OBSOLETE if (filename[0] == '/') */ +/* OBSOLETE corefile = savestring (filename, strlen (filename)); */ +/* OBSOLETE else */ +/* OBSOLETE corefile = concat (current_directory, "/", filename, NULL); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("Program %s ", u.u_comm); */ +/* OBSOLETE */ +/* OBSOLETE /* Read the thread registers and fill in the thread_xxx[] data. *x/ */ +/* OBSOLETE */ +/* OBSOLETE for (n = 0; n < n_threads; n++) */ +/* OBSOLETE { */ +/* OBSOLETE select_thread (n); */ +/* OBSOLETE */ +/* OBSOLETE lseek (corechan, tcontext_offset[n], 0); */ +/* OBSOLETE if (myread (corechan, &tc, sizeof tc) < 0) */ +/* OBSOLETE perror_with_name (corefile); */ +/* OBSOLETE lseek (corechan, tc.core_thread_p, 0); */ +/* OBSOLETE if (myread (corechan, &th, sizeof th) < 0) */ +/* OBSOLETE perror_with_name (corefile); */ +/* OBSOLETE */ +/* OBSOLETE lseek (corechan, tc.core_syscall_context_p, 0); */ +/* OBSOLETE if (myread (corechan, registers, REGISTER_BYTES) < 0) */ +/* OBSOLETE perror_with_name (corefile); */ +/* OBSOLETE */ +/* OBSOLETE thread_signal[n] = th.t_cursig; */ +/* OBSOLETE thread_sigcode[n] = th.t_code; */ +/* OBSOLETE thread_state[n] = th.t_state; */ +/* OBSOLETE thread_pc[n] = read_pc (); */ +/* OBSOLETE */ +/* OBSOLETE if (thread_pc[n] > STACK_END_ADDR) */ +/* OBSOLETE { */ +/* OBSOLETE POP_FRAME; */ +/* OBSOLETE if (is_break_pc (thread_pc[n])) */ +/* OBSOLETE thread_pc[n] = read_pc () - 2; */ +/* OBSOLETE else */ +/* OBSOLETE thread_pc[n] = read_pc (); */ +/* OBSOLETE write_register (PC_REGNUM, thread_pc[n]); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("thread %d received signal %d, %s\n", */ +/* OBSOLETE n, thread_signal[n], */ +/* OBSOLETE safe_strsignal (thread_signal[n])); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Select an interesting thread -- also-rans died with SIGKILL, */ +/* OBSOLETE so find one that didn't. *x/ */ +/* OBSOLETE */ +/* OBSOLETE for (n = 0; n < n_threads; n++) */ +/* OBSOLETE if (thread_signal[n] != 0 && thread_signal[n] != SIGKILL) */ +/* OBSOLETE { */ +/* OBSOLETE select_thread (n); */ +/* OBSOLETE stop_signal = thread_signal[n]; */ +/* OBSOLETE stop_sigcode = thread_sigcode[n]; */ +/* OBSOLETE break; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE core_aouthdr.a_magic = 0; */ +/* OBSOLETE */ +/* OBSOLETE flush_cached_frames (); */ +/* OBSOLETE select_frame (get_current_frame (), 0); */ +/* OBSOLETE validate_files (); */ +/* OBSOLETE */ +/* OBSOLETE print_stack_frame (selected_frame, selected_frame_level, -1); */ +/* OBSOLETE } */ +/* OBSOLETE else if (from_tty) */ +/* OBSOLETE printf_filtered ("No core file now.\n"); */ +/* OBSOLETE } */ diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 11124c7055..10e4ef7de9 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,29 @@ +Fri Jun 25 11:47:06 1999 Andrew Cagney + + * remote.texi (Communication Protocol): ``v'' is in use. Fix + numerous formatting errors. Clarify ``i''. Mark ``i'', ``Z'', + ``z'' and ``qRcmd'' as draft instead of reserved. Identify + packets that are not supported on all hosts. Expand examples. + Spell check. + +1999-06-24 Jason Molenda (jsm@bugshack.cygnus.com) + + * Makefile.in: Recognize html, install-html. Add targets + to build HTML versions of documentation via texi2html. + +Thu Jun 24 15:59:03 1999 Stan Shebs + + * gdbint.texinfo (Testsuite): New chapter, information about the + testsuite. + +Fri Jun 25 02:40:34 1999 Andrew Cagney + + * remote.texi (Communication Protocol): Rewrite. + +Thu Jun 24 16:59:54 1999 Andrew Cagney + + * stabs.texinfo: Fix uses of xref. + Thu Jun 17 17:23:25 1999 Stan Shebs * gdbint.texinfo: Add an anti-printf exhortation, and update the diff --git a/gdb/doc/Makefile.in b/gdb/doc/Makefile.in index 4bcd62ec16..f81e58363b 100644 --- a/gdb/doc/Makefile.in +++ b/gdb/doc/Makefile.in @@ -23,6 +23,7 @@ VPATH = @srcdir@ prefix = @prefix@ infodir = @infodir@ +htmldir = $(prefix)/html SHELL = @SHELL@ @@ -39,6 +40,9 @@ TEXIDIR=${gdbdir}/../texinfo # where to find makeinfo, preferably one designed for texinfo-2 MAKEINFO=makeinfo +MAKEHTML = texi2html +MAKEHTMLFLAGS = -glossary -menu -split_chapter + # where to find texi2roff, ditto TEXI2ROFF=texi2roff @@ -94,6 +98,7 @@ all install: info: gdb.info gdbint.info stabs.info dvi: gdb.dvi gdbint.dvi stabs.dvi refcard.dvi ps: gdb.ps gdbint.ps stabs.ps refcard.ps +html: gdb_toc.html gdbint_toc.html stabs_toc.html all-doc: info dvi ps install-info: info @@ -101,6 +106,11 @@ install-info: info $(INSTALL_DATA) $$i $(infodir)/$$i ; \ done +install-html: html + for i in *.html ; do \ + $(INSTALL_DATA) $$i $(htmldir)/$$i ; \ + done + STAGESTUFF = *.info* gdb-all.texi GDBvn.texi *.ps *.dvi # Copy the object files from a particular stage into a subdirectory. @@ -152,7 +162,7 @@ distclean: clean # "clean" or "distclean". Use maintainer-clean to remove them. maintainer-clean realclean: distclean - rm -f GDBvn.texi *.info* *.dvi *.ps + rm -f GDBvn.texi *.info* *.dvi *.ps *.html # GDB QUICK REFERENCE (dvi output) refcard.dvi : refcard.tex $(REFEDITS) @@ -303,6 +313,11 @@ gdb.mm: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi sed -e 's/---/\\(em/g' \ >gdb.mm +# GDB MANUAL: HTML file + +gdb_toc.html: ${SFILES_DOC} + $(MAKEHTML) $(MAKEHTMLFLAGS) -I ${READLINE_DIR} -I $(srcdir) $(srcdir)/gdb.texinfo + # GDB INTERNALS MANUAL: TeX dvi file gdbint.dvi : gdbint.texinfo @@ -320,9 +335,19 @@ gdbint.ps : gdbint.dvi gdbint.info: gdbint.texinfo $(MAKEINFO) -o gdbint.info $(srcdir)/gdbint.texinfo +# GDB INTERNALS MANUAL: HTML file + +gdbint_toc.html: gdbint.texinfo + $(MAKEHTML) $(MAKEHTMLFLAGS) $(srcdir)/gdbint.texinfo + stabs.info: stabs.texinfo $(MAKEINFO) -o stabs.info $(srcdir)/stabs.texinfo +# STABS DOCUMENTATION: HTML file + +stabs_toc.html: stabs.texinfo + $(MAKEHTML) $(MAKEHTMLFLAGS) $(srcdir)/stabs.texinfo + # STABS DOCUMENTATION: TeX dvi file stabs.dvi : stabs.texinfo $(SET_TEXINPUTS) $(TEX) stabs.texinfo diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 10e5278dbe..4db5212a69 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -86,6 +86,7 @@ as the mechanisms that adapt GDB to specific hosts and targets. * Support Libraries:: * Coding:: * Porting GDB:: +* Testsuite:: * Hints:: @end menu @@ -2559,6 +2560,149 @@ files @file{gdb.info*} in the distribution. Note the plural; @code{makeinfo} will split the document into one overall file and five or so included files. +@node Testsuite + +@chapter Testsuite + +The testsuite is an important component of the GDB package. While it is +always worthwhile to encourage user testing, in practice this is rarely +sufficient; users typically use only a small subset of the available +commands, and it has proven all too common for a change to cause a +significant regression that went unnoticed for some time. + +The GDB testsuite uses the DejaGNU testing framework. DejaGNU is built +using tcl and expect. The tests themselves are calls to various tcl +procs; the framework runs all the procs and summarizes the passes and +fails. + +@section Using the Testsuite + +To run the testsuite, simply go to the GDB object directory (or to the +testsuite's objdir) and type @code{make check}. This just sets up some +environment variables and invokes DejaGNU's @code{runtest} script. While +the testsuite is running, you'll get mentions of which test file is in use, +and a mention of any unexpected passes or fails. When the testsuite is +finished, you'll get a summary that looks like this: +@example + === gdb Summary === + +# of expected passes 6016 +# of unexpected failures 58 +# of unexpected successes 5 +# of expected failures 183 +# of unresolved testcases 3 +# of untested testcases 5 +@end example +The ideal test run consists of expected passes only; however, reality +conspires to keep us from this ideal. Unexpected failures indicate +real problems, whether in GDB or in the testsuite. Expected failures +are still failures, but ones which have been decided are too hard to +deal with at the time; for instance, a test case might work everywhere +except on AIX, and there is no prospect of the AIX case being fixed in +the near future. Expected failures should not be added lightly, since +you may be masking serious bugs in GDB. Unexpected successes are expected +fails that are passing for some reason, while unresolved and untested +cases often indicate some minor catastrophe, such as the compiler being +unable to deal with a test program. + +When making any significant change to GDB, you should run the testsuite +before and after the change, to confirm that there are no regressions. +Note that truly complete testing would require that you run the +testsuite with all supported configurations and a variety of compilers; +however this is more than really necessary. In many cases testing with +a single configuration is sufficient. Other useful options are to test +one big-endian (Sparc) and one little-endian (x86) host, a cross config +with a builtin simulator (powerpc-eabi, mips-elf), or a 64-bit host +(Alpha). + +If you add new functionality to GDB, please consider adding tests for it +as well; this way future GDB hackers can detect and fix their changes +that break the functionality you added. Similarly, if you fix a bug +that was not previously reported as a test failure, please add a test +case for it. Some cases are extremely difficult to test, such as code +that handles host OS failures or bugs in particular versions of +compilers, and it's OK not to try to write tests for all of those. + +@section Testsuite Organization + +The testsuite is entirely contained in @file{gdb/testsuite}. While the +testsuite includes some makefiles and configury, these are very minimal, +and used for little besides cleaning up, since the tests themselves +handle the compilation of the programs that GDB will run. The file +@file{testsuite/lib/gdb.exp} contains common utility procs useful for +all GDB tests, while the directory @file{testsuite/config} contains +configuration-specific files, typically used for special-purpose +definitions of procs like @code{gdb_load} and @code{gdb_start}. + +The tests themselves are to be found in @file{testsuite/gdb.*} and +subdirectories of those. The names of the test files must always end +with @file{.exp}. DejaGNU collects the test files by wildcarding +in the test directories, so both subdirectories and individual files +get chosen and run in alphabetical order. + +The following table lists the main types of subdirectories and what they +are for. Since DejaGNU finds test files no matter where they are +located, and since each test file sets up its own compilation and +execution environment, this organization is simply for convenience and +intelligibility. + +@table @code + +@item gdb.base + +This is the base testsuite. The tests in it should apply to all +configurations of GDB (but generic native-only tests may live here). +The test programs should be in the subset of C that is valid K&R, +ANSI/ISO, and C++ (ifdefs are allowed if necessary, for instance +for prototypes). + +@item gdb.@var{lang} + +Language-specific tests for all languages besides C. Examples are +@file{gdb.c++} and @file{gdb.java}. + +@item gdb.@var{platform} + +Non-portable tests. The tests are specific to a specific configuration +(host or target), such as HP-UX or eCos. Example is @file{gdb.hp}, for +HP-UX. + +@item gdb.@var{compiler} + +Tests specific to a particular compiler. As of this writing (June +1999), there aren't currently any groups of tests in this category that +couldn't just as sensibly be made platform-specific, but one could +imagine a gdb.gcc, for tests of GDB's handling of GCC extensions. + +@item gdb.@var{subsystem} + +Tests that exercise a specific GDB subsystem in more depth. For +instance, @file{gdb.disasm} exercises various disassemblers, while +@file{gdb.stabs} tests pathways through the stabs symbol reader. + +@end table + +@section Writing Tests + +In many areas, the GDB tests are already quite comprehensive; you +should be able to copy existing tests to handle new cases. + +You should try to use @code{gdb_test} whenever possible, since it +includes cases to handle all the unexpected errors that might happen. +However, it doesn't cost anything to add new test procedures; for +instance, @file{gdb.base/exprs.exp} defines a @code{test_expr} that +calls @code{gdb_test} multiple times. + +Only use @code{send_gdb} and @code{gdb_expect} when absolutely +necessary, such as when GDB has several valid responses to a command. + +The source language programs do @emph{not} need to be in a consistent +style. Since GDB is used to debug programs written in many different +styles, it's worth having a mix of styles in the testsuite; for +instance, some GDB bugs involving the display of source lines would +never manifest themselves if the programs used GNU coding style +uniformly. + @node Hints @chapter Hints diff --git a/gdb/doc/remote.texi b/gdb/doc/remote.texi index adf8e0094f..7b3c05760e 100644 --- a/gdb/doc/remote.texi +++ b/gdb/doc/remote.texi @@ -95,7 +95,7 @@ recently added stubs. * Stub Contents:: What the stub can do for you * Bootstrapping:: What you must do for the stub * Debug Session:: Putting it all together -* Protocol:: Outline of the communication protocol +* Protocol:: Definition of the communication protocol * Server:: Using the `gdbserver' program * NetWare:: Using the `gdbserve.nlm' program @end menu @@ -365,79 +365,620 @@ the protocol---for example, if there is only one serial port to your target machine, you might want your program to do something special if it recognizes a packet meant for @value{GDBN}. +In the examples below, @samp{<-} and @samp{->} are used to indicate +transmitted and received data respectfully. + @cindex protocol, @value{GDBN} remote serial @cindex serial protocol, @value{GDBN} remote @cindex remote serial protocol -All @value{GDBN} commands and responses (other than acknowledgements, which -are single characters) are sent as a packet which includes a -checksum. A packet is introduced with the character @samp{$}, and ends -with the character @samp{#} followed by a two-digit checksum: +All @value{GDBN} commands and responses (other than acknowledgments) +are sent as a @var{packet}. A @var{packet} is introduced with the +character @samp{$}, this is followed by an optional two-digit +@var{sequence-id} and the character @samp{:}, the actual +@var{packet-data}, and the terminating character @samp{#} followed by a +two-digit @var{checksum}: @example -$@var{packet info}#@var{checksum} +@code{$}@var{packet-data}@code{#}@var{checksum} +@end example +@noindent +or, with the optional @var{sequence-id}: +@example +@code{$}@var{sequence-id}@code{:}@var{packet-data}@code{#}@var{checksum} @end example @cindex checksum, for @value{GDBN} remote @noindent -@var{checksum} is computed as the modulo 256 sum of the @var{packet -info} characters. +The two-digit @var{checksum} is computed as the modulo 256 sum of all +characters between the leading @samp{$} and the trailing @samp{#} (that +consisting of both the optional @var{sequence-id}@code{:} and the actual +@var{packet-data}). + +@cindex sequence-id, for @value{GDBN} remote +@noindent +The two-digit @var{sequence-id}, when present, is returned with the +acknowledgment. Beyond that its meaning is poorly defined. +@value{GDBN} is not known to output @var{sequence-id}s. When either the host or the target machine receives a packet, the first -response expected is an acknowledgement: a single character, either -@samp{+} (to indicate the package was received correctly) or @samp{-} -(to request retransmission). +response expected is an acknowledgment: either @samp{+} (to indicate +the package was received correctly) or @samp{-} (to request +retransmission): -The host (@value{GDBN}) sends commands, and the target (the debugging stub -incorporated in your program) sends data in response. The target also -sends data when your program stops. +@example +<- @code{$}@var{packet-data}@code{#}@var{checksum} +-> @code{+} +@end example +@noindent +If the received packet included a @var{sequence-id} than that is +appended to a positive acknowledgment: -Command packets are distinguished by their first character, which -identifies the kind of command. +@example +<- @code{$}@var{sequence-id}@code{:}@var{packet-data}@code{#}@var{checksum} +-> @code{+}@var{sequence-id} +@end example -These are some of the commands currently supported (for a complete list of -commands, look in @file{gdb/remote.c.}): +The host (@value{GDBN}) sends @var{command}s, and the target (the +debugging stub incorporated in your program) sends a @var{response}. In +the case of step and continue @var{command}s, the response is only sent +when the operation has completed (the target has again stopped). + +@var{packet-data} consists of a sequence of characters with the +exception of @samp{#} and @samp{$} (see @samp{X} packet for an +exception). @samp{:} can not appear as the third character in a packet. +Fields within the packet should be separated using @samp{,} and @samp{;} +(unfortunately some packets chose to use @samp{:}). Except where +otherwise noted all numbers are represented in HEX with leading zeros +suppressed. + +Response @var{data} can be run-length encoded to save space. A @samp{*} +means that the next character is an ASCII encoding giving a repeat count +which stands for that many repetitions of the character preceding the +@samp{*}. The encoding is @code{n+29}, yielding a printable character +where @code{n >=3} (which is where rle starts to win). Don't use an +@code{n > 126}. + +So: +@example +"@code{0* }" +@end example +@noindent +means the same as "0000". -@table @code -@item g -Requests the values of CPU registers. +The error response, returned for some packets includes a two character +error number. That number is not well defined. -@item G -Sets the values of CPU registers. +For any @var{command} not supported by the stub, an empty response +(@samp{$#00}) should be returned. That way it is possible to extend the +protocol. A newer @value{GDBN} can tell if a packet is supported based +on the response. -@item m@var{addr},@var{count} -Read @var{count} bytes at location @var{addr}. +Below is a complete list of all currently defined @var{command}s and +their corresponding response @var{data}: -@item M@var{addr},@var{count}:@dots{} -Write @var{count} bytes at location @var{addr}. +@multitable @columnfractions .30 .30 .40 +@item Packet +@tab Request +@tab Description -@need 500 -@item c -@itemx c@var{addr} -Resume execution at the current address (or at @var{addr} if supplied). +@item extended ops @emph{(optional)} +@tab @code{!} +@tab +Use the extended remote protocol. Sticky -- only needs to be set once. +The extended remote protocol support the @samp{R} packet. +@item +@tab reply @samp{} +@tab +Stubs that support the extended remote protocol return @samp{} which, +unfortunately, is identical to the response returned by stubs that do not +support protocol extensions. + +@item last signal +@tab @code{?} +@tab +Reply the current reason for stopping. This is the same reply as is +generated for step or cont : @code{S}@var{AA} where @var{AA} is the +signal number. + +@item reserved +@tab @code{a} +@tab Reserved for future use + +@item set program arguments @strong{(reserved)} @emph{(optional)} +@tab @code{A}@var{arglen}@code{,}@var{argnum}@code{,}@var{arg}@code{,...} +@tab +Initialized @samp{argv[]} array passed into program. @var{arglen} +specifies the number of bytes in the hex encoded byte stream @var{arg}. +@item +@tab reply @code{OK} +@item +@tab reply @code{E}@var{NN} + +@item set baud @strong{(deprecated)} +@tab @code{b}@var{baud} +@tab +Change the serial line speed to @var{baud}. JTC: @emph{When does the +transport layer state change? When it's received, or after the ACK is +transmitted. In either case, there are problems if the command or the +acknowledgment packet is dropped.} Stan: @emph{If people really wanted +to add something like this, and get it working for the first time, they +ought to modify ser-unix.c to send some kind of out-of-band message to a +specially-setup stub and have the switch happen "in between" packets, so +that from remote protocol's point of view, nothing actually +happened.} + +@item set breakpoint @strong{(deprecated)} +@tab @code{B}@var{addr},@var{mode} +@tab +Set (@var{mode} is @samp{S}) or clear (@var{mode} is @samp{C}) a +breakpoint at @var{addr}. @emph{This has been replaced by the @samp{Z} and +@samp{z} packets.} + +@item continue +@tab @code{c}@var{addr} +@tab +@var{addr} is address to resume. If @var{addr} is omitted, resume at +current address. +@item +@tab reply +@tab see below + +@item continue with signal @emph{(optional)} +@tab @code{C}@var{sig}@code{;}@var{addr} +@tab +Continue with signal @var{sig} (hex signal number). If +@code{;}@var{addr} is omitted, resume at same address. +@item +@tab reply +@tab see below -@need 500 -@item s -@itemx s@var{addr} -Step the target program for one instruction, from either the current -program counter or from @var{addr} if supplied. - -@item k -Kill the target program. - -@item ? -Report the most recent signal. To allow you to take advantage of the -@value{GDBN} signal handling commands, one of the functions of the debugging -stub is to report CPU traps as the corresponding POSIX signal values. - -@item T -Allows the remote stub to send only the registers that @value{GDBN} needs -to make a quick decision about single-stepping or conditional breakpoints. -This eliminates the need to fetch the entire register set for each instruction -being stepped through. - -@value{GDBN} now implements a write-through cache for registers and only -re-reads the registers if the target has run. -@end table +@item toggle debug @emph{(optional)} +@tab @code{d} +@tab +toggle debug flag (see 386 & 68k stubs) + +@item detach @emph{(optional)} +@tab @code{D} +@tab Reply OK. + +@item reserved +@tab @code{e} +@tab Reserved for future use + +@item reserved +@tab @code{E} +@tab Reserved for future use + +@item reserved +@tab @code{f} +@tab Reserved for future use + +@item reserved +@tab @code{F} +@tab Reserved for future use + +@item read registers +@tab @code{g} +@tab Read general registers. +@item +@tab reply @var{XX...} +@tab +Each byte of register data is described by two hex digits. The bytes +with the register are transmitted in target byte order. The size of +each register and their position within the @samp{g} @var{packet} is +determined by the @var{REGISTER_RAW_SIZE} and @var{REGISTER_NAME} +macros. +@item +@tab @code{E}@var{NN} +@tab for an error. + +@item write regs +@tab @code{G}@var{XX...} +@tab +See @samp{g} for a description of the @var{XX...} data. +@item +@tab reply @code{OK} +@tab for success +@item +@tab reply @code{E}@var{NN} +@tab for an error + +@item reserved +@tab @code{h} +@tab Reserved for future use + +@item set thread @emph{(optional)} +@tab @code{H}@var{c}@var{t...} +@tab +Set thread for subsequent operations. @var{c} = @samp{c} for thread +used in step and continue; @var{t...} can be -1 for all threads. +@var{c} = @samp{g} for thread used in other operations. If zero, pick a +thread, any thread. +@item +@tab reply @code{OK} +@tab for success +@item +@tab reply @code{E}@var{NN} +@tab for an error + +@item cycle step @strong{(draft)} @emph{(optional)} +@tab @code{i}@var{addr}@code{,}@var{nnn} +@tab +Step the remote target by a single clock cycle. If @code{,}@var{nnn} is +present, cycle step @var{nnn} cycles. If @var{addr} is present, cycle +step starting at that address. + +@item signal then cycle step @strong{(reserved)} @emph{(optional)} +@tab @code{I} +@tab +See @samp{i} and @samp{S} for likely syntax and semantics. + +@item reserved +@tab @code{j} +@tab Reserved for future use + +@item reserved +@tab @code{J} +@tab Reserved for future use + +@item kill request @emph{(optional)} +@tab @code{k} +@tab + +@item reserved +@tab @code{l} +@tab Reserved for future use + +@item reserved +@tab @code{L} +@tab Reserved for future use + +@item read memory +@tab @code{m}@var{addr}@code{,}@var{length} +@tab +Read @var{length} bytes of memory starting at address @var{addr}. +@item +@tab reply @var{XX...} +@tab +@var{XX...} is mem contents. Can be fewer bytes than requested if able to +read only part of the data. +@item +@tab reply @code{E}@var{NN} +@tab @var{NN} is errno + +@item write mem +@tab @code{M}@var{addr},@var{length}@code{:}@var{XX...} +@tab +Write @var{length} bytes of memory starting at address @var{addr}. +@var{XX...} is the data. +@item +@tab reply @code{OK} +@tab for success +@item +@tab reply @code{E}@var{NN} +@tab +for an error (this includes the case where only part of the data was +written). + +@item reserved +@tab @code{n} +@tab Reserved for future use + +@item reserved +@tab @code{N} +@tab Reserved for future use + +@item reserved +@tab @code{o} +@tab Reserved for future use + +@item reserved +@tab @code{O} +@tab Reserved for future use + +@item read reg @strong{(reserved)} +@tab @code{p}@var{n...} +@tab +See write register. +@item +@tab return @var{r....} +@tab The hex encoded value of the register in target byte order. + +@item write reg @emph{(optional)} +@tab @code{P}@var{n...}@code{=}@var{r...} +@tab +Write register @var{n...} with value @var{r...}, which contains two hex +digits for each byte in the register (target byte order). +@item +@tab reply @code{OK} +@tab for success +@item +@tab reply @code{E}@var{NN} +@tab for an error + +@item general query @emph{(optional)} +@tab @code{q}@var{query} +@tab +Request info about @var{query}. In general @value{GDBN} @var{query}'s +have a leading upper case letter. Custom vendor queries should use a +leading lower case letter and a company prefix, ex: @samp{qfsf.var}. +@var{query} may optionally be followed by a @samp{,} or @samp{;} +separated list. Stubs should ensure that they fully match any +@var{query} name. +@item +@tab reply @code{XX...} +@tab Hex encoded data from query. The reply can not be empty. +@item +@tab reply @code{E}@var{NN} +@tab error reply +@item +@tab reply @samp{} +@tab Indicating an unrecognized @var{query}. + +@item current thread +@tab @code{q}@code{C} +@tab Return the current thread id. +@item +@tab reply @code{QC}@var{pid} +@tab +Where @var{pid} is a HEX encoded 16 bit process id. +@item +@tab reply * +@tab Any other reply implies the old pid. + +@item compute CRC of memory block +@tab @code{q}@code{CRC:}@var{addr}@code{,}@var{length} +@tab +@item +@tab reply @code{E}@var{NN} +@tab An error (such as memory fault) +@item +@tab reply @code{C}@var{CRC32} +@tab A 32 bit cyclic redundancy check of the specified memory region. + +@item query @var{LIST} or @var{threadLIST} +@tab @code{q}@code{L}@var{startflag}@var{threadcount}@var{nextthread} +@tab +Obtain thread information from RTOS. @var{startflag} is one hex digit; +@var{threadcount} is two hex digits; and @var{nextthread} is 16 hex +digits. +@item +@tab reply * +@tab +See @code{remote.c:parse_threadlist_response()}. + +@item query sect offs +@tab @code{q}@code{Offsets} +@tab Get section offsets. +@item +@tab reply @code{Text=}@var{xxx}@code{;Data=}@var{yyy}@code{;Bss=}@var{zzz} + +@item thread info request +@tab @code{q}@code{P}@var{mode}@var{threadid} +@tab +Returns information on @var{threadid}. Where: @var{mode} is a hex +encoded 32 bit mode; @var{threadid} is a hex encoded 64 bit thread ID. +@item +@tab reply * +@tab +See @code{remote.c:remote_unpack_thread_info_response()}. + +@item remote command @strong{(reserved)} +@tab @code{q}@code{Rcmd,}@var{COMMAND} +@tab +@var{COMMAND} (hex encoded) is passed to the local interpreter for +execution. @emph{Implementors should note that providing access to a +stubs's interpreter may have security implications}. +@item +@tab reply @var{OUTPUT} +@tab +The @var{OUTPUT} (hex encoded). Must be non-empty. +@item +@tab reply @samp{} +@tab +When @samp{q}@samp{Rcmd} is not recognized. + +@item general set @emph{(optional)} +@tab @code{Q}@var{var}@code{=}@var{val} +@tab +Set value of @var{var} to @var{val}. See @samp{q} for a discussing of +naming conventions. + +@item reset @emph{(optional)} +@tab r +@tab reset -- see sparc stub. + +@item remote restart @emph{(optional)} +@tab @code{R}@var{XX} +@tab +Restart the remote server. @var{XX} while needed has no clear +definition. + +@item step @emph{(optional)} +@tab @code{s}@var{addr} +@tab +@var{addr} is address to resume. If @var{addr} is omitted, resume at +same address. +@item +@tab reply +@tab see below + +@item step with signal @emph{(optional)} +@tab @code{S}@var{sig}@code{;}@var{addr} +@tab +Like @samp{C} but step not continue. +@item +@tab reply +@tab see below + +@item search @emph{(optional)} +@tab @code{t}@var{addr}@code{:}@var{PP}@code{,}@var{MM} +@tab +Search backwards starting at address @var{addr} for a match with pattern +@var{PP} and mask @var{MM}. @var{PP} and @var{MM} are 4 +bytes. @var{addr} must be at least 3 digits. + +@item thread alive @emph{(optional)} +@tab @code{T}@var{XX} +@tab Find out if the thread XX is alive. +@item +@tab reply @code{OK} +@tab thread is still alive +@item +@tab reply @code{E}@var{NN} +@tab thread is dead + +@item reserved +@tab @code{u} +@tab Reserved for future use + +@item reserved +@tab @code{U} +@tab Reserved for future use + +@item reserved +@tab @code{v} +@tab Reserved for future use + +@item reserved +@tab @code{V} +@tab Reserved for future use + +@item reserved +@tab @code{w} +@tab Reserved for future use + +@item reserved +@tab @code{W} +@tab Reserved for future use + +@item reserved +@tab @code{x} +@tab Reserved for future use + +@item write mem (binary) @emph{(optional)} +@tab @code{X}@var{addr}@code{,}@var{length}@var{:}@var{XX...} +@tab +@var{addr} is address, @var{length} is number of bytes, @var{XX...} is +binary data. +@item +@tab reply @code{OK} +@tab for success +@item +@tab reply @code{E}@var{NN} +@tab for an error + +@item reserved +@tab @code{y} +@tab Reserved for future use + +@item reserved +@tab @code{Y} +@tab Reserved for future use + +@item remove break or watchpoint @strong{(draft)} @emph{(optional)} +@tab @code{z}@var{t}@code{,}@var{addr}@code{,}@var{length} +@tab +See @samp{Z}. + +@item insert break or watchpoint @strong{(draft)} @emph{(optional)} +@tab @code{Z}@var{t}@code{,}@var{addr}@code{,}@var{length} +@tab +@var{t} is type: @samp{0} - software breakpoint, @samp{1} - hardware +breakpoint, @samp{2} - write watchpoint, @samp{3} - read watchpoint, +@samp{4} - access watchpoint; @var{addr} is address; @var{length} is in +bytes. For a software breakpoint, @var{length} specifies the size of +the instruction to be patched. For hardware breakpoints and watchpoints +@var{length} specifies the memory region to be monitored. +@item +@tab reply @code{E}@var{NN} +@tab for an error +@item +@tab reply @code{OK} +@tab for success +@item +@tab @samp{} +@tab If not supported. + +@item reserved +@tab +@tab Reserved for future use + +@end multitable + +In the case of the @samp{C}, @samp{c}, @samp{S} and @samp{s} packets, +there is no immediate response. The reply, described below, comes when +the machine stops: + +@multitable @columnfractions .4 .6 + +@item @code{S}@var{AA} +@tab @var{AA} is the signal number + +@item @code{T}@var{AA}@var{n...}@code{:}@var{r...}@code{;}@var{n...}@code{:}@var{r...}@code{;}@var{n...}@code{:}@var{r...}@code{;} +@tab +@var{AA} = two hex digit signal number; @var{n...} = register number +(hex), @var{r...} = target byte ordered register contents, size defined +by @code{REGISTER_RAW_SIZE}; @var{n...} = @samp{thread}, @var{r...} = +thread process ID, this is a hex integer; @var{n...} = other string not +starting with valid hex digit. @value{GDBN} should ignore this +@var{n...}, @var{r...} pair and go on to the next. This way we can +extend the protocol. + +@item @code{W}@var{AA} +@tab +The process exited, and @var{AA} is the exit status. This is only +applicable for certains sorts of targets. + +@item @code{X}@var{AA} +@tab +The process terminated with signal @var{AA}. + +@item @code{N}@var{AA}@code{;}@var{tttttttt}@code{;}@var{dddddddd}@code{;}@var{bbbbbbbb} @strong{(obsolete)} +@tab +@var{AA} = signal number; @var{tttttttt} = address of symbol "_start"; +@var{dddddddd} = base of data section; @var{bbbbbbbb} = base of bss +section. @emph{Note: only used by Cisco Systems targets. The difference +between this reply and the "qOffsets" query is that the 'N' packet may +arrive spontaneously whereas the 'qOffsets' is a query initiated by the +host debugger.} + +@item @code{O}@var{XX...} +@tab +@var{XX...} is hex encoding of ASCII data. This can happen at any time +while the program is running and the debugger should continue to wait +for 'W', 'T', etc. + +@end multitable + +Example sequence of a target being re-started. Notice how the restart +does not get any direct output: + +@example +<- @code{R00} +-> @code{+} +@emph{target restarts} +<- @code{?} +-> @code{+} +-> @code{T001:1234123412341234} +<- @code{+} +@end example + +Example sequence of a target being stepped by a single instruction: + +@example +<- @code{G1445...} +-> @code{+} +<- @code{s} +-> @code{+} +@emph{time passes} +-> @code{T001:1234123412341234} +<- @code{+} +<- @code{g} +-> @code{+} +-> @code{1455...} +<- @code{+} +@end example @kindex set remotedebug @kindex show remotedebug diff --git a/gdb/doc/stabs.texinfo b/gdb/doc/stabs.texinfo index 2e4f7b81ad..8239ce7004 100644 --- a/gdb/doc/stabs.texinfo +++ b/gdb/doc/stabs.texinfo @@ -872,7 +872,7 @@ produces the following stabs: .stabn 224,0,0,LBE2 # @r{224 is N_RBRAC} @end example -@xref{Procedures} for more information on the @code{N_FUN} stab, and +See @ref{Procedures} for more information on the @code{N_FUN} stab, and @ref{Block Structure} for more information on the @code{N_LBRAC} and @code{N_RBRAC} stabs. @@ -3370,7 +3370,7 @@ for more information about their use. Variable on the stack; see @ref{Stack Variables}. @item : -C++ nested symbol; see @xref{Nested Symbols} +C++ nested symbol; see @xref{Nested Symbols}. @item a Parameter passed by reference in register; see @ref{Reference Parameters}. diff --git a/gdb/event-loop.c b/gdb/event-loop.c index fc20df10bb..1e22e06c0f 100644 --- a/gdb/event-loop.c +++ b/gdb/event-loop.c @@ -119,8 +119,10 @@ sighandler_list; function. */ static int async_handler_ready = 0; +static void create_file_handler PARAMS ((int, int, file_handler_func *, gdb_client_data)); static void invoke_async_signal_handler PARAMS ((void)); static int gdb_wait_for_event PARAMS ((void)); +static int gdb_do_one_event PARAMS ((void)); static int check_async_ready PARAMS ((void)); @@ -236,7 +238,7 @@ process_event () wait for something to happen (via gdb_wait_for_event), then process it. Returns 1 if something was done otherwise returns 0 (this can happen if there are no event sources to wait for). */ -int +static int gdb_do_one_event () { int result = 0; @@ -278,6 +280,9 @@ gdb_do_one_event () } /* end of if !set_top_level */ else { + /* FIXME: this should really be a call to a hook that is + interface specific, because interfaces can display the + prompt in their own way. */ display_gdb_prompt (0); /* Maybe better to set a flag to be checked somewhere as to whether display the prompt or not. */ @@ -285,8 +290,42 @@ gdb_do_one_event () } return result; } + +/* Start up the event loop. This is the entry point to the event loop + from the command loop. */ +void +start_event_loop () +{ + /* Loop until there is something to do. This is the entry point to + the event loop engine. gdb_do_one_event will process one event + for each invocation. It always returns 1, unless there are no + more event sources registered. In this case it returns 0. */ + while (gdb_do_one_event () != 0) + ; + + /* We are done with the event loop. There are no more event sources + to listen to. So we exit GDB. */ + return; +} + +/* Wrapper function for create_file_handler, so that the caller + doesn't have to know implementation details about the use of poll + vs. select. */ +void +add_file_handler (fd, proc, client_data) + int fd; + file_handler_func *proc; + gdb_client_data client_data; +{ +#ifdef HAVE_POLL + create_file_handler (fd, POLLIN, (file_handler_func *) proc, client_data); +#else + create_file_handler (fd, GDB_READABLE, (file_handler_func *) proc, client_data); +#endif +} + /* Add a file handler/descriptor to the list of descriptors we are interested in. FD is the file descriptor for the file/stream to be listened to. @@ -297,7 +336,7 @@ gdb_do_one_event () For the select case, MASK is a combination of READABLE, WRITABLE, EXCEPTION. PROC is the procedure that will be called when an event occurs for FD. CLIENT_DATA is the argument to pass to PROC. */ -void +static void create_file_handler (fd, mask, proc, client_data) int fd; int mask; diff --git a/gdb/event-loop.h b/gdb/event-loop.h index 5305a673bc..e06fb8cb52 100644 --- a/gdb/event-loop.h +++ b/gdb/event-loop.h @@ -222,28 +222,33 @@ struct prompts #define PREFIX(X) the_prompts.prompt_stack[the_prompts.top + X].prefix #define SUFFIX(X) the_prompts.prompt_stack[the_prompts.top + X].suffix -/* Exported functions from event-top.c */ +/* Exported functions from event-loop.c */ +extern void start_event_loop PARAMS ((void)); extern void delete_file_handler PARAMS ((int)); -extern void - create_file_handler PARAMS ((int, int, file_handler_func, gdb_client_data)); -extern int gdb_do_one_event PARAMS ((void)); +extern void add_file_handler PARAMS ((int, file_handler_func, gdb_client_data)); extern void mark_async_signal_handler PARAMS ((async_signal_handler *)); extern async_signal_handler * create_async_signal_handler PARAMS ((async_handler_func *, gdb_client_data)); extern void delete_async_signal_handler PARAMS ((async_signal_handler *async_handler_ptr)); + +/* Exported functions from event-top.c. + FIXME: these should really go into top.h. */ + extern void display_gdb_prompt PARAMS ((char*)); -extern void start_event_loop PARAMS ((void)); extern void async_init_signals PARAMS ((void)); extern void set_async_editing_command PARAMS ((char *, int, struct cmd_list_element *)); extern void set_async_annotation_level PARAMS ((char *, int, struct cmd_list_element *)); extern void set_async_prompt PARAMS ((char *, int, struct cmd_list_element *)); extern void handle_stop_sig PARAMS ((int)); +extern void gdb_readline2 PARAMS ((void)); -/* Exported variables from event-top.c */ +/* Exported variables from event-top.c. + FIXME: these should really go into top.h. */ extern int async_command_editing_p; extern char *async_annotation_suffix; extern char *new_async_prompt; extern struct prompts the_prompts; - +extern void (*call_readline) PARAMS ((void)); +extern void (*input_handler) PARAMS ((char *)); diff --git a/gdb/event-top.c b/gdb/event-top.c index f658b715d5..223e670c70 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -20,9 +20,6 @@ #include "defs.h" #include "top.h" -#ifdef HAVE_POLL -#include -#endif #include "inferior.h" #include "terminal.h" /* for job_control*/ #include @@ -38,7 +35,7 @@ extern void _initialize_event_loop PARAMS ((void)); static void command_line_handler PARAMS ((char *)); -static void gdb_readline2 PARAMS ((void)); +void gdb_readline2 PARAMS ((void)); static void pop_prompt PARAMS ((void)); static void push_prompt PARAMS ((char *, char *, char *)); static void change_line_handler PARAMS ((void)); @@ -160,9 +157,9 @@ readline_input_state; /* Initialize all the necessary variables, start the event loop, - register readline, and stdin. */ + register readline, and stdin, start the loop. */ void -start_event_loop () +cli_command_loop () { int length; char *a_prompt; @@ -185,16 +182,8 @@ start_event_loop () else display_gdb_prompt (0); - /* Loop until there is something to do. This is the entry point to - the event loop engine. gdb_do_one_event will process one event - for each invocation. It always returns 1, unless there are no - more event sources registered. In this case it returns 0. */ - while (gdb_do_one_event () != 0) - ; - - /* We are done with the event loop. There are no more event sources - to listen to. So we exit GDB. */ - return; + /* Now it's time to start the event loop. */ + start_event_loop (); } /* Change the function to be invoked every time there is a character @@ -227,14 +216,13 @@ change_line_handler () input file descriptor, we need to create a new event source, corresponding to the same fd, but with a new event handler function. */ + /* NOTE: this operates on input_fd, not instream. If we are reading + commands from a file, instream will point to the file. However in + async mode, we always read commands from a file with editing + off. This means that the 'set editing on/off' will have effect + only on the interactive session. */ delete_file_handler (input_fd); -#ifdef HAVE_POLL - create_file_handler (input_fd, POLLIN, - (file_handler_func *) call_readline, 0); -#else - create_file_handler (input_fd, GDB_READABLE, - (file_handler_func *) call_readline, 0); -#endif + add_file_handler (input_fd, (file_handler_func *) call_readline, 0); } /* Displays the prompt. The prompt that is displayed is the current @@ -682,7 +670,7 @@ command_line_handler (rl) /* NOTE: 1999-04-30 Asynchronous version of gdb_readline. gdb_readline will become obsolete when the event loop is made the default execution for gdb. */ -static void +void gdb_readline2 () { int c; @@ -1001,9 +989,12 @@ _initialize_event_loop () rl_instream = instream; /* Get a file descriptor for the input stream, so that we can - register it with the event loop. */ + register it with the event loop. */ input_fd = fileno (instream); + /* Tell gdb to use the cli_command_loop as the main loop. */ + command_loop_hook = cli_command_loop; + /* Now we need to create the event sources for the input file descriptor. */ /* At this point in time, this is the only event source that we @@ -1011,13 +1002,12 @@ _initialize_event_loop () the target program (inferior), but that must be registered only when it actually exists (I.e. after we say 'run' or after we connect to a remote target. */ -#ifdef HAVE_POLL - create_file_handler (input_fd, POLLIN, - (file_handler_func *) call_readline, 0); -#else - create_file_handler (input_fd, GDB_READABLE, - (file_handler_func *) call_readline, 0); -#endif + add_file_handler (input_fd, (file_handler_func *) call_readline, 0); + + /* Tell gdb that we will be using the readline library. This + could be overwritten by a command in .gdbinit like 'set + editing on' or 'off'. */ + async_command_editing_p = 1; } } diff --git a/gdb/frame.h b/gdb/frame.h index f15d65d3f5..b00d8f1706 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -245,7 +245,7 @@ extern void generic_fix_call_dummy PARAMS ((char *dummy, CORE_ADDR pc, CORE_ADDR int nargs, struct value **args, struct type *type, int gcc_p)); -#ifdef __GNUC__ +#ifdef __STDC__ /* Some native compilers, even ones that are supposed to be ANSI and for which __STDC__ is true, complain about forward decls of enums. */ enum lval_type; diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index b016e134c5..d55050ff2d 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -37,6 +37,7 @@ man7dir = $(mandir)/man7 man8dir = $(mandir)/man8 man9dir = $(mandir)/man9 infodir = $(prefix)/info +htmldir = $(prefix)/html includedir = $(prefix)/include SHELL = /bin/sh @@ -159,6 +160,8 @@ installcheck: check: info dvi: install-info: +html: +install-html: clean-info: gdbserver: $(OBS) ${ADD_DEPS} ${CDEPS} diff --git a/gdb/main.c b/gdb/main.c index 12522ff77d..09f4cff0f1 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -1,5 +1,5 @@ /* Top level stuff for GDB, the GNU debugger. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995 + Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 1999 Free Software Foundation, Inc. This file is part of GDB. @@ -48,7 +48,7 @@ int display_space; invoked on the command line with the -nw --async options. In this version, the usual command_loop is substituted by and event loop which processes UI events asynchronously. */ -int async_p = 0; +int async_p = 1; /* Whether this is the command line version or not */ int tui_version = 0; @@ -390,10 +390,6 @@ main (argc, argv) quiet = 1; } - /* Get ready to invoke the event loop instead of the - command_loop. See event-loop.h for more details.*/ - if (async_p) - command_loop_hook = start_event_loop; #if defined(TUI) /* Should this be moved to tui-top.c:_initialize_tui()? */ if (tui_version) diff --git a/gdb/nlm/Makefile.in b/gdb/nlm/Makefile.in index 54511387a0..b494da98f2 100644 --- a/gdb/nlm/Makefile.in +++ b/gdb/nlm/Makefile.in @@ -41,6 +41,7 @@ man7dir = $(mandir)/man7 man8dir = $(mandir)/man8 man9dir = $(mandir)/man9 infodir = @infodir@ +htmldir = $(prefix)/html includedir = @includedir@ SHELL = @SHELL@ @@ -115,6 +116,8 @@ check: info dvi: install-info: clean-info: +html: +install-html: gdbserve.nlm: gdbserve.O $(srcdir)/gdbserve.def ${NLMCONV_FOR_TARGET} -T $(srcdir)/gdbserve.def diff --git a/gdb/rdi-share/Makefile.in b/gdb/rdi-share/Makefile.in index 11410058a6..33274dac7a 100644 --- a/gdb/rdi-share/Makefile.in +++ b/gdb/rdi-share/Makefile.in @@ -28,6 +28,7 @@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ +htmldir = $(prefix)/html mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include @@ -234,6 +235,8 @@ distdir: $(DISTFILES) info: dvi: check: +html: +install-html: installcheck: install-info: install-exec: diff --git a/gdb/remote.c b/gdb/remote.c index e1b0b1ec6c..8fadca8c41 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -485,7 +485,7 @@ set_thread (th, gen) int th; int gen; { - char buf[PBUFSIZ]; + char *buf = alloca (PBUFSIZ); int state = gen ? general_thread : continue_thread; if (state == th) @@ -1059,7 +1059,7 @@ remote_get_threadinfo (threadid, fieldset, info) struct gdb_ext_thread_info *info; { int result; - char threadinfo_pkt[PBUFSIZ]; + char *threadinfo_pkt = alloca (PBUFSIZ); pack_threadinfo_request (threadinfo_pkt, fieldset, threadid); putpkt (threadinfo_pkt); @@ -1146,8 +1146,8 @@ remote_get_threadlist (startflag, nextthread, result_limit, { static threadref echo_nextthread; - char threadlist_packet[PBUFSIZ]; - char t_response[PBUFSIZ]; + char *threadlist_packet = alloca (PBUFSIZ); + char *t_response = alloca (PBUFSIZ); int result = 1; /* Trancate result limit to be smaller than the packet size */ @@ -1267,7 +1267,7 @@ static int remote_current_thread (oldpid) int oldpid; { - char buf[PBUFSIZ]; + char *buf = alloca (PBUFSIZ); putpkt ("qC"); getpkt (buf, 0); @@ -1291,7 +1291,8 @@ remote_find_new_threads () static void remote_threads_info (void) { - char buf[PBUFSIZ], *bufp; + char *buf = alloca (PBUFSIZ); + char *bufp; int tid; if (remote_desc == 0) /* paranoia */ @@ -1323,7 +1324,7 @@ remote_threads_info (void) static void extended_remote_restart () { - char buf[PBUFSIZ]; + char *buf = alloca (PBUFSIZ); /* Send the restart command; for reasons I don't understand the remote side really expects a number after the "R". */ @@ -1354,7 +1355,8 @@ remote_close (quitting) static void get_offsets () { - char buf[PBUFSIZ], *ptr; + char *buf = alloca (PBUFSIZ); + char *ptr; int lose; CORE_ADDR text_addr, data_addr, bss_addr; struct section_offsets *offs; @@ -1414,7 +1416,7 @@ get_offsets () if (symfile_objfile == NULL) return; - offs = (struct section_offsets *) alloca (sizeof (struct section_offsets) + offs = alloca (sizeof (struct section_offsets) + symfile_objfile->num_sections * sizeof (offs->offsets)); memcpy (offs, symfile_objfile->section_offsets, @@ -1697,7 +1699,7 @@ serial device is attached to the remote system (e.g. /dev/ttya)."); if (extended_p) { /* tell the remote that we're using the extended protocol. */ - char buf[PBUFSIZ]; + char *buf = alloca (PBUFSIZ); putpkt ("!"); getpkt (buf, 0); } @@ -1713,7 +1715,7 @@ remote_detach (args, from_tty) char *args; int from_tty; { - char buf[PBUFSIZ]; + char *buf = alloca (PBUFSIZ); if (args) error ("Argument given to \"detach\" when remotely debugging."); @@ -1766,7 +1768,7 @@ remote_resume (pid, step, siggnal) int pid, step; enum target_signal siggnal; { - char buf[PBUFSIZ]; + char *buf = alloca (PBUFSIZ); if (pid == -1) set_thread (0, 0); /* run any thread */ @@ -1896,7 +1898,7 @@ remote_wait (pid, status) int pid; struct target_waitstatus *status; { - unsigned char buf[PBUFSIZ]; + unsigned char *buf = alloca (PBUFSIZ); int thread_num = -1; status->kind = TARGET_WAITKIND_EXITED; @@ -2119,7 +2121,7 @@ static void remote_fetch_registers (regno) int regno; { - char buf[PBUFSIZ]; + char *buf = alloca (PBUFSIZ); int i; char *p; char regs[REGISTER_BYTES]; @@ -2207,7 +2209,7 @@ static void remote_store_registers (regno) int regno; { - char buf[PBUFSIZ]; + char *buf = alloca (PBUFSIZ); int i; char *p; @@ -2360,7 +2362,8 @@ check_binary_download (addr) { if (remote_binary_download && !remote_binary_checked) { - char buf[PBUFSIZ], *p; + char *buf = alloca (PBUFSIZ); + char *p; remote_binary_checked = 1; p = buf; @@ -2403,6 +2406,7 @@ remote_write_bytes (memaddr, myaddr, len) char *myaddr; int len; { + unsigned char *buf = alloca (PBUFSIZ); int max_buf_size; /* Max size of packet output buffer */ int origlen; @@ -2421,7 +2425,6 @@ remote_write_bytes (memaddr, myaddr, len) origlen = len; while (len > 0) { - unsigned char buf[PBUFSIZ]; unsigned char *p, *plen; int todo; int i; @@ -2534,6 +2537,7 @@ remote_read_bytes (memaddr, myaddr, len) char *myaddr; int len; { + char *buf = alloca (PBUFSIZ); int max_buf_size; /* Max size of packet output buffer */ int origlen; @@ -2546,7 +2550,6 @@ remote_read_bytes (memaddr, myaddr, len) origlen = len; while (len > 0) { - char buf[PBUFSIZ]; char *p; int todo; int i; @@ -2647,7 +2650,7 @@ remote_search (len, data, mask, startaddr, increment, lorange, hirange long mask_long, data_long; long data_found_long; CORE_ADDR addr_we_found; - char buf[PBUFSIZ]; + char *buf = alloca (PBUFSIZ); long returned_long[2]; char *p; @@ -2779,7 +2782,9 @@ putpkt_binary (buf, cnt) { int i; unsigned char csum = 0; - char buf2[PBUFSIZ]; + char *buf2 = alloca (PBUFSIZ); + char *junkbuf = alloca (PBUFSIZ); + int ch; int tcount = 0; char *p; @@ -2850,8 +2855,6 @@ putpkt_binary (buf, cnt) break; /* Retransmit buffer */ case '$': { - char junkbuf[PBUFSIZ]; - /* It's probably an old response, and we're out of sync. Just gobble up the packet and ignore it. */ getpkt (junkbuf, 0); @@ -2956,7 +2959,7 @@ read_frame (buf) { if (remote_cisco_mode) /* variant run-length-encoding */ { - char tmp_buf[PBUFSIZ]; + char *tmp_buf = alloca (PBUFSIZ); remote_cisco_expand (buf, tmp_buf); strcpy (buf, tmp_buf); @@ -3329,7 +3332,10 @@ compare_sections_command (args, from_tty) unsigned long host_crc, target_crc; extern bfd *exec_bfd; struct cleanup *old_chain; - char *tmp, *sectdata, *sectname, buf[PBUFSIZ]; + char *tmp; + char *sectdata; + char *sectname; + char *buf = alloca (PBUFSIZ); bfd_size_type size; bfd_vma lma; int matched = 0; @@ -3403,7 +3409,7 @@ remote_query (query_type, buf, outbuf, bufsiz) int *bufsiz; { int i; - char buf2[PBUFSIZ]; + char *buf2 = alloca (PBUFSIZ); char *p2 = &buf2[0]; char *p = buf; @@ -3470,7 +3476,7 @@ packet_command (args, from_tty) char *args; int from_tty; { - char buf[PBUFSIZ]; + char *buf = alloca (PBUFSIZ); if (! remote_desc) error ("command can only be used with remote target"); @@ -3726,7 +3732,7 @@ remote_info_process (args, from_tty) char *args; int from_tty; { - char buf[PBUFSIZ]; + char *buf = alloca (PBUFSIZ); if (remote_desc == 0) error ("Command can only be used when connected to the remote target."); diff --git a/gdb/solib.c b/gdb/solib.c index aa2dd46ab1..2bd8a2ec79 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1306,11 +1306,35 @@ solib_address (address) /* Called by free_all_symtabs */ void -clear_solib() +clear_solib () { struct so_list *next; char *bfd_filename; + /* This function is expected to handle ELF shared libraries. It is + also used on Solaris, which can run either ELF or a.out binaries + (for compatibility with SunOS 4), both of which can use shared + libraries. So we don't know whether we have an ELF executable or + an a.out executable until the user chooses an executable file. + + ELF shared libraries don't get mapped into the address space + until after the program starts, so we'd better not try to insert + breakpoints in them immediately. We have to wait until the + dynamic linker has loaded them; we'll hit a bp_shlib_event + breakpoint (look for calls to create_solib_event_breakpoint) when + it's ready. + + SunOS shared libraries seem to be different --- they're present + as soon as the process begins execution, so there's no need to + put off inserting breakpoints. There's also nowhere to put a + bp_shlib_event breakpoint, so if we put it off, we'll never get + around to it. + + So: disable breakpoints only if we're using ELF shared libs. */ + if (exec_bfd != NULL + && bfd_get_flavour (exec_bfd) != bfd_target_aout_flavour) + disable_breakpoints_in_shlibs (1); + while (so_list_head) { if (so_list_head -> sections) diff --git a/gdb/symtab.c b/gdb/symtab.c index b51d214fae..58da789765 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2408,6 +2408,8 @@ build_canonical_line_spec (sal, symname, canonical) FILE:FUNCTION -- likewise, but prefer functions in that file. *EXPR -- line in which address EXPR appears. + This may all be followed by an "if EXPR", which we ignore. + FUNCTION may be an undebuggable function found in minimal symbol table. If the argument FUNFIRSTLINE is nonzero, we want the first line diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 93630d2703..376c575e28 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,105 @@ +1999-06-25 Stan Shebs + + From Jimmy Guo and others at HP: + * lib/gdb.exp (get_compiler_info): Add detection for assorted + HP compilers, also set the globals $true and $false. + + * gdb.base/annota1.c, bitfields.c, break.c, call-ar-st.c, + call-rt-st.c, call-strs.c, callfuncs.c, callfuncs2.c, condbreak.c, + coremaker.c, ending-run.c, exprs.c, funcargs.c, interrupt.c, + jump.c, langs0.c, langs1.c, langs2.c, list0.c, list1.c, + long_long.c, mips_pro.c, nodebug.c, opaque0.c, opaque1.c, + printcmds.c, ptype.c, recurse.c, restore.c, return.c, run.c, + scope0.c, scope1.c, setshow.c, setvar.c, shmain.c, shr1.c, shr2.c, + sigall.c, signals.c, so-impl-ld.c, so-indr-cl.c, solib.c, + solib1.c, solib2.c, step-test.c, twice.c, varargs.c, watchpoint.c, + whatis.c} Add C++ compatible function definitions and return + types, add includes for library functions. + * gdb.base/ptype.c (my_false, my_true): Use instead of false/true. + * gdb.base/step-test.c (myglob): Rename from glob. + * gdb.base/attach.c, attach2.c, average.c, execd-prog.c, + foll-exec.c, foll-fork.c, foll-vfork.c, sum.c, vforked-prog.c: New + files, move here from gdb.hp. + * gdb.base/annota1.exp, break.exp, call-ar-st.exp, call-rt-st.exp, + commands.exp, condbreak.exp, define.exp, ena-dis-br.exp, + ending-run.exp, jump.exp. list.exp, long_long.exp, so-impl-ld.exp: + Adjust line numbers in regexps. + + * gdb.base/all-bin.exp, eval-skip.exp, exprs.exp, logical.exp, + miscexprs.exp, pointers.exp, relational.exp: Use $true and $false + instead of 0/1. + + * gdb.base/attach.exp, dbx.exp, foll-exec.exp, foll-fork.exp, + foll-vfork.exp: New files, move here from gdb.hp. + * gdb.base/page.exp: New file, test of pagination command. + + * gdb.base/watchpoint.c (recurser): New function, for watchpoint + recursion test. + * gdb.base/watchpoint.exp: Add more test cases for watchpoints. + + * gdb.base/so-impl-ld.exp, gdb.base/so-indr-cl.exp, + gdb.base/solib.exp: Fix compiler invocation process. + + * gdb.base/callfuncs.exp, gdb.base/callfuncs2.exp: Don't xfail for + HP-UX 11, turn off overload resolution explicitly. + * gdb.base/commands.exp: Set argument list explicitly, add + watchpoint test. + * gdb.base/completion.exp: Enable if HP-UX, tweak tests to make + them work. + * gdb.base/constvars.exp, gdb.base/volatile.exp: Escape the + expressions properly. + * gdb.base/corefile.exp: Loosen the match slightly. + * gdb.base/default.exp: Allow "Error accessing memory" message + also. + * gdb.base/display.exp: Skip over x/0 j if PA64. + * gdb.base/funcargs.exp: Add xfails for HP-UX. + * gdb.base/interrupt.exp: Ditto. + * gdb.base/langs.exp: Add symbolic matches governed by compiler + in use. + * gdb.base/list.exp: Add xfails for HP-UX. + * gdb.base/long_long.exp: Refine some of the numeric matches. + * gdb.base/mips_pro.exp: Xfail on HP-UX. + * gdb.base/miscexprs.exp: Add PA2.0 case for array size test. + * gdb.base/nodebug.exp: Succeed on more varieties of output. + * gdb.base/opaque.exp: Remove some HP-UX xfails. + * gdb.base/ptype.exp: Succeed on more varieties of output. + * gdb.base/scope.exp: Add xfails for HP-UX. + * gdb.base/sect-cmd.exp: Add more cases. + * gdb.base/setvar.exp: Add xfails for HP-UX. + * gdb.base/shlib-call.exp: Loosen some matches slightly. + * gdb.base/signals.exp: Match on void symbolically. + * gdb.base/step-test.exp: Add case for PA64. + * gdb.base/term.exp: Add exit and restart. + * gdb.base/twice.exp: Clean up after self. + * gdb.base/varargs.exp: Disable overload resolution explicitly. + * gdb.base/whatis.exp: Allow more ways to pass tests. + + * gdb.base/smoke.exp, gdb.base/smoke.c, gdb.base/smoke.cc: Remove, + no longer useful. + +Fri Jun 25 19:27:28 1999 Andrew Cagney + + * lib/gdb.exp (proc gdb_expect_list): New procedure. Matches a + list of patterns. + * gdb.base/call-ar-st.exp: Use gdb_expect_list in "print + print_double_array(double_array)", "continuing to breakpoint + 1018", "print print_double_array(array_d)" and "continuing to + 1034" tests. + +1999-06-24 Jason Molenda (jsm@bugshack.cygnus.com) + + * Makefile.in: Add empty html and install-html targets. + +1999-06-24 Stan Shebs + + * config/mt-*: Remove, these haven't been used since 1996. + +1999-06-22 Stan Shebs + + * gdb.base/call-strs.c, gdb.base/ending-run.c, + gdb.base/step-test.c: Include stdlib.h and string.h as needed. + * gdb.c++/member-ptr.exp: Skip over these tests if using G++. + 1999-06-18 Stan Shebs * gdb.c++/overload.exp: XFAIL everything if using G++, add a diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in index d763450e2e..c3b94f7948 100644 --- a/gdb/testsuite/Makefile.in +++ b/gdb/testsuite/Makefile.in @@ -89,6 +89,8 @@ INFODIRS=doc info: install-info: dvi: +html: +install-html: install: diff --git a/gdb/testsuite/gdb.base/all-bin.exp b/gdb/testsuite/gdb.base/all-bin.exp index 4d6662b258..5208ef391e 100644 --- a/gdb/testsuite/gdb.base/all-bin.exp +++ b/gdb/testsuite/gdb.base/all-bin.exp @@ -45,6 +45,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +if [get_compiler_info ${binfile}] { + return -1 +} + gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir @@ -206,7 +210,7 @@ gdb_expect { send_gdb "print v_int <= v_short\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of v_int<=v_short" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_short" } @@ -236,7 +240,7 @@ gdb_expect { send_gdb "print v_int <= v_signed_short\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of v_int<=v_signed_short" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_short" } @@ -246,7 +250,7 @@ gdb_expect { send_gdb "print v_int <= v_unsigned_short\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of v_int<=v_unsigned_short" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_short" } @@ -256,7 +260,7 @@ gdb_expect { send_gdb "print v_int <= v_signed_int\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int<=v_signed_int" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_int" } @@ -266,7 +270,7 @@ gdb_expect { send_gdb "print v_int <= v_unsigned_int\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int<=v_unsigned_int" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_int" } @@ -276,7 +280,7 @@ gdb_expect { send_gdb "print v_int <= v_long\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int<=v_long" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_long" } @@ -286,7 +290,7 @@ gdb_expect { send_gdb "print v_int <= v_signed_long\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int<=v_signed_long" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_long" } @@ -296,7 +300,7 @@ gdb_expect { send_gdb "print v_int <= v_unsigned_long\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int<=v_unsigned_long" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_long" } @@ -306,7 +310,7 @@ gdb_expect { send_gdb "print v_int <= v_float\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int<=v_float" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_float" } @@ -316,7 +320,7 @@ gdb_expect { send_gdb "print v_int <= v_double\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int<=v_double" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_double" } @@ -335,7 +339,7 @@ gdb_test "set variable v_unsigned_long=0" "" "set v_unsigned_long=0" send_gdb "print v_int && v_char\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of v_int&&v_char" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_char" } @@ -344,7 +348,7 @@ gdb_expect { send_gdb "print v_int && v_short\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_short" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_short" } @@ -354,7 +358,7 @@ gdb_expect { send_gdb "print v_int && v_signed_char\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_signed_char" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_char" } @@ -364,7 +368,7 @@ gdb_expect { send_gdb "print v_int && v_unsigned_char\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_unsigned_char" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_char" } @@ -374,7 +378,7 @@ gdb_expect { send_gdb "print v_int && v_signed_short\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_signed_short" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_short" } @@ -384,7 +388,7 @@ gdb_expect { send_gdb "print v_int && v_unsigned_short\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_unsigned_short" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_short" } @@ -394,7 +398,7 @@ gdb_expect { send_gdb "print v_int && v_signed_int\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_signed_int" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_int" } @@ -404,7 +408,7 @@ gdb_expect { send_gdb "print v_int && v_unsigned_int\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_unsigned_int" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_int" } @@ -414,7 +418,7 @@ gdb_expect { send_gdb "print v_int && v_long\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_long" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_long" } @@ -424,7 +428,7 @@ gdb_expect { send_gdb "print v_int && v_signed_long\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_signed_long" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_long" } @@ -434,7 +438,7 @@ gdb_expect { send_gdb "print v_int && v_unsigned_long\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of v_int&&v_unsigned_long" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_long" } @@ -444,7 +448,7 @@ gdb_expect { send_gdb "print v_int && v_float\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_float" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_float" } @@ -454,7 +458,7 @@ gdb_expect { send_gdb "print v_int && v_double\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of v_int&&v_double" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_double" } diff --git a/gdb/testsuite/gdb.base/annota1.c b/gdb/testsuite/gdb.base/annota1.c index 7eeee77156..7d423e0960 100644 --- a/gdb/testsuite/gdb.base/annota1.c +++ b/gdb/testsuite/gdb.base/annota1.c @@ -6,16 +6,28 @@ #endif +#ifdef PROTOTYPES +void +handle_USR1 (int sig) +{ +} +#else void handle_USR1 (sig) int sig; { } +#endif int value; +#ifdef PROTOTYPES +int +main (void) +#else int main () +#endif { int my_array[3] = { 1, 2, 3 }; diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp index 4239822c65..ba24fe92b2 100644 --- a/gdb/testsuite/gdb.base/annota1.exp +++ b/gdb/testsuite/gdb.base/annota1.exp @@ -62,7 +62,7 @@ if [target_info exists gdb_stub] { # # the line at which break main will put the breakpoint # -set main_line 20 +set main_line 32 # The commands we test here produce many lines of output; disable "press # to continue" prompts. @@ -143,7 +143,7 @@ gdb_expect { #exp_internal 1 send_gdb "run\n" gdb_expect { - -re "\r\n\032\032post-prompt\r\nStarting program: $binfile \(\r\n\r\n\032\032frames-invalid\)+\(\r\n\r\n\032\032breakpoints-invalid\)*.*\(\r\n\r\n\032\032frames-invalid\)*\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032breakpoint 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*annota1.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ + -re "\r\n\032\032post-prompt\r\nStarting program: $binfile \(\r\n\r\n\032\032frames-invalid\)+\(\r\n\r\n\032\032breakpoints-invalid\)*.*\(\r\n\r\n\032\032frames-invalid\)*\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032breakpoint 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*annota1.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n.*$gdb_prompt$" \ { pass "run until main breakpoint" } -re ".*$gdb_prompt$" { fail "run until main breakpoint" } timeout { fail "run until main breakpoint (timeout)" } @@ -258,7 +258,7 @@ gdb_expect { # send_gdb "signal SIGUSR1\n" gdb_expect { - -re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${srcdir}/${subdir}/${srcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:185:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ + -re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${srcdir}/${subdir}/${srcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ { pass "send SIGUSR1" } -re ".*$gdb_prompt$" { fail "send SIGUSR1" } timeout { fail "send SIGUSR1 (timeout)" } diff --git a/gdb/testsuite/gdb.base/bitfields.c b/gdb/testsuite/gdb.base/bitfields.c index 930b244fcd..3e6b2e63d3 100644 --- a/gdb/testsuite/gdb.base/bitfields.c +++ b/gdb/testsuite/gdb.base/bitfields.c @@ -5,7 +5,7 @@ this may cause some tests to fail. But at least we can still compile the test program and run the tests... */ -#ifndef __STDC__ +#if !defined(__STDC__) && !defined(__cplusplus) #define signed /**/ #endif diff --git a/gdb/testsuite/gdb.base/break.c b/gdb/testsuite/gdb.base/break.c index 491d6e5dd5..6acbf9b416 100644 --- a/gdb/testsuite/gdb.base/break.c +++ b/gdb/testsuite/gdb.base/break.c @@ -29,6 +29,7 @@ char *arg; #else /* ! vxworks */ # include +# include #endif /* ! vxworks */ /* @@ -38,20 +39,34 @@ char *arg; * of gcc have or have had problems with this). */ +#ifdef PROTOTYPES +int marker1 (void) { return (0); } +int marker2 (int a) { return (1); } +void marker3 (char *a, char *b) {} +void marker4 (long d) {} +#else int marker1 () { return (0); } int marker2 (a) int a; { return (1); } void marker3 (a, b) char *a, *b; {} void marker4 (d) long d; {} +#endif /* * This simple classical example of recursion is useful for * testing stack backtraces and such. */ +#ifdef PROTOTYPES +int factorial(int); + +int +main (int argc, char **argv, char **envp) +#else int main (argc, argv, envp) int argc; char *argv[], **envp; +#endif { #ifdef usestubs set_debug_traps(); @@ -70,8 +85,12 @@ char *argv[], **envp; return 0; } +#ifdef PROTOTYPES +int factorial (int value) +#else int factorial (value) int value; +#endif { if (value > 1) { value *= factorial (value - 1); diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 300a4e630a..115cd80398 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -39,6 +39,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +if [get_compiler_info ${binfile}] { + return -1 +} + gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir @@ -88,22 +92,22 @@ gdb_test "break $srcfile:factorial" \ # # test break at line number # -gdb_test "break 64" \ - "Breakpoint.*at.* file .*$srcfile, line 64\\." \ +gdb_test "break 79" \ + "Breakpoint.*at.* file .*$srcfile, line 79\\." \ "breakpoint line number" # # test duplicate breakpoint # -gdb_test "break 64" \ - "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line 64\\." \ +gdb_test "break 79" \ + "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line 79\\." \ "breakpoint duplicate" # # test break at line number in file # -gdb_test "break $srcfile:70" \ - "Breakpoint.*at.* file .*$srcfile, line 70\\." \ +gdb_test "break $srcfile:85" \ + "Breakpoint.*at.* file .*$srcfile, line 85\\." \ "breakpoint line number in file" @@ -111,18 +115,23 @@ gdb_test "break $srcfile:70" \ # check to see what breakpoints are set # if [target_info exists gdb_stub] { - set main_line 57 + set main_line 72 } else { - set main_line 60 + set main_line 75 } +if {$hp_aCC_compiler} { + set proto "\\(int\\)" +} else { + set proto "" +} gdb_test "info break" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.* -\[0-9\]+\[\t \]+breakpoint keep y.* in factorial at .*$srcfile:76.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:64.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:64.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:70" \ +\[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:95.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:85" \ "breakpoint info" @@ -150,35 +159,35 @@ if ![target_info exists use_gdb_stub] { send_gdb "y\n" exp_continue } - -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:60.*60\[\t \]+if .argc.* \{.*$gdb_prompt $"\ + -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:75.*75\[\t \]+if .argc.* \{.*$gdb_prompt $"\ { pass "run until function breakpoint" } -re ".*$gdb_prompt $" { fail "run until function breakpoint" } timeout { fail "run until function breakpoint (timeout)" } } } else { if ![target_info exists gdb_stub] { - gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:60.*60\[\t \]+if .argc.*\{" "stub continue" + gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:75.*75\[\t \]+if .argc.*\{" "stub continue" } } # # run until the breakpoint at a line number # -gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:64.*64\[\t \]+printf.*factorial.*" \ +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:79.*79\[\t \]+printf.*factorial.*" \ "run until breakpoint set at a line number" # # Run until the breakpoint set in a function in a file # for {set i 6} {$i >= 1} {incr i -1} { - gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$srcfile:76.*76\[\t \]+if .value > 1. \{" \ + gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$srcfile:95.*95\[\t \]+.*if .value > 1. \{.*" \ "run until file:function($i) breakpoint" } # # run until the file:function breakpoint at a line number in a file # -gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:70.*70\[\t \]+return 0;" \ +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:85.*85\[\t \]+return 0;" \ "run until file:linenum breakpoint" # @@ -202,31 +211,38 @@ gdb_test "tbreak $srcfile:factorial" "Breakpoint.*at.* file .*$srcfile, line.*" # # test break at line number # -send_gdb "tbreak 64\n" +send_gdb "tbreak 79\n" gdb_expect { - -re "Breakpoint.*at.* file .*$srcfile, line 64.*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } + -re "Breakpoint.*at.* file .*$srcfile, line 79.*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } timeout { fail "breakpoint line number #1 (timeout)" } } -gdb_test "tbreak 60" "Breakpoint.*at.* file .*$srcfile, line 60.*" "Temporary breakpoint line number #2" +gdb_test "tbreak 75" "Breakpoint.*at.* file .*$srcfile, line 75.*" "Temporary breakpoint line number #2" # # test break at line number in file # -send_gdb "tbreak $srcfile:70\n" +send_gdb "tbreak $srcfile:85\n" gdb_expect { - -re "Breakpoint.*at.* file .*$srcfile, line 70.*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } + -re "Breakpoint.*at.* file .*$srcfile, line 85.*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } timeout { fail "Temporary breakpoint line number in file #1 (timeout)" } } -gdb_test "tbreak $srcfile:66" "Breakpoint.*at.* file .*$srcfile, line 66.*" "Temporary breakpoint line number in file #2" +gdb_test "tbreak $srcfile:81" "Breakpoint.*at.* file .*$srcfile, line 81.*" "Temporary breakpoint line number in file #2" # # check to see what breakpoints are set (temporary this time) # -gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial at .*$srcfile:76.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:64.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:70.*" "Temporary breakpoint info" +gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial$proto at .*$srcfile:95.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:79.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:75.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:85.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:81.*" \ + "Temporary breakpoint info" #*********** @@ -301,18 +317,18 @@ gdb_expect { # Verify that "until " works. (This is really just syntactic # sugar for "tbreak ; continue".) # -send_gdb "until 64\n" +send_gdb "until 79\n" gdb_expect { - -re "main .* at .*:64.*$gdb_prompt $"\ - {pass "until 64"} + -re "main .* at .*:79.*$gdb_prompt $"\ + {pass "until 79"} -re "$gdb_prompt $"\ - {fail "until 64"} - timeout {fail "(timeout) until 64"} + {fail "until 79"} + timeout {fail "(timeout) until 79"} } # Verify that a malformed "until" is gracefully caught. # -send_gdb "until 65 then stop\n" +send_gdb "until 80 then stop\n" gdb_expect { -re "Junk at end of arguments..*$gdb_prompt $"\ {pass "malformed until"} @@ -379,13 +395,13 @@ gdb_expect { # if ![runto_main] then { fail "break tests suppressed" } -send_gdb "break 64\n" +send_gdb "break 79\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 64.*$gdb_prompt $"\ - {pass "set to-be-silent break 64"} + -re "Breakpoint (\[0-9\]*) at .*, line 79.*$gdb_prompt $"\ + {pass "set to-be-silent break 79"} -re "$gdb_prompt $"\ - {fail "set to-be-silent break 64"} - timeout {fail "(timeout) set to-be-silent break 64"} + {fail "set to-be-silent break 79"} + timeout {fail "(timeout) set to-be-silent break 79"} } send_gdb "commands $expect_out(1,string)\n" @@ -393,33 +409,33 @@ send_gdb "silent\n" send_gdb "end\n" gdb_expect { -re ".*$gdb_prompt $"\ - {pass "set silent break 64"} - timeout {fail "(timeout) set silent break 64"} + {pass "set silent break 79"} + timeout {fail "(timeout) set silent break 79"} } send_gdb "info break $expect_out(1,string)\n" gdb_expect { - -re "\[0-9\]*\[ \t\]*breakpoint.*:64\r\n\[ \t\]*silent.*$gdb_prompt $"\ - {pass "info silent break 64"} + -re "\[0-9\]*\[ \t\]*breakpoint.*:79\r\n\[ \t\]*silent.*$gdb_prompt $"\ + {pass "info silent break 79"} -re "$gdb_prompt $"\ - {fail "info silent break 64"} - timeout {fail "(timeout) info silent break 64"} + {fail "info silent break 79"} + timeout {fail "(timeout) info silent break 79"} } send_gdb "continue\n" gdb_expect { -re "Continuing.\r\n$gdb_prompt $"\ - {pass "hit silent break 64"} + {pass "hit silent break 79"} -re "$gdb_prompt $"\ - {fail "hit silent break 64"} - timeout {fail "(timeout) hit silent break 64"} + {fail "hit silent break 79"} + timeout {fail "(timeout) hit silent break 79"} } send_gdb "bt\n" gdb_expect { - -re "#0 main .* at .*:64.*$gdb_prompt $"\ - {pass "stopped for silent break 64"} + -re "#0 main .* at .*:79.*$gdb_prompt $"\ + {pass "stopped for silent break 79"} -re "$gdb_prompt $"\ - {fail "stopped for silent break 64"} - timeout {fail "(timeout) stopped for silent break 64"} + {fail "stopped for silent break 79"} + timeout {fail "(timeout) stopped for silent break 79"} } # Verify that GDB can at least parse a breakpoint with the @@ -427,7 +443,7 @@ gdb_expect { # thread-specific breakpoint really triggers appropriately. # The gdb.threads subdirectory contains tests for that.) # -send_gdb "break 65 thread 999\n" +send_gdb "break 80 thread 999\n" gdb_expect { -re "Unknown thread 999.*$gdb_prompt $"\ {pass "thread-specific breakpoint on non-existent thread disallowed"} @@ -435,7 +451,7 @@ gdb_expect { {fail "thread-specific breakpoint on non-existent thread disallowed"} timeout {fail "(timeout) thread-specific breakpoint on non-existent thread disallowed"} } -send_gdb "break 65 thread foo\n" +send_gdb "break 80 thread foo\n" gdb_expect { -re "Junk after thread keyword..*$gdb_prompt $"\ {pass "thread-specific breakpoint on bogus thread ID disallowed"} @@ -447,7 +463,7 @@ gdb_expect { # Verify that GDB responds gracefully to a breakpoint command with # trailing garbage. # -send_gdb "break 65 foo\n" +send_gdb "break 80 foo\n" gdb_expect { -re "Junk at end of arguments..*$gdb_prompt $"\ {pass "breakpoint with trailing garbage disallowed"} @@ -466,9 +482,9 @@ gdb_expect { {pass "step over breakpoint"} timeout {fail "(timeout) step over breakpoint"} } -send_gdb "clear 66\n" +send_gdb "clear 81\n" gdb_expect { - -re "No breakpoint at 66..*$gdb_prompt $"\ + -re "No breakpoint at 81..*$gdb_prompt $"\ {pass "clear line has no breakpoint disallowed"} -re "$gdb_prompt $"\ {fail "clear line has no breakpoint disallowed"} @@ -485,15 +501,15 @@ gdb_expect { # Verify that a breakpoint can be set via a convenience variable. # -send_gdb "set \$foo=66\n" +send_gdb "set \$foo=81\n" gdb_expect { -re "$gdb_prompt $"\ - {pass "set convenience variable \$foo to 66"} - timeout {fail "(timeout) set convenience variable \$foo to 66"} + {pass "set convenience variable \$foo to 81"} + timeout {fail "(timeout) set convenience variable \$foo to 81"} } send_gdb "break \$foo\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 66.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line 81.*$gdb_prompt $"\ {pass "set breakpoint via convenience variable"} -re "$gdb_prompt $"\ {fail "set breakpoint via convenience variable"} @@ -503,11 +519,11 @@ gdb_expect { # Verify that GDB responds gracefully to an attempt to set a # breakpoint via a convenience variable whose type is not integer. # -send_gdb "set \$foo=66.5\n" +send_gdb "set \$foo=81.5\n" gdb_expect { -re "$gdb_prompt $"\ - {pass "set convenience variable \$foo to 66.5"} - timeout {fail "(timeout) set convenience variable \$foo to 66.5"} + {pass "set convenience variable \$foo to 81.5"} + timeout {fail "(timeout) set convenience variable \$foo to 81.5"} } send_gdb "break \$foo\n" gdb_expect { @@ -522,7 +538,7 @@ gdb_expect { # send_gdb "break marker2\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 42.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line 4\[49\].*$gdb_prompt $"\ {pass "set breakpoint on to-be-called function"} -re "$gdb_prompt $"\ {fail "set breakpoint on to-be-called function"} @@ -530,7 +546,7 @@ gdb_expect { } send_gdb "print marker2(99)\n" gdb_expect { - -re "The program being debugged stopped while in a function called from GDB.\r\nWhen the function .marker2. is done executing, GDB will silently\r\nstop .instead of continuing to evaluate the expression containing\r\nthe function call...*$gdb_prompt $"\ + -re "The program being debugged stopped while in a function called from GDB.\r\nWhen the function .marker2$proto. is done executing, GDB will silently\r\nstop .instead of continuing to evaluate the expression containing\r\nthe function call...*$gdb_prompt $"\ {pass "hit breakpoint on called function"} -re "$gdb_prompt $"\ {fail "hit breakpoint on called function"} @@ -543,7 +559,9 @@ gdb_expect { if [istarget "hppa*-*-hpux*"] then { send_gdb "bt\n" gdb_expect { - -re "#0\[ \t\]*marker2.*:42\r\n#1.*_sr4export.*$gdb_prompt $"\ + -re "#0\[ \t\]*marker2.*:4\[49\]\r\n#1.*_sr4export.*$gdb_prompt $"\ + {pass "backtrace while in called function"} + -re "#0\[ \t\]*marker2.*:4\[49\]\r\n#1.*function called from gdb.*$gdb_prompt $"\ {pass "backtrace while in called function"} -re "$gdb_prompt $"\ {fail "backtrace while in called function"} @@ -551,7 +569,9 @@ if [istarget "hppa*-*-hpux*"] then { } send_gdb "finish\n" gdb_expect { - -re "Run till exit from .*marker2.* at .*42\r\n.* in _sr4export.*$gdb_prompt $"\ + -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.* in _sr4export.*$gdb_prompt $"\ + {pass "finish from called function"} + -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.*function called from gdb.*$gdb_prompt $"\ {pass "finish from called function"} -re "$gdb_prompt $"\ {fail "finish from called function"} diff --git a/gdb/testsuite/gdb.base/call-ar-st.c b/gdb/testsuite/gdb.base/call-ar-st.c index bb30e507d5..6d1b99984c 100644 --- a/gdb/testsuite/gdb.base/call-ar-st.c +++ b/gdb/testsuite/gdb.base/call-ar-st.c @@ -141,9 +141,13 @@ struct int_char_combo_t { * IN id_int student -- enumerated type * IN colors shirt -- enumerated type *****************************************************************/ +#ifdef PROTOTYPES +void print_student_id_shirt_color (id_int student, colors shirt) +#else void print_student_id_shirt_color ( student, shirt ) id_int student; colors shirt; +#endif { printf("student id : %d\t", student); @@ -192,9 +196,12 @@ void print_student_id_shirt_color ( student, shirt ) * PRINT_CHAR_ARRAY : * IN char array_c[] -- character array *****************************************************************/ +#ifdef PROTOTYPES +void print_char_array (char array_c[]) +#else void print_char_array ( array_c ) char array_c[]; - +#endif { int index; @@ -212,9 +219,12 @@ void print_char_array ( array_c ) * PRINT_DOUBLE_ARRAY : * IN double array_d[] -- array of doubles *****************************************************************/ +#ifdef PROTOTYPES +void print_double_array (double array_d[]) +#else void print_double_array (array_d) double array_d[]; - +#endif { int index; @@ -232,9 +242,12 @@ void print_double_array (array_d) * PRINT_FLOAT_ARRAY: * IN float array_f[] -- array of floats *****************************************************************/ +#ifdef PROTOTYPES +void print_float_array (float array_f[]) +#else void print_float_array ( array_f ) float array_f[]; - +#endif { int index; @@ -253,9 +266,12 @@ void print_float_array ( array_f ) * PRINT_INT_ARRAY: * IN int array_i[] -- array of integers *****************************************************************/ +#ifdef PROTOTYPES +void print_int_array (int array_i[]) +#else void print_int_array ( array_i ) int array_i[]; - +#endif { int index; @@ -277,12 +293,15 @@ void print_int_array ( array_i ) * IN float array_f[] -- array of floats * IN double array_d[] -- array of doubles *****************************************************************/ +#ifdef PROTOTYPES +void print_all_arrays(int array_i[], char array_c[], float array_f[], double array_d[]) +#else void print_all_arrays( array_i, array_c, array_f, array_d ) int array_i[]; char array_c[]; float array_f[]; double array_d[]; - +#endif { print_int_array(array_i); print_char_array(array_c); @@ -306,8 +325,12 @@ void loop_count () { * A do nothing function. Used to provide a point at which calls can be made. * IN int seed *****************************************************************/ +#ifdef PROTOTYPES +void compute_with_small_structs (int seed) +#else void compute_with_small_structs ( seed ) int seed; +#endif { struct small_rep_info_t array[4]; @@ -337,6 +360,9 @@ void compute_with_small_structs ( seed ) * IN unsigned e -- 0 or 1 * IN unsigned o -- 0 or 1 *****************************************************************/ +#ifdef PROTOTYPES +void init_bit_flags (struct bit_flags_t *bit_flags, unsigned a, unsigned b, unsigned g, unsigned d, unsigned e, unsigned o) +#else void init_bit_flags ( bit_flags, a, b, g, d, e, o ) struct bit_flags_t *bit_flags; unsigned a; @@ -345,6 +371,7 @@ unsigned g; unsigned d; unsigned e; unsigned o; +#endif { bit_flags->alpha = a; @@ -370,6 +397,9 @@ unsigned o; * IN unsigned e -- 0 or 1 * IN unsigned o -- 0 or 1 *****************************************************************/ +#ifdef PROTOTYPES +void init_bit_flags_combo (struct bit_flags_combo_t *bit_flags_combo, unsigned a, unsigned b, char ch1, unsigned g, unsigned d, char ch2, unsigned e, unsigned o) +#else void init_bit_flags_combo ( bit_flags_combo, a, b, ch1, g, d, ch2, e, o ) struct bit_flags_combo_t *bit_flags_combo; unsigned a; @@ -380,6 +410,7 @@ void init_bit_flags_combo ( bit_flags_combo, a, b, ch1, g, d, ch2, e, o ) char ch2; unsigned e; unsigned o; +#endif { bit_flags_combo->alpha = a; @@ -398,9 +429,13 @@ void init_bit_flags_combo ( bit_flags_combo, a, b, ch1, g, d, ch2, e, o ) * OUT struct one_double_t *one_double -- structure to fill * IN double init_val *****************************************************************/ +#ifdef PROTOTYPES +void init_one_double (struct one_double_t *one_double, double init_val) +#else void init_one_double ( one_double, init_val ) struct one_double_t *one_double; double init_val; +#endif { one_double->double1 = init_val; @@ -412,10 +447,14 @@ void init_one_double ( one_double, init_val ) * IN float init_val1 * IN float init_val2 *****************************************************************/ +#ifdef PROTOTYPES +void init_two_floats (struct two_floats_t *two_floats, float init_val1, float init_val2) +#else void init_two_floats ( two_floats, init_val1, init_val2 ) struct two_floats_t *two_floats; float init_val1; float init_val2; +#endif { two_floats->float1 = init_val1; two_floats->float2 = init_val2; @@ -427,10 +466,14 @@ void init_two_floats ( two_floats, init_val1, init_val2 ) * IN char init_val1 * IN char init_val2 *****************************************************************/ +#ifdef PROTOTYPES +void init_two_chars (struct two_char_t *two_char, char init_val1, char init_val2) +#else void init_two_chars ( two_char, init_val1, init_val2 ) struct two_char_t *two_char; char init_val1; char init_val2; +#endif { two_char->ch1 = init_val1; @@ -444,11 +487,15 @@ void init_two_chars ( two_char, init_val1, init_val2 ) * IN char init_val2 * IN char init_val3 *****************************************************************/ +#ifdef PROTOTYPES +void init_three_chars (struct three_char_t *three_char, char init_val1, char init_val2, char init_val3) +#else void init_three_chars ( three_char, init_val1, init_val2, init_val3 ) struct three_char_t *three_char; char init_val1; char init_val2; char init_val3; +#endif { three_char->ch1 = init_val1; @@ -465,6 +512,9 @@ void init_three_chars ( three_char, init_val1, init_val2, init_val3 ) * IN char init_val4 * IN char init_val5 *****************************************************************/ +#ifdef PROTOTYPES +void init_five_chars (struct five_char_t *five_char, char init_val1, char init_val2, char init_val3, char init_val4, char init_val5) +#else void init_five_chars ( five_char, init_val1, init_val2, init_val3,init_val4,init_val5 ) struct five_char_t *five_char; char init_val1; @@ -472,6 +522,7 @@ void init_five_chars ( five_char, init_val1, init_val2, init_val3,init_val4,init char init_val3; char init_val4; char init_val5; +#endif { five_char->ch1 = init_val1; five_char->ch2 = init_val2; @@ -486,10 +537,14 @@ void init_five_chars ( five_char, init_val1, init_val2, init_val3,init_val4,init * IN int init_val1 * IN char init_val2 *****************************************************************/ +#ifdef PROTOTYPES +void init_int_char_combo (struct int_char_combo_t *combo, int init_val1, char init_val2) +#else void init_int_char_combo ( combo, init_val1, init_val2 ) struct int_char_combo_t *combo; int init_val1; char init_val2; +#endif { combo->int1 = init_val1; @@ -501,10 +556,13 @@ void init_int_char_combo ( combo, init_val1, init_val2 ) * OUT struct small_rep_into_t *small_struct -- structure to be filled * IN int seed *****************************************************************/ +#ifdef PROTOTYPES +void init_struct_rep(struct small_rep_info_t *small_struct, int seed) +#else void init_struct_rep( small_struct, seed ) struct small_rep_info_t *small_struct; int seed; - +#endif { small_struct->value = 2 + (seed*2); @@ -516,6 +574,24 @@ void init_struct_rep( small_struct, seed ) * Takes all the small structures as input and calls the appropriate * initialization routine for each structure *****************************************************************/ +#ifdef PROTOTYPES +void init_small_structs ( + struct small_rep_info_t *struct1, + struct small_rep_info_t *struct2, + struct small_rep_info_t *struct3, + struct small_rep_info_t *struct4, + struct bit_flags_t *flags, + struct bit_flags_combo_t *flags_combo, + struct three_char_t *three_char, + struct five_char_t *five_char, + struct int_char_combo_t *int_char_combo, + struct one_double_t *d1, + struct one_double_t *d2, + struct one_double_t *d3, + struct two_floats_t *f1, + struct two_floats_t *f2, + struct two_floats_t *f3) +#else void init_small_structs (struct1, struct2, struct3,struct4,flags,flags_combo, three_char, five_char,int_char_combo, d1, d2,d3,f1,f2,f3) struct small_rep_info_t *struct1; @@ -533,7 +609,7 @@ three_char, five_char,int_char_combo, d1, d2,d3,f1,f2,f3) struct two_floats_t *f1; struct two_floats_t *f2; struct two_floats_t *f3; - +#endif { init_bit_flags(flags, (unsigned)1, (unsigned)0, (unsigned)1, @@ -560,6 +636,19 @@ three_char, five_char,int_char_combo, d1, d2,d3,f1,f2,f3) * PRINT_TEN_DOUBLES : * ????????????????????????????? ****************************************************************/ +#ifdef PROTOTYPES +void print_ten_doubles ( + double d1, + double d2, + double d3, + double d4, + double d5, + double d6, + double d7, + double d8, + double d9, + double d10) +#else void print_ten_doubles ( d1, d2, d3, d4, d5, d6, d7, d8, d9, d10 ) double d1; double d2; @@ -571,6 +660,7 @@ void print_ten_doubles ( d1, d2, d3, d4, d5, d6, d7, d8, d9, d10 ) double d8; double d9; double d10; +#endif { printf("Two Doubles : %f\t%f\n", d1, d2); @@ -584,8 +674,12 @@ void print_ten_doubles ( d1, d2, d3, d4, d5, d6, d7, d8, d9, d10 ) * PRINT_BIT_FLAGS : * IN struct bit_flags_t bit_flags ****************************************************************/ +#ifdef PROTOTYPES +void print_bit_flags (struct bit_flags_t bit_flags) +#else void print_bit_flags ( bit_flags ) struct bit_flags_t bit_flags; +#endif { if (bit_flags.alpha) printf("alpha\n"); @@ -600,8 +694,12 @@ struct bit_flags_t bit_flags; * PRINT_BIT_FLAGS_COMBO : * IN struct bit_flags_combo_t bit_flags_combo ****************************************************************/ +#ifdef PROTOTYPES +void print_bit_flags_combo (struct bit_flags_combo_t bit_flags_combo) +#else void print_bit_flags_combo ( bit_flags_combo ) -struct bit_flags_combo_t bit_flags_combo; + struct bit_flags_combo_t bit_flags_combo; +#endif { if (bit_flags_combo.alpha) printf("alpha\n"); @@ -617,8 +715,12 @@ struct bit_flags_combo_t bit_flags_combo; * PRINT_ONE_DOUBLE : * IN struct one_double_t one_double ****************************************************************/ +#ifdef PROTOTYPES +void print_one_double (struct one_double_t one_double) +#else void print_one_double ( one_double ) struct one_double_t one_double; +#endif { printf("Contents of one_double_t: \n\n"); @@ -629,8 +731,12 @@ struct one_double_t one_double; * PRINT_TWO_FLOATS : * IN struct two_floats_t two_floats ****************************************************************/ +#ifdef PROTOTYPES +void print_two_floats (struct two_floats_t two_floats) +#else void print_two_floats ( two_floats ) struct two_floats_t two_floats; +#endif { printf("Contents of two_floats_t: \n\n"); @@ -641,8 +747,12 @@ struct two_floats_t two_floats; * PRINT_TWO_CHARS : * IN struct two_char_t two_char ****************************************************************/ +#ifdef PROTOTYPES +void print_two_chars (struct two_char_t two_char) +#else void print_two_chars ( two_char ) struct two_char_t two_char; +#endif { printf("Contents of two_char_t: \n\n"); @@ -653,8 +763,12 @@ struct two_char_t two_char; * PRINT_THREE_CHARS : * IN struct three_char_t three_char ****************************************************************/ +#ifdef PROTOTYPES +void print_three_chars (struct three_char_t three_char) +#else void print_three_chars ( three_char ) struct three_char_t three_char; +#endif { printf("Contents of three_char_t: \n\n"); @@ -665,8 +779,12 @@ struct three_char_t three_char; * PRINT_FIVE_CHARS : * IN struct five_char_t five_char ****************************************************************/ +#ifdef PROTOTYPES +void print_five_chars (struct five_char_t five_char) +#else void print_five_chars ( five_char ) struct five_char_t five_char; +#endif { printf("Contents of five_char_t: \n\n"); @@ -679,8 +797,12 @@ struct five_char_t five_char; * PRINT_INT_CHAR_COMBO : * IN struct int_char_combo_t int_char_combo ****************************************************************/ +#ifdef PROTOTYPES +void print_int_char_combo (struct int_char_combo_t int_char_combo) +#else void print_int_char_combo ( int_char_combo ) struct int_char_combo_t int_char_combo; +#endif { printf("Contents of int_char_combo_t: \n\n"); @@ -695,11 +817,17 @@ struct int_char_combo_t int_char_combo; * IN struct small_rep_info_t struct2 * IN struct small_rep_info_t struct3 ****************************************************************/ +#ifdef PROTOTYPES +void print_struct_rep( + struct small_rep_info_t struct1, + struct small_rep_info_t struct2, + struct small_rep_info_t struct3) +#else void print_struct_rep( struct1, struct2, struct3) struct small_rep_info_t struct1; struct small_rep_info_t struct2; struct small_rep_info_t struct3; - +#endif { @@ -721,13 +849,21 @@ void print_struct_rep( struct1, struct2, struct3) * IN struct small_rep_info_t struct3 * IN struct small_rep_info_t struct4 ****************************************************************/ +#ifdef PROTOTYPES +void sum_struct_print ( + int seed, + struct small_rep_info_t struct1, + struct small_rep_info_t struct2, + struct small_rep_info_t struct3, + struct small_rep_info_t struct4) +#else void sum_struct_print ( seed, struct1, struct2, struct3, struct4) int seed; struct small_rep_info_t struct1; struct small_rep_info_t struct2; struct small_rep_info_t struct3; struct small_rep_info_t struct4; - +#endif { int sum; @@ -742,6 +878,24 @@ void sum_struct_print ( seed, struct1, struct2, struct3, struct4) * All of the small structures of odd sizes (40 bits, 8bits, etc.) * are pushed onto the stack. ****************************************************************/ +#ifdef PROTOTYPES +void print_small_structs ( + struct small_rep_info_t struct1, + struct small_rep_info_t struct2, + struct small_rep_info_t struct3, + struct small_rep_info_t struct4, + struct bit_flags_t flags, + struct bit_flags_combo_t flags_combo, + struct three_char_t three_char, + struct five_char_t five_char, + struct int_char_combo_t int_char_combo, + struct one_double_t d1, + struct one_double_t d2, + struct one_double_t d3, + struct two_floats_t f1, + struct two_floats_t f2, + struct two_floats_t f3) +#else void print_small_structs ( struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2,d3,f1,f2,f3) struct small_rep_info_t struct1; @@ -759,6 +913,7 @@ flags_combo, three_char, five_char, int_char_combo, d1, d2,d3,f1,f2,f3) struct two_floats_t f1; struct two_floats_t f2; struct two_floats_t f3; +#endif { print_bit_flags(flags); print_bit_flags_combo(flags_combo); @@ -784,6 +939,30 @@ flags_combo, three_char, five_char, int_char_combo, d1, d2,d3,f1,f2,f3) * may force more space to be pushed onto the stack as part of the callers * frame. ****************************************************************/ +#ifdef PROTOTYPES +void print_long_arg_list ( + double a, + double b, + int c, + int d, + int e, + int f, + struct small_rep_info_t struct1, + struct small_rep_info_t struct2, + struct small_rep_info_t struct3, + struct small_rep_info_t struct4, + struct bit_flags_t flags, + struct bit_flags_combo_t flags_combo, + struct three_char_t three_char, + struct five_char_t five_char, + struct int_char_combo_t int_char_combo, + struct one_double_t d1, + struct one_double_t d2, + struct one_double_t d3, + struct two_floats_t f1, + struct two_floats_t f2, + struct two_floats_t f3) +#else void print_long_arg_list ( a, b, c, d, e, f, struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1,d2,d3, f1, f2, f3 ) @@ -808,7 +987,7 @@ f1, f2, f3 ) struct two_floats_t f1; struct two_floats_t f2; struct two_floats_t f3; - +#endif { printf("double : %f\n", a); printf("double : %f\n", b); @@ -822,9 +1001,12 @@ f1, f2, f3 ) } +#ifdef PROTOTYPES +void print_one_large_struct (struct array_rep_info_t linked_list1) +#else void print_one_large_struct( linked_list1 ) struct array_rep_info_t linked_list1; - +#endif { /* printf("Contents of linked list1: \n\n"); @@ -845,11 +1027,17 @@ void print_one_large_struct( linked_list1 ) * IN struct array_rep_info_t linked_list2 * IN struct array_rep_info_t linked_list3 ****************************************************************/ +#ifdef PROTOTYPES +void print_array_rep( + struct array_rep_info_t linked_list1, + struct array_rep_info_t linked_list2, + struct array_rep_info_t linked_list3) +#else void print_array_rep( linked_list1, linked_list2, linked_list3 ) struct array_rep_info_t linked_list1; struct array_rep_info_t linked_list2; struct array_rep_info_t linked_list3; - +#endif { int index; @@ -895,13 +1083,21 @@ void print_array_rep( linked_list1, linked_list2, linked_list3 ) * IN struct array_rep_info_t linked_list3 * IN struct array_rep_info_t linked_list4 ****************************************************************/ +#ifdef PROTOTYPES +void sum_array_print ( + int seed, + struct array_rep_info_t linked_list1, + struct array_rep_info_t linked_list2, + struct array_rep_info_t linked_list3, + struct array_rep_info_t linked_list4) +#else void sum_array_print ( seed, linked_list1, linked_list2, linked_list3,linked_list4) int seed; struct array_rep_info_t linked_list1; struct array_rep_info_t linked_list2; struct array_rep_info_t linked_list3; struct array_rep_info_t linked_list4; - +#endif { int index; int sum; @@ -925,10 +1121,15 @@ void sum_array_print ( seed, linked_list1, linked_list2, linked_list3,linked_lis * IN struct array_rep_info_t *linked_list * IN int seed ****************************************************************/ +#ifdef PROTOTYPES +void init_array_rep( + struct array_rep_info_t *linked_list, + int seed) +#else void init_array_rep( linked_list, seed ) struct array_rep_info_t *linked_list; int seed; - +#endif { int index; @@ -994,7 +1195,8 @@ int main () { for (index = 0; index < 120; index++) { if ((index%2) == 0) char_array[index] = 'Z'; else char_array[index] = 'a'; - } char_array[120] = '\0'; /* call-ar-st.exp uses line numbers everywhere */ + } + char_array[120] = '\0'; for (index = 0; index < 100; index++) { double_array[index] = index*23.4567; diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp index d737219c80..5662eb77a4 100644 --- a/gdb/testsuite/gdb.base/call-ar-st.exp +++ b/gdb/testsuite/gdb.base/call-ar-st.exp @@ -101,25 +101,36 @@ if ![runto_main] then { continue } -#go -until 1007 -gdb_test "tbreak 1007" \ - "Breakpoint \[0-9\]+.*file.*$srcfile, line 1007.*" \ - "tbreakpoint line 1007" +#go -until 1209 +gdb_test "tbreak 1209" \ + "Breakpoint \[0-9\]+.*file.*$srcfile, line 1209.*" \ + "tbreakpoint line 1209" gdb_test continue \ -"Continuing\\..*main \\(\\) at.*$srcfile:1007.*" \ +"Continuing\\..*main \\(\\) at.*$srcfile:1209.*" \ "run until breakpoint set at a line" #call print_double_array(double_array) if {![target_info exists gdb,skip_float_tests]} { send_gdb "print print_double_array(double_array)\n" - gdb_expect { - -re "array_d :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+0.000000\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200\[ \t\r\n\]+2275.299900 2298.756600 2322.213300\[ \t\r\n\]+\[ \t\r\n\]+.*$gdb_prompt $" { - pass "print print_double_array(double_array)" - } - -re ".*$gdb_prompt $" { fail "print print_double_array(double_array)" } - timeout { fail "(timeout) print print_double_array(double_array)" } + gdb_expect_list "print print_double_array(double_array)" ".*$gdb_prompt $" { + "\[ \t\r\n\]+array_d :" + "\[ \t\r\n\]+=========" + "\[ \t\r\n\]+0.000000" + "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" + "\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200" + "\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800" + "\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400" + "\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000" + "\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600" + "\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200" + "\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800" + "\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400" + "\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000" + "\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600" + "\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200" + "\[ \t\r\n\]+2275.299900 2298.756600 2322.213300\[ \t\r\n\]+\[ \t\r\n\]+" } } @@ -136,18 +147,18 @@ gdb_expect { -#go -until 1014 -gdb_test "tbreak 1014" \ -"Breakpoint.*file.*$srcfile, line 1014.*" \ -"tbreakpoint line 1014" +#go -until 1216 +gdb_test "tbreak 1216" \ +"Breakpoint.*file.*$srcfile, line 1216.*" \ +"tbreakpoint line 1216" send_gdb "continue\n" gdb_expect { - -re "array_c :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+Z\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa\[ \t\r\n\]+\[ \t\r\n\]+\[ \t\r\n\]+main.*at.*$srcfile:1014\[ \t\r\n\]+.*print_double_array\\(double_array\\).*$gdb_prompt $" { - pass "continue to 1014" + -re "array_c :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+Z\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa\[ \t\r\n\]+\[ \t\r\n\]+\[ \t\r\n\]+main.*at.*$srcfile:1216\[ \t\r\n\]+.*print_double_array\\(double_array\\).*$gdb_prompt $" { + pass "continue to 1216" } - -re ".*$gdb_prompt $" { fail "continue to 1014" } - timeout { fail "(timeout) continue to 1014" } + -re ".*$gdb_prompt $" { fail "continue to 1216" } + timeout { fail "(timeout) continue to 1216" } } # I am disabling this test, because it takes too long. I verified by @@ -163,19 +174,40 @@ gdb_expect { # } #set timeout $oldtimeout -#go -until 1018 -gdb_test "tbreak 1018" \ - "Breakpoint.* file .*$srcfile, line 1018.*" \ - "tbreakpoint line 1018" +#go -until 1220 +gdb_test "tbreak 1220" \ + "Breakpoint.* file .*$srcfile, line 1220.*" \ + "tbreakpoint line 1220" -gdb_test continue \ -"Continuing\\..*array_d :.*array_f :.*student id :\[\t \]+.*YELLOW.*array_i :.*main \\(\\) at .*call-ar-st.c:1018\[ \t\r\n\]+.*print_all_arrays\\(integer_array, char_array, float_array, double_array\\)." \ -"continuing to breakpoint 1018" +send_gdb "continue\n" +gdb_expect_list "continuing to breakpoint 1220" ".*$gdb_prompt $" { + "Continuing\\." + "\[ \t\r\n\]+array_d :" + "\[ \t\r\n\]+=========" + "\[ \t\r\n\]+0.000000" + "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" + "\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200" + "\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800" + "\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400" + "\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000" + "\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600" + "\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200" + "\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800" + "\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400" + "\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000" + "\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600" + "\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200" + "\[ \t\r\n\]+2275.299900 2298.756600 2322.213300\[ \t\r\n\]+\[ \t\r\n\]+" + ".*array_f :" + ".*student id :\[\t \]+.*YELLOW" + ".*array_i :" + ".*main \\(\\) at .*call-ar-st.c:1220\[ \t\r\n\]+.*print_all_arrays\\(integer_array, char_array, float_array, double_array\\)." +} #step send_gdb "step\n" gdb_expect { - -re "print_all_arrays \\(array_i=, array_c=.ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=, array_d=\\) at .*call-ar-st.c:287\[ \t\r\n\]+287.*print_int_array\\(array_i\\);.*$gdb_prompt $" {pass "step inside print_all_arrays"} + -re "print_all_arrays \\(array_i=, array_c=.ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=, array_d=\\) at .*call-ar-st.c:306\[ \t\r\n\]+306.*print_int_array\\(array_i\\);.*$gdb_prompt $" {pass "step inside print_all_arrays"} -re ".*$gdb_prompt $" { fail "step inside print_all_arrays" } timeout { fail "step inside print_all_arrays (timeout)" } } @@ -184,7 +216,7 @@ gdb_test continue \ #step -over send_gdb "next\n" gdb_expect { - -re "array_i :.*288.*print_char_array\\(array_c\\);.*$gdb_prompt $" {pass "next over print_int_array in print-all_arrays"} + -re "array_i :.*307.*print_char_array\\(array_c\\);.*$gdb_prompt $" {pass "next over print_int_array in print-all_arrays"} -re ".*$gdb_prompt $" { fail "next over print_int_array in print-all_arrays" } timeout { fail "next over print_int_array in print-all_arrays (timeout)" } } @@ -194,21 +226,52 @@ gdb_test continue \ #call print_double_array(array_d) if {![target_info exists gdb,skip_float_tests]} { send_gdb "print print_double_array(array_d)\n" - gdb_expect { - -re "array_d :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+0.000000\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200\[ \t\r\n\]+2275.299900 2298.756600 2322.213300\[ \t\r\n\]+\[ \t\r\n\]+.*$gdb_prompt $" { - pass "print print_double_array(array_d)" - } - -re ".*$gdb_prompt $" { fail "print print_double_array(array_d)" } - timeout { fail "(timeout) print print_double_array(array_d)" } + gdb_expect_list "print print_double_array(array_d)" ".*$gdb_prompt $" { + "array_d :" + "\[ \t\r\n\]+=========" + "\[ \t\r\n\]+\[ \t\r\n\]+0.000000" + "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" + "\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200" + "\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800" + "\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400" + "\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000" + "\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600" + "\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200" + "\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800" + "\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400" + "\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000" + "\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600" + "\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200" + "\[ \t\r\n\]+2275.299900 2298.756600 2322.213300\[ \t\r\n\]+\[ \t\r\n\]+" } } -#go -until 1034 -gdb_test "tbreak 1034" \ -"Breakpoint.* file .*$srcfile, line 1034.*" \ -"tbreakpoint line 1034" +#go -until 1236 +gdb_test "tbreak 1236" \ +"Breakpoint.* file .*$srcfile, line 1236.*" \ +"tbreakpoint line 1236" -gdb_test continue "Continuing\\..*array_c.*array_f.*array_d.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1034.*printf\\(.BYE BYE FOR NOW.n.\\)." "continuing to 1034" +send_gdb "continue\n" +gdb_expect_list "continuing to 1236" ".*$gdb_prompt $" { + "Continuing\\..*array_c" + ".*array_f" + "\[ \t\r\n\]+array_d :" + "\[ \t\r\n\]+=========" + "\[ \t\r\n\]+0.000000" + "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" + "\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200" + "\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800" + "\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400" + "\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000" + "\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600" + "\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200" + "\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800" + "\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400" + "\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000" + "\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600" + "\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200" + "\[ \t\r\n\]+2275.299900 2298.756600 2322.213300.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1236.*printf\\(.BYE BYE FOR NOW.n.\\)." +} #call sum_array_print(10, *list1, *list2, *list3, *list4) @@ -225,9 +288,9 @@ gdb_expect { #step over send_gdb "n\n" gdb_expect { - -re ".*BYE BYE FOR NOW.*1035.*printf\\(.VERY GREEN GRASS.n.\\);.*$gdb_prompt $" { pass "next to 1035"} - -re ".*$gdb_prompt $" { fail "next to 1035" } - timeout { fail "next to 1035(timeout)" } + -re ".*BYE BYE FOR NOW.*1237.*printf\\(.VERY GREEN GRASS.n.\\);.*$gdb_prompt $" { pass "next to 1237"} + -re ".*$gdb_prompt $" { fail "next to 1237" } + timeout { fail "next to 1237(timeout)" } } #call print_array_rep(\*list1, \*list2, \*list3) @@ -241,17 +304,17 @@ gdb_expect { timeout { fail "(timeout) print print_array_rep(*list1, *list2, *list3)" } } -#go -until 1039 -gdb_test "tbreak 1039" \ - "Breakpoint..* file .*$srcfile, line 1039.*" \ - "tbreakpoint line 1039" +#go -until 1241 +gdb_test "tbreak 1241" \ + "Breakpoint..* file .*$srcfile, line 1241.*" \ + "tbreakpoint line 1241" send_gdb "continue\n" gdb_expect { - -re ".*main \\(\\) at .*call-ar-st.c:1039\r\n1039\t\[ \]+sum_array_print\\(10, \\*list1, \\*list2, \\*list3, \\*list4\\);.*$gdb_prompt $" { - pass "continue to 1039"} - -re ".*$gdb_prompt $" { fail "continue to 1039"} - timeout { fail "(timeout) continue to 1039"} + -re ".*main \\(\\) at .*call-ar-st.c:1241\r\n1241\t\[ \]+sum_array_print\\(10, \\*list1, \\*list2, \\*list3, \\*list4\\);.*$gdb_prompt $" { + pass "continue to 1241"} + -re ".*$gdb_prompt $" { fail "continue to 1241"} + timeout { fail "(timeout) continue to 1241"} } @@ -268,7 +331,7 @@ gdb_test "break sum_array_print" \ ".*Breakpoint ${decimal}: file .*call-ar-st.c, line.*" \ "set breakpoint in sum_array_print" gdb_test "continue" \ - ".*Breakpoint ${decimal}, sum_array_print \\(seed=10, linked_list1=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .4, 6, 8, 10, 12, 14, 16, 18, 20, 22., head = 0., linked_list2=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .8, 10, 12, 14, 16, 18, 20, 22, 24, 26., head = 0., linked_list3=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .10, 12, 14, 16, 18, 20, 22, 24, 26, 28., head = 0., linked_list4=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .20, 22, 24, 26, 28, 30, 32, 34, 36, 38., head = 0.\\) at .*call-ar-st.c:909\[ \t\n\r\]+909.*printf\\(.Sum of 4 arrays, by element \\(add in seed as well\\).*\\);.*" \ + ".*Breakpoint ${decimal}, sum_array_print \\(seed=10, linked_list1=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .4, 6, 8, 10, 12, 14, 16, 18, 20, 22., head = 0., linked_list2=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .8, 10, 12, 14, 16, 18, 20, 22, 24, 26., head = 0., linked_list3=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .10, 12, 14, 16, 18, 20, 22, 24, 26, 28., head = 0., linked_list4=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .20, 22, 24, 26, 28, 30, 32, 34, 36, 38., head = 0.\\) at .*call-ar-st.c:1105\[ \t\n\r\]+1105.*printf\\(.Sum of 4 arrays, by element \\(add in seed as well\\).*\\);.*" \ "check args of sum_array_print" #call print_array_rep(linked_list1, linked_list2, linked_list3) @@ -285,17 +348,17 @@ gdb_test "continue" \ #} -#go -until 1079 -gdb_test "tbreak 1079" \ - "Breakpoint.* file .*call-ar-st.c, line 1079.*" \ - "tbreakpoint line 1079" +#go -until 1281 +gdb_test "tbreak 1281" \ + "Breakpoint.* file .*call-ar-st.c, line 1281.*" \ + "tbreakpoint line 1281" send_gdb "continue\n" gdb_expect { - -re "Continuing\\..*Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t.*main \\(\\) at .*call-ar-st.c:1079.*c = 0.*$gdb_prompt $" { - pass "continue to 1079"} - -re ".*$gdb_prompt $" { fail "continue to 1079"} - timeout { fail "(timeout) continue to 1079"} + -re "Continuing\\..*Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t.*main \\(\\) at .*call-ar-st.c:1281.*c = 0.*$gdb_prompt $" { + pass "continue to 1281"} + -re ".*$gdb_prompt $" { fail "continue to 1281"} + timeout { fail "(timeout) continue to 1281"} } #call print_small_structs(*struct1, *struct2, *struct3, *struct4,*flags, *flags_combo, @@ -334,30 +397,51 @@ if {![target_info exists gdb,skip_float_tests]} { } } -#go -until 1084 -gdb_test "tbreak 1084" \ - "Breakpoint .* file .*call-ar-st.c, line 1084.*" \ - "tbreakpoint line 1084" - -gdb_test continue "Continuing\\..*main \\(.*\\) at.*call-ar-st.c:1084\[\t\r\n \]+1084.*print_long_arg_list \\( a, b, c, d, e, f, .struct1, .struct2, .struct3, .struct4,.*" "continue to 1084" - -# We can't just assume that a "step" will get us into print_long_arg_list here,either. -gdb_test "tbreak print_long_arg_list" \ - "Breakpoint .* file .*call-ar-st.c, line .*" \ - "tbreak in print_long_arg_list after stepping into memcpy" -send_gdb "continue\n" -if {![target_info exists gdb,skip_float_tests]} { - gdb_expect { - -re ".*print_long_arg_list \\(a=22.219999999999999, b=33.332999999999998, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.3399999999999999\}, d3=\{double1 = 675.09123\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at ${srcdir}/${subdir}/${srcfile}:813\[\r\n\]+813\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {pass "step into print_long_arg_list"} - -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" } - timeout { fail "step into print_long_arg_list (timeout)" } - } +#go -until 1286 +gdb_test "tbreak 1286" \ + "Breakpoint .* file .*call-ar-st.c, line 1286.*" \ + "tbreakpoint line 1286" + +gdb_test continue "Continuing\\..*main \\(.*\\) at.*call-ar-st.c:1286\[\t\r\n \]+1286.*print_long_arg_list \\( a, b, c, d, e, f, .struct1, .struct2, .struct3, .struct4,.*" "continue to 1286" + +if { [istarget "hppa*-*-hpux*"] } { + # + # NOTE:(FIXME) + # the aCC demangler cannot demangle the name of a function with >10 args. + # so I added a .* after the name of the function, to match the + # incredibly long mangled name + # (getting aCC's libdemangle.a bundled w/ the system?) + # DTS CLLbs16994 coulter 990114 + # + # FIXME: use step for hppa* testing for now + # guo 990621 + # + send_gdb "step\n" + gdb_expect { + -re ".*print_long_arg_list.*\\(a=22.219999999999999, b=33.332999999999998, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.3399999999999999\}, d3=\{double1 = 675.09123\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at ${srcdir}/${subdir}/${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {pass "step into print_long_arg_list"} + -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" } + timeout { fail "step into print_long_arg_list (timeout)" } + } } else { - gdb_expect { - -re ".*print_long_arg_list \\(.*\\).*$gdb_prompt $" { pass "step into print_long_arg_list" } - -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" } - timeout { fail "step into print_long_arg_list (timeout)" } - } + + # We can't just assume that a "step" will get us into print_long_arg_list here,either. + gdb_test "tbreak print_long_arg_list" \ + "Breakpoint .* file .*call-ar-st.c, line .*" \ + "tbreak in print_long_arg_list after stepping into memcpy" + send_gdb "continue\n" + if {![target_info exists gdb,skip_float_tests]} { + gdb_expect { + -re ".*print_long_arg_list \\(a=22.219999999999999, b=33.332999999999998, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.3399999999999999\}, d3=\{double1 = 675.09123\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at ${srcdir}/${subdir}/${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {pass "step into print_long_arg_list"} + -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" } + timeout { fail "step into print_long_arg_list (timeout)" } + } + } else { + gdb_expect { + -re ".*print_long_arg_list \\(.*\\).*$gdb_prompt $" { pass "step into print_long_arg_list" } + -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" } + timeout { fail "step into print_long_arg_list (timeout)" } + } + } } #call print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3) @@ -373,19 +457,25 @@ if {![target_info exists gdb,skip_float_tests]} { } -#go -until 1098 -gdb_test "tbreak 1098" \ - "Breakpoint.* file .*call-ar-st.c, line 1098.*" \ - "tbreakpoint line 1098" +#go -until 1300 +gdb_test "tbreak 1300" \ + "Breakpoint.* file .*call-ar-st.c, line 1300.*" \ + "tbreakpoint line 1300" + +gdb_test continue "Continuing\\..*Contents of two_floats_t:.*main \\(\\) at.*call-ar-st.c:1300.*1300.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \ + "continue to 1300" + -gdb_test continue "Continuing\\..*Contents of two_floats_t:.*main \\(\\) at.*call-ar-st.c:1098.*1098.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \ - "continue to 1098" +# FIXME: +# HP aCC demangler currently does not handle hp aCC functions with >10 args +# DTS CLLbs16994 coulter 990114 +if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*"} #step send_gdb "step\n" gdb_expect { -re " -init_bit_flags_combo \\(bit_flags_combo=, a=1, b=0, ch1=121 .y., g=1, d=0, ch2=110 .n., e=1, o=0\\) at .*call-ar-st.c:385\[ \t\n\r\]+385.*bit_flags_combo->alpha = a;.*$gdb_prompt $" { +init_bit_flags_combo \\(bit_flags_combo=, a=1, b=0, ch1=121 .y., g=1, d=0, ch2=110 .n., e=1, o=0\\) at .*call-ar-st.c:416\[ \t\n\r\]+416.*bit_flags_combo->alpha = a;.*$gdb_prompt $" { pass "step into init_bit_flags_combo"} -re ".*$gdb_prompt $" { fail "step into init_bit_flags_combo" } timeout { fail "step into init_bit_flags_combo (timeout)" } @@ -402,13 +492,13 @@ gdb_expect { } -#go -until 1103 -gdb_test "tbreak 1103" \ - "Breakpoint.* file .*call-ar-st.c, line 1103.*" \ - "tbreakpoint line 1103" +#go -until 1305 +gdb_test "tbreak 1305" \ + "Breakpoint.* file .*call-ar-st.c, line 1305.*" \ + "tbreakpoint line 1305" -gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1103\[\r\n\t \]+1103.*init_int_char_combo\\(int_char_combo, 13, .!.\\);" \ -"continue to 1103" +gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1305\[\r\n\t \]+1305.*init_int_char_combo\\(int_char_combo, 13, .!.\\);" \ +"continue to 1305" #call print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3) if {![target_info exists gdb,skip_float_tests]} { @@ -423,13 +513,13 @@ if {![target_info exists gdb,skip_float_tests]} { } -#go -until 1109 -gdb_test "tbreak 1109" \ - "Breakpoint.* file .*call-ar-st.c, line 1109.*" \ - "tbreakpoint line 1109" +#go -until 1311 +gdb_test "tbreak 1311" \ + "Breakpoint.* file .*call-ar-st.c, line 1311.*" \ + "tbreakpoint line 1311" -gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1109\[ \t\n\r\]+1109.*compute_with_small_structs\\(35\\);" \ -"continue to 1109" +gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1311\[ \t\n\r\]+1311.*compute_with_small_structs\\(35\\);" \ +"continue to 1311" #call sum_struct_print(10, *struct1, *struct2, *struct3, *struct4) diff --git a/gdb/testsuite/gdb.base/call-rt-st.c b/gdb/testsuite/gdb.base/call-rt-st.c index ad40a70e7d..712f70ecbb 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.c +++ b/gdb/testsuite/gdb.base/call-rt-st.c @@ -119,6 +119,16 @@ void loop_count () { * IN unsigned e -- 0 or 1 * IN unsigned o -- 0 or 1 *****************************************************************/ +#ifdef PROTOTYPES +void init_bit_flags ( +struct bit_flags_t *bit_flags, +unsigned a, +unsigned b, +unsigned g, +unsigned d, +unsigned e, +unsigned o) +#else void init_bit_flags (bit_flags,a,b,g,d,e,o) struct bit_flags_t *bit_flags; unsigned a; @@ -127,6 +137,7 @@ unsigned g; unsigned d; unsigned e; unsigned o; +#endif { bit_flags->alpha = a; @@ -152,6 +163,18 @@ unsigned o; * IN unsigned e -- 0 or 1 * IN unsigned o -- 0 or 1 *****************************************************************/ +#ifdef PROTOTYPES +void init_bit_flags_combo ( +struct bit_flags_combo_t *bit_flags_combo, +unsigned a, +unsigned b, +char ch1, +unsigned g, +unsigned d, +char ch2, +unsigned e, +unsigned o) +#else void init_bit_flags_combo (bit_flags_combo, a, b, ch1, g, d, ch2, e, o) struct bit_flags_combo_t *bit_flags_combo; unsigned a; @@ -162,6 +185,7 @@ unsigned d; char ch2; unsigned e; unsigned o; +#endif { bit_flags_combo->alpha = a; @@ -180,9 +204,13 @@ unsigned o; * OUT struct one_double_t *one_double -- structure to fill * IN double init_val *****************************************************************/ +#ifdef PROTOTYPES +void init_one_double ( struct one_double_t *one_double, double init_val) +#else void init_one_double (one_double, init_val) struct one_double_t *one_double; double init_val; +#endif { one_double->double1 = init_val; @@ -194,10 +222,17 @@ double init_val; * IN float init_val1 * IN float init_val2 *****************************************************************/ +#ifdef PROTOTYPES +void init_two_floats ( + struct two_floats_t *two_floats, + float init_val1, + float init_val2) +#else void init_two_floats (two_floats, init_val1, init_val2) struct two_floats_t *two_floats; float init_val1; float init_val2; +#endif { two_floats->float1 = init_val1; @@ -211,11 +246,19 @@ float init_val2; * IN char init_val2 * IN char init_val3 *****************************************************************/ +#ifdef PROTOTYPES +void init_three_chars ( +struct three_char_t *three_char, +char init_val1, +char init_val2, +char init_val3) +#else void init_three_chars ( three_char, init_val1, init_val2, init_val3) struct three_char_t *three_char; char init_val1; char init_val2; char init_val3; +#endif { three_char->ch1 = init_val1; @@ -232,6 +275,15 @@ char init_val3; * IN char init_val4 * IN char init_val5 *****************************************************************/ +#ifdef PROTOTYPES +void init_five_chars ( +struct five_char_t *five_char, +char init_val1, +char init_val2, +char init_val3, +char init_val4, +char init_val5) +#else void init_five_chars ( five_char, init_val1, init_val2, init_val3, init_val4, init_val5) struct five_char_t *five_char; char init_val1; @@ -239,6 +291,7 @@ char init_val2; char init_val3; char init_val4; char init_val5; +#endif { five_char->ch1 = init_val1; @@ -254,10 +307,17 @@ char init_val5; * IN int init_val1 * IN char init_val2 *****************************************************************/ +#ifdef PROTOTYPES +void init_int_char_combo ( +struct int_char_combo_t *combo, +int init_val1, +char init_val2) +#else void init_int_char_combo ( combo, init_val1, init_val2) struct int_char_combo_t *combo; int init_val1; char init_val2; +#endif { combo->int1 = init_val1; @@ -269,10 +329,15 @@ char init_val2; * OUT struct small_rep_into_t *small_struct -- structure to be filled * IN int seed *****************************************************************/ +#ifdef PROTOTYPES +void init_struct_rep( + struct small_rep_info_t *small_struct, + int seed) +#else void init_struct_rep( small_struct, seed) struct small_rep_info_t *small_struct; int seed; - +#endif { small_struct->value = 2 + (seed*2); @@ -283,8 +348,12 @@ int seed; * PRINT_BIT_FLAGS : * IN struct bit_flags_t bit_flags ****************************************************************/ +#ifdef PROTOTYPES +struct bit_flags_t print_bit_flags (struct bit_flags_t bit_flags) +#else struct bit_flags_t print_bit_flags ( bit_flags) struct bit_flags_t bit_flags; +#endif { if (bit_flags.alpha) printf("alpha\n"); @@ -301,8 +370,12 @@ struct bit_flags_t bit_flags; * PRINT_BIT_FLAGS_COMBO : * IN struct bit_flags_combo_t bit_flags_combo ****************************************************************/ +#ifdef PROTOTYPES +struct bit_flags_combo_t print_bit_flags_combo (struct bit_flags_combo_t bit_flags_combo) +#else struct bit_flags_combo_t print_bit_flags_combo ( bit_flags_combo ) struct bit_flags_combo_t bit_flags_combo; +#endif { if (bit_flags_combo.alpha) printf("alpha\n"); @@ -320,8 +393,12 @@ struct bit_flags_combo_t bit_flags_combo; * PRINT_ONE_DOUBLE : * IN struct one_double_t one_double ****************************************************************/ +#ifdef PROTOTYPES +struct one_double_t print_one_double (struct one_double_t one_double) +#else struct one_double_t print_one_double ( one_double ) struct one_double_t one_double; +#endif { printf("Contents of one_double_t: \n\n"); @@ -334,8 +411,12 @@ struct one_double_t one_double; * PRINT_TWO_FLOATS : * IN struct two_floats_t two_floats ****************************************************************/ +#ifdef PROTOTYPES +struct two_floats_t print_two_floats (struct two_floats_t two_floats) +#else struct two_floats_t print_two_floats ( two_floats ) struct two_floats_t two_floats; +#endif { printf("Contents of two_floats_t: \n\n"); @@ -348,8 +429,12 @@ struct two_floats_t two_floats; * PRINT_THREE_CHARS : * IN struct three_char_t three_char ****************************************************************/ +#ifdef PROTOTYPES +struct three_char_t print_three_chars (struct three_char_t three_char) +#else struct three_char_t print_three_chars ( three_char ) struct three_char_t three_char; +#endif { printf("Contents of three_char_t: \n\n"); @@ -362,8 +447,12 @@ struct three_char_t three_char; * PRINT_FIVE_CHARS : * IN struct five_char_t five_char ****************************************************************/ +#ifdef PROTOTYPES +struct five_char_t print_five_chars (struct five_char_t five_char) +#else struct five_char_t print_five_chars ( five_char ) struct five_char_t five_char; +#endif { printf("Contents of five_char_t: \n\n"); @@ -378,8 +467,12 @@ struct five_char_t five_char; * PRINT_INT_CHAR_COMBO : * IN struct int_char_combo_t int_char_combo ****************************************************************/ +#ifdef PROTOTYPES +struct int_char_combo_t print_int_char_combo (struct int_char_combo_t int_char_combo) +#else struct int_char_combo_t print_int_char_combo ( int_char_combo ) struct int_char_combo_t int_char_combo; +#endif { printf("Contents of int_char_combo_t: \n\n"); @@ -391,9 +484,12 @@ struct int_char_combo_t int_char_combo; /***************************************************************** * PRINT_STRUCT_REP : ****************************************************************/ +#ifdef PROTOTYPES +struct small_rep_info_t print_struct_rep(struct small_rep_info_t struct1) +#else struct small_rep_info_t print_struct_rep( struct1 ) struct small_rep_info_t struct1; - +#endif { printf("Contents of struct1: \n\n"); @@ -406,8 +502,12 @@ struct small_rep_info_t struct1; } +#ifdef PROTOTYPES +struct array_rep_info_t print_one_large_struct(struct array_rep_info_t linked_list1) +#else struct array_rep_info_t print_one_large_struct( linked_list1 ) struct array_rep_info_t linked_list1; +#endif { @@ -423,10 +523,13 @@ struct array_rep_info_t linked_list1; * IN struct array_rep_info_t *linked_list * IN int seed ****************************************************************/ +#ifdef PROTOTYPES +void init_array_rep(struct array_rep_info_t *linked_list, int seed) +#else void init_array_rep( linked_list, seed ) struct array_rep_info_t *linked_list; int seed; - +#endif { int index; diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp index 2c419aebed..a1cca708c5 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.exp +++ b/gdb/testsuite/gdb.base/call-rt-st.exp @@ -122,8 +122,10 @@ gdb_expect { send_gdb "finish\n" gdb_expect { - -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:514\[ \t\r\n\]+514\[\t \]+return 0;.*$gdb_prompt $" { - pass "finish out from loop_count"} + -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:617\[ \t\r\n\]+617\[\t \]+return 0;.*$gdb_prompt $" { + pass "finish out from loop_count (line 617)"} + -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:615\[ \t\r\n\]+615\[\t \]+loop_count.*$gdb_prompt $" { + pass "finish out from loop_count (line 615)"} -re ".*$gdb_prompt $" { fail "finish out from loop_count"} timeout { fail "(timeout)finish out from loop_count"} } diff --git a/gdb/testsuite/gdb.base/call-strs.c b/gdb/testsuite/gdb.base/call-strs.c index 02870e0f60..f3bc8da916 100644 --- a/gdb/testsuite/gdb.base/call-strs.c +++ b/gdb/testsuite/gdb.base/call-strs.c @@ -1,16 +1,33 @@ #include +#include +#include + char buf[100]; char bigbuf[1000]; char * s; +#ifdef PROTOTYPES +char * str_func1(char *s1) +#else char * str_func1(s1) char *s1; +#endif { printf("first string arg is: %s\n", s1); strcpy(bigbuf, s1); return bigbuf; } +#ifdef PROTOTYPES +char * str_func( +char * s1, +char * s2, +char * s3, +char * s4, +char * s5, +char * s6, +char * s7) +#else char * str_func(s1, s2, s3, @@ -25,6 +42,7 @@ char * s4; char * s5; char * s6; char * s7; +#endif { printf("first string arg is: %s\n", s1); printf("second string arg is: %s\n", s2); @@ -49,11 +67,12 @@ link_malloc () return (char*) malloc (1); } -main() +int main() { s = &buf[0]; strcpy(buf, "test string"); str_func("abcd", "efgh", "ijkl", "mnop", "qrst", "uvwx", "yz12"); str_func1("abcd"); + return 0; } diff --git a/gdb/testsuite/gdb.base/call-strs.exp b/gdb/testsuite/gdb.base/call-strs.exp index 1d4cc4a98a..84c1ef5c5b 100644 --- a/gdb/testsuite/gdb.base/call-strs.exp +++ b/gdb/testsuite/gdb.base/call-strs.exp @@ -217,26 +217,25 @@ gdb_expect { timeout { fail "(timeout) call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" } } -#print str_func(s,s,s,s,s,s,s,s) -send_gdb "print str_func(s,s,s,s,s,s,s,s)\n" +#print str_func(s,s,s,s,s,s,s) +send_gdb "print str_func(s,s,s,s,s,s,s)\n" gdb_expect { -re "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*$gdb_prompt $" { - pass "print str_func(s,s,s,s,s,s,s,s)" + pass "print str_func(s,s,s,s,s,s,s)" } - -re ".*$gdb_prompt $" { fail "print str_func(s,s,s,s,s,s,s,s)" } - timeout { fail "(timeout) print str_func(s,s,s,s,s,s,s,s)" } + -re ".*$gdb_prompt $" { fail "print str_func(s,s,s,s,s,s,s)" } + timeout { fail "(timeout) print str_func(s,s,s,s,s,s,s)" } } -#call str_func(s,s,s,s,s,s,s,s) -send_gdb "call str_func(s,s,s,s,s,s,s,s)\n" +#call str_func(s,s,s,s,s,s,s) +send_gdb "call str_func(s,s,s,s,s,s,s)\n" gdb_expect { -re "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*$gdb_prompt $" { - pass "call str_func(s,s,s,s,s,s,s,s)" + pass "call str_func(s,s,s,s,s,s,s)" } - -re ".*$gdb_prompt $" { fail "call str_func(s,s,s,s,s,s,s,s)" } - timeout { fail "(timeout) call str_func(s,s,s,s,s,s,s,s)" } + -re ".*$gdb_prompt $" { fail "call str_func(s,s,s,s,s,s,s)" } + timeout { fail "(timeout) call str_func(s,s,s,s,s,s,s)" } } gdb_exit return 0 -~ diff --git a/gdb/testsuite/gdb.base/callfuncs.c b/gdb/testsuite/gdb.base/callfuncs.c index 56b9ba8153..ecf902657d 100644 --- a/gdb/testsuite/gdb.base/callfuncs.c +++ b/gdb/testsuite/gdb.base/callfuncs.c @@ -8,6 +8,9 @@ #define PARAMS(paramlist) paramlist #endif +# include +# include + char char_val1 = 'a'; char char_val2 = 'b'; @@ -28,8 +31,8 @@ double double_val2 = -67.66; #define DELTA (0.001) -char *string_val1 = "string 1"; -char *string_val2 = "string 2"; +char *string_val1 = (char *)"string 1"; +char *string_val2 = (char *)"string 2"; char char_array_val1[] = "carray 1"; char char_array_val2[] = "carray 2"; @@ -46,15 +49,20 @@ struct struct1 { /* Some functions that can be passed as arguments to other test functions, or called directly. */ - -int add (a, b) -int a, b; +#ifdef PROTOTYPES +int add (int a, int b) +#else +int add (a, b) int a, b; +#endif { return (a + b); } -int doubleit (a) -int a; +#ifdef PROTOTYPES +int doubleit (int a) +#else +int doubleit (a) int a; +#endif { return (a + a); } @@ -69,20 +77,29 @@ enum enumtype enum_val1 = enumval1; enum enumtype enum_val2 = enumval2; enum enumtype enum_val3 = enumval3; -int t_enum_value1 (enum_arg) -enum enumtype enum_arg; +#ifdef PROTOTYPES +int t_enum_value1 (enum enumtype enum_arg) +#else +int t_enum_value1 (enum_arg) enum enumtype enum_arg; +#endif { return (enum_arg == enum_val1); } -int t_enum_value2 (enum_arg) -enum enumtype enum_arg; +#ifdef PROTOTYPES +int t_enum_value2 (enum enumtype enum_arg) +#else +int t_enum_value2 (enum_arg) enum enumtype enum_arg; +#endif { return (enum_arg == enum_val2); } -int t_enum_value3 (enum_arg) -enum enumtype enum_arg; +#ifdef PROTOTYPES +int t_enum_value3 (enum enumtype enum_arg) +#else +int t_enum_value3 (enum_arg) enum enumtype enum_arg; +#endif { return (enum_arg == enum_val3); } @@ -90,9 +107,11 @@ enum enumtype enum_arg; /* A function that takes a vector of integers (along with an explicit count) and returns their sum. */ -int sum_args (argc, argv) -int argc; -int argv[]; +#ifdef PROTOTYPES +int sum_args (int argc, int argv[]) +#else +int sum_args (argc, argv) int argc; int argv[]; +#endif { int sumval = 0; int idx; @@ -107,6 +126,15 @@ int argv[]; /* Test that we can call functions that take structs and return members from that struct */ +#ifdef PROTOTYPES +char t_structs_c (struct struct1 tstruct) { return (tstruct.c); } +short t_structs_s (struct struct1 tstruct) { return (tstruct.s); } +int t_structs_i (struct struct1 tstruct) { return (tstruct.i); } +long t_structs_l (struct struct1 tstruct) { return (tstruct.l); } +float t_structs_f (struct struct1 tstruct) { return (tstruct.f); } +double t_structs_d (struct struct1 tstruct) { return (tstruct.d); } +char *t_structs_a (struct struct1 tstruct) { return (tstruct.a); } +#else char t_structs_c (tstruct) struct struct1 tstruct; { return (tstruct.c); } short t_structs_s (tstruct) struct struct1 tstruct; { return (tstruct.s); } int t_structs_i (tstruct) struct struct1 tstruct; { return (tstruct.i); } @@ -114,19 +142,30 @@ long t_structs_l (tstruct) struct struct1 tstruct; { return (tstruct.l); } float t_structs_f (tstruct) struct struct1 tstruct; { return (tstruct.f); } double t_structs_d (tstruct) struct struct1 tstruct; { return (tstruct.d); } char *t_structs_a (tstruct) struct struct1 tstruct; { return (tstruct.a); } +#endif /* Test that calling functions works if there are a lot of arguments. */ +#ifdef PROTOTYPES +int +sum10 (int i0, int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9) +#else int sum10 (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) int i0, i1, i2, i3, i4, i5, i6, i7, i8, i9; +#endif { return i0 + i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9; } /* Test that args are passed in the right order. */ +#ifdef PROTOTYPES +int +cmp10 (int i0, int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9) +#else int cmp10 (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) int i0, i1, i2, i3, i4, i5, i6, i7, i8, i9; +#endif { return (i0 == 0) && (i1 == 1) && (i2 == 2) && (i3 == 3) && (i4 == 4) && @@ -152,14 +191,21 @@ int main () either 0 or 1, depending upon whether the values were passed incorrectly or correctly, respectively. */ +#ifdef PROTOTYPES +int t_char_values (char char_arg1, char char_arg2) +#else int t_char_values (char_arg1, char_arg2) char char_arg1, char_arg2; +#endif { return ((char_arg1 == char_val1) && (char_arg2 == char_val2)); } int -#ifdef NO_PROTOTYPES +#ifdef PROTOTYPES +t_small_values (char arg1, short arg2, int arg3, char arg4, short arg5, + char arg6, short arg7, int arg8, short arg9, short arg10) +#else t_small_values (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) char arg1; short arg2; @@ -171,34 +217,47 @@ t_small_values (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) int arg8; short arg9; short arg10; -#else -t_small_values (char arg1, short arg2, int arg3, char arg4, short arg5, - char arg6, short arg7, int arg8, short arg9, short arg10) #endif { return arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10; } +#ifdef PROTOTYPES +int t_short_values (short short_arg1, short short_arg2) +#else int t_short_values (short_arg1, short_arg2) -short short_arg1, short_arg2; + short short_arg1, short_arg2; +#endif { return ((short_arg1 == short_val1) && (short_arg2 == short_val2)); } +#ifdef PROTOTYPES +int t_int_values (int int_arg1, int int_arg2) +#else int t_int_values (int_arg1, int_arg2) int int_arg1, int_arg2; +#endif { return ((int_arg1 == int_val1) && (int_arg2 == int_val2)); } +#ifdef PROTOTYPES +int t_long_values (long long_arg1, long long_arg2) +#else int t_long_values (long_arg1, long_arg2) long long_arg1, long_arg2; +#endif { return ((long_arg1 == long_val1) && (long_arg2 == long_val2)); } +#ifdef PROTOTYPES +int t_float_values (float float_arg1, float float_arg2) +#else int t_float_values (float_arg1, float_arg2) float float_arg1, float_arg2; +#endif { return ((float_arg1 - float_val1) < DELTA && (float_arg1 - float_val1) > -DELTA @@ -207,13 +266,13 @@ float float_arg1, float_arg2; } int -#ifdef NO_PROTOTYPES +#ifdef PROTOTYPES +t_float_values2 (float float_arg1, float float_arg2) +#else /* In this case we are just duplicating t_float_values, but that is the easiest way to deal with either ANSI or non-ANSI. */ t_float_values2 (float_arg1, float_arg2) float float_arg1, float_arg2; -#else -t_float_values2 (float float_arg1, float float_arg2) #endif { return ((float_arg1 - float_val1) < DELTA @@ -222,8 +281,12 @@ t_float_values2 (float float_arg1, float float_arg2) && (float_arg2 - float_val2) > -DELTA); } +#ifdef PROTOTYPES +int t_double_values (double double_arg1, double double_arg2) +#else int t_double_values (double_arg1, double_arg2) double double_arg1, double_arg2; +#endif { return ((double_arg1 - double_val1) < DELTA && (double_arg1 - double_val1) > -DELTA @@ -231,15 +294,23 @@ double double_arg1, double_arg2; && (double_arg2 - double_val2) > -DELTA); } +#ifdef PROTOTYPES +int t_string_values (char *string_arg1, char *string_arg2) +#else int t_string_values (string_arg1, string_arg2) char *string_arg1, *string_arg2; +#endif { return (!strcmp (string_arg1, string_val1) && !strcmp (string_arg2, string_val2)); } +#ifdef PROTOTYPES +int t_char_array_values (char char_array_arg1[], char char_array_arg2[]) +#else int t_char_array_values (char_array_arg1, char_array_arg2) char char_array_arg1[], char_array_arg2[]; +#endif { return (!strcmp (char_array_arg1, char_array_val1) && !strcmp (char_array_arg2, char_array_val2)); @@ -264,17 +335,25 @@ char char_array_arg1[], char_array_arg2[]; that function indirectly through the function pointer. This would fail on the HPPA. */ +#ifdef PROTOTYPES +int t_func_values (int (*func_arg1)(int, int), int (*func_arg2)(int)) +#else int t_func_values (func_arg1, func_arg2) int (*func_arg1) PARAMS ((int, int)); int (*func_arg2) PARAMS ((int)); +#endif { return ((*func_arg1) (5,5) == (*func_val1) (5,5) && (*func_arg2) (6) == (*func_val2) (6)); } +#ifdef PROTOTYPES +int t_call_add (int (*func_arg1)(int, int), int a, int b) +#else int t_call_add (func_arg1, a, b) int (*func_arg1) PARAMS ((int, int)); int a, b; +#endif { return ((*func_arg1)(a, b)); } diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp index 19b5c965a9..7db87b7caf 100644 --- a/gdb/testsuite/gdb.base/callfuncs.exp +++ b/gdb/testsuite/gdb.base/callfuncs.exp @@ -31,14 +31,8 @@ set testfile "callfuncs" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} -set prototypes 1 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - set prototypes 0; - # built the second test case since we can't use prototypes - warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES" - if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DNO_PROTOTYPES}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." - } } # Create and source the file that provides information about the compiler @@ -48,6 +42,12 @@ if [get_compiler_info ${binfile}] { return -1; } +if {$hp_aCC_compiler} { + set prototypes 1 +} else { + set prototypes 0 +} + # The a29k can't call functions, so don't even bother with this test. if [target_info exists gdb,cannot_call_functions] { setup_xfail "*-*-*" 2416 @@ -129,13 +129,13 @@ proc do_function_calls {} { # Gcc emits different stabs for the two parameters; the first is # claimed to be a float, the second a double. # dbxout.c in gcc claims this is the desired behavior. - setup_xfail "mn10300-*-*" + setup_xfail "mn10300-*-*" "hppa*-*-*11*" gdb_test "p t_float_values(3.14159,-2.3765)" " = 1" - setup_xfail "mn10300-*-*" + setup_xfail "mn10300-*-*" "hppa*-*-*11*" gdb_test "p t_float_values(float_val1,float_val2)" " = 1" - setup_xfail "mn10300-*-*" + setup_xfail "mn10300-*-*" "hppa*-*-*11*" gdb_test "p t_float_values(3.14159,float_val2)" " = 1" - setup_xfail "mn10300-*-*" + setup_xfail "mn10300-*-*" "hppa*-*-*11*" gdb_test "p t_float_values(float_val1,-2.3765)" " = 1" # Test passing of arguments which might not be widened. @@ -144,7 +144,7 @@ proc do_function_calls {} { # Although PR 5318 mentions SunOS specifically, this seems # to be a generic problem on quite a few platforms. if $prototypes then { - setup_xfail "hppa*-*-*" "sparc-*-*" "mips*-*-*" 5318 + setup_xfail "sparc-*-*" "mips*-*-*" 5318 if {!$gcc_compiled} then { setup_xfail "alpha-dec-osf2*" "i*86-*-sysv4*" 5318 } @@ -186,7 +186,17 @@ proc do_function_calls {} { setup_xfail "rs6000*-*-*" setup_xfail "powerpc*-*-*" if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - gdb_test "p t_func_values(add,func_val2)" "You cannot.*ignored.*" + send_gdb "p t_func_values(add,func_val2)\n" + gdb_expect { + -re "You cannot.*ignored.*" {pass "p t_func_values(add,func_val2)"} + -re "Program received signal SIGBUS, Bus error.*" { + if [istarget hppa*-*-hpux*] { + pass "p t_func_values(add,func_val2)" + } else { + fail "p t_func_values(add,func_val2)" + } + } + } } else { gdb_test "p t_func_values(add,func_val2)" " = 1" } @@ -194,7 +204,17 @@ proc do_function_calls {} { setup_xfail "rs6000*-*-*" setup_xfail "powerpc*-*-*" if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - gdb_test "p t_func_values(func_val1,doubleit)" "You cannot.*ignored.*" + send_gdb "p t_func_values(func_val1,doubleit)\n" + gdb_expect { + -re "You cannot.*ignored.*" {pass "p t_func_values(func_val1,doubleit)"} + -re "Program received signal SIGBUS, Bus error.*" { + if [istarget hppa*-*-hpux*] { + pass "p t_func_values(func_val1,doubleit)" + } else { + fail "p t_func_values(func_val1,doubleit)" + } + } + } } else { gdb_test "p t_func_values(func_val1,doubleit)" " = 1" } @@ -204,7 +224,17 @@ proc do_function_calls {} { setup_xfail "rs6000*-*-*" setup_xfail "powerpc*-*-*" if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - gdb_test "p t_call_add(add,3,4)" "You cannot.*ignored.*" + send_gdb "p t_call_add(add,3,4)\n" + gdb_expect { + -re "You cannot.*ignored.*" {pass "p t_call_add(add,3,4)"} + -re "Program received signal SIGBUS, Bus error.*" { + if [istarget hppa*-*-hpux*] { + pass "p t_call_add(add,3,4)" + } else { + fail "p t_call_add(add,3,4)" + } + } + } } else { gdb_test "p t_call_add(add,3,4)" " = 7" } @@ -255,12 +285,27 @@ gdb_test "set print sevenbit-strings" "" gdb_test "set print address off" "" gdb_test "set width 0" "" -if { ![set_lang_c] } { - gdb_suppress_tests; -} else { +if { $hp_aCC_compiler } { + # Do not set language explicitly to 'C'. This will cause aCC + # tests to fail because promotion rules are different. Just let + # the language be set to the default. + if { ![runto_main] } { gdb_suppress_tests; } + + # However, turn off overload-resolution for aCC. Having it on causes + # a lot of failures. + + gdb_test "set overload-resolution 0" ".*" +} else { + if { ![set_lang_c] } { + gdb_suppress_tests; + } else { + if { ![runto_main] } { + gdb_suppress_tests; + } + } } gdb_test "next" ".*" diff --git a/gdb/testsuite/gdb.base/callfuncs2.c b/gdb/testsuite/gdb.base/callfuncs2.c index ac14d457ae..550a970fba 100644 --- a/gdb/testsuite/gdb.base/callfuncs2.c +++ b/gdb/testsuite/gdb.base/callfuncs2.c @@ -8,6 +8,8 @@ #define PARAMS(paramlist) paramlist #endif +# include + char char_val1 = 'a'; char char_val2 = 'b'; @@ -28,8 +30,8 @@ double double_val2 = -67.66; #define DELTA (0.001) -char *string_val1 = "string 1"; -char *string_val2 = "string 2"; +char *string_val1 = (char *)"string 1"; +char *string_val2 = (char *)"string 2"; char char_array_val1[] = "carray 1"; char char_array_val2[] = "carray 2"; @@ -46,15 +48,21 @@ struct struct1 { /* Some functions that can be passed as arguments to other test functions, or called directly. */ - -int add (a, b) -int a, b; +#ifdef PROTOTYPES +int add (int a, int b) +#else +int add (a, b) int a, b; +#endif { return (a + b); } +#ifdef PROTOTYPES +int doubleit (int a) +#else int doubleit (a) int a; +#endif { return (a + a); } @@ -69,20 +77,32 @@ enum enumtype enum_val1 = enumval1; enum enumtype enum_val2 = enumval2; enum enumtype enum_val3 = enumval3; +#ifdef PROTOTYPES +int t_enum_value1 (enum enumtype enum_arg) +#else t_enum_value1 (enum_arg) enum enumtype enum_arg; +#endif { return (enum_arg == enum_val1); } +#ifdef PROTOTYPES +int t_enum_value2 (enum enumtype enum_arg) +#else t_enum_value2 (enum_arg) enum enumtype enum_arg; +#endif { return (enum_arg == enum_val2); } +#ifdef PROTOTYPES +int t_enum_value3 (enum enumtype enum_arg) +#else t_enum_value3 (enum_arg) enum enumtype enum_arg; +#endif { return (enum_arg == enum_val3); } @@ -90,9 +110,13 @@ enum enumtype enum_arg; /* A function that takes a vector of integers (along with an explicit count) and returns their sum. */ +#ifdef PROTOTYPES +int sum_args (int argc, int argv[]) +#else int sum_args (argc, argv) int argc; int argv[]; +#endif { int sumval = 0; int idx; @@ -107,6 +131,15 @@ int argv[]; /* Test that we can call functions that take structs and return members from that struct */ +#ifdef PROTOTYPES +char t_structs_c (struct struct1 tstruct) { return (tstruct.c); } +short t_structs_s (struct struct1 tstruct) { return (tstruct.s); } +int t_structs_i (struct struct1 tstruct) { return (tstruct.i); } +long t_structs_l (struct struct1 tstruct) { return (tstruct.l); } +float t_structs_f (struct struct1 tstruct) { return (tstruct.f); } +double t_structs_d (struct struct1 tstruct) { return (tstruct.d); } +char *t_structs_a (struct struct1 tstruct) { return (tstruct.a); } +#else char t_structs_c (tstruct) struct struct1 tstruct; { return (tstruct.c); } short t_structs_s (tstruct) struct struct1 tstruct; { return (tstruct.s); } int t_structs_i (tstruct) struct struct1 tstruct; { return (tstruct.i); } @@ -114,11 +147,16 @@ long t_structs_l (tstruct) struct struct1 tstruct; { return (tstruct.l); } float t_structs_f (tstruct) struct struct1 tstruct; { return (tstruct.f); } double t_structs_d (tstruct) struct struct1 tstruct; { return (tstruct.d); } char *t_structs_a (tstruct) struct struct1 tstruct; { return (tstruct.a); } +#endif /* Test that calling functions works if there are a lot of arguments. */ +#ifdef PROTOTYPES +int sum10 (int i0, int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9) +#else int sum10 (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) int i0, i1, i2, i3, i4, i5, i6, i7, i8, i9; +#endif { return i0 + i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9; } @@ -126,27 +164,40 @@ sum10 (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) /* Gotta have a main to be able to generate a linked, runnable executable, and also provide a useful place to set a breakpoint. */ +#ifdef PROTOTYPES +int main() +#else main () +#endif { #ifdef usestubs set_debug_traps(); breakpoint(); #endif t_structs_c(struct_val1); + return 0; + } /* Functions that expect specific values to be passed and return either 0 or 1, depending upon whether the values were passed incorrectly or correctly, respectively. */ +#ifdef PROTOTYPES +int t_char_values (char char_arg1, char char_arg2) +#else int t_char_values (char_arg1, char_arg2) char char_arg1, char_arg2; +#endif { return ((char_arg1 == char_val1) && (char_arg2 == char_val2)); } int -#ifdef NO_PROTOTYPES +#ifdef PROTOTYPES +t_small_values (char arg1, short arg2, int arg3, char arg4, short arg5, + char arg6, short arg7, int arg8, short arg9, short arg10) +#else t_small_values (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) char arg1; short arg2; @@ -158,34 +209,47 @@ t_small_values (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) int arg8; short arg9; short arg10; -#else -t_small_values (char arg1, short arg2, int arg3, char arg4, short arg5, - char arg6, short arg7, int arg8, short arg9, short arg10) #endif { return arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10; } +#ifdef PROTOTYPES +int t_short_values (short short_arg1, short short_arg2) +#else int t_short_values (short_arg1, short_arg2) short short_arg1, short_arg2; +#endif { return ((short_arg1 == short_val1) && (short_arg2 == short_val2)); } +#ifdef PROTOTYPES +int t_int_values (int int_arg1, int int_arg2) +#else int t_int_values (int_arg1, int_arg2) int int_arg1, int_arg2; +#endif { return ((int_arg1 == int_val1) && (int_arg2 == int_val2)); } +#ifdef PROTOTYPES +int t_long_values (long long_arg1, long long_arg2) +#else int t_long_values (long_arg1, long_arg2) long long_arg1, long_arg2; +#endif { return ((long_arg1 == long_val1) && (long_arg2 == long_val2)); } +#ifdef PROTOTYPES +int t_float_values (float float_arg1, float float_arg2) +#else int t_float_values (float_arg1, float_arg2) float float_arg1, float_arg2; +#endif { return ((float_arg1 - float_val1) < DELTA && (float_arg1 - float_val1) > -DELTA @@ -194,13 +258,13 @@ float float_arg1, float_arg2; } int -#ifdef NO_PROTOTYPES +#ifdef PROTOTYPES +t_float_values2 (float float_arg1, float float_arg2) +#else /* In this case we are just duplicating t_float_values, but that is the easiest way to deal with either ANSI or non-ANSI. */ t_float_values2 (float_arg1, float_arg2) float float_arg1, float_arg2; -#else -t_float_values2 (float float_arg1, float float_arg2) #endif { return ((float_arg1 - float_val1) < DELTA @@ -209,8 +273,12 @@ t_float_values2 (float float_arg1, float float_arg2) && (float_arg2 - float_val2) > -DELTA); } +#ifdef PROTOTYPES +int t_double_values (double double_arg1, double double_arg2) +#else int t_double_values (double_arg1, double_arg2) double double_arg1, double_arg2; +#endif { return ((double_arg1 - double_val1) < DELTA && (double_arg1 - double_val1) > -DELTA @@ -218,15 +286,23 @@ double double_arg1, double_arg2; && (double_arg2 - double_val2) > -DELTA); } +#ifdef PROTOTYPES +int t_string_values (char *string_arg1, char *string_arg2) +#else int t_string_values (string_arg1, string_arg2) char *string_arg1, *string_arg2; +#endif { return (!strcmp (string_arg1, string_val1) && !strcmp (string_arg2, string_val2)); } +#ifdef PROTOTYPES +int t_char_array_values (char char_array_arg1[], char char_array_arg2[]) +#else int t_char_array_values (char_array_arg1, char_array_arg2) char char_array_arg1[], char_array_arg2[]; +#endif { return (!strcmp (char_array_arg1, char_array_val1) && !strcmp (char_array_arg2, char_array_val2)); @@ -251,17 +327,25 @@ char char_array_arg1[], char_array_arg2[]; that function indirectly through the function pointer. This would fail on the HPPA. */ +#ifdef PROTOTYPES +int t_func_values (int (*func_arg1)(int, int), int (*func_arg2)(int)) +#else int t_func_values (func_arg1, func_arg2) int (*func_arg1) PARAMS ((int, int)); int (*func_arg2) PARAMS ((int)); +#endif { return ((*func_arg1) (5,5) == (*func_val1) (5,5) && (*func_arg2) (6) == (*func_val2) (6)); } +#ifdef PROTOTYPES +int t_call_add (int (*func_arg1)(int, int), int a, int b) +#else int t_call_add (func_arg1, a, b) int (*func_arg1) PARAMS ((int, int)); int a, b; +#endif { return ((*func_arg1)(a, b)); } diff --git a/gdb/testsuite/gdb.base/callfuncs2.exp b/gdb/testsuite/gdb.base/callfuncs2.exp index 8b17b6346b..078e467bf5 100644 --- a/gdb/testsuite/gdb.base/callfuncs2.exp +++ b/gdb/testsuite/gdb.base/callfuncs2.exp @@ -19,7 +19,7 @@ # This file was written by Fred Fish. (fnf@cygnus.com) -# SAME tests as in callfuncs.exp but here the inferior program does not call malloc. +# SAME tests as in callfns.exp but here the inferior program does not call malloc. @@ -34,14 +34,8 @@ set testfile "callfuncs2" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} -set prototypes 1 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - set prototypes 0; - # built the second test case since we can't use prototypes - warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES" - if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DNO_PROTOTYPES}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." - } } # Create and source the file that provides information about the compiler @@ -51,6 +45,11 @@ if [get_compiler_info ${binfile}] { return -1; } +if {$hp_aCC_compiler} { + set prototypes 1 +} else { + set prototypes 0 +} # The a29k can't call functions, so don't even bother with this test. @@ -134,13 +133,13 @@ proc do_function_calls {} { # Gcc emits different stabs for the two parameters; the first is # claimed to be a float, the second a double. # dbxout.c in gcc claims this is the desired behavior. - setup_xfail "mn10300-*-*" + setup_xfail "mn10300-*-*" "hppa*-*-*11*" gdb_test "p t_float_values(3.14159,-2.3765)" " = 1" - setup_xfail "mn10300-*-*" + setup_xfail "mn10300-*-*" "hppa*-*-*11*" gdb_test "p t_float_values(float_val1,float_val2)" " = 1" - setup_xfail "mn10300-*-*" + setup_xfail "mn10300-*-*" "hppa*-*-*11*" gdb_test "p t_float_values(3.14159,float_val2)" " = 1" - setup_xfail "mn10300-*-*" + setup_xfail "mn10300-*-*" "hppa*-*-*11*" gdb_test "p t_float_values(float_val1,-2.3765)" " = 1" # Test passing of arguments which might not be widened. @@ -149,7 +148,7 @@ proc do_function_calls {} { # Although PR 5318 mentions SunOS specifically, this seems # to be a generic problem on quite a few platforms. if $prototypes then { - setup_xfail "hppa*-*-*" "sparc-*-*" "mips*-*-*" 5318 + setup_xfail "sparc-*-*" "mips*-*-*" 5318 if {!$gcc_compiled} then { setup_xfail "alpha-dec-osf2*" "i*86-*-sysv4*" 5318 } @@ -193,7 +192,17 @@ proc do_function_calls {} { setup_xfail "powerpc*-*-*" if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - gdb_test "p t_func_values(add,func_val2)" "You cannot.*ignored.*" + send_gdb "p t_func_values(add,func_val2)\n" + gdb_expect { + -re "You cannot.*ignored.*" {pass "p t_func_values(add,func_val2)"} + -re "Program received signal SIGBUS, Bus error.*" { + if [istarget hppa*-*-hpux*] { + pass "p t_func_values(add,func_val2)" + } else { + fail "p t_func_values(add,func_val2)" + } + } + } } else { gdb_test "p t_func_values(add,func_val2)" " = 1" } @@ -202,7 +211,17 @@ proc do_function_calls {} { setup_xfail "powerpc*-*-*" if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - gdb_test "p t_func_values(func_val1,doubleit)" "You cannot.*ignored.*" + send_gdb "p t_func_values(func_val1,doubleit)\n" + gdb_expect { + -re "You cannot.*ignored.*" {pass "p t_func_values(func_val1,doubleit)"} + -re "Program received signal SIGBUS, Bus error.*" { + if [istarget hppa*-*-hpux*] { + pass "p t_func_values(func_val1,doubleit)" + } else { + fail "p t_func_values(func_val1,doubleit)" + } + } + } } else { gdb_test "p t_func_values(func_val1,doubleit)" " = 1" } @@ -213,7 +232,17 @@ proc do_function_calls {} { setup_xfail "powerpc*-*-*" if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - gdb_test "p t_call_add(add,3,4)" "You cannot.*ignored.*" + send_gdb "p t_call_add(add,3,4)\n" + gdb_expect { + -re "You cannot.*ignored.*" {pass "p t_call_add(add,3,4)"} + -re "Program received signal SIGBUS, Bus error.*" { + if [istarget hppa*-*-hpux*] { + pass "p t_call_add(add,3,4)" + } else { + fail "p t_call_add(add,3,4)" + } + } + } } else { gdb_test "p t_call_add(add,3,4)" " = 7" } @@ -262,12 +291,24 @@ gdb_test "set print sevenbit-strings" "" gdb_test "set print address off" "" gdb_test "set width 0" "" -if { ![set_lang_c] } { - gdb_suppress_tests; -} else { +if { $hp_aCC_compiler } { + # Do not set language explicitly to 'C'. This will cause aCC + # tests to fail because promotion rules are different. Just let + # the language be set to the default. + if { ![runto_main] } { gdb_suppress_tests; } + + gdb_test "set overload-resolution 0" ".*" +} else { + if { ![set_lang_c] } { + gdb_suppress_tests; + } else { + if { ![runto_main] } { + gdb_suppress_tests; + } + } } gdb_test "next" ".*" diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp index 72356ec53c..62d9f109b4 100644 --- a/gdb/testsuite/gdb.base/commands.exp +++ b/gdb/testsuite/gdb.base/commands.exp @@ -93,6 +93,7 @@ proc progvar_simple_while_test {} { return } + gdb_test "set args 5" "" "set args in progvar_simple_while_test" if { ![runto factorial] } then { gdb_suppress_tests } # Don't depend upon argument passing, since most simulators don't currently # support it. Bash value variable to be what we want. @@ -110,6 +111,7 @@ proc progvar_complex_if_while_test {} { return } + gdb_test "set args 4" "" "set args in progvar_complex_if_while_test" if { ![runto factorial] } then { gdb_suppress_tests } # Don't depend upon argument passing, since most simulators don't currently # support it. Bash value variable to be what we want. @@ -125,6 +127,7 @@ proc if_while_breakpoint_command_test {} { return } + gdb_test "set args 5" "" "set args in if_while_breakpoint_command_test" if { ![runto factorial] } then { gdb_suppress_tests } # Don't depend upon argument passing, since most simulators don't currently # support it. Bash value variable to be what we want. @@ -155,6 +158,7 @@ proc infrun_breakpoint_command_test {} { return } + gdb_test "set args 6" "" "set args in progvar_simple_while_test" if { ![runto factorial] } then { gdb_suppress_tests } # Don't depend upon argument passing, since most simulators don't currently # support it. Bash value variable to be what we want. @@ -177,8 +181,14 @@ proc infrun_breakpoint_command_test {} { } gdb_test "step\nstep\nstep\nstep\nbt\nend" "" \ "commands in infrun_breakpoint_command_test #2" - - gdb_test "continue" "Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.* + + if { [istarget "hppa*-hp-hpux*"] } { + gdb_test "continue" \ + "Continuing.*.*.*Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.*\[0-9\]*\[ \]*if \\(value > 1\\) \{.*\[0-9\]*\[ \]*value \\*= factorial \\(value - 1\\);.*" \ + "contiune in infrun_breakpoint_command_test" + } else { + gdb_test "continue" \ + "Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.* \[0-9\]*\[ \]*if \\(value > 1\\) \{.* \[0-9\]*\[ \]*value \\*= factorial \\(value - 1\\);.* factorial \\(value=4\\) at.*\[0-9\]*\[ \]*if \\(value > 1\\) \{.* @@ -190,7 +200,9 @@ factorial \\(value=3\\) at .* #2 \[0-9a-fx\]* in factorial \\(value=5\\).* #3 \[0-9a-fx\]* in factorial \\(value=6\\).* #4 \[0-9a-fx\]* in main \\(.*\\).*" \ - "continue in infrun_breakpoint_command_test"; + "continue in infrun_breakpoint_command_test"; + } + gdb_stop_suppressing_tests; } @@ -200,6 +212,7 @@ proc breakpoint_command_test {} { return } + gdb_test "set args 6" "" "set args in breakpoint_command_test" if { ![runto factorial] } then { gdb_suppress_tests; } # Don't depend upon argument passing, since most simulators don't currently # support it. Bash value variable to be what we want. @@ -207,7 +220,7 @@ proc breakpoint_command_test {} { delete_breakpoints gdb_test "break factorial" "Breakpoint.*at.*" "break factorial #2" gdb_test "commands\nprintf \"Now the value is %d\\n\", value\nend" \ - "Type commands.*\nEnd with.*" "commands in breakpoint_command_test" + "End with.*" "commands in breakpoint_command_test" gdb_test "continue" "Breakpoint \[0-9\]*, factorial.*Now the value is 5" \ "continue in breakpoint_command_test" gdb_test "print value" " = 5" "print value in breakpoint_command_test" @@ -236,7 +249,84 @@ proc user_defined_command_test {} { gdb_test "show user mycommand" "while.*set.*if.*p/x.*else.*p/x.*end.*" "display user command in user_defined_command_test" } +proc watchpoint_command_test {} { + global noargs + global gdb_prompt + + if [target_info exists noargs] { + verbose "Skipping watchpoint_command_test because of noargs." + return + } + + gdb_test "set args 6" "" "set args in watchpoint_command_test" + if { ![runto factorial] } then { return } + delete_breakpoints + + # Verify that we can create a watchpoint, and give it a commands + # list that continues the inferior. We set the watchpoint on a + # local variable, too, so that it self-deletes when the watched + # data goes out of scope. + # + # What should happen is: Each time the watchpoint triggers, it + # continues the inferior. Eventually, the watchpoint will self- + # delete, when the watched variable is out of scope. But by that + # time, the inferior should have exited. GDB shouldn't crash or + # anything untoward as a result of this. + # + set wp_id -1 + + send_gdb "watch local_var\n" + gdb_expect { + -re ".*\[Ww\]atchpoint (\[0-9\]*): local_var.*$gdb_prompt $" { + set wp_id $expect_out(1,string) + pass "watch local_var" + } + -re "$gdb_prompt $"\ + {fail "watch local_var"} + timeout {fail "(timeout) watch local_var"} + } + if {$wp_id == -1} {return} + + send_gdb "commands $wp_id\n" + gdb_expect { + -re "Type commands for when breakpoint $wp_id is hit, one per line.*>"\ + {pass "begin commands on watch"} + -re "$gdb_prompt $"\ + {fail "begin commands on watch"} + timeout {fail "(timeout) begin commands on watch"} + } + send_gdb "print value\n" + gdb_expect { + -re ">"\ + {pass "add print command to watch"} + -re "$gdb_prompt $"\ + {fail "add print command to watch"} + timeout {fail "(timeout) add print command to watch"} + } + send_gdb "continue\n" + gdb_expect { + -re ">"\ + {pass "add continue command to watch"} + -re "$gdb_prompt $"\ + {fail "add continue command to watch"} + timeout {fail "(timeout) add continue command to watch"} + } + send_gdb "end\n" + gdb_expect { + -re "$gdb_prompt $"\ + {pass "begin commands on watch"} + timeout {fail "(timeout) begin commands on watch"} + } + send_gdb "continue\n" + gdb_expect { + -re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*run.c:57.*"\ + {pass "continue with watch"} + -re "$gdb_prompt $"\ + {fail "continue with watch"} + timeout {fail "(timeout) continue with watch"} + } +} proc test_command_prompt_position {} { global gdb_prompt @@ -295,6 +385,7 @@ if_while_breakpoint_command_test infrun_breakpoint_command_test breakpoint_command_test user_defined_command_test +watchpoint_command_test test_command_prompt_position diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index b4d97f0bc5..327f37dc1c 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -52,9 +52,10 @@ if $tracelevel then { } -#skip all these tests for now (FIXME) - -continue +if { ![istarget "hppa*-hp-hpux*"] } { + #skip all these tests for now (FIXME) + continue +} global usestubs @@ -71,6 +72,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +if [get_compiler_info ${binfile}] { + return -1; +} + gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir @@ -81,7 +86,7 @@ if ![runto_main] then { } set oldtimeout1 $timeout -set timeout [expr $timeout + 500] +set timeout 30 send_gdb "hfgfh\t" @@ -162,31 +167,33 @@ sleep 1 gdb_expect { -re "^p\\\x07$"\ { send_gdb "\n" + sleep 1 gdb_expect { -re "The history is empty\\..*$gdb_prompt $"\ { pass "complete 'p'"} -re ".*$gdb_prompt $" { fail "complete 'p'"} - timeout {fail "(timeout) complete 'p'"} + timeout {fail "(timeout) complete 'p' 2"} } } -re ".*$gdb_prompt $" { fail "complete 'p'" } - timeout { fail "(timeout) complete 'p'" } + timeout { fail "(timeout) complete 'p' 1" } } send_gdb "p \t" -sleep 1 +sleep 3 gdb_expect { -re "^p \\\x07$"\ { send_gdb "\n" + sleep 1 gdb_expect { -re "The history is empty\\..*$gdb_prompt $"\ { pass "complete 'p '"} -re ".*$gdb_prompt $" { fail "complete 'p '"} - timeout {fail "(timeout) complete 'p '"} + timeout {fail "(timeout) complete 'p ' 1"} } } -re ".*$gdb_prompt $" { fail "complete 'p '" } - timeout { fail "(timeout) complete 'p '" } + timeout { fail "(timeout) complete 'p ' 2" } } @@ -283,7 +290,7 @@ gdb_expect { -re "^info $"\ { send_gdb "\n" gdb_expect { - -re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\ninfo address.*info watchpoints.*\r\n\r\nType \"help info\" followed by info subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\ + -re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\n.*info address.*info watchpoints.*\r\n\r\nType \"help info\" followed by info subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\ { pass "complete 'info'"} -re ".*$gdb_prompt $" { fail "complete 'info'"} timeout {fail "(timeout) complete 'info'"} @@ -299,7 +306,7 @@ gdb_expect { -re "^info \\\x07$"\ { send_gdb "\n" gdb_expect { - -re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\ninfo address.*Type \"help info\" followed by info subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\ + -re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\n.*info address.*Type \"help info\" followed by info subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\ { pass "complete 'info '"} -re ".*$gdb_prompt $" { fail "complete 'info '"} timeout {fail "(timeout) complete 'info '"} @@ -313,7 +320,7 @@ gdb_expect { send_gdb "info \t" sleep 1 gdb_expect { - -re "^info \0x7$"\ + -re "^info \\\x07$"\ { send_gdb "\t" gdb_expect { -re "address.*types.*$gdb_prompt info $"\ @@ -368,26 +375,46 @@ gdb_expect { send_gdb "p 'a\t" sleep 1 -gdb_expect { - -re "^p 'a\\\x07$"\ - { send_gdb "\t" - gdb_expect { - -re "a64l.*atol.*$gdb_prompt p .a$"\ - { send_gdb "\n" - gdb_expect { - -re "Invalid character constant\\..*$gdb_prompt $"\ - { pass "complete (2) 'p \'a'"} - -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'"} - timeout {fail "(timeout) complete (2) 'p \'a'"} - } - } - -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'"} - timeout {fail "(timeout) complete (2) 'p \'a'"} - } - } - -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" } - timeout { fail "(timeout) complete (2) 'p \'a'" } - } +gdb_expect { + -re "^p 'a\\\x07$" { + send_gdb "\t" + gdb_expect { + -re "a64l.*atol.*$gdb_prompt p .a$" { + send_gdb "\n" + gdb_expect { + -re "Invalid character constant\\..*$gdb_prompt $" { + pass "complete (2) 'p \'a'" + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" } + timeout { fail "(timeout) complete (2) 'p \'a'" } + } + } + -re "(There are $decimal possibilities\\. Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" { + send_gdb "n" + gdb_expect { + -re "\\(gdb\\) p 'a$" { + send_gdb "\n" + gdb_expect { + -re "Invalid character constant\\..*$gdb_prompt $" { + pass "complete (2) 'p \'a'" + } + -re ".*$gdb_prompt $" { + fail "complete (2) 'p \'a'" + } + timeout { fail "(timeout) complete (2) 'p \'a'" } + } + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" } + timeout { fail "(timeout) complete (2) 'p \'a'" } + } + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" } + timeout { fail "(timeout) complete (2) 'p \'a'" } + } + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" } + timeout { fail "(timeout) complete (2) 'p \'a'" } +} send_gdb "p b-a\t" @@ -408,57 +435,79 @@ gdb_expect { send_gdb "p b-a\t" sleep 1 -gdb_expect { - -re "^p b-a\\\x07$"\ - { send_gdb "\t" - gdb_expect { - -re "a64l.*atol.*$gdb_prompt p b-a$"\ - { send_gdb "\n" - gdb_expect { - -re "No symbol \"b\" in current context\\..*$gdb_prompt $"\ - { pass "complete (2) 'p b-a'"} - -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'"} - timeout {fail "(timeout) complete (2) 'p b-a'"} - } - } - -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'"} - timeout {fail "(timeout) complete (2) 'p b-a'"} - } - } - -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" } - timeout { fail "(timeout) complete (2) 'p b-a'" } +gdb_expect { + -re "^p b-a\\\x07$" { + send_gdb "\t" + gdb_expect { + -re "a64l.*atol.*$gdb_prompt p b-a$" { + send_gdb "\n" + gdb_expect { + -re "No symbol \"b\" in current context\\..*$gdb_prompt $" { + pass "complete (2) 'p b-a'" + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" } + timeout { fail "(timeout) complete (2) 'p b-a'" } + } + } + -re "(There are $decimal possibilities\\. Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" { + send_gdb "n" + gdb_expect { + -re "\\(gdb\\) p b-a$" { + send_gdb "\n" + gdb_expect { + -re "No symbol \"b\" in current context\\..*$gdb_prompt $" { + pass "complete (2) 'p b-a'" + } + -re ".*$gdb_prompt $" { + fail "complete (2) 'p b-a'" + } + timeout { fail "(timeout) complete (2) 'p b-a'" } + } + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" } + timeout { fail "(timeout) complete (2) 'p b-a'" } + } + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" } + timeout { fail "(timeout) complete (2) 'p b-a'" } } - + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" } + timeout { fail "(timeout) complete (2) 'p b-a'" } +} send_gdb "p b-\t" sleep 1 gdb_expect { - -re "^p b-\\\x07$"\ - { send_gdb "\t" - gdb_expect { - -re "There are $decimal possibilities\\. Do you really\r\nwish to see them all. \\(y or n\\)$"\ - { send_gdb "n" - gdb_expect { - -re "\\(gdb\\) p b-$"\ - { send_gdb "\n" - gdb_expect { - -re "No symbol \"b\" in current context\\..*$gdb_prompt $"\ - { pass "complete (2) 'p b-'"} - -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'"} - timeout {fail "(timeout) complete (2) 'p b-'"} - } - } - -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'"} - timeout {fail "(timeout) complete (2) 'p b-'"} - } - } - -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'"} - timeout {fail "(timeout) complete (2) 'p b-'"} - } - } - -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'" } - timeout { fail "(timeout) complete (2) 'p b-'" } - } + -re "^p b-\\\x07$" { + send_gdb "\t" + gdb_expect { + -re "(There are $decimal possibilities\\. Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" { + send_gdb "n" + gdb_expect { + -re "\\(gdb\\) p b-$" { + send_gdb "\n" + gdb_expect { + -re "No symbol \"b\" in current context\\..*$gdb_prompt $" { + pass "complete (2) 'p b-'" + } + -re ".*$gdb_prompt $" { + fail "complete (2) 'p b-'" + } + timeout { fail "(timeout) complete (2) 'p b-'" } + } + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'" } + timeout { fail "(timeout) complete (2) 'p b-'" } + } + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'" } + timeout { fail "(timeout) complete (2) 'p b-'" } + } + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'" } + timeout { fail "(timeout) complete (2) 'p b-'" } +} send_gdb "file ${objdir}/Make\t" sleep 1 @@ -487,7 +536,7 @@ gdb_expect { send_gdb "file ${srcdir}/gdb.base/a1\t" sleep 1 gdb_expect { - -re "^file ${srcdir}/gdb.base/.*'a1.*-selftest\\.exp' $"\ + -re "^file ${srcdir}/gdb.base/.*'a1.*-self\\.exp' $"\ { send_gdb "\n" gdb_expect { -re "\r\nA program is being debugged already\\. Kill it\\? \\(y or n\\) $" @@ -513,13 +562,14 @@ send_gdb "info func mark\t" sleep 1 gdb_expect { -re "^info func mark.*er$"\ - { send_gdb "\t\t" + { + send_gdb "\t\t" sleep 3 gdb_expect { - -re "marker1 marker2 marker3 marker4.*$gdb_prompt info func marker$"\ + -re "marker1.*$gdb_prompt info func marker$"\ { send_gdb "\n" gdb_expect { - -re "All functions matching regular expression \"marker\":\r\n\r\nFile.*break.c:\r\nint marker1\\(\\);\r\nint marker2\\(int\\).*marker3\\(char.*char.*\\);\r\n$gdb_prompt $"\ + -re "All functions matching regular expression \"marker\":\r\n\r\nFile.*break.c:\r\nint marker1\\(.*\\);\r\nint marker2\\(int\\).*marker3\\(char.*char.*\\).*marker4\\(long\\);\r\n$gdb_prompt $"\ { pass "complete 'info func mar'"} -re ".*$gdb_prompt $" { fail "complete 'info func mar'"} timeout {fail "(timeout) complete 'info func mar'"} @@ -540,6 +590,8 @@ gdb_expect { -re "ask.*child.*parent.*$gdb_prompt set follow-fork-mode $"\ { send_gdb "\n" gdb_expect { + -re "Requires an argument.*parent.*child.*ask.*$gdb_prompt $"\ + { pass "complete 'set follow-fork-mode'"} -re "Ambiguous item \"\"\\..*$gdb_prompt $"\ { pass "complete 'set follow-fork-mode'"} -re ".*$gdb_prompt $" { fail "complete 'set follow-fork-mode'"} diff --git a/gdb/testsuite/gdb.base/condbreak.c b/gdb/testsuite/gdb.base/condbreak.c index 491d6e5dd5..6acbf9b416 100644 --- a/gdb/testsuite/gdb.base/condbreak.c +++ b/gdb/testsuite/gdb.base/condbreak.c @@ -29,6 +29,7 @@ char *arg; #else /* ! vxworks */ # include +# include #endif /* ! vxworks */ /* @@ -38,20 +39,34 @@ char *arg; * of gcc have or have had problems with this). */ +#ifdef PROTOTYPES +int marker1 (void) { return (0); } +int marker2 (int a) { return (1); } +void marker3 (char *a, char *b) {} +void marker4 (long d) {} +#else int marker1 () { return (0); } int marker2 (a) int a; { return (1); } void marker3 (a, b) char *a, *b; {} void marker4 (d) long d; {} +#endif /* * This simple classical example of recursion is useful for * testing stack backtraces and such. */ +#ifdef PROTOTYPES +int factorial(int); + +int +main (int argc, char **argv, char **envp) +#else int main (argc, argv, envp) int argc; char *argv[], **envp; +#endif { #ifdef usestubs set_debug_traps(); @@ -70,8 +85,12 @@ char *argv[], **envp; return 0; } +#ifdef PROTOTYPES +int factorial (int value) +#else int factorial (value) int value; +#endif { if (value > 1) { value *= factorial (value - 1); diff --git a/gdb/testsuite/gdb.base/condbreak.exp b/gdb/testsuite/gdb.base/condbreak.exp index 281616b68a..8f8f11c9cf 100644 --- a/gdb/testsuite/gdb.base/condbreak.exp +++ b/gdb/testsuite/gdb.base/condbreak.exp @@ -43,6 +43,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +if [get_compiler_info ${binfile}] { + return -1; +} + gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir @@ -74,8 +78,8 @@ gdb_test "delete 2" \ # # test conditional break at line number # -gdb_test "break 64 if 1==1" \ - "Breakpoint.*at.* file .*$srcfile, line 64\\." \ +gdb_test "break 79 if 1==1" \ + "Breakpoint.*at.* file .*$srcfile, line 79\\." \ "break line if condition" gdb_test "delete 3" \ @@ -92,8 +96,8 @@ gdb_test "break marker1 if (1==1)" \ # # test conditional break at line number # -gdb_test "break 64 if (1==1)" \ - "Breakpoint.*at.* file .*$srcfile, line 64\\." \ +gdb_test "break 79 if (1==1)" \ + "Breakpoint.*at.* file .*$srcfile, line 79\\." \ "break line if (condition)" gdb_test "break marker2 if (a==43)" \ @@ -104,15 +108,23 @@ gdb_test "break marker2 if (a==43)" \ # check to see what breakpoints are set # -set main_line 60 +if {$hp_aCC_compiler} { + set marker1_proto "\\(void\\)" + set marker2_proto "\\(int\\)" +} else { + set marker1_proto "" + set marker2_proto "" +} + +set main_line 75 gdb_test "info break" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.* -\[0-9\]+\[\t \]+breakpoint keep y.* in marker1 at .*$srcfile:41.* +\[0-9\]+\[\t \]+breakpoint keep y.* in marker1$marker1_proto at .*$srcfile:4\[38\].* \[\t \]+stop only if 1 == 1.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:64.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* \[\t \]+stop only if 1 == 1.* -\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile:42.* +\[0-9\]+\[\t \]+breakpoint keep y.* in marker2$marker2_proto at .*$srcfile:4\[49\].* \[\t \]+stop only if a == 43.*" \ "breakpoint info" @@ -127,19 +139,21 @@ rerun_to_main # # run until the breakpoint at a line number # -gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:64.*64\[\t \]+printf.*factorial.*" \ +gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:79.*79\[\t \]+printf.*factorial.*" \ "run until breakpoint set at a line number" # # run until the breakpoint at marker1 # -gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile:41.*41\[\t \]+.*" \ +gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile:4\[38\].*4\[38\]\[\t \]+.*" \ "run until breakpoint at marker1" # # run until the breakpoint at marker2 # -gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile:42.*42\[\t \]+.*" \ +#See 11512CLLbs +setup_xfail hppa2.0w-*-* +gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile:4\[49\].*4\[49\]\[\t \]+.*" \ "run until breakpoint at marker2" diff --git a/gdb/testsuite/gdb.base/constvars.exp b/gdb/testsuite/gdb.base/constvars.exp index 518e5ca9b0..312b524a3b 100644 --- a/gdb/testsuite/gdb.base/constvars.exp +++ b/gdb/testsuite/gdb.base/constvars.exp @@ -41,8 +41,14 @@ set testfile "constvars" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +if [istarget "hppa*-*-*"] { + set lang "c++" +} else { + set lang "" +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [concat debug $lang]] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } # Create and source the file that provides information about the compiler @@ -94,7 +100,7 @@ send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" if {$gcc_compiled} then { setup_xfail "*-*-*" } send_gdb "ptype qux1\n" gdb_expect { - -re "type = int \\(const char, const char &, const char *, char * const\\).*$gdb_prompt $" { + -re "type = int \\(const char, const char, const char \\*, char \\* const\\).*$gdb_prompt $" { pass "ptype qux1" } -re ".*$gdb_prompt $" { fail "ptype qux1" } @@ -150,102 +156,100 @@ proc do_constvar_tests {} { gdb_test "ptype languid" "type = const double" gdb_test "print *legend" " = 66 'B'" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype legend" "type = const char *" + gdb_test "ptype legend" "type = const char \\*" gdb_test "print *legerdemain" " = 10 '\\\\n'" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype legerdemain" "type = const unsigned char *" + gdb_test "ptype legerdemain" "type = const unsigned char \\*" gdb_test "print *leniency" " = 20" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype leniency" "type = const short *" + gdb_test "ptype leniency" "type = const short \\*" gdb_test "print *leonine" " = 30" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype leonine" "type = const unsigned short *" + gdb_test "ptype leonine" "type = const unsigned short \\*" gdb_test "print *lesion" " = 40" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lesion" "type = const long *" + gdb_test "ptype lesion" "type = const long \\*" gdb_test "print *lethal" " = 50" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lethal" "type = const unsigned long *" + gdb_test "ptype lethal" "type = const unsigned long \\*" gdb_test "print *lethargic" " = 60" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lethargic" "type = const float *" + gdb_test "ptype lethargic" "type = const float \\*" gdb_test "print *levity" " = 70" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype levity" "type = const double *" + gdb_test "ptype levity" "type = const double \\*" gdb_test "print *lewd" " = 65 'A'" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lewd" "type = const char * const" + gdb_test "ptype lewd" "type = const char \\* const" gdb_test "print *lexicographer" " = 1 '.001'" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lexicographer" "type = const unsigned char * const" + gdb_test "ptype lexicographer" "type = const unsigned char \\* const" gdb_test "print *lexicon" " = 2" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lexicon" "type = const short * const" + gdb_test "ptype lexicon" "type = const short \\* const" gdb_test "print *liaison" " = 3" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype liaison" "type = const unsigned short * const" + gdb_test "ptype liaison" "type = const unsigned short \\* const" gdb_test "print *libation" " = 4" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype libation" "type = const long * const" + gdb_test "ptype libation" "type = const long \\* const" gdb_test "print *libelous" " = 5" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype libelous" "type = const unsigned long * const" + gdb_test "ptype libelous" "type = const unsigned long \\* const" gdb_test "print *libertine" " = 6" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype libertine" "type = const float * const" + gdb_test "ptype libertine" "type = const float \\* const" gdb_test "print *libidinous" " = 7" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype libidinous" "type = const double * const" + gdb_test "ptype libidinous" "type = const double \\* const" gdb_test "print *languish" " = 65 'A'" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype languish" "type = const char *" + gdb_test "ptype languish" "type = const char \\*" gdb_test "print *languor" " = 1 '.001'" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype languor" "type = const unsigned char *" + gdb_test "ptype languor" "type = const unsigned char \\*" gdb_test "print *lank" " = 2" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lank" "type = const short *" + gdb_test "ptype lank" "type = const short \\*" gdb_test "print *lapidary" " = 3" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lapidary" "type = const unsigned short *" + gdb_test "ptype lapidary" "type = const unsigned short \\*" gdb_test "print *larceny" " = 4" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype larceny" "type = const long *" + gdb_test "ptype larceny" "type = const long \\*" gdb_test "print *largess" " = 5" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype largess" "type = const unsigned long *" + gdb_test "ptype largess" "type = const unsigned long \\*" gdb_test "print *lascivious" " = 6" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lascivious" "type = const float *" + gdb_test "ptype lascivious" "type = const float \\*" gdb_test "print *lassitude" " = 7" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lassitude" "type = const double *" + gdb_test "ptype lassitude" "type = const double \\*" gdb_test "print *lamprey" " = 66 'B'" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lamprey" "type = char * const" + gdb_test "ptype lamprey" "type = char \\* const" gdb_test "print *lariat" " = 10 '\\\\n'" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lariat" "type = unsigned char * const" + gdb_test "ptype lariat" "type = unsigned char \\* const" gdb_test "print *laudanum" " = 20" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype laudanum" "type = short * const" + gdb_test "ptype laudanum" "type = short \\* const" gdb_test "print *lecithin" " = 30" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lecithin" "type = unsigned short * const" + gdb_test "ptype lecithin" "type = unsigned short \\* const" gdb_test "print *leviathan" " = 40" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype leviathan" "type = long * const" + gdb_test "ptype leviathan" "type = long \\* const" gdb_test "print *libretto" " = 50" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype libretto" "type = unsigned long * const" + gdb_test "ptype libretto" "type = unsigned long \\* const" gdb_test "print *lissome" " = 60" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lissome" "type = float * const" + gdb_test "ptype lissome" "type = float \\* const" gdb_test "print *locust" " = 70" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype locust" "type = double * const" - if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype radiation" "type = const char &" + gdb_test "ptype locust" "type = double \\* const" } do_constvar_tests diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp index 83b78c4be9..b2677306dd 100644 --- a/gdb/testsuite/gdb.base/corefile.exp +++ b/gdb/testsuite/gdb.base/corefile.exp @@ -183,13 +183,13 @@ gdb_test "print coremaker_data" "\\\$$decimal = 202" gdb_test "print coremaker_bss" "\\\$$decimal = 10" gdb_test "print coremaker_ro" "\\\$$decimal = 201" -if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print func2::coremaker_local" "\\\$$decimal = {0, 1, 2, 3, 4}" # Somehow we better test the ability to read the registers out of the core # file correctly. I don't think the other tests do this. gdb_test "bt" "abort.*func2.*func1.*main.*" "backtrace in corefile.exp" +gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\).*" "up in corefile.exp" # Test ability to read mmap'd data @@ -217,7 +217,8 @@ gdb_expect { # test reinit_frame_cache gdb_load ${binfile} +# HP defect CLLbs17002 setup_xfail "*-*-*" -gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\)" "up in corefile.exp" +gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\)" "up in corefile.exp (reinit)" gdb_test "core" "No core file now." diff --git a/gdb/testsuite/gdb.base/coremaker.c b/gdb/testsuite/gdb.base/coremaker.c index 56239e9286..4bb16d46aa 100644 --- a/gdb/testsuite/gdb.base/coremaker.c +++ b/gdb/testsuite/gdb.base/coremaker.c @@ -6,6 +6,8 @@ #include #include #include +#include +#include #ifndef __STDC__ #define const /**/ @@ -33,7 +35,6 @@ void mmapdata () { int j, fd; - extern void *malloc (); /* Allocate and initialize a buffer that will be used to write the file that is later mapped in. */ @@ -112,9 +113,10 @@ func1 () func2 (); } -main () +int main () { mmapdata (); func1 (); + return 0; } diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index 2a342aa5ab..528d5a99f5 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -67,6 +67,11 @@ if ![target_info exists use_gdb_stub] { setup_xfail "mips-idt-*" "a29k-*-udi" gdb_test "backtrace" "No stack." + + # ba and bac are no longer unique command prefixes. So these tests + # elict an error from GDB. + # GDB needs to be fixed to map unique alias here for ba bac. + # foreach i "bt ba bac" { setup_xfail "mips-idt-*" "a29k-*-udi" gdb_test $i "No stack." "backtrace \"$i\" abbreviation" @@ -335,6 +340,7 @@ gdb_test "info types" "All defined types:" "info types" #test info variables gdb_test "info variables" "All defined variables:" "info variables" #test info warranty +setup_xfail "hppa*-hp-hpux*" gdb_test "info warranty" "NO WARRANTY.*\[\r\n\]+ *11. *BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY.*\[\r\n\]+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN.*\[\r\n\]+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES.*\[\r\n\]+PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED.*\[\r\n\]+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF.*\[\r\n\]+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS.*\[\r\n\]+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE.*\[\r\n\]+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,.*\[\r\n\]+REPAIR OR CORRECTION..*\[\r\n\]+ *12. *IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING.*\[\r\n\]+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR.*\[\r\n\]+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,.*\[\r\n\]+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING.*\[\r\n\]+OUT OF THE USE OR INABILITY TO USE THE PROGRAM .INCLUDING BUT NOT LIMITED.*\[\r\n\]+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY.*\[\r\n\]+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER.*\[\r\n\]+PROGRAMS., EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE.*\[\r\n\]+POSSIBILITY OF SUCH DAMAGES.*" "info warranty" #test info watchpoints gdb_test "info watchpoints" "No breakpoints or watchpoints." "info watchpoints" @@ -646,7 +652,7 @@ gdb_test "show values" "" "show values" #test show verbose gdb_test "show verbose" "Verbose printing of informational messages is o.*|Verbosity is off.*" "show verbose" #test show version - +setup_xfail "hppa*-hp-hpux*" gdb_test "show version" "GNU gdb \[0-9\.\]*.*\[\r\n\]+Copyright \[0-9\]* Free Software Foundation, Inc.*\[\r\n\]+GDB is free software, covered by the GNU General Public License, and you are.*\[\r\n\]+welcome to change it and/or distribute copies of it under certain conditions.*\[\r\n\]+Type \"show copying\" to see the conditions.*\[\r\n\]+There is absolutely no warranty for GDB. Type \"show warranty\" for details.*\[\r\n\]+This GDB was configured as .*|GDB is free software and you are welcome to distribute copies of it.*\[\r\n\]+ under certain conditions; type \"show copying\" to see the conditions..*\[\r\n\]+There is absolutely no warranty for GDB; type \"show warranty\" for details..*\[\r\n\]+GDB.*Copyright \[0-9\]* Free Software Foundation, Inc.*" "show version" #test show width gdb_test "show width" "Number of characters gdb thinks are in a line is.*" "show width" @@ -719,8 +725,7 @@ gdb_expect { if ![istarget "*-*-udi*"] then { send_gdb "target remote\n" gdb_expect { - -re "To open a remote debug connection, you need to specify what.* -serial device is attached to the remote system .e.g. /dev/ttya.*$gdb_prompt $"\ + -re "To open a remote debug connection, you need to specify what.*serial.*device is attached to the remote system .e.g. /dev/ttya.*$gdb_prompt $"\ { pass "target remote" } -re ".*A program is being debugged already. Kill it. .y or n.*$" { send_gdb "n\n" @@ -792,6 +797,16 @@ setup_xfail "a29k-*-udi" gdb_test "where" "No stack." "where" #test x #The case in which it prints a number is for vxgdb. -gdb_test "x" "0x0:.*0x\[0-9\]*|0x0:.*Cannot access memory at address 0x0." "x" +send_gdb "x\n" +gdb_expect { + -re "0x0:.*Cannot access memory at address 0x0..*$gdb_prompt $" { + pass "x" + } + -re "0x0:.*Error accessing memory address 0x0:.*$gdb_prompt $" { + pass "x" + } + -re ".*$gdb_prompt $" { fail "x" } + timeout { fail "(timeout) x" } +} gdb_exit diff --git a/gdb/testsuite/gdb.base/define.exp b/gdb/testsuite/gdb.base/define.exp index 1cd06a9271..d4423da22a 100644 --- a/gdb/testsuite/gdb.base/define.exp +++ b/gdb/testsuite/gdb.base/define.exp @@ -68,7 +68,7 @@ gdb_expect { # send_gdb "nextwhere\n" gdb_expect { - -re ".*64\[ \t\]*printf.*#0\[ \t\]*main.*:64.*$gdb_prompt $"\ + -re ".*79\[ \t\]*printf.*#0\[ \t\]*main.*:79.*$gdb_prompt $"\ {pass "use user command: nextwhere"} -re "$gdb_prompt $"\ {fail "use user command: nextwhere"} @@ -224,7 +224,7 @@ gdb_expect { send_gdb "next\n" gdb_expect { - -re "#0\[ \t\]*main.*:66.*$gdb_prompt $"\ + -re "#0\[ \t\]*main.*:81.*$gdb_prompt $"\ {pass "use hook-stop command"} -re "$gdb_prompt $"\ {fail "use hook-stop command"} diff --git a/gdb/testsuite/gdb.base/display.exp b/gdb/testsuite/gdb.base/display.exp index 638072c2ba..59ac18d210 100644 --- a/gdb/testsuite/gdb.base/display.exp +++ b/gdb/testsuite/gdb.base/display.exp @@ -46,6 +46,15 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} +# Some coverage stuff +# +gdb_test "kill" ".*The program is not being run.*" "" +gdb_test "detach" ".*" "" +gdb_test "run" ".*" "" + +gdb_load ${binfile} +gdb_test "kill" ".*" "" +gdb_test "detach" ".*" "" # Ok, on to real life # @@ -132,8 +141,14 @@ gdb_test "printf \"%d\" j" ".*Invalid argument syntax.*" "" # play with "p", too # gdb_test "p/r j" ".*Undefined output format.*" "" +gdb_test "p j" ".*" "debug test output" #gdb_test "x/rx j" ".*Cannot access memory.*" "no error!" -gdb_test "x/0 j" ".*" "x/0 j" +# x/0 j doesn't produce any output and terminates PA64 process when testing +if [istarget "hppa*-hp-hpux11*"] { + xfail "'x/0 j' terminate PA64 process - skipped test point" +} else { + gdb_test "x/0 j" ".*" "x/0 j" +} gdb_test "p/0 j" ".*Item count other than 1 is meaningless.*" "p/0 j" gdb_test "p/s sum" ".*Format letter.*is meaningless.*" " no s" gdb_test "p/i sum" ".*Format letter.*is meaningless.*.*" "no i" diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp index f5656d849a..f7be9868e8 100644 --- a/gdb/testsuite/gdb.base/ena-dis-br.exp +++ b/gdb/testsuite/gdb.base/ena-dis-br.exp @@ -74,7 +74,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } # send_gdb "break marker1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 41.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\ {pass "break marker1"} -re "$gdb_prompt $"\ {fail "break marker1"} @@ -118,7 +118,7 @@ gdb_expect { # send_gdb "break marker2\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 42.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line 4\[49\].*$gdb_prompt $"\ {pass "break marker2"} -re "$gdb_prompt $"\ {fail "break marker2"} @@ -172,7 +172,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } send_gdb "break marker3\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 43.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line (45|50).*$gdb_prompt $"\ {pass "break marker3"} -re "$gdb_prompt $"\ {fail "break marker3"} @@ -197,7 +197,7 @@ gdb_expect { send_gdb "continue\n" gdb_expect { - -re ".*marker3 .*:43.*$gdb_prompt $"\ + -re ".*marker3 .*:(45|50).*$gdb_prompt $"\ {pass "continue to auto-deleted break marker3"} -re "Breakpoint \[0-9\]*, marker3.*$gdb_prompt $"\ {fail "continue to auto-deleted break marker3"} @@ -222,7 +222,7 @@ gdb_expect { # send_gdb "break marker4\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 44.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line (46|51).*$gdb_prompt $"\ {pass "break marker4"} -re "$gdb_prompt $"\ {fail "break marker4"} @@ -253,7 +253,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } send_gdb "break marker1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 41.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\ {pass "break marker1"} -re "$gdb_prompt $"\ {fail "break marker1"} @@ -340,7 +340,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } send_gdb "break marker1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 41.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\ {pass "break marker1"} -re "$gdb_prompt $"\ {fail "break marker1"} @@ -377,7 +377,7 @@ rerun_to_main send_gdb "continue\n" gdb_expect { - -re ".*marker1 .*:41.*$gdb_prompt $"\ + -re ".*marker1 .*:4\[38\].*$gdb_prompt $"\ {pass "continue to ignored & auto-deleted break marker1"} -re "Breakpoint \[0-9\]*, marker1.*$gdb_prompt $"\ {fail "continue to ignored & auto-deleted break marker1"} @@ -393,7 +393,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } send_gdb "break marker1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 41.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\ {pass "break marker1"} -re "$gdb_prompt $"\ {fail "break marker1"} @@ -435,9 +435,9 @@ gdb_expect { # if ![runto_main] then { fail "enable/disable break tests suppressed" } -send_gdb "break 64\n" +send_gdb "break 79\n" gdb_expect { - -re "Breakpoint \[0-9\]*.*, line 64.*$gdb_prompt $"\ + -re "Breakpoint \[0-9\]*.*, line 79.*$gdb_prompt $"\ {pass "prepare to continue with ignore count"} -re "$gdb_prompt $"\ {fail "prepare to continue with ignore count"} @@ -454,7 +454,7 @@ gdb_expect { send_gdb "next\n" gdb_expect { - -re ".*66\[ \t\]*marker1.*$gdb_prompt $"\ + -re ".*81\[ \t\]*marker1.*$gdb_prompt $"\ {pass "step after continue with ignore count"} -re "$gdb_prompt $"\ {fail "step after continue with ignore count"} diff --git a/gdb/testsuite/gdb.base/ending-run.c b/gdb/testsuite/gdb.base/ending-run.c index 56335cf1cd..09361460d7 100644 --- a/gdb/testsuite/gdb.base/ending-run.c +++ b/gdb/testsuite/gdb.base/ending-run.c @@ -2,15 +2,20 @@ * bugs. */ #include +#include +#ifdef PROTOTYPES +int callee (int x) +#else int callee( x ) int x; +#endif { int y = x * x; return (y - 2); } -main() +int main() { int *p; @@ -24,4 +29,5 @@ main() } printf( " Goodbye!\n" ); + return 0; } diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp index 8f102fbb43..e36c975bfd 100644 --- a/gdb/testsuite/gdb.base/ending-run.exp +++ b/gdb/testsuite/gdb.base/ending-run.exp @@ -52,39 +52,39 @@ gdb_load ${binfile} # to the prolog--that's another bug...) # gdb_test "b 1" ".*Breakpoint.*line 1.*" "bpt at line before routine" -gdb_test "b 8" ".*Note.*also.*Breakpoint.*2.*" "" +gdb_test "b 13" ".*Note.*also.*Breakpoint.*2.*" "" # Set up to go to the next-to-last line of the program # -gdb_test "b 26" ".*Breakpoint.*3.*" "" +gdb_test "b 31" ".*Breakpoint.*3.*" "" # Expect to hit the bp at line "1", but symbolize this -# as line "8". Then try to clear it--this should work. +# as line "13". Then try to clear it--this should work. # if [target_info exists use_gdb_stub] { - gdb_test "continue" ".*Breakpoint.*1.*callee.*8.*" "" + gdb_test "continue" ".*Breakpoint.*1.*callee.*13.*" "" } else { - gdb_test "r" ".*Breakpoint.*1.*callee.*8.*" "" + gdb_test "r" ".*Breakpoint.*1.*callee.*13.*" "" } gdb_test "cle" ".*Deleted breakpoints 2 1.*" "clear worked" send_gdb "i b\n" gdb_expect { -re ".*breakpoint.*breakpoint.*$gdb_prompt $" { fail "clear bp" } - -re ".*3.*main.*26.*$gdb_prompt $" { pass "cleared bp at line before routine" } + -re ".*3.*main.*31.*$gdb_prompt $" { pass "cleared bp at line before routine" } -re ".*$gdb_prompt $" { fail "info b" } } # Test some other "clear" combinations # gdb_test "b 1" ".*Breakpoint.*4.*" "" -gdb_test "b 8" ".*Note.*also.*Breakpoint.*5.*" "" -gdb_test "cle 8" ".*Deleted breakpoint 5.*" "Only cleared 1 by line" +gdb_test "b 13" ".*Note.*also.*Breakpoint.*5.*" "" +gdb_test "cle 13" ".*Deleted breakpoint 5.*" "Only cleared 1 by line" -send_gdb "inf line 8\n" +send_gdb "inf line 13\n" gdb_expect { -re ".*address (0x\[0-9a-fA-F]*).*$gdb_prompt $" { set line_eight $expect_out(1,string) - gdb_test "b 8" ".*Breakpoint.*6.*" "" + gdb_test "b 13" ".*Breakpoint.*6.*" "" gdb_test "cle *$line_eight" ".*Deleted breakpoints 6 4.*" "Clear 2 by address" } -re ".*$gdb_prompt $" { @@ -92,13 +92,13 @@ gdb_expect { } } -send_gdb "inf line 9\n" +send_gdb "inf line 14\n" gdb_expect { -re ".*address (0x\[0-9a-fA-F]*).*$gdb_prompt $" { set line_nine $expect_out(1,string) - gdb_test "b 9" ".*Breakpoint.*7.*" "" + gdb_test "b 14" ".*Breakpoint.*7.*" "" gdb_test "b *$line_nine" ".*Note.*also.*Breakpoint.*8.*" "" - gdb_test "c" ".*Breakpoint.*7.*callee.*9.*" "" + gdb_test "c" ".*Breakpoint.*7.*callee.*14.*" "" gdb_test "cle" ".*Deleted breakpoints 8 7.*" "Clear 2 by default" } -re ".*$gdb_prompt $" { @@ -111,7 +111,7 @@ gdb_expect { -re ".*breakpoint.*breakpoint.*$gdb_prompt $" { fail "didn't clear bps" } - -re ".*3.*main.*26.*$gdb_prompt $" { + -re ".*3.*main.*31.*$gdb_prompt $" { pass "all set to continue" } -re ".*$gdb_prompt $" { @@ -123,14 +123,14 @@ gdb_expect { # See if we can step out with control. The "1 2 3" stuff # is output from the program. # -gdb_test "cont" ".*Breakpoint.*26.*" "" -gdb_test "next" ".*1 2 7 14 23 34 47 62 79 Goodbye!.*27.*" "Step to return" +gdb_test "cont" ".*Breakpoint.*32.*" "" +gdb_test "next" ".*1 2 7 14 23 34 47 62 79 Goodbye!.*32.*" "Step to return" set old_timeout $timeout set timeout 50 send_gdb "next\n" gdb_expect { - -re "27.*$gdb_prompt $" { + -re "33.*$gdb_prompt $" { # sometimes we stop at the closing brace, if so, do another next send_gdb "next\n" gdb_expect { @@ -141,6 +141,9 @@ gdb_expect { -re ".*in.*start.*$gdb_prompt $" { pass "step out of main" } + -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $" { + pass "step out of main" + } -re ".*$gdb_prompt $" { fail "step at end 2" } timeout { fail "hang or timeout on step at end 2" } } @@ -152,6 +155,9 @@ gdb_expect { -re ".*in.*start.*$gdb_prompt $" { pass "step out of main" } + -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $" { + pass "step out of main 2" + } -re ".*in.*currently asm.*$gdb_prompt $" { pass "step out of main into assembler" } @@ -163,7 +169,18 @@ gdb_expect { } if {![target_info exists use_cygmon] || ![target_info use_cygmon]} { - gdb_test "n" ".*Single.*Program exited.*" "step to end of run" + send_gdb "n\n" + gdb_expect { + -re ".*Single.*Program exited.*$gdb_prompt $" { + pass "step to end of run 1" + } + -re ".*Single.*in exit.*from.*dld.sl.*$gdb_prompt $" { + pass "step to end of run 2" + gdb_test "c" ".*" "continue after exit" + } + timeout { fail "(timeout) step to end of run" } + } + set timeout $old_timeout gdb_test "n" ".*The program is not being run.*" "don't step after run" diff --git a/gdb/testsuite/gdb.base/eval-skip.exp b/gdb/testsuite/gdb.base/eval-skip.exp index 4e17e61197..c82652fff3 100644 --- a/gdb/testsuite/gdb.base/eval-skip.exp +++ b/gdb/testsuite/gdb.base/eval-skip.exp @@ -48,8 +48,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } - - +if [get_compiler_info $binfile] { + return -1 +} gdb_exit gdb_start @@ -67,10 +68,9 @@ gdb_test "set variable y=2" "" "set variable y=2" gdb_test "set variable z=2" "" "set variable z=2" gdb_test "set variable w=3" "" "set variable w=3" - send_gdb "print (0 && (x+y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x+y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x+y))" } @@ -80,7 +80,7 @@ gdb_expect { send_gdb "print (0 && (x-y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x-y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x-y))" } @@ -90,7 +90,7 @@ gdb_expect { send_gdb "print (0 && (x*y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x*y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x*y))" } @@ -101,7 +101,7 @@ gdb_expect { send_gdb "print (0 && (x/y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x/y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x/y))" } @@ -111,7 +111,7 @@ gdb_expect { send_gdb "print (0 && (x%y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x%y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x%y))" } @@ -121,7 +121,7 @@ gdb_expect { send_gdb "print (0 && (x&&y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x&&y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x&&y))" } @@ -132,7 +132,7 @@ gdb_expect { send_gdb "print (0 && (x||y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x||y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x||y))" } @@ -143,7 +143,7 @@ gdb_expect { send_gdb "print (0 && (x&y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x&y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x&y))" } @@ -153,7 +153,7 @@ gdb_expect { send_gdb "print (0 && (x|y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x|y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x|y))" } @@ -163,7 +163,7 @@ gdb_expect { send_gdb "print (0 && (x^y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x^y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x^y))" } @@ -174,7 +174,7 @@ gdb_expect { send_gdb "print (0 && (x < y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x < y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x < y))" } @@ -184,7 +184,7 @@ gdb_expect { send_gdb "print (0 && (x <= y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x <= y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x <= y))" } @@ -195,7 +195,7 @@ gdb_expect { send_gdb "print (0 && (x>y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x>y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x>y))" } @@ -205,7 +205,7 @@ gdb_expect { send_gdb "print (0 && (x>=y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x>=y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x>=y))" } @@ -216,7 +216,7 @@ gdb_expect { send_gdb "print (0 && (x==y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x==y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x==y))" } @@ -226,7 +226,7 @@ gdb_expect { send_gdb "print (0 && (x!=y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x!=y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x!=y))" } @@ -236,7 +236,7 @@ gdb_expect { send_gdb "print (0 && (x<<31))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x<<31))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x<<31))" } @@ -246,7 +246,7 @@ gdb_expect { send_gdb "print (0 && (x>>31))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x>>31))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x>>31))" } @@ -257,7 +257,7 @@ gdb_expect { send_gdb "print (0 && (!x))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (!x))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (!x))" } @@ -267,7 +267,7 @@ gdb_expect { send_gdb "print (0 && (~x))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (~x))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (~x))" } @@ -276,7 +276,7 @@ gdb_expect { send_gdb "print (0 && (-x))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (-x))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (-x))" } @@ -286,7 +286,7 @@ gdb_expect { send_gdb "print (0 && (x++))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x++))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x++))" } @@ -296,7 +296,7 @@ gdb_expect { send_gdb "print (0 && (++x))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (++x))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (++x))" } @@ -306,7 +306,7 @@ gdb_expect { send_gdb "print (0 && (x--))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x--))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x--))" } @@ -316,7 +316,7 @@ gdb_expect { send_gdb "print (0 && (--x))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (--x))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (--x))" } @@ -325,7 +325,7 @@ gdb_expect { send_gdb "print (0 && (x+=7))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x+=7))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x+=7))" } @@ -334,7 +334,7 @@ gdb_expect { send_gdb "print (0 && (x=y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x=y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x=y))" } diff --git a/gdb/testsuite/gdb.base/exprs.c b/gdb/testsuite/gdb.base/exprs.c index e5c7351281..b35c3a58d2 100644 --- a/gdb/testsuite/gdb.base/exprs.c +++ b/gdb/testsuite/gdb.base/exprs.c @@ -1,7 +1,11 @@ +#ifdef PROTOTYPES +int main (int argc, char **argv, char **envp) +#else main (argc, argv, envp) int argc; char **argv; char **envp; +#endif { extern void dummy(); #ifdef usestubs @@ -9,6 +13,8 @@ main (argc, argv, envp) breakpoint(); #endif dummy(); + return 0; + } /* We put main() right up front so its line number doesn't keep changing. */ @@ -44,7 +50,6 @@ unsigned long v_unsigned_long; float v_float; double v_double; - /* * Now some derived types, which are arrays, functions-returning, * pointers, structures, unions, and enumerations. @@ -70,7 +75,6 @@ unsigned long v_unsigned_long_array[2]; float v_float_array[2]; double v_double_array[2]; - /**** pointers *******/ char *v_char_pointer; @@ -203,8 +207,6 @@ void dummy() v_float = 100.0; v_double = 200.0; - - v_char_array[0] = v_char; v_signed_char_array[0] = v_signed_char; v_unsigned_char_array[0] = v_unsigned_char; @@ -223,7 +225,6 @@ void dummy() v_float_array[0] = v_float; v_double_array[0] = v_double; - v_char_pointer = &v_char; v_signed_char_pointer = &v_signed_char; v_unsigned_char_pointer = &v_unsigned_char; diff --git a/gdb/testsuite/gdb.base/exprs.exp b/gdb/testsuite/gdb.base/exprs.exp index cdf33dc943..f31407c458 100644 --- a/gdb/testsuite/gdb.base/exprs.exp +++ b/gdb/testsuite/gdb.base/exprs.exp @@ -73,150 +73,145 @@ proc test_expr { args } { # # test expressions with "char" types # -test_expr "set variable v_char=127" "print v_char == 0" "\\$\[0-9\]* = 0" "print v_char == 127" "\\$\[0-9\]* = 1" "print char ==" -test_expr "set variable v_char=127" "print v_char != 0" "\\$\[0-9\]* = 1" "print v_char != 127" "\\$\[0-9\]* = 0" "print char !=" -test_expr "set variable v_char=127" "print v_char < 0" "\\$\[0-9\]* = 0" "print v_char < 127" "\\$\[0-9\]* = 0" "print char <" -test_expr "set variable v_char=127" "print v_char > 0" "\\$\[0-9\]* = 1" "print v_char > 127" "\\$\[0-9\]* = 0" "print char >" +test_expr "set variable v_char=127" "print v_char == 0" "\\$\[0-9\]* = $false" "print v_char == 127" "\\$\[0-9\]* = $true" "print char ==" +test_expr "set variable v_char=127" "print v_char != 0" "\\$\[0-9\]* = $true" "print v_char != 127" "\\$\[0-9\]* = $false" "print char !=" +test_expr "set variable v_char=127" "print v_char < 0" "\\$\[0-9\]* = $false" "print v_char < 127" "\\$\[0-9\]* = $false" "print char <" +test_expr "set variable v_char=127" "print v_char > 0" "\\$\[0-9\]* = $true" "print v_char > 127" "\\$\[0-9\]* = $false" "print char >" # # test expressions with "signed char" types # -test_expr "set variable v_signed_char=127" "print v_signed_char == 0" "\\$\[0-9\]* = 0" "print v_signed_char == 127" "\\$\[0-9\]* = 1" "print signed char ==" -test_expr "set variable v_signed_char=127" "print v_signed_char != 0" "\\$\[0-9\]* = 1" "print v_signed_char != 127" "\\$\[0-9\]* = 0" "print signed char !=" -test_expr "set variable v_signed_char=127" "print v_signed_char < 0" "\\$\[0-9\]* = 0" "print v_signed_char < 127" "\\$\[0-9\]* = 0" "print signed char <" -test_expr "set variable v_signed_char=127" "print v_signed_char > 0" "\\$\[0-9\]* = 1" "print v_signed_char > 127" "\\$\[0-9\]* = 0" "print signed char >" +test_expr "set variable v_signed_char=127" "print v_signed_char == 0" "\\$\[0-9\]* = $false" "print v_signed_char == 127" "\\$\[0-9\]* = $true" "print signed char ==" +test_expr "set variable v_signed_char=127" "print v_signed_char != 0" "\\$\[0-9\]* = $true" "print v_signed_char != 127" "\\$\[0-9\]* = $false" "print signed char !=" +test_expr "set variable v_signed_char=127" "print v_signed_char < 0" "\\$\[0-9\]* = $false" "print v_signed_char < 127" "\\$\[0-9\]* = $false" "print signed char <" +test_expr "set variable v_signed_char=127" "print v_signed_char > 0" "\\$\[0-9\]* = $true" "print v_signed_char > 127" "\\$\[0-9\]* = $false" "print signed char >" # make char a minus -test_expr "set variable v_signed_char=-1" "print v_signed_char == 0" "\\$\[0-9\]* = 0" "print v_signed_char == -1" "\\$\[0-9\]* = 1" "print signed char == (minus)" -test_expr "set variable v_signed_char=-1" "print v_signed_char != 0" "\\$\[0-9\]* = 1" "print v_signed_char != -1" "\\$\[0-9\]* = 0" "print signed char != (minus)" -test_expr "set variable v_signed_char=-1" "print v_signed_char < 0" "\\$\[0-9\]* = 1" "print v_signed_char < 127" "\\$\[0-9\]* = 1" "print signed char < (minus)" -test_expr "set variable v_signed_char=-1" "print v_signed_char > 0" "\\$\[0-9\]* = 0" "print v_signed_char > 127" "\\$\[0-9\]* = 0" "print signed char > (minus)" +test_expr "set variable v_signed_char=-1" "print v_signed_char == 0" "\\$\[0-9\]* = $false" "print v_signed_char == -1" "\\$\[0-9\]* = $true" "print signed char == (minus)" +test_expr "set variable v_signed_char=-1" "print v_signed_char != 0" "\\$\[0-9\]* = $true" "print v_signed_char != -1" "\\$\[0-9\]* = $false" "print signed char != (minus)" +test_expr "set variable v_signed_char=-1" "print v_signed_char < 0" "\\$\[0-9\]* = $true" "print v_signed_char < 127" "\\$\[0-9\]* = $true" "print signed char < (minus)" +test_expr "set variable v_signed_char=-1" "print v_signed_char > 0" "\\$\[0-9\]* = $false" "print v_signed_char > 127" "\\$\[0-9\]* = $false" "print signed char > (minus)" # # test expressions with "unsigned char" types # -test_expr "set variable v_unsigned_char=127" "print v_unsigned_char == 0" "\\$\[0-9\]* = 0" "print v_unsigned_char == 127" "\\$\[0-9\]* = 1" "print unsigned char ==" -test_expr "set variable v_unsigned_char=127" "print v_unsigned_char != 0" "\\$\[0-9\]* = 1" "print v_unsigned_char != 127" "\\$\[0-9\]* = 0" "print unsigned char !=" -test_expr "set variable v_unsigned_char=127" "print v_unsigned_char < 0" "\\$\[0-9\]* = 0" "print v_unsigned_char < 127" "\\$\[0-9\]* = 0" "print unsigned char <" -test_expr "set variable v_unsigned_char=127" "print v_unsigned_char > 0" "\\$\[0-9\]* = 1" "print v_unsigned_char > 127" "\\$\[0-9\]* = 0" "print unsigned char >" +test_expr "set variable v_unsigned_char=127" "print v_unsigned_char == 0" "\\$\[0-9\]* = $false" "print v_unsigned_char == 127" "\\$\[0-9\]* = $true" "print unsigned char ==" +test_expr "set variable v_unsigned_char=127" "print v_unsigned_char != 0" "\\$\[0-9\]* = $true" "print v_unsigned_char != 127" "\\$\[0-9\]* = $false" "print unsigned char !=" +test_expr "set variable v_unsigned_char=127" "print v_unsigned_char < 0" "\\$\[0-9\]* = $false" "print v_unsigned_char < 127" "\\$\[0-9\]* = $false" "print unsigned char <" +test_expr "set variable v_unsigned_char=127" "print v_unsigned_char > 0" "\\$\[0-9\]* = $true" "print v_unsigned_char > 127" "\\$\[0-9\]* = $false" "print unsigned char >" # make char a minus # FIXME: gdb mishandles the cast (unsigned char) on the i960, so I've # set up an expected failure for this case. setup_xfail "i960-*-*" 1821 -test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char == 0" "\\$\[0-9\]* = 0" "print v_unsigned_char == ~0" "\\$\[0-9\]* = 0" "print v_unsigned_char == (unsigned char)~0" "\\$\[0-9\]* = 1" "print unsigned char == (~0)" +test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char == 0" "\\$\[0-9\]* = $false" "print v_unsigned_char == ~0" "\\$\[0-9\]* = $false" "print v_unsigned_char == (unsigned char)~0" "\\$\[0-9\]* = $true" "print unsigned char == (~0)" # FIXME: gdb mishandles the cast (unsigned char) on the i960, so I've # set up an expected failure for this case. setup_xfail "i960-*-*" 1821 -test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char != 0" "\\$\[0-9\]* = 1" "print v_unsigned_char != (unsigned char)~0" "\\$\[0-9\]* = 0" "print unsigned char != (~0)" -test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char < 0" "\\$\[0-9\]* = 0" "print v_unsigned_char < 127" "\\$\[0-9\]* = 0" "print unsigned char < (~0)" -test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char > 0" "\\$\[0-9\]* = 1" "print v_unsigned_char > 127" "\\$\[0-9\]* = 1" "print unsigned char > (~0)" +test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char != 0" "\\$\[0-9\]* = $true" "print v_unsigned_char != (unsigned char)~0" "\\$\[0-9\]* = $false" "print unsigned char != (~0)" +test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char < 0" "\\$\[0-9\]* = $false" "print v_unsigned_char < 127" "\\$\[0-9\]* = $false" "print unsigned char < (~0)" +test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char > 0" "\\$\[0-9\]* = $true" "print v_unsigned_char > 127" "\\$\[0-9\]* = $true" "print unsigned char > (~0)" # # test expressions with "short" types # -test_expr "set variable v_short=0x7FFF" "print v_short == 0" "\\$\[0-9\]* = 0" "print v_short == 0x7FFF" "\\$\[0-9\]* = 1" "print signed short ==" -test_expr "set variable v_short=0x7FFF" "print v_short != 0" "\\$\[0-9\]* = 1" "print v_short != 0x7FFF" "\\$\[0-9\]* = 0" "print signed short !=" -test_expr "set variable v_short=0x7FFF" "print v_short < 0" "\\$\[0-9\]* = 0" "print v_short < 0x7FFF" "\\$\[0-9\]* = 0" "print signed short <" -test_expr "set variable v_short=0x7FFF" "print v_short > 0" "\\$\[0-9\]* = 1" "print v_short > 0x7FFF" "\\$\[0-9\]* = 0" "print signed short >" +test_expr "set variable v_short=0x7FFF" "print v_short == 0" "\\$\[0-9\]* = $false" "print v_short == 0x7FFF" "\\$\[0-9\]* = $true" "print signed short ==" +test_expr "set variable v_short=0x7FFF" "print v_short != 0" "\\$\[0-9\]* = $true" "print v_short != 0x7FFF" "\\$\[0-9\]* = $false" "print signed short !=" +test_expr "set variable v_short=0x7FFF" "print v_short < 0" "\\$\[0-9\]* = $false" "print v_short < 0x7FFF" "\\$\[0-9\]* = $false" "print signed short <" +test_expr "set variable v_short=0x7FFF" "print v_short > 0" "\\$\[0-9\]* = $true" "print v_short > 0x7FFF" "\\$\[0-9\]* = $false" "print signed short >" # make short a minus -test_expr "set variable v_short=-1" "print v_short == 0" "\\$\[0-9\]* = 0" "print v_short == -1" "\\$\[0-9\]* = 1" "print signed short == (minus)" -test_expr "set variable v_short=-1" "print v_short != 0" "\\$\[0-9\]* = 1" "print v_short != -1" "\\$\[0-9\]* = 0" "print signed short != (minus)" -test_expr "set variable v_short=-1" "print v_short < 0" "\\$\[0-9\]* = 1" "print v_short < 0x7FFF" "\\$\[0-9\]* = 1" "print signed short < (minus)" -test_expr "set variable v_short=-1" "print v_short > 0" "\\$\[0-9\]* = 0" "print v_short > 0x7FFF" "\\$\[0-9\]* = 0" "print signed short > (minus)" +test_expr "set variable v_short=-1" "print v_short == 0" "\\$\[0-9\]* = $false" "print v_short == -1" "\\$\[0-9\]* = $true" "print signed short == (minus)" +test_expr "set variable v_short=-1" "print v_short != 0" "\\$\[0-9\]* = $true" "print v_short != -1" "\\$\[0-9\]* = $false" "print signed short != (minus)" +test_expr "set variable v_short=-1" "print v_short < 0" "\\$\[0-9\]* = $true" "print v_short < 0x7FFF" "\\$\[0-9\]* = $true" "print signed short < (minus)" +test_expr "set variable v_short=-1" "print v_short > 0" "\\$\[0-9\]* = $false" "print v_short > 0x7FFF" "\\$\[0-9\]* = $false" "print signed short > (minus)" # # test expressions with "signed short" types # -test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short == 0" "\\$\[0-9\]* = 0" "print v_signed_short == 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed short ==" -test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short != 0" "\\$\[0-9\]* = 1" "print v_signed_short != 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed short !=" -test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short < 0" "\\$\[0-9\]* = 0" "print v_signed_short < 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed short <" -test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short > 0" "\\$\[0-9\]* = 1" "print v_signed_short > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed short >" +test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short == 0" "\\$\[0-9\]* = $false" "print v_signed_short == 0x7FFF" "\\$\[0-9\]* = $true" "print signed signed short ==" +test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short != 0" "\\$\[0-9\]* = $true" "print v_signed_short != 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed short !=" +test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short < 0" "\\$\[0-9\]* = $false" "print v_signed_short < 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed short <" +test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short > 0" "\\$\[0-9\]* = $true" "print v_signed_short > 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed short >" # make short a minus -test_expr "set variable v_signed_short=-1" "print v_signed_short == 0" "\\$\[0-9\]* = 0" "print v_signed_short == -1" "\\$\[0-9\]* = 1" "print signed signed short == (minus)" -test_expr "set variable v_signed_short=-1" "print v_signed_short != 0" "\\$\[0-9\]* = 1" "print v_signed_short != -1" "\\$\[0-9\]* = 0" "print signed signed short != (minus)" -test_expr "set variable v_signed_short=-1" "print v_signed_short < 0" "\\$\[0-9\]* = 1" "print v_signed_short < 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed short < (minus)" -test_expr "set variable v_signed_short=-1" "print v_signed_short > 0" "\\$\[0-9\]* = 0" "print v_signed_short > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed short > (minus)" +test_expr "set variable v_signed_short=-1" "print v_signed_short == 0" "\\$\[0-9\]* = $false" "print v_signed_short == -1" "\\$\[0-9\]* = $true" "print signed signed short == (minus)" +test_expr "set variable v_signed_short=-1" "print v_signed_short != 0" "\\$\[0-9\]* = $true" "print v_signed_short != -1" "\\$\[0-9\]* = $false" "print signed signed short != (minus)" +test_expr "set variable v_signed_short=-1" "print v_signed_short < 0" "\\$\[0-9\]* = $true" "print v_signed_short < 0x7FFF" "\\$\[0-9\]* = $true" "print signed signed short < (minus)" +test_expr "set variable v_signed_short=-1" "print v_signed_short > 0" "\\$\[0-9\]* = $false" "print v_signed_short > 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed short > (minus)" # # test expressions with "unsigned short" types # -test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short == 0" "\\$\[0-9\]* = 0" "print v_unsigned_short == 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned short ==" -test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short != 0" "\\$\[0-9\]* = 1" "print v_unsigned_short != 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned short !=" -test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short < 0" "\\$\[0-9\]* = 0" "print v_unsigned_short < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned short <" -test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short > 0" "\\$\[0-9\]* = 1" "print v_unsigned_short > 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned short >" +test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short == 0" "\\$\[0-9\]* = $false" "print v_unsigned_short == 0x7FFF" "\\$\[0-9\]* = $true" "print unsigned short ==" +test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short != 0" "\\$\[0-9\]* = $true" "print v_unsigned_short != 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned short !=" +test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short < 0" "\\$\[0-9\]* = $false" "print v_unsigned_short < 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned short <" +test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short > 0" "\\$\[0-9\]* = $true" "print v_unsigned_short > 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned short >" # make short a minus -# note that (unsigned short) ~0 == ~0 iff sizeof(short) == sizeof(int), -# so we can't test v_unsigned_short != ~0 -test_expr "set variable v_unsigned_short=~0" \ - "print v_unsigned_short == 0" "\\$\[0-9\]* = 0" \ - "print v_unsigned_short == (unsigned short)~0" "\\$\[0-9\]* = 1" \ - "print unsigned short == (~0)" -test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short != 0" "\\$\[0-9\]* = 1" "print v_unsigned_short != (unsigned short)~0" "\\$\[0-9\]* = 0" "print unsigned short != (~0)" -test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short < 0" "\\$\[0-9\]* = 0" "print v_unsigned_short < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned short < (~0)" -test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short > 0" "\\$\[0-9\]* = 1" "print v_unsigned_short > 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned short > (~0)" +test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short == 0" "\\$\[0-9\]* = $false" "print v_unsigned_short == ~0" "\\$\[0-9\]* = $false" "print v_unsigned_short == (unsigned short)~0" "\\$\[0-9\]* = $true" "print unsigned short == (~0)" +test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short != 0" "\\$\[0-9\]* = $true" "print v_unsigned_short != (unsigned short)~0" "\\$\[0-9\]* = $false" "print unsigned short != (~0)" +test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short < 0" "\\$\[0-9\]* = $false" "print v_unsigned_short < 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned short < (~0)" +test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short > 0" "\\$\[0-9\]* = $true" "print v_unsigned_short > 0x7FFF" "\\$\[0-9\]* = $true" "print unsigned short > (~0)" # # test expressions with "int" types # -test_expr "set variable v_int=0x7FFF" "print v_int == 0" "\\$\[0-9\]* = 0" "print v_int == 0x7FFF" "\\$\[0-9\]* = 1" "print signed int ==" -test_expr "set variable v_int=0x7FFF" "print v_int != 0" "\\$\[0-9\]* = 1" "print v_int != 0x7FFF" "\\$\[0-9\]* = 0" "print signed int !=" -test_expr "set variable v_int=0x7FFF" "print v_int < 0" "\\$\[0-9\]* = 0" "print v_int < 0x7FFF" "\\$\[0-9\]* = 0" "print signed int <" -test_expr "set variable v_int=0x7FFF" "print v_int > 0" "\\$\[0-9\]* = 1" "print v_int > 0x7FFF" "\\$\[0-9\]* = 0" "print signed int >" +test_expr "set variable v_int=0x7FFF" "print v_int == 0" "\\$\[0-9\]* = $false" "print v_int == 0x7FFF" "\\$\[0-9\]* = $true" "print signed int ==" +test_expr "set variable v_int=0x7FFF" "print v_int != 0" "\\$\[0-9\]* = $true" "print v_int != 0x7FFF" "\\$\[0-9\]* = $false" "print signed int !=" +test_expr "set variable v_int=0x7FFF" "print v_int < 0" "\\$\[0-9\]* = $false" "print v_int < 0x7FFF" "\\$\[0-9\]* = $false" "print signed int <" +test_expr "set variable v_int=0x7FFF" "print v_int > 0" "\\$\[0-9\]* = $true" "print v_int > 0x7FFF" "\\$\[0-9\]* = $false" "print signed int >" # make int a minus -test_expr "set variable v_int=-1" "print v_int == 0" "\\$\[0-9\]* = 0" "print v_int == -1" "\\$\[0-9\]* = 1" "print signed int == (minus)" -test_expr "set variable v_int=-1" "print v_int != 0" "\\$\[0-9\]* = 1" "print v_int != -1" "\\$\[0-9\]* = 0" "print signed int != (minus)" -test_expr "set variable v_int=-1" "print v_int < 0" "\\$\[0-9\]* = 1" "print v_int < 0x7FFF" "\\$\[0-9\]* = 1" "print signed int < (minus)" -test_expr "set variable v_int=-1" "print v_int > 0" "\\$\[0-9\]* = 0" "print v_int > 0x7FFF" "\\$\[0-9\]* = 0" "print signed int > (minus)" +test_expr "set variable v_int=-1" "print v_int == 0" "\\$\[0-9\]* = $false" "print v_int == -1" "\\$\[0-9\]* = $true" "print signed int == (minus)" +test_expr "set variable v_int=-1" "print v_int != 0" "\\$\[0-9\]* = $true" "print v_int != -1" "\\$\[0-9\]* = $false" "print signed int != (minus)" +test_expr "set variable v_int=-1" "print v_int < 0" "\\$\[0-9\]* = $true" "print v_int < 0x7FFF" "\\$\[0-9\]* = $true" "print signed int < (minus)" +test_expr "set variable v_int=-1" "print v_int > 0" "\\$\[0-9\]* = $false" "print v_int > 0x7FFF" "\\$\[0-9\]* = $false" "print signed int > (minus)" # # test expressions with "signed int" types # -test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int == 0" "\\$\[0-9\]* = 0" "print v_signed_int == 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed int ==" -test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int != 0" "\\$\[0-9\]* = 1" "print v_signed_int != 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed int !=" -test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int < 0" "\\$\[0-9\]* = 0" "print v_signed_int < 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed int <" -test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int > 0" "\\$\[0-9\]* = 1" "print v_signed_int > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed int >" +test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int == 0" "\\$\[0-9\]* = $false" "print v_signed_int == 0x7FFF" "\\$\[0-9\]* = $true" "print signed signed int ==" +test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int != 0" "\\$\[0-9\]* = $true" "print v_signed_int != 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed int !=" +test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int < 0" "\\$\[0-9\]* = $false" "print v_signed_int < 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed int <" +test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int > 0" "\\$\[0-9\]* = $true" "print v_signed_int > 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed int >" # make int a minus -test_expr "set variable v_signed_int=-1" "print v_signed_int == 0" "\\$\[0-9\]* = 0" "print v_signed_int == -1" "\\$\[0-9\]* = 1" "print signed signed int == (minus)" -test_expr "set variable v_signed_int=-1" "print v_signed_int != 0" "\\$\[0-9\]* = 1" "print v_signed_int != -1" "\\$\[0-9\]* = 0" "print signed signed int != (minus)" -test_expr "set variable v_signed_int=-1" "print v_signed_int < 0" "\\$\[0-9\]* = 1" "print v_signed_int < 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed int < (minus)" -test_expr "set variable v_signed_int=-1" "print v_signed_int > 0" "\\$\[0-9\]* = 0" "print v_signed_int > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed int > (minus)" +test_expr "set variable v_signed_int=-1" "print v_signed_int == 0" "\\$\[0-9\]* = $false" "print v_signed_int == -1" "\\$\[0-9\]* = $true" "print signed signed int == (minus)" +test_expr "set variable v_signed_int=-1" "print v_signed_int != 0" "\\$\[0-9\]* = $true" "print v_signed_int != -1" "\\$\[0-9\]* = $false" "print signed signed int != (minus)" +test_expr "set variable v_signed_int=-1" "print v_signed_int < 0" "\\$\[0-9\]* = $true" "print v_signed_int < 0x7FFF" "\\$\[0-9\]* = $true" "print signed signed int < (minus)" +test_expr "set variable v_signed_int=-1" "print v_signed_int > 0" "\\$\[0-9\]* = $false" "print v_signed_int > 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed int > (minus)" # # test expressions with "unsigned int" types # -test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int == 0" "\\$\[0-9\]* = 0" "print v_unsigned_int == 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned int ==" -test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int != 0" "\\$\[0-9\]* = 1" "print v_unsigned_int != 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned int !=" -test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int < 0" "\\$\[0-9\]* = 0" "print v_unsigned_int < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned int <" -test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int > 0" "\\$\[0-9\]* = 1" "print v_unsigned_int > 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned int >" +test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int == 0" "\\$\[0-9\]* = $false" "print v_unsigned_int == 0x7FFF" "\\$\[0-9\]* = $true" "print unsigned int ==" +test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int != 0" "\\$\[0-9\]* = $true" "print v_unsigned_int != 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned int !=" +test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int < 0" "\\$\[0-9\]* = $false" "print v_unsigned_int < 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned int <" +test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int > 0" "\\$\[0-9\]* = $true" "print v_unsigned_int > 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned int >" # make int a minus -test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int == 0" "\\$\[0-9\]* = 0" "print v_unsigned_int == ~0" "\\$\[0-9\]* = 1" "print v_unsigned_int == (unsigned int)~0" "\\$\[0-9\]* = 1" "print unsigned int == (~0)" -test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int != 0" "\\$\[0-9\]* = 1" "print v_unsigned_int != (unsigned int)~0" "\\$\[0-9\]* = 0" "print unsigned int != (~0)" -test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int < 0" "\\$\[0-9\]* = 0" "print v_unsigned_int < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned int < (~0)" -test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int > 0" "\\$\[0-9\]* = 1" "print v_unsigned_int > 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned int > (~0)" +test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int == 0" "\\$\[0-9\]* = $false" "print v_unsigned_int == ~0" "\\$\[0-9\]* = $true" "print v_unsigned_int == (unsigned int)~0" "\\$\[0-9\]* = $true" "print unsigned int == (~0)" +test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int != 0" "\\$\[0-9\]* = $true" "print v_unsigned_int != (unsigned int)~0" "\\$\[0-9\]* = $false" "print unsigned int != (~0)" +test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int < 0" "\\$\[0-9\]* = $false" "print v_unsigned_int < 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned int < (~0)" +test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int > 0" "\\$\[0-9\]* = $true" "print v_unsigned_int > 0x7FFF" "\\$\[0-9\]* = $true" "print unsigned int > (~0)" # # test expressions with "long" types # -test_expr "set variable v_long=0x7FFF" "print v_long == 0" "\\$\[0-9\]* = 0" "print v_long == 0x7FFF" "\\$\[0-9\]* = 1" "print signed long ==" -test_expr "set variable v_long=0x7FFF" "print v_long != 0" "\\$\[0-9\]* = 1" "print v_long != 0x7FFF" "\\$\[0-9\]* = 0" "print signed long !=" -test_expr "set variable v_long=0x7FFF" "print v_long < 0" "\\$\[0-9\]* = 0" "print v_long < 0x7FFF" "\\$\[0-9\]* = 0" "print signed long <" -test_expr "set variable v_long=0x7FFF" "print v_long > 0" "\\$\[0-9\]* = 1" "print v_long > 0x7FFF" "\\$\[0-9\]* = 0" "print signed long >" +test_expr "set variable v_long=0x7FFF" "print v_long == 0" "\\$\[0-9\]* = $false" "print v_long == 0x7FFF" "\\$\[0-9\]* = $true" "print signed long ==" +test_expr "set variable v_long=0x7FFF" "print v_long != 0" "\\$\[0-9\]* = $true" "print v_long != 0x7FFF" "\\$\[0-9\]* = $false" "print signed long !=" +test_expr "set variable v_long=0x7FFF" "print v_long < 0" "\\$\[0-9\]* = $false" "print v_long < 0x7FFF" "\\$\[0-9\]* = $false" "print signed long <" +test_expr "set variable v_long=0x7FFF" "print v_long > 0" "\\$\[0-9\]* = $true" "print v_long > 0x7FFF" "\\$\[0-9\]* = $false" "print signed long >" # make long a minus -test_expr "set variable v_long=-1" "print v_long == 0" "\\$\[0-9\]* = 0" "print v_long == -1" "\\$\[0-9\]* = 1" "print signed long == (minus)" -test_expr "set variable v_long=-1" "print v_long != 0" "\\$\[0-9\]* = 1" "print v_long != -1" "\\$\[0-9\]* = 0" "print signed long != (minus)" -test_expr "set variable v_long=-1" "print v_long < 0" "\\$\[0-9\]* = 1" "print v_long < 0x7FFF" "\\$\[0-9\]* = 1" "print signed long < (minus)" -test_expr "set variable v_long=-1" "print v_long > 0" "\\$\[0-9\]* = 0" "print v_long > 0x7FFF" "\\$\[0-9\]* = 0" "print signed long > (minus)" +test_expr "set variable v_long=-1" "print v_long == 0" "\\$\[0-9\]* = $false" "print v_long == -1" "\\$\[0-9\]* = $true" "print signed long == (minus)" +test_expr "set variable v_long=-1" "print v_long != 0" "\\$\[0-9\]* = $true" "print v_long != -1" "\\$\[0-9\]* = $false" "print signed long != (minus)" +test_expr "set variable v_long=-1" "print v_long < 0" "\\$\[0-9\]* = $true" "print v_long < 0x7FFF" "\\$\[0-9\]* = $true" "print signed long < (minus)" +test_expr "set variable v_long=-1" "print v_long > 0" "\\$\[0-9\]* = $false" "print v_long > 0x7FFF" "\\$\[0-9\]* = $false" "print signed long > (minus)" # # test expressions with "signed long" types # -test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long == 0" "\\$\[0-9\]* = 0" "print v_signed_long == 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed long ==" -test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long != 0" "\\$\[0-9\]* = 1" "print v_signed_long != 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed long !=" -test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long < 0" "\\$\[0-9\]* = 0" "print v_signed_long < 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed long <" -test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long > 0" "\\$\[0-9\]* = 1" "print v_signed_long > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed long >" +test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long == 0" "\\$\[0-9\]* = $false" "print v_signed_long == 0x7FFF" "\\$\[0-9\]* = $true" "print signed signed long ==" +test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long != 0" "\\$\[0-9\]* = $true" "print v_signed_long != 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed long !=" +test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long < 0" "\\$\[0-9\]* = $false" "print v_signed_long < 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed long <" +test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long > 0" "\\$\[0-9\]* = $true" "print v_signed_long > 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed long >" # make long a minus -test_expr "set variable v_signed_long=-1" "print v_signed_long == 0" "\\$\[0-9\]* = 0" "print v_signed_long == -1" "\\$\[0-9\]* = 1" "print signed signed long == (minus)" -test_expr "set variable v_signed_long=-1" "print v_signed_long != 0" "\\$\[0-9\]* = 1" "print v_signed_long != -1" "\\$\[0-9\]* = 0" "print signed signed long != (minus)" -test_expr "set variable v_signed_long=-1" "print v_signed_long < 0" "\\$\[0-9\]* = 1" "print v_signed_long < 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed long < (minus)" -test_expr "set variable v_signed_long=-1" "print v_signed_long > 0" "\\$\[0-9\]* = 0" "print v_signed_long > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed long > (minus)" +test_expr "set variable v_signed_long=-1" "print v_signed_long == 0" "\\$\[0-9\]* = $false" "print v_signed_long == -1" "\\$\[0-9\]* = $true" "print signed signed long == (minus)" +test_expr "set variable v_signed_long=-1" "print v_signed_long != 0" "\\$\[0-9\]* = $true" "print v_signed_long != -1" "\\$\[0-9\]* = $false" "print signed signed long != (minus)" +test_expr "set variable v_signed_long=-1" "print v_signed_long < 0" "\\$\[0-9\]* = $true" "print v_signed_long < 0x7FFF" "\\$\[0-9\]* = $true" "print signed signed long < (minus)" +test_expr "set variable v_signed_long=-1" "print v_signed_long > 0" "\\$\[0-9\]* = $false" "print v_signed_long > 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed long > (minus)" # # test expressions with "unsigned long" types # -test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long == 0" "\\$\[0-9\]* = 0" "print v_unsigned_long == 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned long ==" -test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long != 0" "\\$\[0-9\]* = 1" "print v_unsigned_long != 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned long !=" -test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long < 0" "\\$\[0-9\]* = 0" "print v_unsigned_long < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned long <" -test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long > 0" "\\$\[0-9\]* = 1" "print v_unsigned_long > 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned long >" +test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long == 0" "\\$\[0-9\]* = $false" "print v_unsigned_long == 0x7FFF" "\\$\[0-9\]* = $true" "print unsigned long ==" +test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long != 0" "\\$\[0-9\]* = $true" "print v_unsigned_long != 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned long !=" +test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long < 0" "\\$\[0-9\]* = $false" "print v_unsigned_long < 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned long <" +test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long > 0" "\\$\[0-9\]* = $true" "print v_unsigned_long > 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned long >" # make long a minus -test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long == 0" "\\$\[0-9\]* = 0" "print v_unsigned_long == ~0" "\\$\[0-9\]* = 1" "print v_unsigned_long == (unsigned long)~0" "\\$\[0-9\]* = 1" "print unsigned long == (~0)" -test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long != 0" "\\$\[0-9\]* = 1" "print v_unsigned_long != (unsigned long)~0" "\\$\[0-9\]* = 0" "print unsigned long != (~0)" -test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long < 0" "\\$\[0-9\]* = 0" "print v_unsigned_long < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned long < (~0)" -test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long > 0" "\\$\[0-9\]* = 1" "print v_unsigned_long > 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned long > (~0)" +test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long == 0" "\\$\[0-9\]* = $false" "print v_unsigned_long == ~0" "\\$\[0-9\]* = $true" "print v_unsigned_long == (unsigned long)~0" "\\$\[0-9\]* = $true" "print unsigned long == (~0)" +test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long != 0" "\\$\[0-9\]* = $true" "print v_unsigned_long != (unsigned long)~0" "\\$\[0-9\]* = $false" "print unsigned long != (~0)" +test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long < 0" "\\$\[0-9\]* = $false" "print v_unsigned_long < 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned long < (~0)" +test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long > 0" "\\$\[0-9\]* = $true" "print v_unsigned_long > 0x7FFF" "\\$\[0-9\]* = $true" "print unsigned long > (~0)" diff --git a/gdb/testsuite/gdb.base/funcargs.c b/gdb/testsuite/gdb.base/funcargs.c index ead67e551e..98d390bc34 100644 --- a/gdb/testsuite/gdb.base/funcargs.c +++ b/gdb/testsuite/gdb.base/funcargs.c @@ -71,8 +71,12 @@ char carray[] = {'a', 'n', ' ', 'a', 'r', 'r', 'a', 'y', '\0'}; /* Test various permutations and interleaving of integral arguments */ +#ifdef PROTOTYPES +void call0a (char c, short s, int i, long l) +#else call0a (c, s, i, l) char c; short s; int i; long l; +#endif { c = 'a'; s = 5; @@ -80,26 +84,42 @@ char c; short s; int i; long l; l = 7; } +#ifdef PROTOTYPES +void call0b (short s, int i, long l, char c) +#else call0b (s, i, l, c) short s; int i; long l; char c; +#endif { s = 6; i = 7; l = 8; c = 'j'; } +#ifdef PROTOTYPES +void call0c (int i, long l, char c, short s) +#else call0c (i, l, c, s) int i; long l; char c; short s; +#endif { i = 3; l = 4; c = 'k'; s = 5; } +#ifdef PROTOTYPES +void call0d (long l, char c, short s, int i) +#else call0d (l, c, s, i) long l; char c; short s; int i; +#endif { l = 7; c = 'z'; s = 8; i = 9; } +#ifdef PROTOTYPES +void call0e (char c1, long l, char c2, int i, char c3, short s, char c4, char c5) +#else call0e (c1, l, c2, i, c3, s, c4, c5) char c1; long l; char c2; int i; char c3; short s; char c4; char c5; +#endif { c1 = 'a'; l = 5; c2 = 'b'; i = 7; c3 = 'c'; s = 7; c4 = 'f'; c5 = 'g'; } @@ -108,33 +128,53 @@ char c1; long l; char c2; int i; char c3; short s; char c4; char c5; /* Test various permutations and interleaving of unsigned integral arguments */ +#ifdef PROTOTYPES +void call1a (unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else call1a (uc, us, ui, ul) unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#endif { uc = 5; us = 6; ui = 7; ul = 8; } +#ifdef PROTOTYPES +void call1b (unsigned short us, unsigned int ui, unsigned long ul, unsigned char uc) +#else call1b (us, ui, ul, uc) unsigned short us; unsigned int ui; unsigned long ul; unsigned char uc; +#endif { uc = 5; us = 6; ui = 7; ul = 8; } +#ifdef PROTOTYPES +void call1c (unsigned int ui, unsigned long ul, unsigned char uc, unsigned short us) +#else call1c (ui, ul, uc, us) unsigned int ui; unsigned long ul; unsigned char uc; unsigned short us; +#endif { uc = 5; us = 6; ui = 7; ul = 8; } +#ifdef PROTOTYPES +void call1d (unsigned long ul, unsigned char uc, unsigned short us, unsigned int ui) +#else call1d (ul, uc, us, ui) unsigned long ul; unsigned char uc; unsigned short us; unsigned int ui; +#endif { uc = 5; us = 6; ui = 7; ul = 8; } +#ifdef PROTOTYPES +void call1e (unsigned char uc1, unsigned long ul, unsigned char uc2, unsigned int ui, unsigned char uc3, unsigned short us, unsigned char uc4, unsigned char uc5) +#else call1e (uc1, ul, uc2, ui, uc3, us, uc4, uc5) unsigned char uc1; unsigned long ul; unsigned char uc2; unsigned int ui; unsigned char uc3; unsigned short us; unsigned char uc4; unsigned char uc5; +#endif { uc1 = 5; ul = 7; uc2 = 8; ui = 9; uc3 = 10; us = 11; uc4 = 12; uc5 = 55; } @@ -143,57 +183,93 @@ unsigned char uc3; unsigned short us; unsigned char uc4; unsigned char uc5; floating point arguments. */ +#ifdef PROTOTYPES +void call2a (char c, float f1, short s, double d1, int i, float f2, long l, double d2) +#else call2a (c, f1, s, d1, i, f2, l, d2) char c; float f1; short s; double d1; int i; float f2; long l; double d2; +#endif { c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2; } +#ifdef PROTOTYPES +void call2b (float f1, short s, double d1, int i, float f2, long l, double d2, char c) +#else call2b (f1, s, d1, i, f2, l, d2, c) float f1; short s; double d1; int i; float f2; long l; double d2; char c; +#endif { c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2; } +#ifdef PROTOTYPES +void call2c (short s, double d1, int i, float f2, long l, double d2, char c, float f1) +#else call2c (s, d1, i, f2, l, d2, c, f1) short s; double d1; int i; float f2; long l; double d2; char c; float f1; +#endif { c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2; } +#ifdef PROTOTYPES +void call2d (double d1, int i, float f2, long l, double d2, char c, float f1, short s) +#else call2d (d1, i, f2, l, d2, c, f1, s) double d1; int i; float f2; long l; double d2; char c; float f1; short s; +#endif { c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2; } +#ifdef PROTOTYPES +void call2e (int i, float f2, long l, double d2, char c, float f1, short s, double d1) +#else call2e (i, f2, l, d2, c, f1, s, d1) int i; float f2; long l; double d2; char c; float f1; short s; double d1; +#endif { c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2; } +#ifdef PROTOTYPES +void call2f (float f2, long l, double d2, char c, float f1, short s, double d1, int i) +#else call2f (f2, l, d2, c, f1, s, d1, i) float f2; long l; double d2; char c; float f1; short s; double d1; int i; +#endif { c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2; } +#ifdef PROTOTYPES +void call2g (long l, double d2, char c, float f1, short s, double d1, int i, float f2) +#else call2g (l, d2, c, f1, s, d1, i, f2) long l; double d2; char c; float f1; short s; double d1; int i; float f2; +#endif { c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2; } +#ifdef PROTOTYPES +void call2h (double d2, char c, float f1, short s, double d1, int i, float f2, long l) +#else call2h (d2, c, f1, s, d1, i, f2, l) double d2; char c; float f1; short s; double d1; int i; float f2; long l; +#endif { c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2; } +#ifdef PROTOTYPES +void call2i (char c1, float f1, char c2, char c3, double d1, char c4, char c5, char c6, float f2, short s, char c7, double d2) +#else call2i (c1, f1, c2, c3, d1, c4, c5, c6, f2, s, c7, d2) char c1; float f1; char c2; char c3; double d1; char c4; char c5; char c6; float f2; short s; char c7; double d2; +#endif { c1 = 'a'; f1 = 0.0; c2 = 5; d1 = 0.0; c3 = 6; f2 = 0.1; c4 = 7; d2 = 0.2; c5 = 's'; c6 = 'f'; c7 = 'z'; s = 77; @@ -203,21 +279,33 @@ float f2; short s; char c7; double d2; /* Test pointers to various integral and floating types. */ +#ifdef PROTOTYPES +void call3a (char *cp, short *sp, int *ip, long *lp) +#else call3a (cp, sp, ip, lp) char *cp; short *sp; int *ip; long *lp; +#endif { cp = 0; sp = 0; ip = 0; lp = 0; } +#ifdef PROTOTYPES +void call3b (unsigned char *ucp, unsigned short *usp, unsigned int *uip, unsigned long *ulp) +#else call3b (ucp, usp, uip, ulp) unsigned char *ucp; unsigned short *usp; unsigned int *uip; unsigned long *ulp; +#endif { ucp = 0; usp = 0; uip = 0; ulp = 0; } +#ifdef PROTOTYPES +void call3c (float *fp, double *dp) +#else call3c (fp, dp) float *fp; double *dp; +#endif { fp = 0; dp = 0; } @@ -226,12 +314,20 @@ float *fp; double *dp; /* Test passing structures and unions by reference. */ +#ifdef PROTOTYPES +void call4a (struct stag *stp) +#else call4a (stp) -struct stag *stp; { -stp = 0;} +struct stag *stp; +#endif +{stp = 0;} +#ifdef PROTOTYPES +void call4b (union utag *unp) +#else call4b (unp) union utag *unp; +#endif { unp = 0; } @@ -240,165 +336,258 @@ union utag *unp; /* Test passing structures and unions by value. */ +#ifdef PROTOTYPES +void call5a (struct stag st) +#else call5a (st) -struct stag st; {st.s1 = 5;} +struct stag st; +#endif +{st.s1 = 5;} +#ifdef PROTOTYPES +void call5b (union utag un) +#else call5b (un) -union utag un; {un.u1 = 7;} +union utag un; +#endif +{un.u1 = 7;} /* Test shuffling of args */ -call6a (c, s, i, l, f, d, uc, us, ui, ul) -char c; short s; int i; long l; float f; double d; -unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +void call6k () { - c = c; - call6b (s, i, l, f, d, uc, us, ui, ul); } -call6b (s, i, l, f, d, uc, us, ui, ul) -short s; int i; long l; float f; double d; -unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#ifdef PROTOTYPES +void call6j (unsigned long ul) +#else +call6j (ul) +unsigned long ul; +#endif { - s = s; - call6c (i, l, f, d, uc, us, ui, ul); + ul = ul; + call6k (); } -call6c (i, l, f, d, uc, us, ui, ul) -int i; long l; float f; double d; -unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#ifdef PROTOTYPES +void call6i (unsigned int ui, unsigned long ul) +#else +call6i (ui, ul) +unsigned int ui; unsigned long ul; +#endif { - i = i; - call6d (l, f, d, uc, us, ui, ul); + ui = ui; + call6j (ul); } -call6d (l, f, d, uc, us, ui, ul) -long l; float f; double d; -unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#ifdef PROTOTYPES +void call6h (unsigned short us, unsigned int ui, unsigned long ul) +#else +call6h (us, ui, ul) +unsigned short us; unsigned int ui; unsigned long ul; +#endif { - l = l; - call6e (f, d, uc, us, ui, ul); + us = us; + call6i (ui, ul); } -call6e (f, d, uc, us, ui, ul) -float f; double d; +#ifdef PROTOTYPES +void call6g (unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else +call6g (uc, us, ui, ul) unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#endif { - f = f; - call6f (d, uc, us, ui, ul); + uc = uc; + call6h (us, ui, ul); } +#ifdef PROTOTYPES +void call6f (double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else call6f (d, uc, us, ui, ul) double d; unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#endif { d = d; call6g (uc, us, ui, ul); } -call6g (uc, us, ui, ul) +#ifdef PROTOTYPES +void call6e (float f, double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else +call6e (f, d, uc, us, ui, ul) +float f; double d; unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#endif { - uc = uc; - call6h (us, ui, ul); + f = f; + call6f (d, uc, us, ui, ul); } -call6h (us, ui, ul) -unsigned short us; unsigned int ui; unsigned long ul; +#ifdef PROTOTYPES +void call6d (long l, float f, double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else +call6d (l, f, d, uc, us, ui, ul) +long l; float f; double d; +unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#endif { - us = us; - call6i (ui, ul); + l = l; + call6e (f, d, uc, us, ui, ul); } -call6i (ui, ul) -unsigned int ui; unsigned long ul; +#ifdef PROTOTYPES +void call6c (int i, long l, float f, double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else +call6c (i, l, f, d, uc, us, ui, ul) +int i; long l; float f; double d; +unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#endif { - ui = ui; - call6j (ul); + i = i; + call6d (l, f, d, uc, us, ui, ul); } -call6j (ul) -unsigned long ul; +#ifdef PROTOTYPES +void call6b (short s, int i, long l, float f, double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else +call6b (s, i, l, f, d, uc, us, ui, ul) +short s; int i; long l; float f; double d; +unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#endif { - ul = ul; - call6k (); + s = s; + call6c (i, l, f, d, uc, us, ui, ul); } -call6k () +#ifdef PROTOTYPES +void call6a (char c, short s, int i, long l, float f, double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else +call6a (c, s, i, l, f, d, uc, us, ui, ul) +char c; short s; int i; long l; float f; double d; +unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#endif { + c = c; + call6b (s, i, l, f, d, uc, us, ui, ul); } - /* Test shuffling of args, round robin */ -call7a (c, i, s, l, f, uc, d, us, ul, ui) +#ifdef PROTOTYPES +void call7k (char c, int i, short s, long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui) +#else +call7k (c, i, s, l, f, uc, d, us, ul, ui) char c; int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; +#endif { - call7b (i, s, l, f, uc, d, us, ul, ui, c); + c = 'a'; i = 7; s = 8; l = 7; f = 0.3; uc = 44; d = 0.44; us = 77; + ul = 43; ui = 33; } -call7b (i, s, l, f, uc, d, us, ul, ui, c) -int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; +#ifdef PROTOTYPES +void call7j (unsigned int ui, char c, int i, short s, long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul) +#else +call7j (ui, c, i, s, l, f, uc, d, us, ul) +unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; +#endif { - call7c (s, l, f, uc, d, us, ul, ui, c, i); + call7k (c, i, s, l, f, uc, d, us, ul, ui); } -call7c (s, l, f, uc, d, us, ul, ui, c, i) -short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; +#ifdef PROTOTYPES +void call7i (unsigned long ul, unsigned int ui, char c, int i, short s, long l, float f, unsigned char uc, double d, unsigned short us) +#else +call7i (ul, ui, c, i, s, l, f, uc, d, us) +unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; +#endif { - call7d (l, f, uc, d, us, ul, ui, c, i, s); + call7j (ui, c, i, s, l, f, uc, d, us, ul); } -call7d (l, f, uc, d, us, ul, ui, c, i, s) -long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; +#ifdef PROTOTYPES +void call7h (unsigned short us, unsigned long ul, unsigned int ui, char c, int i, short s, long l, float f, unsigned char uc, double d) +#else +call7h (us, ul, ui, c, i, s, l, f, uc, d) +unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; double d; +#endif { - call7e (f, uc, d, us, ul, ui, c, i, s, l); + call7i (ul, ui, c, i, s, l, f, uc, d, us); } -call7e (f, uc, d, us, ul, ui, c, i, s, l) -float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; +#ifdef PROTOTYPES +void call7g (double d, unsigned short us, unsigned long ul, unsigned int ui, char c, int i, short s, long l, float f, unsigned char uc) +#else +call7g (d, us, ul, ui, c, i, s, l, f, uc) +double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; +#endif { - call7f (uc, d, us, ul, ui, c, i, s, l, f); + call7h (us, ul, ui, c, i, s, l, f, uc, d); } +#ifdef PROTOTYPES +void call7f (unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui, char c, int i, short s, long l, float f) +#else call7f (uc, d, us, ul, ui, c, i, s, l, f) unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; +#endif { call7g (d, us, ul, ui, c, i, s, l, f, uc); } -call7g (d, us, ul, ui, c, i, s, l, f, uc) -double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; +#ifdef PROTOTYPES +void call7e (float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui, char c, int i, short s, long l) +#else +call7e (f, uc, d, us, ul, ui, c, i, s, l) +float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; +#endif { - call7h (us, ul, ui, c, i, s, l, f, uc, d); + call7f (uc, d, us, ul, ui, c, i, s, l, f); } -call7h (us, ul, ui, c, i, s, l, f, uc, d) -unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; double d; +#ifdef PROTOTYPES +void call7d (long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui, char c, int i, short s) +#else +call7d (l, f, uc, d, us, ul, ui, c, i, s) +long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; +#endif { - call7i (ul, ui, c, i, s, l, f, uc, d, us); + call7e (f, uc, d, us, ul, ui, c, i, s, l); } -call7i (ul, ui, c, i, s, l, f, uc, d, us) -unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; +#ifdef PROTOTYPES +void call7c (short s, long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui, char c, int i) +#else +call7c (s, l, f, uc, d, us, ul, ui, c, i) +short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; +#endif { - call7j (ui, c, i, s, l, f, uc, d, us, ul); + call7d (l, f, uc, d, us, ul, ui, c, i, s); } -call7j (ui, c, i, s, l, f, uc, d, us, ul) -unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; +#ifdef PROTOTYPES +void call7b (int i, short s, long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui, char c) +#else +call7b (i, s, l, f, uc, d, us, ul, ui, c) +int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; +#endif { - call7k (c, i, s, l, f, uc, d, us, ul, ui); + call7c (s, l, f, uc, d, us, ul, ui, c, i); } -call7k (c, i, s, l, f, uc, d, us, ul, ui) +#ifdef PROTOTYPES +void call7a (char c, int i, short s, long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui) +#else +call7a (c, i, s, l, f, uc, d, us, ul, ui) char c; int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; +#endif { - c = 'a'; i = 7; s = 8; l = 7; f = 0.3; uc = 44; d = 0.44; us = 77; - ul = 43; ui = 33; + call7b (i, s, l, f, uc, d, us, ul, ui, c); } @@ -412,13 +601,17 @@ typedef struct s long l; } SVAL; -hitbottom () +void hitbottom () { } +#ifdef PROTOTYPES +void recurse (SVAL a, int depth) +#else void recurse (a, depth) SVAL a; int depth; +#endif { a.s = a.i = a.l = --depth; if (depth == 0) @@ -427,7 +620,7 @@ int depth; recurse (a, depth); } -test_struct_args () +void test_struct_args () { SVAL s; s.s = 5; s.i = 5; s.l = 5; @@ -438,12 +631,16 @@ test_struct_args () calls alloca may do things differently with respect to frames. So give it a try. */ +#ifdef PROTOTYPES +void localvars_after_alloca (char c, short s, int i, long l) +#else int localvars_after_alloca (c, s, i, l) char c; short s; int i; long l; +#endif { #ifdef HAVE_STACK_ALLOCA /* No need to use the alloca.c alloca-on-top-of-malloc; it doesn't @@ -458,21 +655,29 @@ localvars_after_alloca (c, s, i, l) l = 7; } +#ifdef PROTOTYPES +void call_after_alloca_subr (char c, short s, int i, long l, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else void call_after_alloca_subr (c, s, i, l, uc, us, ui, ul) char c; int i; short s; long l; unsigned char uc; unsigned short us; unsigned long ul; unsigned int ui; +#endif { c = 'a'; i = 7; s = 8; l = 7; uc = 44; us = 77; ul = 43; ui = 33; } +#ifdef PROTOTYPES +void call_after_alloca (char c, short s, int i, long l) +#else int call_after_alloca (c, s, i, l) char c; short s; int i; long l; +#endif { #ifdef HAVE_STACK_ALLOCA /* No need to use the alloca.c alloca-on-top-of-malloc; it doesn't @@ -491,9 +696,13 @@ call_after_alloca (c, s, i, l) will require a trampoline between dyncall and this function on the call path, then another trampoline on between this function and main on the return path. */ +#ifdef PROTOTYPES +double call_with_trampolines (double d1) +#else double call_with_trampolines (d1) double d1; +#endif { return d1; } /* End of call_with_trampolines, this comment is needed by funcargs.exp */ @@ -506,10 +715,10 @@ marker_indirect_call () {} void marker_call_with_trampolines () {} -main () +int main () { - int (*pointer_to_call0a) () = call0a; - double (*pointer_to_call_with_trampolines) () = call_with_trampolines; + void (*pointer_to_call0a) (char, short, int, long) = (void (*)(char, short, int, long))call0a; + double (*pointer_to_call_with_trampolines) (double) = call_with_trampolines; #ifdef usestubs set_debug_traps(); @@ -579,4 +788,5 @@ main () (*pointer_to_call0a) (c, s, i, l); /* Second step into call0a. */ marker_call_with_trampolines (); (*pointer_to_call_with_trampolines) (d); /* Test multiple trampolines. */ + return 0; } diff --git a/gdb/testsuite/gdb.base/funcargs.exp b/gdb/testsuite/gdb.base/funcargs.exp index cc7a6d6937..baa4ab6d5a 100644 --- a/gdb/testsuite/gdb.base/funcargs.exp +++ b/gdb/testsuite/gdb.base/funcargs.exp @@ -167,6 +167,7 @@ proc float_and_integral_args {} { global gdb_prompt global det_file global gcc_compiled + global hp_cc_compiler delete_breakpoints @@ -186,55 +187,67 @@ proc float_and_integral_args {} { # code is broken. setup_xfail "a29k-*-udi" if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" } + # The debug info. for "f" is not correct. It's a known bug. + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} gdb_run_cmd gdb_expect { -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { pass "run to call2a" } + -re ".* call2a \\(c=97 'a', f1=.*, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { xfail "run to call2a" } -re "$gdb_prompt $" { fail "run to call2a" ; gdb_suppress_tests; } timeout { fail "(timeout) run to call2a" ; gdb_suppress_tests; } } # Print each arg as a double check to see if we can print gdb_test "print c" ".* = 97 'a'" "print c after run to call2a" + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} gdb_test "print f1" ".* = 4" "print f1 after run to call2a" gdb_test "print s" ".* = 1" "print s after run to call2a" gdb_test "print d1" ".* = 5" "print d1 after run to call2a" gdb_test "print i" ".* = 2" "print i after run to call2a" + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} gdb_test "print f2" ".* = 4" "print f2 after run to call2a" gdb_test "print l" ".* = 3" "print l after run to call2a" gdb_test "print d2" ".* = 5" "print d2 after run to call2a" setup_xfail "rs6000-*-*" + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" } # Continue; should stop at call2b and print actual arguments. if [gdb_test "cont" ".* call2b \\(f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a'\\) .*" "continue to call2b"] { gdb_suppress_tests; } + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} # Continue; should stop at call2c and print actual arguments. if [gdb_test "cont" ".* call2c \\(s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4\\) .*" "continue to call2c"] { gdb_suppress_tests; } + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} # Continue; should stop at call2d and print actual arguments. if [gdb_test "cont" ".* call2d \\(d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1\\) .*" "continue to call2d"] { gdb_suppress_tests; } + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} # Continue; should stop at call2e and print actual arguments. if [gdb_test "cont" ".* call2e \\(i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5\\) .*" "continue to call2e"] { gdb_suppress_tests; } + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} # Continue; should stop at call2f and print actual arguments. if [gdb_test "cont" ".* call2f \\(f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2\\) .*" "continue to call2f"] { gdb_suppress_tests; } + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} # Continue; should stop at call2g and print actual arguments. if [gdb_test "cont" ".* call2g \\(l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4\\) .*" "continue to call2g"] { gdb_suppress_tests; } + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} # Continue; should stop at call2h and print actual arguments. if [gdb_test "cont" ".* call2h \\(d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3\\) .*" "continue to call2h"] { gdb_suppress_tests; @@ -245,6 +258,7 @@ proc float_and_integral_args {} { delete_breakpoints gdb_breakpoint call2i + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} # Continue; should stop at call2i and print actual arguments. if [gdb_test "cont" ".* call2i \\(c1=97 'a', f1=4, c2=97 'a', c3=97 'a', d1=5, c4=97 'a', c5=97 'a', c6=97 'a', f2=4, s=1, c7=97 'a', d2=5\\) .*" "continue to call2i"] { gdb_suppress_tests; @@ -449,6 +463,7 @@ proc discard_and_shuffle {} { global decimal global det_file global gcc_compiled + global hp_cc_compiler delete_breakpoints @@ -480,8 +495,30 @@ proc discard_and_shuffle {} { setup_xfail "mips-sgi-irix5*" } - if [gdb_test "backtrace 100" " call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6a"] { - gdb_suppress_tests; + # The debug info. for "f" is not correct. It's a known bug. + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + send_gdb "backtrace 100\n" + gdb_expect { + -re "backtrace 100\[\r\n\]+ +.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r +.* main \\(.*\\) .*\r +$gdb_prompt $" { + pass "backtrace from call6a" + } + -re "backtrace 100\[\r\n\]+ +.* call6a \\(c=97 'a', s=1, i=2, l=3, f=.*, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r +.* main \\(.*\\) .*\r +$gdb_prompt $" { + xfail "backtrace from call6a" + } + -re "$gdb_prompt $" { + fail "backtrace from call6a" + gdb_suppress_tests + } + timeout { + fail "(timeout) backtrace from call6a" + gdb_suppress_tests + } } # Continue; should stop at call6b and print actual arguments. @@ -489,7 +526,8 @@ proc discard_and_shuffle {} { gdb_continue call6b - if [gdb_test "backtrace 100" " call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6b"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\]*.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\]" "backtrace from call6b"] { gdb_suppress_tests; } @@ -498,7 +536,8 @@ proc discard_and_shuffle {} { gdb_continue call6c - if [gdb_test "backtrace 100" " call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6c"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6c"] { gdb_suppress_tests; } # Continue; should stop at call6d and print actual arguments. @@ -506,7 +545,8 @@ proc discard_and_shuffle {} { gdb_continue call6d - if [gdb_test "backtrace 100" " call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6d"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6d"] { gdb_suppress_tests; } @@ -515,7 +555,8 @@ proc discard_and_shuffle {} { gdb_continue call6e - if [gdb_test "backtrace 100" " call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6e"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6e"] { gdb_suppress_tests; } @@ -524,7 +565,8 @@ proc discard_and_shuffle {} { gdb_continue call6f - if [gdb_test "backtrace 100" " call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6f"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6f"] { gdb_suppress_tests; } @@ -533,7 +575,8 @@ proc discard_and_shuffle {} { gdb_continue call6g - if [gdb_test "backtrace 100" " call6g \\(uc=98 'b', us=6, ui=7, ul=8\\).* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6g"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6g"] { gdb_suppress_tests; } @@ -542,7 +585,8 @@ proc discard_and_shuffle {} { gdb_continue call6h - if [gdb_test "backtrace 100" " call6h \\(us=6, ui=7, ul=8\\).* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\).* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6h"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6h \\(us=6, ui=7, ul=8\\) .*\[\r\n\].* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6h"] { gdb_suppress_tests; } @@ -558,7 +602,8 @@ proc discard_and_shuffle {} { gdb_continue call6i - if [gdb_test "backtrace 100" " call6i \\(ui=7, ul=8\\).* call6h \\(us=6, ui=7, ul=8\\).* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\).* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6i"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6i \\(ui=7, ul=8\\) .*\[\r\n\].* call6h \\(us=6, ui=7, ul=8\\) .*\[\r\n\].* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6i"] { gdb_suppress_tests; } @@ -567,7 +612,8 @@ proc discard_and_shuffle {} { gdb_continue call6j - if [gdb_test "backtrace 100" " call6j \\(ul=8\\).* call6i \\(ui=7, ul=8\\).* call6h \\(us=6, ui=7, ul=8\\).* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\).* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6j"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6j \\(ul=8\\) .*\[\r\n\].* call6i \\(ui=7, ul=8\\) .*\[\r\n\].* call6h \\(us=6, ui=7, ul=8\\) .*\[\r\n\].* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6j"] { gdb_suppress_tests; } @@ -578,7 +624,8 @@ proc discard_and_shuffle {} { setup_xfail "i960-*-vxworks" 1786 gdb_continue call6k - if [gdb_test "backtrace 100" " call6k \\(\\).* call6j \\(ul=8\\).* call6i \\(ui=7, ul=8\\).* call6h \\(us=6, ui=7, ul=8\\).* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\).* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6k"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6k \\(\\) .*\[\r\n\].* call6j \\(ul=8\\) .*\[\r\n\].* call6i \\(ui=7, ul=8\\) .*\[\r\n\].* call6h \\(us=6, ui=7, ul=8\\) .*\[\r\n\].* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6k"] { gdb_suppress_tests; } gdb_stop_suppressing_tests; @@ -595,6 +642,7 @@ proc shuffle_round_robin {} { global decimal global det_file global gcc_compiled + global hp_cc_compiler delete_breakpoints @@ -624,7 +672,25 @@ proc shuffle_round_robin {} { setup_xfail "i960-*-*" 1813 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" } - gdb_test "backtrace 100" " call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7a" + # The debug info. for "f" is not correct. It's a known bug. + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + send_gdb "backtrace 100\n" + gdb_expect { + -re "backtrace 100\[\r\n\]+ +.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r +.* main \\(.*\\) .*\r +$gdb_prompt $" { + pass "backtrace from call7a" + } + -re "backtrace 100\[\r\n\]+ +.* call7a \\(c=97 'a', i=2, s=1, l=3, f=.*, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r +.* main \\(.*\\) .*\r +$gdb_prompt $" { + xfail "backtrace from call7a" + } + -re "$gdb_prompt $" { fail "backtrace from call7a" ; return } + timeout { fail "(timeout) backtrace from call7a" ; return } + } # Continue; should stop at call7b and print actual arguments. # Print backtrace. @@ -633,43 +699,43 @@ proc shuffle_round_robin {} { if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - gdb_test "backtrace 100" " call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7b" + gdb_test "backtrace 100" ".* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7b" # Continue; should stop at call7c and print actual arguments. # Print backtrace. gdb_continue call7c - gdb_test "backtrace 100" " call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7c" + gdb_test "backtrace 100" ".* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7c" # Continue; should stop at call7d and print actual arguments. # Print backtrace. gdb_continue call7d - gdb_test "backtrace 100" " call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\).* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7d" + gdb_test "backtrace 100" ".* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7d" gdb_continue call7e - gdb_test "backtrace 100" " call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\).* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\).* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7e" + gdb_test "backtrace 100" ".* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7e" # Continue; should stop at call7f and print actual arguments. # Print backtrace. gdb_continue call7f - gdb_test "backtrace 100" " call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\).* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\).* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\).* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7f" + gdb_test "backtrace 100" ".* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7f" # Continue; should stop at call7g and print actual arguments. # Print backtrace. gdb_continue call7g - gdb_test "backtrace 100" " call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\).* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\).* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\).* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\).* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7g" + gdb_test "backtrace 100" ".* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\[\r\n\].* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7g" gdb_continue call7h - gdb_test "backtrace 100" " call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\).* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\).* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\).* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\).* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\).* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7h" + gdb_test "backtrace 100" ".* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\[\r\n\].* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\[\r\n\].* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7h" # monitor only allows 8 breakpoints; w89k board allows 10, so # break them up into two groups. @@ -683,14 +749,14 @@ proc shuffle_round_robin {} { gdb_continue call7i - gdb_test "backtrace 100" " call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\).* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\).* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\).* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\).* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\).* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\).* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7i" + gdb_test "backtrace 100" ".* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\[\r\n\].* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\[\r\n\].* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\[\r\n\].* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7i" # Continue; should stop at call7j and print actual arguments. # Print backtrace. gdb_continue call7j - gdb_test "backtrace 100" " call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\).* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\).* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\).* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\).* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\).* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\).* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\).* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7j" + gdb_test "backtrace 100" ".* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\[\r\n\].* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\[\r\n\].* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\[\r\n\].* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\[\r\n\].* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7j" # Continue; should stop at call7k and print actual arguments. # Print backtrace. @@ -698,7 +764,7 @@ proc shuffle_round_robin {} { gdb_continue call7k if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" } - gdb_test "backtrace 100" " call7k \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\).* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\).* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\).* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\).* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\).* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\).* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\).* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7k" + gdb_test "backtrace 100" ".* call7k \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\[\r\n\].* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\[\r\n\].* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\[\r\n\].* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\[\r\n\].* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7k" gdb_stop_suppressing_tests; } @@ -729,7 +795,7 @@ proc recursive_structs_by_value {} { # The a29k fails all of these tests, perhaps because the prologue # code is broken. setup_xfail "a29k-*-udi" - gdb_test "backtrace 100" " hitbottom \\(\\).* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\).* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\).* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\).* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\).* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\).* test_struct_args \\(\\).* main \\(.*\\).*" "recursive passing of structs by value" + gdb_test "backtrace 100" ".* hitbottom \\(\\) .*\[\r\n\].* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) .*\[\r\n\].* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) .*\[\r\n\].* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) .*\[\r\n\].* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) .*\[\r\n\].* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) .*\[\r\n\].* test_struct_args \\(\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\]" "recursive passing of structs by value" } else { fail "recursive passing of structs by value (sparclet)" } @@ -859,10 +925,12 @@ proc localvars_in_indirect_call { } { send_gdb "finish\n" gdb_expect { -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" { +#On hppa2.0w-hp-hpux11.00, gdb finishes at one line earlier than +#hppa1.1-hp-hpux11.00. Therefore, an extra "step" is necessary to continue the test. send_gdb "step\n" exp_continue } - -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" { + -re ".*\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" { pass "finish from indirectly called function" } -re ".*$gdb_prompt $" { @@ -922,7 +990,8 @@ proc test_stepping_over_trampolines { } { send_gdb "step\n" gdb_expect { -re "main .* at.*$gdb_prompt $" { - pass "stepping back to main from function called with trampolines" ; + pass "stepping back to main from function called with trampolines" ; + gdb_suppress_tests } -re "\}.*End of call_with_trampolines.*$gdb_prompt $" { send_gdb "step\n" diff --git a/gdb/testsuite/gdb.base/interrupt.c b/gdb/testsuite/gdb.base/interrupt.c index 120697b77e..a895d4b7d8 100644 --- a/gdb/testsuite/gdb.base/interrupt.c +++ b/gdb/testsuite/gdb.base/interrupt.c @@ -1,5 +1,7 @@ #include #include +#include +#include int main () { @@ -28,6 +30,7 @@ main () else write (1, &x, 1); } + return 0; } int diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp index 60cf83817c..379df02bc5 100644 --- a/gdb/testsuite/gdb.base/interrupt.exp +++ b/gdb/testsuite/gdb.base/interrupt.exp @@ -105,7 +105,14 @@ if ![file exists $binfile] then { fail "child died when we called func1, skipped rest of tests" return } - -re "$gdb_prompt $" { fail "call function when asleep (wrong output)" } + -re "$gdb_prompt $" { + # On HPUX-11.0 'send "p func1 ()"' above + # terminates the program. A defect is pending on this + # issue [defect #DTS CHFts24203]. Hence calling setup_xfail + # below. + setup_xfail "hppa*-*-*11*" + fail "call function when asleep (wrong output)" + } default { # This fail probably happens whenever we use /proc (we @@ -114,7 +121,6 @@ if ![file exists $binfile] then { setup_xfail "sparc*-*-solaris2*" setup_xfail "mips-*-ultrix*" - setup_xfail "hppa*-*-*" setup_xfail "i386*-*-bsd*" setup_xfail "i*86-*-solaris2*" setup_xfail "*-*-sysv4*" @@ -154,6 +160,9 @@ if ![file exists $binfile] then { # The optional leading \r\n is in case we sent a newline above # to wake the program, in which case the program now sends it # back. + # FIXME: The pattern below leads to an expected success on HPUX-11.0 + # but the success is spurious. Need to provide the right reg.expr. + # here. gdb_expect { -re "^(\r\n|)data\r\n(|data\r\n)$" { pass "echo data" } timeout { fail "echo data (timeout)" } diff --git a/gdb/testsuite/gdb.base/jump.c b/gdb/testsuite/gdb.base/jump.c index e16d0fd384..aae94f7e85 100644 --- a/gdb/testsuite/gdb.base/jump.c +++ b/gdb/testsuite/gdb.base/jump.c @@ -2,18 +2,23 @@ particularly deep about the functionality nor names in here. */ +#ifdef PROTOTYPES +static int square (int x) +#else static int square (x) int x; +#endif { return x*x; } -main () +int main () { int i = 99; i++; i = square (i); i--; + return 0; } diff --git a/gdb/testsuite/gdb.base/jump.exp b/gdb/testsuite/gdb.base/jump.exp index c110e21cf0..cca9094907 100644 --- a/gdb/testsuite/gdb.base/jump.exp +++ b/gdb/testsuite/gdb.base/jump.exp @@ -56,10 +56,10 @@ if ![runto_main] then { # Set a breakpoint on the statement that we're about to jump to. # The statement doesn't contain a function call. # -send_gdb "break 18\n" +send_gdb "break 22\n" set bp_on_non_call 0 gdb_expect { - -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 18.*$gdb_prompt $"\ + -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 22.*$gdb_prompt $"\ {set bp_on_non_call $expect_out(1,string) pass "break before jump to non-call"} -re "$gdb_prompt $"\ @@ -69,9 +69,9 @@ gdb_expect { # Can we jump to the statement? Do we stop there? # -send_gdb "jump 18\n" +send_gdb "jump 22\n" gdb_expect { - -re "Breakpoint \[0-9\]*, .*${srcfile}:18.*$gdb_prompt $"\ + -re "Breakpoint \[0-9\]*, .*${srcfile}:22.*$gdb_prompt $"\ {pass "jump to non-call"} -re "$gdb_prompt $"\ {fail "jump to non-call"} @@ -81,10 +81,10 @@ gdb_expect { # Set a breakpoint on the statement that we're about to jump to. # The statement does contain a function call. # -send_gdb "break 17\n" +send_gdb "break 21\n" set bp_on_call 0 gdb_expect { - -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 17.*$gdb_prompt $"\ + -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 21.*$gdb_prompt $"\ {set bp_on_call $expect_out(1,string) pass "break before jump to call"} -re "$gdb_prompt $"\ @@ -94,9 +94,9 @@ gdb_expect { # Can we jump to the statement? Do we stop there? # -send_gdb "jump 17\n" +send_gdb "jump 21\n" gdb_expect { - -re "Breakpoint \[0-9\]*, .*${srcfile}:17.*$gdb_prompt $"\ + -re "Breakpoint \[0-9\]*, .*${srcfile}:21.*$gdb_prompt $"\ {pass "jump to call"} -re "$gdb_prompt $"\ {fail "jump to call"} @@ -114,9 +114,9 @@ gdb_expect { timeout {fail "(timeout) disable breakpoint on call"} } -send_gdb "jump 17\n" +send_gdb "jump 21\n" gdb_expect { - -re "Breakpoint \[0-9\]*, .*${srcfile}:18.*$gdb_prompt $"\ + -re "Breakpoint \[0-9\]*, .*${srcfile}:22.*$gdb_prompt $"\ {pass "jump to call with disabled breakpoint"} -re "$gdb_prompt $"\ {fail "jump to call with disabled breakpoint"} @@ -138,7 +138,7 @@ gdb_expect { # Verify that GDB responds gracefully to the "jump" command with # trailing junk. # -send_gdb "jump 17 100\n" +send_gdb "jump 21 100\n" gdb_expect { -re "Junk at end of line specification: 100.*$gdb_prompt $"\ {pass "jump with trailing argument junk"} @@ -154,9 +154,9 @@ gdb_expect { # # Try it both ways: confirming and not confirming the jump. # -send_gdb "jump 8\n" +send_gdb "jump 12\n" gdb_expect { - -re "Line 8 is not in `main'. Jump anyway.*y or n. $"\ + -re "Line 12 is not in `main'. Jump anyway.*y or n. $"\ {send_gdb "n\n" gdb_expect { -re "Not confirmed.*$gdb_prompt $"\ @@ -171,9 +171,9 @@ gdb_expect { timeout {fail "(timeout) aborted jump out of current function"} } -send_gdb "jump 8\n" +send_gdb "jump 12\n" gdb_expect { - -re "Line 8 is not in `main'. Jump anyway.*y or n. $"\ + -re "Line 12 is not in `main'. Jump anyway.*y or n. $"\ {send_gdb "y\n" gdb_expect { -re "Continuing at.*$gdb_prompt $"\ diff --git a/gdb/testsuite/gdb.base/langs.exp b/gdb/testsuite/gdb.base/langs.exp index 464c79786e..9ed1e91a28 100644 --- a/gdb/testsuite/gdb.base/langs.exp +++ b/gdb/testsuite/gdb.base/langs.exp @@ -49,6 +49,8 @@ if { [gdb_compile "${binfile}0.o ${binfile}1.o ${binfile}2.o" ${binfile} execut gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +set oldtimeout $timeout +set timeout 10 @@ -63,12 +65,31 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load $binfile -gdb_test "b langs0" {Function "langs0" not defined\.} \ +gdb_test "b langs0" "Function \"langs0\" not defined\.|Breakpoint .* (deferred).*" \ "break on nonexistent function in langs.exp" +if {$hp_aCC_compiler} { + set isfixed 1 + set lang c\\+\\+ + set ext cxx + set foo_func foo__Fi__Fi + set do_func do::langs0 +} else { + if {$hp_cc_compiler} { + set isfixed 1 + set lang c + set ext c + } else { + set isfixed 0 + } + set foo_func foo__Fi + set do_func langs0__2do +} + if [runto csub] then { - gdb_test "show language" "currently c\".*" \ + if { !$isfixed } { set lang c } + gdb_test "show language" "currently $lang\".*" \ "show language at csub in langs.exp" # On some machines, foo doesn't get demangled because the N_SOL for # langs2.cxx is seen only after the function stab for foo. So @@ -76,36 +97,41 @@ if [runto csub] then { # even though only the latter is correct. I haven't tried to xfail it # because it depends on details of the compiler. - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } - gdb_test "bt" "#0.*csub.*#1.*(foo|foo__Fi) \\(.*#2.*cppsub_ .*#3.*fsub.*#4.*langs0__2do \\(.*#5 \[0-9a-fx\]* in main.*" "backtrace in langs.exp" + # Take out xfail. This test has been passing for some time now. + #if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } + gdb_test "bt" "#0.*csub.*#1.*(foo|$foo_func) \\(.*#2.*cppsub_ .*#3.*fsub.*#4.*$do_func \\(.*#5 \[0-9a-fx\]* in main.*" "backtrace in langs.exp" + if { !$isfixed } { set lang c\\+\\+; set ext cxx } if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } - gdb_test "up" ".* in (foo|foo__Fi) .* at langs2\\.cxx.*return csub \\(.*" \ + gdb_test "up" ".* in (foo|$foo_func).* at langs2\\.$ext.*return csub \\(.*" \ "up to foo in langs.exp" - gdb_test "show language" "currently c\\+\\+.*" \ + gdb_test "show language" "currently $lang.*" \ "show language at foo in langs.exp" if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } - gdb_test "up" ".* in cppsub_ .* at langs2\\.cxx.*return foo \\(.*" \ + gdb_test "up" ".* in cppsub_ .* at langs2\\.$ext.*return foo \\(.*" \ "up to cppsub_ in langs.exp" - gdb_test "show language" "currently c\\+\\+.*" \ + gdb_test "show language" "currently $lang.*" \ "show language at cppsub_ in langs.exp" + if { !$isfixed } { set lang fortran } if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } - gdb_test "up" ".* in fsub.* at langs1\\.f.*return \\(cppsub .*" \ + gdb_test "up" ".* in fsub.* at langs1\\.f.*" \ "up to fsub in langs.exp" - gdb_test "show language" "currently fortran.*" \ + gdb_test "show language" "currently $lang.*" \ "show language at fsub in langs.exp" - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } - gdb_test "up" ".* in langs0__2do .* at .*langs0\\.c.*return fsub.*" \ + # Take out xfail. This test has been passing for sometime now. + #if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } + if { !$isfixed } { set lang c } + gdb_test "up" ".* in $do_func .* at .*langs0\\.c.*return fsub.*" \ "up to langs0__2do in langs.exp" - gdb_test "show language" "currently c\".*" \ + gdb_test "show language" "currently $lang\".*" \ "show language at langs0__2do in langs.exp" gdb_test "up" ".* in main .* at .*langs0\\.c.*if \\(langs0__2do \\(.*" \ "up to main in langs.exp" - gdb_test "show language" "currently c\".*" \ + gdb_test "show language" "currently $lang\".*" \ "show language at main in langs.exp" if [target_info exists gdb,noresults] { return } @@ -119,4 +145,5 @@ if [runto csub] then { } } +set timeout $oldtimeout return 0 diff --git a/gdb/testsuite/gdb.base/langs0.c b/gdb/testsuite/gdb.base/langs0.c index 69c0ce8b0f..1477a324f9 100644 --- a/gdb/testsuite/gdb.base/langs0.c +++ b/gdb/testsuite/gdb.base/langs0.c @@ -1,8 +1,14 @@ /* This file is actually in C, it is not supposed to simulate something translated from another language or anything like that. */ +#ifdef PROTOTYPES +extern int fsub_(); + +int csub (int x) +#else int csub (x) int x; +#endif { return x + 1; } diff --git a/gdb/testsuite/gdb.base/langs1.c b/gdb/testsuite/gdb.base/langs1.c index 784225902c..8ffd13f084 100644 --- a/gdb/testsuite/gdb.base/langs1.c +++ b/gdb/testsuite/gdb.base/langs1.c @@ -16,14 +16,22 @@ static integer c__10000 = 10000; /* I am not sure whether there is a way to have a fortran program without */ /* a MAIN, but it does not really harm us to have one. */ +#ifdef PROTOTYPES +/* Main program */ void MAIN__() +#else /* Main program */ MAIN__() +#endif { } /* MAIN__ */ #line 4 "langs1.f" /* Subroutine */ int fsub_() { +#ifdef PROTOTYPES + extern integer cppsub_(int*); +#else extern integer cppsub_(); +#endif #line 5 "langs1.f" #line 6 "langs1.f" diff --git a/gdb/testsuite/gdb.base/langs2.c b/gdb/testsuite/gdb.base/langs2.c index be2a60cfbb..502b80063f 100644 --- a/gdb/testsuite/gdb.base/langs2.c +++ b/gdb/testsuite/gdb.base/langs2.c @@ -1,4 +1,20 @@ /* This is intended to be a vague simulation of cfront output. */ +#ifdef PROTOTYPES +#line 1 "langs2.cxx" +extern int csub (int); +int +foo__Fi (int x) +{ + return csub (x / 2); +} + +extern int cppsub_ (int *y); +int +cppsub_ (int * y) +{ + return foo__Fi (*y); +} +#else #line 1 "langs2.cxx" extern int csub (); int @@ -13,3 +29,4 @@ cppsub_ (y) int *y; { return foo__Fi (*y); } +#endif diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp index f597b9ad2c..3652be9d43 100644 --- a/gdb/testsuite/gdb.base/list.exp +++ b/gdb/testsuite/gdb.base/list.exp @@ -84,6 +84,8 @@ proc set_listsize { arg } { proc test_listsize {} { global gdb_prompt + global hp_cc_compiler + global hp_aCC_compiler # Show default size @@ -101,10 +103,10 @@ proc test_listsize {} { # Ensure we can limit printouts to one line - if [ set_listsize 1 ] then { - setup_xfail "*-*-*" + 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" - setup_xfail "*-*-*" + if {!$hp_cc_compiler && !$hp_aCC_compiler} { setup_xfail "*-*-*" } gdb_test "list 2" "2\[ \t\]+" "list line 2 with listsize 1" } @@ -113,7 +115,7 @@ proc test_listsize {} { if [ set_listsize 2 ] { gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 2" gdb_test "list 2" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 2 with listsize 2" - gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+" "list line 3 with listsize 2" + gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+" "list line 3 with listsize 2" } # Try small listsize > 1 that is an odd number @@ -121,18 +123,18 @@ 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" - setup_xfail "*-*-*" - gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+main \[)(\]+" "list line 2 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" - setup_xfail "*-*-*" - gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+main \[(\]+\[)\]+\r\n4\[ \t\]+\{" "list line 3 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" } # Try small listsize > 2 that is an even number. if [ set_listsize 4 ] then { gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 1 with listsize 4" - gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+main \[)(\]+" "list line 2 with listsize 4" + gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 2 with listsize 4" gdb_test "list 3" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 3 with listsize 4" gdb_test "list 4" "2\[ \t\]+\r\n.*5\[ \t\]+int x;.*" "list line 4 with listsize 4" @@ -141,9 +143,9 @@ proc test_listsize {} { # Try a size larger than the entire file. if [ set_listsize 100 ] then { - gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*\r\n42\[ \t\]+\}" "list line 1 with listsize 100" + gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*\r\n4\[23\]\[ \t\]+\}" "list line 1 with listsize 100" - gdb_test "list 10" "1\[ \t\]+#include \"list0.h\".*\r\n42\[ \t\]+\}" "list line 10 with listsize 100" + gdb_test "list 10" "1\[ \t\]+#include \"list0.h\".*\r\n4\[23\]\[ \t\]+\}" "list line 10 with listsize 100" } # Try listsize of 0 which suppresses printing. @@ -168,12 +170,12 @@ proc test_list_include_file {} { setup_xfail "a29k-*-udi" setup_xfail_format "DWARF 1" setup_xfail_format "COFF" - gdb_test "list list0.h:1" "1\[ \t\]+/\[*\]+ An include file .*5\[ \t\]+foo \[(\]+x\[)\]+" "list line 1 in include file" + gdb_test "list list0.h:1" "1\[ \t\]+/\[*\]+ An include file .*4\[ \t\]+.*foo \(.*x.*\).*" "list line 1 in include file" setup_xfail "a29k-*-udi" setup_xfail_format "DWARF 1" setup_xfail_format "COFF" - gdb_test "list list0.h:100" "Line number 95 out of range; .*list0.h has 36 lines." "list message for lines past EOF" + gdb_test "list list0.h:100" "Line number 95 out of range; .*list0.h has 3\[67\] lines." "list message for lines past EOF" } # @@ -203,7 +205,7 @@ proc test_list_filename_and_number {} { } send_gdb "list list1.c:1\n" gdb_expect { - -re "1\[ \t\]+void.*5\[ \t\]+printf \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { + -re "1\[ \t\]+\#include.*4\[ \t\]+.*int oof\[ \t\]*\(.*\);\r\n.*$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list list1.c:1" ; gdb_suppress_tests } @@ -211,7 +213,7 @@ proc test_list_filename_and_number {} { } send_gdb "list list1.c:12\n" gdb_expect { - -re "7\[ \t\]+long_line \[(\]+.*\[)\]+;.*14\[ \t\]+\}\r\n.*$gdb_prompt $" { + -re "12\[ \t\]+long_line \[(\]+.*\[)\]+;.*13\[ \t\]+\}\r\n.*$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list list1.c:12" ; gdb_suppress_tests } @@ -237,7 +239,7 @@ proc test_list_function {} { # Ultrix gdb takes the second case below; it's also correct. # SunPRO cc is the third case. - gdb_test "list bar" "(1\[ \t\]+void.*7\[ \t\]*long_line ..;.*9\[ \t\]*|1\[ \t\]+void.*8\[ \t\]+\}|1\[ \t\]+void.*7\[ \t\]*long_line ..;)" "list function in source file 2" + gdb_test "list bar" "(4\[ \t\]+void.*\[ \t\]*long_line.*;.*bar.*9\[ \t\]*.*|1\[ \t\]+void.*8\[ \t\]+\}|1\[ \t\]+void.*7\[ \t\]*long_line ..;|7\[ \t\]+void.*14\[ \t\]+\})" "list function in source file 2" # Test "list function" for C include file # Ultrix gdb is the second case, still correct. @@ -275,7 +277,7 @@ proc test_list_forward {} { send_gdb "list\n" gdb_expect { - -re "35\[ \t\]+foo \[(\]+.*\[)\]+;.*42\[ \t\]+\}\r\n$gdb_prompt $" { incr testcnt } + -re "35\[ \t\]+foo \\(.*\\);.*42\[ \t\]+.*\}\r\n$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list 35-42" ; gdb_suppress_tests } timeout { fail "list 35-42 (timeout)" ; gdb_suppress_tests } } @@ -291,7 +293,7 @@ proc test_list_backwards {} { send_gdb "list list0.c:33\n" gdb_expect { - -re "28\[ \t\]+foo \[(\]+.*\[)\]+;.*37\[ \t\]+\r\n$gdb_prompt $" { incr testcnt } + -re "28\[ \t\]+foo \\(.*\\);.*37\[ \t\]+\}\r\n$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list list0.c:33" ; gdb_suppress_tests } timeout { fail "list list0.c:33 (timeout)" ; gdb_suppress_tests } } @@ -328,17 +330,17 @@ proc test_list_backwards {} { proc test_list_range {} { global gdb_prompt - gdb_test "list list0.c:2,list0.c:5" "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+.*5\[ \t\]+int x;" "list range; filename:line1,filename:line2" + gdb_test "list list0.c:2,list0.c:5" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+.*5\[ \t\]+int x;" "list range; filename:line1,filename:line2" - gdb_test "list 2,5" "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+.*5\[ \t\]+int x;" "list range; line1,line2" + gdb_test "list 2,5" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+.*5\[ \t\]+int x;" "list range; line1,line2" # gdb_test "list -1,6" "Line number 0 out of range; .*list0.c has 39 lines." "list range; lower bound negative" # gdb_test "list -100,-40" "Line number -60 out of range; .*list0.c has 39 lines." "list range; both bounds negative" - gdb_test "list 30,43" "30\[ \t\]+foo \[(\]+.*\[)\]+;.*42\[ \t\]+\}" "list range; upper bound past EOF" + gdb_test "list 30,45" "30\[ \t\]+foo \(.*\);.*43\[ \t\]+\}" "list range; upper bound past EOF" - gdb_test "list 43,100" "Line number 43 out of range; .*list0.c has 42 lines." "list range; both bounds past EOF" + gdb_test "list 45,100" "Line number 45 out of range; .*list0.c has 43 lines." "list range; both bounds past EOF" gdb_test "list list0.c:2,list1.c:17" "Specified start and end are in different files." "list range, must be same files" } @@ -375,7 +377,7 @@ proc test_list_filename_and_function {} { setup_xfail "rs6000-*-aix*" send_gdb "list list0.c:unused\n" gdb_expect { - -re "36\[ \t\]+\}.*42\[ \t\]+\}\r\n$gdb_prompt $" { + -re "40\[ \t\]+unused.*43\[ \t\]+\}\r\n$gdb_prompt $" { incr testcnt } -re "37.*42\[ \t\]+\}\r\n$gdb_prompt $" { @@ -417,13 +419,13 @@ proc test_list_filename_and_function {} { # a29k-amd-udi is the third case. send_gdb "list list1.c:bar\n" gdb_expect { - -re "1\[ \t\]+void.*8\[ \t\]+\}\r\n$gdb_prompt $" { + -re "4\[ \t\]+void.*13\[ \t\]+\}\r\n$gdb_prompt $" { incr testcnt } - -re "1\[ \t\]+void.*7\[ \t\]*long_line ..;\r\n$gdb_prompt $" { + -re "4\[ \t\]+void.*12\[ \t\]*long_line ..;\r\n$gdb_prompt $" { incr testcnt } - -re "1\[ \t\]+void.*9\[ \t\]*\r\n$gdb_prompt $" { + -re "4\[ \t\]+void.*11\[ \t\]*\r\n$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list list1.c:bar" } @@ -437,10 +439,10 @@ proc test_list_filename_and_function {} { setup_xfail "rs6000-*-aix*" send_gdb "list list1.c:unused\n" gdb_expect { - -re "7\[ \t\]+long_line \[(\]\[)\];.*14\[ \t\]+\}\r\n.*$gdb_prompt $" { + -re "12\[ \t\]+long_line \[(\]\[)\];.*13\[ \t\]+\}\r\n.*$gdb_prompt $" { incr testcnt } - -re "9.*14\[ \t\]+\}\r\n.*$gdb_prompt $" { + -re "14.*19\[ \t\]+\}\r\n.*$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list list1.c:unused" } @@ -463,10 +465,10 @@ proc test_list_filename_and_function {} { gdb_test "list list0.c:foo" "Function \"foo\" not defined in .*list0.c" "list filename:function; wrong filename rejected" - gdb_test "list foobar.c:main" "No source file named foobar.c." "list filename:function; nonexistant file" + gdb_test "list foobar.c:main" "No source file named foobar.c.|Location not found" "list filename:function; nonexistant file" setup_xfail_format "DWARF 1" - gdb_test "list list0.h:foobar" "Function \"foobar\" not defined." "list filename:function; nonexistant function" + gdb_test "list list0.h:foobar" "Function \"foobar\" not defined.|Location not found" "list filename:function; nonexistant function" } @@ -478,11 +480,11 @@ proc test_forward_search {} { # lines 20-23. This depends on whether the line number of a function # is considered to be the openbrace or the first statement--either one # is acceptable. - gdb_test "list long_line" "20\[ \t\]+long_line .*" + gdb_test "list long_line" "24\[ \t\]+long_line .*" gdb_test "search 4321" " not found" - gdb_test "search 6789" "24\[ \t\]+oof .6789.;" + gdb_test "search 6789" "28\[ \t\]+oof .6789.;" # Test that GDB won't crash if the line being searched is extremely long. @@ -519,3 +521,5 @@ if [ set_listsize 10 ] then { test_list_filename_and_function test_forward_search } + +remote_exec build "rm -f list0.h" diff --git a/gdb/testsuite/gdb.base/list0.c b/gdb/testsuite/gdb.base/list0.c index a5561a766a..b50fdd4323 100644 --- a/gdb/testsuite/gdb.base/list0.c +++ b/gdb/testsuite/gdb.base/list0.c @@ -1,6 +1,6 @@ #include "list0.h" -main () +int main () { int x; #ifdef usestubs @@ -33,6 +33,7 @@ main () foo (x++); foo (x++); foo (x++); + return 0; } static void diff --git a/gdb/testsuite/gdb.base/list1.c b/gdb/testsuite/gdb.base/list1.c index 51632b94d0..6094104b9c 100644 --- a/gdb/testsuite/gdb.base/list1.c +++ b/gdb/testsuite/gdb.base/list1.c @@ -1,6 +1,11 @@ -void -bar (x) -int x; +#include + +#ifdef PROTOTYPES +void long_line (); int oof (int); +void bar (int x) +#else +void bar (x) int x; +#endif { printf ("%d\n", x); @@ -12,11 +17,10 @@ unused () { /* Not used for anything */ } - - -/* This routine has a very long line that will break searching in older - versions of GDB. */ - +/* This routine has a very long line that will break searching in older versions of GDB. */ +#ifdef PROTOTYPES +void +#endif long_line () { oof (67); @@ -25,9 +29,11 @@ long_line () oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 5 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 10 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 15 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 20 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 25 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 30 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 35 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 40 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 45 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 50 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 55 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 60 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 65 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (1234); /* 70 */ } - -oof (n) - int n; +#ifdef PROTOTYPES +int oof (int n) +#else +oof (n) int n; +#endif { return n + 1; } diff --git a/gdb/testsuite/gdb.base/logical.exp b/gdb/testsuite/gdb.base/logical.exp index 0458e61cb1..9d410c6f61 100644 --- a/gdb/testsuite/gdb.base/logical.exp +++ b/gdb/testsuite/gdb.base/logical.exp @@ -44,7 +44,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } - +if [get_compiler_info ${binfile}] { + return -1; +} gdb_exit gdb_start @@ -102,7 +104,7 @@ gdb_expect { send_gdb "print x && y\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of xy" } -re ".*$gdb_prompt $" { fail "print value of x>y" } @@ -133,7 +135,7 @@ gdb_test "set variable y=1" "" "set variable y=1" send_gdb "print x && y\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of xy" } -re ".*$gdb_prompt $" { fail "print value of x>y" } @@ -186,7 +188,7 @@ gdb_test "set variable y=0" "" "set variable y=0" send_gdb "print x && y\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x y || w == z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x > y || w == z" } -re ".*$gdb_prompt $" { fail "print value of x > y || w == z" } @@ -533,7 +535,7 @@ gdb_test "set variable z=3" "" "set variable z=3" send_gdb "print x >= y && w != z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x >= y || w != z" } -re ".*$gdb_prompt $" { fail "print value of x >= y || w != z" } @@ -550,7 +552,7 @@ gdb_test "set variable z=3" "" "set variable z=3" send_gdb "print ! x > y || w + z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x > y || w != z" } -re ".*$gdb_prompt $" { fail "print value of x > y || w != z" } diff --git a/gdb/testsuite/gdb.base/long_long.c b/gdb/testsuite/gdb.base/long_long.c index 096528d1d2..a76e2792ab 100644 --- a/gdb/testsuite/gdb.base/long_long.c +++ b/gdb/testsuite/gdb.base/long_long.c @@ -7,8 +7,12 @@ * cc +e +DA2.0 -g -o long_long long_long.c */ +#ifdef PROTOTYPES +long long callee(long long i) +#else long long callee( i ) long long i; +#endif { register long long result; @@ -32,6 +36,8 @@ int known_types() /* Stop here and look! */ hex = bin - dec | oct; + + return 0; } int main() { diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp index aca59c2e54..52e6ff593a 100644 --- a/gdb/testsuite/gdb.base/long_long.exp +++ b/gdb/testsuite/gdb.base/long_long.exp @@ -35,20 +35,14 @@ if [get_compiler_info ${binfile}] { return -1 } -if {$gcc_compiled == 0} { - if [istarget "hppa*-hp-hpux*"] then { - ### FIXME +e only works with HP's compiler - set additional_flags "additional_flags=+e -w" - } else { - # don't know what the compiler is, hope it supports long long! - set additional_flags "additional_flags=-w" - } +if {$hp_cc_compiler} { + set flag "+e" } else { - set additional_flags "additional_flags=-w" + set flag "" } -if { [gdb_compile "${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +if { [gdb_compile "${srcfile}" "${binfile}" executable [concat debug "additional_flags=$flag -w"]] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } # use this to debug: @@ -64,35 +58,40 @@ if { ![runto known_types] } then { return } -gdb_test "n 4" ".*34.*" "get to known place" +gdb_test "n 4" ".*38.*" "get to known place" # Check the hack for long long prints. # -gdb_test "p/x hex" ".*0x0.*" "default print hex" -gdb_test "p/x dec" ".*0xab54a98ceb1f0ad2.*" "default print dec" -gdb_test "p/x bin" ".*0x123456789abcdef.*" "default print bin" -gdb_test "p/x oct" ".*0xa72ee53977053977.*" "default print oct" - -gdb_test "p/x hex" ".*0x0.*" "hex print" -gdb_test "p/u dec" ".*12345678901234567890.*" "decimal print" -gdb_test "p/t bin" ".*100100011010001010110011110001001101010111100110111101111.*" "binary print" +gdb_test "p/x hex" ".*0x0*0.*" "hex print p/x" +gdb_test "p/x dec" ".*0xab54a98ceb1f0ad2.*" "decimal print p/x" +# see if 'p/' is handled same as 'p /' +# +gdb_test "p /x dec" ".*0xab54a98ceb1f0ad2.*" "default print dec" +gdb_test "p /x bin" ".*0x0*123456789abcdef.*" "default print bin" +gdb_test "p /x oct" ".*0xa72ee53977053977.*" "default print oct" +gdb_test "p hex" ".*= 0*x*0*0.*" "default print hex" + +gdb_test "p/u dec" ".*12345678901234567890.*" "decimal print p/u" +gdb_test "p/t bin" ".*0*100100011010001010110011110001001101010111100110111101111.*" "binary print" gdb_test "p/o oct" ".*01234567123456701234567.*" "octal print" +gdb_test "p /d bin" ".*81985529216486895.*" "print +ve long long" +gdb_test "p/d dec" ".*-6101065172474983726.*" "decimal print p/d" # Try all the combinations to bump up coverage. # gdb_test "p/d oct" ".*12046818088235383159.*" "" -gdb_test "p/u oct" ".*0xa72ee53977053977.*" "" +gdb_test "p/u oct" ".*12046818088235383159.*" "" gdb_test "p/o oct" ".*.*" "" gdb_test "p/t oct" ".*1010011100101110111001010011100101110111000001010011100101110111.*" "" -gdb_test "p/a oct" ".*That operation is not available.*" "" -gdb_test "p/c oct" ".*0xa72ee53977053977.*" "" +gdb_test "p/a oct" ".*0x.*77053977.*" "" +gdb_test "p/c oct" ".*'w'.*" "" gdb_test "p/f oct" ".*-5.9822653797615723e-120.*" "" gdb_test "p/d *(int *)&oct" ".*-1490098887.*" "" gdb_test "p/u *(int *)&oct" ".*2804868409.*" "" gdb_test "p/o *(int *)&oct" ".*024713562471.*" "" gdb_test "p/t *(int *)&oct" ".*10100111001011101110010100111001.*" "" -gdb_test "p/a *(int *)&oct" ".*0xa72ee539.*" "" +gdb_test "p/a *(int *)&oct" ".*0xf*a72ee539.*" "" gdb_test "p/c *(int *)&oct" ".*57 '9'.*" "" gdb_test "p/f *(int *)&oct" ".*-2.42716126e-15.*" "" @@ -100,9 +99,9 @@ gdb_test "p/d *(short *)&oct" ".*-22738.*" "" gdb_test "p/u *(short *)&oct" ".*42798.*" "" gdb_test "p/o *(short *)&oct" ".*0123456.*" "" gdb_test "p/t *(short *)&oct" ".*1010011100101110.*" "" -gdb_test "p/a *(short *)&oct" ".*0xffffa72e.*" "" +gdb_test "p/a *(short *)&oct" ".*0xf*ffffa72e.*" "" gdb_test "p/c *(short *)&oct" ".* 46 '.'.*" "" -gdb_test "p/a **short *)&oct" ".*0xffffa72e <.*" "" +gdb_test "p/a *(short *)&oct" ".*0xf*ffffa72e.*" "" gdb_test "p/f *(short *)&oct" ".*-22738.*" "" gdb_test "x/x &oct" ".*0xa72ee539.*" "" @@ -110,8 +109,8 @@ gdb_test "x/d &oct" ".*.-1490098887*" "" gdb_test "x/u &oct" ".*2804868409.*" "" gdb_test "x/o &oct" ".*024713562471.*" "" gdb_test "x/t &oct" ".*10100111001011101110010100111001.*" "" -gdb_test "x/a &oct" ".*0xa72ee539 <.*" "" -gdb_test "x/c &oct" ".*-89 'M-''.*" "" +gdb_test "x/a &oct" ".*0xa72ee539.*" "" +gdb_test "x/c &oct" ".*-89 '\\\\247'.*" "" gdb_test "x/f &oct" ".*-5.9822653797615723e-120.*" "" gdb_test "x/2x &oct" ".*.*" "" diff --git a/gdb/testsuite/gdb.base/mips_pro.c b/gdb/testsuite/gdb.base/mips_pro.c index d2d1884b9c..b659d82ded 100644 --- a/gdb/testsuite/gdb.base/mips_pro.c +++ b/gdb/testsuite/gdb.base/mips_pro.c @@ -1,15 +1,25 @@ /* Tests regarding examination of prologues. */ +#ifdef PROTOTYPES +int +inner (int z) +#else int inner (z) int z; +#endif { return 2 * z; } +#ifdef PROTOTYPES +int +middle (int x) +#else int middle (x) int x; +#endif { if (x == 0) return inner (5); @@ -17,15 +27,27 @@ middle (x) return inner (6); } +#ifdef PROTOTYPES +int +top (int y) +#else int top (y) int y; +#endif { return middle (y + 1); } +#ifdef PROTOTYPES +int +main (int argc, char **argv) +#else int main (argc, argv) + int argc; + char **argv; +#endif { #ifdef usestubs set_debug_traps(); diff --git a/gdb/testsuite/gdb.base/mips_pro.exp b/gdb/testsuite/gdb.base/mips_pro.exp index 2b94de674d..ea2461e5f0 100644 --- a/gdb/testsuite/gdb.base/mips_pro.exp +++ b/gdb/testsuite/gdb.base/mips_pro.exp @@ -55,7 +55,7 @@ gdb_load ${binfile} if [runto middle] then { # PR 3016 if {$gcc_compiled} then { - setup_xfail "mips*-sgi-irix4*" "mips64*-*-elf" + setup_xfail "hppa*-*-*" "mips*-sgi-irix4*" "mips64*-*-elf" } gdb_test "backtrace" "#0.*middle.*#1.*top.*#2.*main.*" } diff --git a/gdb/testsuite/gdb.base/miscexprs.exp b/gdb/testsuite/gdb.base/miscexprs.exp index d42e5abbfb..97784232c4 100644 --- a/gdb/testsuite/gdb.base/miscexprs.exp +++ b/gdb/testsuite/gdb.base/miscexprs.exp @@ -44,6 +44,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +if [get_compiler_info ${binfile}] { + return -1; +} gdb_exit gdb_start @@ -90,6 +93,9 @@ gdb_expect { -re ".\[0-9\]* = $hex \"\".*$gdb_prompt $" { pass "print value of &cbig.c\[0\]" } + -re ".\[0-9\]* = $hex \"*\".*$gdb_prompt $" { + pass "print value of &cbig.c\[0\]" + } -re ".*$gdb_prompt $" { fail "print value of &cbig.c\[0\]" } timeout { fail "(timeout) print value of &cbig.c\[0\]" } } @@ -158,7 +164,7 @@ gdb_expect { send_gdb "print !ibig.i\[100\]\n" gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { + -re ".\[0-9\]* = $false.*$gdb_prompt $" { pass "print value of !ibig.i\[100\]" } -re ".*$gdb_prompt $" { fail "print value of !ibig.i\[100\]" } @@ -167,7 +173,7 @@ gdb_expect { send_gdb "print !sbig.s\[90\]\n" gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { + -re ".\[0-9\]* = $false.*$gdb_prompt $" { pass "print value of !sbig.s\[90\]" } -re ".*$gdb_prompt $" { fail "print value of !sbig.s\[90\]" } @@ -177,7 +183,7 @@ gdb_expect { send_gdb "print !fbig.f\[100\]\n" gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { + -re ".\[0-9\]* = $false.*$gdb_prompt $" { pass "print value of !ibig.i\[100\]" } -re ".*$gdb_prompt $" { fail "print value of !ibig.i\[100\]" } @@ -186,7 +192,7 @@ gdb_expect { send_gdb "print !dbig.d\[202\]\n" gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { + -re ".\[0-9\]* = $false.*$gdb_prompt $" { pass "print value of !ibig.i\[100\]" } -re ".*$gdb_prompt $" { fail "print value of !ibig.i\[100\]" } @@ -224,7 +230,7 @@ gdb_expect { send_gdb "print !(sbig.s\[90\] * 2)\n" gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { + -re ".\[0-9\]* = $false.*$gdb_prompt $" { pass "print value of !(sbig.s\[90\] * 2)" } -re ".*$gdb_prompt $" { fail "print value of !(sbig.s\[90\] * 2)" } @@ -252,6 +258,18 @@ gdb_expect { } +if [istarget "hppa2.0w*-*-*"] then { +send_gdb "print sizeof(lbig)\n" +gdb_expect { + -re ".\[0-9\]* = 7200.*$gdb_prompt $" { + pass "print value of sizeof(lbig)" + } + -re ".*$gdb_prompt $" { fail "print value of sizeof(lbig)" } + timeout { fail "(timeout) print value of sizeof(lbig)" } + } +} + +if ![istarget "hppa2.0w*-*-*"] then { send_gdb "print sizeof(lbig)\n" gdb_expect { -re ".\[0-9\]* = 3600.*$gdb_prompt $" { @@ -260,6 +278,7 @@ gdb_expect { -re ".*$gdb_prompt $" { fail "print value of sizeof(lbig)" } timeout { fail "(timeout) print value of sizeof(lbig)" } } +} send_gdb "print ibig.i\[100\] << 2\n" gdb_expect { diff --git a/gdb/testsuite/gdb.base/nodebug.c b/gdb/testsuite/gdb.base/nodebug.c index 4aad099e56..3e0a4ce786 100644 --- a/gdb/testsuite/gdb.base/nodebug.c +++ b/gdb/testsuite/gdb.base/nodebug.c @@ -1,3 +1,4 @@ +#include /* Test that things still (sort of) work when compiled without -g. */ int dataglobal = 3; /* Should go in global data */ @@ -5,31 +6,51 @@ static int datalocal = 4; /* Should go in local data */ int bssglobal; /* Should go in global bss */ static int bsslocal; /* Should go in local bss */ +#ifdef PROTOTYPES +int +inner (int x) +#else int inner (x) int x; +#endif { return x + dataglobal + datalocal + bssglobal + bsslocal; } +#ifdef PROTOTYPES +static short +middle (int x) +#else static short middle (x) int x; +#endif { return 2 * inner (x); } +#ifdef PROTOTYPES +short +top (int x) +#else short top (x) int x; +#endif { return 2 * middle (x); } +#ifdef PROTOTYPES +int +main (int argc, char **argv) +#else int main (argc, argv) int argc; char **argv; +#endif { #ifdef usestubs set_debug_traps(); @@ -38,14 +59,16 @@ main (argc, argv) return top (argc); } -char *malloc (); - int *x; +#ifdef PROTOTYPES +int array_index (char *arr, int i) +#else int array_index (arr, i) char *arr; int i; +#endif { /* The basic concept is just "return arr[i];". But call malloc so that gdb will be able to call functions. */ diff --git a/gdb/testsuite/gdb.base/nodebug.exp b/gdb/testsuite/gdb.base/nodebug.exp index e4f8a355d2..684476ee0d 100644 --- a/gdb/testsuite/gdb.base/nodebug.exp +++ b/gdb/testsuite/gdb.base/nodebug.exp @@ -72,28 +72,28 @@ if [runto inner] then { if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" } gdb_test "p top" \ - "{(<(text variable|function), no debug info>|short \\(\\))} \[0-9a-fx]* " + "\{(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))\} \[0-9a-fx]* " if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" } gdb_test "whatis top" \ - "(<(text variable|function), no debug info>|short \\(\\))" + "(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))" if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" } - gdb_test "ptype top" "(short|int) \\((||, )\\)" + gdb_test "ptype top" "(short|int) \\((|void|int||, )\\)" if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" } setup_xfail "mips-sgi-irix6*" gdb_test "p middle" \ - "{(<(text variable|function), no debug info>|short \\(\\))} \[0-9a-fx]* " + "\{(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))\} \[0-9a-fx]* " if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" } setup_xfail "mips-sgi-irix6*" gdb_test "whatis middle" \ - "(<(text variable|function), no debug info>|short \\(\\))" + "(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))" setup_xfail "mips-sgi-irix6*" - gdb_test "ptype middle" "(short|int) \\((||, )\\)" + gdb_test "ptype middle" "(short|int) \\((|void|int||, )\\)" gdb_test "p dataglobal" "= 3" gdb_test "whatis dataglobal" \ - "<(data variable|variable), no debug info>" - gdb_test "ptype dataglobal" "<(data variable|variable), no debug info>" + "<(data variable|variable), no debug info>|int" + gdb_test "ptype dataglobal" "<(data variable|variable), no debug info>|int" # The only symbol xcoff puts out for statics is for the TOC entry. # Possible, but hairy, for gdb to deal. Right now it doesn't, it @@ -115,8 +115,8 @@ if [runto inner] then { gdb_test "ptype datalocal" "<(data variable|variable), no debug info>" gdb_test "p bssglobal" "= 0" - gdb_test "whatis bssglobal" "<(data variable|variable), no debug info>" - gdb_test "ptype bssglobal" "<(data variable|variable), no debug info>" + gdb_test "whatis bssglobal" "<(data variable|variable), no debug info>|int" + gdb_test "ptype bssglobal" "<(data variable|variable), no debug info>|int" setup_xfail "rs6000*-*-aix*" setup_xfail "powerpc*-*-aix*" @@ -145,12 +145,27 @@ if [runto inner] then { # This test is not as obscure as it might look. `p getenv ("TERM")' # is a real-world example, at least on many systems. - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" "mips-sgi-irix6*" } + if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" } if [target_info exists gdb,cannot_call_functions] { setup_xfail "*-*-*" 2416 fail "p/c array_index(\"abcdef\",2)" } else { - gdb_test {p/c array_index("abcdef",2)} " = 99 'c'" + # + # On HP-UX, a support function (__d_plt_call) necessary to + # implement an inferior call is normally only available when + # the inferior was compiled with -g. Thus, we expect this + # testpoint to fail on HP-UX. + if { [istarget "hppa*-hpux*"] } { + send_gdb "p/c array_index(\"abcdef\",2)\n" + gdb_expect { + -re ".*Suggest linking executable with -g.*$gdb_prompt $" { pass "p/c array_index(\"abcdef\",2)" } + -re ".*Cannot find __wdb_call_dummy in.*end.o.*" { pass "p/c array_index(\"abcdef\",2)" } + -re ".*99 'c'.*" { pass "p/c array_index(\"abcdef\",2)" } + timeout { fail "(timeout) p/c array_index" } + } + } else { + gdb_test {p/c array_index("abcdef",2)} " = 99 'c'" + } } # Now, try that we can give names of file-local symbols which happen diff --git a/gdb/testsuite/gdb.base/opaque.exp b/gdb/testsuite/gdb.base/opaque.exp index 92e6459831..a3bc26f34f 100644 --- a/gdb/testsuite/gdb.base/opaque.exp +++ b/gdb/testsuite/gdb.base/opaque.exp @@ -106,7 +106,7 @@ gdb_test "whatis foop" \ # Ensure that we know the form of the structure that foop points to. setup_xfail_on_opaque_pointer -if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "hppa*-*-hpux*" } +if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } gdb_test "ptype foop" \ "type = struct foo \{\[\r\n\]+ int a;\[\r\n\]+ int b;\[\r\n\]+\} \[*\]+" \ "ptype on opaque struct pointer (statically)" @@ -167,7 +167,7 @@ gdb_test "whatis foop" \ # Ensure that we know the form of the thing foop points to. setup_xfail_on_opaque_pointer -if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "hppa*-*-hpux*" } +if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } gdb_test "ptype foop" \ "type = struct foo \{\[\r\n\]+ int a;\[\r\n\]+ int b;\[\r\n\]+\} \[*\]+" \ "ptype on opaque struct pointer (dynamically) 1" @@ -181,7 +181,7 @@ gdb_test "whatis afoo" \ gdb_test "ptype afoo" \ "type = struct foo \{\[\r\n\]+ int a;\[\r\n\]+ int b;\[\r\n\]+\}" \ - "ptype on opaque struct instance (dynamically) 1" + "ptype on opaque struct instance (dynamically) xyz 1" # Ensure that we know the form of an explicit struct foo. @@ -220,7 +220,29 @@ gdb_test "whatis foop" \ # Ensure that we know the form of the thing foop points to. setup_xfail_on_opaque_pointer -if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "hppa*-*-hpux*" } +if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } +gdb_test "ptype foop" \ + "type = struct foo \{\[\r\n\]+ int a;\[\r\n\]+ int b;\[\r\n\]+\} \[*\]+" \ + "ptype on opaque struct pointer (dynamically) 2" + +gdb_test "whatis afoo" \ + "type = struct foo" \ + "whatis on opaque struct instance (dynamically) 1" + + +# Ensure that we know the form of afoo, an instance of a struct foo. + +gdb_test "ptype afoo" \ + "type = struct foo \{\r\n int a;\r\n int b;\r\n\}" \ + "ptype on opaque struct instance (dynamically) 1" + +gdb_test "ptype afoo" \ + "type = struct foo \{\[\r\n\]*.*int a;\[\r\n\]*.*int b;\[\r\n\]*}\[\r\n\]*" \ + "ptype on opaque struct instance (dynamically) pqr 1" + + +# Ensure that we know the form of an explicit struct foo. + gdb_test "ptype foop" \ "type = struct foo \{\[\r\n\]+ int a;\[\r\n\]+ int b;\[\r\n\]+\} \[*\]+" \ "ptype on opaque struct pointer (dynamically) 2" diff --git a/gdb/testsuite/gdb.base/opaque0.c b/gdb/testsuite/gdb.base/opaque0.c index c6e239e4ac..5ec4a2aa08 100644 --- a/gdb/testsuite/gdb.base/opaque0.c +++ b/gdb/testsuite/gdb.base/opaque0.c @@ -7,6 +7,9 @@ struct foo *foop; extern struct foo *getfoo (); +#ifdef PROTOTYPES +extern void putfoo (struct foo *foop); +#endif int main () { diff --git a/gdb/testsuite/gdb.base/opaque1.c b/gdb/testsuite/gdb.base/opaque1.c index 4a3c8559b8..c34f7aaaae 100644 --- a/gdb/testsuite/gdb.base/opaque1.c +++ b/gdb/testsuite/gdb.base/opaque1.c @@ -8,7 +8,7 @@ struct foo *getfoo () return (&afoo); } -#ifdef __STDC__ +#ifdef PROTOTYPES void putfoo (struct foo *foop) #else void putfoo (foop) diff --git a/gdb/testsuite/gdb.base/pointers.exp b/gdb/testsuite/gdb.base/pointers.exp index 7a0e44f357..6b9f1350d5 100644 --- a/gdb/testsuite/gdb.base/pointers.exp +++ b/gdb/testsuite/gdb.base/pointers.exp @@ -43,6 +43,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +if [get_compiler_info ${binfile}] { + return -1; +} gdb_exit gdb_start @@ -153,7 +156,7 @@ gdb_expect { send_gdb "print v_int_pointer == v_int_pointer2\n" gdb_expect { - -re ".*= 0.*$gdb_prompt $" { + -re ".*= $false.*$gdb_prompt $" { pass "pointer1==pointer2" } -re ".*$gdb_prompt $" { fail "pointer1==pointer2" } @@ -162,7 +165,7 @@ gdb_expect { send_gdb "print v_int_pointer != v_int_pointer2\n" gdb_expect { - -re ".*= 1.*$gdb_prompt $" { + -re ".*= $true.*$gdb_prompt $" { pass "pointer1!=pointer2" } -re ".*$gdb_prompt $" { fail "pointer1!=pointer2" } @@ -172,7 +175,7 @@ gdb_expect { send_gdb "print v_int_pointer <= v_int_pointer2\n" gdb_expect { - -re ".*= 1.*$gdb_prompt $" { + -re ".*= $true.*$gdb_prompt $" { pass "pointer1<=pointer2" } -re ".*$gdb_prompt $" { fail "pointer1<=pointer2" } @@ -182,7 +185,7 @@ gdb_expect { send_gdb "print v_int_pointer >= v_int_pointer2\n" gdb_expect { - -re ".*= 0.*$gdb_prompt $" { + -re ".*= $false.*$gdb_prompt $" { pass "pointer1>=pointer2" } -re ".*$gdb_prompt $" { fail "pointer1>=pointer2" } @@ -192,7 +195,7 @@ gdb_expect { send_gdb "print v_int_pointer < v_int_pointer2\n" gdb_expect { - -re ".*= 1.*$gdb_prompt $" { + -re ".*= $true.*$gdb_prompt $" { pass "pointer1 v_int_pointer2\n" gdb_expect { - -re ".*= 0.*$gdb_prompt $" { + -re ".*= $false.*$gdb_prompt $" { pass "pointer1>pointer2" } -re ".*$gdb_prompt $" { fail "pointer1>pointer2" } diff --git a/gdb/testsuite/gdb.base/printcmds.c b/gdb/testsuite/gdb.base/printcmds.c index 6f2238bd25..27080741a3 100644 --- a/gdb/testsuite/gdb.base/printcmds.c +++ b/gdb/testsuite/gdb.base/printcmds.c @@ -1,7 +1,7 @@ /* This table is used as a source for every ascii character. It is explicitly unsigned to avoid differences due to native characters being either signed or unsigned. */ - +#include unsigned char ctable1[256] = { 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007, 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017, @@ -64,7 +64,7 @@ int int2dim[3][4] = {{0,1,2,3},{4,5,6,7},{8,9,10,11}}; int int3dim[2][3][2] = {{{0,1},{2,3},{4,5}},{{6,7},{8,9},{10,11}}}; int int4dim[1][2][3][2] = {{{{0,1},{2,3},{4,5}},{{6,7},{8,9},{10,11}}}}; -char *teststring = "teststring contents"; +char *teststring = (char*)"teststring contents"; /* Test printing of a struct containing character arrays. */ @@ -86,7 +86,7 @@ struct some_arrays *parrays = &arrays; /* -- */ -main () +int main () { #ifdef usestubs set_debug_traps(); diff --git a/gdb/testsuite/gdb.base/ptype.c b/gdb/testsuite/gdb.base/ptype.c index 801343530e..07d6afe5d9 100644 --- a/gdb/testsuite/gdb.base/ptype.c +++ b/gdb/testsuite/gdb.base/ptype.c @@ -6,6 +6,7 @@ /* * First the basic C types. */ +#include #if !defined (__STDC__) && !defined (_AIX) #define signed /**/ @@ -213,21 +214,22 @@ enum cars {bmw, porsche} sportscar; typedef enum {FALSE, TRUE} boolean; boolean v_boolean; -typedef enum bvals {false, true} boolean2; +/*note: aCC has bool type predefined with 'false' and 'true'*/ +typedef enum bvals {my_false, my_true} boolean2; boolean2 v_boolean2; enum misordered {two = 2, one = 1, zero = 0, three = 3}; +/* Seems like we need a variable of this type to get the type to be put + in the executable, at least for AIX xlc. */ +enum misordered v_misordered = three; + /***********/ -main () +int main () { /* Ensure that malloc is a pointer type; avoid use of "void" and any include files. */ - extern char *malloc(); - - /* Seems like we need a variable of this type to get the type to be put - in the executable, at least for AIX xlc. */ - enum misordered v_misordered = three; +/* extern char *malloc();*/ /* Some of the tests in ptype.exp require invoking malloc, so make sure it is linked in to this program. */ @@ -309,5 +311,6 @@ main () v_t_struct_p = 0; v_boolean = FALSE; - v_boolean2 = false; + v_boolean2 = my_false; + return 0; } diff --git a/gdb/testsuite/gdb.base/ptype.exp b/gdb/testsuite/gdb.base/ptype.exp index 1ef677150e..98d45869e8 100644 --- a/gdb/testsuite/gdb.base/ptype.exp +++ b/gdb/testsuite/gdb.base/ptype.exp @@ -94,7 +94,7 @@ if [gdb_test "ptype v_t_struct_p->v_float_member" "type = float"]<0 then { # IBM's xlc puts out bogus stabs--the stuff field is type 42, # which isn't defined. -gdb_test "ptype struct link" "type = struct link \{.*\[\r\n\] struct link \[*\]next;.*\[\r\n\] struct link \[*(\]+linkfunc\[)(\]+(struct link \[*\], int\[)\]|);.*\[\r\n\] struct t_struct stuff.1..2..3.;.*\[\r\n\]\}.*" "ptype linked list structure" +gdb_test "ptype struct link" "type = struct link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list structure" # # test ptype command with unions @@ -103,7 +103,7 @@ gdb_test "ptype union t_union" "type = union t_union \{.*\[\r\n\] (unsigned | # IBM's xlc puts out bogus stabs--the stuff field is type 42, # which isn't defined. -gdb_test "ptype union tu_link" "type = union tu_link .*\[\r\n\] struct link \[*\]next;.*\[\r\n\] struct link \[(\*\]+linkfunc\[)(\]+(struct link \[*\], int\[)\]|);.*\[\r\n\] struct t_struct stuff.1..2..3.;.*\[\r\n\]\}.*" "ptype linked list union" +gdb_test "ptype union tu_link" "type = union tu_link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list union" # # test ptype command with enums @@ -117,7 +117,7 @@ gdb_test "ptype enum colors" "type = enum colors \{yellow, purple, pink\}.*" "pt # # test ptype command with enums as typedef # -gdb_test "ptype boolean" "type = enum \{FALSE, TRUE\}.*" "ptype unnamed typedef'd enumeration" +gdb_test "ptype boolean" "type = enum (boolean |)\{FALSE, TRUE\}.*" "ptype unnamed typedef'd enumeration" # And check that whatis shows the name, not "enum {...}". # This probably fails for all DWARF 1 cases, so assume so for now. -fnf @@ -128,21 +128,23 @@ gdb_test "ptype boolean" "type = enum \{FALSE, TRUE\}.*" "ptype unnamed typedef' # GDB's behavior is correct; the type which the variable is defined # as (51) doesn't have a name. Only 55 has a name. -if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" } +if {!$gcc_compiled && !$hp_aCC_compiler} { + setup_xfail "rs6000-*-*" "i*86-*-sysv4*" "hppa*-*-*" # CLLbs14773 +} setup_xfail_format "DWARF 1" -gdb_test "whatis v_boolean" "type = boolean" \ +gdb_test "whatis v_boolean" "type = (enum |)boolean" \ "whatis unnamed typedef'd enum (compiler bug in IBM's xlc)" # Same thing with struct and union. -gdb_test "ptype t_struct3" "type = struct \{.* +gdb_test "ptype t_struct3" "type = struct (t_struct3 |)\{.* *double v_double_member;.* *int v_int_member;.*\}" "printing typedef'd struct" -gdb_test "ptype t_union3" "type = union \{.* +gdb_test "ptype t_union3" "type = union (t_union3 |)\{.* *double v_double_member;.* *int v_int_member;.*\}" "printing typedef'd union" -gdb_test "ptype enum bvals" "type = enum bvals \{false, true\}.*" "ptype named typedef'd enumf'd enum" +gdb_test "ptype enum bvals" "type = enum bvals \{my_false, my_true\}.*" "ptype named typedef'd enumf'd enum" # # test ptype command with out-of-order enum values @@ -365,6 +367,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" } setup_xfail_format "DWARF 1" +if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*"} gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # @@ -489,21 +492,34 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # # test ptype command with nested structure and union # -gdb_test "ptype struct outer_struct" "type = struct outer_struct \{.*\[\r\n\] int outer_int;.*\[\r\n\] struct inner_struct inner_struct_instance;.*\[\r\n\] union inner_union inner_union_instance;.*\[\r\n\] (long|long int|int) outer_long;.*\[\r\n\]\}.*" "ptype outer structure" +if {$hp_aCC_compiler} { + set outer "outer_struct::" + set struct "" + set union "" +} else { + set outer "" + set struct "struct" + set union "union" +} +gdb_test "ptype struct outer_struct" "type = struct outer_struct \{.*\[\r\n\]+\ +.*int outer_int;.*\[\r\n\]+\ +.*(struct|) ${outer}inner_struct inner_struct_instance;.*\[\r\n\]+\ +.*(union|) ${outer}inner_union inner_union_instance;.*\[\r\n\]+\ +.*(long|long int|int) outer_long;.*\[\r\n\]\}.*" "ptype outer structure" -gdb_test "ptype struct inner_struct" "type = struct inner_struct \{.*\[\r\n\] int inner_int;.*\[\r\n\] (long|long int|int) inner_long;.*\[\r\n\]\}.*" "ptype inner structure" +gdb_test "ptype ${struct} ${outer}inner_struct" "type = struct ${outer}inner_struct \{.*\[\r\n\] int inner_int;.*\[\r\n\] (long|long int|int) inner_long;.*\[\r\n\]\}.*" "ptype inner structure" -gdb_test "ptype union inner_union" "type = union inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype inner union" +gdb_test "ptype ${union} ${outer}inner_union" "type = union ${outer}inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype inner union" -gdb_test "ptype nested_su" "type = struct outer_struct \{.*\[\r\n\] int outer_int;.*\[\r\n\] struct inner_struct inner_struct_instance;.*\[\r\n\] union inner_union inner_union_instance;.*\[\r\n\] (long|long int|int) outer_long;.*\[\r\n\]\}.*" "ptype nested structure" +gdb_test "ptype nested_su" "type = struct outer_struct \{.*\[\r\n\] int outer_int;.*\[\r\n\] (struct |)${outer}inner_struct inner_struct_instance;.*\[\r\n\] (union |)${outer}inner_union inner_union_instance;.*\[\r\n\] (long|long int|int) outer_long;.*\[\r\n\]\}.*" "ptype nested structure" gdb_test "ptype nested_su.outer_int" "type = int.*" "ptype outer int" -gdb_test "ptype nested_su.inner_struct_instance" "type = struct inner_struct \{.*\[\r\n\] int inner_int;.*\[\r\n\] (long|long int|int) inner_long;.*\[\r\n\]\}.*" "ptype nested structure #2" +gdb_test "ptype nested_su.inner_struct_instance" "type = struct ${outer}inner_struct \{.*\[\r\n\] int inner_int;.*\[\r\n\] (long|long int|int) inner_long;.*\[\r\n\]\}.*" "ptype nested structure #2" gdb_test "ptype nested_su.inner_struct_instance.inner_int" "type = int.*" "ptype inner int" -gdb_test "ptype nested_su.inner_union_instance" "type = union inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype nested union" +gdb_test "ptype nested_su.inner_union_instance" "type = union ${outer}inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype nested union" # Test printing type of string constants and array constants, but # requires a running process. These call malloc, and can take a long diff --git a/gdb/testsuite/gdb.base/recurse.c b/gdb/testsuite/gdb.base/recurse.c index 1d6892d0f6..798177888c 100644 --- a/gdb/testsuite/gdb.base/recurse.c +++ b/gdb/testsuite/gdb.base/recurse.c @@ -1,9 +1,14 @@ /* Trivial code used to test watchpoints in recursive code and auto-deletion of watchpoints as they go out of scope. */ +#ifdef PROTOTYPES +static int +recurse (int a) +#else static int recurse (a) int a; +#endif { int b = 0; @@ -15,11 +20,12 @@ recurse (a) return b; } -main() +int main() { #ifdef usestubs set_debug_traps(); breakpoint(); #endif recurse (10); + return 0; } diff --git a/gdb/testsuite/gdb.base/relational.exp b/gdb/testsuite/gdb.base/relational.exp index 6a0b38acad..fd03a41c5f 100644 --- a/gdb/testsuite/gdb.base/relational.exp +++ b/gdb/testsuite/gdb.base/relational.exp @@ -42,6 +42,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +if [get_compiler_info ${binfile}] { + return -1; +} gdb_exit gdb_start @@ -108,7 +111,7 @@ gdb_expect { send_gdb "print x < y\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x y\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x>y" } -re ".*$gdb_prompt $" { fail "print value of x>y" } @@ -135,7 +138,7 @@ gdb_expect { send_gdb "print x >= y\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x>=y" } -re ".*$gdb_prompt $" { fail "print value of x>=y" } @@ -144,7 +147,7 @@ gdb_expect { send_gdb "print x == y\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x==y" } -re ".*$gdb_prompt $" { fail "print value of x==y" } @@ -153,7 +156,7 @@ gdb_expect { send_gdb "print x != y\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x!=y" } -re ".*$gdb_prompt $" { fail "print value of x!=y" } @@ -172,7 +175,7 @@ gdb_test "set variable z=2" "" "set variable z" send_gdb "print x < y < z\n" gdb_expect { - -re ".*1\r\n$gdb_prompt $" { + -re ".*$true.*\r\n$gdb_prompt $" { pass "print value of x y > z\n" gdb_expect { - -re ".*0\r\n$gdb_prompt $" { + -re ".*$false.*\r\n$gdb_prompt $" { pass "print value of x>y>z" } -re 8".*$gdb_prompt $" { fail "print value of x>y>z" } @@ -199,7 +202,7 @@ gdb_expect { send_gdb "print x >= y >= z\n" gdb_expect { - -re ".*0\r\n$gdb_prompt $" { + -re ".*$false.*\r\n$gdb_prompt $" { pass "print value of x>=y>=z" } -re ".*$gdb_prompt $" { fail "print value of x>=y>=z" } @@ -213,7 +216,7 @@ gdb_test "set variable z=1" "" "set variable z" send_gdb "print x == y == z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x==y==z" } -re ".*$gdb_prompt $" { fail "print value of x==y==z" } @@ -225,7 +228,7 @@ gdb_test "set variable z=0" "" "set variable z" send_gdb "print x != y != z\n" gdb_expect { - -re ".*0\r\n$gdb_prompt $" { + -re ".*$false\r\n$gdb_prompt $" { pass "print value of x!=y!=z" } -re ".*$gdb_prompt $" { fail "print value of x!=y!=z" } @@ -242,7 +245,7 @@ gdb_test "set variable z=2" "" "set variable z" send_gdb "print x < y == z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x= z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x=z" } -re ".*$gdb_prompt $" { fail "print value of x=z" } @@ -292,7 +295,7 @@ gdb_test "set variable z=0" "" " set variable z" # 2 3 0 send_gdb "print x < y > z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of xz" } -re ".*$gdb_prompt $" { fail "print value of xz" } @@ -305,7 +308,7 @@ gdb_test "set variable x=1" "" " set variable x" # 1 3 0 send_gdb "print x > y >= z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x>y>=z" } -re ".*$gdb_prompt $" { fail "print value of x>y>=z" } @@ -318,7 +321,7 @@ gdb_test "set variable z=2" "" " set variable z" # 1 3 2 send_gdb "print x > y == z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x>y==z" } -re ".*$gdb_prompt $" { fail "print value of x>y==z" } @@ -332,7 +335,7 @@ gdb_test "set variable z=0" "" " set variable z" # 2 3 0 send_gdb "print x > y != z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x>y!=z" } -re ".*$gdb_prompt $" { fail "print value of x>y!=z" } @@ -345,7 +348,7 @@ gdb_test "set variable x=4" "" "set x to 4" # 4 3 0 send_gdb "print x > y <= z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x>y<=z" } -re ".*$gdb_prompt $" { fail "print value of x>y<=z" } @@ -355,7 +358,7 @@ gdb_expect { # 4 3 0 send_gdb "print x >= y == z\n" gdb_expect { - -re ".*0\r\n$gdb_prompt $" { + -re ".*$false\r\n$gdb_prompt $" { pass "print value of x>=y==z" } -re ".*$gdb_prompt $" { fail "print value of x>=y==z" } @@ -368,7 +371,7 @@ gdb_test "set variable x=2" "" " set variable x" # 2 3 0 send_gdb "print x >= y != z\n" gdb_expect { - -re ".*0\r\n$gdb_prompt $" { + -re ".*$false\r\n$gdb_prompt $" { pass "print value of x>=y!=z" } -re ".*$gdb_prompt $" { fail "print value of x>=y!=z" } @@ -382,7 +385,7 @@ gdb_test "set variable z=4" "" " set variable z" # 0 3 4 send_gdb "print x >= y <= z\n" gdb_expect { - -re ".*1\r\n$gdb_prompt $" { + -re ".*$true\r\n$gdb_prompt $" { pass "print value of x>=y<=z" } -re ".*$gdb_prompt $" { fail "print value of x>=y<=z" } @@ -392,7 +395,7 @@ gdb_expect { # 0 3 4 send_gdb "print x <= y == z\n" gdb_expect { - -re ".*0\r\n$gdb_prompt $" { + -re ".*$false\r\n$gdb_prompt $" { pass "print value of x<=y==z" } -re ".*$gdb_prompt $" { fail "print value of x<=y==z" } @@ -404,7 +407,7 @@ gdb_test "set variable x=2" "" " set variable x" # 2 3 4 send_gdb "print x <= y != z\n" gdb_expect { - -re ".*1\r\n$gdb_prompt $" { + -re ".*$true\r\n$gdb_prompt $" { pass "print value of x<=y!=z" } -re ".*$gdb_prompt $" { fail "print value of x<=y!=z" } @@ -415,7 +418,7 @@ gdb_expect { # 2 3 4 send_gdb "print x == y != z\n" gdb_expect { - -re ".*1\r\n$gdb_prompt $" { + -re ".*$true\r\n$gdb_prompt $" { pass "print value of x==y!=z" } -re ".*$gdb_prompt $" { fail "print value of x==y!=z" } @@ -432,7 +435,7 @@ gdb_test "set variable z=0" "" " set variable z" # 2 3 0 send_gdb "print x >= (y < z)\n" gdb_expect { - -re ".*1\r\n$gdb_prompt $" { + -re ".*$true\r\n$gdb_prompt $" { pass "print value of x>=(y=(y= (y != z)\n" gdb_expect { - -re ".*1\r\n$gdb_prompt $" { + -re ".*$true\r\n$gdb_prompt $" { pass "print value of x>=(y!=z)" } -re ".*$gdb_prompt $" { fail "print value of x>=(y*!=z)" } @@ -453,7 +456,7 @@ gdb_expect { # 2 3 0 send_gdb "print x == (y == z)\n" gdb_expect { - -re ".*0\r\n$gdb_prompt $" { + -re ".*$false\r\n$gdb_prompt $" { pass "print value of x==(y==z)" } -re ".*$gdb_prompt $" { fail "print value of x==(y==z)" } @@ -467,7 +470,7 @@ gdb_test "set variable z=4" "" " set variable z" # 1 3 4 send_gdb "print (x == y) < z\n" gdb_expect { - -re ".*1\r\n$gdb_prompt $" { + -re ".*$true\r\n$gdb_prompt $" { pass "print value of (x==y) /* Test "return" command. */ -func1 () +void func1 () { printf("in func1\n"); } @@ -21,7 +21,7 @@ func3 () int tmp2; double tmp3; -main () +int main () { #ifdef usestubs set_debug_traps(); @@ -32,4 +32,5 @@ main () tmp2 = func2 (); tmp3 = func3 (); printf("exiting\n"); + return 0; } diff --git a/gdb/testsuite/gdb.base/run.c b/gdb/testsuite/gdb.base/run.c index 40ec72020e..25b8a4a4aa 100644 --- a/gdb/testsuite/gdb.base/run.c +++ b/gdb/testsuite/gdb.base/run.c @@ -34,11 +34,20 @@ char *arg; #else /* ! vxworks */ # include +# include #endif /* ! vxworks */ +#ifdef PROTOTYPES +int factorial (int); + +int +main (int argc, char **argv, char **envp) +#else +int main (argc, argv, envp) int argc; char *argv[], **envp; +#endif { #ifdef usestubs set_debug_traps(); @@ -57,11 +66,17 @@ char *argv[], **envp; return 0; } -int factorial (value) -int value; +#ifdef PROTOTYPES +int factorial (int value) +#else +int factorial (value) int value; +#endif { + int local_var; + if (value > 1) { value *= factorial (value - 1); } + local_var = value; return (value); } diff --git a/gdb/testsuite/gdb.base/scope.exp b/gdb/testsuite/gdb.base/scope.exp index 6a92ca7511..708bc42ea1 100644 --- a/gdb/testsuite/gdb.base/scope.exp +++ b/gdb/testsuite/gdb.base/scope.exp @@ -59,6 +59,7 @@ proc test_at_main {} { global srcdir global subdir global gcc_compiled + global hp_cc_compiler # skip past init. There may be a call to __main at the start of # main, so the first next may only get us to the init0 call. @@ -111,6 +112,8 @@ proc test_at_main {} { # Print scope1.c::filelocal, which is 2 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + #DTS 11747CLLbs + if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*"} if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal"] { gdb_suppress_tests ; } @@ -119,6 +122,8 @@ proc test_at_main {} { # Print scope1.c::filelocal_bss, which is 102 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + #DTS 11747CLLbs + if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*"} if [gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_bss"] { gdb_suppress_tests ; } @@ -127,6 +132,8 @@ proc test_at_main {} { # Print scope1.c::filelocal_ro, which is 202 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + #DTS 11747CLLbs + if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*"} if [gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro"] { gdb_suppress_tests ; } @@ -134,7 +141,6 @@ proc test_at_main {} { # Print scope1.c::foo::funclocal, which is 3 - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal" ] { gdb_suppress_tests ; } @@ -238,12 +244,10 @@ proc test_at_foo {} { gdb_test "print funclocal" "\\\$$decimal = 3" "print funclocal at foo" - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print foo::funclocal" "\\\$$decimal = 3" \ "print foo::funclocal at foo" if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal" @@ -252,12 +256,10 @@ proc test_at_foo {} { gdb_test "print funclocal_bss" "\\\$$decimal = 103" \ "print funclocal_bss at foo" - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" \ "print foo::funclocal_bss at foo" if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "print 'scope1.c'::foo::funclocal_bss at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss" @@ -266,23 +268,19 @@ proc test_at_foo {} { gdb_test "print funclocal_ro" "\\\$$decimal = 203" \ "print funclocal_ro at foo" - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" \ "print foo::funclocal_ro at foo" if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro" # Print scope1.c::bar::funclocal, which is 4 - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print bar::funclocal" "\\\$$decimal = 4" \ "print bar::funclocal at foo" if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal" gdb_stop_suppressing_tests; @@ -365,7 +363,6 @@ proc test_at_bar {} { # Print scope1.c::foo::funclocal, which is 3 - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal at bar" ] { gdb_suppress_tests ; } diff --git a/gdb/testsuite/gdb.base/scope0.c b/gdb/testsuite/gdb.base/scope0.c index 3a1b89e250..ad994fc0b2 100644 --- a/gdb/testsuite/gdb.base/scope0.c +++ b/gdb/testsuite/gdb.base/scope0.c @@ -5,7 +5,19 @@ static int filelocal_bss; /* In BSS section */ #endif static const int filelocal_ro = 201; /* In Read-Only Data section */ -main () +extern void init1(); +extern void foo(); + +int autovars (int bcd, int abc); +int localscopes (int x); +int useit (int val); +void init0(); +void marker1 (); +void marker2 (); +void marker3 (); +void marker4 (); + +int main () { #ifdef usestubs set_debug_traps(); @@ -19,14 +31,14 @@ main () /* On some systems, such as AIX, unreferenced variables are deleted from the executable. */ -usestatics () +void usestatics () { useit (filelocal); useit (filelocal_bss); useit (filelocal_ro); } -init0 () +void init0 () { filelocal_bss = 101; init1 (); @@ -34,9 +46,14 @@ init0 () /* This is to derail optimizer in localscopes. Return 1 + 2 + . . . + N. */ +#ifdef PROTOTYPES +int +sum_upto (int n) +#else int sum_upto (n) int n; +#endif { int i; int retval = 0; @@ -46,8 +63,13 @@ sum_upto (n) return retval; } +#ifdef PROTOTYPES +int +useit (int val) +#else int useit (val) +#endif { static int usedval; @@ -55,10 +77,15 @@ useit (val) return val + sum_upto (0); } +#ifdef PROTOTYPES +int +autovars (int bcd, int abc) +#else int autovars (bcd, abc) int bcd; int abc; +#endif { int i0 = useit (0), i1 = useit (1), i2 = useit (2); int i3 = useit (3), i4 = useit (4), i5 = useit (5); @@ -133,9 +160,14 @@ autovars (bcd, abc) + i91 + i92 + i93 + i94 + i95 + i96 + i97 + i98 + i99 + abc + bcd; } +#ifdef PROTOTYPES +int +localscopes (int x) +#else int localscopes (x) int x; +#endif { int localval; int retval; @@ -170,7 +202,7 @@ localscopes (x) return retval; } -marker1 () {} -marker2 () {} -marker3 () {} -marker4 () {} +void marker1 () {} +void marker2 () {} +void marker3 () {} +void marker4 () {} diff --git a/gdb/testsuite/gdb.base/scope1.c b/gdb/testsuite/gdb.base/scope1.c index cccad6f321..8c32522499 100644 --- a/gdb/testsuite/gdb.base/scope1.c +++ b/gdb/testsuite/gdb.base/scope1.c @@ -5,8 +5,11 @@ static int filelocal_bss; /* In BSS section */ #endif static const int filelocal_ro = 202; /* In Read-Only Data section */ -foo () +void foo () { + + void bar (); + static int funclocal = 3; /* In Data section */ static int funclocal_bss; /* In BSS section */ static const int funclocal_ro = 203; /* RO Data */ @@ -16,28 +19,34 @@ foo () bar (); } -bar () +void bar () { static int funclocal = 4; /* In data section */ static int funclocal_bss; /* In BSS section */ funclocal_bss = 104; } -init1 () +void init1 () { filelocal_bss = 102; } /* On some systems, such as AIX, unreferenced variables are deleted from the executable. */ -usestatics1 () +void usestatics1 () { + void useit1 (int val); + useit1 (filelocal); useit1 (filelocal_bss); useit1 (filelocal_ro); } -useit1 (val) +#ifdef PROTOTYPES +void useit1 (int val) +#else +void useit1 (val) int val; +#endif { static int usedval; diff --git a/gdb/testsuite/gdb.base/sect-cmd.exp b/gdb/testsuite/gdb.base/sect-cmd.exp index 27bde04452..d07def553c 100644 --- a/gdb/testsuite/gdb.base/sect-cmd.exp +++ b/gdb/testsuite/gdb.base/sect-cmd.exp @@ -59,10 +59,15 @@ if ![runto_main] then { fail "section command tests suppressed" } # not clear that there'll be a section named "$CODE$" in such # programs.) # + +set address1 "" +set address2 "" send_gdb "info files\n" gdb_expect { - -re ".*(0x\[0-9a-fA-F\]*) - (0x\[0-9a-fA-F\]*) is .CODE..*$gdb_prompt $"\ - {pass "info files"} + -re ".*(0x\[0-9a-fA-F\]*) - (0x\[0-9a-fA-F\]*) is .(CODE|text).*$gdb_prompt $"\ + {pass "info files" + set address1 $expect_out(1,string) + set address2 $expect_out(2,string)} -re "$gdb_prompt $"\ {fail "info files"} timeout {fail "(timeout) info files"} @@ -71,13 +76,24 @@ gdb_expect { # Reset the section to that same starting address, which should be # harmless (i.e., we just want to exercise the section command). # -send_gdb "section \$CODE\$ $expect_out(1,string)\n" -gdb_expect { - -re ".*$expect_out(1,string) \- $expect_out(2,string) is .CODE..*$gdb_prompt $"\ - {pass "set section command"} - -re "$gdb_prompt $"\ - {fail "set section command"} - timeout {fail "(timeout) set section command"} +if [istarget "hppa2.0w-*-*"] then { + send_gdb "section \.text $address1\n" + gdb_expect { + -re ".*$address1 \- $address2 is .text.*$gdb_prompt $"\ + {pass "set section command"} + -re "$gdb_prompt $"\ + {fail "set section command"} + timeout {fail "(timeout) set section command"} + } +} else { + send_gdb "section \$CODE\$ $address1\n" + gdb_expect { + -re ".*$address1 \- $address2 is .CODE..*$gdb_prompt $"\ + {pass "set section command"} + -re "$gdb_prompt $"\ + {fail "set section command"} + timeout {fail "(timeout) set section command"} + } } # Verify that GDB responds gracefully to a non-existent section name. diff --git a/gdb/testsuite/gdb.base/setshow.c b/gdb/testsuite/gdb.base/setshow.c index ed4e7a9a42..fbaba0f5dd 100644 --- a/gdb/testsuite/gdb.base/setshow.c +++ b/gdb/testsuite/gdb.base/setshow.c @@ -3,10 +3,15 @@ #include +#ifdef PROTOTYPES +int +main(int argc, char **argv) +#else int main(argc, argv) int argc; char **argv; +#endif { int i = 1; #ifdef usestubs diff --git a/gdb/testsuite/gdb.base/setvar.c b/gdb/testsuite/gdb.base/setvar.c index 7162155e79..969de0d5e7 100644 --- a/gdb/testsuite/gdb.base/setvar.c +++ b/gdb/testsuite/gdb.base/setvar.c @@ -1,7 +1,13 @@ +#include + +#ifdef PROTOTYPES +int main (int argc, char **argv, char **envp) +#else main (argc, argv, envp) int argc; char **argv; char **envp; +#endif { extern void dummy(); #ifdef usestubs @@ -9,6 +15,7 @@ main (argc, argv, envp) breakpoint(); #endif dummy(); + return 0; } /* We put main() right up front so its line number doesn't keep changing. */ diff --git a/gdb/testsuite/gdb.base/setvar.exp b/gdb/testsuite/gdb.base/setvar.exp index 96d3eb45f5..e7d31dc87a 100644 --- a/gdb/testsuite/gdb.base/setvar.exp +++ b/gdb/testsuite/gdb.base/setvar.exp @@ -329,8 +329,12 @@ gdb_test "print *(v_signed_short_pointer+1)" ".\[0-9\]*.*=.*-456" gdb_test "set v_unsigned_short_pointer=v_unsigned_short_array" "" gdb_test "set variable *(v_unsigned_short_pointer)=123" "" gdb_test "set variable *(v_unsigned_short_pointer+1)=-456" "" +# DTS 10060CLLbs - bad type info from cc +if {$hp_cc_compiler} {setup_xfail hppa*-*-*11*} gdb_test "print v_unsigned_short_array" ".\[0-9\]* =.*\{123,.*65080\}" \ "set variable unsigned short pointer" +# DTS 10060CLLbs - bad type info from cc +if {$hp_cc_compiler} {setup_xfail hppa*-*-*11*} gdb_test "print *(v_unsigned_short_pointer+1)" ".\[0-9\]* = 65080" # # test "set variable" for type "int *" @@ -385,6 +389,8 @@ v_long_member = 3,.*v_float_member = 4,.*v_double_member = 5.*\}" \ # the type of the structure to be specified, as in # v_struct1 = (struct t_struct) {32, 33, 34, 35, 36, 37} # GDB should do the same if it wants to provide this feature. +# However, for HP's aCC this is OK, so we skip the tests for aCC +if {! $hp_aCC_compiler} { if [target_info exists gdb,cannot_call_functions] { setup_xfail "*-*-*" 2416 fail "set variable v_struct1 = {32, 33, 34, 35, 36, 37}" @@ -398,6 +404,7 @@ gdb_test "print v_struct1" \ .*v_int_member = 2,.*\ v_long_member = 3,.*v_float_member = 4,.*v_double_member = 5.*\}" \ "set print structure #2" +} # Test printing of enumeration bitfields. # GNU C supports them, some other compilers don't. diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp index 414d7427f0..4e1daac3be 100644 --- a/gdb/testsuite/gdb.base/shlib-call.exp +++ b/gdb/testsuite/gdb.base/shlib-call.exp @@ -180,7 +180,7 @@ gdb_test "break shr2" \ "Breakpoint.*file.*shr2.c, line.*" \ "breakpoint function shr2" -gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, shr2 \\(.*\\) at.*shr2\\.c:3.*3.*return 2.x;" \ +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, shr2 \\(.*\\) at.*shr2\\.c:7.*7.*return 2.x;" \ "run until breakpoint set at a function" @@ -249,10 +249,10 @@ send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $" # PR's 16495, 18213 # test that we can re-set breakpoints in shared libraries -gdb_test "break shr1" "Breakpoint 1 at .*" "set bp in shared library" +gdb_test "break shr1" "Breakpoint 1.*" "set bp in shared library" gdb_test "run" "Starting program:.*Breakpoint 1,.*" "run to bp in shared library" -gdb_test "cont" "Program exited normally." +gdb_test "cont" ".*Program exited normally..*" gdb_test "run" "Starting program:.*Breakpoint 1,.*" "re-run to bp in shared library (PR's 16495, 18213)" -gdb_test "cont" "Program exited normally." +gdb_test "cont" ".*Program exited normally..*" return 0 diff --git a/gdb/testsuite/gdb.base/shmain.c b/gdb/testsuite/gdb.base/shmain.c index dda5091cdc..7013db5232 100644 --- a/gdb/testsuite/gdb.base/shmain.c +++ b/gdb/testsuite/gdb.base/shmain.c @@ -3,8 +3,10 @@ #include "ss.h" #include -extern int shr1(); -extern int shr2(); +extern int structarg(struct s); +extern int pstructarg(struct s*); +extern int shr1(int); +extern int shr2(int); extern float sg; int eglob; @@ -16,13 +18,27 @@ struct { int g; +#ifdef PROTOTYPES +int local_structarg(struct s x) +#else int local_structarg(x) struct s x; +#endif { return x.b; } -main() +#ifdef PROTOTYPES +int mainshr1(int g) +#else +int mainshr1(g) +int g; +#endif +{ + return 2*g; +} + +int main() { struct s y; g = 1; @@ -36,12 +52,5 @@ main() g = local_structarg(y); g = structarg(y); g = pstructarg(&y); - - return (0); -} - -int mainshr1(g) -int g; -{ - return 2*g; + return 0; } diff --git a/gdb/testsuite/gdb.base/shr1.c b/gdb/testsuite/gdb.base/shr1.c index 0efaff5ec1..a0257e4023 100644 --- a/gdb/testsuite/gdb.base/shr1.c +++ b/gdb/testsuite/gdb.base/shr1.c @@ -7,8 +7,12 @@ float sg = 5.5; int sgi = 2; static int sgs = 7; +#ifdef PROTOTYPES +int shr1(int x) +#else int shr1(x) int x; +#endif { f mumble; int l; @@ -25,20 +29,32 @@ int x; return 2*x; } +#ifdef PROTOTYPES +static int shr1_local(int x) +#else static int shr1_local(x) int x; +#endif { return 2*x; } +#ifdef PROTOTYPES +int structarg(struct s x) +#else int structarg(x) struct s x; +#endif { return x.a; } +#ifdef PROTOTYPES +int pstructarg(struct s *x) +#else int pstructarg(x) struct s *x; +#endif { return x->a; } diff --git a/gdb/testsuite/gdb.base/shr2.c b/gdb/testsuite/gdb.base/shr2.c index 94d5df962a..de34986d76 100644 --- a/gdb/testsuite/gdb.base/shr2.c +++ b/gdb/testsuite/gdb.base/shr2.c @@ -1,11 +1,17 @@ -int shr2(x) +#ifdef PROTOTYPES +int shr2(int x) +#else +int shr2(x) int x; +#endif { return 2*x; } -int shr2_local(x) +#ifdef PROTOTYPES +int shr2_local(int x) +#else +int shr2_local(x) int x; +#endif { return 2*x; } - - diff --git a/gdb/testsuite/gdb.base/sigall.c b/gdb/testsuite/gdb.base/sigall.c index 1ab08e732e..30d06f367d 100644 --- a/gdb/testsuite/gdb.base/sigall.c +++ b/gdb/testsuite/gdb.base/sigall.c @@ -1,4 +1,5 @@ #include +#include #ifdef __sh__ #define signal(a,b) /* Signals not supported on this target - make them go away */ @@ -7,429 +8,784 @@ /* Signal handlers, we set breakpoints in them to make sure that the signals really get delivered. */ +#ifdef PROTOTYPES +void +handle_ABRT (int sig) +#else void handle_ABRT (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_HUP (int sig) +#else void handle_HUP (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_QUIT (int sig) +#else void handle_QUIT (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_ILL (int sig) +#else void handle_ILL (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_EMT (int sig) +#else void handle_EMT (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_FPE (int sig) +#else void handle_FPE (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_BUS (int sig) +#else void handle_BUS (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_SEGV (int sig) +#else void handle_SEGV (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_SYS (int sig) +#else void handle_SYS (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_PIPE (int sig) +#else void handle_PIPE (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_ALRM (int sig) +#else void handle_ALRM (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_URG (int sig) +#else void handle_URG (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_TSTP (int sig) +#else void handle_TSTP (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_CONT (int sig) +#else void handle_CONT (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_CHLD (int sig) +#else void handle_CHLD (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_TTIN (int sig) +#else void handle_TTIN (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_TTOU (int sig) +#else void handle_TTOU (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_IO (int sig) +#else void handle_IO (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_XCPU (int sig) +#else void handle_XCPU (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_XFSZ (int sig) +#else void handle_XFSZ (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_VTALRM (int sig) +#else void handle_VTALRM (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_PROF (int sig) +#else void handle_PROF (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_WINCH (int sig) +#else void handle_WINCH (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_LOST (int sig) +#else void handle_LOST (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_USR1 (int sig) +#else void handle_USR1 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_USR2 (int sig) +#else void handle_USR2 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_PWR (int sig) +#else void handle_PWR (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_POLL (int sig) +#else void handle_POLL (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_WIND (int sig) +#else void handle_WIND (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_PHONE (int sig) +#else void handle_PHONE (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_WAITING (int sig) +#else void handle_WAITING (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_LWP (int sig) +#else void handle_LWP (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_DANGER (int sig) +#else void handle_DANGER (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_GRANT (int sig) +#else void handle_GRANT (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_RETRACT (int sig) +#else void handle_RETRACT (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_MSG (int sig) +#else void handle_MSG (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_SOUND (int sig) +#else void handle_SOUND (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_SAK (int sig) +#else void handle_SAK (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_PRIO (int sig) +#else void handle_PRIO (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_33 (int sig) +#else void handle_33 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_34 (int sig) +#else void handle_34 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_35 (int sig) +#else void handle_35 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_36 (int sig) +#else void handle_36 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_37 (int sig) +#else void handle_37 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_38 (int sig) +#else void handle_38 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_39 (int sig) +#else void handle_39 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_40 (int sig) +#else void handle_40 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_41 (int sig) +#else void handle_41 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_42 (int sig) +#else void handle_42 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_43 (int sig) +#else void handle_43 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_44 (int sig) +#else void handle_44 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_45 (int sig) +#else void handle_45 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_46 (int sig) +#else void handle_46 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_47 (int sig) +#else void handle_47 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_48 (int sig) +#else void handle_48 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_49 (int sig) +#else void handle_49 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_50 (int sig) +#else void handle_50 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_51 (int sig) +#else void handle_51 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_52 (int sig) +#else void handle_52 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_53 (int sig) +#else void handle_53 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_54 (int sig) +#else void handle_54 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_55 (int sig) +#else void handle_55 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_56 (int sig) +#else void handle_56 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_57 (int sig) +#else void handle_57 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_58 (int sig) +#else void handle_58 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_59 (int sig) +#else void handle_59 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_60 (int sig) +#else void handle_60 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_61 (int sig) +#else void handle_61 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_62 (int sig) +#else void handle_62 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_63 (int sig) +#else void handle_63 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_TERM (int sig) +#else void handle_TERM (sig) int sig; +#endif { } @@ -438,6 +794,7 @@ int gen_ABRT () { kill (getpid (), SIGABRT); + return 0; } int @@ -448,6 +805,7 @@ gen_HUP () #else handle_HUP (0); #endif +return 0; } int @@ -458,6 +816,7 @@ gen_QUIT () #else handle_QUIT (0); #endif +return 0; } int @@ -468,6 +827,7 @@ gen_ILL () #else handle_ILL (0); #endif +return 0; } int @@ -478,6 +838,7 @@ gen_EMT () #else handle_EMT (0); #endif +return 0; } int x; @@ -499,6 +860,7 @@ gen_FPE () #else kill (getpid (), SIGFPE); #endif +return 0; } int @@ -509,6 +871,7 @@ gen_BUS () #else handle_BUS (0); #endif +return 0; } int @@ -519,6 +882,7 @@ gen_SEGV () #else handle_SEGV (0); #endif +return 0; } int @@ -529,6 +893,7 @@ gen_SYS () #else handle_SYS (0); #endif +return 0; } int @@ -539,6 +904,7 @@ gen_PIPE () #else handle_PIPE (0); #endif +return 0; } int @@ -549,6 +915,7 @@ gen_ALRM () #else handle_ALRM (0); #endif +return 0; } int @@ -559,6 +926,7 @@ gen_URG () #else handle_URG (0); #endif +return 0; } int @@ -569,6 +937,7 @@ gen_TSTP () #else handle_TSTP (0); #endif +return 0; } int @@ -579,6 +948,7 @@ gen_CONT () #else handle_CONT (0); #endif +return 0; } int @@ -589,6 +959,7 @@ gen_CHLD () #else handle_CHLD (0); #endif +return 0; } int @@ -599,6 +970,7 @@ gen_TTIN () #else handle_TTIN (0); #endif +return 0; } int @@ -609,6 +981,7 @@ gen_TTOU () #else handle_TTOU (0); #endif +return 0; } int @@ -619,6 +992,7 @@ gen_IO () #else handle_IO (0); #endif +return 0; } int @@ -629,6 +1003,7 @@ gen_XCPU () #else handle_XCPU (0); #endif +return 0; } int @@ -639,6 +1014,7 @@ gen_XFSZ () #else handle_XFSZ (0); #endif +return 0; } int @@ -649,6 +1025,7 @@ gen_VTALRM () #else handle_VTALRM (0); #endif +return 0; } int @@ -659,6 +1036,7 @@ gen_PROF () #else handle_PROF (0); #endif +return 0; } int @@ -669,6 +1047,7 @@ gen_WINCH () #else handle_WINCH (0); #endif +return 0; } int @@ -679,6 +1058,7 @@ gen_LOST () #else handle_LOST (0); #endif +return 0; } int @@ -689,6 +1069,7 @@ gen_USR1 () #else handle_USR1 (0); #endif +return 0; } int @@ -699,6 +1080,7 @@ gen_USR2 () #else handle_USR2 (0); #endif +return 0; } int @@ -709,6 +1091,7 @@ gen_PWR () #else handle_PWR (0); #endif +return 0; } int @@ -719,6 +1102,7 @@ gen_POLL () #else handle_POLL (0); #endif +return 0; } int @@ -729,6 +1113,7 @@ gen_WIND () #else handle_WIND (0); #endif +return 0; } int @@ -739,6 +1124,7 @@ gen_PHONE () #else handle_PHONE (0); #endif +return 0; } int @@ -749,6 +1135,7 @@ gen_WAITING () #else handle_WAITING (0); #endif +return 0; } int @@ -759,6 +1146,7 @@ gen_LWP () #else handle_LWP (0); #endif +return 0; } int @@ -769,6 +1157,7 @@ gen_DANGER () #else handle_DANGER (0); #endif +return 0; } int @@ -779,6 +1168,7 @@ gen_GRANT () #else handle_GRANT (0); #endif +return 0; } int @@ -789,6 +1179,7 @@ gen_RETRACT () #else handle_RETRACT (0); #endif +return 0; } int @@ -799,6 +1190,7 @@ gen_MSG () #else handle_MSG (0); #endif +return 0; } int @@ -809,6 +1201,7 @@ gen_SOUND () #else handle_SOUND (0); #endif +return 0; } int @@ -819,6 +1212,7 @@ gen_SAK () #else handle_SAK (0); #endif +return 0; } int @@ -829,6 +1223,7 @@ gen_PRIO () #else handle_PRIO (0); #endif +return 0; } int @@ -839,6 +1234,7 @@ gen_33 () #else handle_33 (0); #endif +return 0; } int @@ -849,6 +1245,7 @@ gen_34 () #else handle_34 (0); #endif +return 0; } int @@ -859,6 +1256,7 @@ gen_35 () #else handle_35 (0); #endif +return 0; } int @@ -869,6 +1267,7 @@ gen_36 () #else handle_36 (0); #endif +return 0; } int @@ -879,6 +1278,7 @@ gen_37 () #else handle_37 (0); #endif +return 0; } int @@ -889,6 +1289,7 @@ gen_38 () #else handle_38 (0); #endif +return 0; } int @@ -899,6 +1300,7 @@ gen_39 () #else handle_39 (0); #endif +return 0; } int @@ -909,6 +1311,7 @@ gen_40 () #else handle_40 (0); #endif +return 0; } int @@ -919,6 +1322,7 @@ gen_41 () #else handle_41 (0); #endif +return 0; } int @@ -929,6 +1333,7 @@ gen_42 () #else handle_42 (0); #endif +return 0; } int @@ -939,6 +1344,7 @@ gen_43 () #else handle_43 (0); #endif +return 0; } int @@ -949,6 +1355,7 @@ gen_44 () #else handle_44 (0); #endif +return 0; } int @@ -959,6 +1366,7 @@ gen_45 () #else handle_45 (0); #endif +return 0; } int @@ -969,6 +1377,7 @@ gen_46 () #else handle_46 (0); #endif +return 0; } int @@ -979,6 +1388,7 @@ gen_47 () #else handle_47 (0); #endif +return 0; } int @@ -989,6 +1399,7 @@ gen_48 () #else handle_48 (0); #endif +return 0; } int @@ -999,6 +1410,7 @@ gen_49 () #else handle_49 (0); #endif +return 0; } int @@ -1009,6 +1421,7 @@ gen_50 () #else handle_50 (0); #endif +return 0; } int @@ -1019,6 +1432,7 @@ gen_51 () #else handle_51 (0); #endif +return 0; } int @@ -1029,6 +1443,7 @@ gen_52 () #else handle_52 (0); #endif +return 0; } int @@ -1039,6 +1454,7 @@ gen_53 () #else handle_53 (0); #endif +return 0; } int @@ -1049,6 +1465,7 @@ gen_54 () #else handle_54 (0); #endif +return 0; } int @@ -1059,6 +1476,7 @@ gen_55 () #else handle_55 (0); #endif +return 0; } int @@ -1069,6 +1487,7 @@ gen_56 () #else handle_56 (0); #endif +return 0; } int @@ -1079,6 +1498,7 @@ gen_57 () #else handle_57 (0); #endif +return 0; } int @@ -1089,6 +1509,7 @@ gen_58 () #else handle_58 (0); #endif +return 0; } int @@ -1099,6 +1520,7 @@ gen_59 () #else handle_59 (0); #endif +return 0; } int @@ -1109,6 +1531,7 @@ gen_60 () #else handle_60 (0); #endif +return 0; } int @@ -1119,6 +1542,7 @@ gen_61 () #else handle_61 (0); #endif +return 0; } int @@ -1129,6 +1553,7 @@ gen_62 () #else handle_62 (0); #endif +return 0; } int @@ -1139,12 +1564,14 @@ gen_63 () #else handle_63 (0); #endif +return 0; } int gen_TERM () { kill (getpid (), SIGTERM); +return 0; } int diff --git a/gdb/testsuite/gdb.base/signals.c b/gdb/testsuite/gdb.base/signals.c index 280e6e7c5d..f1ebcfccb3 100644 --- a/gdb/testsuite/gdb.base/signals.c +++ b/gdb/testsuite/gdb.base/signals.c @@ -1,6 +1,7 @@ /* Test GDB dealing with stuff like stepping into sigtramp. */ #include +#include #ifdef __sh__ #define signal(a,b) /* Signals not supported on this target - make them go away */ @@ -9,9 +10,14 @@ static int count = 0; +#ifdef PROTOTYPES +static void +handler (int sig) +#else static void handler (sig) int sig; +#endif { signal (sig, handler); ++count; diff --git a/gdb/testsuite/gdb.base/signals.exp b/gdb/testsuite/gdb.base/signals.exp index 16528f731d..6511b2e44f 100644 --- a/gdb/testsuite/gdb.base/signals.exp +++ b/gdb/testsuite/gdb.base/signals.exp @@ -42,6 +42,12 @@ if [get_compiler_info ${binfile}] { return -1; } +if {$hp_cc_compiler} { + set void 0 +} else { + set void void +} + proc signal_tests_1 {} { global gdb_prompt if [runto_main] then { @@ -380,7 +386,7 @@ if [runto_main] then { # lose its cool, this is not a problem, it just has to note # that the breakpoint condition is false and keep going. - gdb_test "p func1 ()" "^p func1 \\(\\)\r\n.\[0-9\]* = void" \ + gdb_test "p func1 ()" "^p func1 \\(\\)\r\n.\[0-9\]* = $void" \ "p func1 () #1 in signals.exp" # Make sure the count got incremented. diff --git a/gdb/testsuite/gdb.base/so-impl-ld.c b/gdb/testsuite/gdb.base/so-impl-ld.c index a8fa18949b..9310bca142 100644 --- a/gdb/testsuite/gdb.base/so-impl-ld.c +++ b/gdb/testsuite/gdb.base/so-impl-ld.c @@ -4,9 +4,13 @@ #include -extern int solib_main (int); +#if defined(__cplusplus) || defined(__STDCPP__) +extern "C" int solib_main (int arg); +#else +int solib_main (int arg); +#endif -main () +int main () { int result; @@ -15,4 +19,5 @@ main () /* Call it again. */ result = solib_main (result); + return 0; } diff --git a/gdb/testsuite/gdb.base/so-impl-ld.exp b/gdb/testsuite/gdb.base/so-impl-ld.exp index a52aa1fdfb..beb2a6ac90 100644 --- a/gdb/testsuite/gdb.base/so-impl-ld.exp +++ b/gdb/testsuite/gdb.base/so-impl-ld.exp @@ -68,28 +68,23 @@ if {[gdb_compile "${srcdir}/${subdir}/${libfile}1.c" "${libfile}1.o" object [lis } if [istarget "hppa*-hp-hpux*"] then { - remote_exec build "ld -b ${libfile}1.o -o ${libfile}1.sl" + remote_exec build "ld -b ${libfile}1.o -o ${objdir}/${subdir}/${libfile}1.sl" } else { set additional_flags "additional_flags=-shared" - gdb_compile "${libfile}1.o" "${libfile}1.sl" executable [list debug $additional_flags] + gdb_compile "${libfile}1.o" "${objdir}/${subdir}/${libfile}1.sl" executable [list debug $additional_flags] } # Build the test case #remote_exec build "$CC -Aa -g ${srcfile} ${libfile}1.sl -o ${binfile}" -if {$gcc_compiled == 0} { - if [istarget "hppa*-hp-hpux*"] then { - set additional_flags "additional_flags=-Ae" - } else { - # don't know what the compiler is, hope for the best, maybe it's ANSI... - set additional_flags "" - } +if {$hp_cc_compiler} { + set additional_flags "additional_flags=-Ae" } else { set additional_flags "" } -if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${libfile}1.sl" "${binfile}" executable [list debug $additional_flags]] != ""} { +if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${objdir}/${subdir}/${libfile}1.sl" "${binfile}" executable [list debug $additional_flags]] != ""} { perror "Couldn't build ${binfile}" return -1 } @@ -110,7 +105,7 @@ if ![runto_main] then { fail "implicit solibs tests suppressed" } # send_gdb "next\n" gdb_expect { - -re "17\[ \t\]*result = solib_main .result.*$gdb_prompt $"\ + -re "21\[ \t\]*result = solib_main .result.*$gdb_prompt $"\ {pass "step over solib call"} -re "$gdb_prompt $"\ {fail "step over solib call"} @@ -121,7 +116,7 @@ gdb_expect { # send_gdb "step\n" gdb_expect { - -re "solib_main .arg=10000. at.*${libfile}1.c:8.*$gdb_prompt $"\ + -re "solib_main .arg=10000. at.*${libfile}1.c:17.*$gdb_prompt $"\ {pass "step into solib call"} -re "$gdb_prompt $"\ {fail "step into solib call"} @@ -132,7 +127,7 @@ gdb_expect { # send_gdb "next\n" gdb_expect { - -re "9\[ \t\]*\}.*$gdb_prompt $"\ + -re "18\[ \t\]*\}.*$gdb_prompt $"\ {pass "step in solib call"} -re "$gdb_prompt $"\ {fail "step in solib call"} @@ -148,7 +143,7 @@ gdb_expect { # we haven't left the callee yet, so do another next send_gdb "next\n" gdb_expect { - -re "main .. at.*so-impl-ld.c:18.*$gdb_prompt $"\ + -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\ {pass "step out of solib call"} -re "$gdb_prompt $"\ {fail "step out of solib call"} @@ -156,7 +151,7 @@ gdb_expect { } } - -re "main .. at.*so-impl-ld.c:18.*$gdb_prompt $"\ + -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\ {pass "step out of solib call"} -re "$gdb_prompt $"\ {fail "step out of solib call"} diff --git a/gdb/testsuite/gdb.base/so-indr-cl.c b/gdb/testsuite/gdb.base/so-indr-cl.c index dc29badcbd..f31800d04b 100644 --- a/gdb/testsuite/gdb.base/so-indr-cl.c +++ b/gdb/testsuite/gdb.base/so-indr-cl.c @@ -3,21 +3,28 @@ */ #include +#ifdef PROTOTYPES +extern "C" int solib_main (int); +static int +solib_wrapper (int (*function)(int)) +#else extern int solib_main (int); static int solib_wrapper (function) int (*function)(int); +#endif { return (*function)(100); } -main () +int main () { int result; /* This is an indirect call to solib_main. */ result = solib_wrapper (solib_main); + return 0; } diff --git a/gdb/testsuite/gdb.base/so-indr-cl.exp b/gdb/testsuite/gdb.base/so-indr-cl.exp index e37878e4a6..6847289474 100644 --- a/gdb/testsuite/gdb.base/so-indr-cl.exp +++ b/gdb/testsuite/gdb.base/so-indr-cl.exp @@ -51,13 +51,8 @@ if [get_compiler_info ${binfile}] { #remote_exec build "$CC -g +z -c ${libfile}1.c -o ${libfile}1.o" -if {$gcc_compiled == 0} { - if [istarget "hppa*-hp-hpux*"] then { - set additional_flags "additional_flags=+z" - } else { - # don't know what the compiler is... - set additional_flags "" - } +if {$hp_cc_compiler || $hp_aCC_compiler} { + set additional_flags "additional_flags=+z" } else { set additional_flags "additional_flags=-fpic" } @@ -77,13 +72,8 @@ if [istarget "hppa*-hp-hpux*"] then { #remote_exec build "$CC -Aa -g ${srcfile} ${libfile}1.sl -o ${binfile}" -if {$gcc_compiled == 0} { - if [istarget "hppa*-hp-hpux*"] then { - set additional_flags "additional_flags=-Ae" - } else { - # don't know what the compiler is, hope for the best, maybe it's ANSI... - set additional_flags "" - } +if {$hp_cc_compiler} { + set additional_flags "additional_flags=-Ae" } else { set additional_flags "" } @@ -119,6 +109,8 @@ send_gdb "break solib_main\n" gdb_expect { -re "Cannot break on solib_main without a running program.*$gdb_prompt $"\ {pass "break on indirect solib call before running"} + -re "Breakpoint.*deferred.*\\(\"solib_main\" was not found.*$gdb_prompt $"\ + {pass "break on indirect solib call before running 2"} -re "$gdb_prompt $"\ {fail "break on indirect solib call before running"} timeout {fail "(timeout) break on indirect solib call before running"} diff --git a/gdb/testsuite/gdb.base/solib.c b/gdb/testsuite/gdb.base/solib.c index ff9d359218..6fb9f5e11d 100644 --- a/gdb/testsuite/gdb.base/solib.c +++ b/gdb/testsuite/gdb.base/solib.c @@ -7,12 +7,12 @@ #include #include -main () +int main () { shl_t solib_handle; int dummy; int status; - int (*solib_main) (); + int (*solib_main) (int); /* Load a shlib, with immediate binding of all symbols. @@ -56,4 +56,5 @@ main () /* All done. */ dummy = -1; + return 0; } diff --git a/gdb/testsuite/gdb.base/solib.exp b/gdb/testsuite/gdb.base/solib.exp index f452194d8a..5e25b6890f 100644 --- a/gdb/testsuite/gdb.base/solib.exp +++ b/gdb/testsuite/gdb.base/solib.exp @@ -86,6 +86,31 @@ if [istarget "hppa*-*-hpux*"] { gdb_compile "${binfile}1.o" "${binfile}1.sl" executable [list debug $additional_flags] gdb_compile "${binfile}2.o" "${binfile}2.sl" executable [list debug $additional_flags] } + +# Build a version where the main program is in a shared library. For +# testing an indirect call made in a shared library. + +if {[gdb_compile "${srcdir}/${subdir}/${testfile}.c" "${binfile}_sl.o" object [list debug $additional_flags]] != ""} { + perror "Couldn't compile ${testfile}.c for ${binfile}_sl.o" + #return -1 +} + +if { [istarget "hppa*-*-hpux*"] } { + remote_exec build "ld -b ${binfile}_sl.o -o ${binfile}_sl.sl" +} else { + set additional_flags "additional_flags=-shared" + gdb_compile "${binfile}_sl.o" "${binfile}_sl.sl" executable [list debug $additional_flags] +} + +if { [istarget "hppa*-*-hpux*"] } { + set additional_flags "-Wl,-u,main" + if { [gdb_compile "${binfile}_sl.sl" "${binfile}_sl" executable [list debug $additional_flags]] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." + } +} else { + # FIXME: need to fill this part in for non-HP build +} + #cd .. # Start with a fresh gdb @@ -316,4 +341,20 @@ gdb_expect { # gdb_exit + +# +# Test stepping into an indirect call in a shared library. +# + +gdb_start +gdb_load ${binfile}_sl +gdb_test "break main" ".*deferred. at .main..*" "break on main" +gdb_test "run" ".*Breakpoint.*main.*solib.c.*" "hit breakpoint at main" +gdb_test "break 45" "Breakpoint.*solib.c, line 45.*" "break on indirect call" +gdb_test "continue" "Continuing.*solib.c:45.*" \ + "continue to break on indirect call" +gdb_test "step" "solib_main.*solib1.c:17.*return arg.arg.*" \ + "step into indirect call from a shared library" +gdb_exit + return 0 diff --git a/gdb/testsuite/gdb.base/solib1.c b/gdb/testsuite/gdb.base/solib1.c index eecf02438b..2e51750450 100644 --- a/gdb/testsuite/gdb.base/solib1.c +++ b/gdb/testsuite/gdb.base/solib1.c @@ -2,8 +2,17 @@ library, for use by the solib.exp testcase. It simply returns the square of its integer argument. */ +#if defined(__cplusplus) || defined(__STDCPP__) +extern "C" int +solib_main (int arg) +#else +#ifdef PROTOTYPES +int solib_main (int arg) +#else int solib_main (arg) int arg; +#endif +#endif { return arg*arg; } diff --git a/gdb/testsuite/gdb.base/solib2.c b/gdb/testsuite/gdb.base/solib2.c index 2cd451321b..8c69d8b273 100644 --- a/gdb/testsuite/gdb.base/solib2.c +++ b/gdb/testsuite/gdb.base/solib2.c @@ -2,8 +2,18 @@ library, for use by the solib.exp testcase. It simply returns the cube of its integer argument. */ +#ifdef __cplusplus +extern "C" { +#endif +#ifdef PROTOTYPES +int solib_main (int arg) +#else int solib_main (arg) int arg; +#endif { return arg*arg*arg; } +#ifdef __cplusplus +} +#endif diff --git a/gdb/testsuite/gdb.base/step-test.c b/gdb/testsuite/gdb.base/step-test.c index 7130725400..a1e1dc408c 100644 --- a/gdb/testsuite/gdb.base/step-test.c +++ b/gdb/testsuite/gdb.base/step-test.c @@ -1,9 +1,12 @@ +#include +#include + /* Test various kinds of stepping. */ -int glob = 0; +int myglob = 0; int callee() { - glob++; + myglob++; return 0; } /* A structure which, we hope, will need to be passed using memcpy. */ @@ -14,7 +17,7 @@ struct rhomboidal { void large_struct_by_value (struct rhomboidal r) { - glob += r.rather_large[42]; /* step-test.exp: arrive here 1 */ + myglob += r.rather_large[42]; /* step-test.exp: arrive here 1 */ } int main () { diff --git a/gdb/testsuite/gdb.base/step-test.exp b/gdb/testsuite/gdb.base/step-test.exp index 85744d7386..6eeda0b951 100644 --- a/gdb/testsuite/gdb.base/step-test.exp +++ b/gdb/testsuite/gdb.base/step-test.exp @@ -66,7 +66,7 @@ gdb_test "next" ".*${decimal}.*callee.*INTO.*" "next over" # Step into call # -gdb_test "step" ".*${decimal}.*glob.*" "step into" +gdb_test "step" ".*${decimal}.*myglob.*" "step into" # Step out of call # @@ -74,7 +74,18 @@ gdb_test "step" ".*${decimal}.*glob.*" "step into" # platforms, on which `finish' will return you to some kind of pop # instruction, which is attributed to the line containing the function # call? -gdb_test "finish" ".*${decimal}.*a.*5.*= a.*3.*" "step out" + +# On PA64 we end up at a different instruction than PA32 +if { [istarget "hppa2.0w-hp-hpux*"] } { + send_gdb "finish\n" + gdb_expect { + -re ".*${decimal}.*a.*5.*= a.*3.*$gdb_prompt $" { pass "step out 1" } + -re ".*${decimal}.*callee.*INTO.*$gdb_prompt $" { pass "step out 2" } + timeout { fail "step out" } + } +} else { + gdb_test "finish" ".*${decimal}.*a.*5.*= a.*3.*" "step out" +} ### Testing nexti and stepi. ### @@ -154,6 +165,16 @@ gdb_expect { puts "*** Matched success..." pass "stepi: finish call" } + -re ".*${decimal}.*callee.*STEPI.*$gdb_prompt $" { + # On PA64 we end up at a different instruction than PA32 + if { [istarget "hppa2.0w-hp-hpux*"] } { + puts "*** Matched success..." + pass "stepi: finish call 2" + } else { + fail "stepi: finish call 2" + return + } + } -re "$gdb_prompt $" { # We got something else. Fail. fail "stepi: finish call" diff --git a/gdb/testsuite/gdb.base/term.exp b/gdb/testsuite/gdb.base/term.exp index 211a94c112..26c10323c9 100644 --- a/gdb/testsuite/gdb.base/term.exp +++ b/gdb/testsuite/gdb.base/term.exp @@ -43,6 +43,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +gdb_exit +gdb_start delete_breakpoints gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} diff --git a/gdb/testsuite/gdb.base/twice.c b/gdb/testsuite/gdb.base/twice.c index c50a2b362d..09eb2ddf5a 100644 --- a/gdb/testsuite/gdb.base/twice.c +++ b/gdb/testsuite/gdb.base/twice.c @@ -1,3 +1,4 @@ +#include int nothing () { @@ -6,7 +7,7 @@ int nothing () } -main () +int main () { int y ; @@ -16,4 +17,5 @@ main () #endif y = nothing () ; printf ("hello\n") ; + return 0; } diff --git a/gdb/testsuite/gdb.base/twice.exp b/gdb/testsuite/gdb.base/twice.exp index 8d8c403a7c..4c96b363f0 100644 --- a/gdb/testsuite/gdb.base/twice.exp +++ b/gdb/testsuite/gdb.base/twice.exp @@ -60,4 +60,5 @@ if [runto_main] then { gdb_test "step" "nothing \\(\\) at.*" } +remote_exec build "rm -f twice.c" return 0 diff --git a/gdb/testsuite/gdb.base/varargs.c b/gdb/testsuite/gdb.base/varargs.c index 729d7df5be..666425345f 100644 --- a/gdb/testsuite/gdb.base/varargs.c +++ b/gdb/testsuite/gdb.base/varargs.c @@ -18,11 +18,12 @@ short s; unsigned short us; int a,b,c,d; int max_val; +long long ll; float fa,fb,fc,fd; double da,db,dc,dd; double dmax_val; -main() { +int main() { c = -1; uc = 1; s = -2; @@ -43,6 +44,8 @@ main() { dd = 2.0; dmax_val = find_max_double(3, 1.0, 4.0, 2.0); dmax_val = find_max_double(a, db, dc, dd); + + return 0; } /* Integer varargs, 1 declared arg */ diff --git a/gdb/testsuite/gdb.base/varargs.exp b/gdb/testsuite/gdb.base/varargs.exp index 72fd2f52d6..2fb8f3bc39 100644 --- a/gdb/testsuite/gdb.base/varargs.exp +++ b/gdb/testsuite/gdb.base/varargs.exp @@ -48,23 +48,14 @@ if [get_compiler_info ${binfile}] { return -1 } -if {$gcc_compiled == 0} { - if [istarget "hppa*-hp-hpux*"] then { - set additional_flags "additional_flags=-Ae" - } else { - # don't know what the compiler is, hope for the best, maybe it's ANSI... - set additional_flags "" - } +if {$hp_cc_compiler} { + set additional_flags "additional_flags=-Ae" } else { set additional_flags "" } # build the first test case -#if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } { -# gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -#} - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } { +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug ${additional_flags}}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } @@ -84,6 +75,18 @@ if ![runto_main] then { continue } +if { $hp_aCC_compiler } { + # When compiled w/ aCC we need to disable overload resolution + # for command line calls. + # We need it for vararg calls since the aCC compiler gives us no + # information about the undeclared arguments, or even that there + # _are_ undeclared arguments. As far as gdb is concerned it only + # knows about the declared arguments. So we need to force the call + # even though the overload resolution mechanism says that the types + # don't match. + # - guo + gdb_test "set overload-resolution 0" "" +} send_gdb "print find_max1(5,1,2,3,4,5)\n" gdb_expect { diff --git a/gdb/testsuite/gdb.base/volatile.exp b/gdb/testsuite/gdb.base/volatile.exp index a2a2b59f5f..7796ed5874 100644 --- a/gdb/testsuite/gdb.base/volatile.exp +++ b/gdb/testsuite/gdb.base/volatile.exp @@ -49,7 +49,13 @@ set testfile "constvars" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { +if [istarget "hppa*-*-*"] { + set lang "c++" +} else { + set lang "" +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [concat debug $lang]] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } @@ -100,142 +106,142 @@ send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" # these tests are all expected to fail if GCC is the compiler. -sts if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vox" "type = volatile char" +gdb_test "ptype vox" "type = volatile char.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype victuals" "type = volatile unsigned char" +gdb_test "ptype victuals" "type = volatile unsigned char.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vixen" "type = volatile short" +gdb_test "ptype vixen" "type = volatile short.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vitriol" "type = volatile unsigned short" +gdb_test "ptype vitriol" "type = volatile unsigned short.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vellum" "type = volatile long" +gdb_test "ptype vellum" "type = volatile long.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype valve" "type = volatile unsigned long" +gdb_test "ptype valve" "type = volatile unsigned long.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vacuity" "type = volatile float" +gdb_test "ptype vacuity" "type = volatile float.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vertigo" "type = volatile double" +gdb_test "ptype vertigo" "type = volatile double.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vampire" "type = volatile char *" +gdb_test "ptype vampire" "type = volatile char \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype viper" "type = volatile unsigned char *" +gdb_test "ptype viper" "type = volatile unsigned char \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vigour" "type = volatile short *" +gdb_test "ptype vigour" "type = volatile short \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vapour" "type = volatile unsigned short *" +gdb_test "ptype vapour" "type = volatile unsigned short \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype ventricle" "type = volatile long *" +gdb_test "ptype ventricle" "type = volatile long \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vigintillion" "type = volatile unsigned long *" +gdb_test "ptype vigintillion" "type = volatile unsigned long \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vocation" "type = volatile float *" +gdb_test "ptype vocation" "type = volatile float \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype veracity" "type = volatile double *" +gdb_test "ptype veracity" "type = volatile double \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vapidity" "type = volatile char * volatile" +gdb_test "ptype vapidity" "type = volatile char \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype velocity" "type = volatile unsigned char * volatile" +gdb_test "ptype velocity" "type = volatile unsigned char \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype veneer" "type = volatile short * volatile" +gdb_test "ptype veneer" "type = volatile short \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype video" "type = volatile unsigned short * volatile" +gdb_test "ptype video" "type = volatile unsigned short \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vacuum" "type = volatile long * volatile" +gdb_test "ptype vacuum" "type = volatile long \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype veniality" "type = volatile unsigned long * volatile" +gdb_test "ptype veniality" "type = volatile unsigned long \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vitality" "type = volatile float * volatile" +gdb_test "ptype vitality" "type = volatile float \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype voracity" "type = volatile double * volatile" +gdb_test "ptype voracity" "type = volatile double \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype victor" "type = const volatile char" +gdb_test "ptype victor" "type = const volatile char.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vicar" "type = const volatile unsigned char" +gdb_test "ptype vicar" "type = const volatile unsigned char.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype victory" "type = const volatile char *" +gdb_test "ptype victory" "type = const volatile char \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vicarage" "type = const volatile unsigned char *" +gdb_test "ptype vicarage" "type = const volatile unsigned char \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vein" "type = volatile char * const" +gdb_test "ptype vein" "type = volatile char \\* const.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vogue" "type = volatile unsigned char * const" +gdb_test "ptype vogue" "type = volatile unsigned char \\* const.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype cavern" "type = const volatile char * const" +gdb_test "ptype cavern" "type = const volatile char \\* const.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype coverlet" "type = const volatile unsigned char * const" +gdb_test "ptype coverlet" "type = const volatile unsigned char \\* const.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype caveat" "type = const char * volatile" +gdb_test "ptype caveat" "type = const char \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype covenant" "type = const unsigned char * volatile" +gdb_test "ptype covenant" "type = const unsigned char \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vizier" "type = const volatile char * volatile" +gdb_test "ptype vizier" "type = const volatile char \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vanadium" "type = const volatile unsigned char * volatile" +gdb_test "ptype vanadium" "type = const volatile unsigned char \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vane" "type = char * const volatile" +gdb_test "ptype vane" "type = char \\* const volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype veldt" "type = unsigned char * const volatile" +gdb_test "ptype veldt" "type = unsigned char \\* const volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype cove" "type = const char * const volatile" +gdb_test "ptype cove" "type = const char \\* const volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype cavity" "type = const unsigned char * const volatile" +gdb_test "ptype cavity" "type = const unsigned char \\* const volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vagus" "type = volatile char * const volatile" +gdb_test "ptype vagus" "type = volatile char \\* const volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vagrancy" "type = volatile unsigned char * const volatile" +gdb_test "ptype vagrancy" "type = volatile unsigned char \\* const volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vagary" "type = const volatile char * const volatile" +gdb_test "ptype vagary" "type = const volatile char \\* const volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vendor" "type = const volatile unsigned char * const volatile" +gdb_test "ptype vendor" "type = const volatile unsigned char \\* const volatile.*" # test function parameters if {$gcc_compiled} then { setup_xfail "*-*-*" } send_gdb "ptype qux2\n" gdb_expect { - -re "type = int \\(volatile unsigned char, const volatile int, volatile short &, volatile long \\*, float \\* volatile, const volatile signed char \\* const volatile\\)" { + -re "type = int \\(volatile unsigned char, const volatile int, volatile short, volatile long \\*, float \\* volatile, const volatile signed char \\* const volatile\\).*$gdb_prompt $" { pass "ptype qux2" } -re ".*$gdb_prompt $" { fail "ptype qux2" } diff --git a/gdb/testsuite/gdb.base/watchpoint.c b/gdb/testsuite/gdb.base/watchpoint.c index bd54f3e962..14ccecd525 100644 --- a/gdb/testsuite/gdb.base/watchpoint.c +++ b/gdb/testsuite/gdb.base/watchpoint.c @@ -1,4 +1,5 @@ #include +#include /* * Since using watchpoints can be very slow, we have to take some pains to * ensure that we don't run too long with them enabled or we run the risk @@ -28,6 +29,7 @@ int ival1 = -1; int ival2 = -1; int ival3 = -1; int ival4 = -1; +int ival5 = -1; char buf[10]; struct foo { @@ -53,9 +55,32 @@ void marker5 () { } +void marker6 () +{ +} + +#ifdef PROTOTYPES +void recurser (int x) +#else +void recurser (x) int x; +#endif +{ + int local_x; + + if (x > 0) + recurser (x-1); + local_x = x; +} + void func2 () { + int local_a; + static int static_b; + + ival5++; + local_a = ival5; + static_b = local_a; } int @@ -120,5 +145,30 @@ int main () are not evaluating the watchpoint expression correctly. */ struct1.val = 5; marker5 (); + + /* We're going to watch locals of func2, to see that out-of-scope + watchpoints are detected and properly deleted. + */ + marker6 (); + + /* This invocation is used for watches of a single + local variable. */ + func2 (); + + /* This invocation is used for watches of an expression + involving a local variable. */ + func2 (); + + /* This invocation is used for watches of a static + (non-stack-based) local variable. */ + func2 (); + + /* This invocation is used for watches of a local variable + when recursion happens. + */ + marker6 (); + recurser (2); + + marker6 (); return 0; } diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index 53f2e8b03a..7dced3b0e3 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -30,20 +30,12 @@ set testfile "watchpoint" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} +set wp_set 1 if [get_compiler_info ${binfile}] { return -1 } -# if we are on HPUX and we are not compiled with gcc, then skip these tests. - -if [istarget hppa*-*-hpux*] { - if {!$gcc_compiled} { - continue - } -} - - if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } @@ -69,6 +61,7 @@ proc initialize {} { global hex global decimal global srcfile + global wp_set if [gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker1" ] { return 0; @@ -85,11 +78,27 @@ proc initialize {} { } - if [gdb_test "watch ival3" ".*\[Ww\]atchpoint 3: ival3" "set watchpoint on ival3" ] { - return 0; + # ??rehrauer: To fix DTS #CHFts23014, in which setting a watchpoint + # before running can cause the inferior to croak on HP-UX 10.30 and + # 11.0 for reasons as yet unknown, we've disabled the ability to set + # watches without a running inferior. Verify the restriction. + # + send_gdb "watch ival3\n" + gdb_expect { + -re ".*\[Ww\]atchpoint 3: ival3.*$gdb_prompt $" { + pass "set watchpoint on ival3" + } + -re "warning: can't do that without a running program; try \"break main\", \"run\" first.*$gdb_prompt $" { + pass "set watchpoint on ival3" + set wp_set 0 + return 1 + } + timeout { + fail "(timeout) set watchpoint on ival3" + return 0 + } } - # "info watch" is the same as "info break" if [gdb_test "info watch" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n3\[ \]*.*watchpoint.*ival3" "watchpoint found in watchpoint/breakpoint table" ] { @@ -117,11 +126,14 @@ proc test_simple_watchpoint {} { global gdb_prompt global hex global decimal + global wp_set # Ensure that the watchpoint is disabled when we startup. - if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_simple_watchpoint" ] { - return 0; + if { $wp_set } { + if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_simple_watchpoint" ] { + return 0; + } } @@ -143,6 +155,51 @@ proc test_simple_watchpoint {} { } } + if { !$wp_set } { + # ??rehrauer: To fix DTS #CHFts23014, in which setting a watchpoint + # before running can cause the inferior to croak on HP-UX 10.30 and + # 11.0 for reasons as yet unknown, we've disabled the ability to set + # watches without a running inferior. The following testpoints used + # to be in [initialize]. + # + send_gdb "watch ival3\n" + gdb_expect { + -re ".*\[Ww\]atchpoint 3: ival3\r\n$gdb_prompt $" { + pass "set watchpoint on ival3" + } + -re ".*$gdb_prompt $" { fail "set watchpoint on ival3" } + timeout { fail "set watchpoint on ival3 (timeout)" } + } + + set wp_set 1 + + # "info watch" is the same as "info break" + + send_gdb "info watch\n" + gdb_expect { + -re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n3\[ \]*.*watchpoint.*ival3\r\n$gdb_prompt $" { + pass "watchpoint found in watchpoint/breakpoint table" + } + -re ".*$gdb_prompt $" { + fail "watchpoint found in watchpoint/breakpoint table" + } + timeout { + fail "watchpoint found in watchpoint/breakpoint table" + } + } + + # After installing the watchpoint, we disable it until we are ready + # to use it. This allows the test program to run at full speed until + # we get to the first marker function. + + send_gdb "disable 3\n" + gdb_expect { + -re "disable 3\[\r\n\]+$gdb_prompt $" { pass "disable watchpoint" } + -re ".*$gdb_prompt $" { fail "disable watchpoint" } + timeout { fail "disable watchpoint (timeout)" } + } + } + # After reaching the marker function, enable the watchpoint. if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "enable watchpoint" ] { @@ -221,6 +278,9 @@ proc test_disabling_watchpoints {} { global decimal global hex + # "info watch" is the same as "info break" + gdb_test "info watch" "\[0-9\]+\[ \]*breakpoint.*marker1.*\r\n\[0-9\]+\[ \]*breakpoint.*marker2.*\r\n\[0-9]+\[ \]*.*watchpoint.*ival3\r\n\.*\[0-9\]+ times.*" "watchpoints found in watchpoint/breakpoint table" + # Ensure that the watchpoint is disabled when we startup. if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_disabling_watchpoints" ] { @@ -270,7 +330,7 @@ proc test_disabling_watchpoints {} { # Check watchpoint list, looking for the entry that confirms the # watchpoint is disabled. - gdb_test "info watchpoints" "3\[ \]*.*watchpoint\[ \]*keep\[ \]*n\[ \]*ival3\r\n.*" "watchpoint disabled in table" + gdb_test "info watchpoints" "\[0-9]+\[ \]*.*watchpoint\[ \]*keep\[ \]*n\[ \]*ival3\r\n.*" "watchpoint disabled in table" # Continue until we hit the finishing marker function. # Make sure we hit no more watchpoints. @@ -293,35 +353,30 @@ proc test_stepping {} { gdb_test "break func2 if 0" "Breakpoint.*at.*" gdb_test "p \$func2_breakpoint_number = \$bpnum" " = .*" - # The HPPA has a problem here if it's not using hardware watchpoints - if {[ istarget "hppa*-*-*" ] && ![ istarget "hppa*-*-*bsd*" ]} then { - # Don't actually try doing the call, if we do we can't continue. - setup_xfail "*-*-*" - fail "calling function with watchpoint enabled" - } else { - # The problem is that GDB confuses stepping through the call - # dummy with hitting the breakpoint at the end of the call dummy. - # Will be fixed once all architectures define - # CALL_DUMMY_BREAKPOINT_OFFSET. - setup_xfail "*-*-*" - # This doesn't occur if the call dummy starts with a call, - # because we are out of the dummy by the first time the inferior - # stops. - clear_xfail "d10v*-*-*" - clear_xfail "m68*-*-*" - clear_xfail "i*86*-*-*" - clear_xfail "vax-*-*" - # The following architectures define CALL_DUMMY_BREAKPOINT_OFFSET. - clear_xfail "alpha-*-*" - clear_xfail "mips*-*-*" - clear_xfail "sparc-*-*" - clear_xfail "hppa*-*-*bsd*" - # It works with the generic inferior function calling code too. - clear_xfail "mn10200*-*-*" - clear_xfail "mn10300*-*-*" - gdb_test "p func1 ()" "= 73" \ - "calling function with watchpoint enabled" - } + # The problem is that GDB confuses stepping through the call + # dummy with hitting the breakpoint at the end of the call dummy. + # Will be fixed once all architectures define + # CALL_DUMMY_BREAKPOINT_OFFSET. + setup_xfail "*-*-*" + # This doesn't occur if the call dummy starts with a call, + # because we are out of the dummy by the first time the inferior + # stops. + clear_xfail "d10v*-*-*" + clear_xfail "m68*-*-*" + clear_xfail "i*86*-*-*" + clear_xfail "vax-*-*" + # The following architectures define CALL_DUMMY_BREAKPOINT_OFFSET. + clear_xfail "alpha-*-*" + clear_xfail "mips*-*-*" + clear_xfail "sparc-*-*" + clear_xfail "hppa*-*-*bsd*" + # It works with the generic inferior function calling code too. + clear_xfail "mn10200*-*-*" + clear_xfail "mn10300*-*-*" + # The following architectures define CALL_DUMMY_HAS_COMPLETED. + clear_xfail "hppa*-*-*hpux*" + gdb_test "p func1 ()" "= 73" \ + "calling function with watchpoint enabled" # # "finish" brings us back to main. @@ -495,18 +550,82 @@ proc test_complex_watchpoint {} { gdb_test "cont" "Continuing.*Breakpoint.*marker5 \\(\\).*" \ "did not trigger wrong watchpoint" + # Test watches of things declared locally in a function. + # In particular, test that a watch of stack-based things + # is deleted when the stack-based things go out of scope. + # + gdb_test "disable" "" "disable in test_complex_watchpoint" + gdb_test "break marker6" ".*Breakpoint.*" + gdb_test "cont" "Continuing.*Breakpoint.*marker6 \\(\\).*" \ + "continue to marker6" + gdb_test "break func2" ".*Breakpoint.*" + gdb_test "cont" "Continuing.*func2.*" + + # Test a watch of a single stack-based variable, whose scope + # is the function we're now in. This should auto-delete when + # execution exits the scope of the watchpoint. + # + gdb_test "watch local_a" ".*\[Ww\]atchpoint \[0-9\]*: local_a" "set local watch" + gdb_test "cont" "\[Ww\]atchpoint.*local_a.*" "trigger local watch" + gdb_test "cont" "Continuing.*\[Ww\]atchpoint .* deleted because the program has left the block in.*which its expression is valid.*" "self-delete local watch" + + gdb_test "cont" "Continuing.*func2.*" + # We should be in "func2" again now. Test a watch of an + # expression which includes both a stack-based local and + # something whose scope is larger than this invocation + # of "func2". This should also auto-delete. + # + gdb_test "watch local_a + ival5" ".*\[Ww\]atchpoint \[0-9\]*: local_a . ival5" \ + "set partially local watch" + gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: local_a . ival5.*" \ + "trigger1 partially local watch" + gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: local_a . ival5.*" \ + "trigger2 partially local watch" + gdb_test "cont" "Continuing.*\[Ww\]atchpoint .* deleted because the program has left the block in.*which its expression is valid.*" \ + "self-delete partially local watch" + + # We should be in "func2" again now. Test a watch of a + # static (non-stack-based) local. Since this has scope + # across any invocations of "func2", it should not auto- + # delete. + # + gdb_test "cont" "Continuing.*func2.*" + gdb_test "watch static_b" ".*\[Ww\]atchpoint \[0-9\]*: static_b" \ + "set static local watch" + gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: static_b.*" \ + "trigger static local watch" + gdb_test "cont" "Continuing.*marker6 \\(\\).*" \ + "continue after trigger static local watch" + gdb_test "info break" ".*watchpoint.*static_b.*" \ + "static local watch did not self-delete" + + # We should be in "recurser" now. Test a watch of a stack- + # based local. Symbols mentioned in a watchpoint are bound + # at watchpoint-creation. Thus, a watch of a stack-based + # local to a recursing function should be bound only to that + # one invocation, and should not trigger for other invocations. + # + gdb_test "tbreak recurser" ".*Breakpoint.*" + gdb_test "cont" "Continuing.*recurser.*" + gdb_test "watch local_x" ".*\[Ww\]atchpoint \[0-9\]*: local_x" \ + "set local watch in recursive call" + gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: local_x.*New value = 2.*" \ + "trigger local watch in recursive call" + gdb_test "cont" "Continuing.*\[Ww\]atchpoint .* deleted because the program has left the block in.*which its expression is valid.*" \ + "self-delete local watch in recursive call" + # Disable everything so we can finish the program at full speed gdb_test "disable" "" "disable in test_complex_watchpoint" if [target_info exists gdb,noresults] { return } - - gdb_continue_to_end "continue to exit in test_complex_watchpoint" + gdb_continue_to_end "continue to exit in test_complex_watchpoint" } } # Start with a fresh gdb. +gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load $binfile @@ -576,4 +695,82 @@ if [initialize] then { [istarget "m32r-*-*"]} then { test_complex_watchpoint } + + # Verify that a user can force GDB to use "slow" watchpoints. + # (This proves rather little on kernels that don't support + # fast watchpoints, but still...) + # + if ![runto_main] then { fail "watch tests suppressed" } + + send_gdb "set can-use-hw-watchpoints 0\n" + gdb_expect { + -re "$gdb_prompt $"\ + {pass "disable fast watches"} + timeout {fail "(timeout) disable fast watches"} + } + send_gdb "show can-use-hw-watchpoints\n" + gdb_expect { + -re "Debugger's willingness to use watchpoint hardware is 0.*$gdb_prompt $"\ + {pass "show disable fast watches"} + -re "$gdb_prompt $"\ + {fail "show disable fast watches"} + timeout {fail "(timeout) show disable fast watches"} + } + send_gdb "watch ival3 if count > 1\n" + gdb_expect { + -re "Watchpoint \[0-9\]*: ival3.*$gdb_prompt $"\ + {pass "set slow conditional watch"} + -re "$gdb_prompt $"\ + {fail "set slow conditional watch"} + timeout {fail "(timeout) set slow conditional watch"} + } + send_gdb "continue\n" + gdb_expect { + -re "Watchpoint \[0-9\]*: ival3.*Old value = 1.*New value = 2.*$gdb_prompt $"\ + {pass "trigger slow conditional watch"} + -re "$gdb_prompt $"\ + {fail "trigger slow conditional watch"} + timeout {fail "(timeout) trigger slow conditional watch"} + } + + # We've explicitly disabled hardware watches. Verify that GDB + # + # + send_gdb "rwatch ival3\n" + gdb_expect { + -re "Expression cannot be implemented with read/access watchpoint..*$gdb_prompt $"\ + {pass "rwatch disallowed when can-set-hw-watchpoints cleared"} + -re "$gdb_prompt $"\ + {fail "rwatch disallowed when can-set-hw-watchpoints cleared"} + timeout {fail "(timeout) rwatch disallowed when can-use-hw-watchpoints cleared"} + } + + # Read- and access watchpoints are unsupported on HP-UX. Verify + # that GDB gracefully responds to requests to create them. + # + if [istarget "hppa*-*-hpux*"] then { + send_gdb "set can-use-hw-watchpoints 1\n" + gdb_expect { + -re "$gdb_prompt $"\ + {pass "enable fast watches"} + timeout {fail "(timeout) enable fast watches"} + } + send_gdb "rwatch ival3\n" + gdb_expect { + -re "Target does not have this type of hardware watchpoint support.*$gdb_prompt $"\ + {pass "read watches disallowed"} + -re "$gdb_prompt $"\ + {fail "read watches disallowed"} + timeout {fail "(timeout) read watches disallowed"} + } + + send_gdb "awatch ival3\n" + gdb_expect { + -re "Target does not have this type of hardware watchpoint support.*$gdb_prompt $"\ + {pass "access watches disallowed"} + -re "$gdb_prompt $"\ + {fail "access watches disallowed"} + timeout {fail "(timeout) access watches disallowed"} + } + } } diff --git a/gdb/testsuite/gdb.base/whatis.c b/gdb/testsuite/gdb.base/whatis.c index 6d8d1e64bb..63d5d3dae0 100644 --- a/gdb/testsuite/gdb.base/whatis.c +++ b/gdb/testsuite/gdb.base/whatis.c @@ -188,7 +188,7 @@ enum cars {chevy, ford, porsche} clunker; /***********/ -main () +int main () { #ifdef usestubs set_debug_traps(); diff --git a/gdb/testsuite/gdb.base/whatis.exp b/gdb/testsuite/gdb.base/whatis.exp index 1f4e8b35de..d540e4cd80 100644 --- a/gdb/testsuite/gdb.base/whatis.exp +++ b/gdb/testsuite/gdb.base/whatis.exp @@ -49,14 +49,6 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load $binfile -# If we did not use the signed keyword when compiling the file, don't -# expect GDB to know that char is signed. -if $signed_keyword_not_used then { - set signed_char "char" -} else { - set signed_char "signed char" -} - # Define a procedure to set up an xfail for all targets that put out a # `long' type as an `int' type. # Sun/Ultrix cc have this problem. @@ -77,10 +69,21 @@ proc setup_xfail_on_long_vs_int {} { # uses in the stabs. So we need to deal with names both from gcc and # native compilers. # + gdb_test "whatis v_char" \ "type = (unsigned char|char)" \ "whatis char" +# If we did not use the signed keyword when compiling the file, don't +# expect GDB to know that char is signed. +if { $hp_cc_compiler || $hp_aCC_compiler } { + set signed_keyword_not_used 1 +} +if $signed_keyword_not_used then { + set signed_char "char" +} else { + set signed_char "signed char" +} setup_xfail "a29k-*-*" if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" } gdb_test "whatis v_signed_char" \ @@ -270,13 +273,21 @@ gdb_test "whatis v_double_pointer" \ "whatis double pointer" +if { $hp_aCC_compiler } { + set unstruct "unnamed\.struct\..*" + set ununion "unnamed\.union\..*" +} else { + set unstruct "\.\.\." + set ununion "\.\.\." +} + # test whatis command with structure types gdb_test "whatis v_struct1" \ "type = struct t_struct" \ "whatis named structure" gdb_test "whatis v_struct2" \ - "type = struct \{...\}" \ + "type = struct \{$unstruct\}" \ "whatis unnamed structure" @@ -286,68 +297,78 @@ gdb_test "whatis v_union" \ "whatis named union" gdb_test "whatis v_union2" \ - "type = union \{...\}" \ + "type = union \{$ununion\}" \ "whatis unnamed union" +if { [istarget "hppa*-hp-hpux10.20"] && $hp_aCC_compiler } { + # On HP-UX 10.20 with aCC compiler and objdebug mode, + # we need the 'void' pattern; without objdebug mode, + # we still need to '' pattern. + # FIXME: need to look into this further. + # - guo + set void "(void|)" +} else { + set void "" +} # test whatis command with functions return type gdb_test "whatis v_char_func" \ - "type = (signed |unsigned |)char \\(\\)" \ + "type = (signed |unsigned |)char \\($void\\)" \ "whatis char function" gdb_test "whatis v_signed_char_func" \ - "type = (signed |unsigned |)char \\(\\)" \ + "type = (signed |unsigned |)char \\($void\\)" \ "whatis signed char function" gdb_test "whatis v_unsigned_char_func" \ - "type = unsigned char \\(\\)" \ + "type = unsigned char \\($void\\)" \ "whatis unsigned char function" gdb_test "whatis v_short_func" \ - "type = short (int |)\\(\\)" \ + "type = short (int |)\\($void\\)" \ "whatis short function" gdb_test "whatis v_signed_short_func" \ - "type = (signed |)short (int |)\\(\\)" \ + "type = (signed |)short (int |)\\($void\\)" \ "whatis signed short function" gdb_test "whatis v_unsigned_short_func" \ - "type = (unsigned short|short unsigned int) \\(\\)" \ + "type = (unsigned short|short unsigned int) \\($void\\)" \ "whatis unsigned short function" gdb_test "whatis v_int_func" \ - "type = int \\(\\)" \ + "type = int \\($void\\)" \ "whatis int function" gdb_test "whatis v_signed_int_func" \ - "type = (signed |)int \\(\\)" \ + "type = (signed |)int \\($void\\)" \ "whatis signed int function" gdb_test "whatis v_unsigned_int_func" \ - "type = unsigned int \\(\\)" \ + "type = unsigned int \\($void\\)" \ "whatis unsigned int function" gdb_test "whatis v_long_func" \ - "type = (long|int|long int) \\(\\)" \ + "type = (long|int|long int) \\($void\\)" \ "whatis long function" gdb_test "whatis v_signed_long_func" \ - "type = (signed |)(int|long|long int) \\(\\)" \ + "type = (signed |)(int|long|long int) \\($void\\)" \ "whatis signed long function" gdb_test "whatis v_unsigned_long_func" \ - "type = (unsigned (int|long|long int)|long unsigned int) \\(\\)" \ + "type = (unsigned (int|long|long int)|long unsigned int) \\($void\\)" \ "whatis unsigned long function" # Sun /bin/cc calls this a function returning double. if {!$gcc_compiled} then {setup_xfail "*-sun-sunos4*"} gdb_test "whatis v_float_func" \ - "type = float \\(\\)" \ + "type = float \\($void\\)" \ "whatis float function" gdb_test "whatis v_double_func" \ - "type = double \\(\\)" \ + "type = double \\($void\\)" \ "whatis double function" \ @@ -376,8 +397,14 @@ gdb_test "whatis nested_su.outer_int" \ "type = int" \ "whatis outer structure member" +if {$hp_aCC_compiler} { + set outer "outer_struct::" +} else { + set outer "" +} + gdb_test "whatis nested_su.inner_struct_instance" \ - "type = struct inner_struct" \ + "type = struct ${outer}inner_struct" \ "whatis inner structure" gdb_test "whatis nested_su.inner_struct_instance.inner_int" \ @@ -385,7 +412,7 @@ gdb_test "whatis nested_su.inner_struct_instance.inner_int" \ "whatis inner structure member" gdb_test "whatis nested_su.inner_union_instance" \ - "type = union inner_union" \ + "type = union ${outer}inner_union" \ "whatis inner union" gdb_test "whatis nested_su.inner_union_instance.inner_union_int" \ diff --git a/gdb/testsuite/gdb.c++/member-ptr.exp b/gdb/testsuite/gdb.c++/member-ptr.exp index 7b4dd7c1bf..9bf2431c7f 100644 --- a/gdb/testsuite/gdb.c++/member-ptr.exp +++ b/gdb/testsuite/gdb.c++/member-ptr.exp @@ -42,6 +42,20 @@ set testfile "member-ptr" set srcfile ${testfile}.cc set binfile ${objdir}/${subdir}/${testfile} +# Create and source the file that provides information about the compiler +# used to compile the test case. + +if [get_compiler_info ${binfile} "c++"] { + return -1 +} + +# Nearly all of these tests fail when compiled with G++, so just give up +# until GDB gets enhanced. -sts 1999-06-22 + +if {$gcc_compiled} { + continue +} + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.chill/ChangeLog b/gdb/testsuite/gdb.chill/ChangeLog index 9db44ea6b3..fe5a3176aa 100644 --- a/gdb/testsuite/gdb.chill/ChangeLog +++ b/gdb/testsuite/gdb.chill/ChangeLog @@ -1,3 +1,9 @@ +1999-06-25 Stan Shebs + + From Jimmy Guo : + * xstruct-grt.ch, xstruct.ch, xstruct.exp: Rename to mollify + doschk. + Thu May 21 02:45:18 1998 Felix Lee * chexp.exp: fix tests that assume >16-bit ints. diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 95ed5348b4..cb277bed82 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -63,6 +63,8 @@ if ![info exists gdb_prompt] then { set gdb_prompt "\[(\]gdb\[)\]" } +### Only procedures should come after this point. + # # gdb_version -- extract and print the version number of GDB # @@ -893,7 +895,40 @@ proc get_compiler_info {binfile args} { } } - source ${binfile}.ci + uplevel \#0 { set gcc_compiled 0 } + + if { [llength $args] == 0 || $args != "f77" } { + source ${binfile}.ci + } + + # Most compilers will evaluate comparisons and other boolean + # operations to 0 or 1. + uplevel \#0 { set true 1 } + uplevel \#0 { set false 0 } + + uplevel \#0 { set hp_cc_compiler 0 } + uplevel \#0 { set hp_aCC_compiler 0 } + uplevel \#0 { set hp_f77_compiler 0 } + uplevel \#0 { set hp_f90_compiler 0 } + if { !$gcc_compiled && [istarget "hppa*-*-hpux*"] } { + # Check for the HP compilers + set compiler [lindex [split [get_compiler $args] " "] 0] + catch "exec what $compiler" output + if [regexp ".*HP aC\\+\\+.*" $output] { + uplevel \#0 { set hp_aCC_compiler 1 } + # Use of aCC results in boolean results being displayed as + # "true" or "false" + uplevel \#0 { set true true } + uplevel \#0 { set false false } + } elseif [regexp ".*HP C Compiler.*" $output] { + uplevel \#0 { set hp_cc_compiler 1 } + } elseif [regexp ".*HP-UX f77.*" $output] { + uplevel \#0 { set hp_f77_compiler 1 } + } elseif [regexp ".*HP-UX f90.*" $output] { + uplevel \#0 { set hp_f90_compiler 1 } + } + } + return 0; } @@ -1060,6 +1095,52 @@ proc gdb_expect { args } { } } +# +# Check for long sequence of output by parts. +# TEST: is the test message. +# SENTINEL: Is the terminal pattern indicating that output has finished. +# LIST: is the sequence of outputs to match. +# If the sentinel is recognized early, it is considered an error. +# +proc gdb_expect_list {test sentinal list} { + global gdb_prompt + set index 0 + while { ${index} >= 0 && ${index} < [llength ${list}] } { + set pattern [lindex ${list} ${index}] + set index [expr ${index} + 1] + if { ${index} == [llength ${list}] } { + gdb_expect { + -re "${pattern}${sentinal}" { + pass "${test} (sentinal)" + } + timeout { + fail "(timeout on sentinal) ${test}" + set index -1 + } + } + } else { + gdb_expect { + -re "${pattern}" { + pass "${test} (line ${index})" + } + -re "${sentinal}" { + fail "${test} (line ${index})" + set index -1 + } + timeout { + fail "(timeout on line ${index}) ${test}" + set index -1 + } + } + } + } + if { ${index} >= 0 } { + pass "${test}" + } +} + +# +# proc gdb_suppress_entire_file { reason } { global suppress_flag; diff --git a/gdb/top.c b/gdb/top.c index af5c40b271..fa0c9d0f01 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1,5 +1,5 @@ /* Top level stuff for GDB, the GNU debugger. - Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 1998 + Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc. This file is part of GDB. @@ -3770,7 +3770,6 @@ init_main () /* Set the important stuff up for command editing. */ command_editing_p = 1; - async_command_editing_p = 1; history_expansion_p = 0; write_history_p = 0; diff --git a/gdb/utils.c b/gdb/utils.c index c2c12dd9de..03f0aa4d99 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1941,7 +1941,7 @@ void gdb_file_rewind (file) struct gdb_file *file; { - return file->to_rewind (file); + file->to_rewind (file); } void @@ -1949,7 +1949,7 @@ gdb_file_put (file, dest) struct gdb_file *file; struct gdb_file *dest; { - return file->to_put (file, dest); + file->to_put (file, dest); } void diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 26bd2359dc..d585aa6dbb 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,10 @@ +1999-06-23 Doug Evans + + * cgen-engine.h (TARGET_SEM_BRANCH_FINI): Remove cruft at end of + ifndef. + * genmloop.sh (@cpu@_scache_lookup): Delete unused local var. + (@cpu@_pbb_cti_chain): Minor clean up. + 1999-05-08 Felix Lee * aclocal.m4: Use AC_EXEEXT instead of AM_EXEEXT. Delete defn of diff --git a/sim/common/cgen-engine.h b/sim/common/cgen-engine.h index 9421332b43..e7d27e0358 100644 --- a/sim/common/cgen-engine.h +++ b/sim/common/cgen-engine.h @@ -279,7 +279,7 @@ do { \ #define SEM_BRANCH_INIT \ int taken_p = 0; -#ifndef TARGET_SEM_BRANCH_FINI(pcvar, taken_p) +#ifndef TARGET_SEM_BRANCH_FINI #define TARGET_SEM_BRANCH_FINI(pcvar, taken_p) #endif #define SEM_BRANCH_FINI(pcvar) \ diff --git a/sim/common/genmloop.sh b/sim/common/genmloop.sh index 865fe7242f..6720799a3e 100644 --- a/sim/common/genmloop.sh +++ b/sim/common/genmloop.sh @@ -463,8 +463,6 @@ static INLINE SCACHE * fetch and decode the instruction. */ if (sc->argbuf.addr != vpc) { - insn_t insn; - if (FAST_P) PROFILE_COUNT_SCACHE_MISS (current_cpu); @@ -771,7 +769,8 @@ cat << EOF ++sc; } - /* Update the pointer to the next free entry. */ + /* Update the pointer to the next free entry, may not have used as + many entries as was asked for. */ CPU_SCACHE_NEXT_FREE (current_cpu) = sc; /* Record length of chain if profiling. This includes virtual insns since they count against @@ -827,8 +826,6 @@ INLINE SEM_PC @cpu@_pbb_cti_chain (SIM_CPU *current_cpu, SEM_ARG sem_arg, SEM_PC *new_vpc_ptr, PCADDR new_pc) { - ARGBUF *abuf; - PBB_UPDATE_INSN_COUNT (current_cpu, sem_arg); /* If not running forever, exit back to main loop. */ @@ -854,7 +851,7 @@ INLINE SEM_PC next chain ptr. */ if (new_vpc_ptr == SEM_BRANCH_UNTAKEN) { - abuf = SEM_ARGBUF (sem_arg); + ARGBUF *abuf = SEM_ARGBUF (sem_arg); SET_H_PC (abuf->addr); new_vpc_ptr = &abuf->fields.chain.next; } diff --git a/sim/mcore/ChangeLog b/sim/mcore/ChangeLog index f8b9d93c10..7bb8877c38 100644 --- a/sim/mcore/ChangeLog +++ b/sim/mcore/ChangeLog @@ -1,3 +1,8 @@ +1999-06-23 Nick Clifton + + * sysdep.h: Do not define prototypes for memcpy and strchr if they + are macros. + 1999-05-21 Nick Clifton * interp.c (sim_resume): Add more tracing output. diff --git a/sim/mcore/sysdep.h b/sim/mcore/sysdep.h index adf9b5e277..e2e92e140f 100644 --- a/sim/mcore/sysdep.h +++ b/sim/mcore/sysdep.h @@ -46,7 +46,9 @@ with this program; if not, write to the Free Software Foundation, Inc., /*#include */ #else extern char * mktemp (); +#ifndef memset extern PTR memset (); +#endif #ifndef DONTDECLARE_MALLOC extern PTR malloc (); @@ -65,7 +67,9 @@ extern void free (); extern int free(); #endif +#ifndef strchr extern char * strchr(); +#endif extern char * getenv(); extern PTR memchr(); extern char * strrchr(); -- 2.34.1