Ticket #2188 (closed bug: fixed)

Opened 3 years ago

Last modified 3 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 (last modified by Eclesia) (diff)

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)

Change History

Changed 3 years ago by Eclesia

  • description modified (diff)

Changed 3 years ago by plobsing

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

I notice two things wrong with the stack printed from user code (not automatically printed by an uncaught exception):

  • the HLL file and lineno information are incorrect
  • the stacktop format ("current instr" vs "called from Sub") is in the middle of the trace

Both of these have been fixed and a regression test is in place as of 5b76269.

Note: See TracTickets for help on using tickets.