Shop OBEX P1 Docs P2 Docs Learn Events
What to do when aborts don't abort? :Die PUB die... — Parallax Forums

What to do when aborts don't abort? :Die PUB die...

Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
edited 2009-06-12 19:49 in Propeller 1
I'm working on a routine that includes code for condition checking.

I'm calling my PUB from my Main and I can see the report that
a condition has been met with my an "str(string("Condition met"))
but it never comes back with the abort

What would cause an abort to hang instead of coming back to
the original routine that called it's PUB?

I've got something like this in my PUB

if r < 0
term.str(string("failed."))
abort

I see the failed message, but it doesn't wander back for continued execution.

Ideas?

OBC

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?

Check out: Protoboard Introduction , Propeller Cookbook 1.4 & Software Index
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card connected? - PropDOS

Post Edited (Oldbitcollector) : 3/17/2009 11:47:06 PM GMT

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-03-18 00:07
    I've resigned myself to using a RETURN, but I'd still love to hear what the
    Spin wizards here say about this.

    Thanks!
    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Check out: Protoboard Introduction , Propeller Cookbook 1.4 & Software Index
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • AribaAriba Posts: 2,690
    edited 2009-03-18 00:31
    Have you called the methode which should ABORT, with a \ before the name: \methode(..) ?
    If not the ABORT returns to the first routine in the Top Object.

    Andy
  • Harrison.Harrison. Posts: 484
    edited 2009-03-18 00:33
    You must catch your aborts by starting your method calls with a \. It will look something like this:
    PUB main
      \testing
    
    PRI testing
      abort -1
    
    



    The Propeller Manual explains abort in much more detail. Basically it just POPs the call stack until it reaches a call that 'catches' the abort.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-03-18 00:40
    Ah ha! That makes sense!

    Thank you!

    (Now why didn't I catch that from the three pages in the manual!??)

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Check out: Protoboard Introduction , Propeller Cookbook 1.4 & Software Index
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2009-03-18 01:08
    Learning something new here - I didn't realize there was a \ either, but then again I hadn't used the abort yet.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
    www.tdswieter.com
  • Jeff MartinJeff Martin Posts: 760
    edited 2009-03-18 02:28
    Yeah, without the \ your abort was popping everything out of the stack, and should have caused the cog to terminate... since the stack is initially populated with a return address that causes the Spin interpreter to execute a COGSTOP(COGID).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Jeff Martin

    · Sr. Software Engineer
    · Parallax, Inc.
  • ericballericball Posts: 774
    edited 2009-06-12 19:29
    Just a clarification - is the abort value returned to the abort trap? i.e.

    PRI child
      if <bad thing>
        abort -1
    
    PRI parent
      rc := child
    
    PUB main | rc
      rc := \parent
      IF rc == -1
        <handle bad thing>
    
    

    Thanks Mike.· := fixed

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Composite NTSC sprite driver: http://forums.parallax.com/showthread.php?p=800114
    NTSC color bars (template): http://forums.parallax.com/showthread.php?p=803904


    Post Edited (ericball) : 6/15/2009 12:34:43 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-12 19:49
    Yes. Do remember that assignments use the ":=" operator.
Sign In or Register to comment.