From patchwork Sun Feb 12 20:22:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 19229 Received: (qmail 38952 invoked by alias); 12 Feb 2017 20:23:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 38931 invoked by uid 89); 12 Feb 2017 20:22:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=abfd, ulongest, ULONGEST, dwarf2_cu X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 12 Feb 2017 20:22:56 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D0ECCC056800; Sun, 12 Feb 2017 20:22:56 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-221.ams2.redhat.com [10.36.116.221]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1CKMtr4006104; Sun, 12 Feb 2017 15:22:55 -0500 Subject: [PATCH 1/8] Rename read_unsigned_leb128 to gdb_read_unsigned_leb128 From: Jan Kratochvil To: gdb-patches@sourceware.org Cc: Victor Leschuk Date: Sun, 12 Feb 2017 21:22:54 +0100 Message-ID: <148693097396.9024.2288256732840761882.stgit@host1.jankratochvil.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-IsSubscribed: yes Hi, read_unsigned_leb128 needs to be used outside of dwarf2read.c, removing its static qualifier. But then it would clash with bfd/libbfd.c read_unsigned_leb128 global function of the same name. Jan gdb/ChangeLog 2017-01-20 Jan Kratochvil * dwarf2read.c (read_unsigned_leb128): Rename to ... (gdb_read_unsigned_leb128): ... here, update all cases. --- gdb/dwarf2read.c | 103 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 54 insertions(+), 49 deletions(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 774ed73..bf381a7 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -1509,7 +1509,8 @@ static const char *read_indirect_string (bfd *, const gdb_byte *, static const char *read_indirect_string_from_dwz (struct dwz_file *, LONGEST); -static ULONGEST read_unsigned_leb128 (bfd *, const gdb_byte *, unsigned int *); +static ULONGEST gdb_read_unsigned_leb128 (bfd *, const gdb_byte *, + unsigned int *); static LONGEST read_signed_leb128 (bfd *, const gdb_byte *, unsigned int *); @@ -7195,7 +7196,7 @@ peek_abbrev_code (bfd *abfd, const gdb_byte *info_ptr) { unsigned int bytes_read; - return read_unsigned_leb128 (abfd, info_ptr, &bytes_read); + return gdb_read_unsigned_leb128 (abfd, info_ptr, &bytes_read); } /* Read the initial uleb128 in the die at INFO_PTR in compilation unit CU. @@ -7211,7 +7212,7 @@ peek_die_abbrev (const gdb_byte *info_ptr, unsigned int *bytes_read, unsigned int abbrev_number; struct abbrev_info *abbrev; - abbrev_number = read_unsigned_leb128 (abfd, info_ptr, bytes_read); + abbrev_number = gdb_read_unsigned_leb128 (abfd, info_ptr, bytes_read); if (abbrev_number == 0) return NULL; @@ -7341,7 +7342,7 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr, break; case DW_FORM_exprloc: case DW_FORM_block: - info_ptr += read_unsigned_leb128 (abfd, info_ptr, &bytes_read); + info_ptr += gdb_read_unsigned_leb128 (abfd, info_ptr, &bytes_read); info_ptr += bytes_read; break; case DW_FORM_block1: @@ -7361,7 +7362,7 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr, info_ptr = safe_skip_leb128 (info_ptr, buffer_end); break; case DW_FORM_indirect: - form = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); + form = gdb_read_unsigned_leb128 (abfd, info_ptr, &bytes_read); info_ptr += bytes_read; /* We need to continue parsing from here, so just go back to the top. */ @@ -15212,7 +15213,7 @@ read_full_die_1 (const struct die_reader_specs *reader, bfd *abfd = reader->abfd; offset.sect_off = info_ptr - reader->buffer; - abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); + abbrev_number = gdb_read_unsigned_leb128 (abfd, info_ptr, &bytes_read); info_ptr += bytes_read; if (!abbrev_number) { @@ -15356,7 +15357,7 @@ abbrev_table_read_table (struct dwarf2_section_info *section, dwarf2_read_section (objfile, section); abbrev_ptr = section->buffer + offset.sect_off; - abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); + abbrev_number = gdb_read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); abbrev_ptr += bytes_read; allocated_attrs = ATTR_ALLOC_CHUNK; @@ -15369,16 +15370,17 @@ abbrev_table_read_table (struct dwarf2_section_info *section, /* read in abbrev header */ cur_abbrev->number = abbrev_number; - cur_abbrev->tag - = (enum dwarf_tag) read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); + cur_abbrev->tag = (enum dwarf_tag) gdb_read_unsigned_leb128 (abfd, + abbrev_ptr, + &bytes_read); abbrev_ptr += bytes_read; cur_abbrev->has_children = read_1_byte (abfd, abbrev_ptr); abbrev_ptr += 1; /* now read in declarations */ - abbrev_name = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); + abbrev_name = gdb_read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); abbrev_ptr += bytes_read; - abbrev_form = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); + abbrev_form = gdb_read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); abbrev_ptr += bytes_read; while (abbrev_name) { @@ -15393,9 +15395,9 @@ abbrev_table_read_table (struct dwarf2_section_info *section, = (enum dwarf_attribute) abbrev_name; cur_attrs[cur_abbrev->num_attrs++].form = (enum dwarf_form) abbrev_form; - abbrev_name = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); + abbrev_name = gdb_read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); abbrev_ptr += bytes_read; - abbrev_form = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); + abbrev_form = gdb_read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); abbrev_ptr += bytes_read; } @@ -15416,7 +15418,7 @@ abbrev_table_read_table (struct dwarf2_section_info *section, table is reached. */ if ((unsigned int) (abbrev_ptr - section->buffer) >= section->size) break; - abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); + abbrev_number = gdb_read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); abbrev_ptr += bytes_read; if (abbrev_table_lookup_abbrev (abbrev_table, abbrev_number) != NULL) break; @@ -16321,7 +16323,7 @@ read_attribute_value (const struct die_reader_specs *reader, case DW_FORM_exprloc: case DW_FORM_block: blk = dwarf_alloc_block (cu); - blk->size = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); + blk->size = gdb_read_unsigned_leb128 (abfd, info_ptr, &bytes_read); info_ptr += bytes_read; blk->data = read_n_bytes (abfd, info_ptr, blk->size); info_ptr += blk->size; @@ -16351,7 +16353,7 @@ read_attribute_value (const struct die_reader_specs *reader, info_ptr += bytes_read; break; case DW_FORM_udata: - DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); + DW_UNSND (attr) = gdb_read_unsigned_leb128 (abfd, info_ptr, &bytes_read); info_ptr += bytes_read; break; case DW_FORM_ref1: @@ -16380,11 +16382,12 @@ read_attribute_value (const struct die_reader_specs *reader, break; case DW_FORM_ref_udata: DW_UNSND (attr) = (cu->header.offset.sect_off - + read_unsigned_leb128 (abfd, info_ptr, &bytes_read)); + + gdb_read_unsigned_leb128 (abfd, info_ptr, + &bytes_read)); info_ptr += bytes_read; break; case DW_FORM_indirect: - form = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); + form = gdb_read_unsigned_leb128 (abfd, info_ptr, &bytes_read); info_ptr += bytes_read; info_ptr = read_attribute_value (reader, attr, form, info_ptr); break; @@ -16411,7 +16414,7 @@ read_attribute_value (const struct die_reader_specs *reader, } { ULONGEST str_index = - read_unsigned_leb128 (abfd, info_ptr, &bytes_read); + gdb_read_unsigned_leb128 (abfd, info_ptr, &bytes_read); DW_STRING (attr) = read_str_index (reader, str_index); DW_STRING_IS_CANONICAL (attr) = 0; @@ -16761,8 +16764,8 @@ read_indirect_string (bfd *abfd, const gdb_byte *buf, } static ULONGEST -read_unsigned_leb128 (bfd *abfd, const gdb_byte *buf, - unsigned int *bytes_read_ptr) +gdb_read_unsigned_leb128 (bfd *abfd, const gdb_byte *buf, + unsigned int *bytes_read_ptr) { ULONGEST result; unsigned int num_read; @@ -16859,7 +16862,8 @@ read_addr_index_from_leb128 (struct dwarf2_cu *cu, const gdb_byte *info_ptr, unsigned int *bytes_read) { bfd *abfd = cu->objfile->obfd; - unsigned int addr_index = read_unsigned_leb128 (abfd, info_ptr, bytes_read); + unsigned int addr_index = gdb_read_unsigned_leb128 (abfd, info_ptr, + bytes_read); return read_addr_index (cu, addr_index); } @@ -17428,11 +17432,11 @@ dwarf_decode_line_header (unsigned int offset, struct dwarf2_cu *cu) unsigned int dir_index, mod_time, length; line_ptr += bytes_read; - dir_index = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); + dir_index = gdb_read_unsigned_leb128 (abfd, line_ptr, &bytes_read); line_ptr += bytes_read; - mod_time = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); + mod_time = gdb_read_unsigned_leb128 (abfd, line_ptr, &bytes_read); line_ptr += bytes_read; - length = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); + length = gdb_read_unsigned_leb128 (abfd, line_ptr, &bytes_read); line_ptr += bytes_read; add_file_name (lh, cur_file, dir_index, mod_time, length); @@ -17893,7 +17897,7 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu, else switch (op_code) { case DW_LNS_extended_op: - extended_len = read_unsigned_leb128 (abfd, line_ptr, + extended_len = gdb_read_unsigned_leb128 (abfd, line_ptr, &bytes_read); line_ptr += bytes_read; extended_end = line_ptr + extended_len; @@ -17928,13 +17932,13 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu, &bytes_read); line_ptr += bytes_read; dir_index = - read_unsigned_leb128 (abfd, line_ptr, &bytes_read); + gdb_read_unsigned_leb128 (abfd, line_ptr, &bytes_read); line_ptr += bytes_read; mod_time = - read_unsigned_leb128 (abfd, line_ptr, &bytes_read); + gdb_read_unsigned_leb128 (abfd, line_ptr, &bytes_read); line_ptr += bytes_read; length = - read_unsigned_leb128 (abfd, line_ptr, &bytes_read); + gdb_read_unsigned_leb128 (abfd, line_ptr, &bytes_read); line_ptr += bytes_read; add_file_name (lh, cur_file, dir_index, mod_time, length); } @@ -17946,7 +17950,7 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu, (non-prologue) line we want to coalesce them. PR 17276. */ state_machine.discriminator - = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); + = gdb_read_unsigned_leb128 (abfd, line_ptr, &bytes_read); state_machine.line_has_non_zero_discriminator |= state_machine.discriminator != 0; line_ptr += bytes_read; @@ -17973,7 +17977,7 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu, case DW_LNS_advance_pc: { CORE_ADDR adjust - = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); + = gdb_read_unsigned_leb128 (abfd, line_ptr, &bytes_read); CORE_ADDR addr_adj; addr_adj = (((state_machine.op_index + adjust) @@ -18006,7 +18010,7 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu, struct file_entry *fe; const char *dir = NULL; - state_machine.file = read_unsigned_leb128 (abfd, line_ptr, + state_machine.file = gdb_read_unsigned_leb128 (abfd, line_ptr, &bytes_read); line_ptr += bytes_read; if (state_machine.file == 0 @@ -18028,7 +18032,7 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu, } break; case DW_LNS_set_column: - (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read); + (void) gdb_read_unsigned_leb128 (abfd, line_ptr, &bytes_read); line_ptr += bytes_read; break; case DW_LNS_negate_stmt: @@ -18073,7 +18077,8 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu, for (i = 0; i < lh->standard_opcode_lengths[op_code]; i++) { - (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read); + (void) gdb_read_unsigned_leb128 (abfd, line_ptr, + &bytes_read); line_ptr += bytes_read; } } @@ -20644,7 +20649,7 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu) break; case DW_OP_regx: - unsnd = read_unsigned_leb128 (NULL, (data + i), &bytes_read); + unsnd = gdb_read_unsigned_leb128 (NULL, (data + i), &bytes_read); i += bytes_read; stack[++stacki] = unsnd; if (i < size) @@ -20693,7 +20698,7 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu) break; case DW_OP_constu: - stack[++stacki] = read_unsigned_leb128 (NULL, (data + i), + stack[++stacki] = gdb_read_unsigned_leb128 (NULL, (data + i), &bytes_read); i += bytes_read; break; @@ -20714,7 +20719,7 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu) break; case DW_OP_plus_uconst: - stack[stacki] += read_unsigned_leb128 (NULL, (data + i), + stack[stacki] += gdb_read_unsigned_leb128 (NULL, (data + i), &bytes_read); i += bytes_read; break; @@ -21118,7 +21123,7 @@ skip_form_bytes (bfd *abfd, const gdb_byte *bytes, const gdb_byte *buffer_end, break; case DW_FORM_block: - bytes += read_unsigned_leb128 (abfd, bytes, &bytes_read); + bytes += gdb_read_unsigned_leb128 (abfd, bytes, &bytes_read); bytes += bytes_read; break; @@ -21182,7 +21187,7 @@ skip_unknown_opcode (unsigned int opcode, } defn = opcode_definitions[opcode]; - arg = read_unsigned_leb128 (abfd, defn, &bytes_read); + arg = gdb_read_unsigned_leb128 (abfd, defn, &bytes_read); defn += bytes_read; for (i = 0; i < arg; ++i) @@ -21251,7 +21256,7 @@ dwarf_parse_macro_header (const gdb_byte **opcode_definitions, opcode = read_1_byte (abfd, mac_ptr); ++mac_ptr; opcode_definitions[opcode] = mac_ptr; - arg = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); + arg = gdb_read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read; mac_ptr += arg; } @@ -21329,7 +21334,7 @@ dwarf_decode_macro_bytes (bfd *abfd, const char *body; int is_define; - line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); + line = gdb_read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read; if (macinfo_type == DW_MACRO_GNU_define @@ -21395,9 +21400,9 @@ dwarf_decode_macro_bytes (bfd *abfd, unsigned int bytes_read; int line, file; - line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); + line = gdb_read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read; - file = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); + file = gdb_read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read; if ((line == 0 && !at_commandline) @@ -21516,7 +21521,7 @@ dwarf_decode_macro_bytes (bfd *abfd, /* This reads the constant, but since we don't recognize any vendor extensions, we ignore it. */ - read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); + gdb_read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read; read_direct_string (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read; @@ -21640,7 +21645,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset, { unsigned int bytes_read; - read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); + gdb_read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read; read_direct_string (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read; @@ -21652,9 +21657,9 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset, unsigned int bytes_read; int line, file; - line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); + line = gdb_read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read; - file = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); + file = gdb_read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read; current_file = macro_start_file (file, line, current_file, lh); @@ -21672,7 +21677,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset, { unsigned int bytes_read; - read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); + gdb_read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read; mac_ptr += offset_size; } @@ -21692,7 +21697,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset, { unsigned int bytes_read; - read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); + gdb_read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read; read_direct_string (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read;