From patchwork Thu Oct 20 21:51:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 16710 Received: (qmail 24649 invoked by alias); 20 Oct 2016 21:51:39 -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 24525 invoked by uid 89); 20 Oct 2016 21:51:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=collected, sk:get_obj, H*RU:cmgw2, 4887 X-HELO: gproxy6-pub.mail.unifiedlayer.com Received: from gproxy6-pub.mail.unifiedlayer.com (HELO gproxy6-pub.mail.unifiedlayer.com) (67.222.39.168) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Thu, 20 Oct 2016 21:51:28 +0000 Received: (qmail 10835 invoked by uid 0); 20 Oct 2016 21:51:27 -0000 Received: from unknown (HELO cmgw2) (10.0.90.83) by gproxy6.mail.unifiedlayer.com with SMTP; 20 Oct 2016 21:51:27 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw2 with id xxrN1t00K2f2jeq01xrRV5; Thu, 20 Oct 2016 15:51:25 -0600 X-Authority-Analysis: v=2.1 cv=PIacp5aC c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=CH0kA5CcgfcA:10 a=zstS-IiYAAAA:8 a=g03Q1pYam-GpLBdVFAUA:9 a=FBtTI-GPZDipgzX7:21 a=5hFVyiF6U6Kyq2Tm:21 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 174-16-143-211.hlrn.qwest.net ([174.16.143.211]:35450 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_1) (envelope-from ) id 1bxLFD-0006xw-Tk; Thu, 20 Oct 2016 15:51:24 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 1/2] Change minimal_symbol_reader::record_full to take a bool Date: Thu, 20 Oct 2016 15:51:19 -0600 Message-Id: <1477000280-14921-2-git-send-email-tom@tromey.com> In-Reply-To: <1477000280-14921-1-git-send-email-tom@tromey.com> References: <1477000280-14921-1-git-send-email-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1bxLFD-0006xw-Tk X-Source-Sender: 174-16-143-211.hlrn.qwest.net (bapiya.Home) [174.16.143.211]:35450 X-Source-Auth: tom+tromey.com X-Email-Count: 11 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== This changes an "int" to a "bool" in the signature for minimal_symbol_reader::record_full, and then fixes the callers. 2016-10-20 Tom Tromey * minsyms.h (minimal_symbol_reader::record_full): "copy_name" now a bool. (record, record_with_info): Update. * minsyms.c (record): Fix indentation. (record_full): Fix indentation. Update for type change. * elfread.c (record_minimal_symbol): "copy_name" now a bool. (elf_symtab_read): "copy_names" now a bool. (elf_rel_plt_read, elf_read_minimal_symbols): Update. --- gdb/ChangeLog | 11 +++++++++++ gdb/elfread.c | 19 ++++++++++--------- gdb/minsyms.c | 9 ++++----- gdb/minsyms.h | 14 +++++++------- 4 files changed, 32 insertions(+), 21 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f3dd5d7..35df7f0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,16 @@ 2016-10-20 Tom Tromey + * minsyms.h (minimal_symbol_reader::record_full): "copy_name" now + a bool. + (record, record_with_info): Update. + * minsyms.c (record): Fix indentation. + (record_full): Fix indentation. Update for type change. + * elfread.c (record_minimal_symbol): "copy_name" now a bool. + (elf_symtab_read): "copy_names" now a bool. + (elf_rel_plt_read, elf_read_minimal_symbols): Update. + +2016-10-20 Tom Tromey + * main.c: Include . (cmdarg_s): Remove typedef. Don't define VEC. (captured_main_1): Use vector, not VEC. Remove cleanups. diff --git a/gdb/elfread.c b/gdb/elfread.c index 485e55d..f5aa55e 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -192,7 +192,7 @@ elf_locate_sections (bfd *ignore_abfd, asection *sectp, void *eip) static struct minimal_symbol * record_minimal_symbol (minimal_symbol_reader &reader, - const char *name, int name_len, int copy_name, + const char *name, int name_len, bool copy_name, CORE_ADDR address, enum minimal_symbol_type ms_type, asection *bfd_section, struct objfile *objfile) @@ -229,7 +229,7 @@ static void elf_symtab_read (minimal_symbol_reader &reader, struct objfile *objfile, int type, long number_of_symbols, asymbol **symbol_table, - int copy_names) + bool copy_names) { struct gdbarch *gdbarch = get_objfile_arch (objfile); asymbol *sym; @@ -488,7 +488,7 @@ elf_symtab_read (minimal_symbol_reader &reader, { int len = atsign - sym->name; - record_minimal_symbol (reader, sym->name, len, 1, symaddr, + record_minimal_symbol (reader, sym->name, len, true, symaddr, ms_type, sym->section, objfile); } } @@ -505,8 +505,8 @@ elf_symtab_read (minimal_symbol_reader &reader, { struct minimal_symbol *mtramp; - mtramp = record_minimal_symbol (reader, sym->name, len - 4, 1, - symaddr, + mtramp = record_minimal_symbol (reader, sym->name, len - 4, + true, symaddr, mst_solib_trampoline, sym->section, objfile); if (mtramp) @@ -612,7 +612,7 @@ elf_rel_plt_read (minimal_symbol_reader &reader, msym = record_minimal_symbol (reader, string_buffer, name_len + got_suffix_len, - 1, address, mst_slot_got_plt, got_plt, + true, address, mst_slot_got_plt, got_plt, objfile); if (msym) SET_MSYMBOL_SIZE (msym, ptr_size); @@ -1078,7 +1078,8 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags, bfd_get_filename (objfile->obfd), bfd_errmsg (bfd_get_error ())); - elf_symtab_read (reader, objfile, ST_REGULAR, symcount, symbol_table, 0); + elf_symtab_read (reader, objfile, ST_REGULAR, symcount, symbol_table, + false); } /* Add the dynamic symbols. */ @@ -1104,7 +1105,7 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags, bfd_errmsg (bfd_get_error ())); elf_symtab_read (reader, objfile, ST_DYNAMIC, dynsymcount, - dyn_symbol_table, 0); + dyn_symbol_table, false); elf_rel_plt_read (reader, objfile, dyn_symbol_table); } @@ -1140,7 +1141,7 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags, for (i = 0; i < synthcount; i++) synth_symbol_table[i] = synthsyms + i; elf_symtab_read (reader, objfile, ST_SYNTHETIC, synthcount, - synth_symbol_table.get (), 1); + synth_symbol_table.get (), true); } /* Install any minimal symbols that have been collected as the current diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 5f6db60..d804c95 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -943,7 +943,7 @@ minimal_symbol_reader::~minimal_symbol_reader () void minimal_symbol_reader::record (const char *name, CORE_ADDR address, - enum minimal_symbol_type ms_type) + enum minimal_symbol_type ms_type) { int section; @@ -974,10 +974,9 @@ minimal_symbol_reader::record (const char *name, CORE_ADDR address, struct minimal_symbol * minimal_symbol_reader::record_full (const char *name, int name_len, - int copy_name, - CORE_ADDR address, - enum minimal_symbol_type ms_type, - int section) + bool copy_name, CORE_ADDR address, + enum minimal_symbol_type ms_type, + int section) { struct msym_bunch *newobj; struct minimal_symbol *msymbol; diff --git a/gdb/minsyms.h b/gdb/minsyms.h index b22920b..06b3b4e 100644 --- a/gdb/minsyms.h +++ b/gdb/minsyms.h @@ -93,35 +93,35 @@ class minimal_symbol_reader ADDRESS - the address of the symbol MS_TYPE - the type of the symbol SECTION - the symbol's section - appropriate obj_section for the minimal symbol. This can be NULL. - OBJFILE - the objfile associated with the minimal symbol. */ + */ struct minimal_symbol *record_full (const char *name, int name_len, - int copy_name, + bool copy_name, CORE_ADDR address, enum minimal_symbol_type ms_type, int section); /* Like record_full, but: - uses strlen to compute NAME_LEN, - - passes COPY_NAME = 1, + - passes COPY_NAME = true, - and passes a default SECTION, depending on the type This variant does not return the new symbol. */ - void record (const char *, CORE_ADDR, enum minimal_symbol_type); + void record (const char *name, CORE_ADDR address, + enum minimal_symbol_type ms_type); /* Like record_full, but: - uses strlen to compute NAME_LEN, - - passes COPY_NAME = 1. */ + - passes COPY_NAME = true. */ struct minimal_symbol *record_with_info (const char *name, CORE_ADDR address, enum minimal_symbol_type ms_type, int section) { - return record_full (name, strlen (name), 1, address, ms_type, section); + return record_full (name, strlen (name), true, address, ms_type, section); } private: