Skip to content

Commit 5f57121

Browse files
committed
Update libbacktrace to 11b1a9c476b2df514d620d479407f2cf217cb373
Source: https://github.com/gcc-mirror/gcc
1 parent 02fbf31 commit 5f57121

37 files changed

+474
-1926
lines changed

src/libbacktrace/ChangeLog

+73
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,70 @@
1+
2016-01-04 Jakub Jelinek <jakub@redhat.com>
2+
3+
Update copyright years.
4+
5+
2015-12-18 Andris Pavenis <andris.pavenis@iki.fi>
6+
7+
* configure.ac: Specify that DJGPP do not have mmap even when sys/mman.h exists
8+
* configure: Regenerate
9+
10+
2015-12-09 John David Anglin <danglin@gcc.gnu.org>
11+
12+
PR 68115/libfortran
13+
* configure.ac: Set libbacktrace_cv_sys_sync to no on hppa*-*-hpux*.
14+
* configure: Regenerate.
15+
* elf.c (backtrace_initialize): Cast __sync_bool_compare_and_swap call
16+
to void.
17+
18+
2015-09-17 Ian Lance Taylor <iant@google.com>
19+
20+
* posix.c (backtrace_open): Cast second argument of open() to int.
21+
22+
2015-09-11 Ian Lance Taylor <iant@google.com>
23+
24+
* Makefile.am (backtrace.lo): Depend on internal.h.
25+
(sort.lo, stest.lo): Add explicit dependencies.
26+
* Makefile.in: Rebuild.
27+
28+
2015-09-09 Hans-Peter Nilsson <hp@axis.com>
29+
30+
* backtrace.c: #include <sys/types.h>.
31+
32+
2015-09-08 Ian Lance Taylor <iant@google.com>
33+
34+
PR other/67457
35+
* backtrace.c: #include "internal.h".
36+
(struct backtrace_data): Add can_alloc field.
37+
(unwind): If can_alloc is false, don't try to get file/line
38+
information.
39+
(backtrace_full): Set can_alloc field in bdata.
40+
* alloc.c (backtrace_alloc): Don't call error_callback if it is
41+
NULL.
42+
* mmap.c (backtrace_alloc): Likewise.
43+
* internal.h: Update comments for backtrace_alloc and
44+
backtrace_free.
45+
46+
2015-09-08 Ian Lance Taylor <iant@google.com>
47+
48+
PR other/67457
49+
* mmap.c (backtrace_alloc): Correct test for mmap failure.
50+
51+
2015-08-31 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
52+
53+
* configure.ac: For spu-*-* targets, set have_fcntl to no.
54+
* configure: Regenerate.
55+
56+
2015-08-27 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
57+
58+
* configure.ac: Remove [disable-shared] argument to LT_INIT.
59+
Remove setting PIC_FLAG when building as target library.
60+
* configure: Regenerate.
61+
62+
2015-08-26 Hans-Peter Nilsson <hp@axis.com>
63+
64+
* configure.ac: Only compile with -fPIC if the target
65+
supports it.
66+
* configure: Regenerate.
67+
168
2015-08-24 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
269

370
* configure.ac: Set have_mmap to no on spu-*-* targets.
@@ -497,3 +564,9 @@
497564
2012-09-17 Ian Lance Taylor <iant@google.com>
498565

499566
* Initial implementation.
567+
568+
Copyright (C) 2012-2016 Free Software Foundation, Inc.
569+
570+
Copying and distribution of this file, with or without modification,
571+
are permitted in any medium without royalty provided the copyright
572+
notice and this notice are preserved.

src/libbacktrace/Makefile.am

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Makefile.am -- Backtrace Makefile.
2-
# Copyright (C) 2012-2015 Free Software Foundation, Inc.
2+
# Copyright (C) 2012-2016 Free Software Foundation, Inc.
33

44
# Redistribution and use in source and binary forms, with or without
55
# modification, are permitted provided that the following conditions are
@@ -116,7 +116,7 @@ endif NATIVE
116116

117117
INCDIR = $(top_srcdir)/../include
118118
alloc.lo: config.h backtrace.h internal.h
119-
backtrace.lo: config.h backtrace.h
119+
backtrace.lo: config.h backtrace.h internal.h
120120
btest.lo: (INCDIR)/filenames.h backtrace.h backtrace-supported.h
121121
dwarf.lo: config.h $(INCDIR)/dwarf2.h $(INCDIR)/dwarf2.def \
122122
$(INCDIR)/filenames.h backtrace.h internal.h
@@ -130,5 +130,7 @@ posix.lo: config.h backtrace.h internal.h
130130
print.lo: config.h backtrace.h internal.h
131131
read.lo: config.h backtrace.h internal.h
132132
simple.lo: config.h backtrace.h internal.h
133+
sort.lo: config.h backtrace.h internal.h
134+
stest.lo: config.h backtrace.h internal.h
133135
state.lo: config.h backtrace.h backtrace-supported.h internal.h
134136
unknown.lo: config.h backtrace.h internal.h

