chromatic wrote:
> 2) What's setting an invalid pointer-to-a-PMC here?
This question is answered at the end of the following dump. (This is
one of the things I nopasted during our IRC discussion last week, thanks
for your guidance in producing it.)
One interesting question: the pointer-to-a-PMC is written a couple times
by the CPointer class, and then written by BigInt once. Was that expected?
(By the way, I've also reproduced this on one of the x86-32 gentoo boxes
I tried it on, so it is not x86-64 specific. It is also not specific to
one version of gcc.)
(gdb) break src/headers.c:324 if ((long)pmc & 0xfff) == 0xde8
No source file named src/headers.c.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (src/headers.c:324 if ((long)pmc & 0xfff) == 0xde8) pending.
(gdb) run t/op/bitwise_27.pir
Starting program: /work/parrot-dev/parrot-trunk/parrot t/op/bitwise_27.pir
[Thread debugging using libthread_db enabled]
warning: Lowest section in /usr/lib64/libicudata.so.38 is .hash at
0000000000000190
[New Thread 0x7f3245daf710 (LWP 1013)]
[Switching to Thread 0x7f3245daf710 (LWP 1013)]
Breakpoint 1, new_pmc_header (interp=0x13bd080, flags=1024)
at src/headers.c:324
324 if (!pmc)
(gdb) cont
Continuing.
Breakpoint 1, new_pmc_header (interp=0x13bd080, flags=1024)
at src/headers.c:324
324 if (!pmc)
(gdb) cont
Continuing.
Breakpoint 1, new_pmc_header (interp=0x13bd080, flags=5120)
at src/headers.c:324
324 if (!pmc)
(gdb) cont
Continuing.
Breakpoint 1, new_pmc_header (interp=0x13bd080, flags=5120)
at src/headers.c:324
324 if (!pmc)
(gdb) cont
Continuing.
Breakpoint 1, new_pmc_header (interp=0x13bd080, flags=0) at
src/headers.c:324
324 if (!pmc)
(gdb) cont
Continuing.
Breakpoint 1, new_pmc_header (interp=0x13bd080, flags=1024)
at src/headers.c:324
324 if (!pmc)
(gdb) cont
Continuing.
Breakpoint 1, new_pmc_header (interp=0x13bd080, flags=1024)
at src/headers.c:324
324 if (!pmc)
(gdb) cont
Continuing.
Breakpoint 1, new_pmc_header (interp=0x13bd080, flags=0) at
src/headers.c:324
324 if (!pmc)
(gdb) cont
Continuing.
Breakpoint 1, new_pmc_header (interp=0x13bd080, flags=1024)
at src/headers.c:324
324 if (!pmc)
(gdb) bt
#0 new_pmc_header (interp=0x13bd080, flags=1024) at src/headers.c:324
#1 0x00007f3245753f78 in get_new_pmc_header (interp=0x13bd080,
base_type=52,
flags=1024) at src/pmc.c:267
#2 0x00007f3245753bc3 in pmc_new (interp=0x13bd080, base_type=52)
at src/pmc.c:92
#3 0x00007f324571ce74 in Parrot_build_sig_object_from_varargs (
interp=0x13bd080, sig=0x7f3245988b33 "PPP->P", args=0x7fff4df4d770)
at src/multidispatch.c:477
#4 0x00007f324571d5c6 in Parrot_mmd_multi_dispatch_from_c_args (
interp=0x13bd080, name=0x7f3245989310 "modulus",
sig=0x7f3245988b33 "PPP->P") at src/multidispatch.c:574
#5 0x00007f32457fe59f in Parrot_default_modulus (interp=0x13bd080,
pmc=0x1517f00, value=0x1496a08, dest=0x1495e70)
at ./src/pmc/default.pmc:1673
#6 0x00007f32456afaf8 in Parrot_mod_p_p_p (cur_opcode=0x15176a0,
interp=0x13bd080) at src/ops/math.ops:760
#7 0x00007f3245754c2f in runops_slow_core (interp=0x13bd080, pc=0x15176a0)
at src/runops_cores.c:222
#8 0x00007f3245714ed4 in runops_int (interp=0x13bd080, offset=0)
at src/interpreter.c:937
#9 0x00007f32457158c3 in runops (interp=0x13bd080, offs=0)
at src/inter_run.c:101
#10 0x00007f3245715b7a in runops_args (interp=0x13bd080, sub=0x14978b0,
obj=0x144a020, meth_unused=0x0, sig=0x7f324597fcfb "vP",
ap=0x7fff4df4da40)
at src/inter_run.c:236
#11 0x00007f3245715d6b in Parrot_runops_fromc_args (interp=0x13bd080,
sub=0x14978b0, sig=0x7f324597fcfb "vP") at src/inter_run.c:300
#12 0x00007f32456f781e in Parrot_runcode (interp=0x13bd080, argc=1,
argv=0x7fff4df4dd20) at src/embed.c:951
#13 0x00007f3245958f38 in imcc_run_pbc (interp=0x13bd080, obj_file=0,
output_file=0x0, argc=1, argv=0x7fff4df4dd20) at
compilers/imcc/main.c:791
#14 0x00007f3245959837 in imcc_run (interp=0x13bd080,
sourcefile=0x7fff4df4e165 "t/op/bitwise_27.pir", argc=1,
argv=0x7fff4df4dd20) at compilers/imcc/main.c:1079
#15 0x0000000000400c64 in main (argc=1, argv=0x7fff4df4dd20) at
src/main.c:61
(gdb) step
329 if (flags & PObj_is_PMC_EXT_FLAG) {
(gdb)
330 flags |= PObj_is_special_PMC_FLAG;
(gdb)
331 pmc->pmc_ext = new_pmc_ext(interp);
(gdb)
new_pmc_ext (interp=0x13bd080) at src/headers.c:363
363 Small_Object_Pool * const pool =
interp->arena_base->pmc_ext_pool;
(gdb)
366 return (PMC_EXT *)pool->get_free_object(interp, pool);
(gdb)
gc_ms_get_free_pmc_ext (interp=0x13bd080, pool=0x13be7e0)
at src/gc/smallobject.c:275
275 PMC_EXT *free_list = (PMC_EXT *)pool->free_list;
(gdb)
278 if (!free_list) {
(gdb)
283 ptr = free_list;
(gdb)
284 pool->free_list = ptr->_next_for_GC;
(gdb)
285 ptr->_next_for_GC = NULL;
(gdb)
287 --pool->num_free_objects;
(gdb)
289 return ptr;
(gdb)
290 }
(gdb)
new_pmc_ext (interp=0x13bd080) at src/headers.c:367
367 }
(gdb)
new_pmc_header (interp=0x13bd080, flags=67109888) at src/headers.c:333
333 if (flags & PObj_is_PMC_shared_FLAG)
(gdb)
338 PObj_get_FLAGS(pmc) = PObj_is_PMC_FLAG|flags;
(gdb)
339 pmc->vtable = NULL;
(gdb)
341 PMC_data(pmc) = NULL;
(gdb)
343 return pmc;
(gdb)
344 }
(gdb)
get_new_pmc_header (interp=0x13bd080, base_type=52, flags=1024)
at src/pmc.c:268
268 pmc->vtable = vtable;
(gdb)
269 pmc->real_self = pmc;
(gdb)
278 return pmc;
(gdb)
279 }
(gdb)
pmc_new (interp=0x13bd080, base_type=52) at src/pmc.c:93
93 VTABLE_init(interp, pmc);
(gdb)
Parrot_CPointer_init (interp=0x13bd080, pmc=0x1517de8)
at ./src/pmc/cpointer.pmc:67
67 mem_allocate_typed(Parrot_CPointer_attributes);
(gdb)
mem_sys_allocate (size=16) at src/gc/memory.c:46
46 void * const ptr = malloc(size);
(gdb)
50 if (!ptr)
(gdb)
52 return ptr;
(gdb)
53 }
(gdb)
Parrot_CPointer_init (interp=0x13bd080, pmc=0x1517de8)
at ./src/pmc/cpointer.pmc:69
69 PMC_data(SELF) = pdata_struct;
(gdb) print pdata_struct
$1 = (Parrot_CPointer_attributes *) 0x1559c00
(gdb) watch *((void**)0x1559c00)
Hardware watchpoint 2: *(void **) 22387712
(gdb) cont
Continuing.
Hardware watchpoint 2: *(void **) 22387712
Old value = (void *) 0x0
New value = (void *) 0x7fff4df4d898
Parrot_CPointer_set_pointer (interp=0x13bd080, pmc=0x1517de8,
value=0x7fff4df4d898) at ./src/pmc/cpointer.c:310
310 #line 310 "./src/pmc/cpointer.c"
(gdb) print *((void**)0x7fff4df4d898)
$10 = (void *) 0x144a020
(gdb) watch *((void**)0x7fff4df4d898)
Hardware watchpoint 3: *(void **) 140734501279896
(gdb) print *((PMC*)0x144a020)
$11 = {cache = {_b = {_bufstart = 0xdeadbeef, _buflen = 3735928559},
_ptrs = {
_struct_val = 0xdeadbeef, _pmc_val = 0xdeadbeef}, _i = {
_int_val = 3735928559, _int_val2 = 3735928559},
_num_val = 1.8457939563190925e-314, _string_val = 0xdeadbeef},
flags = 4608, vtable = 0x13c5ca0, data = 0x0, pmc_ext = 0x0,
real_self = 0x144a020}
(gdb) cont
Continuing.
Hardware watchpoint 3: *(void **) 140734501279896
Old value = (void *) 0x144a020
New value = (void *) 0x1495e70
Parrot_CPointer_set_pmc (interp=0x13bd080, pmc=0x1517de8, value=0x1495e70)
at ./src/pmc/cpointer.c:301
301 #line 301 "./src/pmc/cpointer.c"
(gdb) print *((PMC*)0x1495e70)
$12 = {cache = {_b = {_bufstart = 0x150f470, _buflen = 0}, _ptrs = {
_struct_val = 0x150f470, _pmc_val = 0x0}, _i = {_int_val = 22082672,
_int_val2 = 0}, _num_val = 1.0910289603580412e-316,
_string_val = 0x150f470}, flags = 4194816, vtable = 0x1404ba0, data
= 0x0,
pmc_ext = 0x0, real_self = 0x1495e70}
(gdb) bt
#0 Parrot_CPointer_set_pmc (interp=0x13bd080, pmc=0x1517de8,
value=0x1495e70)
at ./src/pmc/cpointer.c:301
#1 0x00007f3245710cc3 in set_context_sig_returns (interp=0x13bd080,
ctx=0x1512f70, indexes=0x7fff4df49670, ret_x=0x1559dd5 "P",
result_list=0x1517e20) at src/inter_call.c:2131
#2 0x00007f324571209a in Parrot_pcc_invoke_sub_from_sig_object (
interp=0x13bd080, sub_obj=0x146a468, sig_obj=0x1517ec8)
at src/inter_call.c:2657
#3 0x00007f324571d692 in Parrot_mmd_multi_dispatch_from_c_args (
interp=0x13bd080, name=0x7f3245989310 "modulus",
sig=0x7f3245988b33 "PPP->P") at src/multidispatch.c:594
#4 0x00007f32457fe59f in Parrot_default_modulus (interp=0x13bd080,
pmc=0x1517f00, value=0x1496a08, dest=0x1495e70)
at ./src/pmc/default.pmc:1673
#5 0x00007f32456afaf8 in Parrot_mod_p_p_p (cur_opcode=0x15176a0,
interp=0x13bd080) at src/ops/math.ops:760
#6 0x00007f3245754c2f in runops_slow_core (interp=0x13bd080, pc=0x15176a0)
at src/runops_cores.c:222
#7 0x00007f3245714ed4 in runops_int (interp=0x13bd080, offset=0)
at src/interpreter.c:937
#8 0x00007f32457158c3 in runops (interp=0x13bd080, offs=0)
at src/inter_run.c:101
#9 0x00007f3245715b7a in runops_args (interp=0x13bd080, sub=0x14978b0,
---Type <return> to continue, or q <return> to quit---
obj=0x144a020, meth_unused=0x0, sig=0x7f324597fcfb "vP",
ap=0x7fff4df4da40)
at src/inter_run.c:236
#10 0x00007f3245715d6b in Parrot_runops_fromc_args (interp=0x13bd080,
sub=0x14978b0, sig=0x7f324597fcfb "vP") at src/inter_run.c:300
#11 0x00007f32456f781e in Parrot_runcode (interp=0x13bd080, argc=1,
argv=0x7fff4df4dd20) at src/embed.c:951
#12 0x00007f3245958f38 in imcc_run_pbc (interp=0x13bd080, obj_file=0,
output_file=0x0, argc=1, argv=0x7fff4df4dd20) at
compilers/imcc/main.c:791
#13 0x00007f3245959837 in imcc_run (interp=0x13bd080,
sourcefile=0x7fff4df4e165 "t/op/bitwise_27.pir", argc=1,
argv=0x7fff4df4dd20) at compilers/imcc/main.c:1079
#14 0x0000000000400c64 in main (argc=1, argv=0x7fff4df4dd20) at
src/main.c:61
(gdb) cont
Continuing.
Hardware watchpoint 3: *(void **) 140734501279896
Old value = (void *) 0x1495e70
New value = (void *) 0x13bd080
0x00007f324585375c in Parrot_BigInt_get_integer (interp=0x13bd080,
pmc=0x1496730) at ./src/pmc/bigint.c:614
614 Parrot_BigInt_get_integer(PARROT_INTERP, PMC *pmc)
(gdb) print *((PMC*)0x13bd080)
$13 = {cache = {_b = {_bufstart = 0x1512ba0, _buflen = 22096984}, _ptrs = {
_struct_val = 0x1512ba0, _pmc_val = 0x1512c58}, _i = {
_int_val = 22096800, _int_val2 = 22096984},
_num_val = 1.0917269763024857e-316, _string_val = 0x1512ba0},
flags = 22097072, vtable = 0x13bd300, data = 0x81, pmc_ext = 0x13be3e0,
real_self = 0x1443228}
(gdb) cont
Continuing.
Hardware watchpoint 3: *(void **) 140734501279896
Old value = (void *) 0x13bd080
New value = (void *) 0x7f324568313e
0x00007f3245673448 in [EMAIL PROTECTED] ()
from /work/parrot-dev/parrot-trunk/blib/lib/libparrot.so.0.7.1
Current language: auto; currently asm
(gdb) bt
#0 0x00007f3245673448 in [EMAIL PROTECTED] ()
from /work/parrot-dev/parrot-trunk/blib/lib/libparrot.so.0.7.1
#1 0x00007f324568313e in Parrot_gt_p_ic_ic (cur_opcode=0x1517628,
interp=0x13bd080) at src/ops/cmp.ops:430
#2 0x00007f3245754c2f in runops_slow_core (interp=0x13bd080, pc=0x1517628)
at src/runops_cores.c:222
#3 0x00007f3245714ed4 in runops_int (interp=0x13bd080, offset=0)
at src/interpreter.c:937
#4 0x00007f32457158c3 in runops (interp=0x13bd080, offs=0)
at src/inter_run.c:101
#5 0x00007f3245715b7a in runops_args (interp=0x13bd080, sub=0x14978b0,
obj=0x144a020, meth_unused=0x0, sig=0x7f324597fcfb "vP",
ap=0x7fff4df4da40)
at src/inter_run.c:236
#6 0x00007f3245715d6b in Parrot_runops_fromc_args (interp=0x13bd080,
sub=0x14978b0, sig=0x7f324597fcfb "vP") at src/inter_run.c:300
#7 0x00007f32456f781e in Parrot_runcode (interp=0x13bd080, argc=1,
argv=0x7fff4df4dd20) at src/embed.c:951
#8 0x00007f3245958f38 in imcc_run_pbc (interp=0x13bd080, obj_file=0,
output_file=0x0, argc=1, argv=0x7fff4df4dd20) at
compilers/imcc/main.c:791
#9 0x00007f3245959837 in imcc_run (interp=0x13bd080,
sourcefile=0x7fff4df4e165 "t/op/bitwise_27.pir", argc=1,
argv=0x7fff4df4dd20) at compilers/imcc/main.c:1079
#10 0x0000000000400c64 in main (argc=1, argv=0x7fff4df4dd20) at
src/main.c:61
(gdb) print *((PMC*)0x7f324568313e)
$14 = {cache = {_b = {_bufstart = 0xe8458b48f8458948,
_buflen = 5192803511993140040}, _ptrs = {
_struct_val = 0xe8458b48f8458948, _pmc_val = 0x48108b4810c08348},
_i = {
_int_val = -1709807337998022328, _int_val2 = 5192803511993140040},
_num_val = -1.9658719122355545e+194, _string_val = 0xe8458b48f8458948},
flags = 10036289951415944587, vtable = 0x8b4810508b48e045,
data = 0x8b4808c08348e845, pmc_ext = 0x3e0c148d0f74800,
real_self = 0x48008b4802048d48}