From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16627 invoked by alias); 6 Jan 2020 16:07:04 -0000 Mailing-List: contact dwz-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: dwz-owner@sourceware.org Received: (qmail 16571 invoked by uid 89); 6 Jan 2020 16:07:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy= X-Spam-Status: No, score=-25.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mx2.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Date: Wed, 01 Jan 2020 00:00:00 -0000 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com Subject: [committed 3/13][odr] Add lang field to struct dw_cu Message-ID: <20200106160658.GA19858@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2020-q1/txt/msg00003.txt 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 * 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: