Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$^H - Fail to run ops with array base - $[ = 1 #50

Open
atoomic opened this issue Jul 17, 2017 · 0 comments
Open

$^H - Fail to run ops with array base - $[ = 1 #50

atoomic opened this issue Jul 17, 2017 · 0 comments

Comments

@atoomic
Copy link
Collaborator

atoomic commented Jul 17, 2017

This looks like another hints_hash issue, as $[ is saved in hints.

When set to 1 it's going to load pp code from ext/arybase/arybase.xs instead of pp.c

no warnings; 

$[ = 1;

our $big = "N\xabN\xab"; 
print qq{ok\n} if rindex($big, "N", 3) == 3;

#print rindex($big, "N", 3) . "\n";
#print join( ', ', map { ord } split(//, $big) ) . "\n";
#print length($big) . "\n";

When adding a breakpoint in gdb to b pp.c:3586 it c, we can see that we are going to the correct pp function

(gdb) bt
#0  Perl_pp_index () at pp.c:3586
#1  0x00007fffefcfbd68 in ab_pp_index () at arybase.xs:335
#2  0x00007ffff7883887 in Perl_runops_standard () at run.c:41
#3  0x00007ffff77c2c92 in S_run_body (oldscope=1) at perl.c:2485
#4  0x00007ffff77c278b in perl_run (my_perl=0x603010) at perl.c:2408
#5  0x0000000000400f5f in main (argc=2, argv=0x7fffffffdcb8, env=0x7fffffffdcd0) at perlmain.c:116

the retval from Perl_pp_index is also correct.

When checking PL_curcop, seems like the cop_hints_hash is set correctly
with cop_hint_stash set to

(gdb) p *(COPHH *) 0x639770
$2 = {
  refcounted_he_next = 0x0,
  refcounted_he_hek = 0x639808,
  refcounted_he_val = {
    refcounted_he_u_iv = 1,
    refcounted_he_u_uv = 1,
    refcounted_he_u_len = 1,
    refcounted_he_u_ptr = 0x1
  },
  refcounted_he_refcnt = 3,
  refcounted_he_data =     " "
}
(gdb) p (char*) ( (HEK*) 0x639808 )->hek_key
$5 = 0x639810 "$["

we can also noticed that the binary is linked to arybase.so

atoomic added a commit that referenced this issue Jul 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants