Joan Lluch via llvm-dev
2019-Nov-04 21:10 UTC
[llvm-dev] Debugging clang with debugger breakpoints ?
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. I know how to use the debugger, this is what I attempt to debug: clang --target=msp430 -emit-llvm -c -S -Oz main.c The debugger works fine, but only on the main thread. However breakpoints do not work with the code that was invoked as a child process with posix_spawn The call to posix_spawn happens in file “Program.inc” on the ‘Execute' function. The actual call is this Err = posix_spawn(&PID, Program.str().c_str(), FileActions, /*attrp*/ nullptr, const_cast<char **>(Argv), const_cast<char **>(Envp)); the variable Program.str() contains "/Users/joan/LLVM-9/llvm-project/build/Debug/bin/clang” at this point, which I got with a breakpoint set at that point. HOWEVER, any code that is run under that child process is not seen by the debugger. I hope my issue is clearer now. Thanks anyway. John> On 4 Nov 2019, at 21:43, David Blaikie <dblaikie at gmail.com> wrote: > > that 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" > > Or wherever you had: -emit-llvm -S -g main.c (or something like that) > You now have: "-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" > > > On Mon, Nov 4, 2019 at 12:29 PM Joan Lluch <joan.lluch at icloud.com <mailto:joan.lluch at icloud.com>> wrote: > Hi David, > > Thank you for your help. Please, can you elaborate on this?. The command line that I get with -### starts with this: > > clang version 9.0.1 (https://github.com/llvm/llvm-project.git <https://github.com/llvm/llvm-project.git> 6e38ee067b8fa08792f551fb565bbb8ada4864b1) > Target: msp430 > Thread model: posix > InstalledDir: /Users/joan/LLVM-9/llvm-project/build/Debug/bin > "/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" > > So what should I set on the debugger? > > Thanks > > John > > > > > > >> On 4 Nov 2019, at 21:03, David Blaikie <dblaikie at gmail.com <mailto:dblaikie at gmail.com>> wrote: >> >> Run clang with -### to get the underlying command line (the one that has the first argument "-cc1") and then run that command under the debugger instead. >> >> On Mon, Nov 4, 2019 at 12:02 PM Joan Lluch via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: >> Hi All, >> >> I want to understand some parts of ‘clang' by setting debug breakpoints. >> >> I have successfully done so with “llc” but I found that debugger breakpoints do not work for ‘clang’ >> >> The apparent cause is that the clang code is run as a child process which is created in the ‘Execute' function of ‘Program.inc'. The debugger stops fine at breakpoints set on the main thread, but breakpoints do not work for any code that is executed as the child process. I am compiling with Xcode in case this makes a difference. >> >> Thanks in advance for any help. >> >> John >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191104/3d43e2e5/attachment-0001.html>
David Blaikie via llvm-dev
2019-Nov-04 21:14 UTC
[llvm-dev] Debugging clang with debugger breakpoints ?
On Mon, Nov 4, 2019 at 1:10 PM Joan Lluch <joan.lluch at icloud.com> 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. > > I know how to use the debugger, this is what I attempt to debug: > > clang --target=msp430 -emit-llvm -c -S -Oz main.c >OK, so wherever you have that ^ you should replace it with this \/ 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" It's just a ton of command line arguments, but it's not fundamentally different from the command you were already debugging - it's clang with some command line arguments. This clang command (the one with the first argument of -cc1) will not invoke a child process - this is the command that the clang command you ran would run as its child process. So it's stripping off that layer so you can debug the underlying command/child process.> > The debugger works fine, but only on the main thread. However breakpoints > do not work with the code that was invoked as a child process with > posix_spawn > > The call to posix_spawn happens in file “Program.inc” on the ‘Execute' > function. The actual call is this > > Err = posix_spawn(&PID, Program.str().c_str(), FileActions, > /*attrp*/ nullptr, const_cast<char **>(Argv), > const_cast<char **>(Envp)); > > the variable Program.str() contains > "/Users/joan/LLVM-9/llvm-project/build/Debug/bin/clang” at this point, > which I got with a breakpoint set at that point. > > HOWEVER, any code that is run under that child process is not seen by the > debugger. > > I hope my issue is clearer now. > > Thanks anyway. > > John > > > On 4 Nov 2019, at 21:43, David Blaikie <dblaikie at gmail.com> wrote: > > that 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" > > Or wherever you had: -emit-llvm -S -g main.c (or something like that) > You now have: "-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" > > > On Mon, Nov 4, 2019 at 12:29 PM Joan Lluch <joan.lluch at icloud.com> wrote: > >> Hi David, >> >> Thank you for your help. Please, can you elaborate on this?. The command >> line that I get with -### starts with this: >> >> clang version 9.0.1 (https://github.com/llvm/llvm-project.git >> 6e38ee067b8fa08792f551fb565bbb8ada4864b1) >> Target: msp430 >> Thread model: posix >> InstalledDir: /Users/joan/LLVM-9/llvm-project/build/Debug/bin >> "/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" >> >> So what should I set on the debugger? >> >> Thanks >> >> John >> >> >> >> >> >> >> On 4 Nov 2019, at 21:03, David Blaikie <dblaikie at gmail.com> wrote: >> >> Run clang with -### to get the underlying command line (the one that has >> the first argument "-cc1") and then run that command under the debugger >> instead. >> >> On Mon, Nov 4, 2019 at 12:02 PM Joan Lluch via llvm-dev < >> llvm-dev at lists.llvm.org> wrote: >> >>> Hi All, >>> >>> I want to understand some parts of ‘clang' by setting debug breakpoints. >>> >>> I have successfully done so with “llc” but I found that debugger >>> breakpoints do not work for ‘clang’ >>> >>> The apparent cause is that the clang code is run as a child process >>> which is created in the ‘Execute' function of ‘Program.inc'. The debugger >>> stops fine at breakpoints set on the main thread, but breakpoints do not >>> work for any code that is executed as the child process. I am compiling >>> with Xcode in case this makes a difference. >>> >>> Thanks in advance for any help. >>> >>> John >>> _______________________________________________ >>> LLVM Developers mailing list >>> llvm-dev at lists.llvm.org >>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>> >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191104/7613e402/attachment.html>
Zachary Turner via llvm-dev
2019-Nov-04 21:18 UTC
[llvm-dev] Debugging clang with debugger breakpoints ?
On Mon, Nov 4, 2019 at 1:11 PM Joan Lluch via llvm-dev < 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/62a0e7f5/attachment.html>
Joan Lluch via llvm-dev
2019-Nov-04 21:22 UTC
[llvm-dev] Debugging clang with debugger breakpoints ?
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> 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/989f4367/attachment.html>
Joan Lluch via llvm-dev
2019-Nov-04 22:13 UTC
[llvm-dev] Debugging clang with debugger breakpoints ?
Hi David, I understand now what you mean, and it worked. I replied already to someone else. Please accept my apologies as I misread a message before. Thanks for your help. John.> On 4 Nov 2019, at 22:14, David Blaikie <dblaikie at gmail.com> wrote: > > > > On Mon, Nov 4, 2019 at 1:10 PM Joan Lluch <joan.lluch at icloud.com <mailto:joan.lluch at icloud.com>> 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. > > I know how to use the debugger, this is what I attempt to debug: > > clang --target=msp430 -emit-llvm -c -S -Oz main.c > > OK, so wherever you have that ^ you should replace it with this \/ > > 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" > > It's just a ton of command line arguments, but it's not fundamentally different from the command you were already debugging - it's clang with some command line arguments. > > This clang command (the one with the first argument of -cc1) will not invoke a child process - this is the command that the clang command you ran would run as its child process. So it's stripping off that layer so you can debug the underlying command/child process. > > > The debugger works fine, but only on the main thread. However breakpoints do not work with the code that was invoked as a child process with posix_spawn > > The call to posix_spawn happens in file “Program.inc” on the ‘Execute' function. The actual call is this > > Err = posix_spawn(&PID, Program.str().c_str(), FileActions, > /*attrp*/ nullptr, const_cast<char **>(Argv), > const_cast<char **>(Envp)); > > the variable Program.str() contains "/Users/joan/LLVM-9/llvm-project/build/Debug/bin/clang” at this point, which I got with a breakpoint set at that point. > > HOWEVER, any code that is run under that child process is not seen by the debugger. > > I hope my issue is clearer now. > > Thanks anyway. > > John > > >> On 4 Nov 2019, at 21:43, David Blaikie <dblaikie at gmail.com <mailto:dblaikie at gmail.com>> wrote: >> >> that 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" >> >> Or wherever you had: -emit-llvm -S -g main.c (or something like that) >> You now have: "-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" >> >> >> On Mon, Nov 4, 2019 at 12:29 PM Joan Lluch <joan.lluch at icloud.com <mailto:joan.lluch at icloud.com>> wrote: >> Hi David, >> >> Thank you for your help. Please, can you elaborate on this?. The command line that I get with -### starts with this: >> >> clang version 9.0.1 (https://github.com/llvm/llvm-project.git <https://github.com/llvm/llvm-project.git> 6e38ee067b8fa08792f551fb565bbb8ada4864b1) >> Target: msp430 >> Thread model: posix >> InstalledDir: /Users/joan/LLVM-9/llvm-project/build/Debug/bin >> "/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" >> >> So what should I set on the debugger? >> >> Thanks >> >> John >> >> >> >> >> >> >>> On 4 Nov 2019, at 21:03, David Blaikie <dblaikie at gmail.com <mailto:dblaikie at gmail.com>> wrote: >>> >>> Run clang with -### to get the underlying command line (the one that has the first argument "-cc1") and then run that command under the debugger instead. >>> >>> On Mon, Nov 4, 2019 at 12:02 PM Joan Lluch via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: >>> Hi All, >>> >>> I want to understand some parts of ‘clang' by setting debug breakpoints. >>> >>> I have successfully done so with “llc” but I found that debugger breakpoints do not work for ‘clang’ >>> >>> The apparent cause is that the clang code is run as a child process which is created in the ‘Execute' function of ‘Program.inc'. The debugger stops fine at breakpoints set on the main thread, but breakpoints do not work for any code that is executed as the child process. I am compiling with Xcode in case this makes a difference. >>> >>> Thanks in advance for any help. >>> >>> John >>> _______________________________________________ >>> LLVM Developers mailing list >>> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> >>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191104/1d36d3ed/attachment.html>