本文整理汇总了C++中DISubprogram::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ DISubprogram::getName方法的具体用法?C++ DISubprogram::getName怎么用?C++ DISubprogram::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DISubprogram
的用法示例。
在下文中一共展示了DISubprogram::getName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addFunction
void DebugDatabase::addFunction(MDNode *subprogram, GenerateRTL *hw) {
string name;
DISubprogram s;
assert(subprogram || hw);
if (subprogram) {
s = DISubprogram(subprogram);
name = s.getName().str();
}
if (hw) {
// dbgs() << "Adding function " <<
// hw->getFunction()->getName().str() << "\n";
if (hwToFunctionIds.find(hw) != hwToFunctionIds.end()) {
// This function has already been added
// This can happen since we add functions with metadata first, then
// add all functions with hardware next. Those with metadata will
// have
// already been added
// dbgs() << "exiting\n";
return;
} else {
// dbgs() << "not exiting\n";
}
if (subprogram) {
assert(name == hw->getFunction()->getName().str());
} else {
name = hw->getFunction()->getName().str();
}
}
std::string query = "INSERT INTO Function (designId, name, inlined, "
"hasMetadata, startLineNumber) ";
query += "VALUES (" + std::to_string(designId);
query += "," + addQuotesToStr(name);
query += "," + std::to_string(hw ? false : true);
query += "," + std::to_string(subprogram ? true : false);
query += "," + (subprogram ? std::to_string(s.getLineNumber()) : "NULL");
query += ");";
runQuery(query);
int functionId = mysql_insert_id(connection);
if (subprogram) {
subprogramsToFunctionIds[subprogram] = functionId;
}
if (hw) {
hwToFunctionIds[hw] = functionId;
}
}
示例2: getFunctionInfo
void getFunctionInfo(const char **name, int *line, const char **filename, size_t pointer)
{
std::map<size_t, FuncInfo> info = jl_jit_events->getMap();
*name = NULL;
*line = -1;
*filename = "no file";
for (std::map<size_t, FuncInfo>::iterator it= info.begin(); it!= info.end(); it++) {
if ((*it).first <= pointer) {
if ((size_t)(*it).first + (*it).second.lengthAdr >= pointer) {
#if LLVM_VERSION_MAJOR == 3
#if LLVM_VERSION_MINOR == 0
*name = &(*(*it).second.func).getNameStr()[0];
#elif LLVM_VERSION_MINOR >= 1
*name = (((*(*it).second.func).getName()).data());
#endif
#endif
if ((*it).second.lines.size() == 0) {
continue;
}
std::vector<JITEvent_EmittedFunctionDetails::LineStart>::iterator vit = (*it).second.lines.begin();
JITEvent_EmittedFunctionDetails::LineStart prev = *vit;
DISubprogram debugscope =
DISubprogram(prev.Loc.getScope((*it).second.func->getContext()));
*filename = debugscope.getFilename().data();
// the DISubprogram has the un-mangled name, so use that if
// available.
*name = debugscope.getName().data();
vit++;
while (vit != (*it).second.lines.end()) {
if (pointer <= (*vit).Address) {
*line = prev.Loc.getLine();
break;
}
prev = *vit;
vit++;
}
if (*line == -1) {
*line = prev.Loc.getLine();
}
break;
}
}
}
}
示例3: emitFunctionAnnot
void LineNumberAnnotatedWriter::emitFunctionAnnot(
const Function *F, formatted_raw_ostream &Out)
{
InstrLoc = nullptr;
DISubprogram *FuncLoc = F->getSubprogram();
if (!FuncLoc) {
auto SP = Subprogram.find(F);
if (SP != Subprogram.end())
FuncLoc = SP->second;
}
if (!FuncLoc)
return;
std::vector<DILineInfo> DIvec(1);
DILineInfo &DI = DIvec.back();
DI.FunctionName = FuncLoc->getName();
DI.FileName = FuncLoc->getFilename();
DI.Line = FuncLoc->getLine();
LinePrinter.emit_lineinfo(Out, DIvec);
}
示例4: fixupSubprogramName
/// fixupSubprogramName - Replace contains special characters used
/// in a typical Objective-C names with '.' in a given string.
static void fixupSubprogramName(DISubprogram Fn, SmallVectorImpl<char> &Out) {
StringRef FName =
Fn.getFunction() ? Fn.getFunction()->getName() : Fn.getName();
FName = Function::getRealLinkageName(FName);
StringRef Prefix("llvm.dbg.lv.");
Out.reserve(FName.size() + Prefix.size());
Out.append(Prefix.begin(), Prefix.end());
bool isObjCLike = false;
for (size_t i = 0, e = FName.size(); i < e; ++i) {
char C = FName[i];
if (C == '[')
isObjCLike = true;
if (isObjCLike && (C == '[' || C == ']' || C == ' ' || C == ':' ||
C == '+' || C == '(' || C == ')'))
Out.push_back('.');
else
Out.push_back(C);
}
}
示例5: jl_getDylibFunctionInfo
//.........这里部分代码省略.........
}
else {
obj = it->second.obj;
context = it->second.ctx;
slide = it->second.slide;
}
#ifdef _OS_DARWIN_
lookup:
#endif
lookup_pointer(context, name, line, filename, pointer+slide, jl_is_sysimg(fname), fromC);
return;
}
*fromC = 1;
return;
}
#endif
void jl_getFunctionInfo(const char **name, size_t *line, const char **filename, size_t pointer, int *fromC, int skipC)
{
*name = NULL;
*line = -1;
*filename = "no file";
*fromC = 0;
#if USE_MCJIT
// With MCJIT we can get function information directly from the ObjectFile
std::map<size_t, ObjectInfo, revcomp> &objmap = jl_jit_events->getObjectMap();
std::map<size_t, ObjectInfo, revcomp>::iterator it = objmap.lower_bound(pointer);
if (it == objmap.end())
return jl_getDylibFunctionInfo(name,line,filename,pointer,fromC,skipC);
if ((pointer - it->first) > it->second.size)
return jl_getDylibFunctionInfo(name,line,filename,pointer,fromC,skipC);
#ifdef LLVM36
DIContext *context = DIContext::getDWARFContext(*it->second.object);
#else
DIContext *context = DIContext::getDWARFContext(it->second.object);
#endif
lookup_pointer(context, name, line, filename, pointer, 1, fromC);
#else // !USE_MCJIT
// Without MCJIT we use the FuncInfo structure containing address maps
std::map<size_t, FuncInfo, revcomp> &info = jl_jit_events->getMap();
std::map<size_t, FuncInfo, revcomp>::iterator it = info.lower_bound(pointer);
if (it != info.end() && (size_t)(*it).first + (*it).second.lengthAdr >= pointer) {
// We do this to hide the jlcall wrappers when getting julia backtraces,
// but it is still good to have them for regular lookup of C frames.
if (skipC && (*it).second.lines.empty()) {
// Technically not true, but we don't want them
// in julia backtraces, so close enough
*fromC = 1;
return;
}
*name = (*it).second.name.c_str();
*filename = (*it).second.filename.c_str();
if ((*it).second.lines.empty()) {
*fromC = 1;
return;
}
std::vector<JITEvent_EmittedFunctionDetails::LineStart>::iterator vit =
(*it).second.lines.begin();
JITEvent_EmittedFunctionDetails::LineStart prev = *vit;
if ((*it).second.func) {
DISubprogram debugscope =
DISubprogram(prev.Loc.getScope((*it).second.func->getContext()));
*filename = debugscope.getFilename().data();
// the DISubprogram has the un-mangled name, so use that if
// available. However, if the scope need not be the current
// subprogram.
if (debugscope.getName().data() != NULL)
*name = debugscope.getName().data();
else
*name = jl_demangle(*name);
}
vit++;
while (vit != (*it).second.lines.end()) {
if (pointer <= (*vit).Address) {
*line = prev.Loc.getLine();
break;
}
prev = *vit;
vit++;
}
if (*line == (size_t) -1) {
*line = prev.Loc.getLine();
}
}
else {
jl_getDylibFunctionInfo(name,line,filename,pointer,fromC,skipC);
}
#endif // USE_MCJIT
}
示例6: getFunctionName
static StringRef getFunctionName(DISubprogram SP) {
if (!SP.getLinkageName().empty())
return SP.getLinkageName();
return SP.getName();
}
示例7: jl_getFunctionInfo
void jl_getFunctionInfo(const char **name, int *line, const char **filename, size_t pointer, int skipC)
{
*name = NULL;
*line = -1;
*filename = "no file";
#if USE_MCJIT
// With MCJIT we can get function information directly from the ObjectFile
std::map<size_t, ObjectInfo, revcomp> &objmap = jl_jit_events->getObjectMap();
std::map<size_t, ObjectInfo, revcomp>::iterator it = objmap.lower_bound(pointer);
if (it == objmap.end())
return jl_getDylibFunctionInfo(name,line,filename,pointer,skipC);
if ((pointer - it->first) > it->second.size)
return jl_getDylibFunctionInfo(name,line,filename,pointer,skipC);
DIContext *context = DIContext::getDWARFContext(it->second.object);
lookup_pointer(context, name, line, filename, pointer, 1);
#else // !USE_MCJIT
// Without MCJIT we use the FuncInfo structure containing address maps
std::map<size_t, FuncInfo, revcomp> &info = jl_jit_events->getMap();
std::map<size_t, FuncInfo, revcomp>::iterator it = info.lower_bound(pointer);
if (it != info.end() && (size_t)(*it).first + (*it).second.lengthAdr >= pointer) {
// commenting these lines out skips functions that don't
// have explicit debug info. this is useful for hiding
// the jlcall wrapper functions we generate.
#if LLVM_VERSION_MAJOR == 3
#if LLVM_VERSION_MINOR == 0
//*name = &(*(*it).second.func).getNameStr()[0];
#elif LLVM_VERSION_MINOR >= 1
//*name = (((*(*it).second.func).getName()).data());
#endif
#endif
std::vector<JITEvent_EmittedFunctionDetails::LineStart>::iterator vit =
(*it).second.lines.begin();
JITEvent_EmittedFunctionDetails::LineStart prev = *vit;
if ((*it).second.func) {
DISubprogram debugscope =
DISubprogram(prev.Loc.getScope((*it).second.func->getContext()));
*filename = debugscope.getFilename().data();
// the DISubprogram has the un-mangled name, so use that if
// available.
*name = debugscope.getName().data();
}
else {
*name = (*it).second.name.c_str();
*filename = (*it).second.filename.c_str();
}
vit++;
while (vit != (*it).second.lines.end()) {
if (pointer <= (*vit).Address) {
*line = prev.Loc.getLine();
break;
}
prev = *vit;
vit++;
}
if (*line == -1) {
*line = prev.Loc.getLine();
}
}
else {
jl_getDylibFunctionInfo(name,line,filename,pointer,skipC);
}
#endif // USE_MCJIT
}