Skip to content

Commit

Permalink
Update libbacktrace to 11b1a9c476b2df514d620d479407f2cf217cb373
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Jan 14, 2016
1 parent 02fbf31 commit 5f57121
Show file tree
Hide file tree
Showing 37 changed files with 474 additions and 1,926 deletions.
73 changes: 73 additions & 0 deletions src/libbacktrace/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,70 @@
2016-01-04 Jakub Jelinek <[email protected]>

Update copyright years.

2015-12-18 Andris Pavenis <[email protected]>

* configure.ac: Specify that DJGPP do not have mmap even when sys/mman.h exists
* configure: Regenerate

2015-12-09 John David Anglin <[email protected]>

PR 68115/libfortran
* configure.ac: Set libbacktrace_cv_sys_sync to no on hppa*-*-hpux*.
* configure: Regenerate.
* elf.c (backtrace_initialize): Cast __sync_bool_compare_and_swap call
to void.

2015-09-17 Ian Lance Taylor <[email protected]>

* posix.c (backtrace_open): Cast second argument of open() to int.

2015-09-11 Ian Lance Taylor <[email protected]>

* Makefile.am (backtrace.lo): Depend on internal.h.
(sort.lo, stest.lo): Add explicit dependencies.
* Makefile.in: Rebuild.

2015-09-09 Hans-Peter Nilsson <[email protected]>

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

2015-09-08 Ian Lance Taylor <[email protected]>

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.

2015-09-08 Ian Lance Taylor <[email protected]>

PR other/67457
* mmap.c (backtrace_alloc): Correct test for mmap failure.

2015-08-31 Ulrich Weigand <[email protected]>

* configure.ac: For spu-*-* targets, set have_fcntl to no.
* configure: Regenerate.

2015-08-27 Ulrich Weigand <[email protected]>

* configure.ac: Remove [disable-shared] argument to LT_INIT.
Remove setting PIC_FLAG when building as target library.
* configure: Regenerate.

2015-08-26 Hans-Peter Nilsson <[email protected]>

* configure.ac: Only compile with -fPIC if the target
supports it.
* configure: Regenerate.

2015-08-24 Ulrich Weigand <[email protected]>

* configure.ac: Set have_mmap to no on spu-*-* targets.
Expand Down Expand Up @@ -497,3 +564,9 @@
2012-09-17 Ian Lance Taylor <[email protected]>

* Initial implementation.

Copyright (C) 2012-2016 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
6 changes: 4 additions & 2 deletions src/libbacktrace/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Makefile.am -- Backtrace Makefile.
# Copyright (C) 2012-2015 Free Software Foundation, Inc.
# Copyright (C) 2012-2016 Free Software Foundation, Inc.

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

INCDIR = $(top_srcdir)/../include
alloc.lo: config.h backtrace.h internal.h
backtrace.lo: config.h backtrace.h
backtrace.lo: config.h backtrace.h internal.h
btest.lo: (INCDIR)/filenames.h backtrace.h backtrace-supported.h
dwarf.lo: config.h $(INCDIR)/dwarf2.h $(INCDIR)/dwarf2.def \
$(INCDIR)/filenames.h backtrace.h internal.h
Expand All @@ -130,5 +130,7 @@ posix.lo: config.h backtrace.h internal.h
print.lo: config.h backtrace.h internal.h
read.lo: config.h backtrace.h internal.h
simple.lo: config.h backtrace.h internal.h
sort.lo: config.h backtrace.h internal.h
stest.lo: config.h backtrace.h internal.h
state.lo: config.h backtrace.h backtrace-supported.h internal.h
unknown.lo: config.h backtrace.h internal.h
5 changes: 4 additions & 1 deletion src/libbacktrace/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BACKTRACE_FILE = @BACKTRACE_FILE@
BACKTRACE_SUPPORTED = @BACKTRACE_SUPPORTED@
BACKTRACE_SUPPORTS_DATA = @BACKTRACE_SUPPORTS_DATA@
BACKTRACE_SUPPORTS_THREADS = @BACKTRACE_SUPPORTS_THREADS@
BACKTRACE_USES_MALLOC = @BACKTRACE_USES_MALLOC@
CC = @CC@
Expand Down Expand Up @@ -745,7 +746,7 @@ uninstall-am:
uninstall-am

alloc.lo: config.h backtrace.h internal.h
backtrace.lo: config.h backtrace.h
backtrace.lo: config.h backtrace.h internal.h
btest.lo: (INCDIR)/filenames.h backtrace.h backtrace-supported.h
dwarf.lo: config.h $(INCDIR)/dwarf2.h $(INCDIR)/dwarf2.def \
$(INCDIR)/filenames.h backtrace.h internal.h
Expand All @@ -759,6 +760,8 @@ posix.lo: config.h backtrace.h internal.h
print.lo: config.h backtrace.h internal.h
read.lo: config.h backtrace.h internal.h
simple.lo: config.h backtrace.h internal.h
sort.lo: config.h backtrace.h internal.h
stest.lo: config.h backtrace.h internal.h
state.lo: config.h backtrace.h backtrace-supported.h internal.h
unknown.lo: config.h backtrace.h internal.h

