summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2017-01-29 19:34:24 +0000
committerChristos Zoulas <christos@zoulas.com>2017-01-29 19:34:24 +0000
commit261f05ab1846668fd9c96a0facaac7a0fa6c33c2 (patch)
tree4fdc64467c1ef6fce29832432b10e6d1cf8cb288
parent45d5b050af82d7be4a3c867906c65bb17d5f6151 (diff)
downloadfile-git-261f05ab1846668fd9c96a0facaac7a0fa6c33c2.tar.gz
PR/591: Print if the file has debug info.
-rw-r--r--src/readelf.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/readelf.c b/src/readelf.c
index 2752ffa7..6738942d 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.129 2017/01/18 16:08:25 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.130 2017/01/29 19:34:24 christos Exp $")
#endif
#ifdef BUILTIN_ELF
@@ -1185,7 +1185,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
{
Elf32_Shdr sh32;
Elf64_Shdr sh64;
- int stripped = 1;
+ int stripped = 1, has_debug_info = 1;
size_t nbadcap = 0;
void *nbuf;
off_t noff, coff, name_off;
@@ -1216,8 +1216,10 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
return -1;
}
name[namesize] = '\0';
- if (strcmp(name, ".debug_info") == 0)
+ if (strcmp(name, ".debug_info") == 0) {
+ has_debug_info = 1;
stripped = 0;
+ }
if (pread(fd, xsh_addr, xsh_sizeof, off) < (ssize_t)xsh_sizeof) {
file_badread(ms);
@@ -1373,6 +1375,10 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
if (file_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
return -1;
+ if (has_debug_info) {
+ if (file_printf(ms, ", with debug_info") == -1)
+ return -1;
+ }
if (cap_hw1) {
const cap_desc_t *cdp;
switch (mach) {