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

Method Add

IDEHelper/DbgModule.cpp:131–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131DbgLineData* DbgLineDataBuilder::Add(DbgCompileUnit* compileUnit, DbgLineData& lineData, DbgSrcFile* srcFile, DbgSubprogram* inlinee)
132{
133 addr_target address = (addr_target)(lineData.mRelAddress + mDbgModule->mImageBase);
134 if ((compileUnit->mLowPC != (addr_target)-1) && ((address < (addr_target)compileUnit->mLowPC) || (address >= (addr_target)compileUnit->mHighPC)))
135 return NULL;
136
137 if ((mCurSubprogram == NULL) || (address < mCurSubprogram->mBlock.mLowPC) || (address >= mCurSubprogram->mBlock.mHighPC))
138 {
139 DbgSubprogramMapEntry* mapEntry = mDbgModule->mDebugTarget->mSubprogramMap.Get(address, DBG_MAX_LOOKBACK);
140 if (mapEntry != NULL)
141 {
142 mCurSubprogram = mapEntry->mEntry;
143
144 if (address > mCurSubprogram->mBlock.mHighPC)
145 mCurSubprogram = NULL;
146
147 if (mCurSubprogram != NULL)
148 {
149 SubprogramRecord** recordPtr = NULL;
150 if (mRecords.TryAdd(mCurSubprogram, NULL, &recordPtr))
151 {
152 // It's not too expensive to over-reserve here, because these are just temporary structures that get copied
153 // exactly sized when we Commit
154 mCurRecord = mAlloc.Alloc<SubprogramRecord>();
155 *recordPtr = mCurRecord;
156 mCurRecord->mContexts.mAlloc = &mAlloc;
157 mCurRecord->mContexts.Reserve(16);
158 mCurRecord->mLines.mAlloc = &mAlloc;
159 mCurRecord->mLines.Reserve(128);
160 mCurRecord->mCurContext = -1;
161 mCurRecord->mHasInlinees = false;
162 }
163 else
164 mCurRecord = *recordPtr;
165 }
166 else
167 mCurRecord = NULL;
168 }
169 }
170
171 if (mCurSubprogram == NULL)
172 return NULL;
173
174 bool needsNewCtx = false;
175 if (mCurRecord->mCurContext == -1)
176 {
177 needsNewCtx = true;
178 }
179 else
180 {
181 auto& curContext = mCurRecord->mContexts[mCurRecord->mCurContext];
182 if ((curContext.mInlinee != inlinee) || (curContext.mSrcFile != srcFile))
183 {
184 needsNewCtx = true;
185 for (int ctxIdx = 0; ctxIdx < (int)mCurRecord->mContexts.size(); ctxIdx++)
186 {
187 auto& ctx = mCurRecord->mContexts[ctxIdx];
188 if ((ctx.mInlinee == inlinee) && (ctx.mSrcFile == srcFile))

Callers 15

DoLookupFieldMethod · 0.45
CreateCallMethod · 0.45
DebugManagerMethod · 0.45
Debugger_HotLoadFunction · 0.45
LoadMethod · 0.45
MiniDumpDebuggerMethod · 0.45
MapModuleMethod · 0.45
AddSubProgramMethod · 0.45
ScanSpanMethod · 0.45
ValidateBreakpointsMethod · 0.45

Calls 5

GetMethod · 0.45
TryAddMethod · 0.45
ReserveMethod · 0.45
sizeMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected