[llvm-dev] Debugging clang with debugger breakpoints ?

Joan Lluch via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 4 14:13:34 PST 2019


Hi Zach,

I appreciate that.  The -debug option is apparently not known in this context, this is what the console pops up immediately:

[0;1;31merror: [0munknown argument: '-debug'[0m
Program ended with exit code: 1

I believe this is now a more general issue because all sort of output to the console is missing, not only LLVM_DEBUG() macro statements. It seems to me that I need to redirect console output to the ide console somehow. This is apparently done automatically when debugging the main thread in the usual way, but it’s not working in this case. Still, having working breakpoints and debug variables is a great improvement. So thanks for that.

John.



> On 4 Nov 2019, at 22:51, Zachary Turner <zturner at roblox.com> wrote:
> 
> I'm not very familiar with this macro, as it seems to be new, but looking at llvm/include/llvm/Support/Debug.h it has this comment:
> 
> // In particular, just wrap your code with the LLVM_DEBUG() macro, and it will
> // be enabled automatically if you specify '-debug' on the command-line.
> // LLVM_DEBUG() requires the DEBUG_TYPE macro to be defined. 
> 
> So, perhaps you should try adding -debug to your command line and seeing if that fixes the problem.
> 
> If that doesn't fix it, someone else may need to help as I'm not familiar with this issue specifically.
> 
> On Mon, Nov 4, 2019 at 1:47 PM Joan Lluch <joan.lluch at icloud.com <mailto:joan.lluch at icloud.com>> wrote:
> Sorry Zach, my apologies. 
> 
> I understood now what you mean. I tried and it works!. 
> 
> But now I found that LLVM_DEBUG statements and other output to the console doesn’t show. How do I get that back?.
> 
> Thanks 
> 
> John 
> 
> 
>> On 4 Nov 2019, at 22:26, Zachary Turner <zturner at roblox.com <mailto:zturner at roblox.com>> wrote:
>> 
>> You hit Reply on my email but then addressed David.  So I want to make sure you saw my suggestion.  Let me know if you tried that and/or whether or not it solved your problem.
>> 
>> Zach
>> 
>> On Mon, Nov 4, 2019 at 1:23 PM Joan Lluch <joan.lluch at icloud.com <mailto:joan.lluch at icloud.com>> wrote:
>> Hi David,
>> 
>> I understand what you say, but have you actually read my messages? I don’t think so,
>> 
>> Anyway, I will repost the question in case someone else can help.
>> 
>> Thanks
>> 
>> John
>> 
>> 
>> 
>> 
>> 
>>> On 4 Nov 2019, at 22:18, Zachary Turner <zturner at roblox.com <mailto:zturner at roblox.com>> wrote:
>>> 
>>> 
>>> 
>>> On Mon, Nov 4, 2019 at 1:11 PM Joan Lluch via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>>> Hi David,
>>> 
>>> Thank you for your patience but I still don’t get it:  I don’t see how that is a “command”, as it’s just a list of strings that state command options.
>>> 
>>> This is the output you pasted after running the command:
>>> 
>>> > "/Users/joan/LLVM-9/llvm-project/build/Debug/bin/clang" "-cc1" "-triple" "msp430" "-emit-llvm" "-disable-free" "-main-file-name" "main.c" "-mrelocation-model" "static" "-mthread-model" "posix" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-nostdsysteminc" "-dwarf-column-info" "-debugger-tuning=gdb" "-target-linker-version" "305" "-momit-leaf-frame-pointer" "-coverage-notes-file" "/Users/joan/Documents-Local/Relay/RelayNou/main.gcno" "-resource-dir" "/Users/joan/LLVM-9/llvm-project/build/Debug/lib/clang/9.0.1" "-internal-isystem" "/Users/joan/LLVM-9/llvm-project/build/Debug/bin/../msp430/include" "-Oz" "-fdebug-compilation-dir" "/Users/joan/Documents-Local/Relay/RelayNou" "-ferror-limit" "19" "-fmessage-length" "224" "-fobjc-runtime=gcc" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-vectorize-slp" "-faddrsig" "-o" "main.ll" "-x" "c" "main.c" 
>>> 
>>> Yes it is a list of strings.  But the first string "/Users/joan/LLVM-9/llvm-project/build/Debug/bin/clang" is a command.  The rest are arguments.  So you should set your debugger to run this command:
>>> 
>>> "/Users/joan/LLVM-9/llvm-project/build/Debug/bin/clang" 
>>> 
>>> with these arguments:
>>> 
>>> "-cc1" "-triple" "msp430" "-emit-llvm" "-disable-free" "-main-file-name" "main.c" "-mrelocation-model" "static" "-mthread-model" "posix" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-nostdsysteminc" "-dwarf-column-info" "-debugger-tuning=gdb" "-target-linker-version" "305" "-momit-leaf-frame-pointer" "-coverage-notes-file" "/Users/joan/Documents-Local/Relay/RelayNou/main.gcno" "-resource-dir" "/Users/joan/LLVM-9/llvm-project/build/Debug/lib/clang/9.0.1" "-internal-isystem" "/Users/joan/LLVM-9/llvm-project/build/Debug/bin/../msp430/include" "-Oz" "-fdebug-compilation-dir" "/Users/joan/Documents-Local/Relay/RelayNou" "-ferror-limit" "19" "-fmessage-length" "224" "-fobjc-runtime=gcc" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-vectorize-slp" "-faddrsig" "-o" "main.ll" "-x" "c" "main.c"
>>> 
>>> Does that make sense?
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191104/19e09ea1/attachment.html>


More information about the llvm-dev mailing list