src/libbacktrace/Makefile.in

+4-1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ AUTOMAKE = @AUTOMAKE@
162162
AWK = @AWK@
163163
BACKTRACE_FILE = @BACKTRACE_FILE@
164164
BACKTRACE_SUPPORTED = @BACKTRACE_SUPPORTED@
165+
BACKTRACE_SUPPORTS_DATA = @BACKTRACE_SUPPORTS_DATA@
165166
BACKTRACE_SUPPORTS_THREADS = @BACKTRACE_SUPPORTS_THREADS@
166167
BACKTRACE_USES_MALLOC = @BACKTRACE_USES_MALLOC@
167168
CC = @CC@
@@ -745,7 +746,7 @@ uninstall-am:
745746
uninstall-am
746747

747748
alloc.lo: config.h backtrace.h internal.h
748-
backtrace.lo: config.h backtrace.h
749+
backtrace.lo: config.h backtrace.h internal.h
749750
btest.lo: (INCDIR)/filenames.h backtrace.h backtrace-supported.h
750751
dwarf.lo: config.h $(INCDIR)/dwarf2.h $(INCDIR)/dwarf2.def \
751752
$(INCDIR)/filenames.h backtrace.h internal.h
@@ -759,6 +760,8 @@ posix.lo: config.h backtrace.h internal.h
759760
print.lo: config.h backtrace.h internal.h
760761
read.lo: config.h backtrace.h internal.h
761762
simple.lo: config.h backtrace.h internal.h
763+
sort.lo: config.h backtrace.h internal.h
764+
stest.lo: config.h backtrace.h internal.h
762765
state.lo: config.h backtrace.h backtrace-supported.h internal.h
763766
unknown.lo: config.h backtrace.h internal.h
764767

src/libbacktrace/alloc.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* alloc.c -- Memory allocation without mmap.
2-
Copyright (C) 2012-2015 Free Software Foundation, Inc.
2+
Copyright (C) 2012-2016 Free Software Foundation, Inc.
33
Written by Ian Lance Taylor, Google.
44
55
Redistribution and use in source and binary forms, with or without
@@ -44,7 +44,8 @@ POSSIBILITY OF SUCH DAMAGE. */
4444
backtrace functions may not be safely invoked from a signal
4545
handler. */
4646

47-
/* Allocate memory like malloc. */
47+
/* Allocate memory like malloc. If ERROR_CALLBACK is NULL, don't
48+
report an error. */
4849

