Added demangling support. Only implemented for gcc 4 yet.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31146 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-06-20 18:45:20 +00:00
parent 8cd32d5b06
commit cba4143217
5 changed files with 65 additions and 2 deletions

View File

@ -16,6 +16,7 @@ SEARCH_SOURCE += [ FDirName $(SUBDIR) model ] ;
local debugAnalyzerSources
= [ FDirName $(HAIKU_TOP) src apps debuganalyzer ] ;
SubDirHdrs [ FDirName $(SUBDIR) demangler ] ;
SubDirHdrs [ FDirName $(HAIKU_TOP) src bin debug ] ;
SubDirHdrs [ FDirName $(debugAnalyzerSources) gui ] ;
@ -75,6 +76,7 @@ Application Debugger :
# tag_names.cpp
:
<nogrist>Debugger_demangler.o
<nogrist>DebugAnalyzer_gui_table.o
<bin>debug_utils.a
@ -87,4 +89,5 @@ Application Debugger :
: Debugger.rdef
;
HaikuSubInclude demangler ;
HaikuSubInclude gui running_teams_window ;

View File

@ -9,6 +9,7 @@
#include "BasicFunctionDebugInfo.h"
#include "DebuggerInterface.h"
#include "Demangler.h"
#include "SymbolInfo.h"
@ -72,8 +73,8 @@ DebuggerDebugInfo::FindFunction(target_addr_t address)
return NULL;
return new(std::nothrow) BasicFunctionDebugInfo(this, symbolInfo->Address(),
symbolInfo->Size(), symbolInfo->Name(), symbolInfo->Name());
// TODO: Demangle!
symbolInfo->Size(), symbolInfo->Name(),
Demangler::Demangle(symbolInfo->Name()));
}

View File

@ -0,0 +1,25 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include "Demangler.h"
#include "demangle.h"
/*static*/ BString
Demangler::Demangle(const BString& mangledName)
{
char buffer[1024];
if (mangledName.Compare("_Z", 2) == 0) {
const char* demangled = demangle_name_gcc3(mangledName.String(), buffer,
sizeof(buffer));
if (demangled != NULL)
return demangled;
}
// TODO: gcc2 demangling!
return mangledName;
}

View File

@ -0,0 +1,17 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef DEMANGLER_H
#define DEMANGLER_H
#include <String.h>
class Demangler {
public:
static BString Demangle(const BString& mangledName);
};
#endif // DEMANGLER_H

View File

@ -0,0 +1,17 @@
SubDir HAIKU_TOP src apps debugger demangler ;
CCFLAGS += -Werror ;
C++FLAGS += -Werror ;
UsePrivateHeaders kernel ;
SEARCH_SOURCE
+= [ FDirName $(HAIKU_TOP) src add-ons kernel debugger demangle ] ;
MergeObject Debugger_demangler.o
:
Demangler.cpp
gcc3+.cpp
;