bebbo / binutils-gdb

Unofficial mirror of sourceware binutils-gdb repository. Updated daily.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git
GNU General Public License v2.0
3 stars 3 forks source link

Addresses in disassembly look wonky #7

Closed mheyer32 closed 5 years ago

mheyer32 commented 5 years ago

m68k-amigaos-objdump -m68030 --no-show-raw-insn -d -C scummvm > scummvm.asm

Produced below disassembly. The addresses look as if each of them had been printed twice:

   11d22:   jsr 58d15c**58d15c** <error(char const*, ...)>
   11d30:   beq.s 11d36**11d36** <PluginManager::instance()+0xe>
   11d44:   beq.s 11d54**11d54** <PluginManager::instance()+0x2c>

etc

   11d1c:   move.l d3,-(sp)
   11d1e:   pea 1194011940 <Plugin::getName() const+0x6e>(pc)
   11d22:   jsr 58d15c58d15c <error(char const*, ...)>

00011d2800011d28 <PluginManager::instance()>:
   11d28:   subq.l #4,sp
   11d2a:   move.l 4c4c <_stext+0x4c>,d0
   11d30:   beq.s 11d3611d36 <PluginManager::instance()+0xe>
   11d32:   addq.l #4,sp
   11d34:   rts
   11d36:   pea 2828 <_stext+0x28>
   11d3a:   jsr 59d08c59d08c <operator new(unsigned int)>
   11d40:   addq.l #4,sp
   11d42:   tst.l d0
   11d44:   beq.s 11d5411d54 <PluginManager::instance()+0x2c>
   11d46:   move.l d0,-(sp)
   11d48:   move.l d0,4(sp)
   11d4c:   jsr 11e4811e48 <PluginManager::PluginManager()>(pc)
   11d50:   addq.l #4,sp
   11d52:   move.l (sp),d0
   11d54:   move.l d0,4c4c <_stext+0x4c>
   11d5a:   addq.l #4,sp
   11d5c:   rts

00011d5e00011d5e <PluginManager::PluginManager()>:
   11d5e:   movem.l d2-d5/a2-a4,-(sp)
   11d62:   movea.l 32(sp),a2
   11d66:   move.l #93544,(a2)
   11d6c:   clr.l 4(a2)
   11d70:   clr.l 8(a2)
   11d74:   clr.l 12(a2)
   11d78:   clr.l 16(a2)
   11d7c:   clr.l 20(a2)
   11d80:   clr.l 24(a2)
   11d84:   clr.l 28(a2)
   11d88:   clr.l 32(a2)
   11d8c:   clr.l 36(a2)
   11d90:   pea 44 <_stext+0x4>
   11d94:   jsr 59d08c59d08c <operator new(unsigned int)>
   11d9a:   movea.l d0,a3
   11d9c:   addq.l #4,sp
   11d9e:   tst.l d0
   11da0:   beq.s 11da811da8 <PluginManager::PluginManager()+0x4a>
   11da2:   move.l #93588,(a3)
mheyer32 commented 5 years ago

Thanks, that seemed to have fixed it.

Side question: do you have an idea why the PluginManager gets generated twice with what looks like identical code?

00478900 <PluginManager::instance()>:
  478900:   link.w a5,#0
  478904:   move.l d2,-(sp)
  478906:   move.l 30 <_stext+0x30>,d0
  47890c:   beq.s 478916 <PluginManager::instance()+0x16>
  47890e:   move.l -4(a5),d2
  478912:   unlk a5
  478914:   rts
  478916:   pea 28 <_stext+0x28>
  47891a:   jsr 592250 <operator new(unsigned int)>
  478920:   move.l d0,d2
  478922:   addq.l #4,sp
  478924:   beq.s 47892c <PluginManager::instance()+0x2c>
  478926:   move.l d0,-(sp)
  478928:   jsr 47898c <PluginManager::PluginManager()>(pc)
  47892c:   move.l d2,30 <_stext+0x30>
  478932:   move.l d2,d0
  478934:   bra.s 47890e <PluginManager::instance()+0xe>