4950
void *
5051
backtrace_alloc (struct backtrace_state *state ATTRIBUTE_UNUSED,
@@ -55,7 +56,10 @@ backtrace_alloc (struct backtrace_state *state ATTRIBUTE_UNUSED,
5556

5657
ret = malloc (size);
5758
if (ret == NULL)
58-
error_callback (data, "malloc", errno);
59+
{
60+
if (error_callback)
61+
error_callback (data, "malloc", errno);
62+
}
5963
return ret;
6064
}
6165

src/libbacktrace/ansidecl.h

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/* ANSI and traditional C compatability macros
2-
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
3-
2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2013
4-
Free Software Foundation, Inc.
2+
Copyright (C) 1991-2015 Free Software Foundation, Inc.
53
This file is part of the GNU C Library.
64
75
This program is free software; you can redistribute it and/or modify
@@ -276,6 +274,15 @@ So instead we use the macro below and test it against specific values. */
276274
# endif /* GNUC >= 4.3 */
277275
#endif /* ATTRIBUTE_HOT */
278276

277+
/* Attribute 'no_sanitize_undefined' was valid as of gcc 4.9. */
278+
#ifndef ATTRIBUTE_NO_SANITIZE_UNDEFINED
279+
# if (GCC_VERSION >= 4009)
280+
# define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__ ((no_sanitize_undefined))
281+
# else
282+
# define ATTRIBUTE_NO_SANITIZE_UNDEFINED
283+
# endif /* GNUC >= 4.9 */
284+
#endif /* ATTRIBUTE_NO_SANITIZE_UNDEFINED */
285+
279286
/* We use __extension__ in some places to suppress -pedantic warnings
280287
about GCC extensions. This feature didn't work properly before
281288
gcc 2.8. */
@@ -304,6 +311,15 @@ So instead we use the macro below and test it against specific values. */
304311
#define ENUM_BITFIELD(TYPE) __extension__ enum TYPE
305312
#else
306313
#define ENUM_BITFIELD(TYPE) unsigned int
314+
#endif
315+
316+
/* This is used to mark a class or virtual function as final. */
317+
#if __cplusplus >= 201103L
318+
#define GCC_FINAL final
319+
#elif GCC_VERSION >= 4007
320+
#define GCC_FINAL __final
321+
#else
322+
#define GCC_FINAL
307323
#endif
308324

309325
#ifdef __cplusplus

src/libbacktrace/atomic.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* atomic.c -- Support for atomic functions if not present.
2-
Copyright (C) 2013-2015 Free Software Foundation, Inc.
2+
Copyright (C) 2013-2016 Free Software Foundation, Inc.
33
Written by Ian Lance Taylor, Google.
44
55
Redistribution and use in source and binary forms, with or without

src/libbacktrace/backtrace-supported.h.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* backtrace-supported.h.in -- Whether stack backtrace is supported.
2-
Copyright (C) 2012-2015 Free Software Foundation, Inc.
2+
Copyright (C) 2012-2016 Free Software Foundation, Inc.
33
Written by Ian Lance Taylor, Google.
44
55
Redistribution and use in source and binary forms, with or without

src/libbacktrace/backtrace.c

+24-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* backtrace.c -- Entry point for stack backtrace library.
2-
Copyright (C) 2012-2015 Free Software Foundation, Inc.
2+
Copyright (C) 2012-2016 Free Software Foundation, Inc.
33
Written by Ian Lance Taylor, Google.
44
55
Redistribution and use in source and binary forms, with or without
@@ -32,8 +32,11 @@ POSSIBILITY OF SUCH DAMAGE. */
3232

3333
#include "config.h"
3434

35+
#include <sys/types.h>
36+
3537
#include "unwind.h"
3638
#include "backtrace.h"
39+
#include "internal.h"
3740

3841
/* The main backtrace_full routine. */
3942

@@ -53,6 +56,8 @@ struct backtrace_data
5356
void *data;
5457
/* Value to return from backtrace_full. */
5558
int ret;
59+
/* Whether there is any memory available. */
60+
int can_alloc;
5661
};
5762

5863
/* Unwind library callback routine. This is passed to
@@ -80,8 +85,11 @@ unwind (struct _Unwind_Context *context, void *vdata)
8085
if (!ip_before_insn)
8186
--pc;
8287

83-
bdata->ret = backtrace_pcinfo (bdata->state, pc, bdata->callback,
84-
bdata->error_callback, bdata->data);
88+
if (!bdata->can_alloc)
89+
bdata->ret = bdata->callback (bdata->data, pc, NULL, 0, NULL);
90+
else
91+
bdata->ret = backtrace_pcinfo (bdata->state, pc, bdata->callback,
92+
bdata->error_callback, bdata->data);
8593
if (bdata->ret != 0)
8694
return _URC_END_OF_STACK;
8795

@@ -96,13 +104,26 @@ backtrace_full (struct backtrace_state *state, int skip,
96104
backtrace_error_callback error_callback, void *data)
97105
{
98106
struct backtrace_data bdata;
107+
void *p;
99108

100109
bdata.skip = skip + 1;
101110
bdata.state = state;
102111
bdata.callback = callback;
103112
bdata.error_callback = error_callback;
104113
bdata.data = data;
105114
bdata.ret = 0;
115+
116+
/* If we can't allocate any memory at all, don't try to produce
117+
file/line information. */
118+
p = backtrace_alloc (state, 4096, NULL, NULL);
119+
if (p == NULL)
120+
bdata.can_alloc = 0;
121+
else
122+
{
123+
backtrace_free (state, p, 4096, NULL, NULL);
124+
bdata.can_alloc = 1;
125+
}
126+
106127
_Unwind_Backtrace (unwind, &bdata);
107128
return bdata.ret;
108129
}

src/libbacktrace/backtrace.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* backtrace.h -- Public header file for stack backtrace library.
2-
Copyright (C) 2012-2015 Free Software Foundation, Inc.
2+
Copyright (C) 2012-2016 Free Software Foundation, Inc.
33
Written by Ian Lance Taylor, Google.
44
55
Redistribution and use in source and binary forms, with or without

src/libbacktrace/btest.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* btest.c -- Test for libbacktrace library
2-
Copyright (C) 2012-2015 Free Software Foundation, Inc.
2+
Copyright (C) 2012-2016 Free Software Foundation, Inc.
33
Written by Ian Lance Taylor, Google.
44
55
Redistribution and use in source and binary forms, with or without

0 commit comments

Comments
 (0)