public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [committed 3/13][odr] Add lang field to struct dw_cu
Date: Wed, 01 Jan 2020 00:00:00 -0000	[thread overview]
Message-ID: <20200106160658.GA19858@delia> (raw)

Hi,

Add a lang field to struct dw_cu, such that we can easily test whether a
compilation unit is C++ or not.

Committed to trunk.

Thanks,
- Tom

[odr] Add lang field to struct dw_cu

2020-01-06  Tom de Vries  <tdevries@suse.de>

	* dwz.c (struct dw_cu): Add lang field.
	(read_debug_info): Initialize lang field.

---
 dwz.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/dwz.c b/dwz.c
index 68c78a4..c9dc56b 100644
--- a/dwz.c
+++ b/dwz.c
@@ -736,6 +736,7 @@ struct dw_cu
   /* Intracusize argument to init_new_die_offsets.  Set in compute_abbrevs,
      used in recompute_abbrevs.  */
   unsigned int initial_intracusize;
+  enum dwarf_source_language lang;
 };
 
 /* Internal representation of a debugging information entry (DIE).
@@ -5676,13 +5677,21 @@ read_debug_info (DSO *dso, int kind, unsigned int *die_count)
 		  break;
 		case DW_FORM_flag_present:
 		  break;
+		case DW_FORM_data1:
+		  if (odr && die->die_tag == DW_TAG_compile_unit
+		      && t->attr[i].attr == DW_AT_language)
+		    cu->lang = *ptr;
+		  /* FALLTHRU */
 		case DW_FORM_ref1:
 		case DW_FORM_flag:
-		case DW_FORM_data1:
 		  ++ptr;
 		  break;
-		case DW_FORM_ref2:
 		case DW_FORM_data2:
+		  if (odr && die->die_tag == DW_TAG_compile_unit
+		      && t->attr[i].attr == DW_AT_language)
+		    cu->lang = do_read_16 (ptr);
+		  /* FALLTHRU */
+		case DW_FORM_ref2:
 		  ptr += 2;
 		  break;
 		case DW_FORM_ref4:

                 reply	other threads:[~2020-01-06 16:07 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=20200106160658.GA19858@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    /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).