我有从perl脚本文件创建的abc.bin文件。
现在如何调试使用此“ abc.bin”生成的核心文件
这样做,
gdb abc.bin -c core_file
我遇到错误并说“不是可执行文件格式:无法识别文件格式”
在GDB中还有其他选项可以调试此类文件吗?
编辑:
让我们忘记abc.bin,有没有办法调试用perl文件生成的核心文件,我有一个abc.pl文件导致核心转储,有没有办法用abc.pl调试该核心? / p>
修改
abc.bin的文件输出
ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), stripped
编辑:
“ gdb abc.bin”的输出
<M> l1143425:/root # gdb /var/storage/cores/abc.bin.11413
GNU gdb (GDB; Astaro Security Gateway) 7.9.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
[New LWP 11413]
Core was generated by `app_name [module_name]'.
Program terminated with signal SIGABRT, Aborted.
#0 0xf7733440 in __kernel_vsyscall ()
"/var/storage/cores/abc.bin.11413" is a core file.
Please specify an executable to debug.
(gdb) bt
#0 0xf7733440 in __kernel_vsyscall ()
#1 0xf754bbb0 in ?? ()
#2 0xf768f000 in ?? ()
#3 0xf754d4e5 in ?? ()
#4 0x00000006 in ?? ()
#5 0xffba33e0 in ?? ()
#6 0xf64b6185 in ?? ()
#7 0x00000000 in ?? ()
(gdb) f 2
#2 0xf768f000 in ?? ()
(gdb) list
No symbol table is loaded. Use the "file" command.
(gdb)
修改
场景:
答案 0 :(得分:2)
您缺少调试信息。我的GDB说:
› gdb /usr/bin/perl
GNU gdb (GDB; openSUSE Tumbleweed) 8.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/perl...Missing separate debuginfo for /usr/bin/perl
Try: zypper install -C "debuginfo(build-id)=33dd6e73e6f617df00f76a78a397b854f49d6df1"
(no debugging symbols found)...done.
(gdb) r -e CORE::dump
Starting program: /usr/bin/perl -e CORE::dump
Missing separate debuginfo for /lib64/ld-linux-x86-64.so.2
Try: zypper install -C "debuginfo(build-id)=d1f6bf237ba196265561924d1baaf522e036281f"
Missing separate debuginfo for /lib64/libm.so.6
Try: zypper install -C "debuginfo(build-id)=1fc13b3ef7db0024a3f401933c6da8b266a8e06c"
Missing separate debuginfo for /lib64/libdl.so.2
Try: zypper install -C "debuginfo(build-id)=b21e9d59d1465db80fa52e72a4803f1901202e6d"
Missing separate debuginfo for /lib64/libcrypt.so.1
Try: zypper install -C "debuginfo(build-id)=b043217f12c9950ff058956c57320d8b03cee06b"
Missing separate debuginfo for /lib64/libpthread.so.0
Try: zypper install -C "debuginfo(build-id)=b5ad7ea10e4e88d4e2cc038e5c3288bdea82e20b"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Missing separate debuginfo for /lib64/libc.so.6
Try: zypper install -C "debuginfo(build-id)=5926416cd74d1dfe53d37374041bca37ee80c598"
Program received signal SIGABRT, Aborted.
0x00007ffff705e367 in kill () from /lib64/libc.so.6
程序包功能解析为程序包名称:glibc-debuginfo glibc-debugsource perl-base-debuginfo perl-debugsource
安装缺少的软件包后,会有一个有意义的回溯:
› gdb /usr/bin/perl
GNU gdb (GDB; openSUSE Tumbleweed) 8.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/perl...Reading symbols from /usr/lib/debug/usr/bin/perl-5.26.2-1.4.x86_64.debug...done.
done.
(gdb) r -e CORE::dump
Starting program: /usr/bin/perl -e CORE::dump
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Program received signal SIGABRT, Aborted.
0x00007ffff705e367 in kill () at ../sysdeps/unix/syscall-template.S:78
78 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
(gdb) bt full
#0 0x00007ffff705e367 in kill () at ../sysdeps/unix/syscall-template.S:78
No locals.
#1 0x00005555555a42e9 in Perl_my_unexec (my_perl=<optimized out>) at perl.c:3685
No locals.
#2 0x0000555555678554 in Perl_pp_goto (my_perl=0x555555956260) at pp_ctl.c:3082
sp = <optimized out>
retop = 0x0
ix = <optimized out>
cx = <optimized out>
enterops = {0x0, 0xeda3fe532dabdd00, 0x555555712140 <arg_counts>, 0x5555559591e0, 0x555555956260, 0x7fffffffd458, 0x5555559758c0,
0x555555956260, 0x555555956260, 0x5555556391e1 <Perl_sv_free2+97>, 0x5555559758c0, 0x555555956260, 0xffffffffffffffff,
0x55555566945e <Perl_free_tmps+78>, 0x5555559758c0, 0x0, 0x1, 0x5555555a9efd <perl_parse+5165>, 0x555555956260, 0x0,
0x555555582800 <xs_init>, 0x0, 0x0, 0x100000000000001, 0x7fefffffffffffff, 0x555555956980, 0x6400000000, 0x0, 0x0, 0x0,
0x54552e45445f6564, 0x6500382d46, 0x0, 0x0, 0x0, 0x2020002020000000, 0x6, 0x405, 0x1, 0x21b6, 0x0, 0x103, 0x0, 0x1000, 0x0,
0x5b59e189, 0x13c9eb00, 0x5b59e189, 0x13c9eb00, 0x5b59e189, 0x13c9eb00, 0x0, 0x0, 0x0, 0x0, 0x6e00000061, 0x0, 0x770000007c, 0x2,
0x0, 0x0, 0x0, 0x0, 0x0}
label = <optimized out>
label_len = 0
label_flags = <optimized out>
do_dump = true
must_have_label = 0x555555712332 "goto must have label"
#3 0x000055555562b1d6 in Perl_runops_standard (my_perl=0x555555956260) at run.c:42
op = <optimized out>
#4 0x00005555555ab027 in S_run_body (oldscope=<optimized out>, my_perl=<optimized out>) at perl.c:2532
No locals.
#5 perl_run (my_perl=0x555555956260) at perl.c:2455
oldscope = 1
ret = <optimized out>
cur_env = {je_prev = 0x5555559565e8, je_buf = {{__jmpbuf = {0, -4037406656558474170, 93824992421648, 140737488344128, 0, 0,
-7877616891281744826, -4037406257967473594}, __mask_was_saved = 0, __saved_mask = {__val = {0, 0, 0, 0, 0, 0, 0, 0, 0,
17123809841394736384, 139637976727552, 93824996434528, 93824992421648, 17123809841394736384, 0, 0}}}}, je_ret = 0,
je_mustcatch = false, je_old_delaymagic = 0}
_p = <optimized out>
---Type <return> to continue, or q <return> to quit---
_p = <optimized out>
#6 0x00005555555826f2 in main (argc=<optimized out>, argv=<optimized out>, env=<optimized out>) at perlmain.c:123
exitstatus = <optimized out>
i = <optimized out>