2010-01-01 07:32:07 +00:00
# Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2007, 2008, 2009, 2010
2007-01-09 17:59:20 +00:00
# Free Software Foundation, Inc.
1999-04-16 01:35:26 +00:00
# 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
2007-08-23 18:14:19 +00:00
# the Free Software Foundation; either version 3 of the License, or
1999-04-16 01:35:26 +00:00
# (at your option) any later version.
2007-08-23 18:14:19 +00:00
#
1999-04-16 01:35:26 +00:00
# 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.
2007-08-23 18:14:19 +00:00
#
1999-04-16 01:35:26 +00:00
# You should have received a copy of the GNU General Public License
2007-08-23 18:14:19 +00:00
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1999-04-16 01:35:26 +00:00
# This file was written by Elena Zannoni (ezannoni@cygnus.com)
# this file tests maintenance commands and help on those.
# source file used is break.c
#maintenance check-symtabs -- Check consistency of psymtabs and symtabs
#maintenance space -- Set the display of space usage
2001-09-25 02:31:51 +00:00
#maintenance set -- Set GDB internal variables used by the GDB maintainer
#maintenance show -- Show GDB internal variables used by the GDB maintainer
1999-04-16 01:35:26 +00:00
#maintenance time -- Set the display of time usage
#maintenance demangle -- Demangle a C++ mangled name
#maintenance dump-me -- Get fatal error; make debugger dump its core
#maintenance print -- Maintenance command for printing GDB internal state
#maintenance info -- Commands for showing internal info about the program being debugged
1999-08-16 19:57:19 +00:00
#maintenance internal-error -- Give GDB an internal error.
1999-04-16 01:35:26 +00:00
#
2003-05-05 18:33:11 +00:00
#maintenance print dummy-frames -- Print the dummy frame stack
1999-04-16 01:35:26 +00:00
#maintenance print statistics -- Print statistics about internal gdb state
#maintenance print objfiles -- Print dump of current object file definitions
#maintenance print psymbols -- Print dump of current partial symbol definitions
#maintenance print msymbols -- Print dump of current minimal symbol definitions
#maintenance print symbols -- Print dump of current symbol definitions
#maintenance print type -- Print a type chain for a given symbol
#maintenance print unwind -- Print unwind table entry at given address
#
#
#maintenance info sections -- List the BFD sections of the exec and core files
#maintenance info breakpoints -- Status of all breakpoints
#
if $tracelevel then {
strace $tracelevel
}
global usestubs
#
# test running programs
#
set prms_id 0
set bug_id 0
set testfile "break"
set srcfile ${testfile}.c
2003-12-09 18:19:20 +00:00
set srcfile1 ${testfile}1.c
1999-04-16 01:35:26 +00:00
set binfile ${objdir}/${subdir}/${testfile}
2003-12-09 18:19:20 +00:00
2006-03-07 15:23:33 +00:00
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } {
2006-08-10 05:27:22 +00:00
untested maint.exp
return -1
2003-12-09 18:19:20 +00:00
}
2006-03-07 15:23:33 +00:00
if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } {
2006-08-10 05:27:22 +00:00
untested maint.exp
return -1
2003-12-09 18:19:20 +00:00
}
2006-03-07 15:23:33 +00:00
if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } {
2006-08-10 05:27:22 +00:00
untested maint.exp
return -1
1999-04-16 01:35:26 +00:00
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
if ![runto_main] then {
perror "tests suppressed"
}
# The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts.
send_gdb "set height 0\n"
gdb_expect -re "$gdb_prompt $"
#
# this command does not produce any output
# unless there is some problem with the symtabs and psymtabs
# so that branch will really never be covered in this tests here!!
#
1999-08-02 23:48:37 +00:00
# guo: on linux this command output is huge. for some reason splitting up
# the regexp checks works.
#
1999-04-16 01:35:26 +00:00
send_gdb "maint check-symtabs\n"
gdb_expect {
1999-08-02 23:48:37 +00:00
-re "^maint check-symtabs" {
gdb_expect {
-re "$gdb_prompt $" \
1999-04-16 01:35:26 +00:00
{ pass "maint check-symtabs" }
1999-08-02 23:48:37 +00:00
timeout { fail "(timeout) maint check-symtabs" }
}
}
1999-04-16 01:35:26 +00:00
-re ".*$gdb_prompt $" { fail "maint check-symtabs" }
timeout { fail "(timeout) maint check-symtabs" }
}
send_gdb "maint space\n"
gdb_expect {
-re "\"maintenance space\" takes a numeric argument\\..*$gdb_prompt $"\
{ pass "maint space" }
-re ".*$gdb_prompt $" { fail "maint space" }
timeout { fail "(timeout) maint space" }
}
send_gdb "maint space 1\n"
gdb_expect {
-re "Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\
{ pass "maint space 1" }
-re ".*$gdb_prompt $" { fail "maint space 1" }
timeout { fail "(timeout) maint space 1" }
}
send_gdb "maint time\n"
gdb_expect {
-re "\"maintenance time\" takes a numeric argument\\..*Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\
{ pass "maint time" }
-re ".*$gdb_prompt $" { fail "maint time" }
timeout { fail "(timeout) maint time" }
}
send_gdb "maint time 1\n"
gdb_expect {
-re "Command execution time: $decimal.*Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\
{ pass "maint time 1" }
-re ".*$gdb_prompt $" { fail "maint time 1" }
timeout { fail "(timeout) maint time 1" }
}
send_gdb "maint time 0\n"
gdb_expect {
-re "Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\
{ pass "maint time 0" }
-re ".*$gdb_prompt $" { fail "maint time 0" }
timeout { fail "(timeout) maint time 0" }
}
send_gdb "maint space 0\n"
gdb_expect {
-re "maint space 0\r\n$gdb_prompt $"\
{ pass "maint space 0" }
-re ".*$gdb_prompt $" { fail "maint space 0" }
timeout { fail "(timeout) maint space 0" }
}
send_gdb "maint demangle\n"
gdb_expect {
-re "\"maintenance demangle\" takes an argument to demangle\\..*$gdb_prompt $"\
{ pass "maint demangle" }
-re ".*$gdb_prompt $" { fail "maint demangle" }
timeout { fail "(timeout) maint demangle" }
}
send_gdb "maint demangle main\n"
gdb_expect {
-re "Can't demangle \"main\".*$gdb_prompt $"\
{ pass "maint demangle" }
-re ".*$gdb_prompt $" { fail "maint demangle" }
timeout { fail "(timeout) maint demangle" }
}
2005-02-09 16:45:39 +00:00
# The timeout value is raised, because printing all the symbols and
# statistical information about Cygwin and Windows libraries takes a lot
# of time.
if [istarget "*-*-cygwin*"] {
set oldtimeout $timeout
set timeout [expr $timeout + 500]
}
1999-04-16 01:35:26 +00:00
send_gdb "maint print statistics\n"
gdb_expect {
2003-02-14 01:13:45 +00:00
-re "Statistics for.*break.*Number of \"minimal\" symbols read.*Number of \"partial\" symbols read.*Number of \"types\" defined.*Number of psym tables \\(not yet expanded\\).*Number of symbol tables.*Number of symbol tables with line tables.*Number of symbol tables with blockvectors.*Total memory used for psymbol obstack.*Total memory used for psymbol cache.*Total memory used for symbol obstack.*Total memory used for type obstack.*$gdb_prompt $"\
2004-02-07 23:26:47 +00:00
{
# Old output for gdb 6.0 and earlier
pass "maint print statistics"
}
-re "Statistics for.*break.*Number of \"minimal\" symbols read.*Number of \"partial\" symbols read.*Number of \"types\" defined.*Number of psym tables \\(not yet expanded\\).*Number of symbol tables.*Number of symbol tables with line tables.*Number of symbol tables with blockvectors.*Total memory used for objfile obstack.*Total memory used for psymbol cache.*Total memory used for macro cache.*$gdb_prompt $"\
1999-04-16 01:35:26 +00:00
{ pass "maint print statistics" }
-re ".*$gdb_prompt $" { fail "maint print statistics" }
timeout { fail "(timeout) maint print statistics" }
}
2003-05-05 18:33:11 +00:00
# There aren't any ...
gdb_test "maint print dummy-frames" ""
1999-04-16 01:35:26 +00:00
send_gdb "maint print objfiles\n"
1999-07-19 23:30:11 +00:00
1999-04-16 01:35:26 +00:00
# To avoid timeouts, we avoid expects with many .* patterns that match
1999-07-19 23:30:11 +00:00
# many lines. Instead, we keep track of which milestones we've seen
# in the output, and stop when we've seen all of them.
set header 0
set psymtabs 0
set symtabs 0
set keep_looking 1
while {$keep_looking} {
gdb_expect {
2001-10-13 08:36:32 +00:00
-re ".*Object file.*break($EXEEXT)?: Objfile at $hex, bfd at $hex, \[0-9\]* minsyms\[\r\t \]+\n" { set header 1 }
1999-07-19 23:30:11 +00:00
-re ".*Psymtabs:\[\r\t \]+\n" { set psymtabs 1 }
-re ".*Symtabs:\[\r\t \]+\n" { set symtabs 1 }
-re ".*$gdb_prompt $" {
set keep_looking 0
}
timeout {
fail "(timeout) maint print objfiles"
set keep_looking 0
}
}
1999-04-16 01:35:26 +00:00
}
1999-07-19 23:30:11 +00:00
proc maint_pass_if {val name} {
if $val { pass $name } else { fail $name }
1999-04-16 01:35:26 +00:00
}
1999-07-19 23:30:11 +00:00
maint_pass_if $header "maint print objfiles: header"
maint_pass_if $psymtabs "maint print objfiles: psymtabs"
maint_pass_if $symtabs "maint print objfiles: symtabs"
1999-04-16 01:35:26 +00:00
send_gdb "maint print psymbols\n"
gdb_expect {
-re "print-psymbols takes an output file name and optional symbol file name.*$gdb_prompt $"\
{ pass "maint print psymbols w/o args" }
-re ".*$gdb_prompt $" { fail "maint print psymbols w/o args" }
timeout { fail "(timeout) maint print psymbols w/o args" }
}
2002-12-04 03:13:22 +00:00
send_gdb "maint print psymbols psymbols_output ${srcdir}/${subdir}/${srcfile}\n"
1999-04-16 01:35:26 +00:00
gdb_expect {
2002-12-04 03:13:22 +00:00
-re "^maint print psymbols psymbols_output \[^\n\]*\r\n$gdb_prompt $"\
1999-04-16 01:35:26 +00:00
{
send_gdb "shell ls psymbols_output\n"
gdb_expect {
-re "psymbols_output\r\n$gdb_prompt $"\
{
# We want this grep to be as specific as possible,
# so it's less likely to match symbol file names in
# psymbols_output. Yes, this actually happened;
# poor expect got tons of output, and timed out
# trying to match it. --- Jim Blandy <jimb@cygnus.com>
send_gdb "shell grep 'main.*function' psymbols_output\n"
gdb_expect {
-re ".main., function, $hex.*$gdb_prompt $"\
1999-08-02 23:48:37 +00:00
{ pass "maint print psymbols 1" }
-re ".*main. .., function, $hex.*$gdb_prompt $"\
{ pass "maint print psymbols 2" }
1999-04-16 01:35:26 +00:00
-re ".*$gdb_prompt $" { fail "maint print psymbols" }
timeout { fail "(timeout) maint print psymbols" }
}
gdb_test "shell rm -f psymbols_output" ""
}
-re ".*$gdb_prompt $" { fail "maint print psymbols" }
timeout { fail "(timeout) maint print psymbols" }
}
}
-re ".*$gdb_prompt $" { fail "maint print psymbols" }
timeout { fail "(timeout) maint print psymbols" }
}
send_gdb "maint print msymbols\n"
gdb_expect {
-re "print-msymbols takes an output file name and optional symbol file name.*$gdb_prompt $"\
{ pass "maint print msymbols w/o args" }
-re ".*$gdb_prompt $" { fail "maint print msymbols w/o args" }
timeout { fail "(timeout) maint print msymbols w/o args" }
}
2002-12-04 03:13:22 +00:00
send_gdb "maint print msymbols msymbols_output ${binfile}\n"
1999-04-16 01:35:26 +00:00
gdb_expect {
2002-12-04 03:13:22 +00:00
-re "^maint print msymbols msymbols_output \[^\n\]*\r\n$gdb_prompt $"\
1999-04-16 01:35:26 +00:00
{
send_gdb "shell ls msymbols_output\n"
gdb_expect {
-re "msymbols_output\r\n$gdb_prompt $"\
{
send_gdb "shell grep factorial msymbols_output\n"
gdb_expect {
2010-03-12 19:17:01 +00:00
-re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex factorial.*$gdb_prompt $"\
1999-04-16 01:35:26 +00:00
{ pass "maint print msymbols" }
-re ".*$gdb_prompt $" { fail "maint print msymbols" }
timeout { fail "(timeout) maint print msymbols" }
}
gdb_test "shell rm -f msymbols_output" ""
}
-re ".*$gdb_prompt $" { fail "maint print msymbols" }
timeout { fail "(timeout) maint print msymbols" }
}
}
-re ".*$gdb_prompt $" { fail "maint print msymbols" }
timeout { fail "(timeout) maint print msymbols" }
}
2005-02-09 16:45:39 +00:00
# Check that maint print msymbols allows relative pathnames
set mydir [pwd]
2007-02-27 13:54:04 +00:00
gdb_test "cd ${objdir}" "Working directory [string_to_regexp ${objdir}]\..*" "cd to objdir"
2005-02-09 16:45:39 +00:00
gdb_test_multiple "maint print msymbols msymbols_output2 ${subdir}/${testfile}" "maint print msymbols" {
-re "^maint print msymbols msymbols_output2 \[^\n\]*\r\n$gdb_prompt $" {
gdb_test_multiple "shell ls msymbols_output2" "maint print msymbols" {
-re "msymbols_output2\r\n$gdb_prompt $" {
gdb_test_multiple "shell grep factorial msymbols_output2" "maint print msymbols" {
2010-03-12 19:17:01 +00:00
-re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex factorial.*$gdb_prompt $" {
2005-02-09 16:45:39 +00:00
pass "maint print msymbols"
}
-re ".*$gdb_prompt $" {
fail "maint print msymbols"
}
timeout {
fail "(timeout) maint print msymbols"
}
}
gdb_test "shell rm -f msymbols_output2" ""
}
-re ".*$gdb_prompt $" {
fail "maint print msymbols"
}
timeout {
fail "(timeout) maint print msymbols"
}
}
}
-re ".*$gdb_prompt $" {
fail "maint print msymbols"
}
timeout {
fail "(timeout) maint print msymbols"
}
}
2007-02-27 13:54:04 +00:00
gdb_test "cd ${mydir}" "Working directory [string_to_regexp ${mydir}]\..*" "cd to mydir"
1999-04-16 01:35:26 +00:00
send_gdb "maint print symbols\n"
gdb_expect {
-re "Arguments missing: an output file name and an optional symbol file name.*$gdb_prompt $"\
{ pass "maint print symbols w/o args" }
-re ".*$gdb_prompt $" { fail "maint print symbols w/o args" }
timeout { fail "(timeout) maint print symbols w/o args" }
}
2002-12-04 03:13:22 +00:00
# Request symbols for one particular source file so that we don't try to
# dump the symbol information for the entire C library - over 500MB nowadays
# for GNU libc.
1999-07-19 23:30:11 +00:00
2002-12-04 03:13:22 +00:00
send_gdb "maint print symbols symbols_output ${srcdir}/${subdir}/${srcfile}\n"
1999-04-16 01:35:26 +00:00
gdb_expect {
2002-12-04 03:13:22 +00:00
-re "^maint print symbols symbols_output \[^\n\]*\r\n$gdb_prompt $"\
1999-04-16 01:35:26 +00:00
{
send_gdb "shell ls symbols_output\n"
gdb_expect {
-re "symbols_output\r\n$gdb_prompt $"\
{
# See comments for `maint print psymbols'.
1999-07-19 23:30:11 +00:00
send_gdb "shell grep 'main(.*block' symbols_output\n"
1999-04-16 01:35:26 +00:00
gdb_expect {
-re "int main\\(int, char \\*\\*, char \\*\\*\\); block.*$gdb_prompt $"\
{ pass "maint print symbols" }
-re ".*$gdb_prompt $" { fail "maint print symbols" }
timeout { fail "(timeout) maint print symbols" }
}
gdb_test "shell rm -f symbols_output" ""
}
-re ".*$gdb_prompt $" { fail "maint print symbols" }
timeout { fail "(timeout) maint print symbols" }
}
}
-re ".*$gdb_prompt $" { fail "maint print symbols" }
timeout { fail "(timeout) maint print symbols" }
}
2010-01-12 05:49:00 +00:00
set msg "maint print type"
gdb_test_multiple "maint print type argc" $msg {
-re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .<NULL>. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\n$gdb_prompt $" {
pass $msg
}
}
1999-04-16 01:35:26 +00:00
1999-08-02 23:48:37 +00:00
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" }
}
}
1999-04-16 01:35:26 +00:00
set oldtimeout $timeout
set timeout [expr $timeout + 300]
# It'd be nice to check for every possible section. However, that's
# problematic, since the relative ordering wanders from release to
# release of the compilers. Instead, we'll just check for two
# sections which appear to always come out in the same relative
# order. (If that changes, then we should just check for one
# section.)
#
# And by the way: This testpoint will break for PA64, where a.out's
# are ELF files.
#
send_gdb "maint info sections\n"
gdb_expect {
2001-10-13 08:36:32 +00:00
-re "Exec file:\r\n.*break($EXEEXT)?., file type.*$gdb_prompt $"\
1999-04-16 01:35:26 +00:00
{ pass "maint info sections" }
-re ".*$gdb_prompt $" { fail "maint info sections" }
timeout { fail "(timeout) maint info sections" }
}
2002-01-05 02:40:47 +00:00
# Test for new option: maint info sections <section name>
# If you don't have a .text section, this will require tweaking.
send_gdb "maint info sections .text\n"
gdb_expect {
2008-01-28 18:06:59 +00:00
-re ".* \\.bss .*$gdb_prompt $" { fail "maint info sections .text" }
-re ".* \\.data .*$gdb_prompt $" { fail "maint info sections .text" }
-re ".* \\.text .*$gdb_prompt $" { pass "maint info sections .text" }
2003-12-17 05:43:46 +00:00
-re ".*$gdb_prompt $" { fail "maint info sections .text" }
2002-01-05 02:40:47 +00:00
timeout { fail "(timeout) maint info sections .text" }
}
# Test for new option: CODE section flag
# If your data section is tagged CODE, xfail this test.
send_gdb "maint info sections CODE\n"
gdb_expect {
2008-01-28 18:06:59 +00:00
-re ".* \\.data .*$gdb_prompt $" { fail "maint info sections CODE" }
-re ".* \\.text .*$gdb_prompt $" { pass "maint info sections CODE" }
2003-12-17 05:43:46 +00:00
-re ".*$gdb_prompt $" { fail "maint info sections CODE" }
2002-01-05 02:40:47 +00:00
timeout { fail "(timeout) maint info sections CODE" }
}
# Test for new option: DATA section flag
# If your text section is tagged DATA, xfail this test.
2005-02-09 16:45:39 +00:00
#
# The "maint info sections DATA" test is marked for XFAIL on Cygwin,
# because Windows has text sections marked DATA.
setup_xfail "*-*-*cygwin*"
2002-01-05 02:40:47 +00:00
send_gdb "maint info sections DATA\n"
gdb_expect {
2008-01-28 18:06:59 +00:00
-re ".* \\.text .*$gdb_prompt $" { fail "maint info sections DATA" }
-re ".* \\.data .*$gdb_prompt $" { pass "maint info sections DATA" }
2010-03-12 19:17:01 +00:00
-re ".* .rodata .*$gdb_prompt $" { pass "maint info sections DATA" }
2003-12-17 05:43:46 +00:00
-re ".*$gdb_prompt $" { fail "maint info sections DATA" }
2002-01-05 02:40:47 +00:00
timeout { fail "(timeout) maint info sections DATA" }
}
2003-12-09 18:19:20 +00:00
set bp_location6 [gdb_get_line_number "set breakpoint 6 here"]
1999-04-16 01:35:26 +00:00
send_gdb "maint info breakpoints\n"
gdb_expect {
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
Add base multi-executable/process support to GDB.
gdb/
* Makefile.in (SFILES): Add progspace.c.
(COMMON_OBS): Add progspace.o.
* progspace.h: New.
* progspace.c: New.
* breakpoint.h (struct bp_target_info) <placed_address_space>: New
field.
(struct bp_location) <pspace>: New field.
(struct breakpoint) <pspace>: New field.
(bpstat_stop_status, breakpoint_here_p)
(moribund_breakpoint_here_p, breakpoint_inserted_here_p)
(regular_breakpoint_inserted_here_p)
(software_breakpoint_inserted_here_p, breakpoint_thread_match)
(set_default_breakpoint): Adjust prototypes.
(remove_breakpoints_pid, breakpoint_program_space_exit): Declare.
(insert_single_step_breakpoint, deprecated_insert_raw_breakpoint):
Adjust prototypes.
* breakpoint.c (executing_startup): Delete.
(default_breakpoint_sspace): New.
(breakpoint_restore_shadows): Skip if the address space doesn't
match.
(update_watchpoint): Record the frame's program space in the
breakpoint location.
(insert_bp_location): Record the address space in target_info.
Adjust to pass the symbol space to solib_name_from_address.
(breakpoint_program_space_exit): New.
(insert_breakpoint_locations): Switch the symbol space and thread
when inserting breakpoints. Don't insert breakpoints in a vfork
parent waiting for vfork done if we're not attached to the vfork
child.
(remove_breakpoints_pid): New.
(reattach_breakpoints): Switch to a thread of PID. Ignore
breakpoints of other symbol spaces.
(create_internal_breakpoint): Store the symbol space in the sal.
(create_longjmp_master_breakpoint): Iterate over all symbol
spaces.
(update_breakpoints_after_exec): Ignore breakpoints for other
symbol spaces.
(remove_breakpoint): Rename to ...
(remove_breakpoint_1): ... this. Pass the breakpoints symbol
space to solib_name_from_address.
(remove_breakpoint): New.
(mark_breakpoints_out): Ignore breakpoints from other symbol
spaces.
(breakpoint_init_inferior): Ditto.
(breakpoint_here_p): Add an address space argument and adjust to
use breakpoint_address_match.
(moribund_breakpoint_here_p): Ditto.
(regular_breakpoint_inserted_here_p): Ditto.
(breakpoint_inserted_here_p): Ditto.
(software_breakpoint_inserted_here_p): Ditto.
(breakpoint_thread_match): Ditto.
(bpstat_check_location): Ditto.
(bpstat_stop_status): Ditto.
(print_breakpoint_location): If there's a location to print,
switch the current symbol space.
(print_one_breakpoint_location): Add `allflag' argument.
(print_one_breakpoint): Ditto. Adjust.
(do_captured_breakpoint_query): Adjust.
(breakpoint_1): Adjust.
(breakpoint_has_pc): Also match the symbol space.
(describe_other_breakpoints): Add a symbol space argument and
adjust.
(set_default_breakpoint): Add a symbol space argument. Set
default_breakpoint_sspace.
(breakpoint_address_match): New.
(check_duplicates_for): Add an address space argument, and adjust.
(set_raw_breakpoint): Record the symbol space in the location and
in the breakpoint.
(set_longjmp_breakpoint): Skip longjmp master breakpoints from
other symbol spaces.
(remove_thread_event_breakpoints, remove_solib_event_breakpoints)
(disable_breakpoints_in_shlibs): Skip breakpoints from other
symbol spaces.
(disable_breakpoints_in_unloaded_shlib): Match symbol spaces.
(create_catchpoint): Set the symbol space in the sal.
(disable_breakpoints_before_startup): Skip breakpoints from other
symbol spaces. Set executing_startup in the current symbol space.
(enable_breakpoints_after_startup): Clear executing_startup in the
current symbol space. Skip breakpoints from other symbol spaces.
(clone_momentary_breakpoint): Also copy the symbol space.
(add_location_to_breakpoint): Set the location's symbol space.
(bp_loc_is_permanent): Switch thread and symbol space.
(create_breakpoint): Adjust.
(expand_line_sal_maybe): Expand comment to mention symbol spaces.
Switch thread and symbol space when reading memory.
(parse_breakpoint_sals): Set the symbol space in the sal.
(break_command_really): Ditto.
(skip_prologue_sal): Switch and space.
(resolve_sal_pc): Ditto.
(watch_command_1): Record the symbol space in the sal.
(create_ada_exception_breakpoint): Adjust.
(clear_command): Adjust. Match symbol spaces.
(update_global_location_list): Use breakpoint_address_match.
(breakpoint_re_set_one): Switch thread and space.
(breakpoint_re_set): Save symbol space.
(breakpoint_re_set_thread): Also reset the symbol space.
(deprecated_insert_raw_breakpoint): Add an address space argument.
Adjust.
(insert_single_step_breakpoint): Ditto.
(single_step_breakpoint_inserted_here_p): Ditto.
(clear_syscall_counts): New.
(_initialize_breakpoint): Install it as inferior_exit observer.
* exec.h: Include "progspace.h".
(exec_bfd, exec_bfd_mtime): New defines.
(exec_close): Declare.
* exec.c: Include "gdbthread.h" and "progspace.h".
(exec_bfd, exec_bfd_mtime, current_target_sections_1): Delete.
(using_exec_ops): New.
(exec_close_1): Rename to exec_close, and make public.
(exec_close): Rename to exec_close_1, and adjust all callers. Add
description. Remove target sections and close executables from
all program spaces.
(exec_file_attach): Add comment.
(add_target_sections): Check on `using_exec_ops' to check if the
target should be pushed.
(remove_target_sections): Only unpush the target if there are no
more target sections in any symbol space.
* gdbcore.h: Include "exec.h".
(exec_bfd, exec_bfd_mtime): Remove declarations.
* frame.h (get_frame_program_space, get_frame_address_space)
(frame_unwind_program_space): Declare.
* frame.c (struct frame_info) <pspace, aspace>: New fields.
(create_sentinel_frame): Add program space argument. Set the
pspace and aspace fields of the frame object.
(get_current_frame, create_new_frame): Adjust.
(get_frame_program_space): New.
(frame_unwind_program_space): New.
(get_frame_address_space): New.
* stack.c (print_frame_info): Adjust.
(print_frame): Use the frame's program space.
* gdbthread.h (any_live_thread_of_process): Declare.
* thread.c (any_live_thread_of_process): New.
(switch_to_thread): Switch the program space as well.
(restore_selected_frame): Don't warn if trying to restore frame
level 0.
* inferior.h: Include "progspace.h".
(detach_fork): Declare.
(struct inferior) <removable, aspace, pspace>
<vfork_parent, vfork_child, pending_detach>
<waiting_for_vfork_done>: New fields.
<terminal_info>: Remove field.
<data, num_data>: New fields.
(register_inferior_data, register_inferior_data_with_cleanup)
(clear_inferior_data, set_inferior_data, inferior_data): Declare.
(exit_inferior, exit_inferior_silent, exit_inferior_num_silent)
(inferior_appeared): Declare.
(find_inferior_pid): Typo.
(find_inferior_id, find_inferior_for_program_space): Declare.
(set_current_inferior, save_current_inferior, prune_inferiors)
(number_of_inferiors): Declare.
(inferior_list): Declare.
* inferior.c: Include "gdbcore.h" and "symfile.h".
(inferior_list): Make public.
(delete_inferior_1): Always delete thread silently.
(find_inferior_id): Make public.
(current_inferior_): New.
(current_inferior): Use it.
(set_current_inferior): New.
(restore_inferior): New.
(save_current_inferior): New.
(free_inferior): Free the per-inferior data.
(add_inferior_silent): Allocate per-inferior data.
Call inferior_appeared.
(delete_threads_of_inferior): New.
(delete_inferior_1): Adjust interface to take an inferior pointer.
(delete_inferior): Adjust.
(delete_inferior_silent): Adjust.
(exit_inferior_1): New.
(exit_inferior): New.
(exit_inferior_silent): New.
(exit_inferior_num_silent): New.
(detach_inferior): Adjust.
(inferior_appeared): New.
(discard_all_inferiors): Adjust.
(find_inferior_id): Make public. Assert pid is not zero.
(find_inferior_for_program_space): New.
(have_inferiors): Check if we have any inferior with pid not zero.
(have_live_inferiors): Go over all pushed targets looking for
process_stratum.
(prune_inferiors): New.
(number_of_inferiors): New.
(print_inferior): Add executable column. Print vfork parent/child
relationships.
(inferior_command): Adjust to cope with not running inferiors.
(remove_inferior_command): New.
(add_inferior_command): New.
(clone_inferior_command): New.
(struct inferior_data): New.
(struct inferior_data_registration): New.
(struct inferior_data_registry): New.
(inferior_data_registry): New.
(register_inferior_data_with_cleanup): New.
(register_inferior_data): New.
(inferior_alloc_data): New.
(inferior_free_data): New.
(clear_inferior_data): New.
(set_inferior_data): New.
(inferior_data): New.
(initialize_inferiors): New.
(_initialize_inferiors): Register "add-inferior",
"remove-inferior" and "clone-inferior" commands.
* objfiles.h: Include "progspace.h".
(struct objfile) <pspace>: New field.
(symfile_objfile, object_files): Don't declare.
(ALL_PSPACE_OBJFILES): New.
(ALL_PSPACE_OBJFILES_SAFE): New.
(ALL_OBJFILES, ALL_OBJFILES_SAFE): Adjust.
(ALL_PSPACE_SYMTABS): New.
(ALL_PRIMARY_SYMTABS): Adjust.
(ALL_PSPACE_PRIMARY_SYMTABS): New.
(ALL_PSYMTABS): Adjust.
(ALL_PSPACE_PSYMTABS): New.
* objfiles.c (object_files, symfile_objfile): Delete.
(struct objfile_sspace_info): New.
(objfiles_pspace_data): New.
(objfiles_pspace_data_cleanup): New.
(get_objfile_pspace_data): New.
(objfiles_changed_p): Delete.
(allocate_objfile): Set the objfile's program space. Adjust to
reference objfiles_changed_p in pspace data.
(free_objfile): Adjust to reference objfiles_changed_p in pspace
data.
(objfile_relocate): Ditto.
(update_section_map): Add pspace argument. Adjust to iterate over
objfiles in the passed in pspace.
(find_pc_section): Delete sections and num_sections statics.
Adjust to refer to program space's objfiles_changed_p. Adjust to
refer to sections and num_sections store in the objfile's pspace
data.
(objfiles_changed): Adjust to reference objfiles_changed_p in
pspace data.
(_initialize_objfiles): New.
* linespec.c (decode_all_digits, decode_dollar): Set the sal's
program space.
* source.c (current_source_pspace): New.
(get_current_source_symtab_and_line): Set the sal's program space.
(set_current_source_symtab_and_line): Set current_source_pspace.
(select_source_symtab): Ditto. Use ALL_OBJFILES.
(forget_cached_source_info): Iterate over all program spaces.
* symfile.c (clear_symtab_users): Adjust.
* symmisc.c (print_symbol_bcache_statistics): Iterate over all
program spaces.
(print_objfile_statistics): Ditto.
(maintenance_print_msymbols): Ditto.
(maintenance_print_objfiles): Ditto.
(maintenance_info_symtabs): Ditto.
(maintenance_info_psymtabs): Ditto.
* symtab.h (SYMTAB_PSPACE): New.
(struct symtab_and_line) <pspace>: New field.
* symtab.c (init_sal): Clear the sal's program space.
(find_pc_sect_symtab): Set the sal's program space. Switch thread
and space.
(append_expanded_sal): Add program space argument. Iterate over
all program spaces.
(expand_line_sal): Iterate over all program spaces. Switch
program space.
* target.h (enum target_waitkind) <TARGET_WAITKIND_VFORK_DONE>: New.
(struct target_ops) <to_thread_address_space>: New field.
(target_thread_address_space): Define.
* target.c (target_detach): Only remove breakpoints from the
inferior we're detaching.
(target_thread_address_space): New.
* defs.h (initialize_progspace): Declare.
* top.c (gdb_init): Call it.
* solist.h (struct so_list) <sspace>: New field.
* solib.h (struct program_space): Forward declare.
(solib_name_from_address): Adjust prototype.
* solib.c (so_list_head): Replace with a macro referencing the
program space.
(update_solib_list): Set the so's program space.
(solib_name_from_address): Add a program space argument and adjust.
* solib-svr4.c (struct svr4_info) <pid>: Delete field.
<interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low>
<interp_plt_sect_high>: New fields.
(svr4_info_p, svr4_info): Delete.
(solib_svr4_sspace_data): New.
(get_svr4_info): Rewrite.
(svr4_sspace_data_cleanup): New.
(open_symbol_file_object): Adjust.
(svr4_default_sos): Adjust.
(svr4_fetch_objfile_link_map): Adjust.
(interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low)
(interp_plt_sect_high): Delete.
(svr4_in_dynsym_resolve_code): Adjust.
(enable_break): Adjust.
(svr4_clear_solib): Revert bit that removed the svr4_info here,
and reinstate clearing debug_base, debug_loader_offset_p,
debug_loader_offset and debug_loader_name.
(_initialize_svr4_solib): Register solib_svr4_pspace_data. Don't
install an inferior_exit observer anymore.
* printcmd.c (struct display) <pspace>: New field.
(display_command): Set the display's sspace.
(do_one_display): Match the display's sspace.
(display_uses_solib_p): Ditto.
* linux-fork.c (detach_fork): Moved to infrun.c.
(_initialize_linux_fork): Moved "detach-on-fork" command to
infrun.c.
* infrun.c (detach_fork): Moved from linux-fork.c.
(proceed_after_vfork_done): New.
(handle_vfork_child_exec_or_exit): New.
(follow_exec_mode_replace, follow_exec_mode_keep)
(follow_exec_mode_names, follow_exec_mode_string)
(show_follow_exec_mode_string): New.
(follow_exec): New. Reinstate the mark_breakpoints_out call.
Remove shared libraries before attaching new executable. If user
wants to keep the inferior, keep it.
(displaced_step_fixup): Adjust to pass an address space to the
breakpoints module.
(resume): Ditto.
(clear_proceed_status): In all-stop mode, always clear the proceed
status of all threads.
(prepare_to_proceed): Adjust to pass an address space to the
breakpoints module.
(proceed): Ditto.
(adjust_pc_after_break): Ditto.
(handle_inferior_event): When handling a process exit, switch the
program space to the inferior's that had exited. Call
handle_vfork_child_exec_or_exit. Adjust to pass an address space
to the breakpoints module. In non-stop mode, when following a
fork and detach-fork is off, also resume the other branch. Handle
TARGET_WAITKIND_VFORK_DONE. Set the program space in sals.
(normal_stop): Prune inferiors.
(_initialize_infrun): Install the new "follow-exec-mode" command.
"detach-on-fork" moved here.
* regcache.h (get_regcache_aspace): Declare.
* regcache.c (struct regcache) <aspace>: New field.
(regcache_xmalloc): Clear the aspace.
(get_regcache_aspace): New.
(regcache_cpy): Copy the aspace field.
(regcache_cpy_no_passthrough): Ditto.
(get_thread_regcache): Fetch the thread's address space from the
target, and store it in the regcache.
* infcall.c (call_function_by_hand): Set the sal's pspace.
* arch-utils.c (default_has_shared_address_space): New.
* arch-utils.h (default_has_shared_address_space): Declare.
* gdbarch.sh (has_shared_address_space): New.
* gdbarch.h, gdbarch.c: Regenerate.
* linux-tdep.c: Include auxv.h, target.h, elf/common.h.
(linux_has_shared_address_space): New.
(_initialize_linux_tdep): Declare.
* arm-tdep.c (arm_software_single_step): Pass the frame's address
space to insert_single_step_breakpoint.
* arm-linux-tdep.c (arm_linux_software_single_step): Pass the
frame's pspace to breakpoint functions.
* cris-tdep.c (crisv32_single_step_through_delay): Ditto.
(cris_software_single_step): Ditto.
* mips-tdep.c (deal_with_atomic_sequence): Add frame argument.
Pass the frame's pspace to breakpoint functions.
(mips_software_single_step): Adjust.
(mips_single_step_through_delay): Adjust.
* rs6000-aix-tdep.c (rs6000_software_single_step): Adjust.
* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust.
* solib-irix.c (enable_break): Adjust to pass the current frame's
address space to breakpoint functions.
* sparc-tdep.c (sparc_software_single_step): Ditto.
* spu-tdep.c (spu_software_single_step): Ditto.
* alpha-tdep.c (alpha_software_single_step): Ditto.
* record.c (record_wait): Adjust to pass an address space to the
breakpoints module.
* fork-child.c (fork_inferior): Set the new inferior's program and
address spaces.
* inf-ptrace.c (inf_ptrace_follow_fork): Copy the parent's program
and address spaces.
(inf_ptrace_attach): Set the inferior's program and address spaces.
* linux-nat.c: Include "solib.h".
(linux_child_follow_fork): Manage parent and child's program and
address spaces. Clone the parent's program space if necessary.
Don't wait for the vfork to be done here. Refuse to resume if
following the vfork parent while leaving the child stopped.
(resume_callback): Don't resume a vfork parent.
(linux_nat_resume): Also check for pending events in the
lp->waitstatus field.
(linux_handle_extended_wait): Report TARGET_WAITKIND_VFORK_DONE
events to the core.
(stop_wait_callback): Don't wait for SIGSTOP on vfork parents.
(cancel_breakpoint): Adjust.
* linux-thread-db.c (thread_db_wait): Don't remove thread event
breakpoints here.
(thread_db_mourn_inferior): Don't mark breakpoints out here.
Remove thread event breakpoints after mourning.
* corelow.c: Include progspace.h.
(core_open): Set the inferior's program and address spaces.
* remote.c (remote_add_inferior): Set the new inferior's program
and address spaces.
(remote_start_remote): Update address spaces.
(extended_remote_create_inferior_1): Don't init the thread list if
we already debugging other inferiors.
* darwin-nat.c (darwin_attach): Set the new inferior's program and
address spaces.
* gnu-nat.c (gnu_attach): Ditto.
* go32-nat.c (go32_create_inferior): Ditto.
* inf-ttrace.c (inf_ttrace_follow_fork, inf_ttrace_attach): Ditto.
* monitor.c (monitor_open): Ditto.
* nto-procfs.c (procfs_attach, procfs_create_inferior): Ditto.
* procfs.c (do_attach): Ditto.
* windows-nat.c (do_initial_windows_stuff): Ditto.
* inflow.c (inferior_process_group)
(terminal_init_inferior_with_pgrp, terminal_inferior,
(terminal_ours_1, inflow_inferior_exit, copy_terminal_info)
(child_terminal_info, new_tty_postfork, set_sigint_trap): Adjust
to use per-inferior data instead of inferior->terminal_info.
(inflow_inferior_data): New.
(inflow_new_inferior): Delete.
(inflow_inferior_data_cleanup): New.
(get_inflow_inferior_data): New.
* mi/mi-interp.c (mi_new_inferior): Rename to...
(mi_inferior_appeared): ... this.
(mi_interpreter_init): Adjust.
* tui/tui-disasm.c: Include "progspace.h".
(tui_set_disassem_content): Pass an address space to
breakpoint_here_p.
* NEWS: Mention multi-program debugging support. Mention new
commands "add-inferior", "clone-inferior", "remove-inferior",
"maint info program-spaces", and new option "set
follow-exec-mode".
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* observer.texi (new_inferior): Rename to...
(inferior_appeared): ... this.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/testsuite/
* gdb.base/foll-vfork.exp: Adjust to spell out "follow-fork".
* gdb.base/foll-exec.exp: Adjust to expect a process id before
"Executing new program".
* gdb.base/foll-fork.exp: Adjust to spell out "follow-fork".
* gdb.base/multi-forks.exp: Ditto. Adjust to the inferior being
left listed after having been killed.
* gdb.base/attach.exp: Adjust to spell out "symbol-file".
* gdb.base/maint.exp: Adjust test.
* Makefile.in (ALL_SUBDIRS): Add gdb.multi.
* gdb.multi/Makefile.in: New.
* gdb.multi/base.exp: New.
* gdb.multi/goodbye.c: New.
* gdb.multi/hangout.c: New.
* gdb.multi/hello.c: New.
* gdb.multi/bkpt-multi-exec.c: New.
* gdb.multi/bkpt-multi-exec.exp: New.
* gdb.multi/crashme.c: New.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* gdb.texinfo (Inferiors): Rename node to ...
(Inferiors and Programs): ... this. Mention running multiple
programs in the same debug session.
<info inferiors>: Mention the new 'Executable' column if "info
inferiors". Update examples. Document the "add-inferior",
"clone-inferior", "remove-inferior" and "maint info
program-spaces" commands.
(Process): Rename node to...
(Forks): ... this. Document "set|show follow-exec-mode".
2009-10-19 09:51:43 +00:00
-re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex\[ \t\]+in main at.*break.c:$bp_location6 inf 1\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $"\
2002-01-21 20:25:18 +00:00
{ pass "maint info breakpoints" }
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
Add base multi-executable/process support to GDB.
gdb/
* Makefile.in (SFILES): Add progspace.c.
(COMMON_OBS): Add progspace.o.
* progspace.h: New.
* progspace.c: New.
* breakpoint.h (struct bp_target_info) <placed_address_space>: New
field.
(struct bp_location) <pspace>: New field.
(struct breakpoint) <pspace>: New field.
(bpstat_stop_status, breakpoint_here_p)
(moribund_breakpoint_here_p, breakpoint_inserted_here_p)
(regular_breakpoint_inserted_here_p)
(software_breakpoint_inserted_here_p, breakpoint_thread_match)
(set_default_breakpoint): Adjust prototypes.
(remove_breakpoints_pid, breakpoint_program_space_exit): Declare.
(insert_single_step_breakpoint, deprecated_insert_raw_breakpoint):
Adjust prototypes.
* breakpoint.c (executing_startup): Delete.
(default_breakpoint_sspace): New.
(breakpoint_restore_shadows): Skip if the address space doesn't
match.
(update_watchpoint): Record the frame's program space in the
breakpoint location.
(insert_bp_location): Record the address space in target_info.
Adjust to pass the symbol space to solib_name_from_address.
(breakpoint_program_space_exit): New.
(insert_breakpoint_locations): Switch the symbol space and thread
when inserting breakpoints. Don't insert breakpoints in a vfork
parent waiting for vfork done if we're not attached to the vfork
child.
(remove_breakpoints_pid): New.
(reattach_breakpoints): Switch to a thread of PID. Ignore
breakpoints of other symbol spaces.
(create_internal_breakpoint): Store the symbol space in the sal.
(create_longjmp_master_breakpoint): Iterate over all symbol
spaces.
(update_breakpoints_after_exec): Ignore breakpoints for other
symbol spaces.
(remove_breakpoint): Rename to ...
(remove_breakpoint_1): ... this. Pass the breakpoints symbol
space to solib_name_from_address.
(remove_breakpoint): New.
(mark_breakpoints_out): Ignore breakpoints from other symbol
spaces.
(breakpoint_init_inferior): Ditto.
(breakpoint_here_p): Add an address space argument and adjust to
use breakpoint_address_match.
(moribund_breakpoint_here_p): Ditto.
(regular_breakpoint_inserted_here_p): Ditto.
(breakpoint_inserted_here_p): Ditto.
(software_breakpoint_inserted_here_p): Ditto.
(breakpoint_thread_match): Ditto.
(bpstat_check_location): Ditto.
(bpstat_stop_status): Ditto.
(print_breakpoint_location): If there's a location to print,
switch the current symbol space.
(print_one_breakpoint_location): Add `allflag' argument.
(print_one_breakpoint): Ditto. Adjust.
(do_captured_breakpoint_query): Adjust.
(breakpoint_1): Adjust.
(breakpoint_has_pc): Also match the symbol space.
(describe_other_breakpoints): Add a symbol space argument and
adjust.
(set_default_breakpoint): Add a symbol space argument. Set
default_breakpoint_sspace.
(breakpoint_address_match): New.
(check_duplicates_for): Add an address space argument, and adjust.
(set_raw_breakpoint): Record the symbol space in the location and
in the breakpoint.
(set_longjmp_breakpoint): Skip longjmp master breakpoints from
other symbol spaces.
(remove_thread_event_breakpoints, remove_solib_event_breakpoints)
(disable_breakpoints_in_shlibs): Skip breakpoints from other
symbol spaces.
(disable_breakpoints_in_unloaded_shlib): Match symbol spaces.
(create_catchpoint): Set the symbol space in the sal.
(disable_breakpoints_before_startup): Skip breakpoints from other
symbol spaces. Set executing_startup in the current symbol space.
(enable_breakpoints_after_startup): Clear executing_startup in the
current symbol space. Skip breakpoints from other symbol spaces.
(clone_momentary_breakpoint): Also copy the symbol space.
(add_location_to_breakpoint): Set the location's symbol space.
(bp_loc_is_permanent): Switch thread and symbol space.
(create_breakpoint): Adjust.
(expand_line_sal_maybe): Expand comment to mention symbol spaces.
Switch thread and symbol space when reading memory.
(parse_breakpoint_sals): Set the symbol space in the sal.
(break_command_really): Ditto.
(skip_prologue_sal): Switch and space.
(resolve_sal_pc): Ditto.
(watch_command_1): Record the symbol space in the sal.
(create_ada_exception_breakpoint): Adjust.
(clear_command): Adjust. Match symbol spaces.
(update_global_location_list): Use breakpoint_address_match.
(breakpoint_re_set_one): Switch thread and space.
(breakpoint_re_set): Save symbol space.
(breakpoint_re_set_thread): Also reset the symbol space.
(deprecated_insert_raw_breakpoint): Add an address space argument.
Adjust.
(insert_single_step_breakpoint): Ditto.
(single_step_breakpoint_inserted_here_p): Ditto.
(clear_syscall_counts): New.
(_initialize_breakpoint): Install it as inferior_exit observer.
* exec.h: Include "progspace.h".
(exec_bfd, exec_bfd_mtime): New defines.
(exec_close): Declare.
* exec.c: Include "gdbthread.h" and "progspace.h".
(exec_bfd, exec_bfd_mtime, current_target_sections_1): Delete.
(using_exec_ops): New.
(exec_close_1): Rename to exec_close, and make public.
(exec_close): Rename to exec_close_1, and adjust all callers. Add
description. Remove target sections and close executables from
all program spaces.
(exec_file_attach): Add comment.
(add_target_sections): Check on `using_exec_ops' to check if the
target should be pushed.
(remove_target_sections): Only unpush the target if there are no
more target sections in any symbol space.
* gdbcore.h: Include "exec.h".
(exec_bfd, exec_bfd_mtime): Remove declarations.
* frame.h (get_frame_program_space, get_frame_address_space)
(frame_unwind_program_space): Declare.
* frame.c (struct frame_info) <pspace, aspace>: New fields.
(create_sentinel_frame): Add program space argument. Set the
pspace and aspace fields of the frame object.
(get_current_frame, create_new_frame): Adjust.
(get_frame_program_space): New.
(frame_unwind_program_space): New.
(get_frame_address_space): New.
* stack.c (print_frame_info): Adjust.
(print_frame): Use the frame's program space.
* gdbthread.h (any_live_thread_of_process): Declare.
* thread.c (any_live_thread_of_process): New.
(switch_to_thread): Switch the program space as well.
(restore_selected_frame): Don't warn if trying to restore frame
level 0.
* inferior.h: Include "progspace.h".
(detach_fork): Declare.
(struct inferior) <removable, aspace, pspace>
<vfork_parent, vfork_child, pending_detach>
<waiting_for_vfork_done>: New fields.
<terminal_info>: Remove field.
<data, num_data>: New fields.
(register_inferior_data, register_inferior_data_with_cleanup)
(clear_inferior_data, set_inferior_data, inferior_data): Declare.
(exit_inferior, exit_inferior_silent, exit_inferior_num_silent)
(inferior_appeared): Declare.
(find_inferior_pid): Typo.
(find_inferior_id, find_inferior_for_program_space): Declare.
(set_current_inferior, save_current_inferior, prune_inferiors)
(number_of_inferiors): Declare.
(inferior_list): Declare.
* inferior.c: Include "gdbcore.h" and "symfile.h".
(inferior_list): Make public.
(delete_inferior_1): Always delete thread silently.
(find_inferior_id): Make public.
(current_inferior_): New.
(current_inferior): Use it.
(set_current_inferior): New.
(restore_inferior): New.
(save_current_inferior): New.
(free_inferior): Free the per-inferior data.
(add_inferior_silent): Allocate per-inferior data.
Call inferior_appeared.
(delete_threads_of_inferior): New.
(delete_inferior_1): Adjust interface to take an inferior pointer.
(delete_inferior): Adjust.
(delete_inferior_silent): Adjust.
(exit_inferior_1): New.
(exit_inferior): New.
(exit_inferior_silent): New.
(exit_inferior_num_silent): New.
(detach_inferior): Adjust.
(inferior_appeared): New.
(discard_all_inferiors): Adjust.
(find_inferior_id): Make public. Assert pid is not zero.
(find_inferior_for_program_space): New.
(have_inferiors): Check if we have any inferior with pid not zero.
(have_live_inferiors): Go over all pushed targets looking for
process_stratum.
(prune_inferiors): New.
(number_of_inferiors): New.
(print_inferior): Add executable column. Print vfork parent/child
relationships.
(inferior_command): Adjust to cope with not running inferiors.
(remove_inferior_command): New.
(add_inferior_command): New.
(clone_inferior_command): New.
(struct inferior_data): New.
(struct inferior_data_registration): New.
(struct inferior_data_registry): New.
(inferior_data_registry): New.
(register_inferior_data_with_cleanup): New.
(register_inferior_data): New.
(inferior_alloc_data): New.
(inferior_free_data): New.
(clear_inferior_data): New.
(set_inferior_data): New.
(inferior_data): New.
(initialize_inferiors): New.
(_initialize_inferiors): Register "add-inferior",
"remove-inferior" and "clone-inferior" commands.
* objfiles.h: Include "progspace.h".
(struct objfile) <pspace>: New field.
(symfile_objfile, object_files): Don't declare.
(ALL_PSPACE_OBJFILES): New.
(ALL_PSPACE_OBJFILES_SAFE): New.
(ALL_OBJFILES, ALL_OBJFILES_SAFE): Adjust.
(ALL_PSPACE_SYMTABS): New.
(ALL_PRIMARY_SYMTABS): Adjust.
(ALL_PSPACE_PRIMARY_SYMTABS): New.
(ALL_PSYMTABS): Adjust.
(ALL_PSPACE_PSYMTABS): New.
* objfiles.c (object_files, symfile_objfile): Delete.
(struct objfile_sspace_info): New.
(objfiles_pspace_data): New.
(objfiles_pspace_data_cleanup): New.
(get_objfile_pspace_data): New.
(objfiles_changed_p): Delete.
(allocate_objfile): Set the objfile's program space. Adjust to
reference objfiles_changed_p in pspace data.
(free_objfile): Adjust to reference objfiles_changed_p in pspace
data.
(objfile_relocate): Ditto.
(update_section_map): Add pspace argument. Adjust to iterate over
objfiles in the passed in pspace.
(find_pc_section): Delete sections and num_sections statics.
Adjust to refer to program space's objfiles_changed_p. Adjust to
refer to sections and num_sections store in the objfile's pspace
data.
(objfiles_changed): Adjust to reference objfiles_changed_p in
pspace data.
(_initialize_objfiles): New.
* linespec.c (decode_all_digits, decode_dollar): Set the sal's
program space.
* source.c (current_source_pspace): New.
(get_current_source_symtab_and_line): Set the sal's program space.
(set_current_source_symtab_and_line): Set current_source_pspace.
(select_source_symtab): Ditto. Use ALL_OBJFILES.
(forget_cached_source_info): Iterate over all program spaces.
* symfile.c (clear_symtab_users): Adjust.
* symmisc.c (print_symbol_bcache_statistics): Iterate over all
program spaces.
(print_objfile_statistics): Ditto.
(maintenance_print_msymbols): Ditto.
(maintenance_print_objfiles): Ditto.
(maintenance_info_symtabs): Ditto.
(maintenance_info_psymtabs): Ditto.
* symtab.h (SYMTAB_PSPACE): New.
(struct symtab_and_line) <pspace>: New field.
* symtab.c (init_sal): Clear the sal's program space.
(find_pc_sect_symtab): Set the sal's program space. Switch thread
and space.
(append_expanded_sal): Add program space argument. Iterate over
all program spaces.
(expand_line_sal): Iterate over all program spaces. Switch
program space.
* target.h (enum target_waitkind) <TARGET_WAITKIND_VFORK_DONE>: New.
(struct target_ops) <to_thread_address_space>: New field.
(target_thread_address_space): Define.
* target.c (target_detach): Only remove breakpoints from the
inferior we're detaching.
(target_thread_address_space): New.
* defs.h (initialize_progspace): Declare.
* top.c (gdb_init): Call it.
* solist.h (struct so_list) <sspace>: New field.
* solib.h (struct program_space): Forward declare.
(solib_name_from_address): Adjust prototype.
* solib.c (so_list_head): Replace with a macro referencing the
program space.
(update_solib_list): Set the so's program space.
(solib_name_from_address): Add a program space argument and adjust.
* solib-svr4.c (struct svr4_info) <pid>: Delete field.
<interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low>
<interp_plt_sect_high>: New fields.
(svr4_info_p, svr4_info): Delete.
(solib_svr4_sspace_data): New.
(get_svr4_info): Rewrite.
(svr4_sspace_data_cleanup): New.
(open_symbol_file_object): Adjust.
(svr4_default_sos): Adjust.
(svr4_fetch_objfile_link_map): Adjust.
(interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low)
(interp_plt_sect_high): Delete.
(svr4_in_dynsym_resolve_code): Adjust.
(enable_break): Adjust.
(svr4_clear_solib): Revert bit that removed the svr4_info here,
and reinstate clearing debug_base, debug_loader_offset_p,
debug_loader_offset and debug_loader_name.
(_initialize_svr4_solib): Register solib_svr4_pspace_data. Don't
install an inferior_exit observer anymore.
* printcmd.c (struct display) <pspace>: New field.
(display_command): Set the display's sspace.
(do_one_display): Match the display's sspace.
(display_uses_solib_p): Ditto.
* linux-fork.c (detach_fork): Moved to infrun.c.
(_initialize_linux_fork): Moved "detach-on-fork" command to
infrun.c.
* infrun.c (detach_fork): Moved from linux-fork.c.
(proceed_after_vfork_done): New.
(handle_vfork_child_exec_or_exit): New.
(follow_exec_mode_replace, follow_exec_mode_keep)
(follow_exec_mode_names, follow_exec_mode_string)
(show_follow_exec_mode_string): New.
(follow_exec): New. Reinstate the mark_breakpoints_out call.
Remove shared libraries before attaching new executable. If user
wants to keep the inferior, keep it.
(displaced_step_fixup): Adjust to pass an address space to the
breakpoints module.
(resume): Ditto.
(clear_proceed_status): In all-stop mode, always clear the proceed
status of all threads.
(prepare_to_proceed): Adjust to pass an address space to the
breakpoints module.
(proceed): Ditto.
(adjust_pc_after_break): Ditto.
(handle_inferior_event): When handling a process exit, switch the
program space to the inferior's that had exited. Call
handle_vfork_child_exec_or_exit. Adjust to pass an address space
to the breakpoints module. In non-stop mode, when following a
fork and detach-fork is off, also resume the other branch. Handle
TARGET_WAITKIND_VFORK_DONE. Set the program space in sals.
(normal_stop): Prune inferiors.
(_initialize_infrun): Install the new "follow-exec-mode" command.
"detach-on-fork" moved here.
* regcache.h (get_regcache_aspace): Declare.
* regcache.c (struct regcache) <aspace>: New field.
(regcache_xmalloc): Clear the aspace.
(get_regcache_aspace): New.
(regcache_cpy): Copy the aspace field.
(regcache_cpy_no_passthrough): Ditto.
(get_thread_regcache): Fetch the thread's address space from the
target, and store it in the regcache.
* infcall.c (call_function_by_hand): Set the sal's pspace.
* arch-utils.c (default_has_shared_address_space): New.
* arch-utils.h (default_has_shared_address_space): Declare.
* gdbarch.sh (has_shared_address_space): New.
* gdbarch.h, gdbarch.c: Regenerate.
* linux-tdep.c: Include auxv.h, target.h, elf/common.h.
(linux_has_shared_address_space): New.
(_initialize_linux_tdep): Declare.
* arm-tdep.c (arm_software_single_step): Pass the frame's address
space to insert_single_step_breakpoint.
* arm-linux-tdep.c (arm_linux_software_single_step): Pass the
frame's pspace to breakpoint functions.
* cris-tdep.c (crisv32_single_step_through_delay): Ditto.
(cris_software_single_step): Ditto.
* mips-tdep.c (deal_with_atomic_sequence): Add frame argument.
Pass the frame's pspace to breakpoint functions.
(mips_software_single_step): Adjust.
(mips_single_step_through_delay): Adjust.
* rs6000-aix-tdep.c (rs6000_software_single_step): Adjust.
* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust.
* solib-irix.c (enable_break): Adjust to pass the current frame's
address space to breakpoint functions.
* sparc-tdep.c (sparc_software_single_step): Ditto.
* spu-tdep.c (spu_software_single_step): Ditto.
* alpha-tdep.c (alpha_software_single_step): Ditto.
* record.c (record_wait): Adjust to pass an address space to the
breakpoints module.
* fork-child.c (fork_inferior): Set the new inferior's program and
address spaces.
* inf-ptrace.c (inf_ptrace_follow_fork): Copy the parent's program
and address spaces.
(inf_ptrace_attach): Set the inferior's program and address spaces.
* linux-nat.c: Include "solib.h".
(linux_child_follow_fork): Manage parent and child's program and
address spaces. Clone the parent's program space if necessary.
Don't wait for the vfork to be done here. Refuse to resume if
following the vfork parent while leaving the child stopped.
(resume_callback): Don't resume a vfork parent.
(linux_nat_resume): Also check for pending events in the
lp->waitstatus field.
(linux_handle_extended_wait): Report TARGET_WAITKIND_VFORK_DONE
events to the core.
(stop_wait_callback): Don't wait for SIGSTOP on vfork parents.
(cancel_breakpoint): Adjust.
* linux-thread-db.c (thread_db_wait): Don't remove thread event
breakpoints here.
(thread_db_mourn_inferior): Don't mark breakpoints out here.
Remove thread event breakpoints after mourning.
* corelow.c: Include progspace.h.
(core_open): Set the inferior's program and address spaces.
* remote.c (remote_add_inferior): Set the new inferior's program
and address spaces.
(remote_start_remote): Update address spaces.
(extended_remote_create_inferior_1): Don't init the thread list if
we already debugging other inferiors.
* darwin-nat.c (darwin_attach): Set the new inferior's program and
address spaces.
* gnu-nat.c (gnu_attach): Ditto.
* go32-nat.c (go32_create_inferior): Ditto.
* inf-ttrace.c (inf_ttrace_follow_fork, inf_ttrace_attach): Ditto.
* monitor.c (monitor_open): Ditto.
* nto-procfs.c (procfs_attach, procfs_create_inferior): Ditto.
* procfs.c (do_attach): Ditto.
* windows-nat.c (do_initial_windows_stuff): Ditto.
* inflow.c (inferior_process_group)
(terminal_init_inferior_with_pgrp, terminal_inferior,
(terminal_ours_1, inflow_inferior_exit, copy_terminal_info)
(child_terminal_info, new_tty_postfork, set_sigint_trap): Adjust
to use per-inferior data instead of inferior->terminal_info.
(inflow_inferior_data): New.
(inflow_new_inferior): Delete.
(inflow_inferior_data_cleanup): New.
(get_inflow_inferior_data): New.
* mi/mi-interp.c (mi_new_inferior): Rename to...
(mi_inferior_appeared): ... this.
(mi_interpreter_init): Adjust.
* tui/tui-disasm.c: Include "progspace.h".
(tui_set_disassem_content): Pass an address space to
breakpoint_here_p.
* NEWS: Mention multi-program debugging support. Mention new
commands "add-inferior", "clone-inferior", "remove-inferior",
"maint info program-spaces", and new option "set
follow-exec-mode".
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* observer.texi (new_inferior): Rename to...
(inferior_appeared): ... this.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/testsuite/
* gdb.base/foll-vfork.exp: Adjust to spell out "follow-fork".
* gdb.base/foll-exec.exp: Adjust to expect a process id before
"Executing new program".
* gdb.base/foll-fork.exp: Adjust to spell out "follow-fork".
* gdb.base/multi-forks.exp: Ditto. Adjust to the inferior being
left listed after having been killed.
* gdb.base/attach.exp: Adjust to spell out "symbol-file".
* gdb.base/maint.exp: Adjust test.
* Makefile.in (ALL_SUBDIRS): Add gdb.multi.
* gdb.multi/Makefile.in: New.
* gdb.multi/base.exp: New.
* gdb.multi/goodbye.c: New.
* gdb.multi/hangout.c: New.
* gdb.multi/hello.c: New.
* gdb.multi/bkpt-multi-exec.c: New.
* gdb.multi/bkpt-multi-exec.exp: New.
* gdb.multi/crashme.c: New.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* gdb.texinfo (Inferiors): Rename node to ...
(Inferiors and Programs): ... this. Mention running multiple
programs in the same debug session.
<info inferiors>: Mention the new 'Executable' column if "info
inferiors". Update examples. Document the "add-inferior",
"clone-inferior", "remove-inferior" and "maint info
program-spaces" commands.
(Process): Rename node to...
(Forks): ... this. Document "set|show follow-exec-mode".
2009-10-19 09:51:43 +00:00
-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:$bp_location6 sspace 1\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 $"\
2002-01-21 20:25:18 +00:00
{ pass "maint info breakpoints (with shlib events)" }
-re ".*$gdb_prompt $" { fail "maint info breakpoints" }
timeout { fail "(timeout) maint info breakpoints" }
1999-04-16 01:35:26 +00:00
}
send_gdb "maint print\n"
gdb_expect {
-re "\"maintenance print\" must be followed by the name of a print command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\
{ pass "maint print w/o args" }
-re ".*$gdb_prompt $" { fail "maint print w/o args" }
timeout { fail "(timeout) maint print w/o args" }
}
send_gdb "maint info\n"
gdb_expect {
-re "\"maintenance info\" must be followed by the name of an info command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\
{ pass "maint info w/o args" }
-re ".*$gdb_prompt $" { fail "maint info w/o args" }
timeout { fail "(timeout) maint info w/o args" }
}
send_gdb "maint\n"
gdb_expect {
-re "\"maintenance\" must be followed by the name of a maintenance command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\
{ pass "maint w/o args" }
-re ".*$gdb_prompt $" { fail "maint w/o args" }
timeout { fail "(timeout) maint w/o args" }
}
set timeout $oldtimeout
#============test help on maint commands
send_gdb "help maint\n"
gdb_expect {
2002-12-24 04:03:46 +00:00
-re "Commands for use by GDB maintainers\\..*Includes commands to dump specific internal GDB structures in.*a human readable form, to cause GDB to deliberately dump core,.*to test internal functions such as the C../ObjC demangler, etc\\..*List of maintenance subcommands:.*maintenance check-symtabs.*maintenance demangle.*(maintenance dump-me.*)?maintenance info.*maintenance internal-error.*maintenance print.*maintenance set.*maintenance show.*maintenance space.*maintenance time.*Type.*help maintenance.*followed by maintenance subcommand name for full documentation\\..*Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
1999-04-16 01:35:26 +00:00
{ pass "help maint" }
-re ".*$gdb_prompt $" { fail "help maint" }
timeout { fail "(timeout) help maint" }
}
send_gdb "help maint check-symtabs\n"
gdb_expect {
-re "Check consistency of psymtabs and symtabs\\..*$gdb_prompt $"\
{ pass "help maint check-symtabs" }
-re ".*$gdb_prompt $" { fail "help maint check-symtabs" }
timeout { fail "(timeout) help maint check-symtabs" }
}
send_gdb "help maint space\n"
gdb_expect {
-re "Set the display of space usage\\.\r\nIf nonzero, will cause the execution space for each command to be\r\ndisplayed, following the command's output\\..*$gdb_prompt $"\
{ pass "help maint space" }
-re ".*$gdb_prompt $" { fail "help maint space" }
timeout { fail "(timeout) help maint space" }
}
send_gdb "help maint time\n"
gdb_expect {
-re "Set the display of time usage\\.\r\nIf nonzero, will cause the execution time for each command to be\r\ndisplayed, following the command's output\\..*$gdb_prompt $"\
{ pass "help maint time" }
-re ".*$gdb_prompt $" { fail "help maint time" }
timeout { fail "(timeout) help maint time" }
}
send_gdb "help maint demangle\n"
gdb_expect {
2002-12-24 04:03:46 +00:00
-re "Demangle a C\\+\\+/ObjC mangled name\\.\r\nCall internal GDB demangler routine to demangle a C\\+\\+ link name\r\nand prints the result\\..*$gdb_prompt $"\
1999-04-16 01:35:26 +00:00
{ pass "help maint demangle" }
-re ".*$gdb_prompt $" { fail "help maint demangle" }
timeout { fail "(timeout) help maint demangle" }
}
send_gdb "help maint dump-me\n"
gdb_expect {
2002-11-22 04:31:21 +00:00
-re "Get fatal error; make debugger dump its core\\.\r\nGDB sets its handling of SIGQUIT back to SIG_DFL and then sends\r\nitself a SIGQUIT signal\\..*$gdb_prompt $"\
1999-04-16 01:35:26 +00:00
{ pass "help maint dump-me" }
-re ".*$gdb_prompt $" { fail "help maint dump-me" }
timeout { fail "(timeout) help maint dump-me" }
}
1999-08-16 19:57:19 +00:00
send_gdb "help maint internal-error\n"
gdb_expect {
-re "Give GDB an internal error\\.\r\nCause GDB to behave as if an internal error was detected\\..*$gdb_prompt $"\
{ pass "help maint internal-error" }
-re ".*$gdb_prompt $" { fail "help maint internal-error" }
timeout { fail "(timeout) help maint internal-error" }
}
2002-09-18 23:53:52 +00:00
send_gdb "help maint internal-warning\n"
gdb_expect {
-re "Give GDB an internal warning\\.\r\nCause GDB to behave as if an internal warning was reported\\..*$gdb_prompt $"\
{ pass "help maint internal-warning" }
-re ".*$gdb_prompt $" { fail "help maint internal-warning" }
timeout { fail "(timeout) help maint internal-warning" }
}
1999-04-16 01:35:26 +00:00
send_gdb "help maint print statistics\n"
gdb_expect {
-re "Print statistics about internal gdb state\\..*$gdb_prompt $"\
{ pass "help maint print statistics" }
-re ".*$gdb_prompt $" { fail "help maint print statistics" }
timeout { fail "(timeout) help maint print statistics" }
}
2003-05-05 18:33:11 +00:00
gdb_test "help maint print dummy-frames" \
"Print the contents of the internal dummy-frame stack."
1999-04-16 01:35:26 +00:00
send_gdb "help maint print objfiles\n"
gdb_expect {
-re "Print dump of current object file definitions\\..*$gdb_prompt $"\
{ pass "help maint print objfiles" }
-re ".*$gdb_prompt $" { fail "help maint print objfiles" }
timeout { fail "(timeout) help maint print objfiles" }
}
send_gdb "help maint print psymbols\n"
gdb_expect {
-re "Print dump of current partial symbol definitions\\.\r\nEntries in the partial symbol table are dumped to file OUTFILE\\.\r\nIf a SOURCE file is specified, dump only that file's partial symbols\\..*$gdb_prompt $"\
{ pass "help maint print psymbols" }
-re ".*$gdb_prompt $" { fail "help maint print psymbols" }
timeout { fail "(timeout) help maint print psymbols" }
}
send_gdb "help maint print msymbols\n"
gdb_expect {
-re "Print dump of current minimal symbol definitions\\.\r\nEntries in the minimal symbol table are dumped to file OUTFILE\\.\r\nIf a SOURCE file is specified, dump only that file's minimal symbols\\..*$gdb_prompt $"\
{ pass "help maint print msymbols" }
-re ".*$gdb_prompt $" { fail "help maint print msymbols" }
timeout { fail "(timeout) help maint print msymbols" }
}
send_gdb "help maint print symbols\n"
gdb_expect {
-re "Print dump of current symbol definitions\\.\r\nEntries in the full symbol table are dumped to file OUTFILE\\.\r\nIf a SOURCE file is specified, dump only that file's symbols\\..*$gdb_prompt $"\
{ pass "help maint print symbols" }
-re ".*$gdb_prompt $" { fail "help maint print symbols" }
timeout { fail "(timeout) help maint print symbols" }
}
send_gdb "help maint print type\n"
gdb_expect {
-re "Print a type chain for a given symbol\\.\r\nFor each node in a type chain, print the raw data for each member of\r\nthe type structure, and the interpretation of the data\\..*$gdb_prompt $"\
{ pass "help maint print type" }
-re ".*$gdb_prompt $" { fail "help maint print type" }
timeout { fail "(timeout) help maint print type" }
}
1999-08-02 23:48:37 +00:00
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" }
}
}
1999-04-16 01:35:26 +00:00
send_gdb "help maint info sections\n"
gdb_expect {
-re "List the BFD sections of the exec and core files\\..*$gdb_prompt $"\
{ pass "help maint info sections" }
-re ".*$gdb_prompt $" { fail "help maint info sections" }
timeout { fail "(timeout) help maint info sections" }
}
send_gdb "help maint info breakpoints\n"
gdb_expect {
-re "Status of all breakpoints, or breakpoint number NUMBER.*$gdb_prompt $" { pass "help maint info breakpoints" }
-re ".*$gdb_prompt $" { fail "help maint info breakpoints" }
timeout { fail "(timeout) help maint info breakpoints" }
}
#send_gdb "help maint info breakpoints\n"
#expect {
# -re "Status of all breakpoints, or breakpoint number NUMBER\\.\[ \r\n\t\]+The \"Type\" column indicates one of:\[ \r\n\t\]+breakpoint\[ \t\]+- normal breakpoint\[ \r\n\t\]+watchpoint\[ \t\]+- watchpoint\[ \r\n\t\]+longjmp\[ \t\]+- internal breakpoint used to step through longjmp\\(\\)\[ \r\n\t\]+longjmp resume - internal breakpoint at the target of longjmp\\(\\)\[ \r\n\t\]+until\[ \t\]+- internal breakpoint used by the \"until\" command\[ \r\n\t\]+finish\[ \t\]+- internal breakpoint used by the \"finish\" command\[ \r\n\t\]+The \"Disp\" column contains one of \"keep\", \"del\", or \"dis\" to indicate\[ \r\n\t\]+the disposition of the breakpoint after it gets hit\\. \"dis\" means that the\[ \r\n\t\]+breakpoint will be disabled\\. The \"Address\" and \"What\" columns indicate the\[ \r\n\t\]+address and file.line number respectively\\.\[ \r\n\t\]+Convenience variable \".*\" and default examine address for \"x\"\[ \r\n\t\]+are set to the address of the last breakpoint listed\\.\[ \r\n\t\]+Convenience variable \".bpnum\" contains the number of the last\[ \r\n\t\]+breakpoint set\\..*$gdb_prompt $"\
# { pass "help maint info breakpoints" }
# -re ".*$gdb_prompt $" { fail "help maint info breakpoints" }
# timeout { fail "(timeout) help maint info breakpoints" }
# }
send_gdb "help maint info\n"
gdb_expect {
-re "Commands for showing internal info about the program being debugged.*unambiguous\\..*$gdb_prompt $"\
{ pass "help maint info" }
-re ".*$gdb_prompt $" { fail "help maint info" }
timeout { fail "(timeout) help maint info" }
}
2006-11-10 16:58:53 +00:00
test_prefix_command_help {"maint print" "maintenance print"} {
"Maintenance command for printing GDB internal state\\.\[\r\n\]+"
}
1999-04-16 01:35:26 +00:00
2006-11-10 16:58:53 +00:00
test_prefix_command_help {"maint" "maintenance"} {
"Commands for use by GDB maintainers\\.\[\r\n\]+"
"Includes commands to dump specific internal GDB structures in\[\r\n\]+"
"a human readable form, to cause GDB to deliberately dump core,\[\r\n\]+"
"to test internal functions such as the C\\+\\+/ObjC demangler, etc\\.\[\r\n\]+"
}
1999-04-16 01:35:26 +00:00
#set oldtimeout $timeout
#set timeout [expr $timeout + 300]
send_gdb "maint dump-me\n"
gdb_expect {
-re "Should GDB dump core.*\\(y or n\\) $"\
{ send_gdb "n\n"
gdb_expect {
-re ".*$gdb_prompt $" { pass "maint dump-me" }
timeout { fail "(timeout) maint dump-me" }
}
}
-re ".*$gdb_prompt $" { fail "maint dump-me" }
timeout { fail "(timeout) maint dump-me" }
}
1999-08-16 19:57:19 +00:00
send_gdb "maint internal-error\n"
2003-11-20 15:36:34 +00:00
gdb_expect {
-re "A problem internal to GDB has been detected" {
pass "maint internal-error"
if [gdb_internal_error_resync] {
pass "internal-error resync"
} else {
fail "internal-error resync"
1999-08-16 19:57:19 +00:00
}
}
-re ".*$gdb_prompt $" {
fail "maint internal-error"
2003-11-20 15:36:34 +00:00
untested "internal-error resync"
1999-08-16 19:57:19 +00:00
}
timeout {
2003-11-20 15:36:34 +00:00
fail "maint internal-error (timeout)"
untested "internal-error resync"
1999-08-16 19:57:19 +00:00
}
}
1999-04-16 01:35:26 +00:00
#set timeout $oldtimeout
gdb_exit
return 0