1 // Check to make sure clang is somewhat picky about -g options. 2 // rdar://10383444 3 4 // RUN: %clang -### -c -g %s -target x86_64-linux-gnu 2>&1 \ 5 // RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s 6 // RUN: %clang -### -c -g2 %s -target x86_64-linux-gnu 2>&1 \ 7 // RUN: | FileCheck -check-prefix=G %s 8 // RUN: %clang -### -c -g3 %s -target x86_64-linux-gnu 2>&1 \ 9 // RUN: | FileCheck -check-prefix=G %s 10 // RUN: %clang -### -c -ggdb %s -target x86_64-linux-gnu 2>&1 \ 11 // RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s 12 // RUN: %clang -### -c -ggdb1 %s -target x86_64-linux-gnu 2>&1 \ 13 // RUN: | FileCheck -check-prefix=GLTO_ONLY -check-prefix=G_GDB %s 14 // RUN: %clang -### -c -ggdb3 %s -target x86_64-linux-gnu 2>&1 \ 15 // RUN: | FileCheck -check-prefix=G %s 16 // RUN: %clang -### -c -glldb %s -target x86_64-linux-gnu 2>&1 \ 17 // RUN: | FileCheck -check-prefix=G -check-prefix=G_LLDB %s 18 // RUN: %clang -### -c -gsce %s -target x86_64-linux-gnu 2>&1 \ 19 // RUN: | FileCheck -check-prefix=G -check-prefix=G_SCE %s 20 21 // RUN: %clang -### -c -g %s -target x86_64-apple-darwin 2>&1 \ 22 // RUN: | FileCheck -check-prefix=G_DARWIN -check-prefix=G_LLDB %s 23 // RUN: %clang -### -c -g2 %s -target x86_64-apple-darwin 2>&1 \ 24 // RUN: | FileCheck -check-prefix=G_DARWIN %s 25 // RUN: %clang -### -c -g3 %s -target x86_64-apple-darwin 2>&1 \ 26 // RUN: | FileCheck -check-prefix=G_DARWIN %s 27 // RUN: %clang -### -c -ggdb %s -target x86_64-apple-darwin 2>&1 \ 28 // RUN: | FileCheck -check-prefix=G_DARWIN -check-prefix=G_GDB %s 29 // RUN: %clang -### -c -ggdb1 %s -target x86_64-apple-darwin 2>&1 \ 30 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s 31 // RUN: %clang -### -c -ggdb3 %s -target x86_64-apple-darwin 2>&1 \ 32 // RUN: | FileCheck -check-prefix=G_DARWIN %s 33 34 // RUN: %clang -### -c -g %s -target x86_64-pc-freebsd10.0 2>&1 \ 35 // RUN: | FileCheck -check-prefix=G_GDB %s 36 37 // On the PS4, -g defaults to -gno-column-info, and we always generate the 38 // arange section. 39 // RUN: %clang -### -c %s -target x86_64-scei-ps4 2>&1 \ 40 // RUN: | FileCheck -check-prefix=NOG_PS4 %s 41 // RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \ 42 // RUN: | FileCheck -check-prefix=G_PS4 %s 43 // RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \ 44 // RUN: | FileCheck -check-prefix=G_SCE %s 45 // RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \ 46 // RUN: | FileCheck -check-prefix=NOCI %s 47 // RUN: %clang -### -c %s -g -gcolumn-info -target x86_64-scei-ps4 2>&1 \ 48 // RUN: | FileCheck -check-prefix=CI %s 49 50 // RUN: %clang -### -c -gdwarf-2 %s 2>&1 | FileCheck -check-prefix=G_D2 %s 51 // 52 // RUN: %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=G_NO %s 53 // RUN: %clang -### -c -g -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s 54 // RUN: %clang -### -c -ggdb0 %s 2>&1 | FileCheck -check-prefix=G_NO %s 55 // RUN: %clang -### -c -glldb -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s 56 // RUN: %clang -### -c -glldb -g1 %s 2>&1 \ 57 // RUN: | FileCheck -check-prefix=GLTO_ONLY -check-prefix=G_LLDB %s 58 // 59 // PS4 defaults to sce; -ggdb0 changes tuning but turns off debug info, 60 // then -g turns it back on without affecting tuning. 61 // RUN: %clang -### -c -ggdb0 -g -target x86_64-scei-ps4 %s 2>&1 \ 62 // RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s 63 // 64 // RUN: %clang -### -c -g1 %s 2>&1 \ 65 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s 66 // RUN: %clang -### -c -gmlt %s 2>&1 \ 67 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s 68 // RUN: %clang -### -c -gline-tables-only %s 2>&1 \ 69 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s 70 // RUN: %clang -### -c -gline-tables-only %s -target x86_64-apple-darwin 2>&1 \ 71 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s 72 // RUN: %clang -### -c -gline-tables-only %s -target i686-pc-openbsd 2>&1 \ 73 // RUN: | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s 74 // RUN: %clang -### -c -gline-tables-only %s -target x86_64-pc-freebsd10.0 2>&1 \ 75 // RUN: | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s 76 // RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-linux-gnu 2>&1 \ 77 // RUN: | FileCheck -check-prefix=G_ONLY %s 78 // RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-apple-darwin 2>&1 \ 79 // RUN: | FileCheck -check-prefix=G_STANDALONE_DWARF4 %s 80 // RUN: %clang -### -c -gline-tables-only -g %s -target i686-pc-openbsd 2>&1 \ 81 // RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s 82 // RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-pc-freebsd10.0 2>&1 \ 83 // RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s 84 // RUN: %clang -### -c -gline-tables-only -g %s -target i386-pc-solaris 2>&1 \ 85 // RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s 86 // RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \ 87 // RUN: | FileCheck -check-prefix=GLTO_NO %s 88 // 89 // RUN: %clang -### -c -grecord-gcc-switches -gno-record-gcc-switches \ 90 // RUN: -gstrict-dwarf -gno-strict-dwarf %s 2>&1 \ 91 // RUN: | FileCheck -check-prefix=GIGNORE %s 92 // 93 // RUN: %clang -### -c -ggnu-pubnames %s 2>&1 | FileCheck -check-prefix=GOPT %s 94 // 95 // RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s 96 // 97 // RUN: %clang -### -fdebug-types-section %s 2>&1 \ 98 // RUN: | FileCheck -check-prefix=FDTS %s 99 // 100 // RUN: %clang -### -fdebug-types-section -fno-debug-types-section %s 2>&1 \ 101 // RUN: | FileCheck -check-prefix=NOFDTS %s 102 // 103 // RUN: %clang -### -g -gno-column-info %s 2>&1 \ 104 // RUN: | FileCheck -check-prefix=NOCI %s 105 // 106 // RUN: %clang -### -g -target x86_64-unknown-unknown %s 2>&1 \ 107 // | FileCheck -check-prefix=CI %s 108 // 109 // RUN: %clang -### -gmodules %s 2>&1 \ 110 // RUN: | FileCheck -check-prefix=GEXTREFS %s 111 // 112 // RUN: %clang -### -gmodules -g %s 2>&1 \ 113 // RUN: | FileCheck -check-prefix=GEXTREFS %s 114 // 115 // RUN: %clang -### -gline-tables-only -gmodules %s 2>&1 \ 116 // RUN: | FileCheck -check-prefix=GEXTREFS %s 117 // 118 // RUN: %clang -### -gmodules -gline-tables-only %s 2>&1 \ 119 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s 120 // 121 // G: "-cc1" 122 // G: "-debug-info-kind=limited" 123 // 124 // G_DARWIN: "-cc1" 125 // G_DARWIN: "-dwarf-version=4" 126 // 127 // NOG_PS4: "-cc1" 128 // NOG_PS4-NOT "-dwarf-version= 129 // NOG_PS4: "-generate-arange-section" 130 // NOG_PS4-NOT: "-dwarf-version= 131 // 132 // G_PS4: "-cc1" 133 // G_PS4: "-dwarf-version= 134 // G_PS4: "-generate-arange-section" 135 // 136 // G_D2: "-cc1" 137 // G_D2: "-dwarf-version=2" 138 // 139 // G_NO: "-cc1" 140 // G_NO-NOT: -debug-info-kind= 141 // 142 // GLTO_ONLY: "-cc1" 143 // GLTO_ONLY-NOT: "-dwarf-ext-refs" 144 // GLTO_ONLY: "-debug-info-kind=line-tables-only" 145 // GLTO_ONLY-NOT: "-dwarf-ext-refs" 146 // 147 // GLTO_ONLY_DWARF2: "-cc1" 148 // GLTO_ONLY_DWARF2: "-debug-info-kind=line-tables-only" 149 // GLTO_ONLY_DWARF2: "-dwarf-version=2" 150 // 151 // G_ONLY: "-cc1" 152 // G_ONLY: "-debug-info-kind=limited" 153 // 154 // G_GDB: "-debugger-tuning=gdb" 155 // G_LLDB: "-debugger-tuning=lldb" 156 // G_SCE: "-debugger-tuning=sce" 157 // 158 // These tests assert that "-gline-tables-only" "-g" uses the latter, 159 // but otherwise not caring about the DebugInfoKind. 160 // G_ONLY_DWARF2: "-cc1" 161 // G_ONLY_DWARF2: "-debug-info-kind={{standalone|limited}}" 162 // G_ONLY_DWARF2: "-dwarf-version=2" 163 // 164 // G_STANDALONE_DWARF4: "-cc1" 165 // G_STANDALONE_DWARF4: "-debug-info-kind=standalone" 166 // G_STANDALONE_DWARF4: "-dwarf-version=4" 167 // 168 // This tests asserts that "-gline-tables-only" "-g0" disables debug info. 169 // GLTO_NO: "-cc1" 170 // GLTO_NO-NOT: -debug-info-kind= 171 // 172 // GIGNORE-NOT: "argument unused during compilation" 173 // 174 // GOPT: -generate-gnu-dwarf-pub-sections 175 // 176 // GARANGE: -generate-arange-section 177 // 178 // FDTS: "-backend-option" "-generate-type-units" 179 // 180 // NOFDTS-NOT: "-backend-option" "-generate-type-units" 181 // 182 // CI: "-dwarf-column-info" 183 // 184 // NOCI-NOT: "-dwarf-column-info" 185 // 186 // GEXTREFS: "-dwarf-ext-refs" "-fmodule-format=obj" "-debug-info-kind={{standalone|limited}}" 187 188 // RUN: not %clang -cc1 -debug-info-kind=watkind 2>&1 | FileCheck -check-prefix=BADSTRING1 %s 189 // BADSTRING1: error: invalid value 'watkind' in '-debug-info-kind=watkind' 190 // RUN: not %clang -cc1 -debugger-tuning=gmodal 2>&1 | FileCheck -check-prefix=BADSTRING2 %s 191 // BADSTRING2: error: invalid value 'gmodal' in '-debugger-tuning=gmodal' 192