views:

126

answers:

2

Hello,

I need to replace allocators with their original source code. I am extracting exported methods from PE export table and facing strange lengthy allocators where STL containers were used in original source code . for example if source code was

   typedef std::list<std::basic_string<_TCHAR> > TokenList;
   EXPORTS_API const TokenList& getLiteralList( );

from export table i am getting

std::list<class std::basic_string<unsigned short, std::char_traits<unsigned short>,class
 std::allocator<unsigned short> >,class std::allocator<class std::basic_string<unsigned 
short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > > > 
const & __thiscall CExpressionTokenizer::getLiteralList(void)

That's annoying. How to get backtrack from above strange lengthy allocators to original source code, more over when comes typedefs it increases in size more and more.

Regards Usman

+1  A: 

I think you mean that you want to be able to determine a more succinct type name from the export table. The standard allocator (std::allocator) is the default template parameter for allocator parameter in most standard container class templates so you can just remove the entire allocator parameter from the template specialization to come up with a simpler expression of the same type.

E.g.

std::list<class std::basic_string<unsigned short, std::char_traits<unsigned short>,class
std::allocator<unsigned short> >,class std::allocator<class std::basic_string<unsigned 
short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > > > 
const & __thiscall CExpressionTokenizer::getLiteralList(void)

becomes

std::list<class std::basic_string<unsigned short, std::char_traits<unsigned short> > > 
const & __thiscall CExpressionTokenizer::getLiteralList(void)
Charles Bailey
A: 

I believe you are talking about decoding the error messages? Try STLFilt.

rlbond
I thought that at first too, but as far as I can tell he's got a utility that extracts names from an executable. Those names are riddled with allocator stuff (as they should be), and he wants to get rid of them, I think.
GMan
yeah definetly.I want to have exact replacement of my original source code in place of those allocators stuff. Actually I need to show these types and extracted methods(Which I taken from export table)at GUI or say some XMLs. So as user I won't be recognize these allocators
Usman
You can't have an exact replacement. Allocators in STL containers are just one example of default arguments. E.g. `std::set<T>` will also have a `std::less<T>` default order. After compiling, you can't figure out anymore whether a default argument was provided or not. That's not to mention typedefs (`std::string` is really `std::basic_string<char>` )
MSalters
So what actually the solution of above statted problem..?I need not exact replacement of typedefs names which actually are in the code. How to eliminate or replace those allocators stuff with actual STL written code?
Usman