]> git.pld-linux.org Git - packages/gdb.git/blobdiff - gdb-6.6-buildid-locate-core-as-arg.patch
libinproctrace not built on %{arm}
[packages/gdb.git] / gdb-6.6-buildid-locate-core-as-arg.patch
index 11386580f41f8b67fc52121bba8c4d830266a51a..d182ae1c5ef45139d3b9d738d82ccc9ce3bc4dcd 100644 (file)
@@ -1,5 +1,11 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches <invalid@email.com>
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-6.6-buildid-locate-core-as-arg.patch
+
+;;=push+jan
+
 http://sourceware.org/ml/gdb-patches/2010-01/msg00558.html
-Subject: Re: [patch] print a more useful error message for "gdb core"
 
 [ Fixed up since the mail.  ]
 
@@ -31,16 +37,13 @@ autodetections.  The second command line argument
 (captured_main->pid_or_core_arg) is also autodetected (for PID or CORE) but
 neither "attach" accepts a core file nor "core-file" accepts a PID.
 
-
 The patch makes sense only with the build-id patchset so this is not submit
 for FSF GDB inclusion yet.  I am fine with your patch (+/- Hui Zhu's pending
 bfd_check_format_matches) as the patch below is its natural extension.
 
-
 Sorry for the delay,
 Jan
 
-
 2010-01-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * exceptions.h (enum errors <IS_CORE_ERROR>): New.
@@ -58,33 +61,19 @@ Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
        * exec.c (exec_file_attach): Print a more useful error message if the
        user did "gdb core".
 
-Index: gdb-7.7.50.20140609/gdb/exceptions.h
-===================================================================
---- gdb-7.7.50.20140609.orig/gdb/exceptions.h  2014-06-13 20:26:46.988804553 +0200
-+++ gdb-7.7.50.20140609/gdb/exceptions.h       2014-06-13 20:27:01.930820057 +0200
-@@ -100,6 +100,9 @@ enum errors {
-   /* Requested feature, method, mechanism, etc. is not supported.  */
-   NOT_SUPPORTED_ERROR,
+diff --git a/gdb/exec.c b/gdb/exec.c
+--- a/gdb/exec.c
++++ b/gdb/exec.c
+@@ -18,6 +18,8 @@
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
  
-+  /* Attempt to load a core file as executable.  */
-+  IS_CORE_ERROR,
-+
-   /* Add more errors here.  */
-   NR_ERRORS
- };
-Index: gdb-7.7.50.20140609/gdb/exec.c
-===================================================================
---- gdb-7.7.50.20140609.orig/gdb/exec.c        2014-06-13 20:26:44.831802315 +0200
-+++ gdb-7.7.50.20140609/gdb/exec.c     2014-06-13 20:27:17.282836454 +0200
-@@ -35,6 +35,7 @@
- #include "progspace.h"
- #include "gdb_bfd.h"
- #include "gcore.h"
+ #include "defs.h"
++#include "arch-utils.h"
 +#include "exceptions.h"
- #include <fcntl.h>
- #include "readline/readline.h"
-@@ -231,12 +232,27 @@ exec_file_attach (char *filename, int fr
+ #include "frame.h"
+ #include "inferior.h"
+ #include "target.h"
+@@ -345,12 +347,27 @@ exec_file_attach (const char *filename, int from_tty)
  
        if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
        {
@@ -101,62 +90,72 @@ Index: gdb-7.7.50.20140609/gdb/exec.c
          exec_close ();
 -        error (_("\"%s\": not in executable format: %s"),
 -               scratch_pathname,
--               gdb_bfd_errmsg (bfd_get_error (), matching));
+-               gdb_bfd_errmsg (bfd_get_error (), matching).c_str ());
 +
 +        if (is_core != 0)
 +          throw_error (IS_CORE_ERROR,
-+                 _("\"%s\" is a core file.\n"
-+                   "Please specify an executable to debug."),
-+                 scratch_pathname);
++                       _("\"%s\" is a core file.\n"
++                         "Please specify an executable to debug."),
++                       scratch_pathname);
 +        else
-+          error (_("\"%s\": not in executable format: %s"),
++          error (_("\"%ss\": not in executable format: %s"),
 +                 scratch_pathname,
-+                 gdb_bfd_errmsg (bfd_get_error (), matching));
++                 gdb_bfd_errmsg (bfd_get_error (), matching).c_str ());
        }
  
        if (build_section_table (exec_bfd, &sections, &sections_end))
