mercredi 10 novembre 2021

GDB Cannot call function with string * parameters

I'm trying to reverse engineer a binary by calling a few functions in GDB but I'm having trouble setting up the parameters.

When I do print FUNCTION I get, $2 = {std::string (std::string)} 0x564803a0b545 <FUNCTION(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>

In Ghidra, the function is listed as, string *FUNCTION(string *__return_storage_ptr__,string *param2)

I then set up the parameters like this,

set $param2 = (std::string *)malloc(sizeof(std::string))
call $param2->basic_string()
call $param2->assign("ASDASDASD")

set $param1 = (std::string *)malloc(sizeof(std::string))
call FUNCTION($param1, $param2)

But GDB says, Cannot resolve function FUNCTION to any overloaded instance

How should I set up my parameters? Thanks for the help!

Aucun commentaire:

Enregistrer un commentaire