Permanently configuring LLDB (in Xcode 4.3.2) not to stop on signals

12,401

In case anyone else ever has this question, I finally solved it by adding a breakpoint in NSApplicationMain() (for plain C programs, main() would of course work as well).

I set the breakpoint action to process handle SIGUSR2 -n true -p true -s false, and enabled the "Automatically continue after evaluating" option.

Xcode 4 Breakpoint Screenshot

If anyone has a more elegant solution, I'd be happy to hear.

Share:
12,401

Related videos on Youtube

puzzle
Author by

puzzle

Updated on June 02, 2022

Comments

  • puzzle
    puzzle almost 2 years

    I'm trying to get LLDB (running in Xcode 4.3.2 with an OS X application) to not stop on certain signals. If I enter

    process handle SIGUSR2 -n true -p true -s false

    on the debugging console it works fine and LLDB no longer stops on SIGUSR2.

    However, if I put

    command process handle SIGUSR2 -n true -p true -s false

    into ~/.lldbinit it seems to be ignored. Other commands in this file (e.g. alias) work fine.

    How can I make LLDB never stop on certain signals?

    • blueberryfields
      blueberryfields about 12 years
      I don't think that what you want to do is doable, without an explicit The process is a run-time concept. Maybe there's a useful setting under "settings list" that you can set?
    • puzzle
      puzzle about 12 years
      Thanks, that explains why adding the command to ~/.lldbinit did not work :)
  • user500
    user500 over 10 years
    Just in case... Don't forget to change symbol to UIApplicationMain for iOS.
  • n0minal
    n0minal over 10 years
    Itworks for me. but after my application freezes. Would this be the true behavior?
  • puzzle
    puzzle over 10 years
    Telling lldb to ignore certain signals should not cause an application to freeze. Where does your application freeze and how?
  • brunobowden
    brunobowden over 9 years
    For Swift use "UIApplicationMain"
  • Laurent Zubiaur
    Laurent Zubiaur about 9 years
    You might also just ignore the signal with signal(SIGPIPE, SIG_IGN)
  • itMaxence
    itMaxence about 6 years
    Wether you ignore or not the signal will not prevent xcode to stop :( (and btw you should better use sigaction() to ignore a signal)
  • itMaxence
    itMaxence about 6 years
    @puzzle could you explain or let a link about the process handle [signal] -n true -p true -s false line? Just for the sake of understanding what I'm copy/pasting :)
  • puzzle
    puzzle about 6 years
    @itMaxence If you enter help process handle in your lldb console, you'll get an explanation of all the possible arguments.
  • shallowThought
    shallowThought over 2 years
    In Xcode 13, having a commandline tool as target, setting this breakpoint in ìnt main(...) ...`, I get: "error: invalid target, create a target using the 'target create' command". any hints any one?