-Index: gdb-7.7.50.20140609/gdb/main.c
-===================================================================
---- gdb-7.7.50.20140609.orig/gdb/main.c        2014-06-13 20:26:44.831802315 +0200
-+++ gdb-7.7.50.20140609/gdb/main.c     2014-06-13 20:26:46.990804555 +0200
-@@ -341,6 +341,36 @@ typedef struct cmdarg {
- /* Define type VEC (cmdarg_s).  */
- DEF_VEC_O (cmdarg_s);
+diff --git a/gdb/gdbsupport/common-exceptions.h b/gdb/gdbsupport/common-exceptions.h
+--- a/gdb/gdbsupport/common-exceptions.h
++++ b/gdb/gdbsupport/common-exceptions.h
+@@ -106,6 +106,9 @@ enum errors {
+      "_ERROR" is appended to the name.  */
+   MAX_COMPLETIONS_REACHED_ERROR,
++  /* Attempt to load a core file as executable.  */
++  IS_CORE_ERROR,
++
+   /* Add more errors here.  */
+   NR_ERRORS
+ };
+diff --git a/gdb/main.c b/gdb/main.c
+--- a/gdb/main.c
++++ b/gdb/main.c
+@@ -467,6 +467,34 @@ struct cmdarg
+   char *string;
+ };
  
 +/* Call exec_file_attach.  If it detected FILENAME is a core file call
 +   core_file_command.  Print the original exec_file_attach error only if
 +   core_file_command failed to find a matching executable.  */
 +
 +static void
-+exec_or_core_file_attach (char *filename, int from_tty)
++exec_or_core_file_attach (const char *filename, int from_tty)
 +{
-+  volatile struct gdb_exception e;
-+
 +  gdb_assert (exec_bfd == NULL);
 +
-+  TRY_CATCH (e, RETURN_MASK_ALL)
++  try
 +    {
 +      exec_file_attach (filename, from_tty);
 +    }
-+  if (e.reason < 0)
++  catch (gdb_exception_error &e)
 +    {
 +      if (e.error == IS_CORE_ERROR)
 +      {
-+        core_file_command (filename, from_tty);
++        core_file_command ((char *) filename, from_tty);
 +
 +        /* Iff the core file found its executable suppress the error message
 +           from exec_file_attach.  */
 +        if (exec_bfd != NULL)
 +          return;
 +      }
-+      throw_exception (e);
++      throw_exception (std::move (e));
 +    }
 +}
 +
- static int
- captured_main (void *data)
+ static void
+ captured_main_1 (struct captured_main_args *context)
  {
-@@ -854,6 +884,8 @@ captured_main (void *data)
+@@ -907,6 +935,8 @@ captured_main_1 (struct captured_main_args *context)
        {
          symarg = argv[optind];
          execarg = argv[optind];
@@ -165,11 +164,11 @@ Index: gdb-7.7.50.20140609/gdb/main.c
          optind++;
        }
  
-@@ -1017,11 +1049,25 @@ captured_main (void *data)
+@@ -1063,12 +1093,25 @@ captured_main_1 (struct captured_main_args *context)
        && symarg != NULL
        && strcmp (execarg, symarg) == 0)
      {
-+      catch_command_errors_ftype *func;
++      catch_command_errors_const_ftype *func;
 +
 +      /* Call exec_or_core_file_attach only if the file was specified as
 +       a command line argument (and not an a command line option).  */
@@ -184,13 +183,14 @@ Index: gdb-7.7.50.20140609/gdb/main.c
        /* The exec file and the symbol-file are the same.  If we can't
           open it, better only print one error message.
 -         catch_command_errors returns non-zero on success!  */
--      if (catch_command_errors (exec_file_attach, execarg,
--                              !batch_flag, RETURN_MASK_ALL))
+-      ret = catch_command_errors (exec_file_attach, execarg,
+-                                !batch_flag);
+-      if (ret != 0)
 +         catch_command_errors returns non-zero on success!
 +       Do not load EXECARG as a symbol file if it has been already processed
 +       as a core file.  */
-+      if (catch_command_errors (func, execarg, !batch_flag, RETURN_MASK_ALL)
-+        && core_bfd == NULL)
-       catch_command_errors_const (symbol_file_add_main, symarg,
-                                   !batch_flag, RETURN_MASK_ALL);
++      ret = catch_command_errors (func, execarg, !batch_flag);
++      if (ret != 0 && core_bfd == NULL)
+       ret = catch_command_errors (symbol_file_add_main_adapter,
+                                   symarg, !batch_flag);
      }
This page took 0.04369 seconds and 4 git commands to generate.