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
This commit is contained in:
Ian Lance Taylor
2021-03-02 18:14:55 -08:00
parent 59473f7906
commit 4f57c99971

13
dwarf.c
View File

@@ -3190,10 +3190,6 @@ 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)
filename = "";
else
{
if (fileno >= hdr->filenames_count) if (fileno >= hdr->filenames_count)
{ {
dwarf_buf_error (line_buf, dwarf_buf_error (line_buf,
@@ -3204,7 +3200,6 @@ read_line_program (struct backtrace_state *state, struct dwarf_data *ddata,
} }
filename = hdr->filenames[fileno]; filename = hdr->filenames[fileno];
} }
}
break; break;
case DW_LNS_set_column: case DW_LNS_set_column:
read_uleb128 (line_buf); read_uleb128 (line_buf);
@@ -3630,10 +3625,6 @@ 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)
function->caller_filename = "";
else
{ {
if (val.u.uint >= lhdr->filenames_count) if (val.u.uint >= lhdr->filenames_count)
{ {
@@ -3643,9 +3634,7 @@ read_function_entry (struct backtrace_state *state, struct dwarf_data *ddata,
0); 0);
return 0; return 0;
} }
function->caller_filename = function->caller_filename = lhdr->filenames[val.u.uint];
lhdr->filenames[val.u.uint];
}
} }
break; break;