public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/60758] New: Infinite backtrace in  __cxa_end_cleanup
@ 2014-04-04  7:51 alexey.merzlyakov at samsung dot com
  2014-04-04  7:51 ` [Bug libstdc++/60758] " alexey.merzlyakov at samsung dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: alexey.merzlyakov at samsung dot com @ 2014-04-04  7:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60758

            Bug ID: 60758
           Summary: Infinite backtrace in  __cxa_end_cleanup
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alexey.merzlyakov at samsung dot com
                CC: v.garbuzov at samsung dot com, y.gribov at samsung dot com
            Target: arm

Created attachment 32542
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32542&action=edit
Testcase to reproduce

While debugging a compiled testcase, the infinite backtrace appears:
  Breakpoint 1, __gnu_end_cleanup () at
../../../../gcc-src/libstdc++-v3/libsupc++/eh_arm.cc:134
  134    ../../../../gcc-src/libstdc++-v3/libsupc++/eh_arm.cc: No such file or
directory.
  (gdb) bt
  #0  __gnu_end_cleanup () at
../../../../gcc-src/libstdc++-v3/libsupc++/eh_arm.cc:134
  #1  0xb6f45b2c in __cxa_end_cleanup () from /lib/libstdc++.so.6
  #2  0xb6f45b2c in __cxa_end_cleanup () from /lib/libstdc++.so.6
  #3  0xb6f45b2c in __cxa_end_cleanup () from /lib/libstdc++.so.6
  #4  0xb6f45b2c in __cxa_end_cleanup () from /lib/libstdc++.so.6
  ...

GCC configuration:
  $ arm-linux-gnueabi-gcc -v
  Using built-in specs.
  COLLECT_GCC=./arm-linux-gnueabi-gcc
 
COLLECT_LTO_WRAPPER=/home/alexey.merzlyakov/arm/libexec/gcc/arm-linux-gnueabi/4.9.0/lto-wrapper
  Target: arm-linux-gnueabi
  Configured with: ../gcc-src/configure --host=i686-pc-linux-gnu
--target=arm-linux-gnueabi --prefix=/home/alexey.merzlyakov/arm
--with-sysroot=/home/alexey.merzlyakov/arm/arm-linux-gnueabi/sys-root
--disable-libmudflap --disable-libssp --with-mode=arm --with-fpu=vfpv3
--with-cpu=cortex-a15 --with-tune=cortex-a15 --with-float=softfp
--disable-libatomic --disable-libgomp --enable-languages=c,c++
--with-gmp=/home/alexey.merzlyakov/arm --with-mpfr=/home/alexey.merzlyakov/arm
--with-mpc=/home/alexey.merzlyakov/arm
  Thread model: posix
  gcc version 4.9.0 20140403 (experimental) (GCC)

Compiling the testcase:
  $ arm-linux-gnueabi-g++ rethrow_if_nested.ii -std=gnu++0x -g

The __cxa_end_cleanup() does not save/restore LR in function header/footer and
does not provide any unwind info:
libstdc++-v3/libsupc++/eh_arm.cc ->
  "__cxa_end_cleanup:\n"
  "       push\t{r1, r2, r3, r4}\n"
  "       bl\t__gnu_end_cleanup\n"
  "       pop\t{r1, r2, r3, r4}\n"
  "       bl\t_Unwind_Resume @ Never returns\n"
GDB uses LR saving/restoring information when making a backtrace (when unwind
info is not available). Otherwise if there are no information, the LR on
current frame will be equal to LR on previous frame. It causes GDB to generate
same backtrace-items for __cxa_end_cleanup again and again.

I would expect the same problem for other tools that unwind stacks (e.g. unwind
code in libgcc, libbacktrace, etc.).

So, it seems to be a libstdc++ bug. Adding the LR in the arguments of
save/restore instructions in __cxa_end_cleanup() code fixes it. Another option
would be to add unwind entries (.cfi_whatever).


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/60758] Infinite backtrace in  __cxa_end_cleanup
  2014-04-04  7:51 [Bug libstdc++/60758] New: Infinite backtrace in __cxa_end_cleanup alexey.merzlyakov at samsung dot com
@ 2014-04-04  7:51 ` alexey.merzlyakov at samsung dot com
  2014-04-04 16:03 ` ramana at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: alexey.merzlyakov at samsung dot com @ 2014-04-04  7:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60758

--- Comment #1 from Alexey Merzlyakov <alexey.merzlyakov at samsung dot com> ---
Created attachment 32543
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32543&action=edit
Proposed patch

Proposed patch is attached.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/60758] Infinite backtrace in  __cxa_end_cleanup
  2014-04-04  7:51 [Bug libstdc++/60758] New: Infinite backtrace in __cxa_end_cleanup alexey.merzlyakov at samsung dot com
  2014-04-04  7:51 ` [Bug libstdc++/60758] " alexey.merzlyakov at samsung dot com
