]> git.pld-linux.org Git - packages/gdb.git/blobdiff - gdb-6.8-bz254229-gcore-prpsinfo.patch
release 1.
[packages/gdb.git] / gdb-6.8-bz254229-gcore-prpsinfo.patch
index b5eb514003fc33d8bf9434ef034c54f89c5b678c..51071f480476f262b6c9675b9177dbfc9e549db9 100644 (file)
@@ -1,8 +1,8 @@
-Index: gdb-7.2.50.20110320/bfd/elf-bfd.h
+Index: gdb-7.4.50.20120602/bfd/elf-bfd.h
 ===================================================================
---- gdb-7.2.50.20110320.orig/bfd/elf-bfd.h     2011-03-20 15:17:42.000000000 +0100
-+++ gdb-7.2.50.20110320/bfd/elf-bfd.h  2011-03-20 15:24:02.000000000 +0100
-@@ -2193,8 +2193,10 @@ extern Elf_Internal_Phdr * _bfd_elf_find
+--- gdb-7.4.50.20120602.orig/bfd/elf-bfd.h     2012-06-02 21:26:09.928717069 +0200
++++ gdb-7.4.50.20120602/bfd/elf-bfd.h  2012-06-02 21:27:21.727689625 +0200
+@@ -2221,8 +2221,10 @@ extern Elf_Internal_Phdr * _bfd_elf_find
  /* Exported interface for writing elf corefile notes. */
  extern char *elfcore_write_note
    (bfd *, char *, int *, const char *, int, const void *, int);
@@ -14,17 +14,11 @@ Index: gdb-7.2.50.20110320/bfd/elf-bfd.h
  extern char *elfcore_write_prstatus
    (bfd *, char *, int *, long, int, const void *);
  extern char * elfcore_write_pstatus
-Index: gdb-7.2.50.20110320/bfd/elf.c
+Index: gdb-7.4.50.20120602/bfd/elf.c
 ===================================================================
---- gdb-7.2.50.20110320.orig/bfd/elf.c 2011-03-20 15:17:42.000000000 +0100
-+++ gdb-7.2.50.20110320/bfd/elf.c      2011-03-20 15:24:02.000000000 +0100
-@@ -8814,13 +8814,12 @@ elfcore_write_note (bfd *abfd,
-   return buf;
- }
--#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
-+#if defined (HAVE_PRPSINFO_T)
- char *
+--- gdb-7.4.50.20120602.orig/bfd/elf.c 2012-06-02 21:26:09.928717069 +0200
++++ gdb-7.4.50.20120602/bfd/elf.c      2012-06-02 21:27:21.732689623 +0200
+@@ -8917,56 +8917,61 @@ char *
  elfcore_write_prpsinfo (bfd  *abfd,
                        char *buf,
                        int  *bufsiz,
@@ -32,9 +26,8 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
 -                      const char *psargs)
 +                      const prpsinfo_t *input)
  {
-   const char *note_name = "CORE";
    const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-@@ -8828,48 +8827,55 @@ elfcore_write_prpsinfo (bfd  *abfd,
    if (bed->elf_backend_write_core_note != NULL)
      {
        char *ret;
@@ -52,7 +45,9 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
        return ret;
      }
  
+-#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
 -#if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T)
++#if defined (HAVE_PRPSINFO_T)
 +#if defined (HAVE_PRPSINFO32_T)
    if (bed->s->elfclass == ELFCLASS32)
      {
@@ -64,7 +59,7 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
        int note_type = NT_PRPSINFO;
 -#endif
  
-       memset (&data, 0, sizeof (data));
+-      memset (&data, 0, sizeof (data));
 -      strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
 -      strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
 +      data.pr_state = input->pr_state;
@@ -83,7 +78,7 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
 +      BFD_ASSERT (sizeof (data.pr_psargs) == sizeof (input->pr_psargs));
 +      memcpy (data.pr_psargs, input->pr_psargs, sizeof (data.pr_psargs));
        return elfcore_write_note (abfd, buf, bufsiz,
-                                note_name, note_type, &data, sizeof (data));
+                                "CORE", note_type, &data, sizeof (data));
      }
    else
  #endif
@@ -100,21 +95,40 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
 -      strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
 -      strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
        return elfcore_write_note (abfd, buf, bufsiz,
--                               note_name, note_type, &data, sizeof (data));
-+                               note_name, note_type, input, sizeof (*input));
+-                               "CORE", note_type, &data, sizeof (data));
++                               "CORE", note_type, input, sizeof (*input));
      }
- }
 -#endif        /* PSINFO_T or PRPSINFO_T */
 +#endif        /* PRPSINFO_T */
  
