llvm.org GIT mirror llvm / b1d6ad1
[CodeView] Add support for emitting column information Column information is present in CodeView when the line table subsection has bit 0 set to 1 in it's flags field. The column information is represented as a pair of 16-bit quantities: a starting and ending column. This information is present at the end of the chunk, after all the line-PC pairs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241764 91177308-0d34-0410-b5e6-96231b3b80d8 David Majnemer 5 years ago
9 changed file(s) with 259 addition(s) and 50 deletion(s). Raw diff Collapse all Expand all
654654 };
655655
656656 enum CodeViewIdentifiers {
657 DEBUG_LINE_TABLES_HAVE_COLUMN_RECORDS = 0x1,
657658 DEBUG_SECTION_MAGIC = 0x4,
658659 DEBUG_SYMBOL_SUBSECTION = 0xF1,
659660 DEBUG_LINE_TABLE_SUBSECTION = 0xF2,
9696 MCSymbol *MCL = Asm->MMI->getContext().createTempSymbol();
9797 Asm->OutStreamer->EmitLabel(MCL);
9898 CurFn->Instrs.push_back(MCL);
99 InstrInfo[MCL] = InstrInfoTy(Filename, DL.getLine());
99 InstrInfo[MCL] = InstrInfoTy(Filename, DL.getLine(), DL.getCol());
100100 }
101101
102102 WinCodeViewLineTables::WinCodeViewLineTables(AsmPrinter *AP)
263263 // Identify the function this subsection is for.
264264 Asm->OutStreamer->EmitCOFFSecRel32(Fn);
265265 Asm->OutStreamer->EmitCOFFSectionIndex(Fn);
266 // Insert padding after a 16-bit section index.
267 Asm->EmitInt16(0);
266 // Insert flags after a 16-bit section index.
267 Asm->EmitInt16(COFF::DEBUG_LINE_TABLES_HAVE_COLUMN_RECORDS);
268268
269269 // Length of the function's code, in bytes.
270270 EmitLabelDiff(*Asm->OutStreamer, Fn, FI.End);
271271
272272 // PC-to-linenumber lookup table:
273273 MCSymbol *FileSegmentEnd = nullptr;
274
275 // The start of the last segment:
276 size_t LastSegmentStart = 0;
277
278 auto FinishPreviousChunk = [&] {
279 if (!FileSegmentEnd)
280 return;
281 for (size_t ColSegI = LastSegmentStart,
282 ColSegEnd = ColSegI + FilenameSegmentLengths[LastSegmentStart];
283 ColSegI != ColSegEnd; ++ColSegI) {
284 unsigned ColumnNumber = InstrInfo[FI.Instrs[ColSegI]].ColumnNumber;
285 Asm->EmitInt16(ColumnNumber); // Start column
286 Asm->EmitInt16(ColumnNumber); // End column
287 }
288 Asm->OutStreamer->EmitLabel(FileSegmentEnd);
289 };
290
274291 for (size_t J = 0, F = FI.Instrs.size(); J != F; ++J) {
275292 MCSymbol *Instr = FI.Instrs[J];
276293 assert(InstrInfo.count(Instr));
277294
278295 if (FilenameSegmentLengths.count(J)) {
279296 // We came to a beginning of a new filename segment.
280 if (FileSegmentEnd)
281 Asm->OutStreamer->EmitLabel(FileSegmentEnd);
297 FinishPreviousChunk();
282298 StringRef CurFilename = InstrInfo[FI.Instrs[J]].Filename;
283299 assert(FileNameRegistry.Infos.count(CurFilename));
284300 size_t IndexInStringTable =
299315 // records.
300316 FileSegmentEnd = Asm->MMI->getContext().createTempSymbol();
301317 EmitLabelDiff(*Asm->OutStreamer, FileSegmentBegin, FileSegmentEnd);
318 LastSegmentStart = J;
302319 }
303320
304321 // The first PC with the given linenumber and the linenumber itself.
306323 Asm->EmitInt32(InstrInfo[Instr].LineNumber);
307324 }
308325
309 if (FileSegmentEnd)
310 Asm->OutStreamer->EmitLabel(FileSegmentEnd);
326 FinishPreviousChunk();
311327 Asm->OutStreamer->EmitLabel(LineTableEnd);
312328 }
313329
5151 struct InstrInfoTy {
5252 StringRef Filename;
5353 unsigned LineNumber;
54 unsigned ColumnNumber;
5455
55 InstrInfoTy() : LineNumber(0) {}
56 InstrInfoTy() : LineNumber(0), ColumnNumber(0) {}
5657
57 InstrInfoTy(StringRef Filename, unsigned LineNumber)
58 : Filename(Filename), LineNumber(LineNumber) {}
58 InstrInfoTy(StringRef Filename, unsigned LineNumber, unsigned ColumnNumber)
59 : Filename(Filename), LineNumber(LineNumber),
60 ColumnNumber(ColumnNumber) {}
5961 };
6062 DenseMap InstrInfo;
6163
5050 ; X86-NEXT: [[F2_START]]:
5151 ; X86-NEXT: .secrel32 _f
5252 ; X86-NEXT: .secidx _f
53 ; X86-NEXT: .short 0
53 ; X86-NEXT: .short 1
5454 ; X86-NEXT: .long [[END_OF_F]]-_f
5555 ; X86-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
5656 ; X86-NEXT: .long 0
6262 ; X86-NEXT: .long 5
6363 ; X86-NEXT: .long [[RETURN_STMT]]-_f
6464 ; X86-NEXT: .long 6
65 ; X86-NEXT: .short 0
66 ; X86-NEXT: .short 0
67 ; X86-NEXT: .short 0
68 ; X86-NEXT: .short 0
69 ; X86-NEXT: .short 0
70 ; X86-NEXT: .short 0
6571 ; X86-NEXT: [[FILE_SEGMENT_END]]:
6672 ; X86-NEXT: [[F2_END]]:
6773 ; File index to string table offset subsection
100106 ; OBJ32-NEXT: ]
101107 ; OBJ32: FunctionLineTable [
102108 ; OBJ32-NEXT: Name: _f
109 ; OBJ32-NEXT: Flags: 0x1
103110 ; OBJ32-NEXT: CodeSize: 0x6
104111 ; OBJ32-NEXT: FilenameSegment [
105112 ; OBJ32-NEXT: Filename: D:\asm.c
109116 ; OBJ32-NEXT: +0x0: 4
110117 ; OBJ32-NEXT: +0x0: 5
111118 ; OBJ32-NEXT: +0x5: 6
119 ; OBJ32-NEXT: ColStart: 0
120 ; OBJ32-NEXT: ColEnd: 0
121 ; OBJ32-NEXT: ColStart: 0
122 ; OBJ32-NEXT: ColEnd: 0
123 ; OBJ32-NEXT: ColStart: 0
124 ; OBJ32-NEXT: ColEnd: 0
112125 ; OBJ32-NEXT: ]
113126 ; OBJ32-NEXT: ]
114127 ; OBJ32: }
156169 ; X64-NEXT: [[F2_START]]:
157170 ; X64-NEXT: .secrel32 f
158171 ; X64-NEXT: .secidx f
159 ; X64-NEXT: .short 0
172 ; X64-NEXT: .short 1
160173 ; X64-NEXT: .long [[END_OF_F]]-f
161174 ; X64-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
162175 ; X64-NEXT: .long 0
170183 ; X64-NEXT: .long 5
171184 ; X64-NEXT: .long [[EPILOG_AND_RET]]-f
172185 ; X64-NEXT: .long 6
186 ; X64-NEXT: .short 0
187 ; X64-NEXT: .short 0
188 ; X64-NEXT: .short 0
189 ; X64-NEXT: .short 0
190 ; X64-NEXT: .short 0
191 ; X64-NEXT: .short 0
192 ; X64-NEXT: .short 0
193 ; X64-NEXT: .short 0
173194 ; X64-NEXT: [[FILE_SEGMENT_END]]:
174195 ; X64-NEXT: [[F2_END]]:
175196 ; File index to string table offset subsection
208229 ; OBJ64-NEXT: ]
209230 ; OBJ64: FunctionLineTable [
210231 ; OBJ64-NEXT: Name: f
232 ; OBJ64-NEXT: Flags: 0x1
211233 ; OBJ64-NEXT: CodeSize: 0xE
212234 ; OBJ64-NEXT: FilenameSegment [
213235 ; OBJ64-NEXT: Filename: D:\asm.c
217239 ; OBJ64-NEXT: +0x4: 4
218240 ; OBJ64-NEXT: +0x4: 5
219241 ; OBJ64-NEXT: +0x9: 6
242 ; OBJ64-NEXT: ColStart: 0
243 ; OBJ64-NEXT: ColEnd: 0
244 ; OBJ64-NEXT: ColStart: 0
245 ; OBJ64-NEXT: ColEnd: 0
246 ; OBJ64-NEXT: ColStart: 0
247 ; OBJ64-NEXT: ColEnd: 0
248 ; OBJ64-NEXT: ColStart: 0
249 ; OBJ64-NEXT: ColEnd: 0
220250 ; OBJ64-NEXT: ]
221251 ; OBJ64-NEXT: ]
222252 ; OBJ64: }
5757 ; X86-NEXT: [[F2_START]]:
5858 ; X86-NEXT: .secrel32 _f
5959 ; X86-NEXT: .secidx _f
60 ; X86-NEXT: .short 0
60 ; X86-NEXT: .short 1
6161 ; X86-NEXT: .long [[END_OF_F]]-_f
6262 ; Segment for file 'D:\\one.c' begins
6363 ; X86-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
6666 ; X86-NEXT: .long [[FILE_SEGMENT_END:.*]]-[[FILE_SEGMENT_START]]
6767 ; X86-NEXT: .long [[CALL_LINE_1]]-_f
6868 ; X86-NEXT: .long 1
69 ; X86-NEXT: .short 0
70 ; X86-NEXT: .short 0
6971 ; X86-NEXT: [[FILE_SEGMENT_END]]:
7072 ; Segment for file 'D:\\two.c' begins
7173 ; X86-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
7476 ; X86-NEXT: .long [[FILE_SEGMENT_END:.*]]-[[FILE_SEGMENT_START]]
7577 ; X86-NEXT: .long [[CALL_LINE_2]]-_f
7678 ; X86-NEXT: .long 2
79 ; X86-NEXT: .short 0
80 ; X86-NEXT: .short 0
7781 ; X86-NEXT: [[FILE_SEGMENT_END]]:
7882 ; A new segment for file 'D:\\one.c' begins
7983 ; X86-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
8488 ; X86-NEXT: .long 7
8589 ; X86-NEXT: .long [[RETURN_STMT]]-_f
8690 ; X86-NEXT: .long 8
91 ; X86-NEXT: .short 0
92 ; X86-NEXT: .short 0
93 ; X86-NEXT: .short 0
94 ; X86-NEXT: .short 0
8795 ; X86-NEXT: [[FILE_SEGMENT_END]]:
8896 ; X86-NEXT: [[F2_END]]:
8997 ; File index to string table offset subsection
125133 ; OBJ32-NEXT: ]
126134 ; OBJ32: FunctionLineTable [
127135 ; OBJ32-NEXT: Name: _f
136 ; OBJ32-NEXT: Flags: 0x1
128137 ; OBJ32-NEXT: CodeSize: 0x10
129138 ; OBJ32-NEXT: FilenameSegment [
130139 ; OBJ32-NEXT: Filename: D:\one.c
131140 ; OBJ32-NEXT: +0x0: 1
141 ; OBJ32-NEXT: ColStart: 0
142 ; OBJ32-NEXT: ColEnd: 0
132143 ; OBJ32-NEXT: ]
133144 ; OBJ32-NEXT: FilenameSegment [
134145 ; OBJ32-NEXT: Filename: D:\two.c
135146 ; OBJ32-NEXT: +0x5: 2
147 ; OBJ32-NEXT: ColStart: 0
148 ; OBJ32-NEXT: ColEnd: 0
136149 ; OBJ32-NEXT: ]
137150 ; OBJ32-NEXT: FilenameSegment [
138151 ; OBJ32-NEXT: Filename: D:\one.c
139152 ; OBJ32-NEXT: +0xA: 7
140153 ; OBJ32-NEXT: +0xF: 8
154 ; OBJ32-NEXT: ColStart: 0
155 ; OBJ32-NEXT: ColEnd: 0
156 ; OBJ32-NEXT: ColStart: 0
157 ; OBJ32-NEXT: ColEnd: 0
141158 ; OBJ32-NEXT: ]
142159 ; OBJ32-NEXT: ]
143160 ; OBJ32: }
188205 ; X64-NEXT: [[F2_START]]:
189206 ; X64-NEXT: .secrel32 f
190207 ; X64-NEXT: .secidx f
191 ; X64-NEXT: .short 0
208 ; X64-NEXT: .short 1
192209 ; X64-NEXT: .long [[END_OF_F]]-f
193210 ; Segment for file 'D:\\input.c' begins
194211 ; X64-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
197214 ; X64-NEXT: .long [[FILE_SEGMENT_END:.*]]-[[FILE_SEGMENT_START]]
198215 ; X64-NEXT: .long [[START]]-f
199216 ; X64-NEXT: .long 3
217 ; X64-NEXT: .short 0
218 ; X64-NEXT: .short 0
200219 ; X64-NEXT: [[FILE_SEGMENT_END]]:
201220 ; Segment for file 'D:\\one.c' begins
202221 ; X64-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
205224 ; X64-NEXT: .long [[FILE_SEGMENT_END:.*]]-[[FILE_SEGMENT_START]]
206225 ; X64-NEXT: .long [[CALL_LINE_1]]-f
207226 ; X64-NEXT: .long 1
227 ; X64-NEXT: .short 0
228 ; X64-NEXT: .short 0
208229 ; X64-NEXT: [[FILE_SEGMENT_END]]:
209230 ; Segment for file 'D:\\two.c' begins
210231 ; X64-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
213234 ; X64-NEXT: .long [[FILE_SEGMENT_END:.*]]-[[FILE_SEGMENT_START]]
214235 ; X64-NEXT: .long [[CALL_LINE_2]]-f
215236 ; X64-NEXT: .long 2
237 ; X64-NEXT: .short 0
238 ; X64-NEXT: .short 0
216239 ; X64-NEXT: [[FILE_SEGMENT_END]]:
217240 ; A new segment for file 'D:\\one.c' begins
218241 ; X64-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
223246 ; X64-NEXT: .long 7
224247 ; X64-NEXT: .long [[EPILOG_AND_RET]]-f
225248 ; X64-NEXT: .long 8
249 ; X64-NEXT: .short 0
250 ; X64-NEXT: .short 0
251 ; X64-NEXT: .short 0
252 ; X64-NEXT: .short 0
226253 ; X64-NEXT: [[FILE_SEGMENT_END]]:
227254 ; X64-NEXT: [[F2_END]]:
228255 ; File index to string table offset subsection
268295 ; OBJ64-NEXT: ]
269296 ; OBJ64: FunctionLineTable [
270297 ; OBJ64-NEXT: Name: f
298 ; OBJ64-NEXT: Flags: 0x1
271299 ; OBJ64-NEXT: CodeSize: 0x18
272300 ; OBJ64-NEXT: FilenameSegment [
273301 ; OBJ64-NEXT: Filename: D:\input.c
274302 ; OBJ64-NEXT: +0x0: 3
303 ; OBJ64-NEXT: ColStart: 0
304 ; OBJ64-NEXT: ColEnd: 0
275305 ; OBJ64-NEXT: ]
276306 ; OBJ64-NEXT: FilenameSegment [
277307 ; OBJ64-NEXT: Filename: D:\one.c
278308 ; OBJ64-NEXT: +0x4: 1
309 ; OBJ64-NEXT: ColStart: 0
310 ; OBJ64-NEXT: ColEnd: 0
279311 ; OBJ64-NEXT: ]
280312 ; OBJ64-NEXT: FilenameSegment [
281313 ; OBJ64-NEXT: Filename: D:\two.c
282314 ; OBJ64-NEXT: +0x9: 2
315 ; OBJ64-NEXT: ColStart: 0
316 ; OBJ64-NEXT: ColEnd: 0
283317 ; OBJ64-NEXT: ]
284318 ; OBJ64-NEXT: FilenameSegment [
285319 ; OBJ64-NEXT: Filename: D:\one.c
286320 ; OBJ64-NEXT: +0xE: 7
287321 ; OBJ64-NEXT: +0x13: 8
322 ; OBJ64-NEXT: ColStart: 0
323 ; OBJ64-NEXT: ColEnd: 0
324 ; OBJ64-NEXT: ColStart: 0
325 ; OBJ64-NEXT: ColEnd: 0
288326 ; OBJ64-NEXT: ]
289327 ; OBJ64-NEXT: ]
290328 ; OBJ64: }
8181 ; X86-NEXT: [[F2_START]]:
8282 ; X86-NEXT: .secrel32 _x
8383 ; X86-NEXT: .secidx _x
84 ; X86-NEXT: .short 0
84 ; X86-NEXT: .short 1
8585 ; X86-NEXT: .long [[END_OF_X]]-_x
8686 ; X86-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
8787 ; X86-NEXT: .long 0
9191 ; X86-NEXT: .long 4
9292 ; X86-NEXT: .long [[X_RETURN]]-_x
9393 ; X86-NEXT: .long 5
94 ; X86-NEXT: .short 42
95 ; X86-NEXT: .short 42
96 ; X86-NEXT: .short 43
97 ; X86-NEXT: .short 43
9498 ; X86-NEXT: [[FILE_SEGMENT_END]]:
9599 ; X86-NEXT: [[F2_END]]:
96100 ; Symbol subsection for y
120124 ; X86-NEXT: [[F2_START]]:
121125 ; X86-NEXT: .secrel32 _y
122126 ; X86-NEXT: .secidx _y
123 ; X86-NEXT: .short 0
127 ; X86-NEXT: .short 1
124128 ; X86-NEXT: .long [[END_OF_Y]]-_y
125129 ; X86-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
126130 ; X86-NEXT: .long 0
130134 ; X86-NEXT: .long 8
131135 ; X86-NEXT: .long [[Y_RETURN]]-_y
132136 ; X86-NEXT: .long 9
137 ; X86-NEXT: .short 52
138 ; X86-NEXT: .short 52
139 ; X86-NEXT: .short 53
140 ; X86-NEXT: .short 53
133141 ; X86-NEXT: [[FILE_SEGMENT_END]]:
134142 ; X86-NEXT: [[F2_END]]:
135143 ; Symbol subsection for f
159167 ; X86-NEXT: [[F2_START]]:
160168 ; X86-NEXT: .secrel32 _f
161169 ; X86-NEXT: .secidx _f
162 ; X86-NEXT: .short 0
170 ; X86-NEXT: .short 1
163171 ; X86-NEXT: .long [[END_OF_F]]-_f
164172 ; X86-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
165173 ; X86-NEXT: .long 0
173181 ; X86-NEXT: .long 14
174182 ; X86-NEXT: .long [[F_RETURN]]-_f
175183 ; X86-NEXT: .long 15
184 ; X86-NEXT: .short 62
185 ; X86-NEXT: .short 62
186 ; X86-NEXT: .short 63
187 ; X86-NEXT: .short 63
188 ; X86-NEXT: .short 72
189 ; X86-NEXT: .short 72
190 ; X86-NEXT: .short 73
191 ; X86-NEXT: .short 73
176192 ; X86-NEXT: [[FILE_SEGMENT_END]]:
177193 ; X86-NEXT: [[F2_END]]:
178194 ; File index to string table offset subsection
197213 ; OBJ32-NEXT: 0x30 IMAGE_REL_I386_SECTION _x
198214 ; OBJ32-NEXT: 0x44 IMAGE_REL_I386_SECREL _x
199215 ; OBJ32-NEXT: 0x48 IMAGE_REL_I386_SECTION _x
200 ; OBJ32-NEXT: 0x94 IMAGE_REL_I386_SECREL _y
201 ; OBJ32-NEXT: 0x98 IMAGE_REL_I386_SECTION _y
202 ; OBJ32-NEXT: 0xAC IMAGE_REL_I386_SECREL _y
203 ; OBJ32-NEXT: 0xB0 IMAGE_REL_I386_SECTION _y
204 ; OBJ32-NEXT: 0xFC IMAGE_REL_I386_SECREL _f
205 ; OBJ32-NEXT: 0x100 IMAGE_REL_I386_SECTION _f
206 ; OBJ32-NEXT: 0x114 IMAGE_REL_I386_SECREL _f
207 ; OBJ32-NEXT: 0x118 IMAGE_REL_I386_SECTION _f
216 ; OBJ32-NEXT: 0x9C IMAGE_REL_I386_SECREL _y
217 ; OBJ32-NEXT: 0xA0 IMAGE_REL_I386_SECTION _y
218 ; OBJ32-NEXT: 0xB4 IMAGE_REL_I386_SECREL _y
219 ; OBJ32-NEXT: 0xB8 IMAGE_REL_I386_SECTION _y
220 ; OBJ32-NEXT: 0x10C IMAGE_REL_I386_SECREL _f
221 ; OBJ32-NEXT: 0x110 IMAGE_REL_I386_SECTION _f
222 ; OBJ32-NEXT: 0x124 IMAGE_REL_I386_SECREL _f
223 ; OBJ32-NEXT: 0x128 IMAGE_REL_I386_SECTION _f
208224 ; OBJ32-NEXT: ]
209225 ; OBJ32: Subsection [
210226 ; OBJ32-NEXT: Type: 0xF1
247263 ; OBJ32: ]
248264 ; OBJ32: FunctionLineTable [
249265 ; OBJ32-NEXT: Name: _x
266 ; OBJ32-NEXT: Flags: 0x1
250267 ; OBJ32-NEXT: CodeSize: 0x6
251268 ; OBJ32-NEXT: FilenameSegment [
252269 ; OBJ32-NEXT: Filename: D:\source.c
253270 ; OBJ32-NEXT: +0x0: 4
254271 ; OBJ32-NEXT: +0x5: 5
272 ; OBJ32-NEXT: ColStart: 42
273 ; OBJ32-NEXT: ColEnd: 42
274 ; OBJ32-NEXT: ColStart: 43
275 ; OBJ32-NEXT: ColEnd: 43
255276 ; OBJ32-NEXT: ]
256277 ; OBJ32-NEXT: ]
257278 ; OBJ32-NEXT: FunctionLineTable [
258279 ; OBJ32-NEXT: Name: _y
280 ; OBJ32-NEXT: Flags: 0x1
259281 ; OBJ32-NEXT: CodeSize: 0x6
260282 ; OBJ32-NEXT: FilenameSegment [
261283 ; OBJ32-NEXT: Filename: D:\source.c
262284 ; OBJ32-NEXT: +0x0: 8
263285 ; OBJ32-NEXT: +0x5: 9
286 ; OBJ32-NEXT: ColStart: 52
287 ; OBJ32-NEXT: ColEnd: 52
288 ; OBJ32-NEXT: ColStart: 53
289 ; OBJ32-NEXT: ColEnd: 53
264290 ; OBJ32-NEXT: ]
265291 ; OBJ32-NEXT: ]
266292 ; OBJ32-NEXT: FunctionLineTable [
267293 ; OBJ32-NEXT: Name: _f
294 ; OBJ32-NEXT: Flags: 0x1
268295 ; OBJ32-NEXT: CodeSize: 0x10
269296 ; OBJ32-NEXT: FilenameSegment [
270297 ; OBJ32-NEXT: Filename: D:\source.c
272299 ; OBJ32-NEXT: +0x5: 13
273300 ; OBJ32-NEXT: +0xA: 14
274301 ; OBJ32-NEXT: +0xF: 15
302 ; OBJ32-NEXT: ColStart: 62
303 ; OBJ32-NEXT: ColEnd: 62
304 ; OBJ32-NEXT: ColStart: 63
305 ; OBJ32-NEXT: ColEnd: 63
306 ; OBJ32-NEXT: ColStart: 72
307 ; OBJ32-NEXT: ColEnd: 72
308 ; OBJ32-NEXT: ColStart: 73
309 ; OBJ32-NEXT: ColEnd: 73
275310 ; OBJ32-NEXT: ]
276311 ; OBJ32-NEXT: ]
277312 ; OBJ32: }
348383 ; X64-NEXT: [[F2_START]]:
349384 ; X64-NEXT: .secrel32 x
350385 ; X64-NEXT: .secidx x
351 ; X64-NEXT: .short 0
386 ; X64-NEXT: .short 1
352387 ; X64-NEXT: .long [[END_OF_X]]-x
353388 ; X64-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
354389 ; X64-NEXT: .long 0
360395 ; X64-NEXT: .long 4
361396 ; X64-NEXT: .long [[X_EPILOG_AND_RET]]-x
362397 ; X64-NEXT: .long 5
398 ; X64-NEXT: .short 0
399 ; X64-NEXT: .short 0
400 ; X64-NEXT: .short 42
401 ; X64-NEXT: .short 42
402 ; X64-NEXT: .short 43
403 ; X64-NEXT: .short 43
363404 ; X64-NEXT: [[FILE_SEGMENT_END]]:
364405 ; X64-NEXT: [[F2_END]]:
365406 ; Symbol subsection for y
389430 ; X64-NEXT: [[F2_START]]:
390431 ; X64-NEXT: .secrel32 y
391432 ; X64-NEXT: .secidx y
392 ; X64-NEXT: .short 0
433 ; X64-NEXT: .short 1
393434 ; X64-NEXT: .long [[END_OF_Y]]-y
394435 ; X64-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
395436 ; X64-NEXT: .long 0
401442 ; X64-NEXT: .long 8
402443 ; X64-NEXT: .long [[Y_EPILOG_AND_RET]]-y
403444 ; X64-NEXT: .long 9
445 ; X64-NEXT: .short 0
446 ; X64-NEXT: .short 0
447 ; X64-NEXT: .short 52
448 ; X64-NEXT: .short 52
449 ; X64-NEXT: .short 53
450 ; X64-NEXT: .short 53
404451 ; X64-NEXT: [[FILE_SEGMENT_END]]:
405452 ; X64-NEXT: [[F2_END]]:
406453 ; Symbol subsection for f
430477 ; X64-NEXT: [[F2_START]]:
431478 ; X64-NEXT: .secrel32 f
432479 ; X64-NEXT: .secidx f
433 ; X64-NEXT: .short 0
480 ; X64-NEXT: .short 1
434481 ; X64-NEXT: .long [[END_OF_F]]-f
435482 ; X64-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
436483 ; X64-NEXT: .long 0
446493 ; X64-NEXT: .long 14
447494 ; X64-NEXT: .long [[F_EPILOG_AND_RET]]-f
448495 ; X64-NEXT: .long 15
496 ; X64-NEXT: .short 0
497 ; X64-NEXT: .short 0
498 ; X64-NEXT: .short 62
499 ; X64-NEXT: .short 62
500 ; X64-NEXT: .short 63
501 ; X64-NEXT: .short 63
502 ; X64-NEXT: .short 72
503 ; X64-NEXT: .short 72
504 ; X64-NEXT: .short 73
505 ; X64-NEXT: .short 73
449506 ; X64-NEXT: [[FILE_SEGMENT_END]]:
450507 ; X64-NEXT: [[F2_END]]:
451508 ; File index to string table offset subsection
470527 ; OBJ64-NEXT: 0x30 IMAGE_REL_AMD64_SECTION x
471528 ; OBJ64-NEXT: 0x44 IMAGE_REL_AMD64_SECREL x
472529 ; OBJ64-NEXT: 0x48 IMAGE_REL_AMD64_SECTION x
473 ; OBJ64-NEXT: 0x9C IMAGE_REL_AMD64_SECREL y
474 ; OBJ64-NEXT: 0xA0 IMAGE_REL_AMD64_SECTION y
475 ; OBJ64-NEXT: 0xB4 IMAGE_REL_AMD64_SECREL y
476 ; OBJ64-NEXT: 0xB8 IMAGE_REL_AMD64_SECTION y
477 ; OBJ64-NEXT: 0x10C IMAGE_REL_AMD64_SECREL f
478 ; OBJ64-NEXT: 0x110 IMAGE_REL_AMD64_SECTION f
530 ; OBJ64-NEXT: 0xA8 IMAGE_REL_AMD64_SECREL y
531 ; OBJ64-NEXT: 0xAC IMAGE_REL_AMD64_SECTION y
532 ; OBJ64-NEXT: 0xC0 IMAGE_REL_AMD64_SECREL y
533 ; OBJ64-NEXT: 0xC4 IMAGE_REL_AMD64_SECTION y
479534 ; OBJ64-NEXT: 0x124 IMAGE_REL_AMD64_SECREL f
480535 ; OBJ64-NEXT: 0x128 IMAGE_REL_AMD64_SECTION f
536 ; OBJ64-NEXT: 0x13C IMAGE_REL_AMD64_SECREL f
537 ; OBJ64-NEXT: 0x140 IMAGE_REL_AMD64_SECTION f
481538 ; OBJ64-NEXT: ]
482539 ; OBJ64: Subsection [
483540 ; OBJ64-NEXT: Type: 0xF1
520577 ; OBJ64: ]
521578 ; OBJ64: FunctionLineTable [
522579 ; OBJ64-NEXT: Name: x
580 ; OBJ64-NEXT: Flags: 0x1
523581 ; OBJ64-NEXT: CodeSize: 0xE
524582 ; OBJ64-NEXT: FilenameSegment [
525583 ; OBJ64-NEXT: Filename: D:\source.c
526584 ; OBJ64-NEXT: +0x0: 3
527585 ; OBJ64-NEXT: +0x4: 4
528586 ; OBJ64-NEXT: +0x9: 5
587 ; OBJ64-NEXT: ColStart: 0
588 ; OBJ64-NEXT: ColEnd: 0
589 ; OBJ64-NEXT: ColStart: 42
590 ; OBJ64-NEXT: ColEnd: 42
591 ; OBJ64-NEXT: ColStart: 43
592 ; OBJ64-NEXT: ColEnd: 43
529593 ; OBJ64-NEXT: ]
530594 ; OBJ64-NEXT: ]
531595 ; OBJ64-NEXT: FunctionLineTable [
532596 ; OBJ64-NEXT: Name: y
597 ; OBJ64-NEXT: Flags: 0x1
533598 ; OBJ64-NEXT: CodeSize: 0xE
534599 ; OBJ64-NEXT: FilenameSegment [
535600 ; OBJ64-NEXT: Filename: D:\source.c
536601 ; OBJ64-NEXT: +0x0: 7
537602 ; OBJ64-NEXT: +0x4: 8
538603 ; OBJ64-NEXT: +0x9: 9
604 ; OBJ64-NEXT: ColStart: 0
605 ; OBJ64-NEXT: ColEnd: 0
606 ; OBJ64-NEXT: ColStart: 52
607 ; OBJ64-NEXT: ColEnd: 52
608 ; OBJ64-NEXT: ColStart: 53
609 ; OBJ64-NEXT: ColEnd: 53
539610 ; OBJ64-NEXT: ]
540611 ; OBJ64-NEXT: ]
541612 ; OBJ64-NEXT: FunctionLineTable [
542613 ; OBJ64-NEXT: Name: f
614 ; OBJ64-NEXT: Flags: 0x1
543615 ; OBJ64-NEXT: CodeSize: 0x18
544616 ; OBJ64-NEXT: FilenameSegment [
545617 ; OBJ64-NEXT: Filename: D:\source.c
548620 ; OBJ64-NEXT: +0x9: 13
549621 ; OBJ64-NEXT: +0xE: 14
550622 ; OBJ64-NEXT: +0x13: 15
623 ; OBJ64-NEXT: ColStart: 0
624 ; OBJ64-NEXT: ColEnd: 0
625 ; OBJ64-NEXT: ColStart: 62
626 ; OBJ64-NEXT: ColEnd: 62
627 ; OBJ64-NEXT: ColStart: 63
628 ; OBJ64-NEXT: ColEnd: 63
629 ; OBJ64-NEXT: ColStart: 72
630 ; OBJ64-NEXT: ColEnd: 72
631 ; OBJ64-NEXT: ColStart: 73
632 ; OBJ64-NEXT: ColEnd: 73
551633 ; OBJ64-NEXT: ]
552634 ; OBJ64-NEXT: ]
553635 ; OBJ64: }
598680 !11 = !{i32 2, !"Dwarf Version", i32 4}
599681 !12 = !{i32 1, !"Debug Info Version", i32 3}
600682 !13 = !{!"clang version 3.5 "}
601 !14 = !DILocation(line: 4, scope: !4)
602 !15 = !DILocation(line: 5, scope: !4)
603 !16 = !DILocation(line: 8, scope: !9)
604 !17 = !DILocation(line: 9, scope: !9)
605 !18 = !DILocation(line: 12, scope: !10)
606 !19 = !DILocation(line: 13, scope: !10)
607 !20 = !DILocation(line: 14, scope: !10)
608 !21 = !DILocation(line: 15, scope: !10)
683 !14 = !DILocation(line: 4, column: 42, scope: !4)
684 !15 = !DILocation(line: 5, column: 43, scope: !4)
685 !16 = !DILocation(line: 8, column: 52, scope: !9)
686 !17 = !DILocation(line: 9, column: 53, scope: !9)
687 !18 = !DILocation(line: 12, column: 62, scope: !10)
688 !19 = !DILocation(line: 13, column: 63, scope: !10)
689 !20 = !DILocation(line: 14, column: 72, scope: !10)
690 !21 = !DILocation(line: 15, column: 73, scope: !10)
4848 ; X86-NEXT: [[F2_START]]:
4949 ; X86-NEXT: .secrel32 _f
5050 ; X86-NEXT: .secidx _f
51 ; X86-NEXT: .short 0
51 ; X86-NEXT: .short 1
5252 ; X86-NEXT: .long [[END_OF_F]]-_f
5353 ; X86-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
5454 ; X86-NEXT: .long 0
5858 ; X86-NEXT: .long 4
5959 ; X86-NEXT: .long [[RETURN_STMT]]-_f
6060 ; X86-NEXT: .long 5
61 ; X86-NEXT: .short 0
62 ; X86-NEXT: .short 0
63 ; X86-NEXT: .short 0
64 ; X86-NEXT: .short 0
6165 ; X86-NEXT: [[FILE_SEGMENT_END]]:
6266 ; X86-NEXT: [[F2_END]]:
6367 ; File index to string table offset subsection
96100 ; OBJ32-NEXT: ]
97101 ; OBJ32: FunctionLineTable [
98102 ; OBJ32-NEXT: Name: _f
103 ; OBJ32-NEXT: Flags: 0x1
99104 ; OBJ32-NEXT: CodeSize: 0x6
100105 ; OBJ32-NEXT: FilenameSegment [
101106 ; OBJ32-NEXT: Filename: D:\test.c
102107 ; OBJ32-NEXT: +0x0: 4
103108 ; OBJ32-NEXT: +0x5: 5
109 ; OBJ32-NEXT: ColStart: 0
110 ; OBJ32-NEXT: ColEnd: 0
111 ; OBJ32-NEXT: ColStart: 0
112 ; OBJ32-NEXT: ColEnd: 0
104113 ; OBJ32-NEXT: ]
105114 ; OBJ32-NEXT: ]
106115 ; OBJ32: }
147156 ; X64-NEXT: [[F2_START]]:
148157 ; X64-NEXT: .secrel32 f
149158 ; X64-NEXT: .secidx f
150 ; X64-NEXT: .short 0
159 ; X64-NEXT: .short 1
151160 ; X64-NEXT: .long [[END_OF_F]]-f
152161 ; X64-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
153162 ; X64-NEXT: .long 0
159168 ; X64-NEXT: .long 4
160169 ; X64-NEXT: .long [[EPILOG_AND_RET]]-f
161170 ; X64-NEXT: .long 5
171 ; X64-NEXT: .short 0
172 ; X64-NEXT: .short 0
173 ; X64-NEXT: .short 0
174 ; X64-NEXT: .short 0
175 ; X64-NEXT: .short 0
176 ; X64-NEXT: .short 0
162177 ; X64-NEXT: [[FILE_SEGMENT_END]]:
163178 ; X64-NEXT: [[F2_END]]:
164179 ; File index to string table offset subsection
197212 ; OBJ64-NEXT: ]
198213 ; OBJ64: FunctionLineTable [
199214 ; OBJ64-NEXT: Name: f
215 ; OBJ64-NEXT: Flags: 0x1
200216 ; OBJ64-NEXT: CodeSize: 0xE
201217 ; OBJ64-NEXT: FilenameSegment [
202218 ; OBJ64-NEXT: Filename: D:\test.c
203219 ; OBJ64-NEXT: +0x0: 3
204220 ; OBJ64-NEXT: +0x4: 4
205221 ; OBJ64-NEXT: +0x9: 5
222 ; OBJ64-NEXT: ColStart: 0
223 ; OBJ64-NEXT: ColEnd: 0
224 ; OBJ64-NEXT: ColStart: 0
225 ; OBJ64-NEXT: ColEnd: 0
226 ; OBJ64-NEXT: ColStart: 0
227 ; OBJ64-NEXT: ColEnd: 0
206228 ; OBJ64-NEXT: ]
207229 ; OBJ64-NEXT: ]
208230 ; OBJ64: }
103103 MFUN32: ]
104104 MFUN32-NEXT: FunctionLineTable [
105105 MFUN32-NEXT: FunctionName: _x
106 MFUN32-NEXT: Flags: 0x0
106107 MFUN32-NEXT: CodeSize: 0xA
107108 MFUN32-NEXT: FilenameSegment [
108109 MFUN32-NEXT: Filename: d:\source.c
113114 MFUN32-NEXT: ]
114115 MFUN32-NEXT: FunctionLineTable [
115116 MFUN32-NEXT: FunctionName: _y
117 MFUN32-NEXT: Flags: 0x0
116118 MFUN32-NEXT: CodeSize: 0xA
117119 MFUN32-NEXT: FilenameSegment [
118120 MFUN32-NEXT: Filename: d:\source.c
123125 MFUN32-NEXT: ]
124126 MFUN32-NEXT: FunctionLineTable [
125127 MFUN32-NEXT: FunctionName: _f
128 MFUN32-NEXT: Flags: 0x0
126129 MFUN32-NEXT: CodeSize: 0x14
127130 MFUN32-NEXT: FilenameSegment [
128131 MFUN32-NEXT: Filename: d:\source.c
200203 MFUN64: ]
201204 MFUN64-NEXT: FunctionLineTable [
202205 MFUN64-NEXT: FunctionName: x
206 MFUN64-NEXT: Flags: 0x0
203207 MFUN64-NEXT: CodeSize: 0xE
204208 MFUN64-NEXT: FilenameSegment [
205209 MFUN64-NEXT: Filename: d:\source.c
210214 MFUN64-NEXT: ]
211215 MFUN64-NEXT: FunctionLineTable [
212216 MFUN64-NEXT: FunctionName: y
217 MFUN64-NEXT: Flags: 0x0
213218 MFUN64-NEXT: CodeSize: 0xE
214219 MFUN64-NEXT: FilenameSegment [
215220 MFUN64-NEXT: Filename: d:\source.c
220225 MFUN64-NEXT: ]
221226 MFUN64-NEXT: FunctionLineTable [
222227 MFUN64-NEXT: FunctionName: f
228 MFUN64-NEXT: Flags: 0x0
223229 MFUN64-NEXT: CodeSize: 0x18
224230 MFUN64-NEXT: FilenameSegment [
225231 MFUN64-NEXT: Filename: d:\source.c
295301 MFILE32: ]
296302 MFILE32-NEXT: FunctionLineTable [
297303 MFILE32-NEXT: FunctionName: _f
304 MFILE32-NEXT: Flags: 0x0
298305 MFILE32-NEXT: CodeSize: 0x14
299306 MFILE32-NEXT: FilenameSegment [
300307 MFILE32-NEXT: Filename: d:\input.c
351358 MFILE64: ]
352359 MFILE64-NEXT: FunctionLineTable [
353360 MFILE64-NEXT: FunctionName: f
361 MFILE64-NEXT: Flags: 0x0
354362 MFILE64-NEXT: CodeSize: 0x18
355363 MFILE64-NEXT: FilenameSegment [
356364 MFILE64-NEXT: Filename: d:\input.c
398406 MCOMDAT-NEXT: }
399407 MCOMDAT: FunctionLineTable [
400408 MCOMDAT-NEXT: FunctionName: ?f@@YAHXZ
409 MCOMDAT-NEXT: Flags: 0x0
401410 MCOMDAT-NEXT: CodeSize: 0x7
402411 MCOMDAT-NEXT: FilenameSegment [
403412 MCOMDAT-NEXT: Filename: c:\src\test.cc
413422 MCOMDAT-NEXT: }
414423 MCOMDAT: FunctionLineTable [
415424 MCOMDAT-NEXT: FunctionName: ?g@@YAHXZ
425 MCOMDAT-NEXT: Flags: 0x0
416426 MCOMDAT-NEXT: CodeSize: 0x7
417427 MCOMDAT-NEXT: FilenameSegment [
418428 MCOMDAT-NEXT: Filename: c:\src\test.cc
584584 W.printString("FunctionName", Name);
585585
586586 DataExtractor DE(FunctionLineTables[Name], true, 4);
587 uint32_t Offset = 8; // Skip relocations.
587 uint32_t Offset = 6; // Skip relocations.
588 uint16_t Flags = DE.getU16(&Offset);
589 W.printHex("Flags", Flags);
590 bool HasColumnInformation =
591 Flags & COFF::DEBUG_LINE_TABLES_HAVE_COLUMN_RECORDS;
588592 uint32_t FunctionSize = DE.getU32(&Offset);
589593 W.printHex("CodeSize", FunctionSize);
590594 while (DE.isValidOffset(Offset)) {
594598 uint32_t OffsetInIndex = DE.getU32(&Offset),
595599 SegmentLength = DE.getU32(&Offset),
596600 FullSegmentSize = DE.getU32(&Offset);
597 if (FullSegmentSize != 12 + 8 * SegmentLength) {
598 error(object_error::parse_failed);
599 return;
600 }
601
602601 uint32_t FilenameOffset;
603602 {
604603 DataExtractor SDE(CVFileIndexToStringOffsetTable, true, 4);
635634 format("+0x%X", PC).snprint(Buffer, 32);
636635 W.printNumber(Buffer, LineNumber);
637636 }
637 if (HasColumnInformation) {
638 for (unsigned J = 0; J != SegmentLength && DE.isValidOffset(Offset);
639 ++J) {
640 uint16_t ColStart = DE.getU16(&Offset);
641 W.printNumber("ColStart", ColStart);
642 uint16_t ColEnd = DE.getU16(&Offset);
643 W.printNumber("ColEnd", ColEnd);
644 }
645 }
638646 }
639647 }
640648 }