[Bug other/67457] segfault in libbacktrace

2021-08-24 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67457

Andrew Pinski  changed:

   What|Removed |Added

 CC||tobias at stoeckmann dot org

--- Comment #7 from Andrew Pinski  ---
*** Bug 67392 has been marked as a duplicate of this bug. ***

[Bug other/67457] segfault in libbacktrace

2015-09-08 Thread Joost.VandeVondele at mat dot ethz.ch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67457

--- Comment #6 from Joost VandeVondele  
---
(In reply to Ian Lance Taylor from comment #4)
> I committed a patch that should produce a more graceful fallback when out of
> memory.  Please see if it helps your situation.

Great! Not sure how you managed, but this gives a clean symbolic backtrace, at
least for this simple test case:

> ./a.out
Operating system error: Cannot allocate memory
Allocation would exceed memory limit

Error termination. Backtrace:

Could not print backtrace: mmap: Cannot allocate memory

Could not print backtrace: mmap: Cannot allocate memory

Could not print backtrace: mmap: Cannot allocate memory

Could not print backtrace: mmap: Cannot allocate memory

Could not print backtrace: mmap: Cannot allocate memory
#0  0x7f068c128e09 in ???
#1  0x7f068c129905 in ???
#2  0x7f068c129b02 in ???
#3  0x40081d in __foomod_MOD_foo
at /data/vjoost/gnu/bugs/test_1.f90:7
#4  0x4008bf in MAIN__
at /data/vjoost/gnu/bugs/test_1.f90:16
#5  0x4008f5 in main
at /data/vjoost/gnu/bugs/test_1.f90:12


[Bug other/67457] segfault in libbacktrace

2015-09-08 Thread ian at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67457

--- Comment #4 from Ian Lance Taylor  ---
I committed a patch that should produce a more graceful fallback when out of
memory.  Please see if it helps your situation.

--- Comment #5 from ian at gcc dot gnu.org  ---
Author: ian
Date: Tue Sep  8 16:46:16 2015
New Revision: 227533

URL: https://gcc.gnu.org/viewcvs?rev=227533&root=gcc&view=rev
Log:
PR other/67457
* backtrace.c: #include "internal.h".
(struct backtrace_data): Add can_alloc field.
(unwind): If can_alloc is false, don't try to get file/line
information.
(backtrace_full): Set can_alloc field in bdata.
* alloc.c (backtrace_alloc): Don't call error_callback if it is
NULL.
* mmap.c (backtrace_alloc): Likewise.
* internal.h: Update comments for backtrace_alloc and
backtrace_free.

Modified:
trunk/libbacktrace/ChangeLog
trunk/libbacktrace/alloc.c
trunk/libbacktrace/backtrace.c
trunk/libbacktrace/internal.h
trunk/libbacktrace/mmap.c


[Bug other/67457] segfault in libbacktrace

2015-09-08 Thread ian at airs dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67457

--- Comment #4 from Ian Lance Taylor  ---
I committed a patch that should produce a more graceful fallback when out of
memory.  Please see if it helps your situation.


[Bug other/67457] segfault in libbacktrace

2015-09-08 Thread Joost.VandeVondele at mat dot ethz.ch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67457

--- Comment #3 from Joost VandeVondele  
---
(In reply to Ian Lance Taylor from comment #2)
> If other compilers can print a backtrace when mmap fails, then I think they
> must be recording all necessary information in loadable sections.  When no
> memory is available we could print a trace of PC addresses, but it would be
> very painful to print file/line information.  We could stage the I/O through
> a static buffer, but finding the information to print without being able to
> build any data structures would be very inefficient.

actually, just a trace of PC addresses would be sufficient and useful, it would
allow to get the needed info afterwards nevertheless. This is actually what I
get with the other compiler.


[Bug other/67457] segfault in libbacktrace

2015-09-08 Thread ian at airs dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67457

Ian Lance Taylor  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #2 from Ian Lance Taylor  ---
I committed a patch so that libbacktrace should no longer segfault when no
memory is available.

If other compilers can print a backtrace when mmap fails, then I think they
must be recording all necessary information in loadable sections.  When no
memory is available we could print a trace of PC addresses, but it would be
very painful to print file/line information.  We could stage the I/O through a
static buffer, but finding the information to print without being able to build
any data structures would be very inefficient.


[Bug other/67457] segfault in libbacktrace

2015-09-08 Thread ian at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67457

--- Comment #1 from ian at gcc dot gnu.org  ---
Author: ian
Date: Tue Sep  8 13:49:19 2015
New Revision: 227529

URL: https://gcc.gnu.org/viewcvs?rev=227529&root=gcc&view=rev
Log:
PR other/67457
* mmap.c (backtrace_alloc): Correct test for mmap failure.

Modified:
trunk/libbacktrace/ChangeLog
trunk/libbacktrace/mmap.c