MCPcopy Create free account
hub / github.com/beefytech/Beef / Commit

Method Commit

IDEHelper/DbgModule.cpp:236–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234}
235
236void DbgLineDataBuilder::Commit()
237{
238 HashSet<DbgSrcFile*> usedSrcFiles;
239
240 for (auto& recordKV : mRecords)
241 {
242 auto dbgSubprogram = recordKV.mKey;
243 auto record = recordKV.mValue;
244
245 usedSrcFiles.Clear();
246 for (auto& ctx : record->mContexts)
247 {
248 if (usedSrcFiles.Add(ctx.mSrcFile))
249 {
250 ctx.mSrcFile->mLineDataRefs.Add(dbgSubprogram);
251 }
252 }
253
254 for (int lineIdx = 0; lineIdx < (int)record->mLines.size() - 1; lineIdx++)
255 {
256 auto& lineData = record->mLines[lineIdx];
257 auto& nextLineData = record->mLines[lineIdx + 1];
258
259 if ((lineData.mContribSize == 0) && (lineData.mCtxIdx == nextLineData.mCtxIdx))
260 {
261 lineData.mContribSize = (uint32)(nextLineData.mRelAddress - lineData.mRelAddress);
262 }
263
264 bool sameInliner = lineData.mCtxIdx == nextLineData.mCtxIdx;
265 if (!sameInliner)
266 {
267 auto ctx = record->mContexts[lineData.mCtxIdx];
268 auto nextCtx = record->mContexts[lineData.mCtxIdx];
269 sameInliner = ctx.mInlinee == nextCtx.mInlinee;
270 }
271 if ((sameInliner) && (lineData.mRelAddress + lineData.mContribSize < nextLineData.mRelAddress))
272 {
273 auto ctx = record->mContexts[lineData.mCtxIdx];
274 if (ctx.mInlinee != NULL)
275 ctx.mInlinee->mHasLineAddrGaps = true;
276 }
277 }
278
279 DbgLineData* lastLine = NULL;
280 for (int lineIdx = 0; lineIdx < (int)record->mLines.size(); lineIdx++)
281 {
282 auto& lineData = record->mLines[lineIdx];
283 if (lineData.mContribSize == 0)
284 {
285 auto ctx = record->mContexts[lineData.mCtxIdx];
286 if (ctx.mInlinee == NULL)
287 lastLine = &lineData;
288 }
289 }
290 if (lastLine != NULL)
291 lastLine->mContribSize = (uint32)(dbgSubprogram->mBlock.mHighPC - (mDbgModule->mImageBase + lastLine->mRelAddress));
292
293 BF_ASSERT(dbgSubprogram->mLineInfo == NULL);

Callers 2

ParseDebugLineInfoMethod · 0.45
ParseCompileUnitMethod · 0.45

Calls 4

ClearMethod · 0.45
AddMethod · 0.45
sizeMethod · 0.45
CopyFromMethod · 0.45

Tested by

no test coverage detected