Ticket #2188 (new bug) — at Initial Version

Opened 10 years ago

Last modified 10 years ago

Missing path in exception stack trace

Reported by: Eclesia Owned by:
Priority: normal Milestone:
Component: none Version: 3.7.0
Severity: high Keywords:
Cc: Language:
Patch status: Platform:

Description

When catching an exception, the last exception path element is missing.

At least two files are requiered to reproduce the bug :

File : exptest.wx

$load 'friend.pbc';

namespace em{
    
    class User{
        
        function User(){}
        
        function call0(){
            try{
                self.call1();
            }catch(ex){
                say(ex['message']);
                for(string exstr in ex.backtrace_strings()){
                    for(string str in split("\n",exstr)){
                        say(str);
                    }
                }
            }

            say("--------------------------------------------");
            self.call1();
        }
        
        
        function call1(){
            var friend = new em.Friend();
            friend.call();
        }
        
    }
        
}

function main(){
    var user = new em.User();
    user.call0();
}

file : friend.wx

namespace em{
        
    class Friend{
        
        function Friend(){}
        
        function call(){
            throw new 'Exception'({
                        "message"   : "Damned ! an exception !",
                        "severity"  : 100});
        }
        
    }
    
}

Then compile everything and run :

winxed -c -o friend.pir friend.wx
parrot -o friend.pbc friend.pir
winxed -c -o exptest.pir exptest.wx
parrot exptest.pir

the output result prints two different stacks. Damned ! an exception ! called from Sub 'parrot;em;Friend;call' pc 30 (friend.pir:23) (exptest.wx:39) called from Sub 'parrot;em;User;call1' pc 130 (exptest.pir:0) (exptest.wx:29) current instr.: 'parrot;em;User;call0' pc 51 (exptest.pir:47) (exptest.wx:15) called from Sub 'main' pc 161 (exptest.pir:97) (exptest.wx:38)


Damned ! an exception ! current instr.: 'parrot;em;Friend;call' pc 30 (friend.pir:23) (friend.wx:9) called from Sub 'parrot;em;User;call1' pc 130 (exptest.pir:0) (exptest.wx:29) called from Sub 'parrot;em;User;call0' pc 102 (exptest.pir:81) (exptest.wx:23) called from Sub 'main' pc 161 (exptest.pir:97) (exptest.wx:38)

Note: See TracTickets for help on using tickets.