aboutsummaryrefslogtreecommitdiff
path: root/libbacktrace
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-03-02 18:14:55 -0800
committerIan Lance Taylor <iant@golang.org>2021-03-02 18:16:58 -0800
commit9b2084db9f9917eb9b19b1eb5ec03cdcb05f349e (patch)
treebc15d73426f7b699262b4d163642ea09abd93c4a /libbacktrace
parentd97a92dca90bb1badb68782c1293f3cd4ff911ea (diff)
downloadgcc-9b2084db9f9917eb9b19b1eb5ec03cdcb05f349e.zip
gcc-9b2084db9f9917eb9b19b1eb5ec03cdcb05f349e.tar.gz
gcc-9b2084db9f9917eb9b19b1eb5ec03cdcb05f349e.tar.bz2
libbacktrace: don't special case file 0
It's no longer necessary as file 0 is now set up in all cases. * dwarf.c (read_line_program): Don't special case file 0. (read_function_entry): Likewise.
Diffstat (limited to 'libbacktrace')
-rw-r--r--libbacktrace/dwarf.c39
1 files changed, 14 insertions, 25 deletions
diff --git a/libbacktrace/dwarf.c b/libbacktrace/dwarf.c
index 546b4b2..e6b1f23 100644
--- a/libbacktrace/dwarf.c
+++ b/libbacktrace/dwarf.c
@@ -2857,20 +2857,15 @@ read_line_program (struct backtrace_state *state, struct dwarf_data *ddata,
uint64_t fileno;
fileno = read_uleb128 (line_buf);
- if (fileno == 0)
- filename = "";
- else
+ if (fileno >= hdr->filenames_count)
{
- if (fileno >= hdr->filenames_count)
- {
- dwarf_buf_error (line_buf,
- ("invalid file number in "
- "line number program"),
- 0);
- return 0;
- }
- filename = hdr->filenames[fileno];
+ dwarf_buf_error (line_buf,
+ ("invalid file number in "
+ "line number program"),
+ 0);
+ return 0;
}
+ filename = hdr->filenames[fileno];
}
break;
case DW_LNS_set_column:
@@ -3298,21 +3293,15 @@ read_function_entry (struct backtrace_state *state, struct dwarf_data *ddata,
case DW_AT_call_file:
if (val.encoding == ATTR_VAL_UINT)
{
- if (val.u.uint == 0)
- function->caller_filename = "";
- else
+ if (val.u.uint >= lhdr->filenames_count)
{
- if (val.u.uint >= lhdr->filenames_count)
- {
- dwarf_buf_error (unit_buf,
- ("invalid file number in "
- "DW_AT_call_file attribute"),
- 0);
- return 0;
- }
- function->caller_filename =
- lhdr->filenames[val.u.uint];
+ dwarf_buf_error (unit_buf,
+ ("invalid file number in "
+ "DW_AT_call_file attribute"),
+ 0);
+ return 0;
}
+ function->caller_filename = lhdr->filenames[val.u.uint];
}
break;