mirror of
https://github.com/ianlancetaylor/libbacktrace.git
synced 2026-04-05 17:09:06 +08:00
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:
committed by
Ian Lance Taylor
parent
14d377e9be
commit
17f687d2b9
17
fileline.c
17
fileline.c
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user