cplusdemstub.cpp

来自「vxworks源码源码解读是学习vxworks的最佳途径」· C++ 代码 · 共 106 行

CPP
106
字号
/* cplusDemStub.cpp - C++ symbol demangler stub *//* Copyright 1998 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01b,12jun98,sn   moved function symbolStartOf from cplusDem.cpp to here.01a,10apr98,sn   written.*//*DESCRIPTIONThis module seperates the interface of cplusDemangle from its implementationin cplusDem.cpp. Many "show" routines such as timexShowCalls attempt to present demangled symbol names to the user  by calling cplusDemangle. IfC++ is not configured into vxWorks the correct behaviouris simply to return the mangled name. We have seperated out a "stub"of cplusDemangle from its body (_cplusDemangle) to avoid dragging in the entire C++ runtime with any vxWorks image that contains show routines. NOMANUAL*//* includes */#include "vxWorks.h"#include "cplusLib.h"#include "demangle.h"/* defines *//* typedefs *//* globals */char * (*cplusDemangleFunc) (char *, char *, int) = 0;/* locals *//* forward declarations *//********************************************************************************* symbolStartOf - skip leading underscore** RETURNS: pointer to the start of the symbol name after any compiler *          prepended leading underscore.*        ** NOMANUAL*/LOCAL char *symbolStartOf (			  char *str			  ){    if (prepends_underscore && (str [0] == '_'))        return str + 1;    else        return str;}/******************************************************************************** cplusDemangle - demangle symbol** This function takes a symbol (source), removes any compiler prepended * underscore, and then attempts to demangle it. If demangling succeeds* the (first n chars of) the demangled string are placed in dest [] and* a pointer to dest is returned. Otherwise a pointer to the start of* the symbol proper (after any compiler prepended underscore) is returned.* RETURNS:* A pointer to a human readable version of source.** NOMANUAL*/char * cplusDemangle    (    char	* source,		/* mangled name */    char	* dest,			/* buffer for demangled copy */    int		  n		/* maximum length of copy */    )    {    source = symbolStartOf (source);    if (cplusDemangleFunc == 0  )	{	return source;	}    else	{        return cplusDemangleFunc (source, dest, n);	}    }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?