本文整理汇总了C++中BPatch_function::findLocalParam方法的典型用法代码示例。如果您正苦于以下问题:C++ BPatch_function::findLocalParam方法的具体用法?C++ BPatch_function::findLocalParam怎么用?C++ BPatch_function::findLocalParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BPatch_function
的用法示例。
在下文中一共展示了BPatch_function::findLocalParam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BPatch_variableExpr
//
// findVariable
// scp - a BPatch_point that defines the scope of the current search
// name - name of the variable to find.
//
BPatch_variableExpr *BPatch_image::findVariableInScope(BPatch_point &scp,
const char *name)
{
// Get the function to search for it's local variables.
// XXX - should really use more detailed scoping info here - jkh 6/30/99
BPatch_function *func = const_cast<BPatch_function *> (scp.getFunction());
if (!func) {
pdstring msg = pdstring("point passed to findVariable lacks a function\n address point type passed?");
showErrorCallback(100, msg);
return NULL;
}
BPatch_localVar *lv = func->findLocalVar(name);
if (!lv) {
// look for it in the parameter scope now
lv = func->findLocalParam(name);
}
if (lv) {
// create a local expr with the correct frame offset or absolute
// address if that is what is needed
return new BPatch_variableExpr(proc, (void *) lv->getFrameOffset(),
lv->getRegister(), lv->getType(), lv->getStorageClass(), &scp);
}
// finally check the global scope.
// return findVariable(name);
/* If we have something else to try, don't report errors on this failure. */
bool reportErrors = true;
char mangledName[100];
func->getName( mangledName, 100 );
char * lastScoping = NULL;
if( strrchr( mangledName, ':' ) != NULL ) {
reportErrors = false;
}
BPatch_variableExpr * gsVar = findVariable( name, reportErrors );
if( gsVar == NULL ) {
/* Try finding it with the function's scope prefixed. */
if( (lastScoping = strrchr( mangledName, ':' )) != NULL ) {
* (lastScoping + sizeof(char)) = '\0';
char scopedName[200];
memmove( scopedName, mangledName, strlen( mangledName ) );
memmove( scopedName + strlen( mangledName ), name, strlen( name ) );
scopedName[ strlen( mangledName ) + strlen( name ) ] = '\0';
bperr( "Searching for scoped name '%s'\n", scopedName );
gsVar = findVariable( scopedName );
}
}
return gsVar;
}