* Added test application for the GCC2 demangler.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28384 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-10-30 18:12:20 +00:00
parent 61791eda0c
commit 2e04b65212
3 changed files with 48 additions and 0 deletions
+1
View File
@@ -25,6 +25,7 @@ SEARCH on [ FGristFiles
SubInclude HAIKU_TOP src tests add-ons kernel bus_managers ;
SubInclude HAIKU_TOP src tests add-ons kernel busses ;
SubInclude HAIKU_TOP src tests add-ons kernel debugger ;
# SubInclude HAIKU_TOP src tests add-ons kernel disk_scanner ;
SubInclude HAIKU_TOP src tests add-ons kernel drivers ;
SubInclude HAIKU_TOP src tests add-ons kernel file_systems ;
@@ -0,0 +1,9 @@
SubDir HAIKU_TOP src tests add-ons kernel debugger ;
UsePrivateKernelHeaders ;
UsePrivateHeaders shared ;
SubDirHdrs $(HAIKU_TOP) src add-ons kernel debugger demangle ;
SimpleTest gcc2_demangle_test : gcc2_demangle_test.cpp ;
@@ -0,0 +1,38 @@
/*
* Copyright 2008, Axel Dörfler, [email protected].
* This file may be used under the terms of the MIT License.
*/
#define kprintf printf
#include "gcc2.cpp"
int
main(int argc, char** argv)
{
for (int i = 1; i < argc; i++) {
bool isObjectMethod;
char name[64];
const char* symbol = demangle_symbol(argv[i], name, sizeof(name),
&isObjectMethod);
if (symbol == NULL) {
printf("%s: cannot be parsed\n", argv[i]);
continue;
}
printf("%s (%s method)\n", symbol, isObjectMethod ? "object" : "class");
uint32 cookie = 0;
int32 type;
size_t length;
while (get_next_argument(&cookie, argv[i], name, sizeof(name), &type,
&length) == B_OK) {
printf("name \"%s\", type %.4s, length %lu\n", name, (char*)&type,
length);
}
}
return 0;
}