How to debug C code with lldb in macOS Mojave?












0















I was using gdb in Linux but now I have switched to Mac and read that lldb is the alternative to gdb in Apple devices. However, I'm getting an error when I try to use lldb (I also tried gdb but it does not recognize the files as executable). When I try to use it I get the following errors:




sanad@Sanads-MBP  ~/Desktop/cppLab  lldb ./a.out  ✔  623  01:43:54
(lldb) target create "./a.out"
Traceback (most recent call last):
File "", line 1, in
File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 98, in
import six
ImportError: No module named six
Traceback (most recent call last):
File "", line 1, in
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
File "", line 1, in
NameError: name 'run_one_line' is not defined


…and a dozen more NameErrors exactly like this until the output ends with:



Current executable set to './a.out' (x86_64).
(lldb)









share|improve this question













migrated from superuser.com Feb 14 at 15:07


This question came from our site for computer enthusiasts and power users.



















  • Looks like lldb uses Python, but it's not finding the Python module named "six" in the $PYTHONPATH. "six" is a well-known Python module for dealing with Python 2.x vs. 3.x compatibility issues. Try installing the "six" module on your system and make sure it's in your PYTHONPATH.

    – Spiff
    Feb 12 at 21:47











  • Try typing run after it and hit enter. See if your a.out start executing after that

    – user996142
    Feb 12 at 21:56











  • I tried installing the "six" pakage but now it shows diffrent error .......lldb) target create "firstprog" Traceback (most recent call last): File "<input>", line 1, in <module> File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module> import weakref File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module> from _weakref import ( ImportError: cannot import name _remove_dead_weakref Current executable set to 'firstprog' (x86_64).

    – thehog
    Feb 13 at 11:41
















0















I was using gdb in Linux but now I have switched to Mac and read that lldb is the alternative to gdb in Apple devices. However, I'm getting an error when I try to use lldb (I also tried gdb but it does not recognize the files as executable). When I try to use it I get the following errors:




sanad@Sanads-MBP  ~/Desktop/cppLab  lldb ./a.out  ✔  623  01:43:54
(lldb) target create "./a.out"
Traceback (most recent call last):
File "", line 1, in
File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 98, in
import six
ImportError: No module named six
Traceback (most recent call last):
File "", line 1, in
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
File "", line 1, in
NameError: name 'run_one_line' is not defined


…and a dozen more NameErrors exactly like this until the output ends with:



Current executable set to './a.out' (x86_64).
(lldb)









share|improve this question













migrated from superuser.com Feb 14 at 15:07


This question came from our site for computer enthusiasts and power users.



















  • Looks like lldb uses Python, but it's not finding the Python module named "six" in the $PYTHONPATH. "six" is a well-known Python module for dealing with Python 2.x vs. 3.x compatibility issues. Try installing the "six" module on your system and make sure it's in your PYTHONPATH.

    – Spiff
    Feb 12 at 21:47











  • Try typing run after it and hit enter. See if your a.out start executing after that

    – user996142
    Feb 12 at 21:56











  • I tried installing the "six" pakage but now it shows diffrent error .......lldb) target create "firstprog" Traceback (most recent call last): File "<input>", line 1, in <module> File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module> import weakref File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module> from _weakref import ( ImportError: cannot import name _remove_dead_weakref Current executable set to 'firstprog' (x86_64).

    – thehog
    Feb 13 at 11:41














0












0








0








I was using gdb in Linux but now I have switched to Mac and read that lldb is the alternative to gdb in Apple devices. However, I'm getting an error when I try to use lldb (I also tried gdb but it does not recognize the files as executable). When I try to use it I get the following errors:




sanad@Sanads-MBP  ~/Desktop/cppLab  lldb ./a.out  ✔  623  01:43:54
(lldb) target create "./a.out"
Traceback (most recent call last):
File "", line 1, in
File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 98, in
import six
ImportError: No module named six
Traceback (most recent call last):
File "", line 1, in
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
File "", line 1, in
NameError: name 'run_one_line' is not defined


…and a dozen more NameErrors exactly like this until the output ends with:



Current executable set to './a.out' (x86_64).
(lldb)









share|improve this question














I was using gdb in Linux but now I have switched to Mac and read that lldb is the alternative to gdb in Apple devices. However, I'm getting an error when I try to use lldb (I also tried gdb but it does not recognize the files as executable). When I try to use it I get the following errors:




sanad@Sanads-MBP  ~/Desktop/cppLab  lldb ./a.out  ✔  623  01:43:54
(lldb) target create "./a.out"
Traceback (most recent call last):
File "", line 1, in
File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 98, in
import six
ImportError: No module named six
Traceback (most recent call last):
File "", line 1, in
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
File "", line 1, in
NameError: name 'run_one_line' is not defined


…and a dozen more NameErrors exactly like this until the output ends with:



Current executable set to './a.out' (x86_64).
(lldb)






macos debugging gdb






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 12 at 20:21









thehogthehog

182




182




migrated from superuser.com Feb 14 at 15:07


This question came from our site for computer enthusiasts and power users.









migrated from superuser.com Feb 14 at 15:07


This question came from our site for computer enthusiasts and power users.















  • Looks like lldb uses Python, but it's not finding the Python module named "six" in the $PYTHONPATH. "six" is a well-known Python module for dealing with Python 2.x vs. 3.x compatibility issues. Try installing the "six" module on your system and make sure it's in your PYTHONPATH.

    – Spiff
    Feb 12 at 21:47











  • Try typing run after it and hit enter. See if your a.out start executing after that

    – user996142
    Feb 12 at 21:56











  • I tried installing the "six" pakage but now it shows diffrent error .......lldb) target create "firstprog" Traceback (most recent call last): File "<input>", line 1, in <module> File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module> import weakref File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module> from _weakref import ( ImportError: cannot import name _remove_dead_weakref Current executable set to 'firstprog' (x86_64).

    – thehog
    Feb 13 at 11:41



















  • Looks like lldb uses Python, but it's not finding the Python module named "six" in the $PYTHONPATH. "six" is a well-known Python module for dealing with Python 2.x vs. 3.x compatibility issues. Try installing the "six" module on your system and make sure it's in your PYTHONPATH.

    – Spiff
    Feb 12 at 21:47











  • Try typing run after it and hit enter. See if your a.out start executing after that

    – user996142
    Feb 12 at 21:56











  • I tried installing the "six" pakage but now it shows diffrent error .......lldb) target create "firstprog" Traceback (most recent call last): File "<input>", line 1, in <module> File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module> import weakref File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module> from _weakref import ( ImportError: cannot import name _remove_dead_weakref Current executable set to 'firstprog' (x86_64).

    – thehog
    Feb 13 at 11:41

















Looks like lldb uses Python, but it's not finding the Python module named "six" in the $PYTHONPATH. "six" is a well-known Python module for dealing with Python 2.x vs. 3.x compatibility issues. Try installing the "six" module on your system and make sure it's in your PYTHONPATH.

– Spiff
Feb 12 at 21:47





Looks like lldb uses Python, but it's not finding the Python module named "six" in the $PYTHONPATH. "six" is a well-known Python module for dealing with Python 2.x vs. 3.x compatibility issues. Try installing the "six" module on your system and make sure it's in your PYTHONPATH.

– Spiff
Feb 12 at 21:47













Try typing run after it and hit enter. See if your a.out start executing after that

– user996142
Feb 12 at 21:56





Try typing run after it and hit enter. See if your a.out start executing after that

– user996142
Feb 12 at 21:56













I tried installing the "six" pakage but now it shows diffrent error .......lldb) target create "firstprog" Traceback (most recent call last): File "<input>", line 1, in <module> File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module> import weakref File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module> from _weakref import ( ImportError: cannot import name _remove_dead_weakref Current executable set to 'firstprog' (x86_64).

– thehog
Feb 13 at 11:41





I tried installing the "six" pakage but now it shows diffrent error .......lldb) target create "firstprog" Traceback (most recent call last): File "<input>", line 1, in <module> File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module> import weakref File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module> from _weakref import ( ImportError: cannot import name _remove_dead_weakref Current executable set to 'firstprog' (x86_64).

– thehog
Feb 13 at 11:41












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54693464%2fhow-to-debug-c-code-with-lldb-in-macos-mojave%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54693464%2fhow-to-debug-c-code-with-lldb-in-macos-mojave%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

is 'sed' thread safe

How to make a Squid Proxy server?