[Crash-utility] [PATCH] crash: dis: introduce count in reverse and forward mode

Dave Anderson anderson at redhat.com
Wed Jun 19 15:28:01 UTC 2019



----- Original Message -----
> I'm simply doing an in-place update by:
> 
> (1) applying your patch to a pre-built git tree, and
> (2) entering "make".
> 
> That should just work. Anyway, I've got an idea on how to address it that
> I'll try tomorrow.
> 
>

Hi Aaron,

With respect to the "secondary" application of the gdb-7.6.patch
file to a pre-built source tree, I came up with a solution that
allows for the restoration of the original version of any gdb file
prior to the secondary re-application of gdb-7.6.patch.  That scheme
works fine, and prevents the "HUNK # FAILED" messages that are seen
for symtab.c and printcmd.c.  Those occur because "patch -N" doesn't
recognize that the patch had been previously applied, and so it goes
ahead and tries the patch again (with unpredictable results).

But -- after trying it with your patch appended to gdb-7.6.patch,
the build still fails.

So I took the "secondary" re-application of gdb-7.6.patch completely
out of the picture, and as it turns out, there is still a problem 
with your patch to gdb-7.6.patch.  What I did was to:

 (1) check out a clean source tree, 
 (2) apply your patch
 (3) run make

That should absolutely just work.

But your patch does not apply cleanly on the initial application, and
then later on printcmd.c fails to compile.  Here are the relevant portions
of the build log:

$ git clone https://github.com/crash-utility/crash.git crash.git
Cloning into 'crash.git'...
remote: Enumerating objects: 35, done.
remote: Counting objects: 100% (35/35), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 2719 (delta 15), reused 25 (delta 10), pack-reused 2684
Receiving objects: 100% (2719/2719), 5.41 MiB | 2.05 MiB/s, done.
Resolving deltas: 100% (1818/1818), done.
$ cd crash.git
$ patch -p1 < /root/dis.patch
patching file gdb-7.6.patch
patching file kernel.c
$ make
... [ cut ] ...
if [ -f gdb-7.6.patch ] && [ -s gdb-7.6.patch ]; then \
        patch -p0 < gdb-7.6.patch; cp gdb-7.6.patch gdb-7.6; fi
patching file gdb-7.6/libiberty/Makefile.in
patching file gdb-7.6/opcodes/i386-dis.c
patching file gdb-7.6/gdb/dwarf2read.c
patching file gdb-7.6/gdb/amd64-linux-nat.c
patching file gdb-7.6/gdb/symfile.c
patching file gdb-7.6/gdb/cli/cli-cmds.c
patching file gdb-7.6/gdb/psymtab.c
patching file gdb-7.6/gdb/symtab.c
patching file gdb-7.6/gdb/c-typeprint.c
patching file gdb-7.6/gdb/xml-syscall.c
patching file gdb-7.6/gdb/exceptions.c
patching file gdb-7.6/gdb/valprint.h
patching file gdb-7.6/gdb/target.c
patching file gdb-7.6/gdb/printcmd.c
patching file gdb-7.6/gdb/ui-file.c
patching file gdb-7.6/gdb/main.c
patching file gdb-7.6/gdb/valprint.c
patching file gdb-7.6/gdb/Makefile.in
patching file gdb-7.6/gdb/c-lang.c
patching file gdb-7.6/readline/rltypedefs.h
patching file gdb-7.6/readline/readline.h
patching file gdb-7.6/readline/misc.c
patching file gdb-7.6/Makefile.in
patching file gdb-7.6/gdb/defs.h
patching file gdb-7.6/bfd/elflink.c
patching file gdb-7.6/gdb/s390-nat.c
patching file gdb-7.6/gdb/printcmd.c
patching file gdb-7.6/bfd/bfd-in.h
patching file gdb-7.6/bfd/bfd-in2.h
patching file gdb-7.6/gdb/symtab.c
patching file gdb-7.6/gdb/aarch64-linux-nat.c
patching file gdb-7.6/sim/igen/Makefile.in
patching file gdb-7.6/sim/mips/cp1.c
patching file gdb-7.6/sim/mips/sim-main.h
patching file gdb-7.6/readline/util.c
patching file gdb-7.6/gdb/symtab.c
patching file gdb-7.6/gdb/symtab.c
patching file gdb-7.6/opcodes/i386-dis.c
patching file gdb-7.6/bfd/coff-i386.c
patching file gdb-7.6/bfd/coff-x86_64.c
patching file gdb-7.6/opcodes/arm-dis.c
patching file gdb-7.6/bfd/elf64-ppc.c
patching file gdb-7.6/include/opcode/ppc.h
patching file gdb-7.6/opcodes/mips-dis.c
patching file gdb-7.6/gdb/ada-lang.c
patching file gdb-7.6/gdb/linux-record.c
patching file gdb-7.6/gdb/inflow.c
patching file gdb-7.6/gdb/printcmd.c
patching file gdb-7.6/gdb/c-typeprint.c
patching file gdb-7.6/gdb/symtab.c
patching file gdb-7.6/bfd/elf64-s390.c
patching file gdb-7.6/gdb/symtab.c
patching file gdb-7.6/bfd/configure
patching file gdb-7.6/opcodes/configure
patching file gdb-7.6/gdb/symtab.c
patching file gdb-7.6/gdb/symtab.c
patching file gdb-7.6/gdb/symtab.c
patching file gdb-7.6/gdb/common/linux-ptrace.c
patching file gdb-7.6/gdb/printcmd.c
Hunk #2 succeeded at 800 with fuzz 2.
Hunk #5 succeeded at 2187 with fuzz 1 (offset 995 lines).
if [ "x86_64" = "ppc64le" ] && [ -f gdb-7.6-ppc64le-support.patch ]; then \
        patch -d gdb-7.6 -p1 -F0 < gdb-7.6-ppc64le-support.patch ; \
fi

... [ cut ] ...

gcc -g -O2   -I. -I. -I./common -I./config -DLOCALEDIR="\"/usr/local/share/locale\"" -DCRASH_MERGE -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/.. -I./../readline/.. -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber  -I./gnulib/import -Ibuild-gnulib/import   -DTUI=1  -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body  `echo " -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body " | sed "s/ -Wformat-nonliteral / -Wno-format-nonliteral /g"` \
        -c -o printcmd.o -MT printcmd.o -MMD -MP -MF .deps/printcmd.Tpo ./printcmd.c
./printcmd.c: In function ‘display_info’:
./printcmd.c:2191:7: error: ‘need_to_update_next_address’ undeclared (first use in this function); did you mean ‘set_next_address’?
   if (need_to_update_next_address)
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
       set_next_address
./printcmd.c:2191:7: note: each undeclared identifier is reported only once for each function it appears in
./printcmd.c:2192:20: error: ‘addr_rewound’ undeclared (first use in this function)
     next_address = addr_rewound;
                    ^~~~~~~~~~~~
make[4]: *** [Makefile:1559: printcmd.o] Error 1
make[3]: *** [Makefile:8265: all-gdb] Error 2
make[2]: *** [Makefile:835: all] Error 2

crash build failed

make[1]: *** [Makefile:234: gdb_merge] Error 1
make: *** [Makefile:225: all] Error 2
$

Anyway, can you re-do your patch set so that it applies fuzz-free on the
original attempt?  

Thanks,
  Dave




More information about the Crash-utility mailing list