1

This is the content from gdb-7.6.patch file:

--- gdb-7.6/libiberty/Makefile.in.orig
+++ gdb-7.6/libiberty/Makefile.in
@@ -175,6 +175,7 @@ REQUIRED_OFILES =                           \
./getruntime.$(objext) ./hashtab.$(objext) ./hex.$(objext)  \
./lbasename.$(objext) ./lrealpath.$(objext)         \
./make-relative-prefix.$(objext) ./make-temp-file.$(objext) \
+   ./mkstemps.$(objext)                        \
./objalloc.$(objext)                        \
./obstack.$(objext)                     \
./partition.$(objext) ./pexecute.$(objext) ./physmem.$(objext)  \
@@ -206,7 +207,7 @@ CONFIGURED_OFILES = ./asprintf.$(objext)
./index.$(objext) ./insque.$(objext)                \
./memchr.$(objext) ./memcmp.$(objext) ./memcpy.$(objext)    \
./memmem.$(objext) ./memmove.$(objext)              \
-    ./mempcpy.$(objext) ./memset.$(objext) ./mkstemps.$(objext)    \
+    ./mempcpy.$(objext) ./memset.$(objext)             \
./pex-djgpp.$(objext) ./pex-msdos.$(objext)         \
 ./pex-unix.$(objext) ./pex-win32.$(objext)         \
 ./putenv.$(objext)                     \
--- gdb-7.6/opcodes/i386-dis.c.orig
+++ gdb-7.6/opcodes/i386-dis.c
@@ -11510,6 +11510,10 @@ print_insn (bfd_vma pc, disassemble_info
   threebyte = *++codep;
   dp = &dis386_twobyte[threebyte];
   need_modrm = twobyte_has_modrm[*codep];
+      if (dp->name && ((strcmp(dp->name, "ud2a") == 0) || 
+(strcmp(dp->name, "ud2") ==   0))) {
+        extern int kernel_BUG_encoding_bytes(void);
+        codep += kernel_BUG_encoding_bytes();
+      }
   codep++;
 }
else
--- gdb-7.6/gdb/dwarf2read.c.orig
+++ gdb-7.6/gdb/dwarf2read.c
@@ -2670,7 +2670,11 @@ read_index_from_section (struct objfile
  indices.  */
if (version < 4)
 {
+#ifdef CRASH_MERGE
+      static int warning_printed = 1;
+#else
   static int warning_printed = 0;
+#endif
   if (!warning_printed)
{
  warning (_("Skipping obsolete .gdb_index section in %s."),
@@ -2689,7 +2693,11 @@ read_index_from_section (struct objfile
  "set use-deprecated-index-sections on".  */
if (version < 6 && !deprecated_ok)
 {
+#ifdef CRASH_MERGE
+      static int warning_printed = 1;
+#else
   static int warning_printed = 0;
+#endif
   if (!warning_printed)
{
  warning (_("\

I wonder how this patch was made out.I guess before making the patch,there should be six files, whose layout was like this:

gdb-7.6/libiberty/Makefile.in.orig
gdb-7.6/libiberty/Makefile.in
gdb-7.6/opcodes/i386-dis.c.orig
gdb-7.6/opcodes/i386-dis.c
gdb-7.6/gdb/dwarf2read.c.orig
gdb-7.6/gdb/dwarf2read.c

the files ended by a 'orig' suffix are the orignal files, while the other files are modified.I tried diff -uNr one by one, thus generating 3 patchs , but I don't know how to generate a patch containing all the changes. Can anybody tell me how to achieve this? Thank you!

zanona
  • 12,345
  • 25
  • 86
  • 141
Chen
  • 105
  • 6

2 Answers2

2

@VonC has a great solution based almost entirely on diff, but my love for the shell cannot let this question go with out an answer based on file manipulation. :)

If you can create 3 of what you want, you can always just append the info the way you want:

diff -ruN gdb-7.6/libiberty/Makefile.in{.orig,} > gdb-7.6.patch
diff -ruN gdb-7.6/opcodes/i386-dis.c{.orig,} >> gdb-7.6.patch
diff -ruN gdb-7.6/gdb/dwarf2read.c{.orig,} >> gdb-7.6.patch
MrAlias
  • 1,316
  • 15
  • 26
  • Thx , it works,and BTW ,how to generate a patch without date ?--- gdb/x86.c.orig 2014-07-26 22:50:26.887899672 +0800 +++ gdb/x86.c 2014-07-26 22:48:07.017893431 +0800 Can I directlt del it from the patch? – Chen Jul 26 '14 at 07:10
1

This article "How to Make and Apply Patches" mentions:

For multiple files the process is only slightly more complex.
Say you have a a folder “original” and a folder “changed” and the latter contains multiple changed versions of the files in the former.
If you call diff passing a folder name instead of a file name then this causes diff to compare file1 in one folder against file1 in the second folder, exactly what we need.

diff -rupN original changed > original.patch

In your case, you would need a:

  • gdb-7.6.ori folder with the content untouched
  • your current gdb-7.6 folder with changes
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you, but the result would be : --- original/eval.c +++ changed/eval.c but not eval.c compared with eval.c.orig – Chen Jul 26 '14 at 07:06