Update from gcc trunk version of libbacktrace at svn rev 256427. (#8)

Includes (among other things) support for compressed debug sections,
a variety of bugfixes, and expanded test coverage.
This commit is contained in:
Than McIntosh
2018-01-12 13:26:02 -05:00
committed by Ian Lance Taylor
parent 14d377e9be
commit 17f687d2b9
37 changed files with 10031 additions and 1997 deletions

View File

@@ -1,5 +1,5 @@
/* fileline.c -- Get file and line number information in a backtrace.
Copyright (C) 2012-2016 Free Software Foundation, Inc.
Copyright (C) 2012-2018 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Google.
Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE. */
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include "backtrace.h"
#include "internal.h"
@@ -57,6 +58,8 @@ fileline_initialize (struct backtrace_state *state,
int pass;
int called_error_callback;
int descriptor;
const char *filename;
char buf[64];
if (!state->threaded)
failed = state->fileline_initialization_failed;
@@ -80,9 +83,8 @@ fileline_initialize (struct backtrace_state *state,
descriptor = -1;
called_error_callback = 0;
for (pass = 0; pass < 4; ++pass)
for (pass = 0; pass < 5; ++pass)
{
const char *filename;
int does_not_exist;
switch (pass)
@@ -99,6 +101,11 @@ fileline_initialize (struct backtrace_state *state,
case 3:
filename = "/proc/curproc/file";
break;
case 4:
snprintf (buf, sizeof (buf), "/proc/%ld/object/a.out",
(long) getpid ());
filename = buf;
break;
default:
abort ();
}
@@ -133,8 +140,8 @@ fileline_initialize (struct backtrace_state *state,
if (!failed)
{
if (!backtrace_initialize (state, descriptor, error_callback, data,
&fileline_fn))
if (!backtrace_initialize (state, filename, descriptor, error_callback,
data, &fileline_fn))
failed = 1;
}