Expand Down
10 changes: 7 additions & 3 deletions src/libbacktrace/alloc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* alloc.c -- Memory allocation without mmap.
Copyright (C) 2012-2015 Free Software Foundation, Inc.
Copyright (C) 2012-2016 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -44,7 +44,8 @@ POSSIBILITY OF SUCH DAMAGE. */
backtrace functions may not be safely invoked from a signal
handler. */

/* Allocate memory like malloc. */
/* Allocate memory like malloc. If ERROR_CALLBACK is NULL, don't
report an error. */

void *
backtrace_alloc (struct backtrace_state *state ATTRIBUTE_UNUSED,
Expand All @@ -55,7 +56,10 @@ backtrace_alloc (struct backtrace_state *state ATTRIBUTE_UNUSED,

ret = malloc (size);
if (ret == NULL)
error_callback (data, "malloc", errno);
{
if (error_callback)
error_callback (data, "malloc", errno);
}
return ret;
}

Expand Down
22 changes: 19 additions & 3 deletions src/libbacktrace/ansidecl.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* ANSI and traditional C compatability macros
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2013
Free Software Foundation, Inc.
Copyright (C) 1991-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -276,6 +274,15 @@ So instead we use the macro below and test it against specific values. */
# endif /* GNUC >= 4.3 */
#endif /* ATTRIBUTE_HOT */

/* Attribute 'no_sanitize_undefined' was valid as of gcc 4.9. */
#ifndef ATTRIBUTE_NO_SANITIZE_UNDEFINED
# if (GCC_VERSION >= 4009)
# define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__ ((no_sanitize_undefined))
# else
# define ATTRIBUTE_NO_SANITIZE_UNDEFINED
# endif /* GNUC >= 4.9 */
#endif /* ATTRIBUTE_NO_SANITIZE_UNDEFINED */

/* We use __extension__ in some places to suppress -pedantic warnings
about GCC extensions. This feature didn't work properly before
gcc 2.8. */
Expand Down Expand Up @@ -304,6 +311,15 @@ So instead we use the macro below and test it against specific values. */
#define ENUM_BITFIELD(TYPE) __extension__ enum TYPE
#else
#define ENUM_BITFIELD(TYPE) unsigned int
#endif

/* This is used to mark a class or virtual function as final. */
#if __cplusplus >= 201103L
#define GCC_FINAL final
#elif GCC_VERSION >= 4007
#define GCC_FINAL __final
#else
#define GCC_FINAL
#endif

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion src/libbacktrace/atomic.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* atomic.c -- Support for atomic functions if not present.
Copyright (C) 2013-2015 Free Software Foundation, Inc.
Copyright (C) 2013-2016 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/libbacktrace/backtrace-supported.h.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* backtrace-supported.h.in -- Whether stack backtrace is supported.
Copyright (C) 2012-2015 Free Software Foundation, Inc.
Copyright (C) 2012-2016 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.

Redistribution and use in source and binary forms, with or without
Expand Down
27 changes: 24 additions & 3 deletions src/libbacktrace/backtrace.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* backtrace.c -- Entry point for stack backtrace library.
Copyright (C) 2012-2015 Free Software Foundation, Inc.
Copyright (C) 2012-2016 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -32,8 +32,11 @@ POSSIBILITY OF SUCH DAMAGE. */

#include "config.h"

#include <sys/types.h>

#include "unwind.h"
#include "backtrace.h"
#include "internal.h"

/* The main backtrace_full routine. */

Expand All @@ -53,6 +56,8 @@ struct backtrace_data
void *data;
/* Value to return from backtrace_full. */
int ret;
/* Whether there is any memory available. */
int can_alloc;
};

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

bdata->ret = backtrace_pcinfo (bdata->state, pc, bdata->callback,
bdata->error_callback, bdata->data);
if (!bdata->can_alloc)
bdata->ret = bdata->callback (bdata->data, pc, NULL, 0, NULL);
else
bdata->ret = backtrace_pcinfo (bdata->state, pc, bdata->callback,
bdata->error_callback, bdata->data);
if (bdata->ret != 0)
return _URC_END_OF_STACK;

Expand All @@ -96,13 +104,26 @@ backtrace_full (struct backtrace_state *state, int skip,
backtrace_error_callback error_callback, void *data)
{
struct backtrace_data bdata;
void *p;

bdata.skip = skip + 1;
bdata.state = state;
bdata.callback = callback;
bdata.error_callback = error_callback;
bdata.data = data;
bdata.ret = 0;

/* If we can't allocate any memory at all, don't try to produce
file/line information. */
p = backtrace_alloc (state, 4096, NULL, NULL);
if (p == NULL)
bdata.can_alloc = 0;
else
{
backtrace_free (state, p, 4096, NULL, NULL);
bdata.can_alloc = 1;
}

_Unwind_Backtrace (unwind, &bdata);
return bdata.ret;
}
2 changes: 1 addition & 1 deletion src/libbacktrace/backtrace.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* backtrace.h -- Public header file for stack backtrace library.
Copyright (C) 2012-2015 Free Software Foundation, Inc.
Copyright (C) 2012-2016 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/libbacktrace/btest.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* btest.c -- Test for libbacktrace library
Copyright (C) 2012-2015 Free Software Foundation, Inc.
Copyright (C) 2012-2016 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
Redistribution and use in source and binary forms, with or without
Expand Down
Loading

0 comments on commit 5f57121

Please sign in to comment.