public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aatsnps at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/99334] Generated DWARF unwind table issue while on instructions where rbp is pointing to callers stack frame
Date: Fri, 19 Mar 2021 19:18:33 +0000	[thread overview]
Message-ID: <bug-99334-4-WnLuEK9MKa@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99334-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99334

AJ D <aatsnps at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---
            Version|6.2.0                       |9.2.0

--- Comment #4 from AJ D <aatsnps at gmail dot com> ---
I can reproduce this issue with gcc 9.2, but this time, on a different routine
(not on the previously reported routine).


GCC Version
============
gcc (GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


GCC Configuration
=================
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/depot/qsc/QSCS/GCC/libexec/gcc/x86_64-centos-linux/9.2.0/lto-wrapper
Target: x86_64-centos-linux
Configured with: ../src/gcc-9.2.0/configure --prefix=/depot/gcc-9.2.0
--enable-bootstrap --enable-threads=posix --disable-checking --with-system-zlib
--enable-__cxa_atexit --disable-libunwind-exceptions
--enable-languages=c,c++,fortran --disable-libgcj --with-cpu=generic
--build=x86_64-centos-linux
Thread model: posix
gcc version 9.2.0 (GCC) 


Assembly Code
=============

0000000000002c10 <raceGetDistSelectInterval>:
    2c10:       4c 8d 54 24 08          lea    0x8(%rsp),%r10
    2c15:       48 83 e4 f0             and    $0xfffffffffffffff0,%rsp
    2c19:       41 ff 72 f8             pushq  -0x8(%r10)
    2c1d:       55                      push   %rbp
=>  2c1e:       48 89 e5                mov    %rsp,%rbp
    2c21:       41 57                   push   %r15
    2c23:       41 56                   push   %r14
    2c25:       41 55                   push   %r13
    2c27:       41 54                   push   %r12
    2c29:       41 52                   push   %r10

Interrupt happened while on this instruction.

=>  2c1e:       48 89 e5                mov    %rsp,%rbp

Here (before executing this instruction), rbp is pointing to parent frame.

So, the following DWARF doesn't look quite right.

000006b0 0000000000000044 000006b4 FDE cie=00000000
pc=0000000000002c10..0000000000003607
  DW_CFA_advance_loc: 5 to 0000000000002c15
  DW_CFA_def_cfa: r10 (r10) ofs 0
  DW_CFA_advance_loc: 9 to 0000000000002c1e
  DW_CFA_expression: r6 (rbp) (DW_OP_breg6 (rbp): 0)
  DW_CFA_advance_loc: 13 to 0000000000002c2b
  DW_CFA_def_cfa_expression (DW_OP_breg6 (rbp): -40; DW_OP_deref)
  DW_CFA_expression: r15 (r15) (DW_OP_breg6 (rbp): -8)
  DW_CFA_expression: r14 (r14) (DW_OP_breg6 (rbp): -16)
  DW_CFA_expression: r13 (r13) (DW_OP_breg6 (rbp): -24)
  DW_CFA_expression: r12 (r12) (DW_OP_breg6 (rbp): -32)


>>   DW_CFA_advance_loc: 9 to 0000000000002c1e
>>   DW_CFA_expression: r6 (rbp) (DW_OP_breg6 (rbp): 0)

Notice at address 0000000000002c1e, we are relying on rbp which is pointing to
the caller procedure's rbp, not the current procedure's rbp.


000006b0 0000000000000044 000006b4 FDE cie=00000000
pc=0000000000002c10..0000000000003607
   LOC           CFA      rbx   rbp   r12   r13   r14   r15   ra      
0000000000002c10 rsp+8    u     u     u     u     u     u     c-8   
0000000000002c15 r10+0    u     u     u     u     u     u     c-8   
0000000000002c1e r10+0    u     exp   u     u     u     u     c-8   
0000000000002c2b exp      u     exp   exp   exp   exp   exp   c-8   
0000000000002c2c exp      exp   exp   exp   exp   exp   exp   c-8   
0000000000002e16 r10+0    exp   exp   exp   exp   exp   exp   c-8   
0000000000002e23 rsp+8    exp   exp   exp   exp   exp   exp   c-8   
0000000000002e24 exp      exp   exp   exp   exp   exp   exp   c-8   


Actual GDB disassemble at the crash point:


Dump of assembler code for function raceGetDistSelectInterval:
   0x00002aaaafd63bd0 <+0>: lea    0x8(%rsp),%r10
   0x00002aaaafd63bd5 <+5>: and    $0xfffffffffffffff0,%rsp
   0x00002aaaafd63bd9 <+9>: pushq  -0x8(%r10)
   0x00002aaaafd63bdd <+13>:    push   %rbp
=> 0x00002aaaafd63bde <+14>:    mov    %rsp,%rbp
   0x00002aaaafd63be1 <+17>:    push   %r15
   0x00002aaaafd63be3 <+19>:    push   %r14


I will add the .i file in few days (have to take care of IP issues as per my
company guidelines).

  parent reply	other threads:[~2021-03-19 19:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 21:57 [Bug c/99334] New: " aatsnps at gmail dot com
2021-03-01 22:18 ` [Bug c/99334] " jakub at gcc dot gnu.org
2021-03-02  7:47 ` [Bug debug/99334] " rguenth at gcc dot gnu.org
2021-03-08 21:53 ` aatsnps at gmail dot com
2021-03-08 22:49 ` pinskia at gcc dot gnu.org
2021-03-19 19:18 ` aatsnps at gmail dot com [this message]
2021-03-20  4:39 ` aatsnps at gmail dot com
2021-03-20  4:46 ` aatsnps at gmail dot com
2021-03-20  9:39 ` jakub at gcc dot gnu.org
2021-03-23 17:20 ` jakub at gcc dot gnu.org
2021-03-26 16:01 ` jakub at gcc dot gnu.org
2021-03-26 23:23 ` cvs-commit at gcc dot gnu.org
2021-03-30 22:41 ` cvs-commit at gcc dot gnu.org
2021-04-20 23:34 ` cvs-commit at gcc dot gnu.org
2021-04-22 16:52 ` cvs-commit at gcc dot gnu.org
2021-04-22 17:10 ` jakub at gcc dot gnu.org
2021-09-22  4:06 ` aatsnps at gmail dot com
2021-09-22  5:19 ` pinskia at gcc dot gnu.org
2021-09-22  5:22 ` pinskia at gcc dot gnu.org

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=bug-99334-4-WnLuEK9MKa@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).