From: Eli Zaretskii <eliz@gnu.org>
To: Simon Marchi <simark@simark.ca>
Cc: kevinb@redhat.com, gdb-patches@sourceware.org
Subject: Re: The 'cold' function attribute and GDB
Date: Thu, 02 May 2019 18:47:00 -0000 [thread overview]
Message-ID: <831s1gpuch.fsf@gnu.org> (raw)
In-Reply-To: <54a14b11-3c1d-956c-916c-e8ecae85a78e@simark.ca> (message from Simon Marchi on Thu, 2 May 2019 14:08:02 -0400)
> Cc: gdb-patches@sourceware.org
> From: Simon Marchi <simark@simark.ca>
> Date: Thu, 2 May 2019 14:08:02 -0400
>
> In my case, the second range, the cold one, is one instruction long, just the call to emacs_abort:
>
> 00000000004173b1 <print_vectorlike.cold>:
> 4173b1: e8 77 ce ff ff callq 41422d <emacs_abort>
Probably because yours is a 64-bit build. Mine is a 32-bit one.
> Can you give the steps to reproduce the bug that leads us there?
It's a bit tricky (my reproduction recipe is based on a bug, but it
only rears its head on Windows, we will need to simulate on your
system).
In a nutshell, you need to put a breakpoint in this routine, run Emacs
as usual, and when it breaks, make the PSEUDOVECTOR_TYPE macro to
return something that doesn't match any of the cases in the switch.
For example, make it return PVEC_FREE (whose numerical value is 1). I
think the easiest will be to use nexti through the code that invokes
PSEUDOVECTOR_TYPE, then assign 1 to the register that gets the result.
You should see the code then fall through to emacs_abort.
To force Emacs to call this function, type this after starting Emacs:
C-h v char-script-table RET
(I assume you are familiar with the notation like C-h and RET.)
> In the mean time, I tried to do "start", followed by "set $pc = 0x4173b1", and this is what I get as my
> first frame:
>
> #0 0x00000000004173b1 in print_vectorlike (obj=0x1, printcharfun=0x7fffffffdd18, escapeflag=<optimized out>, buf=0xa0 <error: Cannot access memory at address 0xa0>) at /home/smarchi/src/emacs/src/print.c:1824
>
> The parameter values are bogus, and the rest of the frames are corrupted, because I don't have
> the stack I would normally have when executing this code. But we can see that the full symbol
> was found: the arguments are printed, and the function name is correct (doesn't include .cold).
>
> So it looks like some debugging of this problem on Windows will be needed :(
Why am I not surprised?
So some description of how GDB finds its way back from $pc to
print_vectorlike using the DW ranges, with pointers to relevant code,
will be appreciated.
Thanks.
next prev parent reply other threads:[~2019-05-02 18:47 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-01 18:59 Eli Zaretskii
2019-05-01 20:17 ` Simon Marchi
2019-05-02 2:51 ` Kevin Buettner
2019-05-02 6:59 ` Eli Zaretskii
2019-05-02 7:26 ` Kevin Buettner
2019-05-02 15:27 ` Eli Zaretskii
2019-05-02 15:59 ` Kevin Buettner
2019-05-02 16:46 ` Eli Zaretskii
2019-05-02 18:08 ` Simon Marchi
2019-05-02 18:47 ` Eli Zaretskii [this message]
2019-05-02 18:55 ` Kevin Buettner
2019-05-02 19:32 ` Eli Zaretskii
2019-05-02 19:51 ` Kevin Buettner
2019-05-02 7:06 ` Eli Zaretskii
2019-05-02 7:38 ` Kevin Buettner
2019-05-02 15:23 ` Eli Zaretskii
2019-05-02 15:56 ` Kevin Buettner
2019-05-02 16:43 ` Eli Zaretskii
2019-05-02 18:25 ` Kevin Buettner
2019-05-02 18:52 ` Eli Zaretskii
2019-05-02 19:13 ` Kevin Buettner
2019-05-02 19:28 ` Eli Zaretskii
2019-05-02 19:45 ` Kevin Buettner
2019-05-02 19:56 ` Eli Zaretskii
2019-05-02 23:30 ` Kevin Buettner
2019-05-04 8:30 ` Eli Zaretskii
2019-05-05 20:04 ` Kevin Buettner
2019-05-06 15:33 ` Eli Zaretskii
2019-05-06 16:24 ` Kevin Buettner
2019-05-02 15:17 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=831s1gpuch.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=kevinb@redhat.com \
--cc=simark@simark.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox