MCPcopy Create free account
hub / github.com/OpenCppCoverage/OpenCppCoverage / RegisterAddress

Method RegisterAddress

CppCoverage/ExecutedAddressManager.cpp:90–117  ·  view source on GitHub ↗

-------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

88
89 //-------------------------------------------------------------------------
90 bool ExecutedAddressManager::RegisterAddress(
91 const Address& address,
92 const std::wstring& filename,
93 unsigned int lineNumber,
94 unsigned char instructionValue)
95 {
96 auto& module = GetLastAddedModule();
97 auto& file = module.files_[filename];
98
99 LOG_TRACE << "RegisterAddress: " << address << " for " << filename << ":" << lineNumber;
100
101 // Different {filename, line} can have the same address.
102 // Same {filename, line} can have several addresses.
103 bool keepBreakpoint = false;
104 auto itAddress = addressLineMap_.find(address);
105
106 if (itAddress == addressLineMap_.end())
107 {
108 itAddress = addressLineMap_.emplace(address,
109 Line{ instructionValue, lastModule_.baseOfImage_ }).first;
110 keepBreakpoint = true;
111 }
112
113 auto& line = itAddress->second;
114 line.hasBeenExecutedCollection_.push_back(&file.lines[lineNumber]);
115
116 return keepBreakpoint;
117 }
118
119 //-------------------------------------------------------------------------
120 ExecutedAddressManager::Module& ExecutedAddressManager::GetLastAddedModule()

Callers 2

SetBreakPointMethod · 0.80
TESTFunction · 0.80

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.64