Search code examples
macos-sierralldb

lldb process launch fails to resolve ~/path-to-filename


In .lldbinit in macOS 10.13.3 I define an alias:

command alias pl process launch --stop-at-entry --

so that inside lldb run from the command line I can say something like:

pl ~/path-to-filename

However, when I examine argv I see that lldb has not performed path expansion on the ~.

Of course, the session fails, lldb can't find the file, but if at the bottom I rerun the session with r, the ~ resolves to the absolute path.

The alias is not the issue because if I run process launch inside lldb with:

process launch --stop-at-entry -- ~/path-to-filename

lldb still refuses to resolve ~. And, it seems bizaare to me, lldb does the expected right thing, resolve ~, when doing r to rerun the debug session. Is this a bash issue, a bug in lldb, a feature or pilot error? I don't know whether this behavior also occurs in the Xcode gui, because I don't use it. It makes me wan't to barf.


Solution

  • (lldb) help pro lau
         Launch the executable in the debugger.
    

    [...]

           -X <boolean> ( --shell-expand-args <boolean> )
                Set whether to shell expand arguments to the process when launching.
    
    (lldb) help r
    'r' is an abbreviation for 'process launch -X true --'