LLDB does not appear to be reading my .lldbinit fi

2019-02-12 17:41发布

问题:

I have a file ~/.lldbinit with a single alias:

command alias pi print (int)

But when I run my app from Xcode, the alias does not work. However, if I manually enter the alias, then the alias does work:

(lldb) pi 6
error: 'pi' is not a valid command.
(lldb) command alias pi print (int)
(lldb) pi 6
(int) $3 = 6
(lldb) 

This leads me to suspect that my .lldbinit file is not getting read. Or is there a different problem that I am missing? Can anyone help?

回答1:

Note that ~/.lldbinit does work in Xcode 4.3.2, iOS.



回答2:

I had a similar problem. It turned out, that I had a syntax error in my .lldbinit file which leads to lldb silently ignoring the file. You can try manually loading the file with

command source ~/.lldbinit

which will show syntax errors.



回答3:

Make the file executable:

chmod +x ~/.lldbinit


回答4:

I created a .llbdbinit file just like you and reproduced your problem in my copy of XCode 4.1. I can't get aliases to work either.

Since ~/.lldbinit is documented by Apple as supposedly being read when started up, I suspect that lldbinit file reading is currently busted in shipping versions of XCode 4. Not sure what pre-release versions are doing, but I'd recommend filing a bug at bugreporter.apple.com.

p.s.

One thing I noticed on one blog (here; look in the "differences between OSX & iOS" section) is that lldb only works for MacOS and NOT for iOS, at least as of a bunch of months ago.



回答5:

if you created the lldbinit file with some editor then it might have screwed it. try openning the lldbinit file with vi and check if it just plain text



回答6:

I had the same problem when trying to get this plugin to work.

command script import ~/Documents/002.ME/001.BITBUCKET_REPO/xcode_plugin_lldb_quicklook/GITHUB-LLDB-QuickLook/LLDB-QuickLook/lldb_quick_look.py
command alias ql quicklook

The path to the py file was wrong so kept reporting the error:

error: 'ql' is not a valid command.

Once I fixed it. I had to restart XCode 5 and it worked.

I didn't have to restart Mac.

I didn't have to make the file executable.