public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [RFC 3/13][odr] Add lang field to struct dw_cu
@ 2019-01-01  0:00 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2019-01-01  0:00 UTC (permalink / raw)
  To: dwz, jakub; +Cc: Michael Matz

Hi,

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

Any comments?

Thanks,
- Tom

[odr] Add lang field to struct dw_cu

2019-12-10  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 5a1f388..4bf3727 100644
--- a/dwz.c
+++ b/dwz.c
@@ -704,6 +704,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).
@@ -5630,13 +5631,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:

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-10 17:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01  0:00 [RFC 3/13][odr] Add lang field to struct dw_cu Tom de Vries

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).