public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Tristan Gingold <gingold@adacore.com>
To: binutils Development <binutils@sourceware.org>
Subject: [Patch] Dump unknown dwarf lne records
Date: Wed, 04 May 2011 11:10:00 -0000	[thread overview]
Message-ID: <7C14CD10-54E4-480F-A898-A6C5F53C2E98@adacore.com> (raw)

Hi,

small patch to dump the unhandled lne records in dwarf.c.  Can be useful to manually decode them.

Ok for trunk ?

Tristan.

binutils/
2011-05-04  Tristan Gingold  <gingold@adacore.com>

	* dwarf.c (process_extended_line_op): Dump unknown records.


diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index b240af6..5102aec 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -376,14 +376,22 @@ process_extended_line_op (unsigned char *data, int is_stmt)
       break;
 
     default:
-      if (op_code >= DW_LNE_lo_user
-	  /* The test against DW_LNW_hi_user is redundant due to
-	     the limited range of the unsigned char data type used
-	     for op_code.  */
-	  /*&& op_code <= DW_LNE_hi_user*/)
-	printf (_("user defined: length %d\n"), len - bytes_read);
-      else
-	printf (_("UNKNOWN: length %d\n"), len - bytes_read);
+      {
+        unsigned int rlen = len - bytes_read - 1;
+
+        if (op_code >= DW_LNE_lo_user
+            /* The test against DW_LNW_hi_user is redundant due to
+               the limited range of the unsigned char data type used
+               for op_code.  */
+            /*&& op_code <= DW_LNE_hi_user*/)
+          printf (_("user defined: "));
+        else
+          printf (_("UNKNOWN: "));
+        printf (_("length %d ["), rlen);
+        for (; rlen; rlen--)
+          printf (" %02x", *data++);
+        printf ("]\n");
+      }
       break;
     }
 

             reply	other threads:[~2011-05-04 11:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-04 11:10 Tristan Gingold [this message]
2011-05-10  2:41 ` Alan Modra
2011-05-10  9:09   ` Tristan Gingold

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=7C14CD10-54E4-480F-A898-A6C5F53C2E98@adacore.com \
    --to=gingold@adacore.com \
    --cc=binutils@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).