On Monday, 8 January 2024 18:35:56 -03 Berthold Stoeger wrote:
> > Thiago, is that something that makes sense to you?
> > 
> > 
> > 
> > here's the disassembled code and yes, it does call terminate...
> 
> Does it? At least not directly as far as I can see. I reckon this is the
> exception handler?

Quite right, there's no branch instruction arriving there. So it could only be 
reached via stack unwinding due to an exception being thrown.

I don't know Objective C or C++ at all so I can't tell for sure why dealloc 
would fail. The most likely condition is that the object has become corrupt, 
probably due to a buffer overflow somewhere or it's a double-free. The object 
itself appears to be a single 64-bit word in size (probably a pointer). 
Searching for "objective c dealloc exception" has as first result "don't use 
dealloc; use release"[1].

I also don't know why Clang inserted that __clang_call_terminate( here. The 
stack unwinding mechanism should have done that, not the IosShare destructor. 
In that case, the runtime usually prints the name of the exception that was 
thrown.

Maybe building in ASan mode and running will provide some clue.

[1] 
https://stackoverflow.com/questions/559295/difference-between-release-and-dealloc-in-objective-c

> > 0000000000000070 <IosShare::~IosShare()>:
> >       70: a9be4ff4      stp     x20, x19, [sp, #-32]!
> >       74: a9017bfd      stp     x29, x30, [sp, #16]
> >       78: 910043fd      add     x29, sp, #16
> >       7c: aa0003f3      mov     x19, x0
> >       80: f9400000      ldr     x0, [x0]
> >       84: 94000000      bl      0x84 <IosShare::~IosShare()+0x14>
> >                 0000000000000084:  ARM64_RELOC_BRANCH26
> > _objc_msgSend$dealloc
> >       88: aa1303e0      mov     x0, x19
> >       8c: a9417bfd      ldp     x29, x30, [sp, #16]
> >       90: a8c24ff4      ldp     x20, x19, [sp], #32
> >       94: d65f03c0      ret
> >       98: 94000000      bl      0x98 <IosShare::~IosShare()+0x28>
> >                 0000000000000098:  ARM64_RELOC_BRANCH26
> > ___clang_call_terminate


-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering



_______________________________________________
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to