@@ -190,13 +190,14 @@ void Instrumentation::createLeafNodeDescription(FunctionDescription &FuncDesc,
190
190
FuncDesc.LeafNodes .emplace_back (IN);
191
191
}
192
192
193
- InstructionListType
194
- Instrumentation::createInstrumentationSnippet ( BinaryContext &BC, bool IsLeaf) {
193
+ InstructionListType Instrumentation::createInstrumentationSnippet (
194
+ BinaryContext &BC, bool IsLeaf, MCPlusBuilder::AllocatorIdTy AllocatorId ) {
195
195
auto L = BC.scopeLock ();
196
196
MCSymbol *Label = BC.Ctx ->createNamedTempSymbol (" InstrEntry" );
197
197
Summary->Counters .emplace_back (Label);
198
198
return BC.MIB ->createInstrIncMemory (Label, BC.Ctx .get (), IsLeaf,
199
- BC.AsmInfo ->getCodePointerSize ());
199
+ BC.AsmInfo ->getCodePointerSize (),
200
+ AllocatorId);
200
201
}
201
202
202
203
// Helper instruction sequence insertion function
@@ -210,14 +211,13 @@ insertInstructions(InstructionListType &Instrs, BinaryBasicBlock &BB,
210
211
return Iter;
211
212
}
212
213
213
- void Instrumentation::instrumentLeafNode (BinaryBasicBlock &BB,
214
- BinaryBasicBlock::iterator Iter,
215
- bool IsLeaf,
216
- FunctionDescription &FuncDesc,
217
- uint32_t Node) {
214
+ void Instrumentation::instrumentLeafNode (
215
+ BinaryBasicBlock &BB, BinaryBasicBlock::iterator Iter, bool IsLeaf,
216
+ FunctionDescription &FuncDesc, uint32_t Node,
217
+ MCPlusBuilder::AllocatorIdTy AllocatorId) {
218
218
createLeafNodeDescription (FuncDesc, Node);
219
219
InstructionListType CounterInstrs = createInstrumentationSnippet (
220
- BB.getFunction ()->getBinaryContext (), IsLeaf);
220
+ BB.getFunction ()->getBinaryContext (), IsLeaf, AllocatorId );
221
221
insertInstructions (CounterInstrs, BB, Iter);
222
222
}
223
223
@@ -247,7 +247,8 @@ bool Instrumentation::instrumentOneTarget(
247
247
BinaryBasicBlock::iterator &Iter, BinaryFunction &FromFunction,
248
248
BinaryBasicBlock &FromBB, uint32_t From, BinaryFunction &ToFunc,
249
249
BinaryBasicBlock *TargetBB, uint32_t ToOffset, bool IsLeaf, bool IsInvoke,
250
- FunctionDescription *FuncDesc, uint32_t FromNodeID, uint32_t ToNodeID) {
250
+ FunctionDescription *FuncDesc, uint32_t FromNodeID, uint32_t ToNodeID,
251
+ MCPlusBuilder::AllocatorIdTy AllocatorId) {
251
252
BinaryContext &BC = FromFunction.getBinaryContext ();
252
253
{
253
254
auto L = BC.scopeLock ();
@@ -263,7 +264,8 @@ bool Instrumentation::instrumentOneTarget(
263
264
return false ;
264
265
}
265
266
266
- InstructionListType CounterInstrs = createInstrumentationSnippet (BC, IsLeaf);
267
+ InstructionListType CounterInstrs =
268
+ createInstrumentationSnippet (BC, IsLeaf, AllocatorId);
267
269
268
270
const MCInst &Inst = *Iter;
269
271
if (BC.MIB ->isCall (Inst)) {
@@ -422,7 +424,7 @@ void Instrumentation::instrumentFunction(BinaryFunction &Function,
422
424
instrumentOneTarget (SplitWorklist, SplitInstrs, I, Function, BB,
423
425
FromOffset, *TargetFunc, TargetBB, ToOffset,
424
426
IsLeafFunction, IsInvokeBlock, FuncDesc,
425
- BBToID[&BB]);
427
+ BBToID[&BB], 0 , AllocId );
426
428
}
427
429
continue ;
428
430
}
@@ -438,7 +440,7 @@ void Instrumentation::instrumentFunction(BinaryFunction &Function,
438
440
instrumentOneTarget (SplitWorklist, SplitInstrs, I, Function, BB,
439
441
FromOffset, *TargetFunc, TargetBB, ToOffset,
440
442
IsLeafFunction, IsInvokeBlock, FuncDesc,
441
- BBToID[&BB], BBToID[TargetBB]);
443
+ BBToID[&BB], BBToID[TargetBB], AllocId );
442
444
continue ;
443
445
}
444
446
@@ -455,7 +457,7 @@ void Instrumentation::instrumentFunction(BinaryFunction &Function,
455
457
instrumentOneTarget (
456
458
SplitWorklist, SplitInstrs, I, Function, BB, FromOffset, Function,
457
459
&*Succ, Succ->getInputOffset (), IsLeafFunction, IsInvokeBlock,
458
- FuncDesc, BBToID[&BB], BBToID[&*Succ]);
460
+ FuncDesc, BBToID[&BB], BBToID[&*Succ], AllocId );
459
461
}
460
462
continue ;
461
463
}
@@ -498,7 +500,7 @@ void Instrumentation::instrumentFunction(BinaryFunction &Function,
498
500
instrumentOneTarget (SplitWorklist, SplitInstrs, I, Function, BB,
499
501
FromOffset, Function, FTBB, FTBB->getInputOffset (),
500
502
IsLeafFunction, IsInvokeBlock, FuncDesc, BBToID[&BB],
501
- BBToID[FTBB]);
503
+ BBToID[FTBB], AllocId );
502
504
}
503
505
} // End of BBs loop
504
506
@@ -508,7 +510,7 @@ void Instrumentation::instrumentFunction(BinaryFunction &Function,
508
510
BinaryBasicBlock &BB = *BBI;
509
511
if (STOutSet[&BB].size () == 0 )
510
512
instrumentLeafNode (BB, BB.begin (), IsLeafFunction, *FuncDesc,
511
- BBToID[&BB]);
513
+ BBToID[&BB], AllocId );
512
514
}
513
515
}
514
516
0 commit comments