00478936 <PluginManager::PluginManager()>:
  478936:   link.w a5,#0
  47893a:   move.l a2,-(sp)
  47893c:   movea.l 8(a5),a2
  478940:   movea.l a2,a0
  478942:   move.l #4700588,(a0)+
  478948:   moveq #1,d0
  47894a:   tst.l d0
  47894c:   blt.s 478958 <PluginManager::PluginManager()+0x22>
  47894e:   clr.l (a0)+
  478950:   clr.l (a0)+
  478952:   clr.l (a0)+
  478954:   subq.l #1,d0
  478956:   bra.s 47894a <PluginManager::PluginManager()+0x14>
  478958:   clr.l 28(a2)
  47895c:   clr.l 32(a2)
  478960:   clr.l 36(a2)
  478964:   pea 4 <_stext+0x4>
  478968:   jsr 592250 <operator new(unsigned int)>
  47896e:   addq.l #4,sp
  478970:   tst.l d0
  478972:   beq.s 47897c <PluginManager::PluginManager()+0x46>
  478974:   movea.l d0,a0
  478976:   move.l #4700632,(a0)
  47897c:   move.l d0,-(sp)
  47897e:   move.l a2,-(sp)
  478980:   jsr 478b2e <PluginManager::addPluginProvider(PluginProvider*)>(pc)
  478984:   movea.l -4(a5),a2
  478988:   unlk a5
  47898a:   rts

0047898c <PluginManager::PluginManager()>:
  47898c:   link.w a5,#0
  478990:   move.l a2,-(sp)
  478992:   movea.l 8(a5),a2
  478996:   movea.l a2,a0
  478998:   move.l #4700588,(a0)+
  47899e:   moveq #1,d0
  4789a0:   tst.l d0
  4789a2:   blt.s 4789ae <PluginManager::PluginManager()+0x22>
  4789a4:   clr.l (a0)+
  4789a6:   clr.l (a0)+
  4789a8:   clr.l (a0)+
  4789aa:   subq.l #1,d0
  4789ac:   bra.s 4789a0 <PluginManager::PluginManager()+0x14>
  4789ae:   clr.l 28(a2)
  4789b2:   clr.l 32(a2)
  4789b6:   clr.l 36(a2)
  4789ba:   pea 4 <_stext+0x4>
  4789be:   jsr 592250 <operator new(unsigned int)>
  4789c4:   addq.l #4,sp
  4789c6:   tst.l d0
  4789c8:   beq.s 4789d2 <PluginManager::PluginManager()+0x46>
  4789ca:   movea.l d0,a0
  4789cc:   move.l #4700632,(a0)
  4789d2:   move.l d0,-(sp)
  4789d4:   move.l a2,-(sp)
  4789d6:   jsr 478b2e <PluginManager::addPluginProvider(PluginProvider*)>(pc)
  4789da:   movea.l -4(a5),a2
  4789de:   unlk a5
  4789e0:   rts

004789e2 <PluginManager::~PluginManager()>:
  4789e2:   link.w a5,#0
  4789e6:   move.l a3,-(sp)
  4789e8:   move.l a2,-(sp)
  4789ea:   movea.l 8(a5),a3
  4789ee:   move.l #4700588,(a3)
  4789f4:   move.l a3,-(sp)
  4789f6:   jsr 47970e <PluginManager::unloadAllPlugins()>(pc)
  4789fa:   addq.l #4,sp
  4789fc:   movea.l 36(a3),a2
  478a00:   bra.s 478a04 <PluginManager::~PluginManager()+0x22>
  478a02:   addq.l #4,a2
  478a04:   move.l 32(a3),d1
  478a08:   move.l d1,d0
  478a0a:   lsl.l #2,d0
  478a0c:   movea.l 36(a3),a0
  478a10:   add.l a0,d0
  478a12:   cmp.l a2,d0
  478a14:   beq.s 478a2a <PluginManager::~PluginManager()+0x48>
  478a16:   movea.l (a2),a0
  478a18:   move.l a0,d0
  478a1a:   beq.s 478a02 <PluginManager::~PluginManager()+0x20>
  478a1c:   movea.l (a0),a1
  478a1e:   move.l a0,-(sp)
  478a20:   movea.l 4(a1),a0
  478a24:   jsr (a0)
  478a26:   addq.l #4,sp
  478a28:   bra.s 478a02 <PluginManager::~PluginManager()+0x20>
  478a2a:   lea 28(a3),a2
  478a2e:   clr.l d0
  478a30:   cmp.l d1,d0
  478a32:   bcc.s 478a38 <PluginManager::~PluginManager()+0x56>
  478a34:   addq.l #1,d0
  478a36:   bra.s 478a30 <PluginManager::~PluginManager()+0x4e>
  478a38:   move.l a0,-(sp)
  478a3a:   jsr 596734 <free>
  478a40:   addq.l #4,a3
  478a42:   addq.l #4,sp
  478a44:   move.l a3,d0
  478a46:   bne.s 478a5e <PluginManager::~PluginManager()+0x7c>
  478a48:   movea.l -8(a5),a2
  478a4c:   movea.l -4(a5),a3
  478a50:   unlk a5
  478a52:   rts
  478a54:   move.l a0,-(sp)
  478a56:   jsr 596734 <free>
  478a5c:   addq.l #4,sp
  478a5e:   cmpa.l a2,a3
  478a60:   beq.s 478a48 <PluginManager::~PluginManager()+0x66>
  478a62:   lea -12(a2),a2
  478a66:   move.l 4(a2),d1
  478a6a:   movea.l 8(a2),a0
  478a6e:   clr.l d0
  478a70:   cmp.l d1,d0
  478a72:   bcc.s 478a54 <PluginManager::~PluginManager()+0x72>
  478a74:   addq.l #1,d0
  478a76:   bra.s 478a70 <PluginManager::~PluginManager()+0x8e>

