Skip to content

Instantly share code, notes, and snippets.

@tk3
Created July 22, 2012 13:35
Show Gist options
  • Save tk3/3159695 to your computer and use it in GitHub Desktop.
Save tk3/3159695 to your computer and use it in GitHub Desktop.
gdb cfunc_test -c core
$ gdb cfunc_test -c core.7700
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-50.el6)
Copyright (C) 2010 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-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/foo/build/mruby-cfunc/test/cfunc_test...done.
[New Thread 7700]
Missing separate debuginfo for
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/b4/1d7cd75a11fc1c03b68d7f9a3ef1ea1edbf200
Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Core was generated by `././cfunc_test'.
Program terminated with signal 11, Segmentation fault.
#0 0x0000000000000000 in ?? ()
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.47.el6_2.12.x86_64
(gdb) up
#1 0x00000000004447a4 in ffi_call_unix64 () at ../src/x86/unix64.S:75
75 call *%r11
(gdb) list
70
71 /* Deallocate the reg arg area. */
72 leaq 176(%r10), %rsp
73
74 /* Call the user function. */
75 call *%r11
76
77 /* Deallocate stack arg area; local stack frame in redzone. */
78 leaq 24(%rbp), %rsp
79
(gdb) up
#2 0x000000000044360a in ffi_call (cif=<value optimized out>, fn=0, rvalue=<value optimized out>, avalue=0x1692f40)
at ../src/x86/ffi64.c:492
492 ffi_call_unix64 (stack, cif->bytes + sizeof (struct register_args),
(gdb) list
487 }
488 }
489 }
490 }
491
492 ffi_call_unix64 (stack, cif->bytes + sizeof (struct register_args),
493 cif->flags, rvalue, fn, ssecount);
494 }
495
496
(gdb) info locals
classes = {X86_64_INTEGER_CLASS, X86_64_NO_CLASS, 814378624, 32661}
stack = 0x7fff160b3d20 "\n"
argp = 0x7fff160b3dd0 "\r\200"
arg_types = <value optimized out>
gprcount = 1
ssecount = <value optimized out>
ngpr = <value optimized out>
nsse = <value optimized out>
i = <value optimized out>
avn = 1
ret_in_memory = <value optimized out>
reg_args = 0x7fff160b3d20
(gdb) up
#3 0x000000000043a72b in cfunc_call (mrb=0x162c010, self=...) at cfunc_call.c:53
53 ffi_call(&cif, fp, result, values);
(gdb) info locals
result = 0x1692f60
margc = 1
mresult_type = {value = {f = 1.1491156654608215e-316, p = 0x162e4f8, i = 23258360, sym = 23258360}, tt = MRB_TT_CLASS}
mname = {value = {f = 1.1628309277893745e-316, p = 0x1672158, i = 23535960, sym = 23535960}, tt = MRB_TT_STRING}
margs = 0x1654ab0
dlh = <value optimized out>
fp = 0x0
args = 0x1692f20
values = 0x1692f40
to_pointer = 319
result_type = <value optimized out>
mresult = {value = {f = 0, p = 0x0, i = 0, sym = 0}, tt = MRB_TT_FALSE}
cif = {abi = FFI_UNIX64, nargs = 1, arg_types = 0x1692f20, rtype = 0x1685ac0, bytes = 0, flags = 32781}
(gdb)
@tk3
Copy link
Author

tk3 commented Jul 25, 2012

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment