Debugging on Leopard

  • Hi All.

    Here's a tip that would have saved me a couple of days in debugging.
    Hopefully it will save somebody else some time.

    I always have a breakpoint set on -[NSException raise] in order to
    trap any exceptions that get hit. On Tiger and previous this has
    never failed me, but on Leopard, not all exceptions go through -
    [NSException raise]. So during Leopard developement, some exceptions
    went unnoticed. It's safer if you also break on +[NSException
    raise:format] and objc_exception_throw. Hopefully there are no other
    paths through which an exception can be thrown.

    -Kenny
  • On Nov 13, 2007, at 08:45, Kenny Leung wrote:

    > Hi All.
    >
    > Here's a tip that would have saved me a couple of days in debugging.
    > Hopefully it will save somebody else some time.
    >
    > I always have a breakpoint set on -[NSException raise] in order to
    > trap any exceptions that get hit. On Tiger and previous this has
    > never failed me, but on Leopard, not all exceptions go through -
    > [NSException raise]. So during Leopard developement, some exceptions
    > went unnoticed. It's safer if you also break on +[NSException
    > raise:format] and objc_exception_throw. Hopefully there are no other
    > paths through which an exception can be thrown.

    All raised objective-C exceptions on Leopard go through
    objc_exception_throw, so no other breakpoint is needed.

    --
    Clark S. Cox III
    <clarkcox3...>
  • On Nov 13, 2007, at 8:45 AM, Kenny Leung wrote:

    > I always have a breakpoint set on -[NSException raise] in order to
    > trap any exceptions that get hit. On Tiger and previous this has
    > never failed me, but on Leopard, not all exceptions go through -
    > [NSException raise].

    As Clark said, on Leopard all exceptions go through
    objc_exception_throw.

    When doing Panther and Tiger development, you should have breakpoints
    on both objc_exception_throw and -[NSException raise] because not all
    exceptions are thrown through the latter.  Specifically, any exception
    that is thrown by a @throw statement will always go through
    objc_exception_throw.

    The difference is that in Leopard, even exceptions that are *not*
    thrown by a @throw statement (e.g. exception objects sent -raise) also
    go through that single bottleneck.

      -- Chris
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today