diff options
author | Jason Molenda <jmolenda@apple.com> | 1999-08-02 23:48:37 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 1999-08-02 23:48:37 +0000 |
commit | a0b3c4fd32cf8336bf7b69f373ef86d5c54035f6 (patch) | |
tree | cf8f31bccdd267252e6b3c9636a1d323397673e2 | |
parent | 30727aa6d12fb866494020c0b62ab265a2bdcdfe (diff) | |
download | gdb-a0b3c4fd32cf8336bf7b69f373ef86d5c54035f6.zip gdb-a0b3c4fd32cf8336bf7b69f373ef86d5c54035f6.tar.gz gdb-a0b3c4fd32cf8336bf7b69f373ef86d5c54035f6.tar.bz2 |
import gdb-1999-08-02 snapshot
88 files changed, 3223 insertions, 640 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8b16fcd..21950fb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,124 @@ +1999-08-01 Jason Molenda (jsm@bugshack.cygnus.com) + + * config/mips/tm-mips.h (BIG_ENDIAN): Don't define here. + +1999-08-01 Jim Blandy <jimb@zwingli.cygnus.com> + + * stabsread.c (read_range_type): Handle an unsigned range type + whose length in bytes is any power of two, not just a few + common ones. + + * monitor.c (monitor_expect): When we receive a character that + isn't part of the string we were expecting, don't just start + matching again at the beginning of the string --- some shorter + suffix of the input might be a prefix of the string too. + +1999-07-31 Fred Fish <fnf@cygnus.com> + + * symfile.c (symbol_file_command): Fix typo that made -1 casted + to a CORE_ADDR look like an subtraction expression. + (add_symbol_file_command): Ditto. + +1999-07-30 Jim Blandy <jimb@cris.red-bean.com> + + * hppa-tdep.c (pa_print_registers): Frob register output some more. + +1999-07-29 Jim Blandy <jimb@cris.red-bean.com> + + * config/pa/nm-hppah.h (PTRACE_ARG3_TYPE): After more + consideration, make this a CORE_ADDR, like WDB did. + + Rather than casting every single use of really_free_pendings to + make_cleanup_func, why not actually make it have that type? Golly! + * buildsym.c (really_free_pendings): Change argument type to PTR. + buildsym.h (really_free_pendings): Fix declaration. + * dbxread.c (dbx_symfile_read, dbx_psymtab_to_symtab_1), + dwarf2read.c (psymtab_to_symtab_1), dwarfread + (psymtab_to_symtab_1), hp-psymtab-read.c (hpread_build_psymtabs), + os9kread.c (os9k_symfile_read, os9k_psymtab_to_symtab_1), + xcoffread.c (xcoff_psymtab_to_symtab_1, xcoff_initial_scan): + Remove casts. + + Pass a CORE_ADDR safely through catch_errors. + * hppa-tdep.c (args_for_find_stub): New member, return_val. + (cover_find_stub_with_shl_get): Change argument and return type to + match catch_errors. Save return value of find_stub_with_shl_get + in *args. + (initialize_hp_cxx_exception_support): Collect value of + eh_notify_callback_addr from args. + + Get rid of some noise. It would be nice to get helpful warnings + from the compiler about lossy conversions. + * hppa-tdep.c (eh_notify_hook_addr, eh_notify_callback_addr, + eh_break_addr, eh_catch_catch_addr, eh_catch_throw_addr, + break_callback_sal): Initialize these to zero, not NULL, to shush + warnings. + * infttrace.c (thread_fake_step): Compare signal to + TARGET_SIGNAL_0, not NULL, to avoid warnings. + (_initialize_infttrace): Add sanity check. + + * config/pa/nm-hppah.h (PTRACE_ARG3_TYPE): Define this to be + long, so we can pass arguments properly to ptrace. + + * hppah-nat.c (child_xfer_memory): Correctly compute mask to round + address to an int boundary. + +1999-07-29 Jim Blandy <jimb@savonarola.red-bean.com> + + Change from Ian Lance Taylor <ian@zembu.com>. The + i386_linux_sigtramp* functions should be moved to + i386-linux-tdep.c, when that file is introduced. + + * config/i386/tm-linux.h (LINUX_SIGCONTEXT_SIZE): Define. + (LINUX_SIGCONTEXT_PC_OFFSET): Define. + (LINUX_SIGCONTEXT_SP_OFFSET): Define. + (SIGCONTEXT_PC_OFFSET): Don't define. + (I386_LINUX_SIGTRAMP): Define. + (IN_SIGTRAMP): Define. + (i386_linux_sigtramp): Declare. + (sigtramp_saved_pc): Define. + (i386_linux_sigtramp_saved_pc): Declare. + (FRAMELESS_SIGNAL): Define. + (FRAME_CHAIN, FRAME_SAVED_PC): Define after #undef. + * i386-tdep.c (i386_linux_sigtramp_start): New static function if + I386_LINUX_SIGTRAMP. + (i386_linux_sigtramp): New function if I386_LINUX_SIGTRAMP. + (i386_linux_sigtramp_saved_pc): Likewise. + (i386_linux_sigtramp_saved_sp): Likewise. + +1999-07-28 Jim Blandy <jimb@savonarola.red-bean.com> + + * infrun.c (handle_inferior_event): Don't try to use the code for + stepping over a function call to also handle stepping out of a + sigtramp on HP-UX. That ends up trashing step-resume breakpoints. + This change reverts some of David Taylor's change of 31 Dec 1998. + The HP-UX maintainer needs to submit a new change for whatever + problem the original change was trying to fix. + +1999-07-28 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * event-top.c (command_line_handler): Don't treat an empty line + from readline the same way as a multiline command. This avoids + missing detecting when the user presses just 'enter'. + +1999-07-28 Jim Blandy <jimb@savonarola.red-bean.com> + + Provide more sanity checking: + * infrun.c (handle_inferior_event): Before assigning a new + breakpoint to step_resume_breakpoint, make sure it's not already + pointing at one; if it is, that's a bug. + (check_for_old_step_resume_breakpoint): New function. + +1999-07-28 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + From Eli Zaretskii <eliz@is.elta.co.il>: + * top.c (gdb_init) [__MSDOS__]: Arrange for GDB to return to the + original directory before exiting. + (cd_command) [_WIN32 || __MSDOS__]: Canonicalize the new directory + name explicitly. Handle "d:/" names correctly. + (init_history) [__MSDOS__]: Use _gdb_history as the default GDB + history file name. + Mon Jul 26 17:13:39 1999 Andrew Cagney <cagney@b1.cygnus.com> * remote.c (enum packet_support, enum packet_detect, struct @@ -30,8 +151,9 @@ Mon Jul 26 17:13:39 1999 Andrew Cagney <cagney@b1.cygnus.com> 1999-07-15 Jim Blandy <jimb@cris.red-bean.com> Make the output from "info registers" fit withinin 80 columns. - * hppa-tdep.c: Make it easy to change row and column counts. - Switch to three columns, instead of four, and adjust spacing. + * hppa-tdep.c (pa_print_registers): Make it easy to change row and + column counts. Switch to three columns, instead of four, and + adjust spacing. First cut at supporting HPPA2.0 in "wide" (64-bit) mode. * configure.tgt: Add hppa2.0w target. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 3703f46..5cbeae5 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -224,7 +224,7 @@ CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE) \ ADD_FILES = $(REGEX) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) ADD_DEPS = $(REGEX1) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) -VERSION = 19990726 +VERSION = 19990802 DIST=gdb LINT=/usr/5bin/lint diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 860f4aa..5668afc 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -148,7 +148,7 @@ find_symbol_in_list (struct pending *list, char *name, int length) /* ARGSUSED */ void -really_free_pendings (int foo) +really_free_pendings (PTR dummy) { struct pending *next, *next1; diff --git a/gdb/buildsym.h b/gdb/buildsym.h index f16ffc5..a67d722 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -243,7 +243,7 @@ extern void finish_block (struct symbol *symbol, CORE_ADDR start, CORE_ADDR end, struct objfile *objfile); -extern void really_free_pendings (int foo); +extern void really_free_pendings (PTR dummy); extern void start_subfile (char *name, char *dirname); diff --git a/gdb/config/i386/tm-linux.h b/gdb/config/i386/tm-linux.h index e39dc04..0767bd9 100644 --- a/gdb/config/i386/tm-linux.h +++ b/gdb/config/i386/tm-linux.h @@ -26,8 +26,14 @@ #include "i386/tm-i386.h" -/* Offset to saved PC in sigcontext, from <linux/signal.h>. */ -#define SIGCONTEXT_PC_OFFSET 38 +/* Size of sigcontext, from <asm/sigcontext.h>. */ +#define LINUX_SIGCONTEXT_SIZE (88) + +/* Offset to saved PC in sigcontext, from <asm/sigcontext.h>. */ +#define LINUX_SIGCONTEXT_PC_OFFSET (56) + +/* Offset to saved SP in sigcontext, from <asm/sigcontext.h>. */ +#define LINUX_SIGCONTEXT_SP_OFFSET (28) /* We need this file for the SOLIB_TRAMPOLINE stuff. */ @@ -36,4 +42,66 @@ /* The following works around a problem with /usr/include/sys/procfs.h */ #define sys_quotactl 1 +/* When the i386 Linux kernel calls a signal handler, the return + address points to a bit of code on the stack. These definitions + are used to identify this bit of code as a signal trampoline in + order to support backtracing through calls to signal handlers. */ + +#define I386_LINUX_SIGTRAMP +#define IN_SIGTRAMP(pc, name) ((name) == NULL && i386_linux_sigtramp (pc)) + +extern int i386_linux_sigtramp PARAMS ((CORE_ADDR)); + +/* We need our own version of sigtramp_saved_pc to get the saved PC in + a sigtramp routine. */ + +#define sigtramp_saved_pc i386_linux_sigtramp_saved_pc +extern CORE_ADDR i386_linux_sigtramp_saved_pc PARAMS ((struct frame_info *)); + +/* Signal trampolines don't have a meaningful frame. As in tm-i386.h, + the frame pointer value we use is actually the frame pointer of the + calling frame--that is, the frame which was in progress when the + signal trampoline was entered. gdb mostly treats this frame + pointer value as a magic cookie. We detect the case of a signal + trampoline by looking at the SIGNAL_HANDLER_CALLER field, which is + set based on IN_SIGTRAMP. + + When a signal trampoline is invoked from a frameless function, we + essentially have two frameless functions in a row. In this case, + we use the same magic cookie for three frames in a row. We detect + this case by seeing whether the next frame has + SIGNAL_HANDLER_CALLER set, and, if it does, checking whether the + current frame is actually frameless. In this case, we need to get + the PC by looking at the SP register value stored in the signal + context. + + This should work in most cases except in horrible situations where + a signal occurs just as we enter a function but before the frame + has been set up. */ + +#define FRAMELESS_SIGNAL(FRAME) \ + ((FRAME)->next != NULL \ + && (FRAME)->next->signal_handler_caller \ + && frameless_look_for_prologue (FRAME)) + +#undef FRAME_CHAIN +#define FRAME_CHAIN(FRAME) \ + ((FRAME)->signal_handler_caller \ + ? (FRAME)->frame \ + : (FRAMELESS_SIGNAL (FRAME) \ + ? (FRAME)->frame \ + : (!inside_entry_file ((FRAME)->pc) \ + ? read_memory_integer ((FRAME)->frame, 4) \ + : 0))) + +#undef FRAME_SAVED_PC +#define FRAME_SAVED_PC(FRAME) \ + ((FRAME)->signal_handler_caller \ + ? sigtramp_saved_pc (FRAME) \ + : (FRAMELESS_SIGNAL (FRAME) \ + ? read_memory_integer (i386_linux_sigtramp_saved_sp ((FRAME)->next), 4) \ + : read_memory_integer ((FRAME)->frame + 4, 4))) + +extern CORE_ADDR i386_linux_sigtramp_saved_sp PARAMS ((struct frame_info *)); + #endif /* #ifndef TM_LINUX_H */ diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index bfdc945..3df3dab 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -109,8 +109,6 @@ extern int in_sigtramp PARAMS ((CORE_ADDR, char *)); #define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) -#define BIG_ENDIAN 4321 - /* BREAKPOINT_FROM_PC uses the program counter value to determine whether a 16- or 32-bit breakpoint should be used. It returns a pointer to a string of bytes that encode a breakpoint instruction, stores diff --git a/gdb/config/pa/nm-hppah.h b/gdb/config/pa/nm-hppah.h index 9d0866c..19bf2f7 100644 --- a/gdb/config/pa/nm-hppah.h +++ b/gdb/config/pa/nm-hppah.h @@ -26,6 +26,18 @@ #define REGISTER_U_ADDR(addr, blockend, regno) \ { addr = (int)(blockend) + REGISTER_BYTE (regno);} +/* This isn't really correct, because ptrace is actually a 32-bit + interface. However, the modern HP-UX targets all really use + ttrace, which is a 64-bit interface --- a debugger running in + either 32- or 64-bit mode can debug a 64-bit process. BUT, the + code doesn't use ttrace directly --- it calls call_ptrace instead, + which is supposed to be drop-in substitute for ptrace. In other + words, they access a 64-bit system call (ttrace) through a + compatibility layer which is allegedly a 32-bit interface. + + So I don't feel the least bit guilty about this. */ +#define PTRACE_ARG3_TYPE CORE_ADDR + /* HPUX 8.0, in its infinite wisdom, has chosen to prototype ptrace with five arguments, so programs written for normal ptrace lose. */ #define FIVE_ARG_PTRACE diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 285d154..258daed 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -623,7 +623,7 @@ dbx_symfile_read (objfile, section_offsets, mainline) symbol_table_offset = DBX_SYMTAB_OFFSET (objfile); free_pending_blocks (); - back_to = make_cleanup ((make_cleanup_func) really_free_pendings, 0); + back_to = make_cleanup (really_free_pendings, 0); init_minimal_symbol_collection (); make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0); @@ -1664,7 +1664,7 @@ dbx_psymtab_to_symtab_1 (pst) /* Init stuff necessary for reading in symbols */ stabsread_init (); buildsym_init (); - old_chain = make_cleanup ((make_cleanup_func) really_free_pendings, 0); + old_chain = make_cleanup (really_free_pendings, 0); file_string_table_offset = FILE_STRING_OFFSET (pst); symbol_size = SYMBOL_SIZE (pst); diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 8f0274b..b27ac49 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -1327,7 +1327,7 @@ psymtab_to_symtab_1 (pst) back_to = make_cleanup (dwarf2_free_tmp_obstack, NULL); buildsym_init (); - make_cleanup ((make_cleanup_func) really_free_pendings, NULL); + make_cleanup (really_free_pendings, NULL); /* read in the comp_unit header */ cu_header.length = read_4_bytes (abfd, info_ptr); diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index e9893ca..13599fa 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -2456,8 +2456,7 @@ psymtab_to_symtab_1 (pst) if (DBLENGTH (pst)) /* Otherwise it's a dummy */ { buildsym_init (); - old_chain = make_cleanup ((make_cleanup_func) - really_free_pendings, 0); + old_chain = make_cleanup (really_free_pendings, 0); read_ofile_symtab (pst); if (info_verbose) { diff --git a/gdb/event-top.c b/gdb/event-top.c index 376352e..639a71b 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -634,9 +634,8 @@ command_line_handler (rl) free (rl); /* Allocated in readline. */ - if (p == linebuffer || *(p - 1) == '\\') + if (*(p - 1) == '\\') { - /* We come here also if the line entered is empty (just a 'return') */ p--; /* Put on top of '\'. */ if (*p == '\\') diff --git a/gdb/hp-psymtab-read.c b/gdb/hp-psymtab-read.c index e1208dc..0d2b236 100644 --- a/gdb/hp-psymtab-read.c +++ b/gdb/hp-psymtab-read.c @@ -1622,7 +1622,7 @@ hpread_build_psymtabs (objfile, section_offsets, mainline) /* Just in case the stabs reader left turds lying around. */ free_pending_blocks (); - make_cleanup ((make_cleanup_func) really_free_pendings, 0); + make_cleanup (really_free_pendings, 0); pst = (struct partial_symtab *) 0; diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index abd3b90..ed41361 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -134,10 +134,11 @@ typedef struct { struct minimal_symbol *msym; CORE_ADDR solib_handle; + CORE_ADDR return_val; } args_for_find_stub; -static CORE_ADDR cover_find_stub_with_shl_get PARAMS ((args_for_find_stub *)); +static int cover_find_stub_with_shl_get (PTR); static int is_pa_2 = 0; /* False */ @@ -1914,14 +1915,14 @@ find_stub_with_shl_get (function, handle) } /* Cover routine for find_stub_with_shl_get to pass to catch_errors */ -static CORE_ADDR -cover_find_stub_with_shl_get (args) - args_for_find_stub *args; +static int +cover_find_stub_with_shl_get (PTR args_untyped) { - return find_stub_with_shl_get (args->msym, args->solib_handle); + args_for_find_stub *args = args_untyped; + args->return_val = find_stub_with_shl_get (args->msym, args->solib_handle); + return 0; } - /* Insert the specified number of args and function address into a call sequence of the above form stored at DUMMYNAME. @@ -2519,7 +2520,7 @@ pa_print_registers (raw_regs, regnum, fpregs) /* Alas, we are compiled so that "long long" is 32 bits */ long raw_val[2]; long long_val; - int rows = 24, columns = 3; + int rows = 48, columns = 2; for (i = 0; i < rows; i++) { @@ -2540,17 +2541,18 @@ pa_print_registers (raw_regs, regnum, fpregs) /* Being big-endian, on this machine the low bits (the ones we want to look at) are in the second longword. */ long_val = extract_signed_integer (&raw_val[1], 4); - printf_filtered ("%8.8s: %8x", + printf_filtered ("%10.10s: %8x ", REGISTER_NAME (regnum), long_val); } else { /* raw_val = extract_signed_integer(&raw_val, 8); */ if (raw_val[0] == 0) - printf_filtered ("%8.8s: %8x", + printf_filtered ("%10.10s: %8x ", REGISTER_NAME (regnum), raw_val[1]); else - printf_filtered ("%8.8s: %8x%8.8x", REGISTER_NAME (regnum), + printf_filtered ("%10.10s: %8x%8.8x ", + REGISTER_NAME (regnum), raw_val[0], raw_val[1]); } } @@ -3886,17 +3888,17 @@ int hp_cxx_exception_support_initialized = 0; /* Similar to above, but imported from breakpoint.c -- non-target-specific */ extern int exception_support_initialized; /* Address of __eh_notify_hook */ -static CORE_ADDR eh_notify_hook_addr = NULL; +static CORE_ADDR eh_notify_hook_addr = 0; /* Address of __d_eh_notify_callback */ -static CORE_ADDR eh_notify_callback_addr = NULL; +static CORE_ADDR eh_notify_callback_addr = 0; /* Address of __d_eh_break */ -static CORE_ADDR eh_break_addr = NULL; +static CORE_ADDR eh_break_addr = 0; /* Address of __d_eh_catch_catch */ -static CORE_ADDR eh_catch_catch_addr = NULL; +static CORE_ADDR eh_catch_catch_addr = 0; /* Address of __d_eh_catch_throw */ -static CORE_ADDR eh_catch_throw_addr = NULL; +static CORE_ADDR eh_catch_throw_addr = 0; /* Sal for __d_eh_break */ -static struct symtab_and_line *break_callback_sal = NULL; +static struct symtab_and_line *break_callback_sal = 0; /* Code in end.c expects __d_pid to be set in the inferior, otherwise __d_eh_notify_callback doesn't bother to call @@ -4049,11 +4051,12 @@ initialize_hp_cxx_exception_support () args.solib_handle = som_solib_get_solib_by_pc (eh_notify_callback_addr); args.msym = msym; + args.return_val = 0; recurse++; - eh_notify_callback_addr = catch_errors ((int (*)PARAMS ((char *))) cover_find_stub_with_shl_get, - (char *) &args, - message, RETURN_MASK_ALL); + catch_errors (cover_find_stub_with_shl_get, (PTR) &args, message, + RETURN_MASK_ALL); + eh_notify_callback_addr = args.return_val; recurse--; exception_catchpoints_are_fragile = 1; diff --git a/gdb/hppah-nat.c b/gdb/hppah-nat.c index 627760d..4aec8ee 100644 --- a/gdb/hppah-nat.c +++ b/gdb/hppah-nat.c @@ -209,7 +209,7 @@ child_xfer_memory (memaddr, myaddr, len, write, target) { register int i; /* Round starting address down to longword boundary. */ - register CORE_ADDR addr = memaddr & -sizeof (int); + register CORE_ADDR addr = memaddr & - (CORE_ADDR)(sizeof (int)); /* Round ending address up; get number of longwords that makes. */ register int count = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 3e50ca8..2388790 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -722,6 +722,140 @@ i386v4_sigtramp_saved_pc (frame) } #endif /* I386V4_SIGTRAMP_SAVED_PC */ +#ifdef I386_LINUX_SIGTRAMP + +/* When the i386 Linux kernel calls a signal handler, the return + address points to a bit of code on the stack. This function + returns whether the PC appears to be within this bit of code. + + The instruction sequence is + pop %eax + mov $0x77,%eax + int $0x80 + or 0x58 0xb8 0x77 0x00 0x00 0x00 0xcd 0x80. + + Checking for the code sequence should be somewhat reliable, because + the effect is to call the system call sigreturn. This is unlikely + to occur anywhere other than a signal trampoline. + + It kind of sucks that we have to read memory from the process in + order to identify a signal trampoline, but there doesn't seem to be + any other way. The IN_SIGTRAMP macro in tm-linux.h arranges to + only call us if no function name could be identified, which should + be the case since the code is on the stack. */ + +#define LINUX_SIGTRAMP_INSN0 (0x58) /* pop %eax */ +#define LINUX_SIGTRAMP_OFFSET0 (0) +#define LINUX_SIGTRAMP_INSN1 (0xb8) /* mov $NNNN,%eax */ +#define LINUX_SIGTRAMP_OFFSET1 (1) +#define LINUX_SIGTRAMP_INSN2 (0xcd) /* int */ +#define LINUX_SIGTRAMP_OFFSET2 (6) + +static const unsigned char linux_sigtramp_code[] = +{ + LINUX_SIGTRAMP_INSN0, /* pop %eax */ + LINUX_SIGTRAMP_INSN1, 0x77, 0x00, 0x00, 0x00, /* mov $0x77,%eax */ + LINUX_SIGTRAMP_INSN2, 0x80 /* int $0x80 */ +}; + +#define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code) + +/* If PC is in a sigtramp routine, return the address of the start of + the routine. Otherwise, return 0. */ + +static CORE_ADDR +i386_linux_sigtramp_start (pc) + CORE_ADDR pc; +{ + unsigned char buf[LINUX_SIGTRAMP_LEN]; + + /* We only recognize a signal trampoline if PC is at the start of + one of the three instructions. We optimize for finding the PC at + the start, as will be the case when the trampoline is not the + first frame on the stack. We assume that in the case where the + PC is not at the start of the instruction sequence, there will be + a few trailing readable bytes on the stack. */ + + if (read_memory_nobpt (pc, (char *) buf, LINUX_SIGTRAMP_LEN) != 0) + return 0; + + if (buf[0] != LINUX_SIGTRAMP_INSN0) + { + int adjust; + + switch (buf[0]) + { + case LINUX_SIGTRAMP_INSN1: + adjust = LINUX_SIGTRAMP_OFFSET1; + break; + case LINUX_SIGTRAMP_INSN2: + adjust = LINUX_SIGTRAMP_OFFSET2; + break; + default: + return 0; + } + + pc -= adjust; + + if (read_memory_nobpt (pc, (char *) buf, LINUX_SIGTRAMP_LEN) != 0) + return 0; + } + + if (memcmp (buf, linux_sigtramp_code, LINUX_SIGTRAMP_LEN) != 0) + return 0; + + return pc; +} + +/* Return whether PC is in a Linux sigtramp routine. */ + +int +i386_linux_sigtramp (pc) + CORE_ADDR pc; +{ + return i386_linux_sigtramp_start (pc) != 0; +} + +/* Assuming FRAME is for a Linux sigtramp routine, return the saved + program counter. The Linux kernel will set up a sigcontext + structure immediately before the sigtramp routine on the stack. */ + +CORE_ADDR +i386_linux_sigtramp_saved_pc (frame) + struct frame_info *frame; +{ + CORE_ADDR pc; + + pc = i386_linux_sigtramp_start (frame->pc); + if (pc == 0) + error ("i386_linux_sigtramp_saved_pc called when no sigtramp"); + return read_memory_integer ((pc + - LINUX_SIGCONTEXT_SIZE + + LINUX_SIGCONTEXT_PC_OFFSET), + 4); +} + +/* Assuming FRAME is for a Linux sigtramp routine, return the saved + stack pointer. The Linux kernel will set up a sigcontext structure + immediately before the sigtramp routine on the stack. */ + +CORE_ADDR +i386_linux_sigtramp_saved_sp (frame) + struct frame_info *frame; +{ + CORE_ADDR pc; + + pc = i386_linux_sigtramp_start (frame->pc); + if (pc == 0) + error ("i386_linux_sigtramp_saved_sp called when no sigtramp"); + return read_memory_integer ((pc + - LINUX_SIGCONTEXT_SIZE + + LINUX_SIGCONTEXT_SP_OFFSET), + 4); +} + +#endif /* I386_LINUX_SIGTRAMP */ + #ifdef STATIC_TRANSFORM_NAME /* SunPRO encodes the static variables. This is not related to C++ mangling, it is done for C too. */ diff --git a/gdb/infrun.c b/gdb/infrun.c index 08e6f64..efb1caf 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1298,6 +1298,16 @@ init_execution_control_state (ecs) ecs->wp = &(ecs->ws); } +/* Call this function before setting step_resume_breakpoint, as a + sanity check. We should never be setting a new + step_resume_breakpoint when we have an old one active. */ +static void +check_for_old_step_resume_breakpoint () +{ + if (step_resume_breakpoint) + warning ("GDB bug: infrun.c (wait_for_inferior): dropping old step_resume breakpoint"); +} + /* Given an execution control state that has been freshly filled in by an event from the inferior, figure out what it means and take appropriate action. */ @@ -2143,16 +2153,39 @@ handle_inferior_event (ecs) if (signal_program[stop_signal] == 0) stop_signal = TARGET_SIGNAL_0; - /* If we're in the middle of a "next" command, let the code for - stepping over a function handle this. pai/1997-09-10 - - A previous comment here suggested it was possible to change - this to jump to keep_going in all cases. */ - - if (step_over_calls > 0) - goto step_over_function; - else - goto check_sigtramp2; + /* I'm not sure whether this needs to be check_sigtramp2 or + whether it could/should be keep_going. + + This used to jump to step_over_function if we are stepping, + which is wrong. + + Suppose the user does a `next' over a function call, and while + that call is in progress, the inferior receives a signal for + which GDB does not stop (i.e., signal_stop[SIG] is false). In + that case, when we reach this point, there is already a + step-resume breakpoint established, right where it should be: + immediately after the function call the user is "next"-ing + over. If we jump to step_over_function now, two bad things + happen: + + - we'll create a new breakpoint, at wherever the current + frame's return address happens to be. That could be + anywhere, depending on what function call happens to be on + the top of the stack at that point. Point is, it's probably + not where we need it. + + - the existing step-resume breakpoint (which is at the correct + address) will get orphaned: step_resume_breakpoint will point + to the new breakpoint, and the old step-resume breakpoint + will never be cleaned up. + + The old behavior was meant to help HP-UX single-step out of + sigtramps. It would place the new breakpoint at prev_pc, which + was certainly wrong. I don't know the details there, so fixing + this probably breaks that. As with anything else, it's up to + the HP-UX maintainer to furnish a fix that doesn't break other + platforms. --JimB, 20 May 1999 */ + goto check_sigtramp2; } /* Handle cases caused by hitting a breakpoint. */ @@ -2513,6 +2546,7 @@ handle_inferior_event (ecs) /* We could probably be setting the frame to step_frame_address; I don't think anyone thought to try it. */ + check_for_old_step_resume_breakpoint (); step_resume_breakpoint = set_momentary_breakpoint (sr_sal, NULL, bp_step_resume); if (breakpoints_inserted) @@ -2595,6 +2629,7 @@ handle_inferior_event (ecs) INIT_SAL (&xxx); /* initialize to zeroes */ xxx.pc = tmp; xxx.section = find_pc_overlay (xxx.pc); + check_for_old_step_resume_breakpoint (); step_resume_breakpoint = set_momentary_breakpoint (xxx, NULL, bp_step_resume); insert_breakpoints (); @@ -2619,51 +2654,30 @@ handle_inferior_event (ecs) step_over_function: /* A subroutine call has happened. */ { - /* Set a special breakpoint after the return */ - struct symtab_and_line sr_sal; + /* We've just entered a callee, and we wish to resume until it + returns to the caller. Setting a step_resume breakpoint on + the return address will catch a return from the callee. + + However, if the callee is recursing, we want to be careful + not to catch returns of those recursive calls, but only of + THIS instance of the call. - INIT_SAL (&sr_sal); - sr_sal.symtab = NULL; - sr_sal.line = 0; + To do this, we set the step_resume bp's frame to our current + caller's frame (step_frame_address, which is set by the "next" + or "until" command, before execution begins). */ + struct symtab_and_line sr_sal; - /* If we came here after encountering a signal in the middle of - a "next", use the stashed-away previous frame pc */ - sr_sal.pc - = stopped_by_random_signal - ? prev_pc - : ADDR_BITS_REMOVE (SAVED_PC_AFTER_CALL (get_current_frame ())); + INIT_SAL (&sr_sal); /* initialize to zeros */ + sr_sal.pc = + ADDR_BITS_REMOVE (SAVED_PC_AFTER_CALL (get_current_frame ())); + sr_sal.section = find_pc_overlay (sr_sal.pc); + check_for_old_step_resume_breakpoint (); step_resume_breakpoint = - set_momentary_breakpoint (sr_sal, - stopped_by_random_signal ? - NULL : get_current_frame (), + set_momentary_breakpoint (sr_sal, get_current_frame (), bp_step_resume); - /* We've just entered a callee, and we wish to resume until - it returns to the caller. Setting a step_resume bp on - the return PC will catch a return from the callee. - - However, if the callee is recursing, we want to be - careful not to catch returns of those recursive calls, - but of THIS instance of the call. - - To do this, we set the step_resume bp's frame to our - current caller's frame (step_frame_address, which is - set by the "next" or "until" command, before execution - begins). - - But ... don't do it if we're single-stepping out of a - sigtramp, because the reason we're single-stepping is - precisely because unwinding is a problem (HP-UX 10.20, - e.g.) and the frame address is likely to be incorrect. - No danger of sigtramp recursion. */ - - if (ecs->stepping_through_sigtramp) - { - step_resume_breakpoint->frame = (CORE_ADDR) NULL; - ecs->stepping_through_sigtramp = 0; - } - else if (!IN_SOLIB_DYNSYM_RESOLVE_CODE (sr_sal.pc)) + if (!IN_SOLIB_DYNSYM_RESOLVE_CODE (sr_sal.pc)) step_resume_breakpoint->frame = step_frame_address; if (breakpoints_inserted) @@ -2713,6 +2727,7 @@ handle_inferior_event (ecs) /* Do not specify what the fp should be when we stop since on some machines the prologue is where the new fp value is established. */ + check_for_old_step_resume_breakpoint (); step_resume_breakpoint = set_momentary_breakpoint (sr_sal, NULL, bp_step_resume); if (breakpoints_inserted) @@ -2757,6 +2772,7 @@ handle_inferior_event (ecs) /* Do not specify what the fp should be when we stop since on some machines the prologue is where the new fp value is established. */ + check_for_old_step_resume_breakpoint (); step_resume_breakpoint = set_momentary_breakpoint (sr_sal, NULL, bp_step_resume); if (breakpoints_inserted) diff --git a/gdb/infttrace.c b/gdb/infttrace.c index dae4ad4..c76c5132 100644 --- a/gdb/infttrace.c +++ b/gdb/infttrace.c @@ -1403,13 +1403,12 @@ get_process_first_stopped_thread_id (pid, thread_state) { int tt_status; - tt_status = call_real_ttrace ( - TT_PROC_GET_FIRST_LWP_STATE, - (pid_t) pid, - (lwpid_t) TT_NIL, - (TTRACE_ARG_TYPE) thread_state, - (TTRACE_ARG_TYPE) sizeof (*thread_state), - TT_NIL); + tt_status = call_real_ttrace (TT_PROC_GET_FIRST_LWP_STATE, + (pid_t) pid, + (lwpid_t) TT_NIL, + (TTRACE_ARG_TYPE) thread_state, + (TTRACE_ARG_TYPE) sizeof (*thread_state), + TT_NIL); if (errno) { @@ -4330,7 +4329,7 @@ thread_fake_step (tid, signal) p = find_thread_info (tid); if (p != NULL) { - if (p->have_signal && signal == NULL) + if (p->have_signal && signal == TARGET_SIGNAL_0) { /* Pass on a saved signal. */ @@ -5875,6 +5874,11 @@ _initialize_infttrace () errno = 0; memory_page_dictionary.page_size = sysconf (_SC_PAGE_SIZE); + /* We do a lot of casts from pointers to TTRACE_ARG_TYPE; make sure + this is okay. */ + if (sizeof (TTRACE_ARG_TYPE) < sizeof (void *)) + abort (); + if (errno || (memory_page_dictionary.page_size <= 0)) perror_with_name ("sysconf"); } diff --git a/gdb/monitor.c b/gdb/monitor.c index 1709a71..306b783 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -607,9 +607,43 @@ monitor_expect (string, buf, buflen) } else { - p = string; - if (c == *p) - p++; + /* We got a character that doesn't match the string. We need to + back up p, but how far? If we're looking for "..howdy" and the + monitor sends "...howdy"? There's certainly a match in there, + but when we receive the third ".", we won't find it if we just + restart the matching at the beginning of the string. + + This is a Boyer-Moore kind of situation. We want to reset P to + the end of the longest prefix of STRING that is a suffix of + what we've read so far. In the example above, that would be + ".." --- the longest prefix of "..howdy" that is a suffix of + "...". This longest prefix could be the empty string, if C + is nowhere to be found in STRING. + + If this longest prefix is not the empty string, it must contain + C, so let's search from the end of STRING for instances of C, + and see if the portion of STRING before that is a suffix of + what we read before C. Actually, we can search backwards from + p, since we know no prefix can be longer than that. + + Note that we can use STRING itself, along with C, as a record + of what we've received so far. :) */ + int i; + + for (i = (p - string) - 1; i >= 0; i--) + if (string[i] == c) + { + /* Is this prefix a suffix of what we've read so far? + In other words, does + string[0 .. i-1] == string[p - i, p - 1]? */ + if (! memcmp (string, p - i, i)) + { + p = string + i + 1; + break; + } + } + if (i < 0) + p = string; } } } diff --git a/gdb/os9kread.c b/gdb/os9kread.c index 402130c..8f439c4 100644 --- a/gdb/os9kread.c +++ b/gdb/os9kread.c @@ -347,7 +347,7 @@ os9k_symfile_read (objfile, section_offsets, mainline) init_psymbol_list (objfile, DBX_SYMCOUNT (objfile)); free_pending_blocks (); - back_to = make_cleanup ((make_cleanup_func) really_free_pendings, 0); + back_to = make_cleanup (really_free_pendings, 0); make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0); read_minimal_symbols (objfile, section_offsets); @@ -1248,7 +1248,7 @@ os9k_psymtab_to_symtab_1 (pst) /* Init stuff necessary for reading in symbols */ stabsread_init (); buildsym_init (); - old_chain = make_cleanup ((make_cleanup_func) really_free_pendings, 0); + old_chain = make_cleanup (really_free_pendings, 0); /* Read in this file's symbols */ os9k_read_ofile_symtab (pst); diff --git a/gdb/stabsread.c b/gdb/stabsread.c index ec59cf3..52b22f1 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -4701,18 +4701,30 @@ read_range_type (pp, typenums, objfile) /* We used to do this only for subrange of self or subrange of int. */ else if (n2 == 0) { + /* -1 is used for the upper bound of (4 byte) "unsigned int" and + "unsigned long", and we already checked for that, + so don't need to test for it here. */ + if (n3 < 0) /* n3 actually gives the size. */ return init_type (TYPE_CODE_INT, -n3, TYPE_FLAG_UNSIGNED, NULL, objfile); - if (n3 == 0xff) - return init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED, NULL, objfile); - if (n3 == 0xffff) - return init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED, NULL, objfile); - /* -1 is used for the upper bound of (4 byte) "unsigned int" and - "unsigned long", and we already checked for that, - so don't need to test for it here. */ + /* Is n3 == 2**(8n))-1 for some integer n? Then it's an + unsigned n-byte integer. But do require n to be a power of + two; we don't want 3- and 5-byte integers flying around. */ + { + int bytes; + unsigned long bits; + + bits = n3; + for (bytes = 0; (bits & 0xff) == 0xff; bytes++) + bits >>= 8; + if (bits == 0 + && ((bytes - 1) & bytes) == 0) /* "bytes is a power of two" */ + return init_type (TYPE_CODE_INT, bytes, TYPE_FLAG_UNSIGNED, NULL, + objfile); + } } /* I think this is for Convex "long long". Since I don't know whether Convex sets self_subrange, I also accept that particular size regardless diff --git a/gdb/symfile.c b/gdb/symfile.c index fcf8326..42d9e4f 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -884,7 +884,7 @@ symbol_file_command (args, from_tty) if (text_relocation == (CORE_ADDR) 0) return; - else if (text_relocation == (CORE_ADDR) - 1) + else if (text_relocation == (CORE_ADDR) -1) { symbol_file_add (name, from_tty, (CORE_ADDR) 0, 1, mapped, readnow, 1, 0); @@ -1313,7 +1313,7 @@ add_symbol_file_command (args, from_tty) else { target_link (name, &text_addr); - if (text_addr == (CORE_ADDR) - 1) + if (text_addr == (CORE_ADDR) -1) error ("Don't know how to get text start location for this file"); } diff --git a/gdb/symtab.c b/gdb/symtab.c index b09ccae..2ade65fc 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1319,7 +1319,21 @@ lookup_block_symbol (block, name, namespace) PC, then use the main symbol. ?!? Is checking the current pc correct? Is this routine - ever called to look up a symbol from another context? */ + ever called to look up a symbol from another context? + + FIXME: No, it's not correct. If someone sets a + conditional breakpoint at an address, then the + breakpoint's `struct expression' should refer to the + `struct symbol' appropriate for the breakpoint's + address, which may not be the PC. + + Even if it were never called from another context, + it's totally bizarre for lookup_symbol's behavior to + depend on the value of the inferior's current PC. We + should pass in the appropriate PC as well as the + block. The interface to lookup_symbol should change + to require the caller to provide a PC. */ + if (SYMBOL_ALIASES (sym)) sym = find_active_alias (sym, read_pc ()); diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index d0c567b..c1e25ca 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,103 @@ +1999-07-30 Stan Shebs <shebs@andros.cygnus.com> + + * gdb.c++/ref-types.cc, gdb.c++/ref-types.exp: Appease doschk + by merging in ref-types2 tests. + * gdb.c++/ref-types2.cc, gdb.c++/ref-types2.exp: Remove. + + From Jimmy Guo <guo@cup.hp.com> and others at HP: + * gdb.c++/Makefile.in: Add standard actions. + (EXECUTABLES): Rename from PROGS, update list. + * gdb.c++/ambiguous.cc, gdb.c++/ambiguous.exp: Move to here + from gdb.hp. + * gdb.c++/anon-union.cc: Don't use anonymous struct, make + foo and bar locals. + * gdb.c++/anon-union.exp: Fix tests to match. + * gdb.c++/classes.exp: Run if HP compiler used, add extra + expect matches to handle output variations. + * gdb.c++/cplusfuncs.cc: Make operator -> return foo *. + * gdb.c++/cplusfuncs.exp: Update to match, allow word "class" in + output, add HP alternatives for new and delete prints. + * gdb.c++/ctti.exp, gdb.c++/cttiadd.cc, gdb.c++/cttiadd1.cc, + gdb.c++/cttiadd2.cc, gdb.c++/cttiadd3.cc: Move here from gdb.hp. + * gdb.c++/demangle.exp: Use $style when reporting failure. + * gdb.c++/derivation.exp: Add some xfails if GCC-compiled. + * gdb.c++/inherit.exp: Run if HP compiler used, add some + match alternatives. + * gdb.c++/local.exp: Add match alternatives or xfails for HP + compilers. + * gdb.c++/member-ptr.exp: Add xfails for hppa*-*-*. + * gdb.c++/method.exp: Add match alternatives. + * gdb.c++/misc.cc: Add bool types. + * gdb.c++/misc.exp: Add tests for bool types. + * gdb.c++/overload.exp: Add xfails. + * gdb.c++/templates.cc: Remove bogus arglist init, init fvpchar. + * gdb.c++/templates.exp: Run if HP compiler used, add some xfails, + add some more template parameter tests (only for HP currently). + * gdb.c++/userdef.exp: Add xfails for hppa*-*-*. + * gdb.c++/virtfunc.cc: Add return type and value for main. + * gdb.c++/virtfunc.exp: Run if HP compiler used, add some + match alternatives. + +1999-07-30 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * gdb.base/display.exp: Fix output of 'p/a &&j' test. + +1999-07-29 Jim Blandy <jimb@savonarola.red-bean.com> + + * gdb.base/signals.exp: Don't expect getting a backtrace from + within a signal handler to fail on Linux. + +1999-07-29 Stan Shebs <shebs@andros.cygnus.com> + + From Jimmy Guo <guo@cup.hp.com> and others at HP: + * lib/gdb.exp: Remove some gratuitious semicolons. + (delete_breakpoints): Increase timeout. + (gdb_expect): Add -notransfer option. + (gdb_test): Use -notransfer option. + (get_compiler_info): Add f77 case. + (get_compiler): New proc, split out from gdb_preprocess, add f77 + case. + (gdb_preprocess): Call get_compiler. + + * gdb.base/Makefile.in (EXECUTABLES): Update the list. + * gdb.base/attach.exp, gdb.base/display.exp, + gdb.base/ending-run.exp, gdb.base/gdbvars.exp, + gdb.base/long_long.exp, gdb.base/printcmds.exp, + gdb.base/structs.exp, gdb.base/structs2.exp: Remove or fill in + third arg to gdb_test. + * gdb.base/call-ar-st.exp: Add HP-UX xfail for >10-arg functions. + * gdb.base/callfuncs.exp, gdb.base/callfwmall.exp: Remove some + HP-UX xfails, add others. + * gdb.base/completion.exp: Reflect name change of self-test. + * gdb.base/condbreak.exp, gdb.base/corefile.exp, + gdb.base/foll-exec.exp, gdb.base/interrupt.exp, + gdb.base/ptype.exp, gdb.base/scope.exp, gdb.base/setvar.exp: Note + HP failure number. + * gdb.base/foll-vfork.exp: Loosen matches slightly, remove + useless HP-UX 10.30 references. + * gdb.base/maint.exp: Loosen matches. + * gdb.base/pointers.c (main): Declare more_code. + * gdb.base/pointers.exp: Match on output of a `next'. + * gdb.base/structs.c: Add prototypes. + * gdb.base/watchpoint.exp: Remove HP-UX 10.30 reference. + * gdb.base/whatis.exp: Fail for both HP-UX 10.20 and 11. + +1999-07-29 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * gdb.base/list.exp: Add tests for repeating 'list <linenum>' + command. + +1999-07-27 Elena Zannoni <ezannoni@kwikemart.cygnus.com> + + * gdb.c++/annota2.exp: Fix delete breakpoint query testcase. + Fix run to main failures. Watchpoint can be hardware watchpoint. + + * gdb.base/annota1.exp: Clean up some more, in case printf has + debug info. Deal with lack of signal hanlder info in stack. + + From Jim Kingdon <kingdon@redhat.com>: + * gdb.base/annota1.exp: If printf has debug info, deal with it. + 1999-07-19 Stan Shebs <shebs@andros.cygnus.com> * gdb.base/foll-exec.exp, gdb.base/foll-fork.exp, diff --git a/gdb/testsuite/gdb.base/Makefile.in b/gdb/testsuite/gdb.base/Makefile.in index fbb7fe2..7dbe519 100644 --- a/gdb/testsuite/gdb.base/Makefile.in +++ b/gdb/testsuite/gdb.base/Makefile.in @@ -2,19 +2,19 @@ VPATH = @srcdir@ srcdir = @srcdir@ EXECUTABLES = all-types annota1 bitfields break \ - call-ar-st call-rt-st call-strs callfuncs callfuncs2 commands \ - compiler condbreak constvars coremaker display \ - ending-run exprs funcargs int-type interrupt \ - jump langs \ - list long_long \ - mips_pro miscexprs nodebug opaque pointers pointers2 printcmds ptype \ + call-ar-st call-rt-st call-strs callfuncs callfwmall \ + commands compiler condbreak constvars coremaker \ + dbx-test display ending-run execd-prog exprs \ + foll-exec foll-fork foll-vfork funcargs int-type interrupt jump \ + langs list long_long mips_pro miscexprs nodebug opaque overlays \ + pointers pointers2 printcmds ptype \ recurse reread reread1 restore return run \ - scope section_command setshow setvar \ - shmain sigall signals smoke smoke1 \ - solib so-impl-ld so-indr-cl \ - step-test structs structs2 twice-tmp varargs watchpoint whatis + scope section_command setshow setvar shmain sigall signals \ + solib solib_sl so-impl-ld so-indr-cl step-test structs structs2 \ + twice-tmp varargs vforked-prog watchpoint whatis -MISCELLANEOUS = coremmap.data shr1.sl shr2.sl solib1.sl solib2.sl +MISCELLANEOUS = coremmap.data ../foobar.baz \ + shr1.sl shr2.sl solib_sl.sl solib1.sl solib2.sl all: @echo "Nothing to be done for all..." diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp index ba24fe9..5ecdcb3 100644 --- a/gdb/testsuite/gdb.base/annota1.exp +++ b/gdb/testsuite/gdb.base/annota1.exp @@ -228,7 +228,7 @@ gdb_expect { # send_gdb "continue\n" gdb_expect { - -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 3\r\n\r\nBreakpoint 3, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n\032\032frame-function-name\r\nprintf\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-where\r\n from.*\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ + -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 3\r\n\r\nBreakpoint 3, \r\n\032\032frame-begin 0 $hex\r\n\r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*\032\032frame-function-name\r\nprintf\r\n\032\032frame-args\r\n.*\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ { pass "continue to printf" } -re ".*$gdb_prompt$" { fail "continue to printf" } timeout { fail "continue to printf (timeout)" } @@ -242,7 +242,7 @@ gdb_expect { # send_gdb "backtrace\n" gdb_expect { - -re "\r\n\032\032post-prompt\r\n\r\n\032\032frame-begin 0 $hex\r\n.0 \r\n\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n\032\032frame-function-name\r\nprintf\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-where\r\n from.*\r\n\032\032frame-end\r\n\r\n\032\032frame-begin 1 $hex\r\n.1 \r\n\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \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${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\032frame-end\r\n$gdb_prompt$" \ + -re "\r\n\032\032post-prompt\r\n\r\n\032\032frame-begin 0 $hex\r\n.0 \r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*\032\032frame-function-name\r\nprintf\r\n\032\032frame-args\r\n \\(.*frame-end\r\n\r\n\032\032frame-begin 1 $hex\r\n.1 \r\n\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \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${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\032frame-end\r\n$gdb_prompt$" \ { pass "bactrace from shlibrary" } -re ".*$gdb_prompt$" { fail "backtrace from shlibrary" } timeout { fail "backtrace from shlibrary (timeout)" } @@ -277,7 +277,7 @@ match_max 3000 verbose "match_max now is: [match_max]" send_gdb "backtrace\n" gdb_expect { - -re ".*frame-begin 0 $hex.*0.*frame-end.*frame-begin 1 $hex.*1.*\032\032signal-handler-caller\r\n.signal handler called.\r\n\r\n\032\032frame-end\r\n\r\n.*frame-begin 2 $hex.*2.*frame-begin 3 $hex.*3.*frame-end.*$gdb_prompt$" \ + -re "frame-begin 0 $hex.*0.*frame-end.*frame-begin 1 $hex.*1.*(\032\032signal-handler-caller\r\n.signal handler called.\r\n\r\n)*\032\032frame-end\r\n\r\n\032\032frame-begin 2 $hex.*2.*(frame-begin 3 $hex.*3.*)*frame-end.*$gdb_prompt$" \ { pass "backtrace @ signal handler" } -re ".*$gdb_prompt$" { fail "backtrace @ signal handler" } timeout { fail "backtrace @ signal handler (timeout)" } diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp index b86838b..09a0877 100644 --- a/gdb/testsuite/gdb.base/attach.exp +++ b/gdb/testsuite/gdb.base/attach.exp @@ -128,7 +128,7 @@ proc do_attach_tests {} { # This reponse is expected on HP-UX 10.20 (i.e., ptrace-based). -re "Attaching to.*, process 0.*No such process.*$gdb_prompt $"\ {pass "attach to nonexistent process is prohibited"} - # This response is expected on HP-UX 10.30 & 11.0 (i.e., ttrace-based). + # This response is expected on HP-UX 11.0 (i.e., ttrace-based). -re "Attaching to.*, process 0 failed.*Hint.*$gdb_prompt $"\ {pass "attach to nonexistent process is prohibited"} -re "$gdb_prompt $" {fail "attach to nonexistent process is prohibited"} @@ -386,8 +386,8 @@ proc do_call_attach_tests {} { # Get rid of the process # - gdb_test "p should_exit = 1" ".*" "" - gdb_test "c" ".*Program exited normally.*" "" + gdb_test "p should_exit = 1" ".*" + gdb_test "c" ".*Program exited normally.*" # Be paranoid # diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp index 5662eb7..15ebe1d 100644 --- a/gdb/testsuite/gdb.base/call-ar-st.exp +++ b/gdb/testsuite/gdb.base/call-ar-st.exp @@ -465,12 +465,6 @@ gdb_test "tbreak 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" - -# 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 { @@ -501,6 +495,13 @@ gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1305\[\r\n\t \]+ "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) + +# 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*-*-*" CLLbs16994} + if {![target_info exists gdb,skip_float_tests]} { send_gdb "print 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)\n" gdb_expect { diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp index 7db87b7..1ce9683 100644 --- a/gdb/testsuite/gdb.base/callfuncs.exp +++ b/gdb/testsuite/gdb.base/callfuncs.exp @@ -94,6 +94,8 @@ proc set_lang_c {} { proc do_function_calls {} { global prototypes global gcc_compiled + global gdb_prompt + # We need to up this because this can be really slow on some boards. set timeout 60; @@ -129,13 +131,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-*-*" "hppa*-*-*11*" + setup_xfail "mn10300-*-*" gdb_test "p t_float_values(3.14159,-2.3765)" " = 1" - setup_xfail "mn10300-*-*" "hppa*-*-*11*" + setup_xfail "mn10300-*-*" gdb_test "p t_float_values(float_val1,float_val2)" " = 1" - setup_xfail "mn10300-*-*" "hppa*-*-*11*" + setup_xfail "mn10300-*-*" gdb_test "p t_float_values(3.14159,float_val2)" " = 1" - setup_xfail "mn10300-*-*" "hppa*-*-*11*" + setup_xfail "mn10300-*-*" gdb_test "p t_float_values(float_val1,-2.3765)" " = 1" # Test passing of arguments which might not be widened. @@ -185,59 +187,22 @@ proc do_function_calls {} { # the RS6000. setup_xfail "rs6000*-*-*" setup_xfail "powerpc*-*-*" - if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - 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 { + if {![istarget hppa*-*-hpux*]} then { gdb_test "p t_func_values(add,func_val2)" " = 1" } setup_xfail "rs6000*-*-*" setup_xfail "powerpc*-*-*" - if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - 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 { + if {![istarget hppa*-*-hpux*]} then { gdb_test "p t_func_values(func_val1,doubleit)" " = 1" } - gdb_test "p t_call_add(func_val1,3,4)" " = 7" - setup_xfail "rs6000*-*-*" setup_xfail "powerpc*-*-*" - if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - 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 { + if {![istarget hppa*-*-hpux*]} then { gdb_test "p t_call_add(add,3,4)" " = 7" } + gdb_test "p t_call_add(func_val1,3,4)" " = 7" gdb_test "p t_enum_value1(enumval1)" " = 1" gdb_test "p t_enum_value1(enum_val1)" " = 1" diff --git a/gdb/testsuite/gdb.base/callfwmall.exp b/gdb/testsuite/gdb.base/callfwmall.exp index 7c734f8..7d7cf78 100644 --- a/gdb/testsuite/gdb.base/callfwmall.exp +++ b/gdb/testsuite/gdb.base/callfwmall.exp @@ -19,7 +19,7 @@ # This file was written by Fred Fish. (fnf@cygnus.com) -# SAME tests as in callfns.exp but here the inferior program does not +# SAME tests as in callfuncs.exp but here the inferior program does not # call malloc. @@ -99,6 +99,8 @@ proc set_lang_c {} { proc do_function_calls {} { global prototypes global gcc_compiled + global gdb_prompt + # We need to up this because this can be really slow on some boards. set timeout 60; @@ -134,13 +136,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-*-*" "hppa*-*-*11*" + setup_xfail "mn10300-*-*" gdb_test "p t_float_values(3.14159,-2.3765)" " = 1" - setup_xfail "mn10300-*-*" "hppa*-*-*11*" + setup_xfail "mn10300-*-*" gdb_test "p t_float_values(float_val1,float_val2)" " = 1" - setup_xfail "mn10300-*-*" "hppa*-*-*11*" + setup_xfail "mn10300-*-*" gdb_test "p t_float_values(3.14159,float_val2)" " = 1" - setup_xfail "mn10300-*-*" "hppa*-*-*11*" + setup_xfail "mn10300-*-*" gdb_test "p t_float_values(float_val1,-2.3765)" " = 1" # Test passing of arguments which might not be widened. @@ -192,38 +194,14 @@ proc do_function_calls {} { setup_xfail "rs6000*-*-*" setup_xfail "powerpc*-*-*" - if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - 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 { + if {![istarget hppa*-*-hpux*]} then { gdb_test "p t_func_values(add,func_val2)" " = 1" } setup_xfail "rs6000*-*-*" setup_xfail "powerpc*-*-*" - if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - 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 { + if {![istarget hppa*-*-hpux*]} then { gdb_test "p t_func_values(func_val1,doubleit)" " = 1" } @@ -232,19 +210,7 @@ proc do_function_calls {} { setup_xfail "rs6000*-*-*" setup_xfail "powerpc*-*-*" - if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - 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 { + if {![istarget hppa*-*-hpux*]} then { gdb_test "p t_call_add(add,3,4)" " = 7" } diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index 327f37d..2db2012 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -533,10 +533,10 @@ gdb_expect { } -send_gdb "file ${srcdir}/gdb.base/a1\t" +send_gdb "file ${srcdir}/gdb.base/self\t" sleep 1 gdb_expect { - -re "^file ${srcdir}/gdb.base/.*'a1.*-self\\.exp' $"\ + -re "^file ${srcdir}/gdb.base/.*'selftest\\.exp' $"\ { send_gdb "\n" gdb_expect { -re "\r\nA program is being debugged already\\. Kill it\\? \\(y or n\\) $" @@ -544,17 +544,17 @@ gdb_expect { { send_gdb "n\n" gdb_expect { -re "\r\nProgram not killed\\.\r\n$gdb_prompt $"\ - { pass "complete 'file gdb.base/a1'"} - -re ".*$gdb_prompt $" { fail "complete 'file gdb.base/a1'"} - timeout {fail "(timeout) complete 'file gdb.base/a1'"} + { pass "complete 'file gdb.base/self'"} + -re ".*$gdb_prompt $" { fail "complete 'file gdb.base/self'"} + timeout {fail "(timeout) complete 'file gdb.base/self'"} } } - -re ".*$gdb_prompt $" { fail "complete 'file gdb.base/a1'"} - timeout {fail "(timeout) complete 'file gdb.base/a1'"} + -re ".*$gdb_prompt $" { fail "complete 'file gdb.base/self'"} + timeout {fail "(timeout) complete 'file gdb.base/self'"} } } - -re ".*$gdb_prompt $" { fail "complete 'file gdb.base/a1'" } - timeout { fail "(timeout) complete 'file gdb.base/a1'" } + -re ".*$gdb_prompt $" { fail "complete 'file gdb.base/self'" } + timeout { fail "(timeout) complete 'file gdb.base/self'" } } diff --git a/gdb/testsuite/gdb.base/condbreak.exp b/gdb/testsuite/gdb.base/condbreak.exp index 8f8f11c..8ec8536 100644 --- a/gdb/testsuite/gdb.base/condbreak.exp +++ b/gdb/testsuite/gdb.base/condbreak.exp @@ -151,8 +151,7 @@ gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$sr # # run until the breakpoint at marker2 # -#See 11512CLLbs -setup_xfail hppa2.0w-*-* +setup_xfail hppa2.0w-*-* 11512CLLbs 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/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp index b267730..32f3f56 100644 --- a/gdb/testsuite/gdb.base/corefile.exp +++ b/gdb/testsuite/gdb.base/corefile.exp @@ -217,8 +217,7 @@ gdb_expect { # test reinit_frame_cache gdb_load ${binfile} -# HP defect CLLbs17002 -setup_xfail "*-*-*" +setup_xfail "*-*-*" CLLbs17002 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/display.exp b/gdb/testsuite/gdb.base/display.exp index 59ac18d..760a2e0 100644 --- a/gdb/testsuite/gdb.base/display.exp +++ b/gdb/testsuite/gdb.base/display.exp @@ -48,13 +48,13 @@ 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_test "kill" ".*The program is not being run.*" +gdb_test "detach" ".*" +gdb_test "run" ".*" gdb_load ${binfile} -gdb_test "kill" ".*" "" -gdb_test "detach" ".*" "" +gdb_test "kill" ".*" +gdb_test "detach" ".*" # Ok, on to real life # @@ -85,8 +85,8 @@ gdb_test "c" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: x/s &sum.*\[1-9\]*: /f sum = 1 gdb_test "c" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: x/s &sum.*\[1-9\]*: /f sum = 2.80259693e.45\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0.*\[1-9\]*: i = 0.*" "second disp" gdb_test "enab disp 6" ".*No display number 6..*" "catch err" -gdb_test "disab disp 1" ".*" "disab" -gdb_test "disab disp 2" ".*" "" +gdb_test "disab disp 1" ".*" "disab disp 1" +gdb_test "disab disp 2" ".*" "disab disp 2" gdb_test "enab disp 1" ".*" "re-enab" gdb_test "enab disp 1" ".*" "re-enab of enab" gdb_test "undisp 5" ".*" "undisp" @@ -117,46 +117,50 @@ gdb_expect { timeout { fail "timeout" } } -gdb_test "disab 3" ".*.*" "" +gdb_test "disab 3" ".*.*" "disab 3" gdb_test "c" ".*Breakpoint 4.*" "watch off" # Now the printf tests # gdb_test "fin" ".*Run till exit.*Value returned is.*= 10.*" "finish" -gdb_test "s" ".*do_vars.*.*25" "" -gdb_test "tb 35" ".*Breakpoint 5 a.*" "" -gdb_test "c" ".*do_vars.*35.*35.*" "" +gdb_test "s" ".*do_vars.*.*27.*" +gdb_test "tb 37" ".*Breakpoint 5 a.*" +gdb_test "c" ".*do_vars.*37.*37.*" # Beat on printf a bit # -gdb_test "printf" ".*Argument required.*" "" -gdb_test "printf %d" ".*Bad format string, missing.*" "" -gdb_test "printf \"%d" ".*Bad format string, non-terminated.*" "" -gdb_test "printf \"%d%d\",i" ".*Wrong number of arguments.*" "" -gdb_test "printf \"\\\\!\\a\\f\\r\\t\\v\\b\"" ".*!.*" "" +gdb_test "printf" ".*Argument required.*" +gdb_test "printf %d" ".*Bad format string, missing.*" +gdb_test "printf \"%d" ".*Bad format string, non-terminated.*" +gdb_test "printf \"%d%d\",i" ".*Wrong number of arguments.*" +gdb_test "printf \"\\\\!\\a\\f\\r\\t\\v\\b\"" ".*!.*" gdb_test "printf \"\"" ".*" "re-set term" -gdb_test "printf \"\\w\"" ".*Unrecognized escape character.*" "" -gdb_test "printf \"%d\" j" ".*Invalid argument syntax.*" "" +gdb_test "printf \"\\w\"" ".*Unrecognized escape character.*" +gdb_test "printf \"%d\" j" ".*Invalid argument syntax.*" # play with "p", too # -gdb_test "p/r j" ".*Undefined output format.*" "" +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!" + # 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" +if [istarget "hppa2.0w-hp-hpux11*"] { + xfail "'x/0 j' terminates PA64 process - skipped test point" } else { - gdb_test "x/0 j" ".*" "x/0 j" + gdb_test "x/0 j" ".*" +} +if [istarget "hppa*-hp-hpux*"] { + # on HP-UX you could access the first page without getting an error + gdb_test "x/rx j" ".*(Cannot access|Error accessing) memory.*|.*0xa:\[ \t\]*\[0-9\]+.*" } 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" -gdb_test "p/a &sum" ".*= 0x.*<sum>.*" "" -gdb_test "p/a main+1000" ".*= 0x.*<.*>.*" "" -gdb_test "p/a \\\$pc" ".*= 0x.*<do_vars+.*>.*" "" -gdb_test "p/a &j" ".*= 0x.*<.*>.*" "" -gdb_test "p/a &&j" ".*A syntax error.*" "" +gdb_test "p/a &sum" ".*= $hex.*<sum>.*" +gdb_test "p/a main+1000" ".*= $hex.*<.*>.*" +gdb_test "p/a \$pc" ".*= $hex.*<do_vars+.*>.*" +gdb_test "p/a &j" ".*= $hex.*<do_vars+.*>.*" +gdb_test "p/a &&j" ".*A parse error.*" # Done! # diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp index e36c975..790a98c 100644 --- a/gdb/testsuite/gdb.base/ending-run.exp +++ b/gdb/testsuite/gdb.base/ending-run.exp @@ -52,19 +52,19 @@ 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 13" ".*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 31" ".*Breakpoint.*3.*" "" +gdb_test "b 31" ".*Breakpoint.*3.*" # Expect to hit the bp at line "1", but symbolize this # as line "13". Then try to clear it--this should work. # if [target_info exists use_gdb_stub] { - gdb_test "continue" ".*Breakpoint.*1.*callee.*13.*" "" + gdb_test "continue" ".*Breakpoint.*1.*callee.*13.*" } else { - gdb_test "r" ".*Breakpoint.*1.*callee.*13.*" "" + gdb_test "r" ".*Breakpoint.*1.*callee.*13.*" } gdb_test "cle" ".*Deleted breakpoints 2 1.*" "clear worked" send_gdb "i b\n" @@ -76,15 +76,15 @@ gdb_expect { # Test some other "clear" combinations # -gdb_test "b 1" ".*Breakpoint.*4.*" "" -gdb_test "b 13" ".*Note.*also.*Breakpoint.*5.*" "" +gdb_test "b 1" ".*Breakpoint.*4.*" +gdb_test "b 13" ".*Note.*also.*Breakpoint.*5.*" gdb_test "cle 13" ".*Deleted breakpoint 5.*" "Only cleared 1 by line" 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 13" ".*Breakpoint.*6.*" "" + gdb_test "b 13" ".*Breakpoint.*6.*" gdb_test "cle *$line_eight" ".*Deleted breakpoints 6 4.*" "Clear 2 by address" } -re ".*$gdb_prompt $" { @@ -96,9 +96,9 @@ 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 14" ".*Breakpoint.*7.*" "" - gdb_test "b *$line_nine" ".*Note.*also.*Breakpoint.*8.*" "" - gdb_test "c" ".*Breakpoint.*7.*callee.*14.*" "" + gdb_test "b 14" ".*Breakpoint.*7.*" + gdb_test "b *$line_nine" ".*Note.*also.*Breakpoint.*8.*" + gdb_test "c" ".*Breakpoint.*7.*callee.*14.*" gdb_test "cle" ".*Deleted breakpoints 8 7.*" "Clear 2 by default" } -re ".*$gdb_prompt $" { @@ -123,7 +123,7 @@ gdb_expect { # See if we can step out with control. The "1 2 3" stuff # is output from the program. # -gdb_test "cont" ".*Breakpoint.*32.*" "" +gdb_test "cont" ".*Breakpoint.*31.*" gdb_test "next" ".*1 2 7 14 23 34 47 62 79 Goodbye!.*32.*" "Step to return" set old_timeout $timeout diff --git a/gdb/testsuite/gdb.base/foll-exec.exp b/gdb/testsuite/gdb.base/foll-exec.exp index 260a7d8..c4d62a5 100644 --- a/gdb/testsuite/gdb.base/foll-exec.exp +++ b/gdb/testsuite/gdb.base/foll-exec.exp @@ -209,7 +209,7 @@ proc do_exec_tests {} { # DTS CLLbs16760 # PA64 doesn't know about $START$ in dld.sl at this point. It should. # - Michael Coulter - setup_xfail hppa2.0w-hp-hpux* + setup_xfail hppa2.0w-hp-hpux* CLLbs16760 send_gdb "continue\n" gdb_expect { -re ".*Executing new program:.*${testfile2}.*Catchpoint .*(exec\'d .*${testfile2}).*in .START..*$gdb_prompt $"\ diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp index b25bf56..60f8f1f 100644 --- a/gdb/testsuite/gdb.base/foll-vfork.exp +++ b/gdb/testsuite/gdb.base/foll-vfork.exp @@ -79,7 +79,7 @@ proc vfork_parent_follow_through_step {} { } send_gdb "next\n" gdb_expect { - -re "Detaching after fork from.*13.*$gdb_prompt $"\ + -re "Detaching after fork from.*13.*$gdb_prompt "\ {pass "vfork parent follow, through step"} -re "$gdb_prompt $" {fail "vfork parent follow, through step"} timeout {fail "(timeout) vfork parent follow, through step" } @@ -106,7 +106,7 @@ proc vfork_parent_follow_to_bp {} { } send_gdb "continue\n" gdb_expect { - -re ".*Detaching after fork from process.*Breakpoint.*18.*$gdb_prompt $"\ + -re ".*Detaching after fork from process.*Breakpoint.*18.*$gdb_prompt "\ {pass "vfork parent follow, to bp"} -re "$gdb_prompt $" {fail "vfork parent follow, to bp"} timeout {fail "(timeout) vfork parent follow, to bp" } @@ -129,7 +129,7 @@ proc vfork_and_exec_child_follow_to_main_bp {} { } send_gdb "continue\n" gdb_expect { - -re "Detaching from program.*Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt $"\ + -re "Detaching from program.*Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt "\ {pass "vfork and exec child follow, to main bp"} -re "$gdb_prompt $" {fail "vfork and exec child follow, to main bp"} timeout {fail "(timeout) vfork and exec child follow, to main bp" } @@ -175,7 +175,7 @@ proc vfork_and_exec_child_follow_through_step {} { # the implementation of "next" sets a "step resume" breakpoint at the # return from the vfork(), which the child will hit on its way to exec'ing. # - if { ![istarget "hppa*-*-hpux10.30"] && ![istarget "hppa*-*-hpux11.*"] } { + if { ![istarget "hppa*-*-hpux11.*"] } { verbose "vfork child-following next test ignored for non-hppa or pre-HP/UX-10.30 targets." return 0 } @@ -187,7 +187,7 @@ proc vfork_and_exec_child_follow_through_step {} { } send_gdb "next\n" gdb_expect { - -re "Detaching from program.*Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt $"\ + -re "Detaching from program.*Attaching after fork to.*Executing new program.*Breakpoint.*vforked-prog.c:9.*$gdb_prompt "\ {pass "vfork and exec child follow, through step"} -re "$gdb_prompt $" {fail "vfork and exec child follow, through step"} timeout {fail "(timeout) vfork and exec child follow, through step" } @@ -242,16 +242,16 @@ proc tcatch_vfork_then_parent_follow {} { # HP-UX 10.20 seems to stop you in "vfork", while more recent HP-UXs # stop you in "_vfork". gdb_expect { - -re "0x\[0-9a-fA-F\]*.*vfork.*$gdb_prompt $"\ + -re "0x\[0-9a-fA-F\]*.*vfork.*$gdb_prompt "\ {pass "vfork parent follow, tcatch vfork"} - -re "0x\[0-9a-fA-F\]*.*_vfork.*$gdb_prompt $"\ + -re "0x\[0-9a-fA-F\]*.*_vfork.*$gdb_prompt "\ {pass "vfork parent follow, tcatch vfork"} -re "$gdb_prompt $" {fail "vfork parent follow, tcatch vfork"} timeout {fail "(timeout) vfork parent follow, tcatch vfork"} } send_gdb "finish\n" gdb_expect { - -re "Run till exit from.*vfork.*0x\[0-9a-fA-F\]* in main .* at .*${srcfile}:12.*$gdb_prompt $"\ + -re "Run till exit from.*vfork.*0x\[0-9a-fA-F\]* in main .* at .*${srcfile}:12.*$gdb_prompt "\ {pass "vfork parent follow, finish after tcatch vfork"} -re "$gdb_prompt $" {fail "vfork parent follow, finish after tcatch vfork"} timeout {fail "(timeout) vfork parent follow, finish after tcatch vfork" } @@ -283,16 +283,16 @@ proc tcatch_vfork_then_child_follow {} { # HP-UX 10.20 seems to stop you in "vfork", while more recent HP-UXs # stop you in "_vfork". gdb_expect { - -re "0x\[0-9a-fA-F\]*.*vfork.*$gdb_prompt $"\ + -re "0x\[0-9a-fA-F\]*.*vfork.*$gdb_prompt "\ {pass "vfork child follow, tcatch vfork"} - -re "0x\[0-9a-fA-F\]*.*_vfork.*$gdb_prompt $"\ + -re "0x\[0-9a-fA-F\]*.*_vfork.*$gdb_prompt "\ {pass "vfork child follow, tcatch vfork"} -re "$gdb_prompt $" {fail "vfork child follow, tcatch vfork"} timeout {fail "(timeout) vfork child follow, tcatch vfork"} } send_gdb "finish\n" gdb_expect { - -re "Run till exit from.*vfork.*${srcfile2}:9.*$gdb_prompt $"\ + -re "Run till exit from.*vfork.*${srcfile2}:9.*$gdb_prompt "\ {pass "vfork child follow, finish after tcatch vfork"} -re "$gdb_prompt $" {fail "vfork child follow, finish after tcatch vfork"} timeout {fail "(timeout) vfork child follow, finish after tcatch vfork" } diff --git a/gdb/testsuite/gdb.base/gdbvars.exp b/gdb/testsuite/gdb.base/gdbvars.exp index 2ab37e0..9678df6 100644 --- a/gdb/testsuite/gdb.base/gdbvars.exp +++ b/gdb/testsuite/gdb.base/gdbvars.exp @@ -84,7 +84,7 @@ proc test_value_history {} { gdb_test "print \$0" "\\\$8 = 102" \ "Print value-history\[MAX\] using explicit index \$0" - gdb_test "print 108" "\\\$9 = 108" "" + gdb_test "print 108" "\\\$9 = 108" gdb_test "print \$\$0" "\\\$10 = 108" \ "Print value-history\[MAX\] using explicit index \$\$0" diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp index 379df02..c2ad284 100644 --- a/gdb/testsuite/gdb.base/interrupt.exp +++ b/gdb/testsuite/gdb.base/interrupt.exp @@ -110,7 +110,7 @@ if ![file exists $binfile] then { # terminates the program. A defect is pending on this # issue [defect #DTS CHFts24203]. Hence calling setup_xfail # below. - setup_xfail "hppa*-*-*11*" + setup_xfail "hppa*-*-*11*" CHFts24203 fail "call function when asleep (wrong output)" } default { diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp index d77ce53..f319ba0 100644 --- a/gdb/testsuite/gdb.base/list.exp +++ b/gdb/testsuite/gdb.base/list.exp @@ -282,6 +282,48 @@ proc test_list_forward {} { gdb_stop_suppressing_tests; } +# Test that repeating the list linenum command doesn't print the same +# lines over again. Note that this test makes sure that the argument +# linenum is dropped, when we repeat the previous command. 'x/5i $pc' +# works the same way. + +proc test_repeat_list_command {} { + global gdb_prompt + + set testcnt 0 + + send_gdb "list list0.c:10\n" + gdb_expect { + -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt } + -re ".*$gdb_prompt $" { fail "list list0.c:10" ; gdb_suppress_tests } + timeout { fail "list list0.c:10 (timeout)" ; gdb_suppress_tests } + } + + send_gdb "\n" + gdb_expect { + -re "15\[ \t\]+foo \[(\]+.*\[)\]+;.*24\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt } + -re ".*$gdb_prompt $" { fail "list 15-24" ; gdb_suppress_tests } + timeout { fail "list 15-24 (timeout)" ; gdb_suppress_tests } + } + + send_gdb "\n" + gdb_expect { + -re "25\[ \t\]+foo \[(\]+.*\[)\]+;.*34\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt } + -re ".*$gdb_prompt $" { fail "list 25-34" ; gdb_suppress_tests } + timeout { fail "list 25-34 (timeout)" ; gdb_suppress_tests } + } + + send_gdb "\n" + gdb_expect { + -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 } + } + + pass "repeat list commands to page forward using 'return' ($testcnt tests)" + gdb_stop_suppressing_tests; +} + proc test_list_backwards {} { global gdb_prompt @@ -513,6 +555,7 @@ if [ set_listsize 10 ] then { test_list_function test_list_forward test_list_backwards + test_repeat_list_command test_list_range test_list_filename_and_function test_forward_search diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp index 52e6ff5..07006b6 100644 --- a/gdb/testsuite/gdb.base/long_long.exp +++ b/gdb/testsuite/gdb.base/long_long.exp @@ -79,84 +79,84 @@ 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" ".*12046818088235383159.*" "" -gdb_test "p/o oct" ".*.*" "" -gdb_test "p/t oct" ".*1010011100101110111001010011100101110111000001010011100101110111.*" "" -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" ".*0xf*a72ee539.*" "" -gdb_test "p/c *(int *)&oct" ".*57 '9'.*" "" -gdb_test "p/f *(int *)&oct" ".*-2.42716126e-15.*" "" - -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" ".*0xf*ffffa72e.*" "" -gdb_test "p/c *(short *)&oct" ".* 46 '.'.*" "" -gdb_test "p/a *(short *)&oct" ".*0xf*ffffa72e.*" "" -gdb_test "p/f *(short *)&oct" ".*-22738.*" "" - -gdb_test "x/x &oct" ".*0xa72ee539.*" "" -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 '\\\\247'.*" "" -gdb_test "x/f &oct" ".*-5.9822653797615723e-120.*" "" - -gdb_test "x/2x &oct" ".*.*" "" -gdb_test "x/2d &oct" ".*.*" "" -gdb_test "x/2u &oct" ".*.*" "" -gdb_test "x/2o &oct" ".*.*" "" -gdb_test "x/2t &oct" ".*.*" "" -gdb_test "x/2a &oct" ".*.*" "" -gdb_test "x/2c &oct" ".*.*" "" -gdb_test "x/2f &oct" ".*.*" "" - -gdb_test "x/2bx &oct" ".*.*" "" -gdb_test "x/2bd &oct" ".*.*" "" -gdb_test "x/2bu &oct" ".*.*" "" -gdb_test "x/2bo &oct" ".*.*" "" -gdb_test "x/2bt &oct" ".*.*" "" -gdb_test "x/2ba &oct" ".*.*" "" -gdb_test "x/2bc &oct" ".*.*" "" -gdb_test "x/2bf &oct" ".*.*" "" - -gdb_test "x/2hx &oct" ".*.*" "" -gdb_test "x/2hd &oct" ".*.*" "" -gdb_test "x/2hu &oct" ".*.*" "" -gdb_test "x/2ho &oct" ".*.*" "" -gdb_test "x/2ht &oct" ".*.*" "" -gdb_test "x/2ha &oct" ".*.*" "" -gdb_test "x/2hc &oct" ".*.*" "" -gdb_test "x/2hf &oct" ".*.*" "" - -gdb_test "x/2wx &oct" ".*.*" "" -gdb_test "x/2wd &oct" ".*.*" "" -gdb_test "x/2wu &oct" ".*.*" "" -gdb_test "x/2wo &oct" ".*.*" "" -gdb_test "x/2wt &oct" ".*.*" "" -gdb_test "x/2wa &oct" ".*.*" "" -gdb_test "x/2wc &oct" ".*.*" "" -gdb_test "x/2wf &oct" ".*.*" "" - -gdb_test "x/2gx &oct" ".*.*" "" -gdb_test "x/2gd &oct" ".*.*" "" -gdb_test "x/2gu &oct" ".*.*" "" -gdb_test "x/2go &oct" ".*.*" "" -gdb_test "x/2gt &oct" ".*.*" "" -gdb_test "x/2ga &oct" ".*.*" "" -gdb_test "x/2gc &oct" ".*.*" "" -gdb_test "x/2gf &oct" ".*.*" "" +gdb_test "p/d oct" ".*-6399925985474168457.*" +gdb_test "p/u oct" ".*12046818088235383159.*" +gdb_test "p/o oct" ".*.*" +gdb_test "p/t oct" ".*1010011100101110111001010011100101110111000001010011100101110111.*" +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" ".*0xf*a72ee539.*" +gdb_test "p/c *(int *)&oct" ".*57 '9'.*" +gdb_test "p/f *(int *)&oct" ".*-2.42716126e-15.*" + +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" ".*0xf*ffffa72e.*" +gdb_test "p/c *(short *)&oct" ".* 46 '.'.*" +gdb_test "p/a *(short *)&oct" ".*0xf*ffffa72e.*" +gdb_test "p/f *(short *)&oct" ".*-22738.*" + +gdb_test "x/x &oct" ".*0xa72ee539.*" +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 '\\\\247'.*" +gdb_test "x/f &oct" ".*-5.9822653797615723e-120.*" + +gdb_test "x/2x &oct" ".*.*" +gdb_test "x/2d &oct" ".*.*" +gdb_test "x/2u &oct" ".*.*" +gdb_test "x/2o &oct" ".*.*" +gdb_test "x/2t &oct" ".*.*" +gdb_test "x/2a &oct" ".*.*" +gdb_test "x/2c &oct" ".*.*" +gdb_test "x/2f &oct" ".*.*" + +gdb_test "x/2bx &oct" ".*.*" +gdb_test "x/2bd &oct" ".*.*" +gdb_test "x/2bu &oct" ".*.*" +gdb_test "x/2bo &oct" ".*.*" +gdb_test "x/2bt &oct" ".*.*" +gdb_test "x/2ba &oct" ".*.*" +gdb_test "x/2bc &oct" ".*.*" +gdb_test "x/2bf &oct" ".*.*" + +gdb_test "x/2hx &oct" ".*.*" +gdb_test "x/2hd &oct" ".*.*" +gdb_test "x/2hu &oct" ".*.*" +gdb_test "x/2ho &oct" ".*.*" +gdb_test "x/2ht &oct" ".*.*" +gdb_test "x/2ha &oct" ".*.*" +gdb_test "x/2hc &oct" ".*.*" +gdb_test "x/2hf &oct" ".*.*" + +gdb_test "x/2wx &oct" ".*.*" +gdb_test "x/2wd &oct" ".*.*" +gdb_test "x/2wu &oct" ".*.*" +gdb_test "x/2wo &oct" ".*.*" +gdb_test "x/2wt &oct" ".*.*" +gdb_test "x/2wa &oct" ".*.*" +gdb_test "x/2wc &oct" ".*.*" +gdb_test "x/2wf &oct" ".*.*" + +gdb_test "x/2gx &oct" ".*.*" +gdb_test "x/2gd &oct" ".*.*" +gdb_test "x/2gu &oct" ".*.*" +gdb_test "x/2go &oct" ".*.*" +gdb_test "x/2gt &oct" ".*.*" +gdb_test "x/2ga &oct" ".*.*" +gdb_test "x/2gc &oct" ".*.*" +gdb_test "x/2gf &oct" ".*.*" gdb_exit return 0 diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index 29e3134..b1f7c53 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -92,10 +92,18 @@ match_max 6000 # so that branch will really never be covered in this tests here!! # +# guo: on linux this command output is huge. for some reason splitting up +# the regexp checks works. +# send_gdb "maint check-symtabs\n" gdb_expect { - -re "^maint check-symtabs.*$gdb_prompt $"\ + -re "^maint check-symtabs" { + gdb_expect { + -re "$gdb_prompt $" \ { pass "maint check-symtabs" } + timeout { fail "(timeout) maint check-symtabs" } + } + } -re ".*$gdb_prompt $" { fail "maint check-symtabs" } timeout { fail "(timeout) maint check-symtabs" } } @@ -235,7 +243,9 @@ gdb_expect { send_gdb "shell grep 'main.*function' psymbols_output\n" gdb_expect { -re ".main., function, $hex.*$gdb_prompt $"\ - { pass "maint print psymbols" } + { pass "maint print psymbols 1" } + -re ".*main. .., function, $hex.*$gdb_prompt $"\ + { pass "maint print psymbols 2" } -re ".*$gdb_prompt $" { fail "maint print psymbols" } timeout { fail "(timeout) maint print psymbols" } } @@ -338,13 +348,18 @@ gdb_expect { timeout { fail "(timeout) maint print type" } } -#send_gdb "maint print unwind &main\n" -#gdb_expect { -# -re ".*unwind_table_entry \\($hex\\):\r\n\tregion_start = $hex <main>\r\n\tregion_end = $hex <main\\+220>\r\n\tflags = Args_stored Save_RP\r\n\tRegion_description = $hex\r\n\tEntry_FR = $hex\r\n\tEntry_GR = $hex\r\n\tTotal_frame_size = $hex\r\n$gdb_prompt $"\ -# { pass "maint print unwind" } -# -re ".*$gdb_prompt $" { fail "maint print unwind" } -# timeout { fail "(timeout) maint print unwind" } -# } +if [istarget "hppa*-*-11*"] { + setup_xfail hppa*-*-*11* CLLbs14860 + send "maint print unwind &main\n" + expect { + -re ".*unwind_table_entry \\($hex\\):\r\n\tregion_start = $hex <main>\r\n\tregion_end = $hex <main\\+\[0-9\]*>\r\n\tflags = Args_stored Save_RP\r\n\tRegion_description = $hex\r\n\tEntry_FR = $hex\r\n\tEntry_GR = $hex\r\n\tTotal_frame_size = $hex\r\n$gdb_prompt $"\ + { pass "maint print unwind" } + -re ".*unwind_table_entry \\($hex\\):\r\n\tregion_start = $hex <main>\r\n\tregion_end = $hex <main\\+\[0-9\]*>\r\n\tflags = Args_stored Save_RP\r\n\tFLD = $hex\r\n\tFLD = $hex\r\n\tFLD = $hex\r\n\tFLD = $hex\r\n$gdb_prompt $"\ + { xfail "maint print unwind" } + -re ".*$gdb_prompt $" { xfail "maint info unwind" } + timeout { fail "(timeout) maint print unwind" } + } +} set oldtimeout $timeout set timeout [expr $timeout + 300] @@ -369,7 +384,7 @@ gdb_expect { send_gdb "maint info breakpoints\n" gdb_expect { - -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex in main at.*break.c:60\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $"\ + -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex in main at.*break.c:75\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $"\ { pass "maint info breakpoints" } -re ".*$gdb_prompt $" { fail "maint info breakpoints" } timeout { fail "(timeout) maint info breakpoints" } @@ -383,7 +398,9 @@ if {! ([istarget "hppa*-*-hpux*"] } send_gdb "maint info breakpoints\n" gdb_expect { - -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex in main at.*break.c:60\r\n\[ \t\]+breakpoint already hit 1 time\r\n-1\[ \t\]+shlib events\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex.*breakpoint already hit.*$gdb_prompt $"\ + -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex in main at.*break.c:75\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $"\ + { pass "maint info breakpoints" } + -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex in main at.*break.c:75\r\n\[ \t\]+breakpoint already hit 1 time\r\n-1\[ \t\]+shlib events\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex.*breakpoint already hit.*$gdb_prompt $"\ { pass "maint info breakpoints: shlib events" } -re ".*$gdb_prompt $" { fail "maint info breakpoints: shlib events" @@ -521,13 +538,15 @@ gdb_expect { timeout { fail "(timeout) help maint print type" } } -#send_gdb "help maint print unwind\n" -#gdb_expect { -# -re "Print unwind table entry at given address\\..*$gdb_prompt $"\ -# { pass "help maint print unwind" } -# -re ".*$gdb_prompt $" { fail "help maint print unwind" } -# timeout { fail "(timeout) help maint print unwind" } -# } +if [istarget "hppa*-*-*"] { + send_gdb "help maint print unwind\n" + gdb_expect { + -re "Print unwind table entry at given address\\..*$gdb_prompt $"\ + { pass "help maint print unwind" } + -re ".*$gdb_prompt $" { fail "help maint print unwind" } + timeout { fail "(timeout) help maint print unwind" } + } +} send_gdb "help maint info sections\n" gdb_expect { diff --git a/gdb/testsuite/gdb.base/pointers.c b/gdb/testsuite/gdb.base/pointers.c index 60e6444..a6f0062 100644 --- a/gdb/testsuite/gdb.base/pointers.c +++ b/gdb/testsuite/gdb.base/pointers.c @@ -74,6 +74,7 @@ int y; int main () { void dummy(); + int more_code(); /* Ensure that malloc is a pointer type; avoid use of "void" and any include files. */ /* extern char *malloc();*/ diff --git a/gdb/testsuite/gdb.base/pointers.exp b/gdb/testsuite/gdb.base/pointers.exp index bccda66..539f875 100644 --- a/gdb/testsuite/gdb.base/pointers.exp +++ b/gdb/testsuite/gdb.base/pointers.exp @@ -62,7 +62,7 @@ if ![runto_main] then { continue } -gdb_test "next" "" "continuing after dummy()" +gdb_test "next " "more_code.*;" "continuing after dummy()" # diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index cdbe56c..79c6bc6 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -398,7 +398,7 @@ proc test_print_repeats_10 {} { global gdb_prompt for { set x 1; } { $x <= 16 } { incr x; } { - gdb_test "set print elements $x" "" "" + gdb_test "set print elements $x" "" for { set e 1; } { $e <= 16 } {incr e; } { set v [expr $e - 1]; set command "p &ctable2\[${v}*16\]" @@ -451,23 +451,23 @@ proc test_print_strings {} { # Test that setting print elements unlimited doesn't completely suppress # printing; this was a bug in older gdb's. - gdb_test "set print elements 0" "" "" + gdb_test "set print elements 0" "" gdb_test "p teststring" \ " = (.unsigned char .. )?\"teststring contents\"" "p teststring with elements set to 0" - gdb_test "set print elements 1" "" "" + gdb_test "set print elements 1" "" gdb_test "p teststring" \ " = (.unsigned char .. )?\"t\"\\.\\.\\." "p teststring with elements set to 1" - gdb_test "set print elements 5" "" "" + gdb_test "set print elements 5" "" gdb_test "p teststring" \ " = (.unsigned char .. )?\"tests\"\\.\\.\\." "p teststring with elements set to 5" - gdb_test "set print elements 19" "" "" + gdb_test "set print elements 19" "" gdb_test "p teststring" \ " = (.unsigned char .. )?\"teststring contents\"" "p teststring with elements set to 19" - gdb_test "set print elements 20" "" "" + gdb_test "set print elements 20" "" gdb_test "p teststring" \ " = (.unsigned char .. )?\"teststring contents\"" "p teststring with elements set to 20" - gdb_test "set print elements 8" "" "" + gdb_test "set print elements 8" "" gdb_test "p &ctable1\[0\]" \ " = \\(unsigned char \\*\\) \"\"" @@ -540,7 +540,7 @@ proc test_print_strings {} { proc test_print_int_arrays {} { global gdb_prompt - gdb_test "set print elements 24" "" "" + gdb_test "set print elements 24" "" gdb_test "p int1dim" \ " = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}" @@ -566,8 +566,8 @@ proc test_print_char_arrays {} { global gdb_prompt global hex - gdb_test "set print elements 24" "" "" - gdb_test "set print address on" "" "" + gdb_test "set print elements 24" "" + gdb_test "set print address on" "" gdb_test "p arrays" \ " = {array1 = \"abc\", array2 = \"d\", array3 = \"e\", array4 = \"fg\", array5 = \"hij\"}" @@ -584,13 +584,13 @@ proc test_print_char_arrays {} { gdb_test "p parrays->array5" " = \"hij\"" gdb_test "p &parrays->array5" " = \\(unsigned char \\(\\*\\)\\\[4\\\]\\) $hex" - gdb_test "set print address off" "" "" + gdb_test "set print address off" "" } proc test_print_string_constants {} { global gdb_prompt - gdb_test "set print elements 50" "" "" + gdb_test "set print elements 50" "" if [target_info exists gdb,cannot_call_functions] { setup_xfail "*-*-*" 2416 @@ -677,7 +677,7 @@ gdb_test "print \$pc" "No registers\\." gdb_load ${binfile} gdb_test "set print sevenbit-strings" "" -gdb_test "set print address off" "" "" +gdb_test "set print address off" "" gdb_test "set width 0" "" if [set_lang_c] then { diff --git a/gdb/testsuite/gdb.base/ptype.exp b/gdb/testsuite/gdb.base/ptype.exp index d36efec..f5b4503 100644 --- a/gdb/testsuite/gdb.base/ptype.exp +++ b/gdb/testsuite/gdb.base/ptype.exp @@ -129,7 +129,8 @@ gdb_test "ptype boolean" "type = enum (boolean |)\{FALSE, TRUE\}.*" "ptype unnam # as (51) doesn't have a name. Only 55 has a name. if {!$gcc_compiled && !$hp_aCC_compiler} { - setup_xfail "rs6000-*-*" "i*86-*-sysv4*" "hppa*-*-*" # CLLbs14773 + setup_xfail "rs6000-*-*" "i*86-*-sysv4*" + setup_xfail "hppa*-*-*" CLLbs14773 } get_debug_format setup_xfail_format "DWARF 1" diff --git a/gdb/testsuite/gdb.base/scope.exp b/gdb/testsuite/gdb.base/scope.exp index 708bc42..6c3f9f2 100644 --- a/gdb/testsuite/gdb.base/scope.exp +++ b/gdb/testsuite/gdb.base/scope.exp @@ -112,8 +112,7 @@ 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 {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*" 11747CLLbs} 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 ; } @@ -122,8 +121,7 @@ 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 {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*" 11747CLLbs} 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 ; } @@ -132,8 +130,7 @@ 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 {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*" 11747CLLbs} 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 ; } diff --git a/gdb/testsuite/gdb.base/setvar.exp b/gdb/testsuite/gdb.base/setvar.exp index ec217cf..2c9b416 100644 --- a/gdb/testsuite/gdb.base/setvar.exp +++ b/gdb/testsuite/gdb.base/setvar.exp @@ -330,11 +330,11 @@ 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*} +if {$hp_cc_compiler} {setup_xfail hppa*-*-*11* 10060CLLbs} 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*} +if {$hp_cc_compiler} {setup_xfail hppa*-*-*11* 10060CLLbs} gdb_test "print *(v_unsigned_short_pointer+1)" ".\[0-9\]* = 65080" # # test "set variable" for type "int *" diff --git a/gdb/testsuite/gdb.base/signals.exp b/gdb/testsuite/gdb.base/signals.exp index 6511b2e..ad875cc 100644 --- a/gdb/testsuite/gdb.base/signals.exp +++ b/gdb/testsuite/gdb.base/signals.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1997, 1998 Free Software Foundation, Inc. +# Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. # 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 @@ -184,7 +184,7 @@ proc signal_tests_1 {} { # This doesn't test that main is frame #2, just that main is frame # #2, #3, or higher. At some point this should be fixed (but # it quite possibly would introduce new FAILs on some systems). - setup_xfail "i*86-pc-linux-gnu*" "i*86-*-bsdi2.0" + setup_xfail "i*86-*-bsdi2.0" gdb_test "backtrace 10" "#0.*handler.*#1.*#2.*main.*" \ "backtrace in signals_tests_1" diff --git a/gdb/testsuite/gdb.base/structs.c b/gdb/testsuite/gdb.base/structs.c index b44d2fe..82a537c 100644 --- a/gdb/testsuite/gdb.base/structs.c +++ b/gdb/testsuite/gdb.base/structs.c @@ -102,68 +102,120 @@ struct struct16 fun16() return foo16; } +#ifdef PROTOTYPES +void Fun1(struct struct1 foo1) +#else void Fun1(foo1) struct struct1 foo1; +#endif { L1 = foo1; } +#ifdef PROTOTYPES +void Fun2(struct struct2 foo2) +#else void Fun2(foo2) struct struct2 foo2; +#endif { L2 = foo2; } +#ifdef PROTOTYPES +void Fun3(struct struct3 foo3) +#else void Fun3(foo3) struct struct3 foo3; +#endif { L3 = foo3; } +#ifdef PROTOTYPES +void Fun4(struct struct4 foo4) +#else void Fun4(foo4) struct struct4 foo4; +#endif { L4 = foo4; } +#ifdef PROTOTYPES +void Fun5(struct struct5 foo5) +#else void Fun5(foo5) struct struct5 foo5; +#endif { L5 = foo5; } +#ifdef PROTOTYPES +void Fun6(struct struct6 foo6) +#else void Fun6(foo6) struct struct6 foo6; +#endif { L6 = foo6; } +#ifdef PROTOTYPES +void Fun7(struct struct7 foo7) +#else void Fun7(foo7) struct struct7 foo7; +#endif { L7 = foo7; } +#ifdef PROTOTYPES +void Fun8(struct struct8 foo8) +#else void Fun8(foo8) struct struct8 foo8; +#endif { L8 = foo8; } +#ifdef PROTOTYPES +void Fun9(struct struct9 foo9) +#else void Fun9(foo9) struct struct9 foo9; +#endif { L9 = foo9; } +#ifdef PROTOTYPES +void Fun10(struct struct10 foo10) +#else void Fun10(foo10) struct struct10 foo10; +#endif { L10 = foo10; } +#ifdef PROTOTYPES +void Fun11(struct struct11 foo11) +#else void Fun11(foo11) struct struct11 foo11; +#endif { L11 = foo11; } +#ifdef PROTOTYPES +void Fun12(struct struct12 foo12) +#else void Fun12(foo12) struct struct12 foo12; +#endif { L12 = foo12; } +#ifdef PROTOTYPES +void Fun16(struct struct16 foo16) +#else void Fun16(foo16) struct struct16 foo16; +#endif { L16 = foo16; } diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp index 1c79af5..7f4556c 100644 --- a/gdb/testsuite/gdb.base/structs.exp +++ b/gdb/testsuite/gdb.base/structs.exp @@ -127,9 +127,9 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -gdb_test "set print sevenbit-strings" "" "" -gdb_test "set print address off" "" "" -gdb_test "set width 0" "" "" +gdb_test "set print sevenbit-strings" "" +gdb_test "set print address off" "" +gdb_test "set width 0" "" if [target_info exists gdb,cannot_call_functions] { setup_xfail "*-*-*" 2416 diff --git a/gdb/testsuite/gdb.base/structs2.exp b/gdb/testsuite/gdb.base/structs2.exp index 14652be..d2924ea 100644 --- a/gdb/testsuite/gdb.base/structs2.exp +++ b/gdb/testsuite/gdb.base/structs2.exp @@ -45,7 +45,7 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -gdb_test "set width 0" "" "" +gdb_test "set width 0" "" if { ![runto_main] } then { gdb_suppress_tests diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index 7dced3b..f9fda65 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -79,9 +79,9 @@ proc initialize {} { # ??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. + # before running can cause the inferior to croak on HP-UX 11.0 for + # reasons yet unknown, we've disabled the ability to set watches + # without a running inferior. Verify the restriction. # send_gdb "watch ival3\n" gdb_expect { @@ -157,8 +157,8 @@ 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 + # before running can cause the inferior to croak on HP-UX 11.0 + # for reasons yet unknown, we've disabled the ability to set # watches without a running inferior. The following testpoints used # to be in [initialize]. # diff --git a/gdb/testsuite/gdb.base/whatis.exp b/gdb/testsuite/gdb.base/whatis.exp index d540e4c..20cd67e 100644 --- a/gdb/testsuite/gdb.base/whatis.exp +++ b/gdb/testsuite/gdb.base/whatis.exp @@ -301,11 +301,10 @@ gdb_test "whatis v_union2" \ "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. +if { [istarget "hppa*-hp-hpux*"] && $hp_aCC_compiler } { + # HP-UX: HP aCC compiler w/ +objdebug option detects language as + # c++, so we need the 'void' pattern here. + # Without +objdebug compilation option we still need to match ''. # - guo set void "(void|)" } else { diff --git a/gdb/testsuite/gdb.c++/Makefile.in b/gdb/testsuite/gdb.c++/Makefile.in index 5efba8d..58ef94b 100644 --- a/gdb/testsuite/gdb.c++/Makefile.in +++ b/gdb/testsuite/gdb.c++/Makefile.in @@ -1,17 +1,24 @@ VPATH = @srcdir@ srcdir = @srcdir@ -PROGS = annota2 anon-union compiler cplusfuncs derivation inherit local \ - member-ptr method misc \ - overload ovldbreak ref-types ref-types2 templates userdef virtfunc +EXECUTABLES = ambiguous annota2 anon-union cplusfuncs cttiadd \ + derivation inherit local member-ptr method misc \ + overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc all: @echo "Nothing to be done for all..." -#### host, target, and site specific Makefile frags come in here. +info: +install-info: +dvi: +install: +uninstall: force +installcheck: +check: clean mostlyclean: - -rm -f *.ci *.o ${OBJS} ${PROGS} *~ core + -rm -f *~ *.o *.ci + -rm -f core ${EXECUTABLES} distclean maintainer-clean realclean: clean -rm -f Makefile config.status config.log diff --git a/gdb/testsuite/gdb.c++/ambiguous.cc b/gdb/testsuite/gdb.c++/ambiguous.cc new file mode 100644 index 0000000..6ee7bc1 --- /dev/null +++ b/gdb/testsuite/gdb.c++/ambiguous.cc @@ -0,0 +1,110 @@ + +void marker1() +{ + return; +} + +class A1 { +public: + int x; + int y; +}; + +class A2 { +public: + int x; + int y; +}; + +class A3 { +public: + int x; + int y; +}; + +class X : public A1, public A2 { +public: + int z; +}; + +class L : public A1 { +public: + int z; +}; + +class LV : public virtual A1 { +public: + int z; +}; + +class M : public A2 { +public: + int w; +}; + +class N : public L, public M { +public: + int r; +}; + +class K : public A1 { +public: + int i; +}; + +class KV : public virtual A1 { +public: + int i; +}; + +class J : public K, public L { +public: + int j; +}; + +class JV : public KV, public LV { +public: + int jv; +}; + +class JVA1 : public KV, public LV, public A1 { +public: + int jva1; +}; + +class JVA2 : public KV, public LV, public A2 { +public: + int jva2; +}; + +class JVA1V : public KV, public LV, public virtual A1 { +public: + int jva1v; +}; + +int main() +{ + A1 a1; + A2 a2; + A3 a3; + X x; + L l; + M m; + N n; + K k; + J j; + JV jv; + JVA1 jva1; + JVA2 jva2; + JVA1V jva1v; + + int i; + + i += k.i + m.w + a1.x + a2.x + a3.x + x.z + l.z + n.r + j.j; + + marker1(); + +} + + + diff --git a/gdb/testsuite/gdb.c++/ambiguous.exp b/gdb/testsuite/gdb.c++/ambiguous.exp new file mode 100644 index 0000000..998b478 --- /dev/null +++ b/gdb/testsuite/gdb.c++/ambiguous.exp @@ -0,0 +1,235 @@ +# Copyright (C) 1998 Free Software Foundation, Inc. + +# 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. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file is part of the gdb testsuite + +# tests relating to ambiguous class members +# Written by Satish Pai <pai@apollo.hp.com> 1997-07-28 + +# This file is part of the gdb testsuite + +if $tracelevel then { + strace $tracelevel + } + +# +# test running programs +# + +set prms_id 0 +set bug_id 0 + +set testfile "ambiguous" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile} "c++"] { + return -1; +} + +if { $gcc_compiled } then { 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." +} + + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +# +# set it up at a breakpoint so we can play with the variable values +# +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" + send_gdb "cont\n" + gdb_expect { + -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" { + send_gdb "up\n" + gdb_expect { + -re ".*$gdb_prompt $" { pass "up from marker1" } + timeout { fail "up from marker1" } + } + } + -re "$gdb_prompt $" { fail "continue to marker1" } + timeout { fail "(timeout) continue to marker1" } + } + +# print out various class objects' members. The values aren't +# important, just check that the warning is emitted at the +# right times. + +# X is derived from A1 and A2; both A1 and A2 have a member 'x' +send_gdb "print x.x\n" +gdb_expect { + -re "warning: x ambiguous; using X::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print x.x" + } + -re "warning: x ambiguous; using X::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print x.x" + } + -re ".*$gdb_prompt $" { fail "print x.x" } + timeout { fail "(timeout) print x.x" } +} + + +# N is derived from A1 and A2, but not immediately -- two steps +# up in the hierarchy. Both A1 and A2 have a member 'x'. +send_gdb "print n.x\n" +gdb_expect { + -re "warning: x ambiguous; using N::M::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print n.x" + } + -re "warning: x ambiguous; using N::L::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print n.x" + } + -re ".*$gdb_prompt $" { fail "print n.x" } + timeout { fail "(timeout) print n.x" } +} + +# J is derived from A1 twice. A1 has a member x. +send_gdb "print j.x\n" +gdb_expect { + -re "warning: x ambiguous; using J::L::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print j.x" + } + -re "warning: x ambiguous; using J::K::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print j.x" + } + -re ".*$gdb_prompt $" { fail "print j.x" } + timeout { fail "(timeout) print j.x" } +} + +# JV is derived from A1 but A1 is a virtual base. Should not +# report an ambiguity in this case. +send_gdb "print jv.x\n" +gdb_expect { + -re "warning: x ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + fail "print jv.x (ambiguity reported)" + } + -re "\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { pass "print jv.x" } + -re ".*$gdb_prompt $" { fail "print jv.x (??)" } + timeout { fail "(timeout) print jv.x" } +} + +# JVA1 is derived from A1; A1 occurs as a virtual base in two +# ancestors, and as a non-virtual immediate base. Ambiguity must +# be reported. +send_gdb "print jva1.x\n" +gdb_expect { + -re "warning: x ambiguous; using JVA1::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print jva1.x" + } + -re "warning: x ambiguous; using JVA1::KV::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print jva1.x" + } + -re ".*$gdb_prompt $" { fail "print jva1.x" } + timeout { fail "(timeout) print jva1.x" } +} + +# JVA2 is derived from A1 & A2; A1 occurs as a virtual base in two +# ancestors, and A2 is a non-virtual immediate base. Ambiguity must +# be reported as A1 and A2 both have a member 'x'. +send_gdb "print jva2.x\n" +gdb_expect { + -re "warning: x ambiguous; using JVA2::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print jva2.x" + } + -re "warning: x ambiguous; using JVA2::KV::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print jva2.x" + } + -re ".*$gdb_prompt $" { fail "print jva2.x" } + timeout { fail "(timeout) print jva2.x" } +} + +# JVA1V is derived from A1; A1 occurs as a virtual base in two +# ancestors, and also as a virtual immediate base. Ambiguity must +# not be reported. +send_gdb "print jva1v.x\n" +gdb_expect { + -re "warning: x ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + fail "print jva1v.x (ambiguity reported)" + } + -re "\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { pass "print jva1v.x" } + -re ".*$gdb_prompt $" { fail "print jva1v.x (??)" } + timeout { fail "(timeout) print jva1v.x" } +} + +# Now check for ambiguous bases. + +# J is derived from A1 twice; report ambiguity if a J is +# cast to an A1. +send_gdb "print (A1)j\n" +gdb_expect { + -re "warning: A1 ambiguous; using J::L::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + pass "print (A1)j" + } + -re "warning: A1 ambiguous; using J::K::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + pass "print (A1)j" + } + -re ".*$gdb_prompt $" { fail "print (A1)j" } + timeout { fail "(timeout) print (A1)j" } +} + +# JV is derived from A1 twice, but A1 is a virtual base; should +# not report ambiguity when a JV is cast to an A1. +send_gdb "print (A1)jv\n" +gdb_expect { + -re "warning: A1 ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + fail "print (A1)jv (ambiguity reported)" + } + -re "\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { pass "print (A1)jv" } + -re ".*$gdb_prompt $" { fail "print (A1)jv (??)" } + timeout { fail "(timeout) print (A1)jv" } +} + +# JVA1 is derived from A1; A1 is a virtual base and also a +# non-virtual base. Must report ambiguity if a JVA1 is cast to an A1. +send_gdb "print (A1)jva1\n" +gdb_expect { + -re "warning: A1 ambiguous; using JVA1::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + pass "print (A1)jva1" + } + -re "warning: A1 ambiguous; using JVA1::KV::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + pass "print (A1)jva1" + } + -re ".*$gdb_prompt $" { fail "print (A1)jva1" } + timeout { fail "(timeout) print (A1)jva1" } +} + +# JVA1V is derived from A1; A1 is a virtual base indirectly +# and also directly; must not report ambiguity when a JVA1V is cast to an A1. +send_gdb "print (A1)jva1v\n" +gdb_expect { + -re "warning: A1 ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + fail "print (A1)jva1v (ambiguity reported)" + } + -re "\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { pass "print (A1)jva1v" + } + -re ".*$gdb_prompt $" { fail "print (A1)jva1v (??)" } + timeout { fail "(timeout) print (A1)jva1v" } +} + diff --git a/gdb/testsuite/gdb.c++/annota2.exp b/gdb/testsuite/gdb.c++/annota2.exp index aabc551..0a58cd4 100644 --- a/gdb/testsuite/gdb.c++/annota2.exp +++ b/gdb/testsuite/gdb.c++/annota2.exp @@ -95,8 +95,7 @@ gdb_expect { 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.*annota2.cc\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 "$main_line.*$gdb_prompt$" { pass "run until main breakpoint" } -re ".*$gdb_prompt$" { fail "run until main breakpoint" } timeout { fail "run until main breakpoint (timeout)" } } @@ -135,7 +134,7 @@ gdb_expect { # send_gdb "delete\n" gdb_expect { - -re " " { + -re ".*Delete all breakpoints. \\(y or n\\) \r\n\032\032query.*$" { send_gdb "y\n" gdb_expect { -re " " { pass "delete bps" } @@ -166,10 +165,11 @@ set main_line 22 # # run program up to breakpoint. # + + send_gdb "run\n" gdb_expect { - -re "\r\n\032\032post-prompt\r\n.*Starting 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 2\r\n\r\nBreakpoint 2, \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.*annota2.cc\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 "$main_line.*$gdb_prompt$" { pass "run until main breakpoint" } -re ".*$gdb_prompt$" { fail "run until main breakpoint" } timeout { fail "run until main breakpoint (timeout)" } } @@ -179,7 +179,7 @@ send_gdb "run\n" # send_gdb "watch a.x\n" gdb_expect { - -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nWatchpoint 3: a.x\r\n$gdb_prompt$" \ + -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\n.*atchpoint 3: a.x\r\n$gdb_prompt$" \ { pass "set watch on a.x" } -re ".*$gdb_prompt$" { fail "set watch on a.x" } timeout { fail "set watch on a.x (timeout)" } @@ -222,3 +222,4 @@ gdb_expect { # reinstall the old prompt for the rest of the testsuite. set gdb_prompt $old_gdb_prompt + diff --git a/gdb/testsuite/gdb.c++/anon-union.cc b/gdb/testsuite/gdb.c++/anon-union.cc index c58a306..0b3fd13 100644 --- a/gdb/testsuite/gdb.c++/anon-union.cc +++ b/gdb/testsuite/gdb.c++/anon-union.cc @@ -4,13 +4,13 @@ struct Foo { int zero; unsigned int one; } num1; - - union { - int pebble; - struct { + struct X { int rock; unsigned int rock2; - } x; + }; + union { + int pebble; + X x; union { int qux; unsigned int mux; @@ -32,22 +32,23 @@ union Bar { unsigned int y; }; -Foo foo; -Bar bar; int main() { + Foo foo = {0, 0}; + foo.paper = 33; foo.pebble = 44; foo.mux = 55; - bar.x = 33; + Bar bar = {0}; - union - { + union { int z; unsigned int w; - }; + }; w = 0; + + bar.x = 33; w = 45; diff --git a/gdb/testsuite/gdb.c++/anon-union.exp b/gdb/testsuite/gdb.c++/anon-union.exp index 83171a2..5ed924f 100644 --- a/gdb/testsuite/gdb.c++/anon-union.exp +++ b/gdb/testsuite/gdb.c++/anon-union.exp @@ -76,6 +76,16 @@ gdb_expect -re "$gdb_prompt $" # NOTE: Add -- ptype foo.x, etc. when things are working +#Initialize foo +send_gdb "next\n" +gdb_expect { + -re "40\[ \t\]*foo.paper = 33;\r\n$gdb_prompt $" { + pass "next 1" + } + -re ".*$gdb_prompt $" { fail "next 1" } + timeout { fail "(timeout) next 1" } +} + # Print out the big anon union. send_gdb "print foo\n" gdb_expect { @@ -245,10 +255,10 @@ gdb_expect { } -# Step over next two assignments -send_gdb "next 2\n" +# Step over next four assignments +send_gdb "next 4\n" gdb_expect { - -re "52\[ \t\]*w = 45;\r\n$gdb_prompt $" { + -re "53\[ \t\]*w = 45;\r\n$gdb_prompt $" { pass "next 3" } -re ".*$gdb_prompt $" { fail "next 3" } @@ -257,30 +267,28 @@ gdb_expect { # Tests for anon unions that are not members of a class or struct -# w is not yet initialized; it contains garbage -#send_gdb "print w\n" -#gdb_expect { -# -re "\\$\[0-9\]* = 0\r\n$gdb_prompt $" { -# pass "print w 1" -# } -# -re ".*$gdb_prompt $" { fail "print w 1" } -# timeout { fail "(timeout) print w 1" } -#} -# -# z is not yet initialized; it contains garbage -#send_gdb "print z\n" -#gdb_expect { -# -re "\\$\[0-9\]* = 0\r\n$gdb_prompt $" { -# pass "print z 1" -# } -# -re ".*$gdb_prompt $" { fail "print z 1" } -# timeout { fail "(timeout) print z 1" } -#} +send_gdb "print w\n" +gdb_expect { + -re "\\$\[0-9\]* = 0\r\n$gdb_prompt $" { + pass "print w 1" + } + -re ".*$gdb_prompt $" { fail "print w 1" } + timeout { fail "(timeout) print w 1" } +} + +send_gdb "print z\n" +gdb_expect { + -re "\\$\[0-9\]* = 0\r\n$gdb_prompt $" { + pass "print z 1" + } + -re ".*$gdb_prompt $" { fail "print z 1" } + timeout { fail "(timeout) print z 1" } +} # Step over next assignment to w send_gdb "next\n" gdb_expect { - -re "54\[ \t\]*\}\r\n$gdb_prompt $" { + -re "55\[ \t\]*\}\r\n$gdb_prompt $" { pass "next 4" } -re ".*$gdb_prompt $" { fail "next 4" } diff --git a/gdb/testsuite/gdb.c++/classes.exp b/gdb/testsuite/gdb.c++/classes.exp index 05a6cde..445f2e6 100644 --- a/gdb/testsuite/gdb.c++/classes.exp +++ b/gdb/testsuite/gdb.c++/classes.exp @@ -42,13 +42,6 @@ if [get_compiler_info ${binfile} "c++"] { 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 c++}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." @@ -142,6 +135,9 @@ proc test_ptype_class_objects {} { -re "type = struct mixed_protection_struct \{${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl\}$nl$gdb_prompt $" { pass "ptype struct mixed_protection_struct (FIXME)" } + -re "type = struct mixed_protection_struct \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl.*\}$nl$gdb_prompt $" { + pass "ptype struct mixed_protection_struct (extra public)" + } -re "type = class mixed_protection_struct \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl.*\}$nl$gdb_prompt $" { setup_xfail "*-*-*" fail "ptype struct mixed_protection_struct (FIXME)" @@ -203,6 +199,9 @@ proc test_ptype_class_objects {} { -re "type = class explicit_private_class \{${ws}private:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { pass "ptype class explicit_private_class" } + -re "type = class explicit_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class explicit_private_class (OK for HP aCC)" + } -re "type = struct explicit_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { setup_xfail "*-*-*" fail "ptype class explicit_private_class" @@ -340,6 +339,9 @@ proc test_ptype_class_objects {} { setup_xfail "*-*-*" fail "ptype class vB (FIXME: non-portable virtual table constructs)" } + -re "type = class vB : public virtual vA \{${ws}public:${ws}int vb;${ws}int vx;${ws}\}$nl$gdb_prompt $" { + pass "ptype class vB (aCC)" + } -re "type = class vB : public virtual vA \{${ws}private:${ws}vA \\*_vb.vA;${ws}public:${ws}int vb;${ws}int vx;((${ws}vB & operator=\\(vB const &\\);)|(${ws}vB\\(int, vB const &\\);)|(${ws}vB\\(int\\);))*${ws}\}$nl$gdb_prompt $" { setup_xfail "*-*-*" fail "ptype class vB (FIXME) (obsolescent gcc or gdb)" @@ -364,6 +366,9 @@ proc test_ptype_class_objects {} { setup_xfail "*-*-*" fail "ptype class vC (FIXME: non-portable virtual table constructs)" } + -re "type = class vC : public virtual vA \{${ws}public:${ws}int vc;${ws}int vx;${ws}\}$nl$gdb_prompt $" { + pass "ptype class vC (aCC)" + } -re "type = class vC : public virtual vA \{${ws}private:${ws}vA \\*_vb.vA;${ws}public:${ws}int vc;${ws}int vx;((${ws}vC & operator=\\(vC const &\\);)|(${ws}vC\\(int, vC const &\\);)|(${ws}vC\\(int\\);))*${ws}\}$nl$gdb_prompt $" { setup_xfail "*-*-*" fail "ptype class vC (FIXME) (obsolescent gcc or gdb)" @@ -388,6 +393,9 @@ proc test_ptype_class_objects {} { setup_xfail "*-*-*" fail "ptype class vD (FIXME: non-portable virtual table constructs)" } + -re "type = class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;${ws}\}$nl$gdb_prompt $" { + pass "ptype class vD (aCC)" + } -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*_vb.vC;${ws}vB \\*_vb.vB;${ws}public:${ws}int vd;${ws}int vx;((${ws}vD & operator=\\(vD const &\\);)|(${ws}vD\\(int, vD const &\\);)|(${ws}vD\\(int\\);))*${ws}\}$nl$gdb_prompt $" { setup_xfail "*-*-*" fail "ptype class vD (FIXME) (obsolescent gcc or gdb)" @@ -412,6 +420,9 @@ proc test_ptype_class_objects {} { setup_xfail "*-*-*" fail "ptype class vE (FIXME: non-portable virtual table constructs)" } + -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;${ws}\}$nl$gdb_prompt $" { + pass "ptype class vE (aCC)" + } -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*_vb.vD;${ws}public:${ws}int ve;${ws}int vx;((${ws}vE & operator=\\(vE const &\\);)|(${ws}vE\\(int, vE const &\\);)|(${ws}vE\\(int\\);))*${ws}\}$nl$gdb_prompt $" { setup_xfail "*-*-*" fail "ptype class vE (FIXME) (obsolescent gcc or gdb)" @@ -446,6 +457,9 @@ proc test_ptype_class_objects {} { setup_xfail_format "DWARF 1" send_gdb "ptype class Foo\n" gdb_expect { + -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;\r\n${ws}Foo\\(int, int\\);${ws}int operator!.void.;${ws}operator int.void.;${ws}int times.int.;$nl\}$nl$gdb_prompt $" { + pass "ptype class Foo(aCC)" + } -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;${ws}Foo & operator=\\(Foo const &\\);${ws}Foo\\(Foo const &\\);${ws}Foo\\(int, int\\);${ws}int operator!\\(void\\);${ws}int operator int\\(void\\);${ws}int times\\(int\\);${ws}\}$nl$gdb_prompt $" { pass "ptype class Foo" } @@ -584,7 +598,7 @@ proc test_pointers_to_class_members {} { timeout { fail "print (int)&Bar::y == 2*sizeof(int) (timeout)" ; return } } - send_gdb "next\n" + send_gdb "next 2\n" setup_xfail "*-*-*" gdb_expect { -re "$decimal\[ \t\]+inheritance3 \[)(\]+;$nl$gdb_prompt $" {} @@ -774,15 +788,15 @@ do_tests # set a breakpoint and go there -send_gdb "break 503\n" +send_gdb "break 516\n" gdb_expect { - -re "Breakpoint \[0-9\] at.*$gdb_prompt $" { pass "set break 503" } - -re "$gdb_prompt $" { fail "set break 503" } - timeout { fail "(timeout) set break 503" } + -re "Breakpoint \[0-9\] at.*$gdb_prompt $" { pass "set break 516" } + -re "$gdb_prompt $" { fail "set break 516" } + timeout { fail "(timeout) set break 516" } } send_gdb "continue\n" gdb_expect { - -re "Continuing\\.\r\n\r\nBreakpoint \[0-9\]*, main....at.*misc\\.cc:503\r\n503.*\r\n$gdb_prompt $" { pass "continue" } + -re "Continuing\\.\r\n\r\nBreakpoint \[0-9\]*, main....at.*misc\\.cc:516\r\n516.*\r\n$gdb_prompt $" { pass "continue" } -re "$gdb_prompt $" { fail "continue" } timeout { fail "(timeout) continue" } } @@ -829,13 +843,17 @@ gdb_expect { } # ptype on the object +# g++ is putting out the wrong debug info. This works with aCC +if {!$hp_aCC_compiler} {setup_xfail "hppa*-*-*"} send_gdb "ptype obj_with_enum\n" gdb_expect { - -re "type = class ClassWithEnum \\{\r\n\[ \t\]*public:\r\n\[ \t\]*enum ClassWithEnum::PrivEnum priv_enum;\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { pass "ptype obj_with_enum" } + -re "type = class ClassWithEnum \\{\r\n\[ \t\]*public:\r\n\[ \t\]*(enum |)ClassWithEnum::PrivEnum priv_enum;\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { pass "ptype obj_with_enum" } -re "$gdb_prompt $" { fail "ptype obj_with_enum" } timeout { fail "(timeout) ptype obj_with_enum" } } +# g++ is putting out the wrong debug info. This works with aCC +if {!$hp_aCC_compiler} {setup_xfail "hppa*-*-*"} send_gdb "print (ClassWithEnum::PrivEnum) 42\n" gdb_expect { -re "\\$\[0-9\]* = yellow.*$gdb_prompt $" { pass "print (ClassWithEnum::PrivEnum) 42" } diff --git a/gdb/testsuite/gdb.c++/cplusfuncs.cc b/gdb/testsuite/gdb.c++/cplusfuncs.cc index acb73b1..0c835eb 100644 --- a/gdb/testsuite/gdb.c++/cplusfuncs.cc +++ b/gdb/testsuite/gdb.c++/cplusfuncs.cc @@ -36,7 +36,7 @@ public: void operator || (foo&); void operator ~ (void); void operator -- (int); - void operator -> (void); + foo* operator -> (void); void operator -= (foo&); void operator /= (foo&); void operator <<= (foo&); @@ -63,7 +63,7 @@ extern "C" { }; #endif -main () { +int main () { #ifdef usestubs set_debug_traps(); breakpoint(); @@ -105,7 +105,7 @@ void foo::operator ^ (foo& afoo) { afoo.ifoo = 0; } void foo::operator || (foo& afoo) { afoo.ifoo = 0; } void foo::operator ~ (void) {} void foo::operator -- (int ival) { ival = 0; } -void foo::operator -> (void) {} +foo* foo::operator -> (void) {return this;} void foo::operator -= (foo& afoo) { afoo.ifoo = 0; } void foo::operator /= (foo& afoo) { afoo.ifoo = 0; } void foo::operator <<= (foo& afoo) { afoo.ifoo = 0; } diff --git a/gdb/testsuite/gdb.c++/cplusfuncs.exp b/gdb/testsuite/gdb.c++/cplusfuncs.exp index e36d379..16283f3 100644 --- a/gdb/testsuite/gdb.c++/cplusfuncs.exp +++ b/gdb/testsuite/gdb.c++/cplusfuncs.exp @@ -34,6 +34,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 "c++"] == -1} { + return -1 +} + # # Cause gdb to lookup a specific C++ function and print the demangled # form. @@ -44,7 +48,10 @@ proc info_func { regex demangled } { send_gdb "info function $regex\n" gdb_expect { - -re "File .*:\r\n$demangled\r\n$gdb_prompt $" { + -re "File .*:\r\n$demangled\r\n.*$gdb_prompt $" { + pass "info function for \"$regex\"" + } + -re "File .*:\r\nclass $demangled\r\n.*$gdb_prompt $" { pass "info function for \"$regex\"" } -re ".*$gdb_prompt $" { @@ -125,7 +132,7 @@ proc test_lookup_operator_functions {} { info_func "operator,(" "void foo::operator,\\(foo &\\);" info_func "operator~(" "void foo::operator~\\(void\\);" - info_func "operator delete(" "void foo::operator delete\\(void \\*\\);" + info_func "operator delete(" "void foo::operator delete\\(void \\*\\)(| static);" info_func "operator/(" "void foo::operator/\\(foo &\\);" info_func "operator==(" "void foo::operator==\\(foo &\\);" info_func "operator^(" "void foo::operator\\^\\(foo &\\);" @@ -146,14 +153,14 @@ proc test_lookup_operator_functions {} { info_func "operator--(" "void foo::operator--\\(int\\);" info_func "operator!=(" "void foo::operator!=\\(foo &\\);" info_func "operator!(" "void foo::operator!\\(void\\);" - info_func "operator new(" "void \\*foo::operator new\\(.*\\);" + info_func "operator new(" "void \\*foo::operator new\\(.*\\)(| static);" info_func "operator||(" "void foo::operator\\|\\|\\(foo &\\);" info_func "operator char \\*(" "char \\*foo::operator char \\*\\(void\\);" info_func "operator int(" "int foo::operator int\\(void\\);" info_func "operator|(" "void foo::operator\\|\\(foo &\\);" info_func "operator+(" "void foo::operator\\+\\(foo &\\);" info_func "operator++(" "void foo::operator\\+\\+\\(int\\);" - info_func "operator->(" "void foo::operator->\\(void\\);" + info_func "operator->(" "foo \\*foo::operator->\\(void\\);" info_func "operator->\\*(" "void foo::operator->\\*\\(foo &\\);" info_func "operator>>(" "void foo::operator\>\>\\(foo &\\);" @@ -167,6 +174,7 @@ proc test_lookup_operator_functions {} { proc test_paddr_operator_functions {} { global hex + global hp_aCC_compiler print_addr_of "foo::operator&&(foo &)" print_addr_of "foo::operator&=(foo &)" @@ -184,7 +192,12 @@ proc test_paddr_operator_functions {} { print_addr_of "foo::operator()(foo &)" print_addr_of "foo::operator, (foo &)" print_addr_of "foo::operator~(void)" - print_addr_of "foo::operator delete(void *)" + if { !$hp_aCC_compiler } { + print_addr_of "foo::operator delete(void *)" + } else { + gdb_test "print &'foo::operator delete(void *) static'" \ + " = .*(0x\[0-9a-f\]+|) <foo::operator delete.*>" + } print_addr_of "foo::operator/(foo &)" print_addr_of "foo::operator==(foo &)" print_addr_of "foo::operator^(foo &)" @@ -200,7 +213,7 @@ proc test_paddr_operator_functions {} { print_addr_of "foo::operator!=(foo &)" print_addr_of "foo::operator!(void)" gdb_test "print &'foo::operator new'" \ - " = .* $hex <foo::operator new\\(.*\\)>" + " = .* $hex <foo::operator new\\(.*\\)(| static)>" print_addr_of "foo::operator||(foo &)" print_addr_of "foo::operator char *(void)" print_addr_of "foo::operator int(void)" diff --git a/gdb/testsuite/gdb.c++/ctti.exp b/gdb/testsuite/gdb.c++/ctti.exp new file mode 100644 index 0000000..b8c7cc9 --- /dev/null +++ b/gdb/testsuite/gdb.c++/ctti.exp @@ -0,0 +1,268 @@ +# Copyright (C) 1998 Free Software Foundation, Inc. + +# 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. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + + +# This file is part of the gdb testsuite +# file written by Elena Zannoni (ezannoni@cygnus.com) +# +# source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.cc +# + + +if $tracelevel then { + strace $tracelevel +} + + +# Check to see if we have an executable to test. If not, then either we +# haven't tried to compile one, or the compilation failed for some reason. +# In either case, just notify the user and skip the tests in this file. + +set testfile "cttiadd" +set srcfile ${testfile}.cc +set srcfile1 ${testfile}1.cc +set srcfile2 ${testfile}2.cc +set srcfile3 ${testfile}3.cc +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile} "c++"] { + return -1; +} + +if { $gcc_compiled } then { continue } + +#if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3}" "${binfile}" executable {debug c++}] != "" } { +# gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +#} + +set cmdline "$CXX_FOR_TARGET ${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3} -g -o ${binfile}" + +remote_exec build $cmdline + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*i = 2;.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*f = 4.5;.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*c = add\\(c, c\\);.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*i = add\\(i, i\\);.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*f = add\\(f, f\\);.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*add1\\(\\);.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "print c\n" +gdb_expect { + -re ".$decimal = -62.*\r\n$gdb_prompt $" { + pass "print value of c" + } + -re ".*$gdb_prompt $" { fail "print value of c" } + timeout { fail "(timeout) print value of c" } + } + + +send_gdb "print f\n" +gdb_expect { + -re ".$decimal = 9\r\n$gdb_prompt $" { + pass "print value of f" + } + -re ".*$gdb_prompt $" { fail "print value of f" } + timeout { fail "(timeout) print value of f" } + } + + +send_gdb "print i\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of i" + } + -re ".*$gdb_prompt $" { fail "print value of i" } + timeout { fail "(timeout) print value of i" } + } + + + +send_gdb "print add<int>(2,2)\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of add<int>(2,2)" + } + -re ".*$gdb_prompt $" { fail "print value of add<int>(2,2)" } + timeout { fail "(timeout) print value of add<int>(2,2)" } + } + +send_gdb "print add<float>(2.3,2.3)\n" +gdb_expect { + -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { + pass "print value of add<float>(2.3,2.3)" + } + -re ".*$gdb_prompt $" { fail "print value of add<float>(2.3,2.3)" } + timeout { fail "(timeout) print value of add<float>(2.3,2.3)" } + } + +send_gdb "print add<char>('A','A')\n" +gdb_expect { + -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { + pass "print value of add<char>('A','A')" + } + -re ".*$gdb_prompt $" { fail "print value of add<char>('A','A')" } + timeout { fail "(timeout) print value of add<char>('A','A')" } + } + + +send_gdb "print add2<int>(2,2)\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of add2<int>(2,2)" + } + -re ".*$gdb_prompt $" { fail "print value of add2<int>(2,2)" } + timeout { fail "(timeout) print value of add2<int>(2,2)" } + } + +send_gdb "print add2<float>(2.3,2.3)\n" +gdb_expect { + -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { + pass "print value of add2<float>(2.3,2.3)" + } + -re ".*$gdb_prompt $" { fail "print value of add2<float>(2.3,2.3)" } + timeout { fail "(timeout) print value of add2<float>(2.3,2.3)" } + } + +send_gdb "print add2<char>('A','A')\n" +gdb_expect { + -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { + pass "print value of add2<char>('A','A')" + } + -re ".*$gdb_prompt $" { fail "print value of add2<char>('A','A')" } + timeout { fail "(timeout) print value of add2<char>('A','A')" } + } + +send_gdb "print add3<int>(2,2)\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of add3<int>(2,2)" + } + -re ".*$gdb_prompt $" { fail "print value of add3<int>(2,2)" } + timeout { fail "(timeout) print value of add3<int>(2,2)" } + } + +send_gdb "print add3<float>(2.3,2.3)\n" +gdb_expect { + -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { + pass "print value of add3<float>(2.3,2.3)" + } + -re ".*$gdb_prompt $" { fail "print value of add3<float>(2.3,2.3)" } + timeout { fail "(timeout) print value of add3<float>(2.3,2.3)" } + } + +send_gdb "print add3<char>('A','A')\n" +gdb_expect { + -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { + pass "print value of add3<char>('A','A')" + } + -re ".*$gdb_prompt $" { fail "print value of add3<char>('A','A')" } + timeout { fail "(timeout) print value of add3<char>('A','A')" } + } + +send_gdb "print add4<int>(2,2)\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of add4<int>(2,2)" + } + -re ".*$gdb_prompt $" { fail "print value of add4<int>(2,2)" } + timeout { fail "(timeout) print value of add4<int>(2,2)" } + } + +send_gdb "print add4<float>(2.3,2.3)\n" +gdb_expect { + -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { + pass "print value of add4<float>(2.3,2.3)" + } + -re ".*$gdb_prompt $" { fail "print value of add4<float>(2.3,2.3)" } + timeout { fail "(timeout) print value of add4<float>(2.3,2.3)" } + } + +send_gdb "print add4<char>('A','A')\n" +gdb_expect { + -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { + pass "print value of add4<char>('A','A')" + } + -re ".*$gdb_prompt $" { fail "print value of add4<char>('A','A')" } + timeout { fail "(timeout) print value of add4<char>('A','A')" } + } + + +gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.c++/cttiadd.cc b/gdb/testsuite/gdb.c++/cttiadd.cc new file mode 100644 index 0000000..1f50fae --- /dev/null +++ b/gdb/testsuite/gdb.c++/cttiadd.cc @@ -0,0 +1,29 @@ +template<class T> T add(T v1, T v2) +{ + T v3; + v3 = v1; + v3 += v2; + return v3; + } + +int main() +{ + char c; + int i; + float f; + extern void add1(); + extern void subr2(); + extern void subr3(); + + c = 'a'; + i = 2; + f = 4.5; + + c = add(c, c); + i = add(i, i); + f = add(f, f); + + add1(); + subr2(); + subr3(); +} diff --git a/gdb/testsuite/gdb.c++/cttiadd1.cc b/gdb/testsuite/gdb.c++/cttiadd1.cc new file mode 100644 index 0000000..7113ece --- /dev/null +++ b/gdb/testsuite/gdb.c++/cttiadd1.cc @@ -0,0 +1,16 @@ +template<class T> T add(T v1, T v2); + +void add1() +{ + char c; + int i; + float f; + + c = 'b'; + i = 3; + f = 6.5; + + c = add(c, c); + i = add(i, i); + f = add(f, f); +} diff --git a/gdb/testsuite/gdb.c++/cttiadd2.cc b/gdb/testsuite/gdb.c++/cttiadd2.cc new file mode 100644 index 0000000..d0d9891 --- /dev/null +++ b/gdb/testsuite/gdb.c++/cttiadd2.cc @@ -0,0 +1,22 @@ +template<class T> T add2(T v1, T v2) +{ + T v3; + v3 = v1; + v3 += v2; + return v3; +} + +void subr2() +{ + char c; + int i; + float f; + + c = 'b'; + i = 3; + f = 6.5; + + c = add2(c, c); + i = add2(i, i); + f = add2(f, f); +} diff --git a/gdb/testsuite/gdb.c++/cttiadd3.cc b/gdb/testsuite/gdb.c++/cttiadd3.cc new file mode 100644 index 0000000..7ba1b01 --- /dev/null +++ b/gdb/testsuite/gdb.c++/cttiadd3.cc @@ -0,0 +1,33 @@ +template<class T> T add3(T v1, T v2) +{ + T v3; + v3 = v1; + v3 += v2; + return v3; +} + +template<class T> T add4(T v1, T v2) +{ + T v3; + v3 = v1; + v3 += v2; + return v3; +} + +void subr3() +{ + char c; + int i; + float f; + + c = 'b'; + i = 3; + f = 6.5; + + c = add3(c, c); + i = add3(i, i); + f = add3(f, f); + c = add4(c, c); + i = add4(i, i); + f = add4(f, f); +} diff --git a/gdb/testsuite/gdb.c++/demangle.exp b/gdb/testsuite/gdb.c++/demangle.exp index 7f9f174..d63ab04 100644 --- a/gdb/testsuite/gdb.c++/demangle.exp +++ b/gdb/testsuite/gdb.c++/demangle.exp @@ -54,11 +54,11 @@ proc set_demangling_style {style} { pass "$style: check demangling style" } -re ".*$gdb_prompt $" { - fail "gnu: check demangling style" + fail "$style: check demangling style" error "set_demangling_style: check style" } timeout { - fail "gnu: check demangling style (timeout)" + fail "$style: check demangling style (timeout)" error "set_demangling_style: check style" } } diff --git a/gdb/testsuite/gdb.c++/derivation.exp b/gdb/testsuite/gdb.c++/derivation.exp index 657b166..0ac4eca 100644 --- a/gdb/testsuite/gdb.c++/derivation.exp +++ b/gdb/testsuite/gdb.c++/derivation.exp @@ -127,6 +127,7 @@ gdb_expect { send_gdb "ptype d_instance\n" gdb_expect { -re "type = class D : private A, public B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int d;\r\n\[\t \]*int dd;\[\r\n\t ]+D & operator=\\(D const &\\);\[\r\n\t ]+D\\(D const &\\);\[\r\n\t \]+D\\(void\\);\r\n\[\t \]*int dfoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype d_instance" } + -re "type = class D : private A, public B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int d;\r\n\[\t \]*int dd;\[\r\n\t \]+D\\(void\\);\r\n\[\t \]*int dfoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype d_instance" } -re ".*$gdb_prompt $" { fail "ptype d_instance" } timeout { fail "(timeout) ptype d_instance" } } @@ -156,6 +157,7 @@ gdb_expect { send_gdb "ptype e_instance\n" gdb_expect { -re "type = class E : public A, private B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int e;\r\n\[\t \]*int ee;\[\r\n\t ]+E & operator=\\(E const &\\);\[\r\n\t ]+E\\(E const &\\);\[\r\n\t \]+E\\(void\\);\r\n\[\t \]*int efoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype e_instance" } + -re "type = class E : public A, private B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int e;\r\n\[\t \]*int ee;\[\r\n\t \]+E\\(void\\);\r\n\[\t \]*int efoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype e_instance" } -re ".*$gdb_prompt $" { fail "ptype e_instance" } timeout { fail "(timeout) ptype e_instance" } } @@ -302,6 +304,7 @@ gdb_expect { timeout { fail "(timeout) print value of g_instance.c" } } +if { $gcc_compiled } { setup_xfail "hppa*-hp-hpux*" } send_gdb "print g_instance.afoo()\n" gdb_expect { -re ".\[0-9\]* = 1.*$gdb_prompt $" { @@ -311,6 +314,7 @@ gdb_expect { timeout { fail "(timeout) print value of g_instance.afoo()" } } +if { $gcc_compiled } { setup_xfail "hppa*-hp-hpux*" } send_gdb "print g_instance.bfoo()\n" gdb_expect { -re ".\[0-9\]* = 2.*$gdb_prompt $" { @@ -320,6 +324,7 @@ gdb_expect { timeout { fail "(timeout) print value of g_instance.bfoo()" } } +if { $gcc_compiled } { setup_xfail "hppa*-hp-hpux*" } send_gdb "print g_instance.cfoo()\n" gdb_expect { -re ".\[0-9\]* = 3.*$gdb_prompt $" { diff --git a/gdb/testsuite/gdb.c++/inherit.exp b/gdb/testsuite/gdb.c++/inherit.exp index 8c7a90c..b1c28ed 100644 --- a/gdb/testsuite/gdb.c++/inherit.exp +++ b/gdb/testsuite/gdb.c++/inherit.exp @@ -43,15 +43,6 @@ if [get_compiler_info ${binfile} "c++"] { 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 c++}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } @@ -120,6 +111,7 @@ proc test_ptype_si {} { global gdb_prompt global ws global nl + global hp_aCC_compiler # Print class A as a type. @@ -144,7 +136,7 @@ proc test_ptype_si {} { pass "ptype class A (FIXME)" } -re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" { - setup_xfail "*-*-*" + if {!$hp_aCC_compiler} {setup_xfail "*-*-*"} fail "ptype class A (FIXME)" } -re ".*$gdb_prompt $" { fail "ptype class A" } @@ -159,7 +151,7 @@ proc test_ptype_si {} { pass "ptype g_A (FIXME)" } -re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" { - setup_xfail "*-*-*" + if {!$hp_aCC_compiler} {setup_xfail "*-*-*"} fail "ptype g_A (FIXME)" } -re ".*$gdb_prompt $" { fail "ptype g_A" } @@ -243,12 +235,12 @@ proc test_print_si_classes {} { # Print all members of g_B. setup_xfail_format "DWARF 1" - gdb_test "print g_B" ".* = \{\<A\> = \{a = 3, x = 4\}, b = 5, x = 6\}" "print g_B" + gdb_test "print g_B" ".* = \{\<(class |)A\> = \{a = 3, x = 4\}, b = 5, x = 6\}" "print g_B" # Print all members of g_C. setup_xfail_format "DWARF 1" - gdb_test "print g_C" ".* = \{\<A\> = \{a = 7, x = 8\}, c = 9, x = 10\}" "print g_C" + gdb_test "print g_C" ".* = \{\<(class |)A\> = \{a = 7, x = 8\}, c = 9, x = 10\}" "print g_C" } # @@ -270,10 +262,10 @@ proc test_print_anon_union {} { setup_xfail_format "DWARF 1" send_gdb "print g_anon_union\n" gdb_expect { - -re ".* = \{one = 1, = \{a = 2, b = 2\}\}$nl$gdb_prompt $" { + -re ".* = \{one = 1, ( = |)\{a = 2, b = 2\}\}$nl$gdb_prompt $" { pass "print variable of type anonymous union" } - -re ".* = .*\{one = 1, = \{a = 2, b = .*\}\}$nl$gdb_prompt $" { + -re ".* = .*\{one = 1, ( = |)\{a = 2, b = .*\}\}$nl$gdb_prompt $" { pass "print variable of type anonymous union (obsolete gcc or gdb)" } -re ".*$nl$gdb_prompt $" { @@ -308,6 +300,7 @@ proc test_print_anon_union {} { proc test_print_mi_members {} { global gdb_prompt global nl + global hp_aCC_compiler # Print all members of g_A. @@ -341,15 +334,21 @@ proc test_print_mi_members {} { # For now, accept gdb's behavior as an expected failure if it # simply prints either member correctly. - setup_xfail "*-*-*" + if {!$hp_aCC_compiler} {setup_xfail "*-*-*"} send_gdb "print g_D.A::a\n" - gdb_expect { - -re ".* = 11$nl$gdb_prompt $" { - fail "print g_D.A::a (FIXME)" + gdb_expect { + -re "warning: A ambiguous; using D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 15$nl$gdb_prompt $" { + pass "print g_D.A::a" + } + -re "warning: A ambiguous; using D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 11$nl$gdb_prompt $" { + pass "print g_D.A::a (using B)" } -re ".* = 15$nl$gdb_prompt $" { fail "print g_D.A::a (FIXME)" } + -re ".* = 11$nl$gdb_prompt $" { + fail "print g_D.A::a (FIXME)" + } -re ".*$gdb_prompt $" { fail "print g_D.A::a" } timeout { fail "print g_D.A::a (timeout)" ; return } } @@ -358,15 +357,21 @@ proc test_print_mi_members {} { # For now, accept gdb's behavior as an expected failure if it # simply prints either member correctly. - setup_xfail "*-*-*" + if {!$hp_aCC_compiler} {setup_xfail "*-*-*"} send_gdb "print g_D.A::x\n" gdb_expect { - -re ".* = 12$nl$gdb_prompt $" { - fail "print g_D.A::x (FIXME)" + -re "warning: A ambiguous; using D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 16$nl$gdb_prompt $" { + pass "print g_D.A::x" + } + -re "warning: A ambiguous; using D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 12$nl$gdb_prompt $" { + pass "print g_D.A::x (using B)" } -re ".* = 16$nl$gdb_prompt $" { fail "print g_D.A::x (FIXME)" } + -re ".* = 12$nl$gdb_prompt $" { + fail "print g_D.A::x (FIXME)" + } -re ".*$gdb_prompt $" { fail "print g_D.A::x" } timeout { fail "print g_D.A::x (timeout)" ; return } } @@ -408,15 +413,21 @@ proc test_print_mi_members {} { # For now, accept gdb's behavior as an expected failure if it # simply prints either member correctly. - setup_xfail "*-*-*" + if {!$hp_aCC_compiler} {setup_xfail "*-*-*"} send_gdb "print g_E.A::x\n" gdb_expect { - -re ".* = 22$nl$gdb_prompt $" { - fail "print g_E.A::x (FIXME)" + -re "warning: A ambiguous; using E::D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 26$nl$gdb_prompt $" { + pass "print g_E.A::x" + } + -re "warning: A ambiguous; using E::D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 22$nl$gdb_prompt $" { + pass "print g_E.A::x (using B)" } -re ".* = 26$nl$gdb_prompt $" { fail "print g_E.A::x (FIXME)" } + -re ".* = 22$nl$gdb_prompt $" { + fail "print g_E.A::x (FIXME)" + } -re ".*$gdb_prompt $" { fail "print g_E.A::x" } timeout { fail "print g_E.A::x (timeout)" ; return } } @@ -474,12 +485,12 @@ proc test_print_mi_classes {} { # Print all members of g_D. setup_xfail_format "DWARF 1" - gdb_test "print g_D" ".* = \{\<B\> = \{\<A\> = \{a = 11, x = 12\}, b = 13, x = 14\}, \<C\> = \{\<A\> = \{a = 15, x = 16\}, c = 17, x = 18\}, d = 19, x = 20\}" "print g_D" + gdb_test "print g_D" ".* = \{\<(class |)B\> = \{\<(class |)A\> = \{a = 11, x = 12\}, b = 13, x = 14\}, \<(class |)C\> = \{\<(class |)A\> = \{a = 15, x = 16\}, c = 17, x = 18\}, d = 19, x = 20\}" "print g_D" # Print all members of g_E. setup_xfail_format "DWARF 1" - gdb_test "print g_E" ".* = \{\<D\> = \{\<B\> = \{\<A\> = \{a = 21, x = 22\}, b = 23, x = 24\}, \<C\> = \{\<A\> = \{a = 25, x = 26\}, c = 27, x = 28\}, d = 29, x = 30\}, e = 31, x = 32\}" "print g_E" + gdb_test "print g_E" ".* = \{\<(class |)D\> = \{\<(class |)B\> = \{\<(class |)A\> = \{a = 21, x = 22\}, b = 23, x = 24\}, \<(class |)C\> = \{\<(class |)A\> = \{a = 25, x = 26\}, c = 27, x = 28\}, d = 29, x = 30\}, e = 31, x = 32\}" "print g_E" } # @@ -563,6 +574,7 @@ proc test_print_svi_members {} { proc test_ptype_vi {} { global gdb_prompt + global ws global nl # This class does not use any C++-specific features, so it's fine for @@ -608,22 +620,82 @@ proc test_ptype_vi {} { } setup_xfail_format "DWARF 1" - gdb_test "ptype vB" "ptype vB\[\r\n\]+type = class vB : public virtual vA \{$nl private:$nl\[ \]+vA \[*\]+_vb\[\\\$\.\]+vA;$nl public:$nl\[ \]+int vb;$nl\[ \]+int vx;$nl.*\}" "ptype vB" + send_gdb "ptype vB\n" + gdb_expect { + -re "ptype vB${nl}type = class vB : public virtual vA \{$nl private:${ws}vA \[*\]+_vb\[\\\$\.\]+vA;$nl public:${ws}int vb;${ws}int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype vB" + } + -re "ptype vB${nl}type = class vB : public virtual vA \{$nl public:${ws}int vb;${ws}int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype vB (aCC)" + } + -re ".*$gdb_prompt $" { fail "ptype vB" } + timeout { fail "ptype vB (timeout)" } + } setup_xfail_format "DWARF 1" - gdb_test "ptype class vB" "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}" "ptype class vB" + send_gdb "ptype class vB\n" + gdb_expect { + -re "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class vB" + } + -re "type = class vB : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class vB (aCC)" + } + -re ".*$gdb_prompt $" { fail "ptype class vB" } + timeout { fail "ptype class vB (timeout)" } + } setup_xfail_format "DWARF 1" - gdb_test "ptype g_vB" "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}" "ptype g_vB" + send_gdb "ptype g_vB\n" + gdb_expect { + -re "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype g_vB" + } + -re "type = class vB : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype g_vB (aCC)" + } + -re ".*$gdb_prompt $" { fail "ptype g_vB" } + timeout { fail "ptype g_vB (timeout)" } + } setup_xfail_format "DWARF 1" - gdb_test "ptype vC" "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}" "ptype vC" + send_gdb "ptype vC\n" + gdb_expect { + -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype vC" + } + -re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype vC (aCC)" + } + -re ".*$gdb_prompt $" { fail "ptype vC" } + timeout { fail "ptype vC (timeout)" } + } setup_xfail_format "DWARF 1" - gdb_test "ptype class vC" "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}" "ptype class vC" + send_gdb "ptype class vC\n" + gdb_expect { + -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class vC" + } + -re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype class vC (aCC)" + } + -re ".*$gdb_prompt $" { fail "ptype class vC" } + timeout { fail "ptype class vC (timeout)" } + } setup_xfail_format "DWARF 1" - gdb_test "ptype g_vC" "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}" "ptype g_vC" + send_gdb "ptype g_vC\n" + gdb_expect { + -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype g_vC" + } + -re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { + pass "ptype g_vC (aCC)" + } + -re ".*$gdb_prompt $" { fail "ptype g_vC" } + timeout { fail "ptype g_vC (timeout)" } + } } # @@ -645,6 +717,12 @@ proc test_print_svi_classes {} { setup_xfail_format "DWARF 1" send_gdb "print g_vB\n" gdb_expect { + -re ".* = \{\<class vA\> = \{va = 3, vx = 4\}, vb = 5, vx = 6, Virtual table at $hex\}$nl$gdb_prompt $" { + pass "print g_vB (aCC)" + } + -re ".* = \{\<class vA\> = \{va = 3, vx = 4\}, vb = 5, vx = 6, __vfp = $hex\}$nl$gdb_prompt $" { + pass "print g_vB (aCC)" + } -re ".* = \{\<vA\> = \{va = 3, vx = 4\}, _vb\[\\\$\.\]vA = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" { pass "print g_vB" } @@ -661,7 +739,20 @@ proc test_print_svi_classes {} { # Print all members of g_vC. setup_xfail_format "DWARF 1" - gdb_test "print g_vC" ".* = \{\<vA\> = \{va = 7, vx = 8\}, _vb\[\\\$\.\]vA = $hex, vc = 9, vx = 10\}" "print g_vC" + send_gdb "print g_vC\n" + gdb_expect { + -re ".* = \{\<class vA\> = \{va = 7, vx = 8\}, vc = 9, vx = 10, Virtual table at $hex\}$nl$gdb_prompt $" { + pass "print g_vC (aCC)" + } + -re ".* = \{\<class vA\> = \{va = 7, vx = 8\}, vc = 9, vx = 10, __vfp = $hex\}$nl$gdb_prompt $" { + pass "print g_vC (aCC)" + } + -re ".* = \{\<vA\> = \{va = 7, vx = 8\}, _vb\[\\\$\.\]vA = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" { + pass "print g_vC" + } + -re ".*$gdb_prompt $" { fail "print g_vC" } + timeout { fail "print g_vC (timeout)" } + } } # @@ -743,25 +834,87 @@ proc test_print_mvi_members {} { # proc test_ptype_mvi {} { + global gdb_prompt + global ws global nl setup_xfail_format "DWARF 1" - gdb_test "ptype vD" "type = class vD : public virtual vB, public virtual vC \{$nl\[ \]*private:$nl\[ \]*vC \[*\]+_vb\[\\\$\.\]vC;$nl\[ \]*vB \[*\]+_vb\[\\\$\.\]vB;$nl\[ \]*public:$nl\[ \]*int vd;$nl\[ \]*int vx;$nl.*\}" "ptype vD" + send_gdb "ptype vD\n" + gdb_expect { + -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \[*\]+_vb\[\\\$\.\]vC;${ws}vB \[*\]+_vb\[\\\$\.\]vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" { + pass "ptype vD" + } + -re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;.*\}.*$gdb_prompt $" { + pass "ptype vD" + } + -re ".*$gdb_prompt $" { fail "ptype vD" } + timeout { fail "(timeout) ptype vD" } + } setup_xfail_format "DWARF 1" - gdb_test "ptype class vD" "type = class vD : public virtual vB, public virtual vC \{$nl\[ \]*private:$nl\[ \]*vC \[*\]+_vb\[\\\$\.\]vC;$nl\[ \]*vB \[*\]+_vb\[\\\$\.\]vB;$nl\[ \]*public:$nl\[ \]*int vd;$nl\[ \]*int vx;$nl.*\}" "ptype class vD" + send_gdb "ptype class vD\n" + gdb_expect { + -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \[*\]+_vb\[\\\$\.\]vC;${ws}vB \[*\]+_vb\[\\\$\.\]vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" { + pass "ptype class vD" + } + -re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;.*\}.*$gdb_prompt $" { + pass "ptype class vD" + } + -re ".*$gdb_prompt $" { fail "ptype class vD" } + timeout { fail "(timeout) ptype class vD" } + } setup_xfail_format "DWARF 1" - gdb_test "ptype g_vD" "type = class vD : public virtual vB, public virtual vC \{$nl\[ \]*private:$nl\[ \]*vC \[*\]+_vb\[\\\$\.\]vC;$nl\[ \]*vB \[*\]+_vb\[\\\$\.\]vB;$nl\[ \]*public:$nl\[ \]*int vd;$nl\[ \]*int vx;$nl.*\}" "ptype g_vD" + send_gdb "ptype g_vD\n" + gdb_expect { + -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \[*\]+_vb\[\\\$\.\]vC;${ws}vB \[*\]+_vb\[\\\$\.\]vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" { + pass "ptype g_vD" + } + -re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;\r\n.*\}.*$gdb_prompt $" { + pass "ptype g_vD" + } + -re ".*$gdb_prompt $" { fail "ptype g_vD" } + timeout { fail "(timeout) ptype g_vD" } + } setup_xfail_format "DWARF 1" - gdb_test "ptype vE" "type = class vE : public virtual vD \{$nl\[ \]*private:$nl\[ \]*vD \[*\]+_vb\[\\\$\.\]vD;$nl\[ \]*public:$nl\[ \]*int ve;$nl\[ \]*int vx;$nl.*\}" "ptype vE" + send_gdb "ptype vE\n" + gdb_expect { + -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \[*\]+_vb\[\\\$\.\]vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" { + pass "ptype vE" + } + -re ".*class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" { + pass "ptype vE" + } + -re ".*$gdb_prompt $" { fail "ptype vE" } + timeout { fail "(timeout) ptype vE" } + } setup_xfail_format "DWARF 1" - gdb_test "ptype class vE" "type = class vE : public virtual vD \{$nl\[ \]*private:$nl\[ \]*vD \[*\]+_vb\[\\\$\.\]vD;$nl\[ \]*public:$nl\[ \]*int ve;$nl\[ \]*int vx;$nl.*\}" "ptype class vE" + send_gdb "ptype class vE\n" + gdb_expect { + -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \[*\]+_vb\[\\\$\.\]vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" { + pass "ptype class vE" + } + -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" { + pass "ptype class vE" + } + -re ".*$gdb_prompt $" { fail "ptype class vE" } + timeout { fail "(timeout) ptype class vE" } + } setup_xfail_format "DWARF 1" - gdb_test "ptype g_vE" "type = class vE : public virtual vD \{$nl\[ \]*private:$nl\[ \]*vD \[*\]+_vb\[\\\$\.\]vD;$nl\[ \]*public:$nl\[ \]*int ve;$nl\[ \]*int vx;$nl.*\}" "ptype g_vE" + send_gdb "ptype g_vE\n" + gdb_expect { + -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \[*\]+_vb\[\\\$\.\]vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" { + pass "ptype g_vE" + } + -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" { + pass "ptype g_vE" + } + -re ".*$gdb_prompt $" { fail "ptype g_vE" } + timeout { fail "(timeout) ptype g_vE" } + } } # @@ -779,6 +932,12 @@ proc test_print_mvi_classes {} { setup_xfail_format "DWARF 1" send_gdb "print g_vD\n" gdb_expect { + -re ".* = \{\<class vB\> = \{\<class vA\> = \{va = 19, vx = 20\}, vb = 21, vx = 22, Virtual table at $hex\}, \<class vC\> = \{vc = 23, vx = 24, Virtual table at $hex\}, vd = 25, vx = 26, Virtual table at $hex\}$nl$gdb_prompt $" { + pass "print g_vD (aCC)" + } + -re ".* = \{\<class vB\> = \{\<class vA\> = \{va = 19, vx = 20\}, vb = 21, vx = 22, __vfp = $hex\}, \<class vC\> = \{vc = 23, vx = 24, __vfp = $hex\}, vd = 25, vx = 26, __vfp = $hex\}$nl$gdb_prompt $" { + pass "print g_vD (aCC)" + } -re ".* = \{\<vB\> = \{\<vA\> = \{va = 19, vx = 20\}, _vb\[\\\$\.\]vA = $hex, vb = 21, vx = 22\}, \<vC\> = \{_vb\[\\\$\.\]vA = $hex, vc = 23, vx = 24\}, _vb\[\\\$\.\]vC = $hex, _vb\[\\\$\.\]vB = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { pass "print g_vD" } @@ -795,7 +954,20 @@ proc test_print_mvi_classes {} { # Print all members of g_vE. setup_xfail_format "DWARF 1" - gdb_test "print g_vE" ".* = \{\<vD\> = \{\<vB\> = \{\<vA\> = \{va = 0, vx = 0\}, _vb\[\\\$\.\]vA = $hex, vb = 0, vx = 0\}, \<vC\> = \{_vb\[\\\$\.\]vA = $hex, vc = 0, vx = 0\}, _vb\[\\\$\.\]vC = $hex, _vb\[\\\$\.\]vB = $hex, vd = 0, vx = 0\}, _vb\[\\\$\.\]vD = $hex, ve = 27, vx = 28\}" "print g_vE" + send_gdb "print g_vE\n" + gdb_expect { + -re ".* = \{\<class vD\> = \{\<class vB\> = \{\<class vA\> = \{va = 0, vx = 0\}, vb = 0, vx = 0, Virtual table at $hex\}, \<class vC\> = \{vc = 0, vx = 0, Virtual table at $hex\}, vd = 0, vx = 0, Virtual table at $hex\}, ve = 27, vx = 28, Virtual table at $hex\}$nl$gdb_prompt $" { + pass "print g_vE (aCC)" + } + -re ".* = \{\<class vD\> = \{\<class vB\> = \{\<class vA\> = \{va = 0, vx = 0\}, vb = 0, vx = 0, __vfp = $hex\}, \<class vC\> = \{vc = 0, vx = 0, __vfp = $hex\}, vd = 0, vx = 0, __vfp = $hex\}, ve = 27, vx = 28, __vfp = $hex\}$nl$gdb_prompt $" { + pass "print g_vE (aCC)" + } + -re ".* = \{\<vD\> = \{\<vB\> = \{\<vA\> = \{va = 0, vx = 0\}, _vb\[\\\$\.\]vA = $hex, vb = 0, vx = 0\}, \<vC\> = \{_vb\[\\\$\.\]vA = $hex, vc = 0, vx = 0\}, _vb\[\\\$\.\]vC = $hex, _vb\[\\\$\.\]vB = $hex, vd = 0, vx = 0\}, _vb\[\\\$\.\]vD = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { + pass "print g_vE" + } + -re ".*$gdb_prompt $" { fail "print g_vE" } + timeout { fail "print g_vE (timeout)" } + } } proc do_tests {} { diff --git a/gdb/testsuite/gdb.c++/local.exp b/gdb/testsuite/gdb.c++/local.exp index 0aa8468..0335796 100644 --- a/gdb/testsuite/gdb.c++/local.exp +++ b/gdb/testsuite/gdb.c++/local.exp @@ -41,6 +41,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 "c++"] { + return -1 +} gdb_exit gdb_start @@ -71,38 +74,72 @@ send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" timeout { fail "(timeout) continue to marker1" } } +# srikanth, These tests have always been run only with aCC. Now in +# the new scheme of things, we run it twice, once with aCC, and once +# with g++. Flag these tests as expected failures when run with g++. +# as these are failing now and were never known to pass with g++. +global gcc_compiled +if {$gcc_compiled} then { +setup_xfail "*-*-*" +} + send_gdb "ptype Local\n" gdb_expect { - -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*.char loc_foo\\(char\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:10\\).*$gdb_prompt $" { pass "ptype Local" } - -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*.char loc_foo\\(char\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype Local (incorrect line number?)" } + -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*.char loc_foo\\(char\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:10\\).*$gdb_prompt $" { pass "ptype Local" } + -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*.char loc_foo\\(char\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype Local (incorrect line number?)" } + -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*Local & Local::operator=\\(foobar__Fi___0::Local const &\\);\r\n\[\t \]*Local::Local\\(foobar__Fi___0::Local const &\\);\r\n\[\t \]*Local::Local\\(void\\);\r\n\[\t \]*char Local::loc_foo\\(char\\);\r\n\[\t \]*\}*.*$gdb_prompt $" { pass "ptype Local" } + -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*Local & Local const &\\);\r\n\[\t \]*Local const &\\);\r\n\[\t \]*Local\\(void\\);\r\n\[\t \]*char loc_foo\\(char\\);\r\n\[\t \]*\}\[\t \]*.*$gdb_prompt $" { pass "ptype Local" } + -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*char loc_foo\\(char\\);\r\n\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\)\r\n\}.*$gdb_prompt $" { pass "ptype Local (aCC)" } -re ".*$gdb_prompt $" { fail "ptype Local" } timeout { fail "(timeout) ptype Local" } } +# DTS CLLbs14316 and CLLbs17058 +# coulter - I added a clause for HP's aCC compiler. We print out the type +# as xx instead of const unsigned char, but we still have an expected failure +# because of two reasons: +# There is a number at the end of InnerLocal4 which should not be there, +# DTS CLLbs14316 +# The line number for the class +setup_xfail "hppa*-*-*" CLLbs14316 send_gdb "ptype InnerLocal\n" gdb_expect { - -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(const unsigned char &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:36\\).*$gdb_prompt $" { pass "ptype InnerLocal" } - -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*class InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(const unsigned char &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:36\\).*$gdb_prompt $" { pass "ptype InnerLocal" } - -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(const unsigned char &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype InnerLocal (incorrect line number?" } - -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*class InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(const unsigned char &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype InnerLocal (incorrect line number?" } + -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(const unsigned char &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:36\\).*$gdb_prompt $" { pass "ptype InnerLocal" } + -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*class InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(const unsigned char &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:36\\).*$gdb_prompt $" { pass "ptype InnerLocal" } + -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(const unsigned char &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype InnerLocal (incorrect line number?" } + -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*class InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(const unsigned char &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype InnerLocal (incorrect line number?" } + -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:36\\).*$gdb_prompt $" { pass "ptype InnerLocal HP aCC" } + -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*NestedInnerLocal nest1;\r\n\r\n\[\t \]*InnerLocal & InnerLocal::operator=\\(main___0::InnerLocal const &\\);\r\n\[\t \]*InnerLocal::InnerLocal\\(main___0::InnerLocal const &\\);\r\n\[\t \]*InnerLocal::InnerLocal\\(void\\);\r\n\[\t \]*int InnerLocal::il_foo\\(unsigned char const &\\);\r\n\*\}\r\n*.*$gdb_prompt $" { pass "ptype InnerLocal" } + -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*NestedInnerLocal nest1;\r\n\r\n\[\t \]*InnerLocal & InnerLocal const &\\);\r\n\[\t \]*InnerLocal const &\\);\r\n\[\t \]*InnerLocal\\(void\\);\r\n\[\t \]*.int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\}\[\t \]*.*$gdb_prompt $" { pass "ptype InnerLocal" } + -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*class InnerLocal4::NestedInnerLocal nest1;\r\n\r\n\[\t \]*int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\\(Local at.*local\.cc:\[0-9\]+\\)\r\n\}.*$gdb_prompt $" { pass "ptype InnerLocal (aCC)" } -re ".*$gdb_prompt $" { fail "ptype InnerLocal" } timeout { fail "(timeout) ptype InnerLocal" } } +if {$gcc_compiled} then { +setup_xfail "*-*-*" +} + send_gdb "ptype NestedInnerLocal\n" gdb_expect { - -re "type = class InnerLocal::NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*.int nil_foo\\(int\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:44\\).*$gdb_prompt $" { pass "ptype NestedInnerLocal" } - -re "type = class InnerLocal::NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*.int nil_foo\\(int\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype NestedInnerLocal (incorrect line number?)" } + -re "type = class InnerLocal::NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*.int nil_foo\\(int\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:44\\).*$gdb_prompt $" { pass "ptype NestedInnerLocal" } + -re "type = class InnerLocal::NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*.int nil_foo\\(int\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype NestedInnerLocal (incorrect line number?)" } + -re "type = class NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*NestedInnerLocal & InnerLocal::NestedInnerLocal::operator=\\(main___1::InnerLocal::NestedInnerLocal const &\\);\r\n\[\t \]*InnerLocal::NestedInnerLocal::NestedInnerLocal\\(main___1::InnerLocal::NestedInnerLocal const &\\);\r\n\[\t \]*InnerLocal::NestedInnerLocal::NestedInnerLocal\\(void\\);\r\n\[\t \]*int InnerLocal::NestedInnerLocal::nil_foo\\(int\\);\r\n\}\r\n*.*$gdb_prompt $" { pass "ptype NestedInnerLocal" } + -re "type = class NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*NestedInnerLocal & NestedInnerLocal const &\\);\r\n\[\t \]*NestedInnerLocal const &\\);\r\n\[\t \]*NestedInnerLocal\\(void\\);\r\n\[\t \]*int nil_foo\\(int\\);\r\n\[\t \]*\}\r\n*.*$gdb_prompt $" { pass "ptype NestedInnerLocal" } -re "No symbol.*in current context.*$gdb_prompt $" { pass "ptype NestedInnerLocal (known aCC limitation)" } -re ".*$gdb_prompt $" { fail "ptype NestedInnerLocal" } timeout { fail "(timeout) ptype NestedInnerLocal" } } +# gdb incorrectly interprets the NestedInnerLocal in +# InnerLocal::NestedInnerLocal as field name instead of a type name; +# See CLLbs14784. +setup_xfail hppa*-*-* CLLbs14784 send_gdb "ptype InnerLocal::NestedInnerLocal\n" gdb_expect { - -re "type = class InnerLocal::NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*.int nil_foo\\(int\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:44\\).*$gdb_prompt $" { pass "ptype InnerLocal::NestedInnerLocal" } - -re "type = class InnerLocal::NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*.int nil_foo\\(int\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype InnerLocal::NestedInnerLocal (incorrect line number?)" } + -re "type = class InnerLocal::NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*.int nil_foo\\(int\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:44\\).*$gdb_prompt $" { pass "ptype InnerLocal::NestedInnerLocal" } + -re "type = class InnerLocal::NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*.int nil_foo\\(int\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype InnerLocal::NestedInnerLocal (incorrect line number?)" } -re ".*$gdb_prompt $" { fail "ptype InnerLocal::NestedInnerLocal" } timeout { fail "(timeout) ptype InnerLocal::NestedInnerLocal" } } diff --git a/gdb/testsuite/gdb.c++/member-ptr.exp b/gdb/testsuite/gdb.c++/member-ptr.exp index 9bf2431..d1de663 100644 --- a/gdb/testsuite/gdb.c++/member-ptr.exp +++ b/gdb/testsuite/gdb.c++/member-ptr.exp @@ -103,6 +103,7 @@ gdb_expect { # print pointer to data member +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print pmi\n" gdb_expect { -re "\\$\[0-9\]* = \\(int \\( A::\\*\\)\\) &A::j\r\n$gdb_prompt $" { @@ -115,6 +116,7 @@ gdb_expect { # print dereferenced pointer to data member +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print a.*pmi\n" gdb_expect { -re "\\$\[0-9\]* = 121\r\n$gdb_prompt $" { @@ -127,6 +129,7 @@ gdb_expect { # print dereferenced pointer to data member # this time, dereferenced through a pointer +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print a_p->*pmi\n" gdb_expect { -re "\\$\[0-9\]* = 121\r\n$gdb_prompt $" { @@ -212,6 +215,7 @@ gdb_expect { } # Double-check by printing a. +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print a\n" gdb_expect { -re "\\$\[0-9\]* = \{c = 120 'x', j = 33, jj = 1331, static s = 10, Virtual table at $hex\}\r\n$gdb_prompt $" { @@ -244,6 +248,7 @@ gdb_expect { } # Double-check by printing a. +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print a\n" gdb_expect { -re "\\$\[0-9\]* = \{c = 120 'x', j = 44, jj = 1331, static s = 10, Virtual table at $hex\}\r\n$gdb_prompt $" { @@ -290,6 +295,7 @@ gdb_expect { # Ptype a pointer to a method. +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "ptype pmf\n" gdb_expect { -re "type = int \\( A::\\*\\)\\(\\.\\.\\.\\)\r\n$gdb_prompt $" { @@ -301,6 +307,7 @@ gdb_expect { # print a pointer to a method +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print pmf\n" gdb_expect { -re "\\$\[0-9\]* = \\(int \\( A::\\*\\)\\(\\.\\.\\.\\)\\) \\?\\? <not supported with HP aCC>\r\n$gdb_prompt $" { @@ -313,6 +320,7 @@ gdb_expect { # Ptype a pointer to a pointer to a method +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "ptype pmf_p\n" gdb_expect { -re "type = int \\( A::\\*\\*\\)\\(\\.\\.\\.\\)\r\n$gdb_prompt $" { @@ -324,6 +332,7 @@ gdb_expect { # print a pointer to a pointer to a method +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print pmf_p\n" gdb_expect { -re "\\$\[0-9\]* = \\(int \\( A::\\*\\*\\)\\(\\.\\.\\.\\)\\) $hex\r\n$gdb_prompt $" { @@ -335,39 +344,43 @@ gdb_expect { # print dereferenced pointer to method +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print a.*pmf\n" gdb_expect { -re "Pointers to methods not supported with HP aCC\r\n$gdb_prompt $" { pass "print a.*pmf (known aCC limitation)" } - -re ".*$gdb_prompt $" { fail "print a.*pmf -- ??" } + -re ".*$gdb_prompt $" { fail "print a.*pmf" } timeout { fail "(timeout) print a.*pmf" } } # print dereferenced pointer to method, using ->* +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print a_p->*pmf\n" gdb_expect { -re "Pointers to methods not supported with HP aCC\r\n$gdb_prompt $" { pass "print a_p->*pmf (known aCC limitation)" } - -re ".*$gdb_prompt $" { fail "print a_p->*pmf -- ??" } + -re ".*$gdb_prompt $" { fail "print a_p->*pmf" } timeout { fail "(timeout) print a_p->*pmf" } } # set the pointer to data member +setup_xfail "hppa*-*-*" send_gdb "set var pmf = &A::foo\n" gdb_expect { -re "Assignment to pointers to methods not implemented with HP aCC\r\n$gdb_prompt $" { pass "set var pmf (known aCC limitation)" } - -re ".*$gdb_prompt $" { fail "set var pmf -- ??" } + -re ".*$gdb_prompt $" { fail "set var pmf" } timeout { fail "(timeout) set var pmf" } } # Try to dereference the pointer to method without any object +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print *pmf\n" gdb_expect { -re "Attempt to dereference pointer to member without an object\r\n$gdb_prompt $" { @@ -389,6 +402,7 @@ gdb_expect { } # Check cast of pointer to member to integer +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print (int) pmi\n" gdb_expect { -re "\\$\[0-9\]* = 8\r\n$gdb_prompt $" { @@ -399,37 +413,41 @@ gdb_expect { } # Check cast of pointer to method to integer +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print (int) pmf\n" gdb_expect { -re "Pointers to methods not supported with HP aCC\r\n$gdb_prompt $" { pass "casting pmf to int (known aCC limitation)" } - -re ".*$gdb_prompt $" { fail "casting pmf to int -- ??" } + -re ".*$gdb_prompt $" { fail "casting pmf to int" } timeout { fail "(timeout) casting pmf to int" } } # Try to invoke a function through a pointer to data member +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print (a.*pmi)(3)\n" gdb_expect { -re "Not implemented: function invocation through pointer to method with HP aCC\r\n$gdb_prompt $" { pass "print (a.*pmi)(3) -- error message should be different" } - -re ".*$gdb_prompt $" { fail "print (a.*pmi)(3) -- ???" } + -re ".*$gdb_prompt $" { fail "print (a.*pmi)(3)" } timeout { fail "(timeout) print (a.*pmi)(3)" } } # Try to invoke a function through a pointer to a method +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print (a.*pmf)(3)\n" gdb_expect { -re "Not implemented: function invocation through pointer to method with HP aCC\r\n$gdb_prompt $" { pass "print (a.*pmi)(3) -- known aCC limitation" } - -re ".*$gdb_prompt $" { fail "print (a.*pmf)(3) -- ???" } + -re ".*$gdb_prompt $" { fail "print (a.*pmf)(3)" } timeout { fail "(timeout) print (a.*pmf)(3)" } } # Go past assignment of NULL to pmi +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "next\n" gdb_expect { -re "\r\n85\[ \t\]*k = \\(a.\\*pmf\\)\\(3\\);\r\n$gdb_prompt $" { @@ -449,6 +467,7 @@ gdb_expect { #} # Dereference the null pointer to member +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print a.*pmi\n" gdb_expect { -re "Attempted dereference of null pointer-to-member\r\n$gdb_prompt $" { @@ -469,6 +488,7 @@ gdb_expect { timeout { fail "(timeout) set break at 91" } } +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "continue\n" gdb_expect { -re "Continuing\\.\r\n\r\nBreakpoint.*at.*member-ptr\\.cc:91\r\n91\[ \t]*k = \\(a.\\*pmf\\)\\(4\\);\r\n$gdb_prompt $" { @@ -482,6 +502,7 @@ gdb_expect { # Now check again that pmi works even when not set to # something that's at the beginning of the object +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print pmi\n" gdb_expect { -re "\\$\[0-9\]* = \\(int \\( A::\\*\\)\\) &A::jj\r\n$gdb_prompt $" { @@ -494,6 +515,7 @@ gdb_expect { # print dereferenced pointer to data member +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print a.*pmi\n" gdb_expect { -re "\\$\[0-9\]* = 1331\r\n$gdb_prompt $" { @@ -506,6 +528,7 @@ gdb_expect { # print dereferenced pointer to data member # this time, dereferenced through a pointer +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "print a_p->*pmi\n" gdb_expect { -re "\\$\[0-9\]* = 1331\r\n$gdb_prompt $" { diff --git a/gdb/testsuite/gdb.c++/method.exp b/gdb/testsuite/gdb.c++/method.exp index edfa689..a0d005b 100644 --- a/gdb/testsuite/gdb.c++/method.exp +++ b/gdb/testsuite/gdb.c++/method.exp @@ -50,7 +50,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 "c++"] { + return -1 +} gdb_exit gdb_start @@ -143,7 +145,20 @@ gdb_expect { send_gdb "print this\n" gdb_expect { -re "\\$\[0-9\]* = \\(const class A \\*\\) $hex\r\n$gdb_prompt $" { + global gcc_compiled + if {$gcc_compiled} { + xfail "print this (in bar)" + } else { + pass "print this (in bar)" + } + } + -re "\\$\[0-9\]* = \\(A \\*\\) $hex\r\n$gdb_prompt $" { + global gcc_compiled + if {$gcc_compiled} { pass "print this (in bar)" + } else { + xfail "print this (in bar)" + } } -re ".*$gdb_prompt $" { fail "print this (in bar)" } timeout { fail "(timeout) print this (in bar)" } @@ -209,7 +224,7 @@ gdb_expect { send_gdb "ptype A\n" gdb_expect { - -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\\[ \]*A & operator=\\(A const &\\);\r\n\[ \]*A\\(A const &\\)\r\n\[ \]*A\\(void\\)\r\n[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\) volatile;\r\n\[ \]*int qux\\(int, float\\) const volatile;\r\n\}\r\n$gdb_prompt $" { + -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*A & operator=\\(A const &\\);\r\n\[ \]*A\\(A const &\\);\r\n\[ \]*A\\(void\\);\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\) volatile;\r\n\[ \]*int qux\\(int, float\\) const volatile;\r\n\}\r\n$gdb_prompt $" { pass "ptype A" } -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\);\r\n\[ \]*int qux\\(int, float\\) const;\r\n\}\r\n$gdb_prompt $" { diff --git a/gdb/testsuite/gdb.c++/misc.cc b/gdb/testsuite/gdb.c++/misc.cc index 4cf9318..7c212cc 100644 --- a/gdb/testsuite/gdb.c++/misc.cc +++ b/gdb/testsuite/gdb.c++/misc.cc @@ -1,5 +1,9 @@ // Test various -*- C++ -*- things. +// ====================== basic C++ types ======================= +bool v_bool; +bool v_bool_array[2]; + typedef struct fleep fleep; struct fleep { int a; } s; @@ -477,6 +481,14 @@ register_class () return v.x + 5; } +void dummy() +{ + v_bool = true; + v_bool_array[0] = false; + v_bool_array[1] = v_bool; +} + + int main() { @@ -484,6 +496,7 @@ main() set_debug_traps(); breakpoint(); #endif + dummy(); inheritance1 (); inheritance3 (); register_class (); diff --git a/gdb/testsuite/gdb.c++/misc.exp b/gdb/testsuite/gdb.c++/misc.exp index 6090fbb..7d64e4a 100644 --- a/gdb/testsuite/gdb.c++/misc.exp +++ b/gdb/testsuite/gdb.c++/misc.exp @@ -79,6 +79,23 @@ proc deduce_language_of_main {} { } } +proc test_expr { args } { + if { [llength $args] % 2 } { + warning "an even # of arguments should be passed to test_expr" + } + set last_ent [expr [llength $args] - 1]; + set testname [lindex $args $last_ent]; + if [gdb_test [lindex $args 0] "" "$testname (setup)"] { + gdb_suppress_tests; + } + for {set x 1} {$x < $last_ent} {set x [expr $x + 2]} { + if [gdb_test [lindex $args $x] [lindex $args [expr $x + 1]] "$testname ([lindex $args $x])"] { + gdb_suppress_tests; + } + } + gdb_stop_suppressing_tests; +} + proc do_tests {} { global prms_id global bug_id @@ -104,3 +121,41 @@ proc do_tests {} { } do_tests + +test_expr "set language c++" \ + "print 1 == 1" "print.*\\$\[0-9\]* = true" \ + "print 1 == 2" "print.*\\$\[0-9\]* = false" \ + "print as bool" + +# Test bool type printing, etc. +# Note: Language is already set to C++ above! +gdb_test "print v_bool" "\\$\[0-9\]* = false" "print a bool var" + +# set a bool variable +test_expr "set variable v_bool = true" \ + "print v_bool" "\\$\[0-9\]* = true" \ + "set a bool var" + +# next print an array of bool +gdb_test "print v_bool_array" "\\$\[0-9\]* = \\{false, false\\}" "print a bool array" + +# set elements of a bool array +test_expr "set variable v_bool_array\[1\] = true" \ + "print v_bool_array" "\\$\[0-9\]* = \\{false, true\\}" \ + "set a bool array elem" + +# bool constants +gdb_test "print true" "\\$\[0-9\]* = true" "print true" +gdb_test "print false" "\\$\[0-9\]* = false" "print false" + +# arithmetic conversions +gdb_test "print 1 + true" "\\$\[0-9\]* = 2" "1 + true" +gdb_test "print 3 + false" "\\$\[0-9\]* = 3" "3 + false" +gdb_test "print 1 < 2 < 3" "\\$\[0-9\]* = true" "1 < 2 < 3" +gdb_test "print 2 < 1 > 4" "\\$\[0-9\]* = false" "2 < 1 > 4" +gdb_test "print (bool)43" "\\$\[0-9\]* = true" "(bool)43" +gdb_test "print (bool)0" "\\$\[0-9\]* = false" "(bool)0" +gdb_test "print (bool)17.93" "\\$\[0-9\]* = true" "(bool)17.93" +gdb_test "print (bool)0.0" "\\$\[0-9\]* = false" "(bool)0.0" +gdb_test "print (int)true" "\\$\[0-9\]* = 1" "(int)true" +gdb_test "print (int)false" "\\$\[0-9\]* = 0" "(int)false" diff --git a/gdb/testsuite/gdb.c++/overload.exp b/gdb/testsuite/gdb.c++/overload.exp index e77d2dc..c49d76a 100644 --- a/gdb/testsuite/gdb.c++/overload.exp +++ b/gdb/testsuite/gdb.c++/overload.exp @@ -43,9 +43,6 @@ 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." } -# 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 } @@ -88,6 +85,7 @@ gdb_expect { } +setup_xfail "hppa*-*-*" CLLbs16901 send_gdb "ptype foo_instance1\n" gdb_expect { -re "type = class foo \{.*public:.*int ifoo;.*const char \\*ccpfoo;.*foo\\(int\\);.*foo\\(int, (const char|char const) \\*\\);.*foo\\(foo &\\);.*~foo\\(void\\);.*void foofunc\\(int\\);.*void foofunc\\(int, signed char \\*\\);.*int overload1arg\\(void\\);.*int overload1arg\\(char\\);.*int overload1arg\\(signed char\\);.*int overload1arg\\(unsigned char\\);.*int overload1arg\\(short\\);.*int overload1arg\\(unsigned short\\);.*int overload1arg\\(int\\);.*int overload1arg\\(unsigned int\\);.*int overload1arg\\(long\\);.*int overload1arg\\(unsigned long\\);.*int overload1arg\\(float\\);.*int overload1arg\\(double\\);.*int overloadargs\\(int\\);.*int overloadargs\\(int, int\\);.*int overloadargs\\(int, int, int\\);.*int overloadargs\\(int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int, int, int, int, int\\);\r\n\}\r\n$gdb_prompt $" { @@ -123,8 +121,8 @@ gdb_expect { # work right for G++ output, since the list of parameters seems not to # be filled in correctly. Until this gets fixed, don't expect to pass # these tests. -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overloadargs(1)\n" gdb_expect { -re ".\[0-9\]* = 1\r\n$gdb_prompt $" { @@ -135,7 +133,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overloadargs(1, 2)\n" gdb_expect { @@ -147,7 +145,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overloadargs(1, 2, 3)\n" gdb_expect { @@ -159,7 +157,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4)\n" gdb_expect { @@ -171,7 +169,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5)\n" gdb_expect { @@ -183,7 +181,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6)\n" gdb_expect { @@ -195,7 +193,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7)\n" gdb_expect { @@ -207,7 +205,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8)\n" gdb_expect { @@ -219,7 +217,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9)\n" gdb_expect { @@ -231,7 +229,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\n" gdb_expect { @@ -243,7 +241,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)\n" gdb_expect { @@ -255,7 +253,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overload1arg()\n" gdb_expect { @@ -267,7 +265,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overload1arg((char)arg2)\n" gdb_expect { @@ -279,7 +277,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overload1arg((signed char)arg3)\n" gdb_expect { @@ -291,7 +289,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overload1arg((unsigned char)arg4)\n" gdb_expect { @@ -303,7 +301,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overload1arg((short)arg5)\n" gdb_expect { @@ -315,7 +313,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overload1arg((unsigned short)arg6)\n" gdb_expect { @@ -327,7 +325,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overload1arg((int)arg7)\n" gdb_expect { @@ -339,7 +337,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overload1arg((unsigned int)arg8)\n" gdb_expect { @@ -351,7 +349,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overload1arg((long)arg9)\n" gdb_expect { @@ -363,7 +361,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overload1arg((unsigned long)arg10)\n" gdb_expect { @@ -375,7 +373,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overload1arg((float)arg11)\n" gdb_expect { @@ -387,7 +385,7 @@ gdb_expect { } -if {$gcc_compiled} then { setup_xfail "*-*-*" } +setup_xfail "*-*-*" CLLbs16901 send_gdb "print foo_instance1.overload1arg((double)arg12)\n" gdb_expect { diff --git a/gdb/testsuite/gdb.c++/ref-types.cc b/gdb/testsuite/gdb.c++/ref-types.cc index 8ee5c40..23cc510 100644 --- a/gdb/testsuite/gdb.c++/ref-types.cc +++ b/gdb/testsuite/gdb.c++/ref-types.cc @@ -1,3 +1,5 @@ +int main2(void); + void marker1 (void) { @@ -25,6 +27,53 @@ int main(void) breakpoint(); #endif marker1(); - + + main2(); + + return 0; +} + +int f() +{ + int f1; + f1 = 1; + return f1; +} + +int main2(void) +{ + char C; + unsigned char UC; + short S; + unsigned short US; + int I; + unsigned int UI; + long L; + unsigned long UL; + float F; + double D; + char &rC = C; + unsigned char &rUC = UC; + short &rS = S; + unsigned short &rUS = US; + int &rI = I; + unsigned int &rUI = UI; + long &rL = L; + unsigned long &rUL = UL; + float &rF = F; + double &rD = D; + C = 'A'; + UC = 21; + S = -14; + US = 7; + I = 102; + UI = 1002; + L = -234; + UL = 234; + F = 1.25E10; + D = -1.375E-123; + I = f(); + return 0; + } diff --git a/gdb/testsuite/gdb.c++/ref-types.exp b/gdb/testsuite/gdb.c++/ref-types.exp index 2a9d337..611dc6f 100644 --- a/gdb/testsuite/gdb.c++/ref-types.exp +++ b/gdb/testsuite/gdb.c++/ref-types.exp @@ -276,3 +276,414 @@ gdb_expect { -re ".*$gdb_prompt $" { fail "print value of ras\[3\]" } timeout { fail "(timeout) print value of ras\[3\]" } } + + +send_gdb "break f\n" ; gdb_expect -re ".*$gdb_prompt $" + + send_gdb "cont\n" + gdb_expect { + -re "Break.* f \\(\\) at .*:$decimal.*$gdb_prompt $" { + send_gdb "up\n" + gdb_expect { + -re ".*$gdb_prompt $" {} + timeout { fail "up from f" } + } + } + -re "$gdb_prompt $" { fail "continue to f" } + timeout { fail "(timeout) continue to f" } + } + + +send_gdb "print C\n" +gdb_expect { + -re ".\[0-9\]* = 65 \'A\'.*$gdb_prompt $" { + pass "print value of C" + } + -re ".*$gdb_prompt $" { fail "print value of C" } + timeout { fail "(timeout) print value of C" } + } + + +send_gdb "ptype C\n" +gdb_expect { + -re "type = char.*$gdb_prompt $" { pass "ptype C" } + -re ".*$gdb_prompt $" { fail "ptype C" } + timeout { fail "(timeout) ptype C" } +} + + +send_gdb "print UC\n" +gdb_expect { + -re ".\[0-9\]* = 21 '\.025'\.*$gdb_prompt $" { + pass "print value of UC" + } + -re ".*$gdb_prompt $" { fail "print value of UC" } + timeout { fail "(timeout) print value of UC" } + } + + +send_gdb "ptype UC\n" +gdb_expect { + -re "type = unsigned char.*$gdb_prompt $" { pass "ptype UC" } + -re ".*$gdb_prompt $" { fail "ptype UC" } + timeout { fail "(timeout) ptype UC" } +} + + +send_gdb "print S\n" +gdb_expect { + -re ".\[0-9\]* = -14.*$gdb_prompt $" { + pass "print value of S" + } + -re ".*$gdb_prompt $" { fail "print value of S" } + timeout { fail "(timeout) print value of S" } + } + + +send_gdb "ptype S\n" +gdb_expect { + -re "type = short.*$gdb_prompt $" { pass "ptype S" } + -re ".*$gdb_prompt $" { fail "ptype S" } + timeout { fail "(timeout) ptype S" } +} + + +send_gdb "print US\n" +gdb_expect { + -re ".\[0-9\]* = 7.*$gdb_prompt $" { + pass "print value of US" + } + -re ".*$gdb_prompt $" { fail "print value of US" } + timeout { fail "(timeout) print value of US" } + } + + +send_gdb "ptype US\n" +gdb_expect { + -re "type = unsigned short.*$gdb_prompt $" { pass "ptype US" } + -re "type = short unsigned.*$gdb_prompt $" { pass "ptype US" } + -re ".*$gdb_prompt $" { fail "ptype US" } + timeout { fail "(timeout) ptype US" } +} + + +send_gdb "print I\n" +gdb_expect { + -re ".\[0-9\]* = 102.*$gdb_prompt $" { + pass "print value of I" + } + -re ".*$gdb_prompt $" { fail "print value of I" } + timeout { fail "(timeout) print value of I" } + } + + +send_gdb "ptype I\n" +gdb_expect { + -re "type = int.*$gdb_prompt $" { pass "ptype I" } + -re ".*$gdb_prompt $" { fail "ptype I" } + timeout { fail "(timeout) ptype I" } +} + + +send_gdb "print UI\n" +gdb_expect { + -re ".\[0-9\]* = 1002.*$gdb_prompt $" { + pass "print value of UI" + } + -re ".*$gdb_prompt $" { fail "print value of UI" } + timeout { fail "(timeout) print value of UI" } + } + + +send_gdb "ptype UI\n" +gdb_expect { + -re "type = unsigned int.*$gdb_prompt $" { pass "ptype UI" } + -re ".*$gdb_prompt $" { fail "ptype UI" } + timeout { fail "(timeout) ptype UI" } +} + + +send_gdb "print L\n" +gdb_expect { + -re ".\[0-9\]* = -234.*$gdb_prompt $" { + pass "print value of L" + } + -re ".*$gdb_prompt $" { fail "print value of L" } + timeout { fail "(timeout) print value of L" } + } + + +send_gdb "ptype L\n" +gdb_expect { + -re "type = long.*$gdb_prompt $" { pass "ptype L" } + -re ".*$gdb_prompt $" { fail "ptype L" } + timeout { fail "(timeout) ptype L" } +} + + +send_gdb "print UL\n" +gdb_expect { + -re ".\[0-9\]* = 234.*$gdb_prompt $" { + pass "print value of UL" + } + -re ".*$gdb_prompt $" { fail "print value of UL" } + timeout { fail "(timeout) print value of UL" } + } + + +send_gdb "ptype UL\n" +gdb_expect { + -re "type = unsigned long.*$gdb_prompt $" { pass "ptype UL" } + -re "type = long unsigned.*$gdb_prompt $" { pass "ptype UL" } + -re ".*$gdb_prompt $" { fail "ptype UL" } + timeout { fail "(timeout) ptype UL" } +} + + +send_gdb "print F\n" +gdb_expect { + -re ".\[0-9\]* = 1.2\[0-9\]*e\\+10.*$gdb_prompt $" { + pass "print value of F" + } + -re ".*$gdb_prompt $" { fail "print value of F" } + timeout { fail "(timeout) print value of F" } + } + + + +send_gdb "ptype F\n" +gdb_expect { + -re "type = float.*$gdb_prompt $" { pass "ptype F" } + -re ".*$gdb_prompt $" { fail "ptype F" } + timeout { fail "(timeout) ptype F" } +} + + +send_gdb "print D\n" +gdb_expect { + -re ".\[0-9\]* = -1.375e-123.*$gdb_prompt $" { + pass "print value of D" + } + -re ".*$gdb_prompt $" { fail "print value of D" } + timeout { fail "(timeout) print value of D" } + } + + +send_gdb "ptype D\n" +gdb_expect { + -re "type = double.*$gdb_prompt $" { pass "ptype D" } + -re ".*$gdb_prompt $" { fail "ptype D" } + timeout { fail "(timeout) ptype D" } +} + + + +# +# test reference types +# + + + + +send_gdb "ptype rC\n" +gdb_expect { + -re "type = char &.*$gdb_prompt $" { pass "ptype rC" } + -re ".*$gdb_prompt $" { fail "ptype rC" } + timeout { fail "(timeout) ptype rC" } +} + + + + +send_gdb "ptype rUC\n" +gdb_expect { + -re "type = unsigned char &.*$gdb_prompt $" { pass "ptype rUC" } + -re ".*$gdb_prompt $" { fail "ptype rUC" } + timeout { fail "(timeout) ptype rUC" } +} + + + +send_gdb "ptype rS\n" +gdb_expect { + -re "type = short &.*$gdb_prompt $" { pass "ptype rS" } + -re "type = short int &.*$gdb_prompt $" { pass "ptype rS" } + -re ".*$gdb_prompt $" { fail "ptype rS" } + timeout { fail "(timeout) ptype rS" } +} + + + +send_gdb "ptype rUS\n" +gdb_expect { + -re "type = unsigned short &.*$gdb_prompt $" { pass "ptype rUS" } + -re "type = short unsigned int &.*$gdb_prompt $" { pass "ptype rUS" } + -re ".*$gdb_prompt $" { fail "ptype rUS" } + timeout { fail "(timeout) ptype rUS" } +} + + +send_gdb "ptype rI\n" +gdb_expect { + -re "type = int &.*$gdb_prompt $" { pass "ptype rI" } + -re ".*$gdb_prompt $" { fail "ptype rI" } + timeout { fail "(timeout) ptype rI" } +} + + + +send_gdb "ptype rUI\n" +gdb_expect { + -re "type = unsigned int &.*$gdb_prompt $" { pass "ptype rUI" } + -re ".*$gdb_prompt $" { fail "ptype rUI" } + timeout { fail "(timeout) ptype rUI" } +} + + + +send_gdb "ptype rL\n" +gdb_expect { + -re "type = long &.*$gdb_prompt $" { pass "ptype rL" } + -re "type = long int &.*$gdb_prompt $" { pass "ptype rL" } + -re ".*$gdb_prompt $" { fail "ptype rL" } + timeout { fail "(timeout) ptype rL" } +} + + +send_gdb "ptype rUL\n" +gdb_expect { + -re "type = unsigned long &.*$gdb_prompt $" { pass "ptype rUL" } + -re "type = long unsigned int &.*$gdb_prompt $" { pass "ptype rUL" } + -re ".*$gdb_prompt $" { fail "ptype rUL" } + timeout { fail "(timeout) ptype rUL" } +} + + +send_gdb "ptype rF\n" +gdb_expect { + -re "type = float &.*$gdb_prompt $" { pass "ptype rF" } + -re ".*$gdb_prompt $" { fail "ptype rF" } + timeout { fail "(timeout) ptype rF" } +} + + +send_gdb "ptype rD\n" +gdb_expect { + -re "type = double &.*$gdb_prompt $" { pass "ptype rD" } + -re ".*$gdb_prompt $" { fail "ptype rD" } + timeout { fail "(timeout) ptype rD" } +} + + +send_gdb "print rC\n" +gdb_expect { + -re ".\[0-9\]* = \\(char &\\) @$hex: 65 \'A\'.*$gdb_prompt $" { + pass "print value of rC" + } + -re ".*$gdb_prompt $" { fail "print value of rC" } + timeout { fail "(timeout) print value of rC" } + } + + +send_gdb "print rUC\n" +gdb_expect { + -re ".\[0-9\]* = \\(unsigned char &\\) @$hex: 21 \'.025\'.*$gdb_prompt $" { + pass "print value of rUC" + } + -re ".*$gdb_prompt $" { fail "print value of rUC" } + timeout { fail "(timeout) print value of rUC" } + } + + +send_gdb "print rS\n" +gdb_expect { + -re ".\[0-9\]* = \\(short &\\) @$hex: -14.*$gdb_prompt $" { + pass "print value of rS" + } + -re ".\[0-9\]* = \\(short int &\\) @$hex: -14.*$gdb_prompt $" { + pass "print value of rS" + } + -re ".*$gdb_prompt $" { fail "print value of rS" } + timeout { fail "(timeout) print value of rS" } + } + + +send_gdb "print rUS\n" +gdb_expect { + -re ".\[0-9\]* = \\(unsigned short &\\) @$hex: 7.*$gdb_prompt $" { + pass "print value of rUS" + } + -re ".\[0-9\]* = \\(short unsigned int &\\) @$hex: 7.*$gdb_prompt $" { + pass "print value of rUS" + } + -re ".*$gdb_prompt $" { fail "print value of rUS" } + timeout { fail "(timeout) print value of rUS" } + } + + +send_gdb "print rI\n" +gdb_expect { + -re ".\[0-9\]* = \\(int &\\) @$hex: 102.*$gdb_prompt $" { + pass "print value of rI" + } + -re ".*$gdb_prompt $" { fail "print value of rI" } + timeout { fail "(timeout) print value of rI" } + } + + +send_gdb "print rUI\n" +gdb_expect { + -re ".\[0-9\]* = \\(unsigned int &\\) @$hex: 1002.*$gdb_prompt $" { + pass "print value of UI" + } + -re ".*$gdb_prompt $" { fail "print value of rUI" } + timeout { fail "(timeout) print value of rUI" } + } + + +send_gdb "print rL\n" +gdb_expect { + -re ".\[0-9\]* = \\(long &\\) @$hex: -234.*$gdb_prompt $" { + pass "print value of rL" + } + -re ".\[0-9\]* = \\(long int &\\) @$hex: -234.*$gdb_prompt $" { + pass "print value of rL" + } + -re ".*$gdb_prompt $" { fail "print value of rL" } + timeout { fail "(timeout) print value of rL" } + } + + + +send_gdb "print rUL\n" +gdb_expect { + -re ".\[0-9\]* = \\(unsigned long &\\) @$hex: 234.*$gdb_prompt $" { + pass "print value of rUL" + } + -re ".\[0-9\]* = \\(long unsigned int &\\) @$hex: 234.*$gdb_prompt $" { + pass "print value of rUL" + } + -re ".*$gdb_prompt $" { fail "print value of rUL" } + timeout { fail "(timeout) print value of rUL" } + } + + +send_gdb "print rF\n" +gdb_expect { + -re ".\[0-9\]* = \\(float &\\) @$hex: 1.2\[0-9\]*e\\+10.*$gdb_prompt $" { + pass "print value of rF" + } + -re ".*$gdb_prompt $" { fail "print value of rF" } + timeout { fail "(timeout) print value of rF" } + } + + +send_gdb "print rD\n" +gdb_expect { + -re ".\[0-9\]* = \\(double &\\) @$hex: -1.375e-123.*$gdb_prompt $" { + pass "print value of rD" + } + -re ".*$gdb_prompt $" { fail "print value of rD" } + timeout { fail "(timeout) print value of rD" } + } + diff --git a/gdb/testsuite/gdb.c++/templates.cc b/gdb/testsuite/gdb.c++/templates.cc index 470024c..e1d6810 100644 --- a/gdb/testsuite/gdb.c++/templates.cc +++ b/gdb/testsuite/gdb.c++/templates.cc @@ -516,7 +516,7 @@ public: int (*manage[5])(double, void *(*malloc)(unsigned size), void (*free)(void *pointer)); - int (*device[5])(int open(const char *, unsigned mode, unsigned perms, int extra = 0), + int (*device[5])(int open(const char *, unsigned mode, unsigned perms, int extra), int *(*read)(int fd, void *place, unsigned size), int *(*write)(int fd, void *place, unsigned size), void (*close)(int fd)); @@ -716,7 +716,7 @@ int main() Foo<int> fint; Foo<char> fchar; - Foo<volatile char *> fvpchar; + Foo<volatile char *> fvpchar = {0, 0}; Bar<int, 33> bint; Bar<int, (4 > 3)> bint2; diff --git a/gdb/testsuite/gdb.c++/templates.exp b/gdb/testsuite/gdb.c++/templates.exp index ee25eaa..6c643b1 100644 --- a/gdb/testsuite/gdb.c++/templates.exp +++ b/gdb/testsuite/gdb.c++/templates.exp @@ -36,20 +36,10 @@ if [get_compiler_info ${binfile} "c++"] { } source ${binfile}.ci -# 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 c++}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } -source ${binfile}.ci - # # Test printing of the types of templates. # @@ -63,6 +53,8 @@ proc test_ptype_of_templates {} { -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}T5\\<int> & operator=\\(T5<int> const &\\);${ws}T5\\(int\\);${ws}T5\\(T5<int> const &\\);${ws}~T5\\(void\\);${ws}static void \\* operator new\\(unsigned (int|long)\\);${ws}static void operator delete\\(void \\*\\);${ws}int value\\(void\\);${ws}\}\r\n$gdb_prompt $" { pass "ptype T5<int>" } + -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}${ws}T5 \\(int\\);${ws}T5 \\(const class T5<int> &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned int\\);${ws}static void delete \\(void \\*\\);${ws}int value \\(void\\);${ws}\\}${ws}$gdb_prompt $" { pass "ptype T5<int> -- new with unsigned int" } + -re "type = class T5<int> \\{.*public:.*static int X;.*int x;.*int val;.*T5 \\(int\\);.*T5 \\(const class T5<int> &\\);.*void ~T5 \\(int\\);.*static void \\* new \\(unsigned long\\);.*static void delete \\(void \\*\\);.*int value \\(void\\);.*\\}\r\n$gdb_prompt $" { pass "ptype T5<int> -- new with unsigned long" } -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;((${ws}T5\\<int> & operator=\\(T5<int> const &\\);)|(${ws}T5\\(int\\);)|(${ws}T5\\(T5<int> const &\\);)|(${ws}~T5\\(void\\);)|(${ws}static void \\* operator new\\(unsigned (int|long)\\);)|(${ws}static void operator delete\\(void \\*\\);)|(${ws}int value\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { pass "ptype T5<int> (obsolescent gcc or gdb)" } @@ -76,6 +68,12 @@ proc test_ptype_of_templates {} { send_gdb "ptype t5i\n" gdb_expect { + -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5\\(int\\);${ws}T5\\(T5<int> const &\\);${ws}~T5\\(void\\);${ws}static void \\* operator new\\(unsigned int\\);${ws}static void operator delete\\(void \\*\\);${ws}int value\\(void\\);${ws}\\}\r\n$gdb_prompt $" { pass "ptype T5<int> -- with several fixes from 4.17" } + -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5 \\(int\\);${ws}T5 \\(const class T5<int> &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned int\\);${ws}static void delete \\(void \\*\\);${ws}int value \\(void\\);${ws}\\}\r\n$gdb_prompt $" { pass "ptype t5i<int> -- new with unsigned int" } + -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5 \\(int\\);${ws}T5 \\(const class T5<int> &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned long\\);${ws}static void delete \\(void \\*\\);${ws}int value \\(void\\);${ws}\\}\r\n$gdb_prompt $" { pass "ptype t5i<int> -- new with unsigned long" } + -re "type = class T5<int> \{.*public:.*static int X;.*int x;.*int val;.*.*T5 \\(int\\);.*.*void ~T5 \\(int\\).*.*.*int value \\(void\\);.*\}.*$gdb_prompt $" { + pass "ptype t5i" + } -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}T5<int> & operator=\\(T5<int> const &\\);${ws}T5\\(int\\);${ws}T5\\(T5<int> const &\\);${ws}~T5\\(void\\);${ws}static void \\* operator new\\(unsigned (int|long)\\);${ws}static void operator delete\\(void \\*\\);${ws}int value\\(void\\);${ws}\}\r\n$gdb_prompt $" { pass "ptype t5i" } @@ -99,6 +97,7 @@ proc test_template_breakpoints {} { global gdb_prompt global testfile global srcdir + global hp_aCC_compiler send_gdb "break T5<int>::T5\n" gdb_expect { @@ -116,7 +115,9 @@ proc test_template_breakpoints {} { default { fail "constructor breakpoint (timeout)" } } - gdb_test "break T5<int>::~T5" \ +# See CLLbs14792 + if {$hp_aCC_compiler} {setup_xfail hppa*-*-* CLLbs14792} + gdb_test "break T5<int>::~T5" \ "Breakpoint.*at.* file .*${testfile}.cc, line.*" \ "destructor breakpoint" @@ -133,6 +134,7 @@ proc test_template_breakpoints {} { proc test_template_calls {} { global gdb_prompt + global hp_aCC_compiler if [target_info exists gdb,cannot_call_functions] { setup_xfail "*-*-*" 2416 @@ -140,14 +142,19 @@ proc test_template_calls {} { return } + if {!$hp_aCC_compiler} {setup_xfail hppa*-*-*} send_gdb "print t5i.value()\n" gdb_expect { -re ".* = 2\[\r\n\]*$gdb_prompt $" { pass "print t5i.value()" } -re "Cannot invoke functions on this machine.*$gdb_prompt $" { fail "print t5i.value()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + xfail "print t5i.value" + } -re ".*$gdb_prompt $" { fail "print t5i.value()" } - default { fail "print t5i.value() (timeout)" } + timeout { fail "print t5i.value() (timeout)" } } } @@ -200,3 +207,218 @@ proc do_tests {} { do_tests +if {!$hp_aCC_compiler} {continue} + +# More tests for different kinds of template parameters, +# templates with partial specializations, nested templates, etc. +# These have been tested only with HP aCC. They probably won't +# work with other compilers because of differences in mangling +# schemes. +# Added by Satish Pai <pai@apollo.hp.com> 1997-09-25 + +send_gdb "print fint\n" +gdb_expect { + -re "\\$\[0-9\]* = \\{x = 0, t = 0\\}\r\n$gdb_prompt $" { pass "print fint" } + -re "$gdb_prompt $" { fail "print fint" } + timeout { fail "(timeout) print fint" } +} + +send_gdb "print fvpchar\n" +gdb_expect { + -re "\\$\[0-9\]* = \\{x = 0, t = 0x0\\}\r\n$gdb_prompt $" { pass "print fvpchar" } + -re "$gdb_prompt $" { fail "print fvpchar" } + timeout { fail "(timeout) print fvpchar" } +} + +# Template Foo<T> + +setup_xfail hppa2.0w-*-* CLLbs16092 +send_gdb "ptype Foo\n" +gdb_expect { + -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Foo<volatile char \\*>\r\n\[ \t\]*(class |)Foo<char>\r\n\[ \t\]*(class |)Foo<int>\r\n$gdb_prompt $" { pass "ptype Foo" } + -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Foo" } + -re "$gdb_prompt $" { fail "ptype Foo" } + timeout { fail "(timeout) ptype Foo" } +} + +# ptype Foo<int> + +send_gdb "ptype fint\n" +gdb_expect { + -re "type = (class |)Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fint" } + -re "$gdb_prompt $" { fail "ptype fint" } + timeout { fail "(timeout) ptype fint" } +} + +# ptype Foo<char> + +send_gdb "ptype fchar\n" +gdb_expect { + -re "type = (class |)Foo<char> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char foo\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fchar" } + -re "$gdb_prompt $" { fail "ptype fchar" } + timeout { fail "(timeout) ptype fchar" } +} + +# ptype Foo<volatile char *> + +send_gdb "ptype fvpchar\n" +gdb_expect { + -re "type = (class |)Foo<volatile char \\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*volatile char \\*t;\r\n\r\n\[ \t\]*volatile char \\* foo\\(int, volatile char \\*\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fvpchar" } + -re "$gdb_prompt $" { fail "ptype fvpchar" } + timeout { fail "(timeout) ptype fvpchar" } +} + +# print a function from Foo<volatile char *> + +send_gdb "print Foo<volatile char *>::foo\n" +gdb_expect { + -re "\\$\[0-9\]* = \\{volatile char \\*\\((class |)Foo<volatile char \\*> \\*, int, volatile char \\*\\)\\} $hex <Foo<volatile char \\*>::foo\\(int, volatile char \\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char *>::foo" } + -re "$gdb_prompt $" { fail "print Foo<volatile char *>::foo" } + timeout { fail "(timeout) print Foo<volatile char *>::foo" } +} + +# Template Bar<T, int> + +setup_xfail hppa2.0w-*-* CLLbs16092 +send_gdb "ptype Bar\n" +gdb_expect { + -re "type = template <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)1>\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)33>\r\n$gdb_prompt $" { pass "ptype Bar" } + -re "type = <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Bar" } + -re "$gdb_prompt $" { fail "ptype Bar" } + timeout { fail "(timeout) ptype Bar" } +} + + +# ptype Bar<int,33> + +send_gdb "ptype bint\n" +gdb_expect { + -re "type = (class |)Bar<int,(\\(int\\)|)33> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bint" } + -re "$gdb_prompt $" { fail "ptype bint" } + timeout { fail "(timeout) ptype bint" } +} + +# ptype Bar<int, (4>3)> + +send_gdb "ptype bint2\n" +gdb_expect { + -re "type = (class |)Bar<int,(\\(int\\)|)1> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bint2" } + -re "$gdb_prompt $" { fail "ptype bint2" } + timeout { fail "(timeout) ptype bint2" } +} + +# Template Baz<T, char> + +setup_xfail hppa2.0w-*-* CLLbs16092 +send_gdb "ptype Baz\n" +gdb_expect { + -re "type = template <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Baz<char,(\\(char\\)|)97>\r\n\[ \t\]*(class |)Baz<int,(\\(char\\)|)115>\r\n$gdb_prompt $" { pass "ptype Baz" } + -re "type = <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Baz" } + -re "$gdb_prompt $" { fail "ptype Baz" } + timeout { fail "(timeout) ptype Baz" } +} + + +# ptype Baz<int, 's'> + +send_gdb "ptype bazint\n" +gdb_expect { + -re "type = (class |)Baz<int,(\\(char\\)|)115> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bazint" } + -re "$gdb_prompt $" { fail "ptype bazint" } + timeout { fail "(timeout) ptype bazint" } +} + +# ptype Baz<char, 'a'> + +send_gdb "ptype bazint2\n" +gdb_expect { + -re "type = (class |)Baz<char,(\\(char\\)|)97> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char baz\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bazint2" } + -re "$gdb_prompt $" { fail "ptype bazint2" } + timeout { fail "(timeout) ptype bazint2" } +} + +# Template Qux<T, int (*f)(int) > + +send_gdb "ptype Qux\n" +gdb_expect { + -re "type = template <(class |)T, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Qux<int,&string>\r\n\[ \t\]*(class |)Qux<char,&string>\r\n$gdb_prompt $" { pass "ptype Qux" } + -re ".*type = template <(class |)T.*, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}.*$gdb_prompt $" { pass "ptype Qux" } + -re "$gdb_prompt $" { fail "ptype Qux" } + timeout { fail "(timeout) ptype Qux" } +} + +# pt Qux<int,&string> + +send_gdb "ptype quxint\n" +gdb_expect { + -re "type = class Qux<int,&string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" } + -re "$gdb_prompt $" { fail "ptype quxint" } + timeout { fail "(timeout) ptype quxint" } +} + +# pt Qux<char,0> + +# commented out this as quxint2 declaration was commented out in +# templates.exp -- ovidiu +# send_gdb "ptype quxint2\n" +# gdb_expect { +# -re "type = class Qux<char,&string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char qux\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint2" } +# -re "$gdb_prompt $" { fail "ptype quxint2" } +# timeout { fail "(timeout) ptype quxint2" } +# } + +# Template Spec<T1, T2> + +setup_xfail hppa2.0w-*-* CLLbs16092 +send_gdb "ptype Spec\n" +gdb_expect { + -re "type = template <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Spec<int,int \\*>\r\n\[ \t\]*(class |)Spec<int,char>\r\n$gdb_prompt $" { pass "ptype Spec" } + -re "type = <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Spec" } + -re "$gdb_prompt $" { fail "ptype Spec" } + timeout { fail "(timeout) ptype Spec" } +} + +# pt Spec<char,0> + +send_gdb "ptype siip\n" +gdb_expect { + -re "type = class Spec<int,int \\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*int spec\\(int \\*\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype siip" } + -re "$gdb_prompt $" { fail "ptype siip" } + timeout { fail "(timeout) ptype siip" } +} + +# pt Garply<int> + +send_gdb "ptype Garply<int>\n" +gdb_expect { + -re "type = class Garply<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int garply\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype Garply<int>" } + -re "$gdb_prompt $" { fail "ptype Garply<int>" } + timeout { fail "(timeout) ptype Garply<int>" } +} + +# ptype of nested template name + +send_gdb "ptype Garply<Garply<char> >\n" +gdb_expect { + -re "type = (class |)Garply<Garply<char> > \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*(class |)Garply<char> t;\r\n\r\n\[ \t\]*(class |)Garply<char> garply\\(int, (class |)Garply<char>\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype Garply<Garply<char> >" } + -re "$gdb_prompt $" { fail "ptype Garply<Garply<char> >" } + timeout { fail "(timeout) ptype Garply<Garply<char> >" } +} + +# print out a function from a nested template name + +send_gdb "print Garply<Garply<char> >::garply\n" +gdb_expect { + -re "\\$\[0-9\]* = \\{(class |)Garply<char> \\((class |)Garply<Garply<char> > \\*, int, (class |)Garply<char>\\)\\} $hex <Garply<Garply<char>>::garply\\(int, (class |)Garply<char>\\)>\r\n$gdb_prompt $" { pass "print Garply<Garply<char> >::garply" } + -re ".*$gdb_prompt $" { fail "print Garply<Garply<char> >::garply" } + timeout { fail "print Garply<Garply<char> >::garply (timeout)" } +} + +# UNFORTUNATELY, "break Garply<Garply<char> >::garply" doesn't yet work. + +#send_gdb "break Garply<Garply<char> >::garply +#gdb_expect { +# -re "Breakpoint \[0-9\]* at $hex: file .*templates.cc, line.*\r\n$gdb_prompt $" { pass "break Garply<Garply<char> >::garply" } +# -re ".*$gdb_prompt $" { fail "break Garply<Garply<char> >::garply" } +# timeout { fail "break Garply<Garply<char> >::garply (timeout)" } +#} diff --git a/gdb/testsuite/gdb.c++/userdef.exp b/gdb/testsuite/gdb.c++/userdef.exp index c9bb053..055ff0d 100644 --- a/gdb/testsuite/gdb.c++/userdef.exp +++ b/gdb/testsuite/gdb.c++/userdef.exp @@ -68,7 +68,7 @@ send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" } - setup_xfail hppa_*_* +setup_xfail "hppa*-*-*" send_gdb "print one+two\n" gdb_expect { -re "FIXME.*$gdb_prompt $" { @@ -78,6 +78,7 @@ gdb_expect { timeout { fail "(timeout) print value of one two" } } +setup_xfail "hppa*-*-*" send_gdb "print one-two\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -87,6 +88,7 @@ gdb_expect { timeout { fail "(timeout) print value of one - two" } } +setup_xfail "hppa*-*-*" send_gdb "print one*two\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -96,6 +98,7 @@ gdb_expect { timeout { fail "(timeout) print value of one * two" } } +setup_xfail "hppa*-*-*" send_gdb "print one/two\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -105,6 +108,7 @@ gdb_expect { timeout { fail "(timeout) print value of one / two" } } +setup_xfail "hppa*-*-*" send_gdb "print one%two\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -114,6 +118,7 @@ gdb_expect { timeout { fail "(timeout) print value of one % two" } } +setup_xfail "hppa*-*-*" send_gdb "print one&&two\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -123,6 +128,7 @@ gdb_expect { timeout { fail "(timeout) print value of one && two" } } +setup_xfail "hppa*-*-*" send_gdb "print one||two\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -132,6 +138,7 @@ gdb_expect { timeout { fail "(timeout) print value of one|| two" } } +setup_xfail "hppa*-*-*" send_gdb "print one&two\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -141,6 +148,7 @@ gdb_expect { timeout { fail "(timeout) print value of one & two" } } +setup_xfail "hppa*-*-*" send_gdb "print one|two\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -150,6 +158,7 @@ gdb_expect { timeout { fail "(timeout) print value of one | two" } } +setup_xfail "hppa*-*-*" send_gdb "print one ^ two\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -159,6 +168,8 @@ gdb_expect { timeout { fail "(timeout) print value of one ^ two" } } + +setup_xfail "hppa*-*-*" send_gdb "print one < two\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -168,6 +179,7 @@ gdb_expect { timeout { fail "(timeout) print value of one < two" } } +setup_xfail "hppa*-*-*" send_gdb "print one <= two\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -177,6 +189,7 @@ gdb_expect { timeout { fail "(timeout) print value of one <= two" } } +setup_xfail "hppa*-*-*" send_gdb "print one > two\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -186,6 +199,7 @@ gdb_expect { timeout { fail "(timeout) print value of one > two" } } +setup_xfail "hppa*-*-*" send_gdb "print one >= two\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -196,6 +210,7 @@ gdb_expect { } +setup_xfail "hppa*-*-*" send_gdb "print one==two\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -205,6 +220,8 @@ gdb_expect { timeout { fail "(timeout) print value of one == two" } } + +setup_xfail "hppa*-*-*" send_gdb "print one!=two\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -214,6 +231,7 @@ gdb_expect { timeout { fail "(timeout) print value of one != two" } } +setup_xfail "hppa*-*-*" send_gdb "print one<<31\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -223,6 +241,7 @@ gdb_expect { timeout { fail "(timeout) print value of one<<31" } } +setup_xfail "hppa*-*-*" send_gdb "print one>>31\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -232,6 +251,7 @@ gdb_expect { timeout { fail "(timeout) print value of one>>31" } } +setup_xfail "hppa*-*-*" send_gdb "print !one\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -241,6 +261,7 @@ gdb_expect { timeout { fail "(timeout) print value of !one" } } +setup_xfail "hppa*-*-*" send_gdb "print ~one\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -250,6 +271,7 @@ gdb_expect { timeout { fail "(timeout) print value of ~one" } } +setup_xfail "hppa*-*-*" send_gdb "print -one\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -259,6 +281,7 @@ gdb_expect { timeout { fail "(timeout) print value of -one" } } +setup_xfail "hppa*-*-*" send_gdb "print one++\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -268,6 +291,7 @@ gdb_expect { timeout { fail "(timeout) print value of one++" } } +setup_xfail "hppa*-*-*" send_gdb "print ++one\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -277,6 +301,7 @@ gdb_expect { timeout { fail "(timeout) print value of ++one" } } +setup_xfail "hppa*-*-*" send_gdb "print one--\n" gdb_expect { -re ".*.FIXME*$gdb_prompt $" { @@ -286,6 +311,8 @@ gdb_expect { timeout { fail "(timeout) print value of one-->>31" } } + +setup_xfail "hppa*-*-*" send_gdb "print --one\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -295,6 +322,7 @@ gdb_expect { timeout { fail "(timeout) print value of --one" } } +setup_xfail "hppa*-*-*" send_gdb "print one+=7\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { @@ -304,6 +332,7 @@ gdb_expect { timeout { fail "(timeout) print value of one+=7" } } +setup_xfail "hppa*-*-*" send_gdb "print two=one\n" gdb_expect { -re ".*FIXME.*$gdb_prompt $" { diff --git a/gdb/testsuite/gdb.c++/virtfunc.cc b/gdb/testsuite/gdb.c++/virtfunc.cc index 883d502..005de9d 100644 --- a/gdb/testsuite/gdb.c++/virtfunc.cc +++ b/gdb/testsuite/gdb.c++/virtfunc.cc @@ -170,7 +170,7 @@ extern "C" { }; #endif -main() +int main() { #ifdef usestubs set_debug_traps(); @@ -182,6 +182,8 @@ main() e.vb = 11; test_calls(); + return 0; + } int A::f() {return 1;} diff --git a/gdb/testsuite/gdb.c++/virtfunc.exp b/gdb/testsuite/gdb.c++/virtfunc.exp index d0db755..e182744 100644 --- a/gdb/testsuite/gdb.c++/virtfunc.exp +++ b/gdb/testsuite/gdb.c++/virtfunc.exp @@ -34,15 +34,6 @@ if [get_compiler_info ${binfile} "c++"] { 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 - } -} - - # Check to see if we have an executable to test. If not, then either we # haven't tried to compile one, or the compilation failed for some reason. @@ -106,6 +97,9 @@ proc test_ptype_of_classes {} { -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const &\\);${ws}VB\\(VB const &\\);${ws}VB\\(void\\);${ws}int fvb\\(void\\);${ws}virtual int vvb\\(void\\);${ws}\}.*$gdb_prompt $" { pass "ptype VB" } + -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\}.*$gdb_prompt $" { + pass "ptype VB (aCC)" + } -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\}.*$gdb_prompt $" { pass "ptype VB (obsolescent gcc or gdb)" } @@ -122,6 +116,9 @@ proc test_ptype_of_classes {} { -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" { pass "ptype V" } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype V (aCC)" + } -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" { pass "ptype V (obsolescent gcc or gdb)" } @@ -138,6 +135,9 @@ proc test_ptype_of_classes {} { -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb\[\\\$\.\]+V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" { pass "ptype A" } + -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype A (aCC)" + } -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb\[\\\$\.\]+V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" { pass "ptype A (obsolescent gcc or gdb)" } @@ -161,6 +161,9 @@ proc test_ptype_of_classes {} { -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" { pass "ptype B" } + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype B (aCC)" + } -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" { pass "ptype B (obsolescent gcc or gdb)" } @@ -177,6 +180,9 @@ proc test_ptype_of_classes {} { -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;${ws}C & operator=\\(C const &\\);${ws}C\\(int, C const &\\);${ws}C\\(int\\);${ws}\}$nl$gdb_prompt $" { pass "ptype C" } + -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" { + pass "ptype C (aCC)" + } -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(int, C const &\\);)|(${ws}C\\(int\\);))*${ws}\}$nl$gdb_prompt $" { pass "ptype C (obsolescent gcc or gdb)" } @@ -193,6 +199,9 @@ proc test_ptype_of_classes {} { -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\}$nl$gdb_prompt $" { pass "ptype AD" } + -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype AD (aCC)" + } -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\}$nl$gdb_prompt $" { pass "ptype AD (obsolescent gcc or gdb)" } @@ -209,6 +218,9 @@ proc test_ptype_of_classes {} { -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" { pass "ptype D" } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype D (aCC)" + } -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}$nl$gdb_prompt $" { pass "ptype D (obsolescent gcc or gdb)" } @@ -225,6 +237,9 @@ proc test_ptype_of_classes {} { -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" { pass "ptype E" } + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}virtual int f \\(void\\);${ws}virtual int vg \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype E (aCC)" + } -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" { pass "ptype E (obsolescent gcc or gdb)" } @@ -241,6 +256,9 @@ proc test_ptype_of_classes {} { -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" { pass "ptype dd" } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype dd (aCC)" + } -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}$nl$gdb_prompt $" { pass "ptype dd (obsolescent gcc or gdb)" } @@ -257,6 +275,9 @@ proc test_ptype_of_classes {} { -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype ppd" } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype ppd (aCC)" + } -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype ppd (obsolescent gcc or gdb)" } @@ -273,6 +294,9 @@ proc test_ptype_of_classes {} { -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pAd" } + -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pAd (aCC)" + } -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pAd (obsolescent gcc or gdb)" } @@ -289,6 +313,9 @@ proc test_ptype_of_classes {} { -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" { pass "ptype a" } + -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype a (aCC)" + } -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" { pass "ptype a (obsolescent gcc or gdb)" } @@ -305,6 +332,9 @@ proc test_ptype_of_classes {} { -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" { pass "ptype b" } + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype b (aCC)" + } -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" { pass "ptype b (obsolescent gcc or gdb)" } @@ -321,6 +351,9 @@ proc test_ptype_of_classes {} { -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;${ws}C & operator=\\(C const &\\);${ws}C\\(int, C const &\\);${ws}C\\(int\\);${ws}\}$nl$gdb_prompt $" { pass "ptype c" } + -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" { + pass "ptype c (aCC)" + } -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(int, C const &\\);)|(${ws}C\\(int\\);))*${ws}\}$nl$gdb_prompt $" { pass "ptype c (obsolescent gcc or gdb)" } @@ -337,6 +370,9 @@ proc test_ptype_of_classes {} { -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" { pass "ptype d" } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype d (aCC)" + } -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}$nl$gdb_prompt $" { pass "ptype d (obsolescent gcc or gdb)" } @@ -353,6 +389,9 @@ proc test_ptype_of_classes {} { -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" { pass "ptype e" } + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}virtual int f \\(void\\);${ws}virtual int vg \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype e (aCC)" + } -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" { pass "ptype e (obsolescent gcc or gdb)" } @@ -369,6 +408,9 @@ proc test_ptype_of_classes {} { -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" { pass "ptype v" } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype v (aCC)" + } -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" { pass "ptype v (obsolescent gcc or gdb)" } @@ -385,6 +427,9 @@ proc test_ptype_of_classes {} { -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const &\\);${ws}VB\\(VB const &\\);${ws}VB\\(void\\);${ws}int fvb\\(void\\);${ws}virtual int vvb\\(void\\);${ws}\}$nl$gdb_prompt $" { pass "ptype vb" } + -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\}$nl$gdb_prompt $" { + pass "ptype vb (aCC)" + } -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\}$nl$gdb_prompt $" { pass "ptype vb (obsolescent gcc or gdb)" } @@ -401,6 +446,9 @@ proc test_ptype_of_classes {} { -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pAa" } + -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pAa (aCC)" + } -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pAa (obsolescent gcc or gdb)" } @@ -417,6 +465,9 @@ proc test_ptype_of_classes {} { -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pAe" } + -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pAe (aCC)" + } -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pAe (obsolescent gcc or gdb)" } @@ -433,6 +484,9 @@ proc test_ptype_of_classes {} { -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pBe" } + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pBe (aCC)" + } -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pBe (obsolescent gcc or gdb)" } @@ -449,6 +503,9 @@ proc test_ptype_of_classes {} { -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pDd" } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pDd (aCC)" + } -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pDd (obsolescent gcc or gdb)" } @@ -465,6 +522,9 @@ proc test_ptype_of_classes {} { -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pDe" } + -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pDe (aCC)" + } -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pDe (obsolescent gcc or gdb)" } @@ -481,6 +541,9 @@ proc test_ptype_of_classes {} { -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pVa" } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVa (aCC)" + } -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pVa (obsolescent gcc or gdb)" } @@ -497,6 +560,9 @@ proc test_ptype_of_classes {} { -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pVv" } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVv (aCC)" + } -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pVv (obsolescent gcc or gdb)" } @@ -513,6 +579,9 @@ proc test_ptype_of_classes {} { -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pVe" } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVe (aCC)" + } -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pVe (obsolescent gcc or gdb)" } @@ -529,6 +598,9 @@ proc test_ptype_of_classes {} { -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pVd" } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVd (aCC)" + } -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pVd (obsolescent gcc or gdb)" } @@ -545,6 +617,9 @@ proc test_ptype_of_classes {} { -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pADe" } + -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pADe (aCC)" + } -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pADe (obsolescent gcc or gdb)" } @@ -561,6 +636,9 @@ proc test_ptype_of_classes {} { -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pEe" } + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}virtual int f \\(void\\);${ws}virtual int vg \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pEe (aCC)" + } -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pEe (obsolescent gcc or gdb)" } @@ -577,6 +655,9 @@ proc test_ptype_of_classes {} { -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const &\\);${ws}VB\\(VB const &\\);${ws}VB\\(void\\);${ws}int fvb\\(void\\);${ws}virtual int vvb\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pVB" } + -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" { + pass "ptype pVB (aCC)" + } -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pVB (obsolescent gcc or gdb)" } @@ -616,6 +697,10 @@ proc test_virtual_calls {} { (known failure with gcc cygnus-2.4.5-930417, skipping virtual calls)" return 0 } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pAe->f()" + } -re ".*$gdb_prompt $" { fail "print pAe->f()" } timeout { fail "print pAe->f() (timeout)" } eof { fail "print pAe->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } @@ -624,15 +709,22 @@ proc test_virtual_calls {} { send_gdb "print pAa->f()\n" gdb_expect { -re ".* = 1$nl$gdb_prompt $" { pass "print pAa->f()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pAa->f()" + } -re ".*$gdb_prompt $" { fail "print pAa->f()" } timeout { fail "print pAa->f() (timeout)" } eof { fail "print pAa->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } send_gdb "print pDe->vg()\n" -# setup_xfail "*-*-*" gdb_expect { -re ".* = 202$nl$gdb_prompt $" { pass "print pDe->vg()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pDe->vg()" + } -re ".*$gdb_prompt $" { fail "print pDe->vg()" } timeout { fail "print pDe->vg() (timeout)" } eof { fail "print pDe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } @@ -641,24 +733,34 @@ proc test_virtual_calls {} { send_gdb "print pADe->vg()\n" gdb_expect { -re ".* = 202$nl$gdb_prompt $" { pass "print pADe->vg()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pADe->vg()" + } -re ".*$gdb_prompt $" { fail "print pADe->vg()" } timeout { fail "print pADe->vg() (timeout)" } eof { fail "print pADe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } send_gdb "print pDd->vg()\n" -# setup_xfail "*-*-*" gdb_expect { -re ".* = 101$nl$gdb_prompt $" { pass "print pDd->vg()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pDd->vg()" + } -re ".*$gdb_prompt $" { fail "print pDd->vg()" } timeout { fail "print pDd->vg() (timeout)" } eof { fail "print pDd->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } send_gdb "print pEe->vvb()\n" -# setup_xfail "*-*-*" gdb_expect { -re ".* = 411$nl$gdb_prompt $" { pass "print pEe->vvb()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pEe->vvb()" + } -re ".*$gdb_prompt $" { fail "print pEe->vvb()" } timeout { fail "print pEe->vvb() (timeout)" } eof { fail "print pEe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } @@ -667,42 +769,58 @@ proc test_virtual_calls {} { send_gdb "print pVB->vvb()\n" gdb_expect { -re ".* = 407$nl$gdb_prompt $" { pass "print pVB->vvb()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pVB->vvb()" + } -re ".*$gdb_prompt $" { fail "print pVB->vvb()" } timeout { fail "print pVB->vvb() (timeout)" } eof { fail "print pVB->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } send_gdb "print pBe->vvb()\n" -# setup_xfail "*-*-*" gdb_expect { -re ".* = 411$nl$gdb_prompt $" { pass "print pBe->vvb()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pBe->vvb()" + } -re ".*$gdb_prompt $" { fail "print pBe->vvb()" } timeout { fail "print pBe->vvb() (timeout)" } eof { fail "print pBe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } send_gdb "print pDe->vvb()\n" -# setup_xfail "*-*-*" gdb_expect { -re ".* = 411$nl$gdb_prompt $" { pass "print pDe->vvb()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pDe->vvb()" + } -re ".*$gdb_prompt $" { fail "print pDe->vvb()" } timeout { fail "print pDe->vvb() (timeout)" } eof { fail "print pDe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } send_gdb "print pEe->vd()\n" -# setup_xfail "*-*-*" gdb_expect { -re ".* = 282$nl$gdb_prompt $" { pass "print pEe->vd()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pEe->vd()" + } -re ".*$gdb_prompt $" { fail "print pEe->vd()" } timeout { fail "print pEe->vd() (timeout)" } eof { fail "print pEe->vd() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } send_gdb "print pEe->fvb()\n" -# setup_xfail "*-*-*" gdb_expect { -re ".* = 311$nl$gdb_prompt $" { pass "print pEe->fvb()" } + -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { + setup_xfail hppa*-*-* CLLbs16899 + fail "print pEe->fvb()" + } -re ".*$gdb_prompt $" { fail "print pEe->fvb()" } timeout { fail "print pEe->fvb() (timeout)" } eof { fail "print pEe->fvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 3e71adc..ad1e5ad 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -131,8 +131,11 @@ proc gdb_unload {} { proc delete_breakpoints {} { global gdb_prompt + # we need a larger timeout value here or this thing just confuses + # itself. May need a better implementation if possible. - guo + # send_gdb "delete breakpoints\n" - gdb_expect 30 { + gdb_expect 100 { -re "Delete all breakpoints.*y or n.*$" { send_gdb "y\n"; exp_continue @@ -142,7 +145,7 @@ proc delete_breakpoints {} { timeout { perror "Delete all breakpoints in delete_breakpoints (timeout)" ; return } } send_gdb "info breakpoints\n" - gdb_expect 30 { + gdb_expect 100 { -re "No breakpoints or watchpoints..*$gdb_prompt $" {} -re "$gdb_prompt $" { perror "breakpoints not deleted" ; return } -re "Delete all breakpoints.*or n.*$" { @@ -376,7 +379,12 @@ proc gdb_test { args } { fail "$message"; return $result; } - gdb_expect 2 { + # since we're checking if each line of the multi-line + # command are 'accepted' by GDB here, + # we need to set -notransfer expect option so that + # command output is not lost for pattern matching + # - guo + gdb_expect -notransfer 2 { -re "\[\r\n\]" { } timeout { } } @@ -885,7 +893,7 @@ proc get_compiler_info {binfile args} { return 1; } } - } else { + } elseif { $args != "f77" } { if { [eval gdb_preprocess \ [list "${srcdir}/${subdir}/compiler.c" "${binfile}.ci"] \ $args] != "" } { @@ -932,53 +940,70 @@ proc get_compiler_info {binfile args} { return 0; } -proc gdb_preprocess {source dest args} { - global CC_FOR_TARGET - global CXX_FOR_TARGET +proc get_compiler {args} { + global CC CC_FOR_TARGET CXX CXX_FOR_TARGET F77_FOR_TARGET - if { [llength $args] == 0 } { + if { [llength $args] == 0 + || ([llength $args] == 1 && [lindex $args 0] == "") } { set which_compiler "c" } else { if { $args =="c++" } { set which_compiler "c++" + } elseif { $args =="f77" } { + set which_compiler "f77" } else { perror "Unknown compiler type supplied to gdb_preprocess" - return 1; + return "" } } if [info exists CC_FOR_TARGET] { - if { $which_compiler == "c"} { - set compiler $CC_FOR_TARGET; + if {$which_compiler == "c"} { + set compiler $CC_FOR_TARGET } } if [info exists CXX_FOR_TARGET] { - if { $which_compiler == "c++"} { - set compiler $CXX_FOR_TARGET; + if {$which_compiler == "c++"} { + set compiler $CXX_FOR_TARGET + } + } + + if [info exists F77_FOR_TARGET] { + if {$which_compiler == "f77"} { + set compiler $F77_FOR_TARGET } } if { ![info exists compiler] } { if { $which_compiler == "c" } { if {[info exists CC]} { - set compiler $CC; + set compiler $CC } } if { $which_compiler == "c++" } { if {[info exists CXX]} { - set compiler $CXX; + set compiler $CXX } } if {![info exists compiler]} { set compiler [board_info [target_info name] compiler]; if { $compiler == "" } { - puts "default_target_compile: No compiler to compile with"; - return "default_target_compile: No compiler to compile with"; + perror "get_compiler: No compiler found" + return "" } } } + return $compiler +} + +proc gdb_preprocess {source dest args} { + set compiler [get_compiler "$args"] + if { $compiler == "" } { + return 1 + } + set cmdline "$compiler -E $source > $dest" verbose "Invoking $compiler -E $source > $dest" @@ -1034,6 +1059,20 @@ proc send_gdb { string } { # proc gdb_expect { args } { + # allow -notransfer expect flag specification, + # used by gdb_test routine for multi-line commands. + # packed with gtimeout when fed to remote_expect routine, + # which is a hack but due to what looks like a res and orig + # parsing problem in remote_expect routine (dejagnu/lib/remote.exp): + # what's fed into res is not removed from orig. + # - guo + if { [lindex $args 0] == "-notransfer" } { + set notransfer -notransfer; + set args [lrange $args 1 end]; + } else { + set notransfer ""; + } + if { [llength $args] == 2 && [lindex $args 0] != "-re" } { set gtimeout [lindex $args 0]; set expcode [list [lindex $args 1]]; @@ -1073,7 +1112,8 @@ proc gdb_expect { args } { set remote_suppress_flag 1; } } - set code [catch {uplevel remote_expect host $gtimeout $expcode} string]; + set code [catch \ + {uplevel remote_expect host "$gtimeout $notransfer" $expcode} string]; if [info exists old_val] { set remote_suppress_flag $old_val; } else { @@ -680,6 +680,12 @@ gdb_init (argv0) getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); current_directory = gdb_dirbuf; +#ifdef __MSDOS__ + /* Make sure we return to the original directory upon exit, come + what may, since the OS doesn't do that for us. */ + make_final_cleanup ((make_cleanup_func) chdir, strsave (current_directory)); +#endif + init_cmd_lists (); /* This needs to be done first */ initialize_targets (); /* Setup target_terminal macros for utils.c */ initialize_utils (); /* Make errors and warnings possible */ @@ -3362,13 +3368,32 @@ cd_command (dir, from_tty) if (chdir (dir) < 0) perror_with_name (dir); +#if defined(_WIN32) || defined(__MSDOS__) + /* There's too much mess with DOSish names like "d:", "d:.", + "d:./foo" etc. Instead of having lots of special #ifdef'ed code, + simply get the canonicalized name of the current directory. */ + dir = getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); +#endif + len = strlen (dir); - dir = savestring (dir, len - (len > 1 && SLASH_P (dir[len - 1]))); + if (SLASH_P (dir[len-1])) + { + /* Remove the trailing slash unless this is a root directory + (including a drive letter on non-Unix systems). */ + if (!(len == 1) /* "/" */ +#if defined(_WIN32) || defined(__MSDOS__) + && !(!SLASH_P (*dir) && ROOTED_P (dir) && len <= 3) /* "d:/" */ +#endif + ) + len--; + } + + dir = savestring (dir, len); if (ROOTED_P (dir)) current_directory = dir; else { - if (SLASH_P (current_directory[0]) && current_directory[1] == '\0') + if (SLASH_P (current_directory[strlen (current_directory) - 1])) current_directory = concat (current_directory, dir, NULL); else current_directory = concat (current_directory, SLASH_STRING, dir, NULL); @@ -3755,7 +3780,12 @@ init_history () /* We include the current directory so that if the user changes directories the file written will be the same as the one that was read. */ +#ifdef __MSDOS__ + /* No leading dots in file names are allowed on MSDOS. */ + history_filename = concat (current_directory, "/_gdb_history", NULL); +#else history_filename = concat (current_directory, "/.gdb_history", NULL); +#endif } read_history (history_filename); } diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index cb040bb..ef73399 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1827,7 +1827,7 @@ xcoff_psymtab_to_symtab_1 (pst) /* Init stuff necessary for reading in symbols. */ stabsread_init (); buildsym_init (); - old_chain = make_cleanup ((make_cleanup_func) really_free_pendings, 0); + old_chain = make_cleanup (really_free_pendings, 0); read_xcoff_symtab (pst); sort_symtab_syms (pst->symtab); @@ -2743,7 +2743,7 @@ xcoff_initial_scan (objfile, section_offsets, mainline) init_psymbol_list (objfile, num_symbols); free_pending_blocks (); - back_to = make_cleanup ((make_cleanup_func) really_free_pendings, 0); + back_to = make_cleanup (really_free_pendings, 0); init_minimal_symbol_collection (); make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0); diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog index cdea1ae..64751c9 100644 --- a/sim/mips/ChangeLog +++ b/sim/mips/ChangeLog @@ -1,3 +1,9 @@ +Tue Jul 27 16:36:51 1999 Andrew Cagney <cagney@amy.cygnus.com> + + * interp.c (sim_store_register): Handle case where client - GDB - + specifies that a 4 byte register is 8 bytes in size. + (sim_fetch_register): Ditto. + 1999-07-14 Frank Ch. Eigler <fche@cygnus.com> Implement "sim firmware" option, inspired by jimb's version of 1998-01. diff --git a/sim/mips/interp.c b/sim/mips/interp.c index 3ee5001..4975008 100644 --- a/sim/mips/interp.c +++ b/sim/mips/interp.c @@ -850,8 +850,17 @@ sim_store_register (sd,rn,memory,length) cpu->fpr_state[rn - FGRIDX] = fmt_uninterpreted; if (cpu->register_widths[rn] == 32) { - cpu->fgr[rn - FGRIDX] = T2H_4 (*(unsigned32*)memory); - return 4; + if (length == 8) + { + cpu->fgr[rn - FGRIDX] = + (unsigned32) T2H_8 (*(unsigned64*)memory); + return 8; + } + else + { + cpu->fgr[rn - FGRIDX] = T2H_4 (*(unsigned32*)memory); + return 4; + } } else { @@ -862,8 +871,17 @@ sim_store_register (sd,rn,memory,length) if (cpu->register_widths[rn] == 32) { - cpu->registers[rn] = T2H_4 (*(unsigned32*)memory); - return 4; + if (length == 8) + { + cpu->registers[rn] = + (unsigned32) T2H_8 (*(unsigned64*)memory); + return 8; + } + else + { + cpu->registers[rn] = T2H_4 (*(unsigned32*)memory); + return 4; + } } else { @@ -903,8 +921,17 @@ sim_fetch_register (sd,rn,memory,length) { if (cpu->register_widths[rn] == 32) { - *(unsigned32*)memory = H2T_4 (cpu->fgr[rn - FGRIDX]); - return 4; + if (length == 8) + { + *(unsigned64*)memory = + H2T_8 ((unsigned32) (cpu->fgr[rn - FGRIDX])); + return 8; + } + else + { + *(unsigned32*)memory = H2T_4 (cpu->fgr[rn - FGRIDX]); + return 4; + } } else { @@ -915,8 +942,17 @@ sim_fetch_register (sd,rn,memory,length) if (cpu->register_widths[rn] == 32) { - *(unsigned32*)memory = H2T_4 ((unsigned32)(cpu->registers[rn])); - return 4; + if (length == 8) + { + *(unsigned64*)memory = + H2T_8 ((unsigned32) (cpu->registers[rn])); + return 8; + } + else + { + *(unsigned32*)memory = H2T_4 ((unsigned32)(cpu->registers[rn])); + return 4; + } } else { |