summaryrefslogtreecommitdiff
path: root/libbacktrace
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-31 10:18:27 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-31 10:18:27 +0000
commitd42d3fad6998402ea943bc2a3159cad09eb288d5 (patch)
treed70dbc97eb104b1c403ef6d4cff46da1ebf52c76 /libbacktrace
parent8422fa6afbb619fc66678c664bfaf834691527fc (diff)
downloadgcc-d42d3fad6998402ea943bc2a3159cad09eb288d5.tar.gz
2012-10-31 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 193029 using svnmerge.py git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@193030 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libbacktrace')
-rw-r--r--libbacktrace/ChangeLog26
-rwxr-xr-xlibbacktrace/configure25
-rw-r--r--libbacktrace/configure.ac14
-rw-r--r--libbacktrace/elf.c4
-rw-r--r--libbacktrace/fileline.c4
-rw-r--r--libbacktrace/internal.h10
-rw-r--r--libbacktrace/mmap.c13
-rw-r--r--libbacktrace/posix.c10
8 files changed, 93 insertions, 13 deletions
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog
index 729123d8bb0..91e1c9eccd4 100644
--- a/libbacktrace/ChangeLog
+++ b/libbacktrace/ChangeLog
@@ -1,3 +1,29 @@
+2012-10-29 Ian Lance Taylor <iant@google.com>
+
+ * mmap.c (backtrace_vector_release): Correct last patch: add
+ aligned, not size.
+
+2012-10-29 Ian Lance Taylor <iant@google.com>
+
+ * mmap.c (backtrace_vector_release): Make sure freed block is
+ aligned on 8-byte boundary.
+
+2012-10-26 Ian Lance Taylor <iant@google.com>
+
+ PR other/55087
+ * posix.c (backtrace_open): Add does_not_exist parameter.
+ * elf.c (phdr_callback): Do not warn if shared library could not
+ be opened.
+ * fileline.c (fileline_initialize): Update calls to
+ backtrace_open.
+ * internal.h (backtrace_open): Update declaration.
+
+2012-10-26 Jack Howarth <howarth@bromo.med.uc.edu>
+
+ PR target/55061
+ * configure.ac: Check for _Unwind_GetIPInfo function declaration.
+ * configure: Regenerate.
+
2012-10-24 Ian Lance Taylor <iant@google.com>
PR target/55061
diff --git a/libbacktrace/configure b/libbacktrace/configure
index f4608d1fa1d..36b6b8dff8c 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -11619,13 +11619,32 @@ $as_echo "#define HAVE_GETIPINFO 1" >>confdefs.h
fi
else
- ac_fn_c_check_func "$LINENO" "_Unwind_GetIPInfo" "ac_cv_func__Unwind_GetIPInfo"
-if test "x$ac_cv_func__Unwind_GetIPInfo" = x""yes; then :
+ ac_save_CFFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror-implicit-function-declaration"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _Unwind_GetIPInfo" >&5
+$as_echo_n "checking for _Unwind_GetIPInfo... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include "unwind.h"
+ struct _Unwind_Context *context;
+ int ip_before_insn = 0;
+int
+main ()
+{
+return _Unwind_GetIPInfo (context, &ip_before_insn);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
have_unwind_getipinfo=yes
else
have_unwind_getipinfo=no
fi
-
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$ac_save_CFLAGS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_unwind_getipinfo" >&5
+$as_echo "$have_unwind_getipinfo" >&6; }
if test "$have_unwind_getipinfo" = "yes"; then
$as_echo "#define HAVE_GETIPINFO 1" >>confdefs.h
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 6867ecffb89..534f9276cdb 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -129,8 +129,18 @@ AC_SUBST(WARN_FLAGS)
if test -n "${with_target_subdir}"; then
GCC_CHECK_UNWIND_GETIPINFO
else
- AC_CHECK_FUNC(_Unwind_GetIPInfo, [have_unwind_getipinfo=yes],
- [have_unwind_getipinfo=no])
+ ac_save_CFFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror-implicit-function-declaration"
+ AC_MSG_CHECKING([for _Unwind_GetIPInfo])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include "unwind.h"
+ struct _Unwind_Context *context;
+ int ip_before_insn = 0;],
+ [return _Unwind_GetIPInfo (context, &ip_before_insn);])],
+ [have_unwind_getipinfo=yes], [have_unwind_getipinfo=no])
+ CFLAGS="$ac_save_CFLAGS"
+ AC_MSG_RESULT([$have_unwind_getipinfo])
if test "$have_unwind_getipinfo" = "yes"; then
AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.])
fi
diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c
index b396c47ef29..8433a72fcd6 100644
--- a/libbacktrace/elf.c
+++ b/libbacktrace/elf.c
@@ -810,6 +810,7 @@ phdr_callback (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED,
{
struct phdr_data *pd = (struct phdr_data *) pdata;
int descriptor;
+ int does_not_exist;
fileline elf_fileline_fn;
int found_dwarf;
@@ -821,7 +822,8 @@ phdr_callback (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED,
|| info->dlpi_addr == 0)
return 0;
- descriptor = backtrace_open (info->dlpi_name, pd->error_callback, pd->data);
+ descriptor = backtrace_open (info->dlpi_name, pd->error_callback, pd->data,
+ &does_not_exist);
if (descriptor < 0)
return 0;
diff --git a/libbacktrace/fileline.c b/libbacktrace/fileline.c
index 4efd19b0595..e577ecc9061 100644
--- a/libbacktrace/fileline.c
+++ b/libbacktrace/fileline.c
@@ -80,9 +80,9 @@ fileline_initialize (struct backtrace_state *state,
/* We have not initialized the information. Do it now. */
if (state->filename != NULL)
- descriptor = backtrace_open (state->filename, error_callback, data);
+ descriptor = backtrace_open (state->filename, error_callback, data, NULL);
else
- descriptor = backtrace_open ("/proc/self/exe", error_callback, data);
+ descriptor = backtrace_open ("/proc/self/exe", error_callback, data, NULL);
if (descriptor < 0)
failed = 1;
diff --git a/libbacktrace/internal.h b/libbacktrace/internal.h
index b1afca0a2d9..5e0dba44a85 100644
--- a/libbacktrace/internal.h
+++ b/libbacktrace/internal.h
@@ -109,10 +109,16 @@ struct backtrace_state
struct backtrace_freelist_struct *freelist;
};
-/* Open a file for reading. Returns -1 on error. */
+/* Open a file for reading. Returns -1 on error. If DOES_NOT_EXIST
+ is not NULL, *DOES_NOT_EXIST will be set to 0 normally and set to 1
+ if the file does not exist. If the file does not exist and
+ DOES_NOT_EXIST is not NULL, the function will return -1 and will
+ not call ERROR_CALLBACK. On other errors, or if DOES_NOT_EXIST is
+ NULL, the function will call ERROR_CALLBACK before returning. */
extern int backtrace_open (const char *filename,
backtrace_error_callback error_callback,
- void *data);
+ void *data,
+ int *does_not_exist);
/* A view of the contents of a file. This supports mmap when
available. A view will remain in memory even after backtrace_close
diff --git a/libbacktrace/mmap.c b/libbacktrace/mmap.c
index e07810d4575..d3313c7cf1e 100644
--- a/libbacktrace/mmap.c
+++ b/libbacktrace/mmap.c
@@ -229,7 +229,18 @@ backtrace_vector_release (struct backtrace_state *state,
backtrace_error_callback error_callback,
void *data)
{
- backtrace_free (state, (char *) vec->base + vec->size, vec->alc,
+ size_t size;
+ size_t alc;
+ size_t aligned;
+
+ /* Make sure that the block that we free is aligned on an 8-byte
+ boundary. */
+ size = vec->size;
+ alc = vec->alc;
+ aligned = (size + 7) & ~ (size_t) 7;
+ alc -= aligned - size;
+
+ backtrace_free (state, (char *) vec->base + aligned, alc,
error_callback, data);
vec->alc = 0;
return 1;
diff --git a/libbacktrace/posix.c b/libbacktrace/posix.c
index 01afc42b08e..4d6c852b781 100644
--- a/libbacktrace/posix.c
+++ b/libbacktrace/posix.c
@@ -57,14 +57,20 @@ POSSIBILITY OF SUCH DAMAGE. */
int
backtrace_open (const char *filename, backtrace_error_callback error_callback,
- void *data)
+ void *data, int *does_not_exist)
{
int descriptor;
+ if (does_not_exist != NULL)
+ *does_not_exist = 0;
+
descriptor = open (filename, O_RDONLY | O_BINARY | O_CLOEXEC);
if (descriptor < 0)
{
- error_callback (data, filename, errno);
+ if (does_not_exist != NULL && errno == ENOENT)
+ *does_not_exist = 1;
+ else
+ error_callback (data, filename, errno);
return -1;
}