简体   繁体   English

如何用实际的源代码替换stl的分配器

[英]How to replace allocators of stl with actual source code

I need to replace allocators with their original source code. 我需要用其原始源代码替换分配器。 I am extracting exported methods from the PE export table and facing strange lengthy allocators where STL containers were used in the original source code. 我正在从PE导出表中提取导出的方法,并面对奇怪的冗长的分配器,在原始源代码中使用了STL容器。 ie If source code was: 即如果源代码是:

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

from the 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)

How do I get the backtrack from the above lengthy allocators to its original source code? 如何从上述冗长的分配器返回其原始源代码? (typedefs increase more in size.) (typedef的大小增加了。)

Regards, 问候,

Usman 乌斯曼

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. 在大多数标准容器类模板中,标准分配器( std::allocator )是分配器参数的默认模板参数,因此您只需从模板专门化中删除整个分配器参数,即可得出一个简单的相同类型的表达式。

Eg 例如

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)

I believe you are talking about decoding the error messages? 我相信您正在谈论解码错误消息? Try STLFilt . 尝试STLFilt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM