Skip to content

Instantly share code, notes, and snippets.

@MasterDuke17
Last active February 18, 2018 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MasterDuke17/9f386a024a4be69572a9a45fbab53376 to your computer and use it in GitHub Desktop.
Save MasterDuke17/9f386a024a4be69572a9a45fbab53376 to your computer and use it in GitHub Desktop.
$ gdb --args /home/dan/Source/perl6/install/bin/moar --libpath=src/vm/moar/stage0 src/vm/moar/stage0/nqp.moarvm --bootstrap --module-path=gen/moar/stage1 --setting-path=gen/moar/stage1 --setting=NQPCORE --no-regex-lib --target=mbc --output=gen/moar/stage1/NQPHLL.moarvm gen/moar/stage1/NQPHLL.nqp
GNU gdb (Ubuntu 8.0.1-0ubuntu1) 8.0.1
Copyright (C) 2017 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-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
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 /home/dan/Source/perl6/install/bin/moar...done.
(gdb) r
Starting program: /home/dan/Source/perl6/install/bin/moar --libpath=src/vm/moar/stage0 src/vm/moar/stage0/nqp.moarvm --bootstrap --module-path=gen/moar/stage1 --setting-path=gen/moar/stage1 --setting=NQPCORE --no-regex-lib --target=mbc --output=gen/moar/stage1/NQPHLL.moarvm gen/moar/stage1/NQPHLL.nqp
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff6322700 (LWP 7684)]
Thread 1 "moar" received signal SIGSEGV, Segmentation fault.
MVM_spesh_log_static (tc=0x555555758c40, value=0x555555ce3178) at src/spesh/log.c:152
152 MVMSpeshLogEntry *entry = &(sl->body.entries[sl->body.used]);
(gdb) bt
#0 MVM_spesh_log_static (tc=0x555555758c40, value=0x555555ce3178) at src/spesh/log.c:152
#1 0x00007ffff558ef4c in ?? ()
#2 0x0000555555758c40 in ?? ()
#3 0x00007ffff7cddcc0 in obj_int_callsite () from //home/dan/Source/perl6/install/lib/libmoar.so
#4 0x0000555555851c68 in ?? ()
#5 0x00007ffff04dc220 in ?? ()
#6 0x0000555556779830 in ?? ()
#7 0x00007ffff766537a in MVM_frame_invoke (tc=0x55555838b890, static_frame=<optimized out>, callsite=0x7fffffffd7f0, args=0x1, outer=<optimized out>, code_ref=<optimized out>, spesh_cand=<optimized out>) at src/core/frame.c:550
#8 0x0000555555758c40 in ?? ()
#9 0x000055555583a3c8 in ?? ()
#10 0x0000555555758c40 in ?? ()
#11 0x0000555555851c50 in ?? ()
#12 0x00007ffff765c0ba in MVM_interp_run (tc=tc@entry=0x555555758c40, initial_invoke=0x7ffff52af118, invoke_data=0x0) at src/core/interp.c:5729
#13 0x00007ffff7729115 in MVM_vm_run_file (instance=0x555555758260, filename=<optimized out>) at src/moar.c:407
#14 0x00005555555554c0 in main (argc=11, argv=0x7fffffffddb8) at src/main.c:256
(gdb) print *tc
$1 = {thread_id = 1, thread_obj = 0x5555557c6bd0, instance = 0x555555758260, num_locks = 0, nursery_fromspace = 0x7ffff6323010, nursery_tospace = 0x7ffff4fbf010, nursery_alloc = 0x7ffff52bd220, nursery_alloc_limit = 0x7ffff53bf010,
gc_status = 0, gen2 = 0x555555759250, nursery_fromspace_size = 4194304, nursery_tospace_size = 4194304, allocate_in_gen2 = 0, gc_promoted_bytes = 1425828, num_temproots = 0, mark_temproots = 0, alloc_temproots = 16,
temproots = 0x555555758fb0, num_gen2roots = 12362, alloc_gen2roots = 16384, gen2roots = 0x5555563a0470, num_finalize = 0, alloc_finalize = 0, finalize = 0x0, num_finalizing = 0, alloc_finalizing = 0, finalizing = 0x0, gc_in_tray = 0x0,
gc_work = 0x555555ec96f0, gc_work_size = 16, gc_work_count = 1, thread_fsa = 0x5555557599d0, interp_cur_op = 0x7fffffffda08, interp_bytecode_start = 0x7fffffffda10, interp_reg_base = 0x7fffffffda18, interp_cu = 0x7fffffffda20,
interp_jump = {{__jmpbuf = {93824994348096, -5153928619735522953, 93824994345568, 93824994339968, 4, 5, 5153928618894942583, 5153947506463727991}, __mask_was_saved = 0, __saved_mask = {__val = {0 <repeats 16 times>}}}},
cur_frame = 0x7ffff7fd41a0, thread_entry_frame = 0x0, stack_first = 0x7ffff7fd4010, stack_current = 0x7ffff7fd4010, active_handlers = 0x0, last_handler_result = 0x0, last_payload = 0x5555557bed40, current_frame_nr = 1457940,
next_frame_nr = 1457956, spesh_log = 0x5555560c31d0, spesh_log_quota = 1, spesh_sim_stack = 0x5555557cbf70, num_compunit_extra_logs = 5, spesh_cid = 127290, osr_hunt_frame_nr = 1457239, osr_hunt_num_spesh_candidates = 1,
loop = 0x7ffff7dd3c20 <default_loop_struct>, ex_release_mutex = 0x0, serialized_size = 0, serialized = 0x0, serialized_string_heap = 0x0, sc_wb_disable_depth = 0, compiling_scs = 0x5555563464f0, cur_dispatcher = 0x0,
cur_dispatcher_for = 0x0, native_callback_cache = 0x0, rand_state = {17575705166209042969, 11237995845637950439}, nfa_done = 0x555555def490, nfa_curst = 0x555555defa10, nfa_nextst = 0x555555deff90, nfa_alloc_states = 349,
nfa_fates = 0x555555e49270, nfa_fates_len = 34, nfa_longlit = 0x555555e49390, nfa_longlit_len = 34, multi_dim_indices = 0x0, num_multi_dim_indices = 0, prof_data = 0x0}
(gdb) print *value
$2 = {header = {sc_forward_u = {forwarder = 0x0, sc = {sc_idx = 0, idx = 0}, st = 0x0}, owner = 1, flags = 16, size = 72}, st = 0x5555557aa298}
$ lldb -- /home/dan/Source/perl6/install/bin/moar --libpath=src/vm/moar/stage0 src/vm/moar/stage0/nqp.moarvm --bootstrap --module-path=gen/moar/stage1 --setting-path=gen/moar/stage1 --setting=NQPCORE --no-regex-lib --target=mbc --output=gen/moar/stage1/NQPHLL.moarvm gen/moar/stage1/NQPHLL.nqp
(lldb) target create "/home/dan/Source/perl6/install/bin/moar"
Current executable set to '/home/dan/Source/perl6/install/bin/moar' (x86_64).
(lldb) settings set -- target.run-args "--libpath=src/vm/moar/stage0" "src/vm/moar/stage0/nqp.moarvm" "--bootstrap" "--module-path=gen/moar/stage1" "--setting-path=gen/moar/stage1" "--setting=NQPCORE" "--no-regex-lib" "--target=mbc" "--output=gen/moar/stage1/NQPHLL.moarvm" "gen/moar/stage1/NQPHLL.nqp"
(lldb) r
Process 22820 launched: '/home/dan/Source/perl6/install/bin/moar' (x86_64)
Process 22820 stopped
* thread #1, name = 'moar', stop reason = signal SIGTRAP
frame #0: 0x00007ffff554265e
-> 0x7ffff554265e: movq %r14, %rdi
0x7ffff5542661: callq *0x108a5(%rip)
0x7ffff5542667: movq %rax, %r8
0x7ffff554266a: je 0x7ffff5542682
(lldb) si
Process 22820 stopped
* thread #1, name = 'moar', stop reason = instruction step into
frame #0: 0x00007ffff5542661
-> 0x7ffff5542661: callq *0x108a5(%rip)
0x7ffff5542667: movq %rax, %r8
0x7ffff554266a: je 0x7ffff5542682
0x7ffff554266c: movq 0x748(%rbx), %r9
(lldb) si
Process 22820 stopped
* thread #1, name = 'moar', stop reason = instruction step into
frame #0: libmoar.so`MVM_spesh_log_is_logging(tc=0x0000555555758c40) at log.h:29
26
27 /* Quick check if we are logging, to save function call overhead. */
28 MVM_STATIC_INLINE MVMint32 MVM_spesh_log_is_logging(MVMThreadContext *tc) {
-> 29 MVMFrame *cur_frame = tc->cur_frame;
30 return cur_frame->spesh_cand == NULL && tc->cur_frame->spesh_correlation_id && tc->spesh_log;
31 }
32
(lldb) print $rax
(unsigned long) $0 = 93824998338664
.
.
.
(lldb) s
Process 22820 stopped
* thread #1, name = 'moar', stop reason = step in
frame #0: libmoar.so`MVM_spesh_log_is_logging(tc=0x0000555555758c40) at log.h:31
28 MVM_STATIC_INLINE MVMint32 MVM_spesh_log_is_logging(MVMThreadContext *tc) {
29 MVMFrame *cur_frame = tc->cur_frame;
30 return cur_frame->spesh_cand == NULL && tc->cur_frame->spesh_correlation_id && tc->spesh_log;
-> 31 }
32
33 void MVM_spesh_log_initialize_thread(MVMThreadContext *tc, MVMint32 main_thread);
34 MVMSpeshLog * MVM_spesh_log_create(MVMThreadContext *tc, MVMThread *target_thread);
(lldb) print $rax
(unsigned long) $1 = 0
(lldb) print *cur_frame
(MVMFrame) $2 = {
header = {
sc_forward_u = {
forwarder = 0x0000000000000000
sc = (sc_idx = 0, idx = 0)
st = 0x0000000000000000
}
owner = 1
flags = 4
size = 184
}
env = 0x0000555555836070
work = 0x0000555555ab9750
args = 0x0000555555ab9eb0
cur_args_callsite = 0x00007ffff7cddd40
outer = 0x00007ffff64800d8
caller = 0x00007ffff64800d8
static_info = 0x0000555555a27ee0
code_ref = 0x00007ffff6480090
params = {
callsite = 0x00007ffff7d717c0
arg_flags = 0x0000000000000000 <no value available>
args = 0x0000555555aa4f10
named_used = (byte_array = <no value available>, bit_field = 0)
named_used_size = 0
arg_count = 0
num_pos = 0
flag_count = 2
}
effective_spesh_slots = 0x00007ffff016d760
spesh_cand = 0x00007ffff0145840
return_address = 0x00007ffff5a336de "r\x01\x1c"
return_value = 0x00005555579b9360
return_type = '\x01'
flags = '\0'
allocd_work = 2000
allocd_env = 56
spesh_correlation_id = 119576
sequence_nr = 1393072
jit_entry_label = 0x00007ffff55425d0
extra = 0x0000000000000000
}
(lldb)
$ valgrind /home/dan/Source/perl6/install/bin/moar --libpath=src/vm/moar/stage0 src/vm/moar/stage0/nqp.moarvm --bootstrap --module-path=gen/moar/stage1 --setting-path=gen/moar/stage1 --setting=NQPCORE --no-regex-lib --target=mbc --output=gen/moar/stage1/NQPHLL.moarvm gen/moar/stage1/NQPHLL.nqp
==7988== Memcheck, a memory error detector
==7988== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==7988== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==7988== Command: /home/dan/Source/perl6/install/bin/moar --libpath=src/vm/moar/stage0 src/vm/moar/stage0/nqp.moarvm --bootstrap --module-path=gen/moar/stage1 --setting-path=gen/moar/stage1 --setting=NQPCORE --no-regex-lib --target=mbc --output=gen/moar/stage1/NQPHLL.moarvm gen/moar/stage1/NQPHLL.nqp
==7988==
==7988== Invalid read of size 4
==7988== at 0x509E454: MVM_spesh_log_static (log.c:152)
==7988== by 0xE471C51: ???
==7988== by 0x50130B9: MVM_interp_run (interp.c:5729)
==7988== by 0x50E0114: MVM_vm_run_file (moar.c:407)
==7988== by 0x1094BF: main (main.c:256)
==7988== Address 0x28 is not stack'd, malloc'd or (recently) free'd
==7988==
==7988==
==7988== Process terminating with default action of signal 11 (SIGSEGV)
==7988== Access not within mapped region at address 0x28
==7988== at 0x509E454: MVM_spesh_log_static (log.c:152)
==7988== by 0xE471C51: ???
==7988== by 0x50130B9: MVM_interp_run (interp.c:5729)
==7988== by 0x50E0114: MVM_vm_run_file (moar.c:407)
==7988== by 0x1094BF: main (main.c:256)
==7988== If you believe this happened as a result of a stack
==7988== overflow in your program's main thread (unlikely but
==7988== possible), you can try to increase the size of the
==7988== main thread stack using the --main-stacksize= flag.
==7988== The main thread stack size used in this run was 8388608.
==7988==
==7988== HEAP SUMMARY:
==7988== in use at exit: 56,727,768 bytes in 190,245 blocks
==7988== total heap usage: 981,376 allocs, 791,131 frees, 477,818,699 bytes allocated
==7988==
==7988== LEAK SUMMARY:
==7988== definitely lost: 0 bytes in 0 blocks
==7988== indirectly lost: 0 bytes in 0 blocks
==7988== possibly lost: 234,136 bytes in 4,179 blocks
==7988== still reachable: 56,493,632 bytes in 186,066 blocks
==7988== suppressed: 0 bytes in 0 blocks
==7988== Rerun with --leak-check=full to see details of leaked memory
==7988==
==7988== For counts of detected and suppressed errors, rerun with: -v
==7988== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment