Re: The 'cold' function attribute and GDB

Kevin Buettner
2019-05-02T19:45:24Z

On Thu, 02 May 2019 22:28:17 +0300
Eli Zaretskii <eliz@gnu.org> wrote:

> > Date: Thu, 2 May 2019 12:13:05 -0700
> > From: Kevin Buettner <kevinb@redhat.com>
> > Cc: gdb-patches@sourceware.org, simark@simark.ca
> >
> > I hadn't checked before, but I do see .cold symbols...
> >
> > emacs:000000000058cab0 t print_vectorlike
> > emacs:000000000041fed1 t print_vectorlike.cold
> >
> > The address for print_vectorlike.cold is exactly the address for the
> > second address range for print_vectorlike:
> >
> > Address range 0x41fed1 to 0x41fed6:
> > 0x000000000041fed1 <+-1493983>: callq 0x41cca5 <emacs_abort>
> >
> > It's interesting that this _doesn't_ show up when doing the following:
> >
> > (gdb) x/i 0x000000000041fed1
> > 0x41fed1 <print_vectorlike+4293473313>: callq 0x41cca5
> > <emacs_abort>
> >
> > What do you see when you issue a similar command for your build
> > of emacs on Windows? (Apologies if you've already shown this to
> > me.)
>
> "nm -A" shows this:
>
> 011d6521 t _print_vectorlike
> 012e1ce5 t _print_vectorlike.cold.65
>
> And GDB shows this:
>
> (gdb) x/i 0x012e1ce5
> 0x12e1ce5 <print_vectorlike.cold.65>: movl $0xf5,0x8(%esp)

What I (think I) actually want to see is "x/i 0x012e1f36".

This is the address corresponding to the call of emacs_abort in the
second address range. What I want to see is whether
print_vectorlike.cold.65 is used to print the address.

If so, it should be possible to debug this problem without needing
to actually run it.

Looking back at your earlier email where you provided me with
the output of the disassemble command, i just noticed something
odd:

> Address range 0x12e1ce5 to 0x12e1f3b:
> 1824 emacs_abort ();
> 0x012e1f36 <+593>: call 0x12e7b40 <emacs_abort>

The address range includes more addresses than are shown. I would
have expected the range to be something like "0x012e1f36 to 0x12e1f3b"
instead of starting at 0x12e1ce5 as shown.

Kevin