* gdb.threads/gcore-thread.exp: Use gdb_gcore_cmd.
* gdb.python/py-strfns.exp (test_strfns_core_file): Use gdb_gcore_cmd. * gdb.cell/gcore.exp: Use gdb_gcore_cmd. * gdb.base/gcore.exp: Use gdb_gcore_cmd. * gdb.base/gcore-relro.exp: Use gdb_gcore_cmd. * gdb.base/gcore-buffer-overflow.exp: Use gdb_gcore_cmd. * gdb.base/auxv.exp: Use gdb_gcore_cmd. * gdb.arch/vsx-regs.exp: Use gdb_gcore_cmd. * gdb.arch/system-gcore.exp: Use gdb_gcore_cmd. * gdb.arch/pa-nullify.exp (test_core_bt): Use gdb_gcore_cmd. * lib/gdb.exp (gdb_gcore_cmd): New proc.
This commit is contained in:
parent
234fa27ce0
commit
2d338fa948
@ -1,3 +1,18 @@
|
||||
2012-11-06 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* gdb.threads/gcore-thread.exp: Use gdb_gcore_cmd.
|
||||
* gdb.python/py-strfns.exp (test_strfns_core_file): Use
|
||||
gdb_gcore_cmd.
|
||||
* gdb.cell/gcore.exp: Use gdb_gcore_cmd.
|
||||
* gdb.base/gcore.exp: Use gdb_gcore_cmd.
|
||||
* gdb.base/gcore-relro.exp: Use gdb_gcore_cmd.
|
||||
* gdb.base/gcore-buffer-overflow.exp: Use gdb_gcore_cmd.
|
||||
* gdb.base/auxv.exp: Use gdb_gcore_cmd.
|
||||
* gdb.arch/vsx-regs.exp: Use gdb_gcore_cmd.
|
||||
* gdb.arch/system-gcore.exp: Use gdb_gcore_cmd.
|
||||
* gdb.arch/pa-nullify.exp (test_core_bt): Use gdb_gcore_cmd.
|
||||
* lib/gdb.exp (gdb_gcore_cmd): New proc.
|
||||
|
||||
2012-11-05 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* gdb.base/foll-vfork.exp (vfork_relations_in_info_inferiors): New
|
||||
|
@ -107,26 +107,8 @@ gdb_test "stepi" "in main.*" "stepi to main"
|
||||
|
||||
proc gen_core { test } {
|
||||
global gcorefile
|
||||
global gdb_prompt
|
||||
set gcore_works 0
|
||||
set escapedfilename [string_to_regexp $gcorefile]
|
||||
|
||||
# gcore is not yet implemented for HPUX
|
||||
setup_xfail hppa*-*-hpux*
|
||||
|
||||
gdb_test_multiple "gcore $gcorefile" "$test: gcore" {
|
||||
-re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
|
||||
pass "$test: gcore"
|
||||
set gcore_works 1
|
||||
}
|
||||
-re "Undefined command.*$gdb_prompt $" {
|
||||
fail "$test: gcore (undefined command)"
|
||||
}
|
||||
-re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
|
||||
fail "$test: gcore (can't create corefile)"
|
||||
}
|
||||
}
|
||||
|
||||
set gcore_works [gdb_gcore_cmd $gcorefile "$test: gcore"]
|
||||
return $gcore_works
|
||||
}
|
||||
|
||||
|
@ -95,23 +95,8 @@ set pre_corefile_local_array \
|
||||
set pre_corefile_extern_array \
|
||||
[capture_command_output "print extern_array" "$print_prefix"]
|
||||
|
||||
set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
|
||||
|
||||
set core_supported 0
|
||||
gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \
|
||||
"save a corefile" \
|
||||
{
|
||||
-re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
|
||||
pass "save a corefile"
|
||||
global core_supported
|
||||
set core_supported 1
|
||||
}
|
||||
-re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
|
||||
unsupported "save a corefile"
|
||||
global core_supported
|
||||
set core_supported 0
|
||||
}
|
||||
}
|
||||
set core_supported [gdb_gcore_cmd "${objdir}/${subdir}/gcore.test" \
|
||||
"save a corefile"]
|
||||
|
||||
if {!$core_supported} {
|
||||
return -1
|
||||
|
@ -128,24 +128,8 @@ for {set i 0} {$i < 32} {incr i 1} {
|
||||
# later when loading the core file (i.e., different register values for different
|
||||
# vector register banks).
|
||||
|
||||
set escapedfilename [string_to_regexp ${objdir}/${subdir}/vsx-core.test]
|
||||
|
||||
set core_supported 0
|
||||
|
||||
gdb_test_multiple "gcore ${objdir}/${subdir}/vsx-core.test" \
|
||||
"Save a VSX-enabled corefile" \
|
||||
{
|
||||
-re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
|
||||
pass "Save a VSX-enabled corefile"
|
||||
global core_supported
|
||||
set core_supported 1
|
||||
}
|
||||
-re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
|
||||
unsupported "Save a VSX-enabled corefile"
|
||||
global core_supported
|
||||
set core_supported 0
|
||||
}
|
||||
}
|
||||
set core_supported [gdb_gcore_cmd "${objdir}/${subdir}/vsx-core.test" \
|
||||
"Save a VSX-enabled corefile"]
|
||||
|
||||
# Now run the F32~F63/VR0~VR31 tests.
|
||||
|
||||
|
@ -127,20 +127,7 @@ proc fetch_auxv {test} {
|
||||
set live_data [fetch_auxv "info auxv on live process"]
|
||||
|
||||
# Now try gcore.
|
||||
set gcore_works 0
|
||||
set escapedfilename [string_to_regexp $gcorefile]
|
||||
gdb_test_multiple "gcore $gcorefile" "gcore" {
|
||||
-re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
|
||||
pass "gcore"
|
||||
set gcore_works 1
|
||||
}
|
||||
-re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
|
||||
unsupported "gcore"
|
||||
}
|
||||
-re "Undefined command: .*\[\r\n\]+$gdb_prompt $" {
|
||||
unsupported "gcore"
|
||||
}
|
||||
}
|
||||
set gcore_works [gdb_gcore_cmd "$gcorefile" "gcore"]
|
||||
|
||||
# Let the program continue and die.
|
||||
gdb_test continue ".*Program received signal.*"
|
||||
|
@ -55,17 +55,4 @@ if { ! [ runto_main ] } then {
|
||||
return -1
|
||||
}
|
||||
|
||||
set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore-buffer-overflow.test]
|
||||
|
||||
set test "save a corefile"
|
||||
gdb_test_multiple "gcore ${objdir}/${subdir}/gcore-buffer-overflow.test" $test {
|
||||
-re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
|
||||
pass $test
|
||||
}
|
||||
-re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
|
||||
unsupported $test
|
||||
}
|
||||
eof {
|
||||
fail $test
|
||||
}
|
||||
}
|
||||
gdb_gcore_cmd "${objdir}/${subdir}/gcore-buffer-overflow.test" "save a corefile"
|
||||
|
@ -55,17 +55,8 @@ if ![runto lib] {
|
||||
return -1
|
||||
}
|
||||
|
||||
set escapedfilename [string_to_regexp ${gcorefile}]
|
||||
|
||||
set test "save a corefile"
|
||||
gdb_test_multiple "gcore ${gcorefile}" $test {
|
||||
-re "Saved corefile ${escapedfilename}\r\n$gdb_prompt $" {
|
||||
pass $test
|
||||
}
|
||||
-re "Can't create a corefile\r\n$gdb_prompt $" {
|
||||
unsupported $test
|
||||
return -1
|
||||
}
|
||||
if {![gdb_gcore_cmd $gcorefile "save a corefile"]} {
|
||||
return -1
|
||||
}
|
||||
|
||||
# Now restart gdb and load the corefile.
|
||||
|
@ -85,24 +85,8 @@ set pre_corefile_local_array \
|
||||
set pre_corefile_extern_array \
|
||||
[capture_command_output "print extern_array" "$print_prefix"]
|
||||
|
||||
set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
|
||||
|
||||
set core_supported 0
|
||||
gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \
|
||||
"save a corefile" \
|
||||
{
|
||||
-re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
|
||||
pass "save a corefile"
|
||||
global core_supported
|
||||
set core_supported 1
|
||||
}
|
||||
-re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
|
||||
unsupported "save a corefile"
|
||||
global core_supported
|
||||
set core_supported 0
|
||||
}
|
||||
}
|
||||
|
||||
set core_supported [gdb_gcore_cmd "${objdir}/${subdir}/gcore.test" \
|
||||
"save a corefile"]
|
||||
if {!$core_supported} {
|
||||
return -1
|
||||
}
|
||||
|
@ -69,21 +69,11 @@ delete_breakpoints
|
||||
|
||||
gdb_test "continue" ".*Aborted.*"
|
||||
|
||||
set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
|
||||
|
||||
gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \
|
||||
"save a corefile" \
|
||||
{
|
||||
-re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
|
||||
pass "save a corefile"
|
||||
}
|
||||
-re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
|
||||
unsupported "save a corefile"
|
||||
if {![gdb_gcore_cmd "${objdir}/${subdir}/gcore.test" \
|
||||
"save a corefile"]} {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Now restart gdb and load the corefile.
|
||||
gdb_exit
|
||||
gdb_start
|
||||
|
@ -67,20 +67,11 @@ proc test_strfns_core_file { } {
|
||||
global objdir subdir gdb_prompt testfile
|
||||
|
||||
set filename "${objdir}/${subdir}/py-strfns.core"
|
||||
set escapedfilename [string_to_regexp $filename]
|
||||
|
||||
gdb_test_multiple "gcore $filename" \
|
||||
"save a corefile" \
|
||||
{
|
||||
-re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
|
||||
pass "save a corefile"
|
||||
}
|
||||
-re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
|
||||
unsupported "save a corefile"
|
||||
# No use proceeding from here.
|
||||
return
|
||||
}
|
||||
}
|
||||
if {![gdb_gcore_cmd "$filename" "save a corefile"]} {
|
||||
# No use proceeding from here.
|
||||
return
|
||||
}
|
||||
|
||||
clean_restart $testfile
|
||||
|
||||
|
@ -91,20 +91,8 @@ delete_breakpoints
|
||||
gdb_breakpoint "thread2"
|
||||
gdb_test "continue" "Continuing.*Breakpoint.* thread2 .*" "thread 2 is running"
|
||||
|
||||
set escapedfilename [string_to_regexp $corefile]
|
||||
# Drop corefile
|
||||
set core_supported 0
|
||||
gdb_test_multiple "gcore $corefile" "save a corefile" \
|
||||
{
|
||||
-re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
|
||||
pass "save a corefile"
|
||||
global core_supported
|
||||
set core_supported 1
|
||||
}
|
||||
-re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
|
||||
unsupported "save a corefile"
|
||||
}
|
||||
}
|
||||
set core_supported [gdb_gcore_cmd "$corefile" "save a corefile"]
|
||||
|
||||
if {!$core_supported} {
|
||||
return -1
|
||||
|
@ -3026,6 +3026,36 @@ proc gdb_load_cmd { args } {
|
||||
return -1
|
||||
}
|
||||
|
||||
# Invoke "gcore". CORE is the name of the core file to write. TEST
|
||||
# is the name of the test case. This will return 1 if the core file
|
||||
# was created, 0 otherwise. If this fails to make a core file because
|
||||
# this configuration of gdb does not support making core files, it
|
||||
# will call "unsupported", not "fail". However, if this fails to make
|
||||
# a core file for some other reason, then it will call "fail".
|
||||
|
||||
proc gdb_gcore_cmd {core test} {
|
||||
global gdb_prompt
|
||||
|
||||
set result 0
|
||||
gdb_test_multiple "gcore $core" $test {
|
||||
-re "Saved corefile .*\[\r\n\]+$gdb_prompt $" {
|
||||
pass $test
|
||||
set result 1
|
||||
}
|
||||
|
||||
-re "Undefined command.*$gdb_prompt $" {
|
||||
unsupported $test
|
||||
verbose -log "'gcore' command undefined in gdb_gcore_cmd"
|
||||
}
|
||||
|
||||
-re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
|
||||
unsupported $test
|
||||
}
|
||||
}
|
||||
|
||||
return $result
|
||||
}
|
||||
|
||||
# Return the filename to download to the target and load on the target
|
||||
# for this shared library. Normally just LIBNAME, unless shared libraries
|
||||
# for this target have separate link and load images.
|
||||
|
Loading…
Reference in New Issue
Block a user