LLDB stops after encountering errors when using "-o" and "--source"

Example:
lldb -f a.exe --source init. If there any command in init file causes an error, lldb repl stops and doesn’t continue executing the commands after it. Is this an intended behavior?
I ask this because I want to add a shell test for lldb which triggers an error and continue executing other commands.

This behavior is controlled by the interpreter.stop-command-source-on-error setting. This should do what you want:

lldb -f a.exe -o “settings set interpreter.stop-command-source-on-error false” --source init

Jim

2 Likes

Thanks, that works.

BTW, is it also intentional that the effective value of the setting cannot be changed once we’ve started to source a file? i.e., if you place the settings set command into the init file, then it will not work. It seems like it could be useful for a script to enable this mode itself, if it knows that some of the commands it runs may fail…

I am pretty sure that is just an implementation side-effect. I can’t think of any good reason why setting the setting shouldn’t affect the following commands regardless of where you set it in the command stream.

Jim

Personally I consider that a bug. As a user, without knowing the implementation details, this leads to widely inconsistent behavior. See TestStopCommandSourceOnError.test with some examples of things that don’t behave the way you would expect.