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

27
dwarf.c
View File

@@ -1,5 +1,5 @@
/* dwarf.c -- Get file/line information from DWARF for backtraces.
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
@@ -1648,16 +1648,15 @@ add_line (struct backtrace_state *state, struct dwarf_data *ddata,
return 1;
}
/* Free the line header information. If FREE_FILENAMES is true we
free the file names themselves, otherwise we leave them, as there
may be line structures pointing to them. */
/* Free the line header information. */
static void
free_line_header (struct backtrace_state *state, struct line_header *hdr,
backtrace_error_callback error_callback, void *data)
{
backtrace_free (state, hdr->dirs, hdr->dirs_count * sizeof (const char *),
error_callback, data);
if (hdr->dirs_count != 0)
backtrace_free (state, hdr->dirs, hdr->dirs_count * sizeof (const char *),
error_callback, data);
backtrace_free (state, hdr->filenames,
hdr->filenames_count * sizeof (char *),
error_callback, data);
@@ -1718,12 +1717,16 @@ read_line_header (struct backtrace_state *state, struct unit *u,
++hdr->dirs_count;
}
hdr->dirs = ((const char **)
backtrace_alloc (state,
hdr->dirs_count * sizeof (const char *),
line_buf->error_callback, line_buf->data));
if (hdr->dirs == NULL)
return 0;
hdr->dirs = NULL;
if (hdr->dirs_count != 0)
{
hdr->dirs = ((const char **)
backtrace_alloc (state,
hdr->dirs_count * sizeof (const char *),
line_buf->error_callback, line_buf->data));
if (hdr->dirs == NULL)
return 0;
}
i = 0;
while (*hdr_buf.buf != '\0')