1 /* Copyright (C) 2012 IBM Corporation and Others. All Rights Reserved */ 2 3 #include <stdio.h> 4 #include <demangle.h> 5 showSym(char * str)6void showSym(char *str) { 7 char *rest; 8 struct Name *name = Demangle(str, rest); // "f__1XFi" 9 10 printf("# '%s'\n", str); 11 if(*rest) printf("\trest: '%s'\n", rest); 12 if(name->Kind() == MemberFunction) { 13 //((MemberFunctionName *) name)->Scope()->Text() is "X" 14 //((MemberFunctionName *) name)->RootName() is "f" 15 //((MemberFunctionName *) name)->Text() is "X::f(int)" 16 printf("\t=> %s\n", ((MemberFunctionName *) name)->Text()); 17 } else { 18 printf("\t(not MemberFunction)\n"); 19 } 20 } 21 22 23 24 25 main(int argc,char * argv[])26int main(int argc, /*const*/ char *argv[]) { 27 if(argc>1) { 28 for(int i=1;i<argc;i++) { 29 showSym(argv[i]); 30 } 31 } else { 32 printf("Usage: %s <symbol> ...\n", argv[0]); 33 } 34 35 36 37 } 38