Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does Znwm and ZdlPv mean in assembly?

I'm new to assembly and I'm trying to figure out how C++ handles dynamic dispatch in assembly.

When looking through assembly code, I saw that there were 2 unusual calls:

call _Znwm
call _ZdlPv

These did not have a subroutine that I could trace them to. From examining the code, Znwm seemed to return the address of the object when its constructor was called, but I'm not sure about that. ZdlPv was in a block of code that could never be reached (it was jumped over). C++:

Fruit * f;
f = new Apple();

x86:

# BB#1:
    mov eax, 8
    mov edi, eax
    call    _Znwm
    mov rdi, rax
    mov rcx, rax
.Ltmp6:
    mov qword ptr [rbp - 48], rdi # 8-byte Spill
    mov rdi, rax
    mov qword ptr [rbp - 56], rcx # 8-byte Spill
    call    _ZN5AppleC2Ev

Any advice would be appreciated. Thanks.

like image 537
user2999870 Avatar asked Nov 16 '17 19:11

user2999870


1 Answers

_Znwm is operator new.
_ZdlPv is operator delete.

like image 195
Manu Evans Avatar answered Sep 24 '22 03:09

Manu Evans