diff mbox

libbacktrace patch committed: Graceful fallback if out of memory

Message ID 201509090000.t8900Qtt020752@ignucius.se.axis.com
State New
Headers show

Commit Message

Hans-Peter Nilsson Sept. 9, 2015, midnight UTC
> From: Ian Lance Taylor <iant@google.com>
> Date: Tue, 8 Sep 2015 18:46:21 +0200


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

> Index: backtrace.c
> ===================================================================
> --- backtrace.c	(revision 227528)
> +++ backtrace.c	(working copy)
> @@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.  */
>  
>  #include "unwind.h"
>  #include "backtrace.h"
> +#include "internal.h"
>  
>  /* The main backtrace_full routine.  */
>  


I don't know about your environment, but for me (cross from
x86_64-linux to cris-elf) that causes a:

/bin/sh ./libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I/tmp/hpautotest-gcc0/gcc/libbacktrace  -I /tmp/hpautotest-gcc0/gcc/libbacktrace/../include -I /tmp/hpautotest-gcc0/gcc/libbacktrace/../libgcc -I ../libgcc  -funwind-tables -frandom-seed=backtrace.lo -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -Wcast-qual  -g -O2 -c -o backtrace.lo /tmp/hpautotest-gcc0/gcc/libbacktrace/backtrace.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I/tmp/hpautotest-gcc0/gcc/libbacktrace -I /tmp/hpautotest-gcc0/gcc/libbacktrace/../include -I /tmp/hpautotest-gcc0/gcc/libbacktrace/../libgcc -I ../libgcc -funwind-tables -frandom-seed=backtrace.lo -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -Wcast-qual -g -O2 -c /tmp/hpautotest-gcc0/gcc/libbacktrace/backtrace.c  -fPIC -DPIC -o .libs/backtrace.o
In file included from /tmp/hpautotest-gcc0/gcc/libbacktrace/backtrace.c:37:
/tmp/hpautotest-gcc0/gcc/libbacktrace/internal.h:182: error: expected declaration specifiers or '...' before 'off_t'
make[3]: *** [backtrace.lo] Error 1
make[3]: Leaving directory `/tmp/hpautotest-gcc0/cris-elf/gccobj/libbacktrace'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/tmp/hpautotest-gcc0/cris-elf/gccobj/libbacktrace'
make[1]: *** [all-libbacktrace] Error 2
make[1]: Leaving directory `/tmp/hpautotest-gcc0/cris-elf/gccobj'
make: *** [all] Error 2

I've committed the following as obvious, following the pattern
of the other files including internal.h, after observing
all-libbacktrace (i.e. built for the host) complete.

libbacktrace:
	* backtrace.c: #include <sys/types.h>.


brgds, H-P

Comments

Ian Lance Taylor Sept. 9, 2015, 12:35 a.m. UTC | #1
On Tue, Sep 8, 2015 at 5:00 PM, Hans-Peter Nilsson
<hans-peter.nilsson@axis.com> wrote:
>
> I've committed the following as obvious, following the pattern
> of the other files including internal.h, after observing
> all-libbacktrace (i.e. built for the host) complete.
>
> libbacktrace:
>         * backtrace.c: #include <sys/types.h>.

Thanks.

Ian
diff mbox

Patch

Index: backtrace.c
===================================================================
--- backtrace.c	(revision 227567)
+++ backtrace.c	(working copy)
@@ -32,6 +32,8 @@  POSSIBILITY OF SUCH DAMAGE.  */
 
 #include "config.h"
 
+#include <sys/types.h>
+
 #include "unwind.h"
 #include "backtrace.h"
 #include "internal.h"