diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-07-19 17:51:25 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-07-19 17:51:25 +0000 |
commit | c0edd9edadfe292d00ea18c410f73cafa2657beb (patch) | |
tree | 65c0dbd9e554f8e9aeb3af8151980d28802167ef /gdb/testsuite | |
parent | 3437afb19942280b83663ffbd0ff5e283d4744fb (diff) | |
download | gdb-c0edd9edadfe292d00ea18c410f73cafa2657beb.zip gdb-c0edd9edadfe292d00ea18c410f73cafa2657beb.tar.gz gdb-c0edd9edadfe292d00ea18c410f73cafa2657beb.tar.bz2 |
gdb/
Make core files the process_stratum.
* corefile.c (core_target): New variable.
(core_file_command): Remove variable t, use core_target.
* corelow.c (core_ops): Make it static.
(init_core_ops): Change to process_stratum. Initialize CORE_TARGET.
* defs.h (make_cleanup_unpush_target): New prototype.
* gdbarch.h: Regenerate.
* gdbarch.sh (core_pid_to_str): Remove core_stratum from its comment.
* gdbcore.h (core_target): New declaration.
* inf-ptrace.c (inf_ptrace_create_inferior, inf_ptrace_attach): New
variables ops_already_pushed and back_to. Use push_target,
make_cleanup_unpush_target and discard_cleanups calls.
* record.c (record_open): Replace core_stratum by a core_bfd check.
* target.c (target_is_pushed): New function.
(find_core_target): Remove.
* target.h (enum strata) <core_stratum>: Remove.
(target_is_pushed): New declaration.
(find_core_target): Remove declaration.
* tracepoint.c (init_tfile_ops) <to_stratum>: Remove comment.
* utils.c (do_unpush_target, make_cleanup_unpush_target): New functions.
gdb/doc/
Make core files the process_stratum.
* gdb.texinfo (Active Targets): Remove core_stratum. Include
record_stratum example.
gdb/testsuite/
Make core files the process_stratum.
* gdb.base/corefile.exp (run: load core again)
(run: sanity check we see the core file, run: with core)
(run: core file is cleared, attach: load core again)
(attach: sanity check we see the core file, attach: with core)
(attach: core file is cleared): New tests.
* gdb.base/coremaker.c (main): New parameters. Implement "sleep" argv.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/corefile.exp | 59 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/coremaker.c | 8 |
3 files changed, 76 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index e657676..e821f0e 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2010-07-19 Jan Kratochvil <jan.kratochvil@redhat.com> + + Make core files the process_stratum. + * gdb.base/corefile.exp (run: load core again) + (run: sanity check we see the core file, run: with core) + (run: core file is cleared, attach: load core again) + (attach: sanity check we see the core file, attach: with core) + (attach: core file is cleared): New tests. + * gdb.base/coremaker.c (main): New parameters. Implement "sleep" argv. + 2010-07-14 Ken Werner <ken.werner@de.ibm.com> * gdb.arch/altivec-abi.exp: New tests. diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp index 61040a6..09204e85 100644 --- a/gdb/testsuite/gdb.base/corefile.exp +++ b/gdb/testsuite/gdb.base/corefile.exp @@ -177,3 +177,62 @@ gdb_load ${binfile} gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp (reinit)" gdb_test "core" "No core file now." + + +# Test a run (start) command will clear any loaded core file. + +gdb_test "core-file $corefile" "Core was generated by .*" "run: load core again" +gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "run: sanity check we see the core file" + +set test "run: with core" +if [runto_main] { + pass $test +} else { + fail $test +} + +set test "run: core file is cleared" +gdb_test_multiple "info files" $test { + -re "\r\nLocal core dump file:\r\n.*\r\n$gdb_prompt $" { + fail $test + } + -re "\r\n$gdb_prompt $" { + pass $test + } +} + +gdb_exit + + +# Test an attach command will clear any loaded core file. + +if ![is_remote target] { + set test "attach: spawn sleep" + set res [remote_spawn host "$binfile sleep"]; + if { $res < 0 || $res == "" } { + fail $test + return + } + set pid [exp_pid -i $res] + # We don't care whether the program is still in the startup phase when we + # attach. + + gdb_start + + gdb_test "core-file $corefile" "Core was generated by .*" "attach: load core again" + gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "attach: sanity check we see the core file" + + gdb_test "attach $pid" "Attaching to process $pid\r\n.*" "attach: with core" + + set test "attach: core file is cleared" + gdb_test_multiple "info files" $test { + -re "\r\nLocal core dump file:\r\n.*\r\n$gdb_prompt $" { + fail $test + } + -re "\r\n$gdb_prompt $" { + pass $test + } + } + + gdb_exit +} diff --git a/gdb/testsuite/gdb.base/coremaker.c b/gdb/testsuite/gdb.base/coremaker.c index f336389..81ca4d5 100644 --- a/gdb/testsuite/gdb.base/coremaker.c +++ b/gdb/testsuite/gdb.base/coremaker.c @@ -133,8 +133,14 @@ func1 () func2 (); } -int main () +int +main (int argc, char **argv) { + if (argc == 2 && strcmp (argv[1], "sleep") == 0) + { + sleep (60); + return 0; + } mmapdata (); func1 (); return 0; |