@ 2014-04-04 16:03 ` ramana at gcc dot gnu.org
  2014-04-07  6:20 ` alexey.merzlyakov at samsung dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ramana at gcc dot gnu.org @ 2014-04-04 16:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60758

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ramana at gcc dot gnu.org

--- Comment #2 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
Please send patches to the mailing list after testing them appropriately and
not attach them to bugzilla.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/60758] Infinite backtrace in  __cxa_end_cleanup
  2014-04-04  7:51 [Bug libstdc++/60758] New: Infinite backtrace in __cxa_end_cleanup alexey.merzlyakov at samsung dot com
  2014-04-04  7:51 ` [Bug libstdc++/60758] " alexey.merzlyakov at samsung dot com
  2014-04-04 16:03 ` ramana at gcc dot gnu.org
@ 2014-04-07  6:20 ` alexey.merzlyakov at samsung dot com
  2014-05-16 13:17 ` merzlyakovao at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: alexey.merzlyakov at samsung dot com @ 2014-04-07  6:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60758

--- Comment #3 from Alexey Merzlyakov <alexey.merzlyakov at samsung dot com> ---
Thank you very much!
Reg. test - no changes.
http://gcc.gnu.org/ml/gcc-patches/2014-04/msg00195.html


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/60758] Infinite backtrace in  __cxa_end_cleanup
  2014-04-04  7:51 [Bug libstdc++/60758] New: Infinite backtrace in __cxa_end_cleanup alexey.merzlyakov at samsung dot com
                   ` (2 preceding siblings ...)
  2014-04-07  6:20 ` alexey.merzlyakov at samsung dot com
@ 2014-05-16 13:17 ` merzlyakovao at gcc dot gnu.org
  2014-05-19 11:19 ` alexey.merzlyakov at samsung dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: merzlyakovao at gcc dot gnu.org @ 2014-05-16 13:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from merzlyakovao at gcc dot gnu.org ---
Author: merzlyakovao
Date: Fri May 16 13:16:33 2014
New Revision: 210515

URL: http://gcc.gnu.org/viewcvs?rev=210515&root=gcc&view=rev
Log:
2014-05-16  Alexey Merzlyakov  <alexey.merzlyakov@samsung.com>

    PR libstdc++/60758
    * libsupc++/eh_arm.cc (__cxa_end_cleanup): Change r4 to lr in save/restore
    and add unwind directives.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/libsupc++/eh_arm.cc


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/60758] Infinite backtrace in  __cxa_end_cleanup
  2014-04-04  7:51 [Bug libstdc++/60758] New: Infinite backtrace in __cxa_end_cleanup alexey.merzlyakov at samsung dot com
                   ` (3 preceding siblings ...)
  2014-05-16 13:17 ` merzlyakovao at gcc dot gnu.org
@ 2014-05-19 11:19 ` alexey.merzlyakov at samsung dot com
  2014-05-19 11:26 ` alexey.merzlyakov at samsung dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: alexey.merzlyakov at samsung dot com @ 2014-05-19 11:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Alexey Merzlyakov <alexey.merzlyakov at samsung dot com> ---
The problem does not appear for thumb2 targets.
On older architectures (armv6 and below) in thumb-mode the LR indeed can not be
used as argument of POP instruction.

