Subject: bug#28308: Build failure on FreeBSD/aarch64

From: Eli Zaretskii <[email-masked]>
Date: Tue, 12 Sep 2017 17:59:17 +0300

> Cc: [email-masked], [email-masked]
> From: Gergely Czuczy <[email-masked]>
> Date: Mon, 11 Sep 2017 22:33:45 +0200
> 
> It's still in the delete_ttye function, however, 4463 is a call to 
> delete_terminal, and not to xpalloc. It's interesting why's that frame 
> #2, because lldb also returns the same as we can see in the source:
> (lldb) frame select 3
> frame #3: 0x0000000000168214 
> bootstrap-emacs`delete_tty(terminal=0x4f67ed32e8e06446) at term.c:4463
>     4460      before delete_terminal.  */
>     4461   reset_sys_modes (tty);
>     4462
> -> 4463   delete_terminal (terminal);
>     4464
>     4465   xfree (tty->name);
>     4466   xfree (tty->type);
> 
> However, disassembly gave something interesting:
> ** 4463   delete_terminal (terminal);
>     4464
> 
>      0x16820c <+224>: bl     0xd40b4 ; coordinates_in_window + 5312 at 
> window.c:1274
>      0x168210 <+228>: bl     0x22e1f8 ; xpalloc + 16084 at alloc.c:992
> 
> -> 4465   xfree (tty->name);
> 
> ->  0x168214 <+232>: bl 0x35b294                  ; 
> text_property_stickiness + 628 at textprop.c:1845
>      0x168218 <+236>: ldurb  w8, [x29, #-0x2c]
>      0x16821c <+240>: tbz    w8, #0x0, 0x16823c ; <+272> at term.c
> 
> The pointer is at the xfree call. However, I the disassembly was too 
> long, I couldn't get anything useful out of it.

Can you step through that code, starting at the delete_tty, stepping
into the functions, and showing the source lines?  I don't see how the
code you are showing could possibly be correct.

Thanks.