summaryrefslogtreecommitdiff
path: root/src/readelf.c
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2020-08-26 14:27:46 +0200
committerMark Wielaard <mark@klomp.org>2020-08-26 14:27:46 +0200
commitdf91c6af98ac09acce5a906afef3e3fe21b24734 (patch)
tree1c29e9d116a2ed5765a26017744b8baf49c40911 /src/readelf.c
parent0c8cac246d18c7f9d161e68c951168750c72e26c (diff)
downloadelfutils-df91c6af98ac09acce5a906afef3e3fe21b24734.tar.gz
readelf: It is not an error if there are no line number statements
It can happen that there are no line number statements at the end of a debug line section. So don't check that there are any more bytes after the last file entry. And print "No line number statements." libdw already got this corner case correct. Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'src/readelf.c')
-rw-r--r--src/readelf.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/readelf.c b/src/readelf.c
index 685d0b17..41933d95 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -8642,7 +8642,7 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
printf (", ");
}
printf ("\n");
- if (linep >= lineendp)
+ if (linep > lineendp)
goto invalid_unit;
}
}
@@ -8685,6 +8685,12 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
++linep;
}
+ if (linep == lineendp)
+ {
+ puts (gettext ("\nNo line number statements."));
+ return;
+ }
+
puts (gettext ("\nLine number statements:"));
Dwarf_Word address = 0;
unsigned int op_index = 0;