]> git.pld-linux.org Git - packages/gdb.git/blobdiff - gdb-6.6-buildid-locate-core-as-arg.patch
- updated to 8.1.1
[packages/gdb.git] / gdb-6.6-buildid-locate-core-as-arg.patch
index ffe0b40588f370bbb8d9765ba130c5ae0dd38696..5d9792a86d61e3e12611746b4ad6da2be89d4246 100644 (file)
@@ -1,5 +1,13 @@
+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: print a more useful error message for "gdb core"
+
+FileName: 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 +39,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.
@@ -57,14 +62,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.6.90.20140127/gdb/exceptions.h
-===================================================================
---- gdb-7.6.90.20140127.orig/gdb/exceptions.h  2014-02-06 17:31:00.148529736 +0100
-+++ gdb-7.6.90.20140127/gdb/exceptions.h       2014-02-06 17:31:17.560548525 +0100
-@@ -97,6 +97,9 @@ enum errors {
-   /* An undefined command was executed.  */
-   UNDEFINED_COMMAND_ERROR,
+---
+ gdb/common/common-exceptions.h |  3 +++
+ gdb/exec.c                     | 22 +++++++++++++++---
+ gdb/main.c                     | 53 +++++++++++++++++++++++++++++++++++++++---
+ 3 files changed, 72 insertions(+), 6 deletions(-)
+
+diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h
+index 15c85e28ab..9fe2375bce 100644
+--- a/gdb/common/common-exceptions.h
++++ b/gdb/common/common-exceptions.h
+@@ -104,6 +104,9 @@ enum errors {
+      "_ERROR" is appended to the name.  */
+   MAX_COMPLETIONS_REACHED_ERROR,
  
 +  /* Attempt to load a core file as executable.  */
 +  IS_CORE_ERROR,
@@ -72,19 +82,19 @@ Index: gdb-7.6.90.20140127/gdb/exceptions.h
    /* Add more errors here.  */
    NR_ERRORS
  };
-Index: gdb-7.6.90.20140127/gdb/exec.c
-===================================================================
---- gdb-7.6.90.20140127.orig/gdb/exec.c        2014-02-06 17:30:58.266527708 +0100
-+++ gdb-7.6.90.20140127/gdb/exec.c     2014-02-06 17:31:00.149529737 +0100
-@@ -34,6 +34,7 @@
- #include "gdbthread.h"
+diff --git a/gdb/exec.c b/gdb/exec.c
+index c8c32ecc27..b329e2b834 100644
+--- a/gdb/exec.c
++++ b/gdb/exec.c
+@@ -35,6 +35,7 @@
  #include "progspace.h"
  #include "gdb_bfd.h"
+ #include "gcore.h"
 +#include "exceptions.h"
  
  #include <fcntl.h>
  #include "readline/readline.h"
-@@ -228,12 +229,27 @@ exec_file_attach (char *filename, int fr
+@@ -346,12 +347,27 @@ exec_file_attach (const char *filename, int from_tty)
  
        if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
        {
@@ -115,34 +125,34 @@ Index: gdb-7.6.90.20140127/gdb/exec.c
        }
  
        if (build_section_table (exec_bfd, &sections, &sections_end))
-Index: gdb-7.6.90.20140127/gdb/main.c
-===================================================================
---- gdb-7.6.90.20140127.orig/gdb/main.c        2014-02-06 17:30:58.267527709 +0100
-+++ gdb-7.6.90.20140127/gdb/main.c     2014-02-06 17:32:32.232629052 +0100
-@@ -307,6 +307,36 @@ typedef struct cmdarg {
- /* Define type VEC (cmdarg_s).  */
DEF_VEC_O (cmdarg_s);
+diff --git a/gdb/main.c b/gdb/main.c
+index 3c98787edb..17d35f4a8a 100644
+--- a/gdb/main.c
++++ b/gdb/main.c
+@@ -446,6 +446,37 @@ 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 (e, RETURN_MASK_ALL)
 +    {
 +      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.  */
@@ -151,12 +161,13 @@ Index: gdb-7.6.90.20140127/gdb/main.c
 +      }
 +      throw_exception (e);
 +    }
++  END_CATCH
 +}
 +
- static int
- captured_main (void *data)
+ static void
+ captured_main_1 (struct captured_main_args *context)
  {
-@@ -824,6 +854,8 @@ captured_main (void *data)
+@@ -882,6 +913,8 @@ captured_main_1 (struct captured_main_args *context)
        {
          symarg = argv[optind];
          execarg = argv[optind];
@@ -165,11 +176,11 @@ Index: gdb-7.6.90.20140127/gdb/main.c
          optind++;
        }
  
-@@ -987,11 +1019,25 @@ captured_main (void *data)
+@@ -1032,11 +1065,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).  */
@@ -185,12 +196,15 @@ Index: gdb-7.6.90.20140127/gdb/main.c
           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))
+-                              !batch_flag))
 +         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)
++      if (catch_command_errors (func, execarg, !batch_flag)
 +        && core_bfd == NULL)
-       catch_command_errors_const (symbol_file_add_main, symarg,
-                                   !batch_flag, RETURN_MASK_ALL);
+       catch_command_errors (symbol_file_add_main_adapter, symarg,
+                             !batch_flag);
      }
+-- 
+2.14.3
+
This page took 0.08809 seconds and 4 git commands to generate.