simonlindholm / asm-differ

Assembly diff script
The Unlicense
106 stars 52 forks source link

MSVC name mangling seems to cause an exception. #116

Open OmniBlade opened 1 year ago

OmniBlade commented 1 year ago

The following asm snippet seems to cause an exception when used within decomp.me where I'm trying to implement msvc support. When the function is changed to no longer be part of a class the exception dissappears and the diff works:

i386-pc-msdosdjgpp-objdump --disassemble --disassemble-zeroes --line-numbers --start-address=0 -m i386 --no-show-raw-insn /mnt/d/Code/teststraw.o

/mnt/d/Code/teststraw.o:     file format coff-go32

Disassembly of section .text:

00000000 <?Get_From@Straw@@EAEXPAV1@@Z>:
   0:   push   %esi
   1:   mov    0x8(%esp),%esi
   5:   push   %edi
   6:   mov    %ecx,%edi
   8:   cmp    %esi,0x4(%edi)
   b:   je     3e <?Get_From@Straw@@EAEXPAV1@@Z+0x3e>
   d:   test   %esi,%esi
   f:   je     26 <?Get_From@Straw@@EAEXPAV1@@Z+0x26>
  11:   mov    0x8(%esi),%ecx
  14:   test   %ecx,%ecx
  16:   je     26 <?Get_From@Straw@@EAEXPAV1@@Z+0x26>
  18:   mov    (%ecx),%eax
  1a:   push   $0x0
  1c:   call   *0x4(%eax)
  1f:   movl   $0x0,0x8(%esi)
  26:   mov    0x4(%edi),%eax
  29:   test   %eax,%eax
  2b:   je     34 <?Get_From@Straw@@EAEXPAV1@@Z+0x34>
  2d:   movl   $0x0,0x8(%eax)
  34:   test   %esi,%esi
  36:   mov    %esi,0x4(%edi)
  39:   je     3e <?Get_From@Straw@@EAEXPAV1@@Z+0x3e>
  3b:   mov    %edi,0x8(%esi)
  3e:   pop    %edi
  3f:   pop    %esi
  40:   ret    $0x4
  43:   nop
  44:   nop
  45:   nop
  46:   nop
  47:   nop
  48:   nop
  49:   nop
  4a:   nop
  4b:   nop
  4c:   nop
  4d:   nop
  4e:   nop
  4f:   nop
simonlindholm commented 1 year ago

Sorry for the delayed response. I can't reproduce this now when trying... If you're still seeing this, can you post a .o file and asm-differ invocation that triggers the exception? What is the exception that's thrown?

Or, are you uploading that asm literally as is? That's not expected to work -- objdump output is generally not reassemblable. We've talked about adding a .o file upload mode to decomp.me to make this simpler.