- #if defined (HAVE_PRSTATUS_T)
- char *
-Index: gdb-7.2.50.20110320/gdb/linux-nat.c
+   free (buf);
+   return NULL;
+Index: gdb-7.4.50.20120602/gdb/procfs.c
+===================================================================
+--- gdb-7.4.50.20120602.orig/gdb/procfs.c      2012-06-02 21:26:09.928717069 +0200
++++ gdb-7.4.50.20120602/gdb/procfs.c   2012-06-02 21:27:21.745689618 +0200
+@@ -5541,6 +5541,7 @@ procfs_make_note_section (bfd *obfd, int
+   note_data = (char *) elfcore_write_prpsinfo (obfd,
+                                              note_data,
+                                              note_size,
++                                             NULL,
+                                              fname,
+                                              psargs);
+Index: gdb-7.4.50.20120602/gdb/linux-tdep.c
 ===================================================================
---- gdb-7.2.50.20110320.orig/gdb/linux-nat.c   2011-03-20 15:17:46.000000000 +0100
-+++ gdb-7.2.50.20110320/gdb/linux-nat.c        2011-03-20 15:25:36.000000000 +0100
-@@ -4603,6 +4603,131 @@ linux_spu_make_corefile_notes (bfd *obfd
-   return args.note_data;
+--- gdb-7.4.50.20120602.orig/gdb/linux-tdep.c  2012-06-02 21:26:09.928717069 +0200
++++ gdb-7.4.50.20120602/gdb/linux-tdep.c       2012-06-02 21:31:12.051601510 +0200
+@@ -30,6 +30,7 @@
+ #include "elf-bfd.h"            /* for elfcore_write_* */
+ #include "inferior.h"
+ #include "cli/cli-utils.h"
++#include <sys/procfs.h>
+ #include <ctype.h>
+@@ -769,6 +770,131 @@ linux_corefile_thread_callback (struct t
+   return !args->note_data;
  }
  
 +/* Should be always true for Linux */
@@ -245,45 +259,22 @@ Index: gdb-7.2.50.20110320/gdb/linux-nat.c
  /* Fills the "to_make_corefile_note" target vector.  Builds the note
     section for a corefile, and returns it in a malloc buffer.  */
  
-@@ -4621,26 +4746,11 @@ linux_nat_make_corefile_notes (bfd *obfd
+@@ -784,16 +910,9 @@ linux_make_corefile_notes (struct gdbarc
+   /* Process information.  */
    if (get_exec_file (0))
      {
--      strncpy (fname, lbasename (get_exec_file (0)), sizeof (fname));
--      strncpy (psargs, get_exec_file (0), sizeof (psargs));
--      if (get_inferior_args ())
--      {
--        char *string_end;
--        char *psargs_end = psargs + sizeof (psargs);
--
--        /* linux_elfcore_write_prpsinfo () handles zero unterminated
--           strings fine.  */
--        string_end = memchr (psargs, 0, sizeof (psargs));
--        if (string_end != NULL)
--          {
--            *string_end++ = ' ';
--            strncpy (string_end, get_inferior_args (),
--                     psargs_end - string_end);
--          }
--      }
+-      const char *fname = lbasename (get_exec_file (0));
+-      char *psargs = xstrdup (fname);
 +      const prpsinfo_t *data = fill_prpsinfo ();
-+
-       note_data = (char *) elfcore_write_prpsinfo (obfd,
-                                                  note_data,
--                                                 note_size, fname, psargs);
-+                                                 note_size, data);
-     }
  
-   /* Dump information for threads.  */
-Index: gdb-7.2.50.20110320/gdb/procfs.c
-===================================================================
---- gdb-7.2.50.20110320.orig/gdb/procfs.c      2011-03-09 13:48:55.000000000 +0100
-+++ gdb-7.2.50.20110320/gdb/procfs.c   2011-03-20 15:24:02.000000000 +0100
-@@ -5752,6 +5752,7 @@ procfs_make_note_section (bfd *obfd, int
-   note_data = (char *) elfcore_write_prpsinfo (obfd,
-                                              note_data,
-                                              note_size,
-+                                             NULL,
-                                              fname,
-                                              psargs);
+-      if (get_inferior_args ())
+-        psargs = reconcat (psargs, psargs, " ", get_inferior_args (),
+-                         (char *) NULL);
+-
+-      note_data = elfcore_write_prpsinfo (obfd, note_data, note_size,
+-                                          fname, psargs);
+-      xfree (psargs);
++      note_data = elfcore_write_prpsinfo (obfd, note_data, note_size, data);
  
+       if (!note_data)
+       return NULL;
This page took 0.075583 seconds and 4 git commands to generate.