Avoid producing broken non-native core files
authorMaciej W. Rozycki <macro@codesourcery.com>
Thu, 24 Oct 2013 19:37:49 +0000 (20:37 +0100)
committerTom Tromey <tromey@sourceware.org>
Fri, 25 Oct 2013 14:03:00 +0000 (14:03 +0000)
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.

gdb/ChangeLog
gdb/linux-tdep.c
gdb/testsuite/ChangeLog
gdb/testsuite/lib/gdb.exp

index 64660282b5da9f3d8ff1b623891d2996e346a560..b0b6ff8b5275d154cd9b361f5d7d10ab245ac224 100644 (file)
@@ -1,3 +1,8 @@
+2013-10-24  Maciej W. Rozycki  <macro@codesourcery.com>
+
+       * linux-tdep.c (linux_corefile_thread_callback): Propagate any
+       failure from register information collection.
+
 2013-10-24  Maciej W. Rozycki  <macro@codesourcery.com>
 
        * linux-tdep.c (linux_corefile_thread_data): Remove `num_notes'
index 5bca07666b7cf35b0e4b2c4624f496ed4e6f9f91..304fe0936e8a701fd6d799f0742e40da0684bf42 100644 (file)
@@ -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);
     }
index 1edfc930db5decbd20f6bee132be3e92fc0c9c2f..003208dfa6abeda72dc0b2fd037c0080094a732f 100644 (file)
@@ -1,3 +1,8 @@
+2013-10-24  Maciej W. Rozycki  <macro@codesourcery.com>
+
+       * lib/gdb.exp (gdb_gcore_cmd): Also handle a "Target does not
+       support core file generation" reply.
+
 2013-10-21  Jose E. Marchesi  <jose.marchesi@oracle.com>
 
        PR gdb/15986
index bde4e4888575094f27229337176a520df43a4d9b..e4a613422bbfd80b7d7222ff630f7fc0d9787649 100644 (file)
@@ -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
        }
     }