2

I'm using IDA Pro and have identified a function that takes an std::string as an argument.

However when I click on the function and "Set Item Type", entering its definition:

std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>> funcname(const std::__ndk1::basic_string<char,std::__ndk1::char_traits<char>,std::__ndk1::allocator<char>>& foo)

I get a syntax error:

Syntax error near: std::__ndk1::basic_string

However there are other variables with this very type that IDA is able to use. Why is it failing when I try to set it?

  • 1
    From Ida Help: "The function type must be entered as a C declaration.". So it seems that you cannot use C++ classes while setting function type. – bart1e Jun 20 at 17:47
  • Hmm seems tricky... so that leads to a very different question which is 'how do I deal with a C++ function taking C++ args..' – Claudiu Jun 20 at 18:02
  • Anyway this seems the answer, I will upvote & accept if you post as answer – Claudiu Jun 20 at 18:03
1

IDA’s C parser does not handle some C++ syntax like namespaces. There are two options:

  1. Rename the local type or struct to have no “wrong” symbols, you can use it in type declaration then
  2. Use “Convert to struct*” context menu command on the argument/variable. This bypasses the C parser and sets the type directly.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.