00478a78 <PluginManager::~PluginManager()>:
  478a78:   link.w a5,#0
  478a7c:   move.l a3,-(sp)
  478a7e:   move.l a2,-(sp)
  478a80:   movea.l 8(a5),a3
  478a84:   move.l #4700588,(a3)
  478a8a:   move.l a3,-(sp)
  478a8c:   jsr 47970e <PluginManager::unloadAllPlugins()>(pc)
  478a90:   addq.l #4,sp
  478a92:   movea.l 36(a3),a2
  478a96:   bra.s 478a9a <PluginManager::~PluginManager()+0x22>
  478a98:   addq.l #4,a2
  478a9a:   move.l 32(a3),d1
  478a9e:   move.l d1,d0
  478aa0:   lsl.l #2,d0
  478aa2:   movea.l 36(a3),a0
  478aa6:   add.l a0,d0
  478aa8:   cmp.l a2,d0
  478aaa:   beq.s 478ac0 <PluginManager::~PluginManager()+0x48>
  478aac:   movea.l (a2),a0
  478aae:   move.l a0,d0
  478ab0:   beq.s 478a98 <PluginManager::~PluginManager()+0x20>
  478ab2:   movea.l (a0),a1
  478ab4:   move.l a0,-(sp)
  478ab6:   movea.l 4(a1),a0
  478aba:   jsr (a0)
  478abc:   addq.l #4,sp
  478abe:   bra.s 478a98 <PluginManager::~PluginManager()+0x20>
  478ac0:   lea 28(a3),a2
  478ac4:   clr.l d0
  478ac6:   cmp.l d1,d0
  478ac8:   bcc.s 478ace <PluginManager::~PluginManager()+0x56>
  478aca:   addq.l #1,d0
  478acc:   bra.s 478ac6 <PluginManager::~PluginManager()+0x4e>
  478ace:   move.l a0,-(sp)
  478ad0:   jsr 596734 <free>
  478ad6:   addq.l #4,a3
  478ad8:   addq.l #4,sp
  478ada:   move.l a3,d0
  478adc:   bne.s 478af4 <PluginManager::~PluginManager()+0x7c>
  478ade:   movea.l -8(a5),a2
  478ae2:   movea.l -4(a5),a3
  478ae6:   unlk a5
  478ae8:   rts
  478aea:   move.l a0,-(sp)
  478aec:   jsr 596734 <free>
  478af2:   addq.l #4,sp
  478af4:   cmpa.l a2,a3
  478af6:   beq.s 478ade <PluginManager::~PluginManager()+0x66>
  478af8:   lea -12(a2),a2
  478afc:   move.l 4(a2),d1
  478b00:   movea.l 8(a2),a0
  478b04:   clr.l d0
  478b06:   cmp.l d1,d0
  478b08:   bcc.s 478aea <PluginManager::~PluginManager()+0x72>
  478b0a:   addq.l #1,d0
  478b0c:   bra.s 478b06 <PluginManager::~PluginManager()+0x8e>

00478b0e <PluginManager::~PluginManager()>:
  478b0e:   link.w a5,#0
  478b12:   move.l d2,-(sp)
  478b14:   move.l 8(a5),d2
  478b18:   move.l d2,-(sp)
  478b1a:   jsr 478a78 <PluginManager::~PluginManager()>(pc)
  478b1e:   move.l d2,-(sp)
  478b20:   jsr 5922dc <operator delete(void*)>
  478b26:   move.l -4(a5),d2
  478b2a:   unlk a5
  478b2c:   rts
bebbo commented 5 years ago

read here: https://stackoverflow.com/questions/44558119/why-do-i-have-two-destructor-implementations-in-my-assembly-output