1 Index: gdb-6.8.50.20090909/gdb/testsuite/configure.ac
2 ===================================================================
3 --- gdb-6.8.50.20090909.orig/gdb/testsuite/configure.ac 2009-07-31 17:38:16.000000000 +0200
4 +++ gdb-6.8.50.20090909/gdb/testsuite/configure.ac 2009-09-09 19:06:01.000000000 +0200
5 @@ -144,6 +144,6 @@ AC_OUTPUT([Makefile \
6 gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
7 gdb.fortran/Makefile gdb.server/Makefile \
8 gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile \
9 - gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile \
10 + gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile \
11 gdb.python/Makefile gdb.reverse/Makefile \
12 gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile])
13 Index: gdb-6.8.50.20090909/gdb/testsuite/configure
14 ===================================================================
15 --- gdb-6.8.50.20090909.orig/gdb/testsuite/configure 2009-08-22 18:56:43.000000000 +0200
16 +++ gdb-6.8.50.20090909/gdb/testsuite/configure 2009-09-09 19:06:27.000000000 +0200
17 @@ -3515,7 +3515,7 @@ done
21 -ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
22 +ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
24 cat >confcache <<\_ACEOF
25 # This file is a shell script that caches the results of configure
26 @@ -4231,6 +4231,7 @@ do
27 "gdb.objc/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.objc/Makefile" ;;
28 "gdb.opt/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opt/Makefile" ;;
29 "gdb.pascal/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.pascal/Makefile" ;;
30 + "gdb.pie/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.pie/Makefile" ;;
31 "gdb.python/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.python/Makefile" ;;
32 "gdb.reverse/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.reverse/Makefile" ;;
33 "gdb.threads/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.threads/Makefile" ;;
34 Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.c
35 ===================================================================
36 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
37 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.c 2009-09-09 19:06:01.000000000 +0200
39 +/* This program is intended to be started outside of gdb, and then
40 + attached to by gdb. Thus, it simply spins in a loop. The loop
41 + is exited when & if the variable 'should_exit' is non-zero. (It
42 + is initialized to zero in this program, so the loop will never
43 + exit unless/until gdb sets the variable to non-zero.)
53 + while (! should_exit)
59 Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach2.c
60 ===================================================================
61 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
62 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach2.c 2009-09-09 19:06:01.000000000 +0200
64 +/* This program is intended to be started outside of gdb, and then
65 + attached to by gdb. Thus, it simply spins in a loop. The loop
66 + is exited when & if the variable 'should_exit' is non-zero. (It
67 + is initialized to zero in this program, so the loop will never
68 + exit unless/until gdb sets the variable to non-zero.)
80 + sleep( 10 ); /* System call causes register fetch to fail */
81 + /* This is a known HPUX "feature" */
82 + while (! should_exit)
88 Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.c
89 ===================================================================
90 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
91 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.c 2009-09-09 19:06:01.000000000 +0200
93 +/* This testcase is part of GDB, the GNU debugger.
95 + Copyright 1992, 1993, 1994, 1995, 1999, 2002, 2003 Free Software
98 + This program is free software; you can redistribute it and/or modify
99 + it under the terms of the GNU General Public License as published by
100 + the Free Software Foundation; either version 2 of the License, or
101 + (at your option) any later version.
103 + This program is distributed in the hope that it will be useful,
104 + but WITHOUT ANY WARRANTY; without even the implied warranty of
105 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
106 + GNU General Public License for more details.
108 + You should have received a copy of the GNU General Public License
109 + along with this program; if not, write to the Free Software
110 + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
112 + Please email any bugs, comments, and/or additions to this file to:
113 + bug-gdb@prep.ai.mit.edu */
119 +/* VxWorks does not supply atoi. */
126 + while (*z >= '0' && *z <= '9')
127 + i = i * 10 + (*z++ - '0');
131 +/* I don't know of any way to pass an array to VxWorks. This function
132 + can be called directly from gdb. */
141 + main (2, argv, (char **) 0);
144 +#else /* ! vxworks */
146 +# include <stdlib.h>
147 +#endif /* ! vxworks */
150 +extern int marker1 (void);
151 +extern int marker2 (int a);
152 +extern void marker3 (char *a, char *b);
153 +extern void marker4 (long d);
155 +extern int marker1 ();
156 +extern int marker2 ();
157 +extern void marker3 ();
158 +extern void marker4 ();
162 + * This simple classical example of recursion is useful for
163 + * testing stack backtraces and such.
170 +main (int argc, char **argv, char **envp)
173 +main (argc, argv, envp)
175 +char *argv[], **envp;
179 + set_debug_traps(); /* set breakpoint 5 here */
182 + if (argc == 12345) { /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */
183 + fprintf (stderr, "usage: factorial <number>\n");
186 + printf ("%d\n", factorial (atoi ("6"))); /* set breakpoint 1 here */
187 + /* set breakpoint 12 here */
188 + marker1 (); /* set breakpoint 11 here */
189 + marker2 (43); /* set breakpoint 20 here */
190 + marker3 ("stack", "trace"); /* set breakpoint 21 here */
191 + marker4 (177601976L);
192 + argc = (argc == 12345); /* This is silly, but we can step off of it */ /* set breakpoint 2 here */
193 + return argc; /* set breakpoint 10 here */
197 +int factorial (int value)
199 +int factorial (value)
203 + if (value > 1) { /* set breakpoint 7 here */
204 + value *= factorial (value - 1);
206 + return (value); /* set breakpoint 19 here */
210 +int multi_line_if_conditional (int a, int b, int c)
212 +int multi_line_if_conditional (a, b, c)
216 + if (a /* set breakpoint 3 here */
225 +int multi_line_while_conditional (int a, int b, int c)
227 +int multi_line_while_conditional (a, b, c)
231 + while (a /* set breakpoint 4 here */
239 Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break1.c
240 ===================================================================
241 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
242 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break1.c 2009-09-09 19:06:01.000000000 +0200
244 +/* This testcase is part of GDB, the GNU debugger.
246 + Copyright 1992, 1993, 1994, 1995, 1999, 2002, 2003 Free Software
249 + This program is free software; you can redistribute it and/or modify
250 + it under the terms of the GNU General Public License as published by
251 + the Free Software Foundation; either version 2 of the License, or
252 + (at your option) any later version.
254 + This program is distributed in the hope that it will be useful,
255 + but WITHOUT ANY WARRANTY; without even the implied warranty of
256 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
257 + GNU General Public License for more details.
259 + You should have received a copy of the GNU General Public License
260 + along with this program; if not, write to the Free Software
261 + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
263 + Please email any bugs, comments, and/or additions to this file to:
264 + bug-gdb@prep.ai.mit.edu */
266 +/* The code for this file was extracted from the gdb testsuite
267 + testcase "break.c". */
269 +/* The following functions do nothing useful. They are included
270 + simply as places to try setting breakpoints at. They are
271 + explicitly "one-line functions" to verify that this case works
272 + (some versions of gcc have or have had problems with this).
274 + These functions are in a separate source file to prevent an
275 + optimizing compiler from inlining them and optimizing them away. */
278 +int marker1 (void) { return (0); } /* set breakpoint 15 here */
279 +int marker2 (int a) { return (1); } /* set breakpoint 8 here */
280 +void marker3 (char *a, char *b) {} /* set breakpoint 17 here */
281 +void marker4 (long d) {} /* set breakpoint 14 here */
283 +int marker1 () { return (0); } /* set breakpoint 16 here */
284 +int marker2 (a) int a; { return (1); } /* set breakpoint 9 here */
285 +void marker3 (a, b) char *a, *b; {} /* set breakpoint 18 here */
286 +void marker4 (d) long d; {} /* set breakpoint 13 here */
288 Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/coremaker.c
289 ===================================================================
290 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
291 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/coremaker.c 2009-09-09 19:06:01.000000000 +0200
293 +/* Copyright 1992, 1993, 1994, 1995, 1996, 1999
294 + Free Software Foundation, Inc.
296 + This file is part of GDB.
298 + This program is free software; you can redistribute it and/or modify
299 + it under the terms of the GNU General Public License as published by
300 + the Free Software Foundation; either version 2 of the License, or (at
301 + your option) any later version.
303 + This program is distributed in the hope that it will be useful, but
304 + WITHOUT ANY WARRANTY; without even the implied warranty of
305 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
306 + General Public License for more details.
308 + You should have received a copy of the GNU General Public License
309 + along with this program; if not, write to the Free Software
310 + Foundation, Inc., 59 Temple Place - Suite 330,
311 + Boston, MA 02111-1307, USA. */
313 +/* Simple little program that just generates a core dump from inside some
314 + nested function calls. */
317 +#include <sys/types.h>
319 +#include <sys/mman.h>
328 +#define MAPSIZE (8 * 1024)
330 +/* Don't make these automatic vars or we will have to walk back up the
331 + stack to access them. */
336 +int coremaker_data = 1; /* In Data section */
337 +int coremaker_bss; /* In BSS section */
339 +const int coremaker_ro = 201; /* In Read-Only Data section */
341 +/* Note that if the mapping fails for any reason, we set buf2
342 + to -1 and the testsuite notices this and reports it as
343 + a failure due to a mapping error. This way we don't have
344 + to test for specific errors when running the core maker. */
351 + /* Allocate and initialize a buffer that will be used to write
352 + the file that is later mapped in. */
354 + buf1 = (char *) malloc (MAPSIZE);
355 + for (j = 0; j < MAPSIZE; ++j)
360 + /* Write the file to map in */
362 + fd = open ("coremmap.data", O_CREAT | O_RDWR, 0666);
365 + perror ("coremmap.data open failed");
366 + buf2 = (char *) -1;
369 + write (fd, buf1, MAPSIZE);
371 + /* Now map the file into our address space as buf2 */
373 + buf2 = (char *) mmap (0, MAPSIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
374 + if (buf2 == (char *) -1)
376 + perror ("mmap failed");
380 + /* Verify that the original data and the mapped data are identical.
381 + If not, we'd rather fail now than when trying to access the mapped
382 + data from the core file. */
384 + for (j = 0; j < MAPSIZE; ++j)
386 + if (buf1[j] != buf2[j])
388 + fprintf (stderr, "mapped data is incorrect");
389 + buf2 = (char *) -1;
398 + int coremaker_local[5];
402 + /* Force a corefile that includes the data section for AIX. */
404 + struct sigaction sa;
406 + sigaction (SIGABRT, (struct sigaction *)0, &sa);
407 + sa.sa_flags |= SA_FULLDUMP;
408 + sigaction (SIGABRT, &sa, (struct sigaction *)0);
412 + /* Make sure that coremaker_local doesn't get optimized away. */
413 + for (i = 0; i < 5; i++)
414 + coremaker_local[i] = i;
416 + for (i = 0; i < 5; i++)
417 + coremaker_bss += coremaker_local[i];
418 + coremaker_data = coremaker_ro + 1;
435 Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp
436 ===================================================================
437 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
438 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp 2009-09-09 19:06:01.000000000 +0200
440 +# Copyright 1997, 1999, 2002 Free Software Foundation, Inc.
442 +# This program is free software; you can redistribute it and/or modify
443 +# it under the terms of the GNU General Public License as published by
444 +# the Free Software Foundation; either version 2 of the License, or
445 +# (at your option) any later version.
447 +# This program is distributed in the hope that it will be useful,
448 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
449 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
450 +# GNU General Public License for more details.
452 +# You should have received a copy of the GNU General Public License
453 +# along with this program; if not, write to the Free Software
454 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
456 +# Please email any bugs, comments, and/or additions to this file to:
457 +# bug-gdb@prep.ai.mit.edu
459 +if $tracelevel then {
466 +# On HP-UX 11.0, this test is causing a process running the program
467 +# "attach" to be left around spinning. Until we figure out why, I am
468 +# commenting out the test to avoid polluting tiamat (our 11.0 nightly
469 +# test machine) with these processes. RT
471 +# Setting the magic bit in the target app should work. I added a
472 +# "kill", and also a test for the R3 register warning. JB
473 +if { [istarget "hppa*-*-hpux*"] } {
477 +# are we on a target board
478 +if [is_remote target] then {
482 +set testfile "attach"
483 +set srcfile ${testfile}.c
484 +set srcfile2 ${testfile}2.c
485 +set binfile ${objdir}/${subdir}/${testfile}
486 +set binfile2 ${objdir}/${subdir}/${testfile}2
487 +set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}]
488 +set cleanupfile ${objdir}/${subdir}/${testfile}.awk
490 +#execute_anywhere "rm -f ${binfile} ${binfile2}"
491 +remote_exec build "rm -f ${binfile} ${binfile2}"
492 +# For debugging this test
496 +# Clean out any old files from past runs.
498 +remote_exec build "${cleanupfile}"
500 +# build the first test case
502 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug "additional_flags= -fpie -pie"}] != "" } {
503 + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
506 +# Build the in-system-call test
508 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug "additional_flags= -fpie -pie"}] != "" } {
509 + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
512 +if [get_compiler_info ${binfile}] {
516 +proc do_attach_tests {} {
519 + global escapedbinfile
526 + # Start the program running and then wait for a bit, to be sure
527 + # that it can be attached to.
529 + set testpid [eval exec $binfile &]
532 + # Verify that we cannot attach to nonsense.
534 + send_gdb "attach abc\n"
536 + -re ".*Illegal process-id: abc.*$gdb_prompt $"\
537 + {pass "attach to nonsense is prohibited"}
538 + -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\
540 + # Response expected from /proc-based systems.
541 + pass "attach to nonsense is prohibited"
543 + -re "Attaching to.*$gdb_prompt $"\
544 + {fail "attach to nonsense is prohibited (bogus pid allowed)"}
545 + -re "$gdb_prompt $" {fail "attach to nonsense is prohibited"}
546 + timeout {fail "(timeout) attach to nonsense is prohibited"}
549 + # Verify that we cannot attach to what appears to be a valid
550 + # process ID, but is a process that doesn't exist. Traditionally,
551 + # most systems didn't have a process with ID 0, so we take that as
552 + # the default. However, there are a few exceptions.
555 + if { [istarget "*-*-*bsd*"] } {
556 + # In FreeBSD 5.0, PID 0 is used for "swapper". Use -1 instead
557 + # (which should have the desired effect on any version of
558 + # FreeBSD, and probably other *BSD's too).
561 + send_gdb "attach $boguspid\n"
563 + -re "Attaching to.*, process $boguspid.*No such process.*$gdb_prompt $"\
565 + # Response expected on ptrace-based systems (i.e. HP-UX 10.20).
566 + pass "attach to nonexistent process is prohibited"
568 + -re "Attaching to.*, process $boguspid failed.*Hint.*$gdb_prompt $"\
570 + # Response expected on ttrace-based systems (i.e. HP-UX 11.0).
571 + pass "attach to nonexistent process is prohibited"
573 + -re "Attaching to.*, process $boguspid.*denied.*$gdb_prompt $"\
574 + {pass "attach to nonexistent process is prohibited"}
575 + -re "Attaching to.*, process $boguspid.*not permitted.*$gdb_prompt $"\
576 + {pass "attach to nonexistent process is prohibited"}
577 + -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\
579 + # Response expected from /proc-based systems.
580 + pass "attach to nonexistent process is prohibited"
582 + -re "$gdb_prompt $" {fail "attach to nonexistent process is prohibited"}
584 + fail "(timeout) attach to nonexistent process is prohibited"
588 + # Verify that we can attach to the process by first giving its
589 + # executable name via the file command, and using attach with
592 + # (Actually, the test system appears to do this automatically
593 + # for us. So, we must also be prepared to be asked if we want
594 + # to discard an existing set of symbols.)
596 + send_gdb "file $binfile\n"
598 + -re "Load new symbol table from.*y or n.*$" {
601 + -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\
602 + {pass "(re)set file, before attach1"}
603 + -re "$gdb_prompt $" {fail "(re)set file, before attach1"}
604 + timeout {fail "(timeout) (re)set file, before attach1"}
607 + -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\
608 + {pass "set file, before attach1"}
609 + -re "$gdb_prompt $" {fail "set file, before attach1"}
610 + timeout {fail "(timeout) set file, before attach1"}
613 + send_gdb "attach $testpid\n"
615 + -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*main.*at .*$srcfile:.*$gdb_prompt $"\
616 + {pass "attach1, after setting file"}
617 + -re "$gdb_prompt $" {fail "attach1, after setting file"}
618 + timeout {fail "(timeout) attach1, after setting file"}
621 + # Verify that we can "see" the variable "should_exit" in the
622 + # program, and that it is zero.
624 + send_gdb "print should_exit\n"
626 + -re ".* = 0.*$gdb_prompt $"\
627 + {pass "after attach1, print should_exit"}
628 + -re "$gdb_prompt $" {fail "after attach1, print should_exit"}
629 + timeout {fail "(timeout) after attach1, print should_exit"}
632 + # Detach the process.
634 + send_gdb "detach\n"
636 + -re "Detaching from program: .*$escapedbinfile.*$gdb_prompt $"\
637 + {pass "attach1 detach"}
638 + -re "$gdb_prompt $" {fail "attach1 detach"}
639 + timeout {fail "(timeout) attach1 detach"}
642 + # Wait a bit for gdb to finish detaching
646 + # Purge the symbols from gdb's brain. (We want to be certain
647 + # the next attach, which won't be preceded by a "file" command,
648 + # is really getting the executable file without our help.)
650 + set old_timeout $timeout
654 + -re ".*gdb internal error.*$" {
655 + fail "Internal error, prob. Memory corruption"
657 + -re "No executable file now.*Discard symbol table.*y or n.*$" {
660 + -re "No symbol file now.*$gdb_prompt $"\
661 + {pass "attach1, purging symbols after detach"}
662 + -re "$gdb_prompt $" {fail "attach1, purging symbols after detach"}
663 + timeout {fail "(timeout) attach1, purging symbols after detach"}
666 + -re "$gdb_prompt $" {fail "attach1, purging file after detach"}
668 + fail "(timeout) attach1, purging file after detach"
671 + set timeout $old_timeout
673 + # Verify that we can attach to the process just by giving the
676 + send_gdb "attach $testpid\n"
678 + -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $"\
680 + -re "$gdb_prompt $" {fail "attach2"}
681 + timeout {fail "(timeout) attach2"}
684 + # Verify that we can modify the variable "should_exit" in the
687 + send_gdb "set should_exit=1\n"
689 + -re "$gdb_prompt $" {pass "after attach2, set should_exit"}
690 + timeout {fail "(timeout) after attach2, set should_exit"}
693 + # Verify that the modification really happened.
695 + send_gdb "tbreak 19\n"
697 + -re "reakpoint .*at.*$srcfile, line 19.*$gdb_prompt $"\
698 + {pass "after attach2, set tbreak postloop"}
699 + -re "$gdb_prompt $" {fail "after attach2, set tbreak postloop"}
700 + timeout {fail "(timeout) after attach2, set tbreak postloop"}
702 + send_gdb "continue\n"
704 + -re "main.*at.*$srcfile:19.*$gdb_prompt $"\
705 + {pass "after attach2, reach tbreak postloop"}
706 + -re "$gdb_prompt $" {fail "after attach2, reach tbreak postloop"}
707 + timeout {fail "(timeout) after attach2, reach tbreak postloop"}
710 + # Allow the test process to exit, to cleanup after ourselves.
712 + send_gdb "continue\n"
714 + -re "Program exited normally.*$gdb_prompt $"\
715 + {pass "after attach2, exit"}
716 + -re "$gdb_prompt $" {fail "after attach2, exit"}
717 + timeout {fail "(timeout) after attach2, exit"}
720 + # Make sure we don't leave a process around to confuse
721 + # the next test run (and prevent the compile by keeping
722 + # the text file busy), in case the "set should_exit" didn't
725 + remote_exec build "kill -9 ${testpid}"
726 + # Start the program running and then wait for a bit, to be sure
727 + # that it can be attached to.
729 + set testpid [eval exec $binfile &]
732 + # Verify that we can attach to the process, and find its a.out
733 + # when we're cd'd to some directory that doesn't contain the
734 + # a.out. (We use the source path set by the "dir" command.)
736 + send_gdb "dir ${objdir}/${subdir}\n"
738 + -re ".*Source directories searched: .*$gdb_prompt $"\
739 + {pass "set source path"}
740 + -re "$gdb_prompt $" {fail "set source path"}
741 + timeout {fail "(timeout) set source path"}
744 + send_gdb "cd /tmp\n"
746 + -re ".*Working directory /tmp.*$gdb_prompt $"\
747 + {pass "cd away from process' a.out"}
748 + -re "$gdb_prompt $" {fail "cd away from process' a.out"}
749 + timeout {fail "(timeout) cd away from process' a.out"}
752 + # Explicitly flush out any knowledge of the previous attachment.
753 + send_gdb "symbol\n"
755 + -re ".*Discard symbol table from.*y or n. $"\
758 + -re ".*No symbol file now.*$gdb_prompt $"\
759 + {pass "before attach3, flush symbols"}
760 + -re "$gdb_prompt $" {fail "before attach3, flush symbols"}
761 + timeout {fail "(timeout) before attach3, flush symbols"}
764 + -re ".*No symbol file now.*$gdb_prompt $"\
765 + {pass "before attach3, flush symbols"}
766 + -re "$gdb_prompt $" {fail "before attach3, flush symbols"}
767 + timeout {fail "(timeout) before attach3, flush symbols"}
771 + -re ".*No executable file now.*$gdb_prompt $"\
772 + {pass "before attach3, flush exec"}
773 + -re "$gdb_prompt $" {fail "before attach3, flush exec"}
774 + timeout {fail "(timeout) before attach3, flush exec"}
777 + send_gdb "attach $testpid\n"
779 + -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $"\
780 + {pass "attach when process' a.out not in cwd"}
781 + -re "$gdb_prompt $" {fail "attach when process' a.out not in cwd"}
782 + timeout {fail "(timeout) attach when process' a.out not in cwd"}
787 + -re ".*Kill the program being debugged.*y or n. $"\
790 + -re "$gdb_prompt $" {pass "after attach3, exit"}
791 + timeout {fail "(timeout) after attach3, exit"}
794 + -re "$gdb_prompt $" {fail "after attach3, exit"}
795 + timeout {fail "(timeout) after attach3, exit"}
798 + # Another "don't leave a process around"
799 + remote_exec build "kill -9 ${testpid}"
802 +proc do_call_attach_tests {} {
806 + # Start the program running and then wait for a bit, to be sure
807 + # that it can be attached to.
809 + set testpid [eval exec $binfile2 &]
814 + gdb_test "file $binfile2" ".*" "force switch to gdb64, if necessary"
815 + send_gdb "attach $testpid\n"
817 + -re ".*warning: reading register.*I.*O error.*$gdb_prompt $" {
818 + fail "attach call, read register 3 error"
820 + -re "Attaching to.*process $testpid.*$gdb_prompt $" {
821 + # libc is relocated, not relocated, therefore not printed.
824 + -re "$gdb_prompt $" {fail "attach call"}
825 + timeout {fail "(timeout) attach call"}
828 + # See if other registers are problems
830 + send_gdb "i r r3\n"
832 + -re ".*warning: reading register.*$gdb_prompt $" {
833 + pass "CHFts23490: known bug"
835 + -re ".*r3.*$gdb_prompt $" {
836 + pass "Bug fixed, Yayyy!"
838 + timeout { fail "timeout on info reg" }
841 + # Get rid of the process
843 + gdb_test "p should_exit = 1" ".*"
844 + gdb_test "c" ".*Program exited normally.*"
848 + remote_exec build "kill -9 ${testpid}"
853 +# Start with a fresh gdb
857 +gdb_reinitialize_dir $srcdir/$subdir
860 +# This is a test of gdb's ability to attach to a running process.
864 +# Test attaching when the target is inside a system call
869 +gdb_reinitialize_dir $srcdir/$subdir
870 +do_call_attach_tests
873 Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.exp
874 ===================================================================
875 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
876 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.exp 2009-09-09 19:06:01.000000000 +0200
878 +# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
879 +# 2000, 2002, 2003, 2004
880 +# Free Software Foundation, Inc.
882 +# This program is free software; you can redistribute it and/or modify
883 +# it under the terms of the GNU General Public License as published by
884 +# the Free Software Foundation; either version 2 of the License, or
885 +# (at your option) any later version.
887 +# This program is distributed in the hope that it will be useful,
888 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
889 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
890 +# GNU General Public License for more details.
892 +# You should have received a copy of the GNU General Public License
893 +# along with this program; if not, write to the Free Software
894 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
896 +# Please email any bugs, comments, and/or additions to this file to:
897 +# bug-gdb@prep.ai.mit.edu
899 +# This file was written by Rob Savoye. (rob@cygnus.com)
901 +# Test the same stuff but with PIE executables
903 +if $tracelevel then {
909 +# test running programs
914 +set testfile "break"
915 +set srcfile ${testfile}.c
916 +set srcfile1 ${testfile}1.c
917 +set binfile ${objdir}/${subdir}/${testfile}
919 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug "additional_flags=-w -fpie -pie"}] != "" } {
920 + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
923 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug "additional_flags=-w -fpie -pie"}] != "" } {
924 + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
927 +if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug "additional_flags=-w -fpie -pie"}] != "" } {
928 + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
931 +if [get_compiler_info ${binfile}] {
937 +gdb_reinitialize_dir $srcdir/$subdir
940 +if [target_info exists gdb_stub] {
944 +# test simple breakpoint setting commands
947 +# Test deleting all breakpoints when there are none installed,
948 +# GDB should not prompt for confirmation.
949 +# Note that gdb-init.exp provides a "delete_breakpoints" proc
950 +# for general use elsewhere.
952 +send_gdb "delete breakpoints\n"
954 + -re "Delete all breakpoints.*$" {
957 + -re "$gdb_prompt $" {
958 + fail "Delete all breakpoints when none (unexpected prompt)"
960 + timeout { fail "Delete all breakpoints when none (timeout after unexpected prompt)" }
963 + -re ".*$gdb_prompt $" { pass "Delete all breakpoints when none" }
964 + timeout { fail "Delete all breakpoints when none (timeout)" }
968 +# test break at function
970 +gdb_test "break main" \
971 + "Breakpoint.*at.* file .*$srcfile, line.*" \
972 + "breakpoint function"
975 +# test break at quoted function
977 +gdb_test "break \"marker2\"" \
978 + "Breakpoint.*at.* file .*$srcfile1, line.*" \
979 + "breakpoint quoted function"
982 +# test break at function in file
984 +gdb_test "break $srcfile:factorial" \
985 + "Breakpoint.*at.* file .*$srcfile, line.*" \
986 + "breakpoint function in file"
988 +set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
991 +# test break at line number
993 +# Note that the default source file is the last one whose source text
994 +# was printed. For native debugging, before we've executed the
995 +# program, this is the file containing main, but for remote debugging,
996 +# it's wherever the processor was stopped when we connected to the
997 +# board. So, to be sure, we do a list command.
999 +gdb_test "list main" \
1000 + ".*main \\(argc, argv, envp\\).*" \
1001 + "use `list' to establish default source file"
1002 +gdb_test "break $bp_location1" \
1003 + "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\." \
1004 + "breakpoint line number"
1007 +# test duplicate breakpoint
1009 +gdb_test "break $bp_location1" \
1010 + "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line $bp_location1\\." \
1011 + "breakpoint duplicate"
1013 +set bp_location2 [gdb_get_line_number "set breakpoint 2 here"]
1016 +# test break at line number in file
1018 +gdb_test "break $srcfile:$bp_location2" \
1019 + "Breakpoint.*at.* file .*$srcfile, line $bp_location2\\." \
1020 + "breakpoint line number in file"
1022 +set bp_location3 [gdb_get_line_number "set breakpoint 3 here"]
1023 +set bp_location4 [gdb_get_line_number "set breakpoint 4 here"]
1026 +# Test putting a break at the start of a multi-line if conditional.
1027 +# Verify the breakpoint was put at the start of the conditional.
1029 +gdb_test "break multi_line_if_conditional" \
1030 + "Breakpoint.*at.* file .*$srcfile, line $bp_location3\\." \
1031 + "breakpoint at start of multi line if conditional"
1033 +gdb_test "break multi_line_while_conditional" \
1034 + "Breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \
1035 + "breakpoint at start of multi line while conditional"
1037 +set bp_location5 [gdb_get_line_number "set breakpoint 5 here"]
1038 +set bp_location6 [gdb_get_line_number "set breakpoint 6 here"]
1041 +# check to see what breakpoints are set
1043 +if [target_info exists gdb_stub] {
1044 + set main_line $bp_location5
1046 + set main_line $bp_location6
1049 +if {$hp_aCC_compiler} {
1050 + set proto "\\(int\\)"
1055 +set bp_location7 [gdb_get_line_number "set breakpoint 7 here"]
1056 +set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1]
1057 +set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1]
1059 +# Test a pending breakpoint in PIE executable does not crash later GDB.
1060 +gdb_breakpoint "non_existent_function" allow-pending
1062 +gdb_test "info break" \
1063 + "Num\[ \]+Type\[ \]+Disp Enb Address\[ \]+What.*
1064 +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.*
1065 +\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile1:($bp_location8|$bp_location9).*
1066 +\[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:$bp_location7.*
1067 +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.*
1068 +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.*
1069 +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location2.*
1070 +\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_if_conditional at .*$srcfile:$bp_location3.*
1071 +\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_while_conditional at .*$srcfile:$bp_location4.*
1072 +\[0-9\]+\[\t \]+breakpoint keep y.* <PENDING> *non_existent_function" \
1075 +# FIXME: The rest of this test doesn't work with anything that can't
1076 +# handle arguments.
1077 +# Huh? There doesn't *appear* to be anything that passes arguments
1079 +if [istarget "mips-idt-*"] then {
1084 +# run until the breakpoint at main is hit. For non-stubs-using targets.
1086 +if ![target_info exists use_gdb_stub] {
1087 + if [istarget "*-*-vxworks*"] then {
1088 + send_gdb "run vxmain \"2\"\n"
1090 + verbose "Timeout is now $timeout seconds" 2
1095 + -re "The program .* has been started already.*y or n. $" {
1099 + -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\
1100 + { pass "run until function breakpoint" }
1101 + -re ".*$gdb_prompt $" { fail "run until function breakpoint" }
1102 + timeout { fail "run until function breakpoint (timeout)" }
1105 + if ![target_info exists gdb_stub] {
1106 + gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue"
1111 +# run until the breakpoint at a line number
1113 +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location1.*$bp_location1\[\t \]+printf.*factorial.*" \
1114 + "run until breakpoint set at a line number"
1117 +# Run until the breakpoint set in a function in a file
1119 +for {set i 6} {$i >= 1} {incr i -1} {
1120 + gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$srcfile:$bp_location7.*$bp_location7\[\t \]+.*if .value > 1. \{.*" \
1121 + "run until file:function($i) breakpoint"
1125 +# Run until the breakpoint set at a quoted function
1127 +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, (0x\[0-9a-f\]+ in )?marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*" \
1128 + "run until quoted breakpoint"
1130 +# run until the file:function breakpoint at a line number in a file
1132 +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location2.*$bp_location2\[\t \]+argc = \\(argc == 12345\\);.*" \
1133 + "run until file:linenum breakpoint"
1135 +# Test break at offset +1
1136 +set bp_location10 [gdb_get_line_number "set breakpoint 10 here"]
1138 +gdb_test "break +1" \
1139 + "Breakpoint.*at.* file .*$srcfile, line $bp_location10\\." \
1140 + "breakpoint offset +1"
1142 +# Check to see if breakpoint is hit when stepped onto
1145 + ".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location10.*$bp_location10\[\t \]+return argc;.*breakpoint 10 here.*" \
1146 + "step onto breakpoint"
1149 +# delete all breakpoints so we can start over, course this can be a test too
1154 +# test temporary breakpoint at function
1157 +gdb_test "tbreak main" "reakpoint.*at.* file .*$srcfile, line.*" "Temporary breakpoint function"
1160 +# test break at function in file
1163 +gdb_test "tbreak $srcfile:factorial" "reakpoint.*at.* file .*$srcfile, line.*" \
1164 + "Temporary breakpoint function in file"
1167 +# test break at line number
1169 +send_gdb "tbreak $bp_location1\n"
1171 + -re "reakpoint.*at.* file .*$srcfile, line $bp_location1.*$gdb_prompt $" { pass "Temporary breakpoint line number #1" }
1172 + -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number #1" }
1173 + timeout { fail "breakpoint line number #1 (timeout)" }
1176 +gdb_test "tbreak $bp_location6" "reakpoint.*at.* file .*$srcfile, line $bp_location6.*" "Temporary breakpoint line number #2"
1179 +# test break at line number in file
1181 +send_gdb "tbreak $srcfile:$bp_location2\n"
1183 + -re "reakpoint.*at.* file .*$srcfile, line $bp_location2.*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" }
1184 + -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" }
1185 + timeout { fail "Temporary breakpoint line number in file #1 (timeout)" }
1188 +set bp_location11 [gdb_get_line_number "set breakpoint 11 here"]
1189 +gdb_test "tbreak $srcfile:$bp_location11" "reakpoint.*at.* file .*$srcfile, line $bp_location11.*" "Temporary breakpoint line number in file #2"
1192 +# check to see what breakpoints are set (temporary this time)
1194 +gdb_test "info break" "Num.*Type.*Disp Enb Address.*What.*\[\r\n\]
1195 +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\]
1196 +\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial$proto at .*$srcfile:$bp_location7.*\[\r\n\]
1197 +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location1.*\[\r\n\]
1198 +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location6.*\[\r\n\]
1199 +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location2.*\[\r\n\]
1200 +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location11.*" \
1201 + "Temporary breakpoint info"
1206 +# Verify that catchpoints for fork, vfork and exec don't trigger
1207 +# inappropriately. (There are no calls to those system functions
1208 +# in this test program.)
1210 +if ![runto_main] then { fail "break tests suppressed" }
1214 + -re "Catch requires an event name.*$gdb_prompt $"\
1215 + {pass "catch requires an event name"}
1216 + -re "$gdb_prompt $"\
1217 + {fail "catch requires an event name"}
1218 + timeout {fail "(timeout) catch requires an event name"}
1222 +set name "set catch fork, never expected to trigger"
1223 +send_gdb "catch fork\n"
1225 + -re "Catchpoint \[0-9\]* .fork..*$gdb_prompt $"
1227 + -re "Catch of fork not yet implemented.*$gdb_prompt $"
1229 + -re "$gdb_prompt $"
1231 + timeout {fail "(timeout) $name"}
1235 +set name "set catch vfork, never expected to trigger"
1236 +send_gdb "catch vfork\n"
1238 +# If we are on HP-UX 10.20, we expect an error message to be
1239 +# printed if we type "catch vfork" at the gdb gdb_prompt. This is
1240 +# because on HP-UX 10.20, we cannot catch vfork events.
1242 +if [istarget "hppa*-hp-hpux10.20"] then {
1244 + -re "Catch of vfork events not supported on HP-UX 10.20..*$gdb_prompt $"
1246 + -re "$gdb_prompt $"
1248 + timeout {fail "(timeout) $name"}
1252 + -re "Catchpoint \[0-9\]* .vfork..*$gdb_prompt $"
1254 + -re "Catch of vfork not yet implemented.*$gdb_prompt $"
1256 + -re "$gdb_prompt $"
1258 + timeout {fail "(timeout) $name"}
1262 +set name "set catch exec, never expected to trigger"
1263 +send_gdb "catch exec\n"
1265 + -re "Catchpoint \[0-9\]* .exec..*$gdb_prompt $"
1267 + -re "Catch of exec not yet implemented.*$gdb_prompt $"
1269 + -re "$gdb_prompt $" {fail $name}
1270 + timeout {fail "(timeout) $name"}
1273 +# Verify that GDB responds gracefully when asked to set a breakpoint
1274 +# on a nonexistent source line.
1276 +send_gdb "break 999\n"
1278 + -re "No line 999 in file .*$gdb_prompt $"\
1279 + {pass "break on non-existent source line"}
1280 + -re "$gdb_prompt $"\
1281 + {fail "break on non-existent source line"}
1282 + timeout {fail "(timeout) break on non-existent source line"}
1285 +# Run to the desired default location. If not positioned here, the
1286 +# tests below don't work.
1288 +gdb_test "until $bp_location1" "main .* at .*:$bp_location1.*" "until bp_location1"
1291 +# Verify that GDB allows one to just say "break", which is treated
1292 +# as the "default" breakpoint. Note that GDB gets cute when printing
1293 +# the informational message about other breakpoints at the same
1294 +# location. We'll hit that bird with this stone too.
1298 + -re "Breakpoint \[0-9\]*.*$gdb_prompt $"\
1299 + {pass "break on default location, 1st time"}
1300 + -re "$gdb_prompt $"\
1301 + {fail "break on default location, 1st time"}
1302 + timeout {fail "(timeout) break on default location, 1st time"}
1307 + -re "Note: breakpoint \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\
1308 + {pass "break on default location, 2nd time"}
1309 + -re "$gdb_prompt $"\
1310 + {fail "break on default location, 2nd time"}
1311 + timeout {fail "(timeout) break on default location, 2nd time"}
1316 + -re "Note: breakpoints \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\
1317 + {pass "break on default location, 3rd time"}
1318 + -re "$gdb_prompt $"\
1319 + {fail "break on default location, 3rd time"}
1320 + timeout {fail "(timeout) break on default location, 3rd time"}
1325 + -re "Note: breakpoints \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\
1326 + {pass "break on default location, 4th time"}
1327 + -re "$gdb_prompt $"\
1328 + {fail "break on default location, 4th time"}
1329 + timeout {fail "(timeout) break on default location, 4th time"}
1332 +# Verify that a "silent" breakpoint can be set, and that GDB is indeed
1333 +# "silent" about its triggering.
1335 +if ![runto_main] then { fail "break tests suppressed" }
1337 +send_gdb "break $bp_location1\n"
1339 + -re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $"\
1340 + {pass "set to-be-silent break bp_location1"}
1341 + -re "$gdb_prompt $"\
1342 + {fail "set to-be-silent break bp_location1"}
1343 + timeout {fail "(timeout) set to-be-silent break bp_location1"}
1346 +send_gdb "commands $expect_out(1,string)\n"
1347 +send_gdb "silent\n"
1350 + -re ".*$gdb_prompt $"\
1351 + {pass "set silent break bp_location1"}
1352 + timeout {fail "(timeout) set silent break bp_location1"}
1355 +send_gdb "info break $expect_out(1,string)\n"
1357 + -re "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*$gdb_prompt $"\
1358 + {pass "info silent break bp_location1"}
1359 + -re "$gdb_prompt $"\
1360 + {fail "info silent break bp_location1"}
1361 + timeout {fail "(timeout) info silent break bp_location1"}
1363 +send_gdb "continue\n"
1365 + -re "Continuing.\r\n$gdb_prompt $"\
1366 + {pass "hit silent break bp_location1"}
1367 + -re "$gdb_prompt $"\
1368 + {fail "hit silent break bp_location1"}
1369 + timeout {fail "(timeout) hit silent break bp_location1"}
1373 + -re "#0 main .* at .*:$bp_location1.*$gdb_prompt $"\
1374 + {pass "stopped for silent break bp_location1"}
1375 + -re "$gdb_prompt $"\
1376 + {fail "stopped for silent break bp_location1"}
1377 + timeout {fail "(timeout) stopped for silent break bp_location1"}
1380 +# Verify that GDB can at least parse a breakpoint with the
1381 +# "thread" keyword. (We won't attempt to test here that a
1382 +# thread-specific breakpoint really triggers appropriately.
1383 +# The gdb.threads subdirectory contains tests for that.)
1385 +set bp_location12 [gdb_get_line_number "set breakpoint 12 here"]
1386 +send_gdb "break $bp_location12 thread 999\n"
1388 + -re "Unknown thread 999.*$gdb_prompt $"\
1389 + {pass "thread-specific breakpoint on non-existent thread disallowed"}
1390 + -re "$gdb_prompt $"\
1391 + {fail "thread-specific breakpoint on non-existent thread disallowed"}
1392 + timeout {fail "(timeout) thread-specific breakpoint on non-existent thread disallowed"}
1394 +send_gdb "break $bp_location12 thread foo\n"
1396 + -re "Junk after thread keyword..*$gdb_prompt $"\
1397 + {pass "thread-specific breakpoint on bogus thread ID disallowed"}
1398 + -re "$gdb_prompt $"\
1399 + {fail "thread-specific breakpoint on bogus thread ID disallowed"}
1400 + timeout {fail "(timeout) thread-specific breakpoint on bogus thread ID disallowed"}
1403 +# Verify that GDB responds gracefully to a breakpoint command with
1404 +# trailing garbage.
1406 +send_gdb "break $bp_location12 foo\n"
1408 + -re "Junk at end of arguments..*$gdb_prompt $"\
1409 + {pass "breakpoint with trailing garbage disallowed"}
1410 + -re "$gdb_prompt $"\
1411 + {fail "breakpoint with trailing garbage disallowed"}
1412 + timeout {fail "(timeout) breakpoint with trailing garbage disallowed"}
1415 +# Verify that GDB responds gracefully to a "clear" command that has
1416 +# no matching breakpoint. (First, get us off the current source line,
1417 +# which we know has a breakpoint.)
1421 + -re ".*$gdb_prompt $"\
1422 + {pass "step over breakpoint"}
1423 + timeout {fail "(timeout) step over breakpoint"}
1425 +send_gdb "clear 81\n"
1427 + -re "No breakpoint at 81..*$gdb_prompt $"\
1428 + {pass "clear line has no breakpoint disallowed"}
1429 + -re "$gdb_prompt $"\
1430 + {fail "clear line has no breakpoint disallowed"}
1431 + timeout {fail "(timeout) clear line has no breakpoint disallowed"}
1435 + -re "No breakpoint at this line..*$gdb_prompt $"\
1436 + {pass "clear current line has no breakpoint disallowed"}
1437 + -re "$gdb_prompt $"\
1438 + {fail "clear current line has no breakpoint disallowed"}
1439 + timeout {fail "(timeout) clear current line has no breakpoint disallowed"}
1442 +# Verify that we can set and clear multiple breakpoints.
1444 +# We don't test that it deletes the correct breakpoints. We do at
1445 +# least test that it deletes more than one breakpoint.
1447 +gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #1"
1448 +gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #2"
1449 +gdb_test "clear marker3" {Deleted breakpoints [0-9]+ [0-9]+.*}
1451 +# Verify that a breakpoint can be set via a convenience variable.
1453 +send_gdb "set \$foo=$bp_location11\n"
1455 + -re "$gdb_prompt $"\
1456 + {pass "set convenience variable \$foo to bp_location11"}
1457 + timeout {fail "(timeout) set convenience variable \$foo to bp_location11"}
1459 +send_gdb "break \$foo\n"
1461 + -re "Breakpoint (\[0-9\]*) at .*, line $bp_location11.*$gdb_prompt $"\
1462 + {pass "set breakpoint via convenience variable"}
1463 + -re "$gdb_prompt $"\
1464 + {fail "set breakpoint via convenience variable"}
1465 + timeout {fail "(timeout) set breakpoint via convenience variable"}
1468 +# Verify that GDB responds gracefully to an attempt to set a
1469 +# breakpoint via a convenience variable whose type is not integer.
1471 +send_gdb "set \$foo=81.5\n"
1473 + -re "$gdb_prompt $"\
1474 + {pass "set convenience variable \$foo to 81.5"}
1475 + timeout {fail "(timeout) set convenience variable \$foo to 81.5"}
1477 +send_gdb "break \$foo\n"
1479 + -re "Convenience variables used in line specs must have integer values..*$gdb_prompt $"\
1480 + {pass "set breakpoint via non-integer convenience variable disallowed"}
1481 + -re "$gdb_prompt $"\
1482 + {fail "set breakpoint via non-integer convenience variable disallowed"}
1483 + timeout {fail "(timeout) set breakpoint via non-integer convenience variable disallowed"}
1486 +# Verify that we can set and trigger a breakpoint in a user-called function.
1488 +send_gdb "break marker2\n"
1490 + -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*$gdb_prompt $"\
1491 + {pass "set breakpoint on to-be-called function"}
1492 + -re "$gdb_prompt $"\
1493 + {fail "set breakpoint on to-be-called function"}
1494 + timeout {fail "(timeout) set breakpoint on to-be-called function"}
1496 +send_gdb "print marker2(99)\n"
1498 + -re "The program being debugged stopped while in a function called from GDB.\r\nEvaluation of the expression containing the function\r\n.marker2$proto. will be abandoned.\r\nWhen the function is done executing, GDB will silently stop.\r\n$gdb_prompt $"\
1499 + {pass "hit breakpoint on called function"}
1500 + -re "$gdb_prompt $"\
1501 + {fail "hit breakpoint on called function"}
1502 + timeout {fail "(timeout) hit breakpoint on called function"}
1505 +# As long as we're stopped (breakpointed) in a called function,
1506 +# verify that we can successfully backtrace & such from here.
1508 +# In this and the following test, the _sr4export check apparently is needed
1509 +# for hppa*-*-hpux.
1513 + -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*_sr4export.*$gdb_prompt $"\
1514 + {pass "backtrace while in called function"}
1515 + -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*function called from gdb.*$gdb_prompt $"\
1516 + {pass "backtrace while in called function"}
1517 + -re "$gdb_prompt $"\
1518 + {fail "backtrace while in called function"}
1519 + timeout {fail "(timeout) backtrace while in called function"}
1522 +# Return from the called function. For remote targets, it's important to do
1523 +# this before runto_main, which otherwise may silently stop on the dummy
1524 +# breakpoint inserted by GDB at the program's entry point.
1526 +send_gdb "finish\n"
1528 + -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.* in _sr4export.*$gdb_prompt $"\
1529 + {pass "finish from called function"}
1530 + -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*function called from gdb.*$gdb_prompt $"\
1531 + {pass "finish from called function"}
1532 + -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*Value returned.*$gdb_prompt $"\
1533 + {pass "finish from called function"}
1534 + -re "$gdb_prompt $"\
1535 + {fail "finish from called function"}
1536 + timeout {fail "(timeout) finish from called function"}
1539 +# Verify that GDB responds gracefully to a "finish" command with
1542 +if ![runto_main] then { fail "break tests suppressed" }
1544 +send_gdb "finish 123\n"
1546 + -re "The \"finish\" command does not take any arguments.\r\n$gdb_prompt $"\
1547 + {pass "finish with arguments disallowed"}
1548 + -re "$gdb_prompt $"\
1549 + {fail "finish with arguments disallowed"}
1550 + timeout {fail "(timeout) finish with arguments disallowed"}
1553 +# Verify that GDB responds gracefully to a request to "finish" from
1554 +# the outermost frame. On a stub that never exits, this will just
1555 +# run to the stubs routine, so we don't get this error... Thus the
1556 +# second condition.
1559 +send_gdb "finish\n"
1561 + -re "\"finish\" not meaningful in the outermost frame.\r\n$gdb_prompt $"\
1562 + {pass "finish from outermost frame disallowed"}
1563 + -re "Run till exit from.*\r\n$gdb_prompt $" {
1564 + pass "finish from outermost frame disallowed"
1566 + -re "$gdb_prompt $"\
1567 + {fail "finish from outermost frame disallowed"}
1568 + timeout {fail "(timeout) finish from outermost frame disallowed"}
1571 +# Verify that we can explicitly ask GDB to stop on all shared library
1572 +# events, and that it does so.
1574 +if [istarget "hppa*-*-hpux*"] then {
1575 + if ![runto_main] then { fail "break tests suppressed" }
1577 + send_gdb "set stop-on-solib-events 1\n"
1579 + -re "$gdb_prompt $"\
1580 + {pass "set stop-on-solib-events"}
1581 + timeout {fail "(timeout) set stop-on-solib-events"}
1586 + -re ".*Start it from the beginning.*y or n. $"\
1589 + -re ".*Stopped due to shared library event.*$gdb_prompt $"\
1590 + {pass "triggered stop-on-solib-events"}
1591 + -re "$gdb_prompt $"\
1592 + {fail "triggered stop-on-solib-events"}
1593 + timeout {fail "(timeout) triggered stop-on-solib-events"}
1596 + -re "$gdb_prompt $"\
1597 + {fail "rerun for stop-on-solib-events"}
1598 + timeout {fail "(timeout) rerun for stop-on-solib-events"}
1601 + send_gdb "set stop-on-solib-events 0\n"
1603 + -re "$gdb_prompt $"\
1604 + {pass "reset stop-on-solib-events"}
1605 + timeout {fail "(timeout) reset stop-on-solib-events"}
1609 +# Hardware breakpoints are unsupported on HP-UX. Verify that GDB
1610 +# gracefully responds to requests to create them.
1612 +if [istarget "hppa*-*-hpux*"] then {
1613 + if ![runto_main] then { fail "break tests suppressed" }
1615 + send_gdb "hbreak\n"
1617 + -re "No hardware breakpoint support in the target.*$gdb_prompt $"\
1618 + {pass "hw breaks disallowed"}
1619 + -re "$gdb_prompt $"\
1620 + {fail "hw breaks disallowed"}
1621 + timeout {fail "(timeout) hw breaks disallowed"}
1624 + send_gdb "thbreak\n"
1626 + -re "No hardware breakpoint support in the target.*$gdb_prompt $"\
1627 + {pass "temporary hw breaks disallowed"}
1628 + -re "$gdb_prompt $"\
1629 + {fail "temporary hw breaks disallowed"}
1630 + timeout {fail "(timeout) temporary hw breaks disallowed"}
1638 +# Test "next" over recursive function call.
1641 +proc test_next_with_recursion {} {
1646 + if [target_info exists use_gdb_stub] {
1647 + # Reload the program.
1648 + delete_breakpoints
1649 + gdb_load ${binfile};
1651 + # FIXME: should be using runto
1652 + gdb_test "kill" "" "kill program" "Kill the program being debugged.*y or n. $" "y"
1654 + delete_breakpoints
1657 + gdb_test "break factorial" "Breakpoint $decimal at .*" "break at factorial"
1659 + # Run until we call factorial with 6
1661 + if [istarget "*-*-vxworks*"] then {
1662 + send_gdb "run vxmain \"6\"\n"
1667 + -re "Break.* factorial .value=6. .*$gdb_prompt $" {}
1668 + -re ".*$gdb_prompt $" {
1669 + fail "run to factorial(6)";
1670 + gdb_suppress_tests;
1672 + timeout { fail "run to factorial(6) (timeout)" ; gdb_suppress_tests }
1675 + # Continue until we call factorial recursively with 5.
1677 + if [gdb_test "continue" \
1678 + "Continuing.*Break.* factorial .value=5. .*" \
1679 + "continue to factorial(5)"] then { gdb_suppress_tests }
1681 + # Do a backtrace just to confirm how many levels deep we are.
1683 + if [gdb_test "backtrace" \
1684 + "#0\[ \t\]+ factorial .value=5..*" \
1685 + "backtrace from factorial(5)"] then { gdb_suppress_tests }
1687 + # Now a "next" should position us at the recursive call, which
1688 + # we will be performing with 4.
1690 + if [gdb_test "next" \
1691 + ".* factorial .value - 1.;.*" \
1692 + "next to recursive call"] then { gdb_suppress_tests }
1694 + # Disable the breakpoint at the entry to factorial by deleting them all.
1695 + # The "next" should run until we return to the next line from this
1696 + # recursive call to factorial with 4.
1697 + # Buggy versions of gdb will stop instead at the innermost frame on
1698 + # the line where we are trying to "next" to.
1700 + delete_breakpoints
1702 + if [istarget "mips*tx39-*"] {
1705 + # We used to set timeout here for all other targets as well. This
1706 + # is almost certainly wrong. The proper timeout depends on the
1707 + # target system in use, and how we communicate with it, so there
1708 + # is no single value appropriate for all targets. The timeout
1709 + # should be established by the Dejagnu config file(s) for the
1710 + # board, and respected by the test suite.
1712 + # For example, if I'm running GDB over an SSH tunnel talking to a
1713 + # portmaster in California talking to an ancient 68k board running
1714 + # a crummy ROM monitor (a situation I can only wish were
1715 + # hypothetical), then I need a large timeout. But that's not the
1716 + # kind of knowledge that belongs in this file.
1718 + gdb_test next "\[0-9\]*\[\t \]+return \\(value\\);.*" \
1719 + "next over recursive call"
1721 + # OK, we should be back in the same stack frame we started from.
1722 + # Do a backtrace just to confirm.
1724 + set result [gdb_test "backtrace" \
1725 + "#0\[ \t\]+ factorial .value=120.*\r\n#1\[ \t\]+ \[0-9a-fx\]+ in factorial .value=6..*" \
1726 + "backtrace from factorial(5.1)"]
1727 + if { $result != 0 } { gdb_suppress_tests }
1729 + if [target_info exists gdb,noresults] { gdb_suppress_tests }
1730 + gdb_continue_to_end "recursive next test"
1731 + gdb_stop_suppressing_tests;
1734 +test_next_with_recursion
1739 +# build a new file with optimization enabled so that we can try breakpoints
1740 +# on targets with optimized prologues
1742 +set binfileo2 ${objdir}/${subdir}/${testfile}o2
1744 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}O0.o" object {debug "additional_flags=-w -O2 -fpie -pie"}] != "" } {
1745 + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
1748 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}O1.o" object {debug "additional_flags=-w -O2 -fpie -pie"}] != "" } {
1749 + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
1752 +if { [gdb_compile "${binfile}O0.o ${binfile}O1.o" "${binfileo2}" executable {debug "additional_flags=-w -fpie -pie"}] != "" } {
1753 + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
1756 +if [get_compiler_info ${binfileo2}] {
1762 +gdb_reinitialize_dir $srcdir/$subdir
1763 +gdb_load ${binfileo2}
1765 +if [target_info exists gdb_stub] {
1766 + gdb_step_for_stub;
1770 +# test break at function
1772 +gdb_test "break main" \
1773 + "Breakpoint.*at.* file .*$srcfile, line.*" \
1774 + "breakpoint function, optimized file"
1777 +# test break at function
1779 +gdb_test "break marker4" \
1780 + "Breakpoint.*at.* file .*$srcfile1, line.*" \
1781 + "breakpoint small function, optimized file"
1784 +# run until the breakpoint at main is hit. For non-stubs-using targets.
1786 +if ![target_info exists use_gdb_stub] {
1787 + if [istarget "*-*-vxworks*"] then {
1788 + send_gdb "run vxmain \"2\"\n"
1790 + verbose "Timeout is now $timeout seconds" 2
1795 + -re "The program .* has been started already.*y or n. $" {
1799 + -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $"\
1800 + { pass "run until function breakpoint, optimized file" }
1801 + -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$gdb_prompt $"\
1802 + { pass "run until function breakpoint, optimized file (code motion)" }
1803 + -re ".*$gdb_prompt $" { fail "run until function breakpoint, optimized file" }
1804 + timeout { fail "run until function breakpoint, optimized file (timeout)" }
1807 + if ![target_info exists gdb_stub] {
1808 + gdb_test continue ".*Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.*\{.*" "stub continue, optimized file"
1813 +# run until the breakpoint at a small function
1817 +# Add a second pass pattern. The behavior differs here between stabs
1818 +# and dwarf for one-line functions. Stabs preserves two line symbols
1819 +# (one before the prologue and one after) with the same line number,
1820 +# but dwarf regards these as duplicates and discards one of them.
1821 +# Therefore the address after the prologue (where the breakpoint is)
1822 +# has no exactly matching line symbol, and GDB reports the breakpoint
1823 +# as if it were in the middle of a line rather than at the beginning.
1825 +set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1]
1826 +set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1]
1827 +send_gdb "continue\n"
1829 + -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" {
1830 + pass "run until breakpoint set at small function, optimized file"
1832 + -re "Breakpoint $decimal, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" {
1833 + pass "run until breakpoint set at small function, optimized file"
1835 + -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*" {
1836 + # marker4() is defined at line 46 when compiled with -DPROTOTYPES
1837 + pass "run until breakpoint set at small function, optimized file (line bp_location14)"
1839 + -re ".*$gdb_prompt " {
1840 + fail "run until breakpoint set at small function, optimized file"
1843 + fail "run until breakpoint set at small function, optimized file (timeout)"
1848 +# Reset the default arguments for VxWorks
1849 +if [istarget "*-*-vxworks*"] {
1851 + verbose "Timeout is now $timeout seconds" 2
1852 + send_gdb "set args main\n"
1853 + gdb_expect -re ".*$gdb_prompt $" {}
1855 Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/corefile.exp
1856 ===================================================================
1857 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1858 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/corefile.exp 2009-09-09 19:06:01.000000000 +0200
1860 +# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
1861 +# Free Software Foundation, Inc.
1863 +# This program is free software; you can redistribute it and/or modify
1864 +# it under the terms of the GNU General Public License as published by
1865 +# the Free Software Foundation; either version 2 of the License, or
1866 +# (at your option) any later version.
1868 +# This program is distributed in the hope that it will be useful,
1869 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1870 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1871 +# GNU General Public License for more details.
1873 +# You should have received a copy of the GNU General Public License
1874 +# along with this program; if not, write to the Free Software
1875 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1877 +# Please email any bugs, comments, and/or additions to this file to:
1878 +# bug-gdb@prep.ai.mit.edu
1880 +# This file was written by Fred Fish. (fnf@cygnus.com)
1882 +if $tracelevel then {
1883 + strace $tracelevel
1889 +# are we on a target board
1890 +if ![isnative] then {
1894 +set testfile "coremaker"
1895 +set srcfile ${testfile}.c
1896 +set binfile ${objdir}/${subdir}/${testfile}
1897 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug "additional_flags=-fpie -pie"}] != "" } {
1898 + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
1901 +# Create and source the file that provides information about the compiler
1902 +# used to compile the test case.
1903 +if [get_compiler_info ${binfile}] {
1907 +# Create a core file named "corefile" rather than just "core", to
1908 +# avoid problems with sys admin types that like to regularly prune all
1909 +# files named "core" from the system.
1911 +# Arbitrarily try setting the core size limit to "unlimited" since
1912 +# this does not hurt on systems where the command does not work and
1913 +# allows us to generate a core on systems where it does.
1915 +# Some systems append "core" to the name of the program; others append
1916 +# the name of the program to "core"; still others (like Linux, as of
1917 +# May 2003) create cores named "core.PID". In the latter case, we
1918 +# could have many core files lying around, and it may be difficult to
1919 +# tell which one is ours, so let's run the program in a subdirectory.
1921 +set coredir "${objdir}/${subdir}/coredir.[getpid]"
1922 +file mkdir $coredir
1923 +catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\""
1924 +# remote_exec host "${binfile}"
1925 +foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" {
1926 + if [remote_file build exists $i] {
1927 + remote_exec build "mv $i ${objdir}/${subdir}/corefile"
1931 +# Check for "core.PID".
1932 +if { $found == 0 } {
1933 + set names [glob -nocomplain -directory $coredir core.*]
1934 + if {[llength $names] == 1} {
1935 + set corefile [file join $coredir [lindex $names 0]]
1936 + remote_exec build "mv $corefile ${objdir}/${subdir}/corefile"
1940 +if { $found == 0 } {
1941 + # The braindamaged HPUX shell quits after the ulimit -c above
1942 + # without executing ${binfile}. So we try again without the
1943 + # ulimit here if we didn't find a core file above.
1944 + # Oh, I should mention that any "braindamaged" non-Unix system has
1945 + # the same problem. I like the cd bit too, it's really neat'n stuff.
1946 + catch "system \"(cd ${objdir}/${subdir}; ${binfile}; true) >/dev/null 2>&1\""
1947 + foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" {
1948 + if [remote_file build exists $i] {
1949 + remote_exec build "mv $i ${objdir}/${subdir}/corefile"
1955 +# Try to clean up after ourselves.
1956 +remote_file build delete [file join $coredir coremmap.data]
1957 +remote_exec build "rmdir $coredir"
1959 +if { $found == 0 } {
1960 + warning "can't generate a core file - core tests suppressed - check ulimit -c"
1965 +# Test that we can simply startup with a "-core=corefile" command line arg
1966 +# and recognize that the core file is a valid, usable core file.
1967 +# To do this, we must shutdown the currently running gdb and restart
1968 +# with the -core args. We can't use gdb_start because it looks for
1969 +# the first gdb prompt, and the message we are looking for occurs
1970 +# before the first prompt. Also, we can't include GDBFLAGS because
1971 +# if it is empty, this confuses gdb with an empty argument that it
1972 +# grumbles about (said grumbling currently being ignored in gdb_start).
1975 +# Another problem is that on some systems (solaris for example), there
1976 +# is apparently a limit on the length of a fully specified path to
1977 +# the coremaker executable, at about 80 chars. For this case, consider
1978 +# it a pass, but note that the program name is bad.
1981 +if $verbose>1 then {
1982 + send_user "Spawning $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile\n"
1985 +set oldtimeout $timeout
1986 +set timeout [expr "$timeout + 60"]
1987 +verbose "Timeout is now $timeout seconds" 2
1988 +eval "spawn $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile"
1990 + -re "Couldn't find .* registers in core file.*$gdb_prompt $" {
1991 + fail "args: -core=corefile (couldn't find regs)"
1993 + -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
1994 + pass "args: -core=corefile"
1996 + -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
1997 + pass "args: -core=corefile (with bad program name)"
1999 + -re ".*registers from core file: File in wrong format.* $" {
2000 + fail "args: -core=corefile (could not read registers from core file)"
2002 + -re ".*$gdb_prompt $" { fail "args: -core=corefile" }
2003 + timeout { fail "(timeout) starting with -core" }
2008 +# Test that startup with both an executable file and -core argument.
2009 +# See previous comments above, they are still applicable.
2014 +if $verbose>1 then {
2015 + send_user "Spawning $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile\n"
2019 +eval "spawn $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile";
2021 + -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
2022 + pass "args: execfile -core=corefile"
2024 + -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
2025 + pass "args: execfile -core=corefile (with bad program name)"
2027 + -re ".*registers from core file: File in wrong format.* $" {
2028 + fail "args: execfile -core=corefile (could not read registers from core file)"
2030 + -re ".*$gdb_prompt $" { fail "args: execfile -core=corefile" }
2031 + timeout { fail "(timeout) starting with -core" }
2033 +set timeout $oldtimeout
2034 +verbose "Timeout is now $timeout seconds" 2
2038 +# Now restart normally.
2041 +gdb_reinitialize_dir $srcdir/$subdir
2042 +gdb_load ${binfile}
2044 +# Test basic corefile recognition via core-file command.
2046 +send_gdb "core-file $objdir/$subdir/corefile\n"
2048 + -re ".* program is being debugged already.*y or n. $" {
2049 + # gdb_load may connect us to a gdbserver.
2053 + -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
2054 + pass "core-file command"
2056 + -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
2057 + pass "core-file command (with bad program name)"
2059 + -re ".*registers from core file: File in wrong format.* $" {
2060 + fail "core-file command (could not read registers from core file)"
2062 + -re ".*$gdb_prompt $" { fail "core-file command" }
2063 + timeout { fail "(timeout) core-file command" }
2066 +# Test correct mapping of corefile sections by printing some variables.
2068 +gdb_test "print coremaker_data" "\\\$$decimal = 202"
2069 +gdb_test "print coremaker_bss" "\\\$$decimal = 10"
2070 +gdb_test "print coremaker_ro" "\\\$$decimal = 201"
2072 +gdb_test "print func2::coremaker_local" "\\\$$decimal = \\{0, 1, 2, 3, 4\\}"
2074 +# Somehow we better test the ability to read the registers out of the core
2075 +# file correctly. I don't think the other tests do this.
2077 +gdb_test "bt" "abort.*func2.*func1.*main.*" "backtrace in corefile.exp"
2078 +gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp"
2080 +# Test ability to read mmap'd data
2082 +gdb_test "x/8bd buf1" ".*:.*0.*1.*2.*3.*4.*5.*6.*7" "accessing original mmap data in core file"
2083 +setup_xfail "*-*-sunos*" "*-*-ultrix*" "*-*-aix*"
2084 +set test "accessing mmapped data in core file"
2085 +gdb_test_multiple "x/8bd buf2" "$test" {
2086 + -re ".*:.*0.*1.*2.*3.*4.*5.*6.*7.*$gdb_prompt $" {
2089 + -re "0x\[f\]*:.*Cannot access memory at address 0x\[f\]*.*$gdb_prompt $" {
2090 + fail "$test (mapping failed at runtime)"
2092 + -re "0x.*:.*Cannot access memory at address 0x.*$gdb_prompt $" {
2093 + fail "$test (mapping address not found in core file)"
2097 +# test reinit_frame_cache
2099 +gdb_load ${binfile}
2100 +gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\).*" "up in corefile.exp (reinit)"
2102 +gdb_test "core" "No core file now."
2103 Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/Makefile.in
2104 ===================================================================
2105 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2106 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/Makefile.in 2009-09-09 19:06:01.000000000 +0200
2112 +MISCELLANEOUS = arch.inc
2114 +all info install-info dvi install uninstall installcheck check:
2115 + @echo "Nothing to be done for $@..."
2118 + -rm -f *~ *.o a.out *.x *.ci *.tmp
2119 + -rm -f core core.coremaker coremaker.core corefile $(EXECUTABLES)
2120 + -rm -f $(MISCELLANEOUS)
2122 +distclean maintainer-clean realclean: clean
2124 + -rm -f Makefile config.status config.log
2126 + -rm -fr *.log summary detail *.plog *.sum *.psum site.*