Xcode + Instruments ... related

Discussion in 'Mac Programming' started by OneDreamCloser, Nov 29, 2009.

  1. OneDreamCloser macrumors member

    Jun 16, 2008
    hello all,

    i would like to ask you about 2 things :

    1. when a "SIGSEGV" (segmentation fault) appears at runtime, i can see the function that causes it (through the printed stack, when i run my app in debug mode)
    the thing is that i do not know the specific line that is responsible for this kind of errors,
    how can i obtain this information ? (Instruments as s profiler can logically help me deal with that)

    2. how can i know "when" + "who" changes the value of a specific variable in my app ?
  2. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
    1. A backtrace should tell you line numbers. If it doesn't for some reason, use up and down or frame to navigate to the stack frame that had the problem (that's where you should start, though...) and you should be able to see the offending line.

    2. http://www.unknownroad.com/rtfm/gdbtut/gdbwatch.html
    There have been times that watchpoints haven't "done it" for me, so i've had to:
    Use p to display the address of the variable using &.
    use display/XX 0x7832309
    where XX is the format of the variable in question, and the address is what you get from printing the variable address.
    Then single step through your code until you see the value being displayed change.


Share This Page