Hello Yury,

Yury Khrustalev <[email protected]> writes:

> Hi, thanks for this report.
>
> I've looked into these issues, and it seems like most of them are caused by
> how GDB treats malloc function for evaluating expressions that require a
> function call.
>
> GDB seems to ignore that malloc has become n ifunc in Glibc and it tries to
> access symbol 'malloc' directly.
>
> It seems like GDB has been having some issues with ifuncs before, e.g. [1].
>
> Simple way to reproduce the issue: use a program with just empty main 
> function:
>
>   int main(void) { return 0; }
>
> In GDB (not that __libc_malloc is the implementation that is returned by the
> ifunc resolver):
>
>   (gdb) br main
>   (gdb) r
>   (gdb) disassemble __libc_malloc
>
> Notice first 2 instructions
>
>   (gdb) call printf("%s\n", "hello")
>
> Might result in SIGILL or SIGSEGV... but if it works, it prints format string
> instead of 'hello'.
>
>   (gdb) disassemble __libc_malloc
>
> Notice first 2 instructions have now been re-written with gibberish (hence the
> signals).
>
> I would appreciate if this could be looked at from the GDB point of view. 
> Perhaps,
> this should be fixed in GDB?
>
> FWIW, lldb works as expected.

Thank you for the investigation and the detailed report.
I was able to reproduce the problem and will work on a fix.

-- 
Thiago
(he/him)
_______________________________________________
linaro-toolchain mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to