Home > Net >  Call operator new[] using GDB
Call operator new[] using GDB

Time:01-19

How can I call to operator new[] with GDB?

For example I want to allocate 0x40 bytes and print the address : operator new[](0x44u));

How can I do that using GDB ?

When I tried p (void*)operator new[](0x40) I got No symbol "operator" in current context.

CodePudding user response:

This worked for me:

(gdb) p 'operator new<TAB>
operator new(unsigned long)
operator new(unsigned long) [clone .cold]
...
operator new[](unsigned long)
operator new[](unsigned long)@got.plt
operator new[](unsigned long)@plt
operator new[](unsigned long, std::align_val_t)
... more choices

(gdb) p 'operator new[](unsigned long)'(0x40)
$1 = (void *) 0x416ee0
  • Related