From: Maciej W. Rozycki Date: Thu, 24 Oct 2013 19:37:49 +0000 (+0100) Subject: Avoid producing broken non-native core files X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bbe769cc07aa1b1b0f4ede05c189a2d9897603bb;p=binutils-gdb.git Avoid producing broken non-native core files gdb/ * linux-tdep.c (linux_corefile_thread_callback): Propagate any failure from register information collection. gdb/testsuite/ * lib/gdb.exp (gdb_gcore_cmd): Also handle a "Target does not support core file generation" reply. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 64660282b5d..b0b6ff8b527 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2013-10-24 Maciej W. Rozycki + + * linux-tdep.c (linux_corefile_thread_callback): Propagate any + failure from register information collection. + 2013-10-24 Maciej W. Rozycki * linux-tdep.c (linux_corefile_thread_data): Remove `num_notes' diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 5bca07666b7..304fe0936e8 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -1209,14 +1209,15 @@ linux_corefile_thread_callback (struct thread_info *info, void *data) args->note_data, args->note_size, args->stop_signal); - if (siginfo_data != NULL) - { + /* Don't return anything if we got no register information above, + such a core file is useless. */ + if (args->note_data != NULL) + if (siginfo_data != NULL) args->note_data = elfcore_write_note (args->obfd, args->note_data, args->note_size, "CORE", NT_SIGINFO, siginfo_data, siginfo_size); - } do_cleanups (old_chain); } diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1edfc930db5..003208dfa6a 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-10-24 Maciej W. Rozycki + + * lib/gdb.exp (gdb_gcore_cmd): Also handle a "Target does not + support core file generation" reply. + 2013-10-21 Jose E. Marchesi PR gdb/15986 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index bde4e488857..e4a613422bb 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -3183,7 +3183,7 @@ proc gdb_gcore_cmd {core test} { verbose -log "'gcore' command undefined in gdb_gcore_cmd" } - -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" { + -re "(?:Can't create a corefile|Target does not support core file generation\\.)\[\r\n\]+$gdb_prompt $" { unsupported $test } }