0

Question: How can I configure / tell Xcode's LLDB to not stop on - and pass a certain singal for a Commandline Tool?


Background:

We are using 3rd party code that relies on SIGUSR1.

Running in Xcode 13, LLDB stops on that signal and eats it (i.e. does not pass it).

Our targtet is a command-line tool, not an NSApplication.

I have found this answer to a very similar question (only difference AFAICS is that it is a NSApplication). It says to use this command:

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

in a Symbolic Breakpoint, setting main() as symbol.

But that gives us:

error: invalid target, create a target using the 'target create' command


I have tried with a "normal" breakpoint in main():

enter image description here

And with a Symbolic Breakpoint, using main() as symbol:

enter image description here

Both breakpoints log the described error, so that proves:

  • the breakpoint does work
  • the command is processed but causes the error

The Xcode scheme used is setup for debug and the correct executable:

enter image description here


When using the command in LLDB - console (instead of Xcode), it works fine, so the command seems to be OK.


HowTo Simple Reproduce:

  • In Xcode, "new Project" -> "Comman Line Tool"

  • Name it "TestLLDB" and save anywhere

  • set breakpoint in main() line 13 (NSLog...)

  • Edit the the breakpoint and add "Debugger Command" Action: "process handle SIGUSR1 -n true -p true -s false"

  • Run the project

  • check the console for the above error

7
  • You can't call "process handle" until you have an actual process. That's why the answer you quote says to put the "process handle" command into a breakpoint command on main, at that point there will be a running process. But from the error, it sounds like you don't even have a target yet (created with the 'file' - i.e. 'target create' - command). But I'd have to see a complete session to tell in more detail what's going on.
    – Jim Ingham
    Dec 8, 2021 at 18:46
  • @JimIngham: re "put the "process handle" command into a breakpoint command on main, at that point there will be a running process": that is exactly what I am doing (as written in the question. Sorry for being mistakable). I do put the command in a breakpoint. And that gives me the error. Using LLDB in command line it works fine. Dec 10, 2021 at 17:43
  • Can you put your exact breakpoint command in the question? The "invalid target" error doesn't make sense if you are in a breakpoint command, where you obviously have a target or you couldn't hit the breakpoint...
    – Jim Ingham
    Dec 10, 2021 at 19:28
  • @JimIngham I agree that it doesn't make sense, that's why I am asking here desperately :-) . Thanks for having a look, I have updated the question with imgs of the used breakpooints. Dec 15, 2021 at 10:16
  • Sorry, I cannot reproduce the behavior you report. I followed your steps and the process handle command works correctly. Probably time to file a bug with a copy of your project. Since this is Xcode related, it's best to report to bugreporter.apple.com.
    – Jim Ingham
    Dec 15, 2021 at 19:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.