To support __cxa_end_cleanup backtracing on thumb1, we can make additional
register operations before push/pop.
But I guess, this will have a negative effect on __cxa_end_cleanup performance.
So, I propose to preserve __cxa_end_cleanup backtracing on thumb2 architectures
and revert it on thumb1.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/60758] Infinite backtrace in  __cxa_end_cleanup
  2014-04-04  7:51 [Bug libstdc++/60758] New: Infinite backtrace in __cxa_end_cleanup alexey.merzlyakov at samsung dot com
                   ` (4 preceding siblings ...)
  2014-05-19 11:19 ` alexey.merzlyakov at samsung dot com
@ 2014-05-19 11:26 ` alexey.merzlyakov at samsung dot com
  2014-05-20  6:27 ` alexey.merzlyakov at samsung dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: alexey.merzlyakov at samsung dot com @ 2014-05-19 11:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Alexey Merzlyakov <alexey.merzlyakov at samsung dot com> ---
Created attachment 32820
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32820&action=edit
Fix for thumb fail

Proposed bugfix (build OK, but not regtested).


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/60758] Infinite backtrace in  __cxa_end_cleanup
  2014-04-04  7:51 [Bug libstdc++/60758] New: Infinite backtrace in __cxa_end_cleanup alexey.merzlyakov at samsung dot com
                   ` (5 preceding siblings ...)
  2014-05-19 11:26 ` alexey.merzlyakov at samsung dot com
@ 2014-05-20  6:27 ` alexey.merzlyakov at samsung dot com
  2014-05-20 17:26 ` ygribov at gcc dot gnu.org
  2015-04-22 19:53 ` ramana at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: alexey.merzlyakov at samsung dot com @ 2014-05-20  6:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Alexey Merzlyakov <alexey.merzlyakov at samsung dot com> ---
The following PR has been opened for Thumb1 problem:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61223


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/60758] Infinite backtrace in  __cxa_end_cleanup
  2014-04-04  7:51 [Bug libstdc++/60758] New: Infinite backtrace in __cxa_end_cleanup alexey.merzlyakov at samsung dot com
                   ` (6 preceding siblings ...)
  2014-05-20  6:27 ` alexey.merzlyakov at samsung dot com
@ 2014-05-20 17:26 ` ygribov at gcc dot gnu.org
  2015-04-22 19:53 ` ramana at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: ygribov at gcc dot gnu.org @ 2014-05-20 17:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from ygribov at gcc dot gnu.org ---
Author: ygribov
Date: Tue May 20 17:25:26 2014
New Revision: 210650

URL: http://gcc.gnu.org/viewcvs?rev=210650&root=gcc&view=rev
Log:
2014-05-20  Alexey Merzlyakov  <alexey.merzlyakov@samsung.com>

    PR libstdc++/61223
    Revert:
    2014-05-16  Alexey Merzlyakov  <alexey.merzlyakov@samsung.com>

    PR libstdc++/60758
    * libsupc++/eh_arm.cc (__cxa_end_cleanup): Change r4 to lr in save/restore
    and add unwind directives.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/libsupc++/eh_arm.cc


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libstdc++/60758] Infinite backtrace in  __cxa_end_cleanup
  2014-04-04  7:51 [Bug libstdc++/60758] New: Infinite backtrace in __cxa_end_cleanup alexey.merzlyakov at samsung dot com
                   ` (7 preceding siblings ...)
  2014-05-20 17:26 ` ygribov at gcc dot gnu.org
@ 2015-04-22 19:53 ` ramana at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: ramana at gcc dot gnu.org @ 2015-04-22 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |5.0

--- Comment #11 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
fixed on 5.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-04-22 19:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-04  7:51 [Bug libstdc++/60758] New: Infinite backtrace in __cxa_end_cleanup alexey.merzlyakov at samsung dot com
2014-04-04  7:51 ` [Bug libstdc++/60758] " alexey.merzlyakov at samsung dot com
2014-04-04 16:03 ` ramana at gcc dot gnu.org
2014-04-07  6:20 ` alexey.merzlyakov at samsung dot com
2014-05-16 13:17 ` merzlyakovao at gcc dot gnu.org
2014-05-19 11:19 ` alexey.merzlyakov at samsung dot com
2014-05-19 11:26 ` alexey.merzlyakov at samsung dot com
2014-05-20  6:27 ` alexey.merzlyakov at samsung dot com
2014-05-20 17:26 ` ygribov at gcc dot gnu.org
2015-04-22 19:53 ` ramana at gcc dot gnu.org

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).