public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [COMMITTED] readelf: Only lookup files and show errors in attr_callback when not silent.
Date: Fri, 13 Apr 2018 13:09:00 -0000	[thread overview]
Message-ID: <1523624979-20664-1-git-send-email-mark@klomp.org> (raw)

We recently added a couple more sanity checks and show an error when
attributes that represent files cannot be resolved. We should only do
this when the attr_callback should print the attribute information.
When not (for example when not showing the .debug_info section, but
only collecting information about the CUs containing pointers into
other sections) we don't need to lookup the file names, nor print
the errors/warnings.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 src/ChangeLog | 4 ++++
 src/readelf.c | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/src/ChangeLog b/src/ChangeLog
index 55eb279..068c87b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2018-04-14  Mark Wielaard  <mark@klomp.org>
+
+	* readelf.c (attr_callback): Only show errors when not silent.
+
 2018-03-23  Mark Wielaard  <mark@klomp.org>
 
 	* readelf.c (attr_callback): Handle DW_FORM_strx[1234].
diff --git a/src/readelf.c b/src/readelf.c
index 3fb5ee6..8c0ef6c 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -6253,6 +6253,9 @@ attr_callback (Dwarf_Attribute *attrp, void *arg)
 	case DW_AT_decl_file:
 	case DW_AT_call_file:
 	  {
+	    if (cbargs->silent)
+	      break;
+
 	    /* Try to get the actual file, the current interface only
 	       gives us full paths, but we only want to show the file
 	       name for now.  */
-- 
1.8.3.1

                 reply	other threads:[~2018-04-13 13:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1523624979-20664-1-git-send-email-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).