Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Created October 9, 2017 18:27
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 dogbert17/48792636b42ab7dbe87b0600548ebded to your computer and use it in GitHub Desktop.
Save dogbert17/48792636b42ab7dbe87b0600548ebded to your computer and use it in GitHub Desktop.
SEGV when running test taken from t/spec/S17-lowlevel/cas-int.t
dogbert@dogbert-VirtualBox ~/repos/rakudo $ cat ~/scratch.pl6
use Test;
for 1..40 -> $attempt {
my class IntegerHolder {
has atomicint $.value = 0;
method add-a-lot() {
for 1..10000 -> int $i {
loop {
my int $orig = $!value;
last if cas($!value, $orig, $orig + $i) == $orig;
}
}
}
}
my $obj = IntegerHolder.new;
await start { $obj.add-a-lot() } xx 4;
is $obj.value, 4 * [+](1..10000),
"CAS on integer attribute with competing threads works ($attempt)";
}
dogbert@dogbert-VirtualBox ~/repos/rakudo $ MVM_SPESH_BLOCKING=1 MVM_SPESH_NODELAY=1 ./perl6-gdb-m ~/scratch.pl6
================================================================================================
This is Rakudo Perl 6 running in the GNU debugger, which often allows the user to generate useful back-
traces to debug or report issues in Rakudo, the MoarVM backend or the currently running code.
This Rakudo version is 2017.09.361.g.484.f.98725 built on MoarVM version 2017.09.1.575.gd.4.e.230.a.6,
running on ubuntu (14.04.3.LTS.Trusty.Tahr) / linux (3.19.0.32.generic)
Type `bt full` to generate a backtrace if applicable, type `q` to quit or `help` for help.
------------------------------------------------------------------------------------------------
Reading symbols from /home/dogbert/repos/rakudo/nqp/MoarVM/../../install/bin/moar...done.
Starting program: /home/dogbert/repos/rakudo/install/bin/moar --execname=./perl6-gdb-m --libpath=. --libpath=blib --libpath=/home/dogbert/repos/rakudo/install/share/nqp/lib --libpath=/home/dogbert/repos/rakudo/install/share/nqp/lib --libpath=/home/dogbert/repos/rakudo/install/share/nqp/lib /home/dogbert/repos/rakudo/perl6.moarvm --nqp-lib=blib /home/dogbert/scratch.pl6
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
[New Thread 0xb77fcb40 (LWP 18056)]
[New Thread 0xb3dffb40 (LWP 18057)]
[New Thread 0xb33ffb40 (LWP 18058)]
[New Thread 0xb27ffb40 (LWP 18059)]
[New Thread 0xb1dffb40 (LWP 18060)]
[New Thread 0xb11ffb40 (LWP 18061)]
ok 1 - CAS on integer attribute with competing threads works (1)
ok 2 - CAS on integer attribute with competing threads works (2)
ok 3 - CAS on integer attribute with competing threads works (3)
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb33ffb40 (LWP 18058)]
0xb676eda3 in p6decontrv (tc=0xa4ad2b0, cur_op=0xb606f112 "\b") at src/vm/moar/ops/perl6_ops.c:339
339 const MVMContainerSpec *spec = STABLE(retval)->container_spec;
(gdb) bt
#0 0xb676eda3 in p6decontrv (tc=0xa4ad2b0, cur_op=0xb606f112 "\b") at src/vm/moar/ops/perl6_ops.c:339
#1 0xb7b8ec0a in MVM_interp_run (tc=0xa4ad2b0, initial_invoke=0xb7b9ec18 <thread_initial_invoke>, invoke_data=0xa4acf68) at src/core/interp.c:5882
#2 0xb7b9ed52 in start_thread (data=0xa4acf68) at src/core/threads.c:85
#3 0xb7896f72 in start_thread (arg=0xb33ffb40) at pthread_create.c:312
#4 0xb79e13ee in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:129
(gdb) info threads
Id Target Id Frame
7 Thread 0xb11ffb40 (LWP 18061) "moar" 0xb7b949a3 in allocate_frame (tc=0xb2a8a0e8, static_frame=0xa00e890, spesh_cand=0xb540cfe8, heap=1) at src/core/frame.c:242
6 Thread 0xb1dffb40 (LWP 18060) "moar" 0xb7b67cf2 in MVM_interp_run (tc=0xb2a89ed0, initial_invoke=0xb7b9ec18 <thread_initial_invoke>, invoke_data=0xb2a677b8) at src/core/interp.c:340
5 Thread 0xb27ffb40 (LWP 18059) "moar" 0xb7c7b905 in MVM_bigint_cmp (tc=0xb2a8b4c8, a=0xb29782e4, b=0xb2978354) at src/math/bigintops.c:487
* 4 Thread 0xb33ffb40 (LWP 18058) "moar" 0xb676eda3 in p6decontrv (tc=0xa4ad2b0, cur_op=0xb606f112 "\b") at src/vm/moar/ops/perl6_ops.c:339
3 Thread 0xb3dffb40 (LWP 18057) "moar" 0xb7bea67d in set_int (tc=0xa46b8d0, st=0x85e0db0, root=0xb28722f4, data=0xb2872304, value=433981) at src/6model/reprs/P6opaque.c:469
2 Thread 0xb77fcb40 (LWP 18056) "moar" 0xb7fdccb0 in ?? ()
1 Thread 0xb7880700 (LWP 18052) "moar" 0xb7fdccb0 in ?? ()
(gdb) t 7
[Switching to thread 7 (Thread 0xb11ffb40 (LWP 18061))]
#0 0xb7b949a3 in allocate_frame (tc=0xb2a8a0e8, static_frame=0xa00e890, spesh_cand=0xb540cfe8, heap=1) at src/core/frame.c:242
242 MVMROOT(tc, static_frame, {
(gdb) bt
#0 0xb7b949a3 in allocate_frame (tc=0xb2a8a0e8, static_frame=0xa00e890, spesh_cand=0xb540cfe8, heap=1) at src/core/frame.c:242
#1 0xb7b95307 in MVM_frame_invoke (tc=0xb2a8a0e8, static_frame=0xa00e890, callsite=0xb7fd74a4 <null_args_callsite>, args=0xb2a8d4d8, outer=0xb08ba6e0, code_ref=0xb08ba750, spesh_cand=0) at src/core/frame.c:492
#2 0xb7befab8 in invoke_handler (tc=0xb2a8a0e8, invokee=0xb08ba750, callsite=0xb7fd74a4 <null_args_callsite>, args=0xb2a8d4d8) at src/6model/reprs/MVMCode.c:10
#3 0xb7b6c352 in MVM_interp_run (tc=0xb2a8a0e8, initial_invoke=0xb7b9ec18 <thread_initial_invoke>, invoke_data=0xb2a65340) at src/core/interp.c:914
#4 0xb7b9ed52 in start_thread (data=0xb2a65340) at src/core/threads.c:85
#5 0xb7896f72 in start_thread (arg=0xb11ffb40) at pthread_create.c:312
#6 0xb79e13ee in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:129
(gdb) t 6
[Switching to thread 6 (Thread 0xb1dffb40 (LWP 18060))]
#0 0xb7b67cf2 in MVM_interp_run (tc=0xb2a89ed0, initial_invoke=0xb7b9ec18 <thread_initial_invoke>, invoke_data=0xb2a677b8) at src/core/interp.c:340
340 MVM_ASSIGN_REF(tc, &(f->header), GET_LEX(cur_op, 0, f).o,
(gdb) bt
#0 0xb7b67cf2 in MVM_interp_run (tc=0xb2a89ed0, initial_invoke=0xb7b9ec18 <thread_initial_invoke>, invoke_data=0xb2a677b8) at src/core/interp.c:340
#1 0xb7b9ed52 in start_thread (data=0xb2a677b8) at src/core/threads.c:85
#2 0xb7896f72 in start_thread (arg=0xb1dffb40) at pthread_create.c:312
#3 0xb79e13ee in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:129
(gdb) t 5
[Switching to thread 5 (Thread 0xb27ffb40 (LWP 18059))]
#0 0xb7c7b905 in MVM_bigint_cmp (tc=0xb2a8b4c8, a=0xb29782e4, b=0xb2978354) at src/math/bigintops.c:487
487 if (MVM_BIGINT_IS_BIG(ba) || MVM_BIGINT_IS_BIG(bb)) {
(gdb) bt
#0 0xb7c7b905 in MVM_bigint_cmp (tc=0xb2a8b4c8, a=0xb29782e4, b=0xb2978354) at src/math/bigintops.c:487
#1 0xb7b7d2c4 in MVM_interp_run (tc=0xb2a8b4c8, initial_invoke=0xb7b9ec18 <thread_initial_invoke>, invoke_data=0xb2a8a0d8) at src/core/interp.c:3412
#2 0xb7b9ed52 in start_thread (data=0xb2a8a0d8) at src/core/threads.c:85
#3 0xb7896f72 in start_thread (arg=0xb27ffb40) at pthread_create.c:312
#4 0xb79e13ee in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:129
(gdb) t 3
[Switching to thread 3 (Thread 0xb3dffb40 (LWP 18057))]
#0 0xb7bea67d in set_int (tc=0xa46b8d0, st=0x85e0db0, root=0xb28722f4, data=0xb2872304, value=433981) at src/6model/reprs/P6opaque.c:469
469 st->REPR->box_funcs.set_int(tc, st, root, (char *)data + repr_data->attribute_offsets[repr_data->unbox_int_slot], value);
(gdb) bt
#0 0xb7bea67d in set_int (tc=0xa46b8d0, st=0x85e0db0, root=0xb28722f4, data=0xb2872304, value=433981) at src/6model/reprs/P6opaque.c:469
#1 0xb7bdaff6 in MVM_repr_set_int (tc=0xa46b8d0, obj=0xb28722f4, val=433981) at src/6model/reprconv.c:557
#2 0xb7bdb15e in MVM_repr_box_int (tc=0xa46b8d0, type=0x85e23a0, val=433981) at src/6model/reprconv.c:577
#3 0xb7bdc80f in native_ref_fetch (tc=0xa46b8d0, cont=0xb28722d8, res=0xb3488d98) at src/6model/containers.c:246
#4 0xb7b8b791 in MVM_interp_run (tc=0xa46b8d0, initial_invoke=0xb7b9ec18 <thread_initial_invoke>, invoke_data=0xa4ac730) at src/core/interp.c:5340
#5 0xb7b9ed52 in start_thread (data=0xa4ac730) at src/core/threads.c:85
#6 0xb7896f72 in start_thread (arg=0xb3dffb40) at pthread_create.c:312
#7 0xb79e13ee in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:129
(gdb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment