Commit 4f57c999 by Ian Lance Taylor

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. Fixes #69
parent 59473f79
...@@ -3190,20 +3190,15 @@ read_line_program (struct backtrace_state *state, struct dwarf_data *ddata, ...@@ -3190,20 +3190,15 @@ read_line_program (struct backtrace_state *state, struct dwarf_data *ddata,
uint64_t fileno; uint64_t fileno;
fileno = read_uleb128 (line_buf); fileno = read_uleb128 (line_buf);
if (fileno == 0) if (fileno >= hdr->filenames_count)
filename = "";
else
{ {
if (fileno >= hdr->filenames_count) dwarf_buf_error (line_buf,
{ ("invalid file number in "
dwarf_buf_error (line_buf, "line number program"),
("invalid file number in " 0);
"line number program"), return 0;
0);
return 0;
}
filename = hdr->filenames[fileno];
} }
filename = hdr->filenames[fileno];
} }
break; break;
case DW_LNS_set_column: case DW_LNS_set_column:
...@@ -3631,21 +3626,15 @@ read_function_entry (struct backtrace_state *state, struct dwarf_data *ddata, ...@@ -3631,21 +3626,15 @@ read_function_entry (struct backtrace_state *state, struct dwarf_data *ddata,
case DW_AT_call_file: case DW_AT_call_file:
if (val.encoding == ATTR_VAL_UINT) if (val.encoding == ATTR_VAL_UINT)
{ {
if (val.u.uint == 0) if (val.u.uint >= lhdr->filenames_count)
function->caller_filename = "";
else
{ {
if (val.u.uint >= lhdr->filenames_count) dwarf_buf_error (unit_buf,
{ ("invalid file number in "
dwarf_buf_error (unit_buf, "DW_AT_call_file attribute"),
("invalid file number in " 0);
"DW_AT_call_file attribute"), return 0;
0);
return 0;
}
function->caller_filename =
lhdr->filenames[val.u.uint];
} }
function->caller_filename = lhdr->filenames[val.u.uint];
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment