Ticket #1149 (closed bug: fixed)

Opened 5 years ago

Last modified 5 years ago

[bug] Segfault in -t trace output

Reported by: pmichaud Owned by:
Priority: blocker Milestone:
Component: core Version: trunk
Severity: high Keywords:
Cc: Language:
Patch status: Platform:

Description

While working on debugging some issues in nqp-rx this morning, I ran into a segfault that occurs when running Parrot with the -t option. I've been able to narrow the problem down to this short code snippet (revision 42097):

$ cat z.pir
.sub main
    'foo'()
.end


.sub 'foo'
    $P0 = getinterp
    $P1 = $P0['namespace';1]
    say $P1
.end

$ ./parrot z.pir
parrot
$ ./parrot -t1 z.pir
     0 set_args PC1
     2 set P0, PC9                                        P0=PMCNULL PC9=Sub=PMC(0x97471dc pc:12)
     5 get_results PC1
     7 invokecc P0                                        P0=Sub=PMC(0x97471dc pc:12)
    12 getinterp P0                                        P0=PMCNULL
Segmentation fault
$ 

When -t causes segfaults on its own, it's much less useful for debugging. :-(

Thanks!

Pm

Change History

Changed 5 years ago by pmichaud

Here's a backtrace of the z.pir script on my system:

$ cat z.pir
.sub main
    'foo'()
.end


.sub 'foo'
    $P0 = getinterp
    $P1 = $P0['namespace';1]
    say $P1
.end
$ gdb ./parrot
GNU gdb 6.8-debian
Copyright (C) 2008 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 "i486-linux-gnu"...
(gdb) run -t1 z.pir
Starting program: /home/pmichaud/nqp-rx/parrot/parrot -t1 z.pir
warning: Lowest section in /usr/lib/libicudata.so.38 is .hash at 000000d4
[Thread debugging using libthread_db enabled]
     0 set_args PC1
     2 set P0, PC9                                        P0=PMCNULL PC9=Sub=PMC(0x94661dc pc:12)
     5 get_results PC1
     7 invokecc P0                                        P0=Sub=PMC(0x94661dc pc:12)
    12 getinterp P0                                        P0=PMCNULL
[New Thread 0xb6e48990 (LWP 6339)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb6e48990 (LWP 6339)]
0xb7e35b3f in key_string (interp=0x93fa040, key=0x9486204) at src/key.c:444
444	            GETATTR_Key_str_key(interp, key, s);
(gdb) bt
#0  0xb7e35b3f in key_string (interp=0x93fa040, key=0x9486204) at src/key.c:444
#1  0xb7e668bf in trace_key_dump (interp=0x93fa040, key=0x9486204)
    at src/runcore/trace.c:207
#2  0xb7e66f21 in trace_op_dump (interp=0x93fa040, code_start=0x94b5f10, 
    pc=0x94b5f48) at src/runcore/trace.c:360
#3  0xb7e5f867 in runops_slow_core (interp=0x93fa040, runcore=0x94884d0, 
    pc=0x94b5f48) at src/runcore/cores.c:789
#4  0xb7e5e6ee in runops_int (interp=0x93fa040, offset=0)
    at src/runcore/main.c:545
#5  0xb7e34892 in runops (interp=0x93fa040, offs=0) at src/call/ops.c:97
#6  0xb7e2ec8c in Parrot_pcc_invoke_from_sig_object (interp=0x93fa040, 
    sub_obj=0x94661c8, call_object=0x9466204) at src/call/pcc.c:280
#7  0xb7e2ecef in Parrot_pcc_invoke_sub_from_c_args (interp=0x93fa040, 
    sub_obj=0x94661c8, sig=0xb7f7ff59 "P->") at src/call/pcc.c:73
#8  0xb7e1d881 in Parrot_runcode (interp=0x93fa040, argc=1, argv=0xbfcce18c)
    at src/embed.c:827
#9  0xb7f5a213 in imcc_run (interp=0x93fa040, sourcefile=0xbfccf63f "z.pir", 
    argc=1, argv=0xbfcce18c) at compilers/imcc/main.c:792
#10 0x08048975 in main (argc=1, argv=0xbfcce18c) at src/main.c:60
(gdb) 

Changed 5 years ago by NotFound

  • status changed from new to closed
  • resolution set to fixed

Fixed in r42112

Note: See TracTickets for help on using tickets.