expected behavior with run alias

I looking at bug 22968 and trying to figure out if there’s a bug here or not.

The run command alias ends with --, so there doesn’t seem to be a way to specify options when using the alias. For example, if you do:

(lldb) run -s

That’s treated as though you wrote:

(lldb) process launch -c – -s

The -s argument is placed after the --, which causes it to be passed on to the inferior and not treated as an option to the process launch command. That’s consistent but possibly surprising behavior. If you wanted the -s on the command, you’d have to spell it out explicitly:

(lldb) process launch -c -s

Should there be an alias that doesn’t end in --?

Adrian McCarthy

A lot of these aliases were added to emulate the associated gdb commands, in order to make the transition easier for gdb users. So in this case, because run is "process launch --" you can launch your program and pass the arguments "-foo -bar -baz" to your program by doing:

(lldb) run -foo -bar -baz

which pretty much what you would do in gdb. So having the -- in the alias is necessary to produce the intended behavior.

Since, if you don't like run the way it is, you can easily unalias it in your .lldbinit and re-alias it to whatever you want, it doesn't bother me that the built-in alias presents a reduced but more familiar view of the command.


Thanks for the insight.