From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13768 invoked by alias); 6 May 2013 20:30:02 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 13759 invoked by uid 89); 6 May 2013 20:30:02 -0000 X-Spam-SWARE-Status: No, score=-4.4 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD,SPF_PASS,TW_BJ,TW_CP,TW_FN autolearn=ham version=3.3.1 Received: from mail-vb0-f73.google.com (HELO mail-vb0-f73.google.com) (209.85.212.73) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 06 May 2013 20:30:00 +0000 Received: by mail-vb0-f73.google.com with SMTP id e13so424747vbg.0 for ; Mon, 06 May 2013 13:29:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:mime-version:content-type:content-transfer-encoding :message-id:date:to:cc:subject:in-reply-to:references:x-mailer :x-gm-message-state; bh=h6b+aZBKxp1suG7MdeEl6xJmQJc6bsOZNgl+ODUl7hI=; b=F1OhAvBy+9WX2NALXR+J2tdoALOYKLxnq6jusF+Bf+bcrymgLCvk082ZuvHO5qy/EQ 7eZ/0XYTWP/RUEMIlkdta5u2Tn5Z2Gj73O8MgAzQC7iuy9B0BTKfnKooTZzrrqqY3uDb 2jMv3yrmg/i/KeOwHPA/bSKdrzQKBWxZ1aZhZ6JgD4Q1zML1Ka2mglX77q5Msr8dH0tR ZHaAhvzAWuqan+wm6HPsRfBcBl7GhYOMo1QY99KhZ6M3pOTQcECOTjCN1CKHwemtjRhp hH3rqUkrP9esgtZbS8fWgqp2RVMjtFnQGJ0zfBxZgNkyNTFrVg7mNN4cxK4Yu/LXmhDd anHQ== X-Received: by 10.236.93.116 with SMTP id k80mr16661241yhf.32.1367872198950; Mon, 06 May 2013 13:29:58 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id n78si2571143yhh.1.2013.05.06.13.29.58 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Mon, 06 May 2013 13:29:58 -0700 (PDT) Received: from ruffy2.mtv.corp.google.com (ruffy2.mtv.corp.google.com [172.17.128.107]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 6C55A5A4174; Mon, 6 May 2013 13:29:58 -0700 (PDT) From: Doug Evans MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <20872.4805.825949.93170@ruffy2.mtv.corp.google.com> Date: Mon, 06 May 2013 20:30:00 -0000 To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [patch] Delete offsets, num_offsets args to syms_from_objfile In-Reply-To: <871u9jyipu.fsf@fleche.redhat.com> References: <871u9jyipu.fsf@fleche.redhat.com> X-Gm-Message-State: ALoCoQlnppdn0AA+winJMp499Y2atRhjW1kA5YqsAQuqPGp0XlLXiaPyaad67DYzD2rsYKVMUu8N1DlzoruYxVhPY1WSH7zE5aAXMBD63sVyEByqDid2i2RbqTYim5EB3yap0S6R0aB3oIuQMOd8hGp48ymb3SYVqM03yQm68o20SZ/wknev0ppap7if0qMyB+tHCuVT1oqwCYqtga7/rKT7hGAprxVWww== X-SW-Source: 2013-05/txt/msg00149.txt.bz2 Tom Tromey writes: > >>>>> "Doug" == Doug Evans writes: > > Doug> 2013-05-06 Doug Evans > Doug> * symfile.c (syms_from_objfile_1): Delete args offsets, num_offsets. > Doug> All callers updated. > Doug> (syms_from_objfile): Ditto. Make static. > Doug> (symbol_file_add_with_addrs_or_offsets): Delete args offsets, > Doug> num_offsets. All callers updated. > Doug> * symfile.h (syms_from_objfile): Delete. > > After this patch, symbol_file_add_with_addrs_or_offsets is misnamed. > It no longer accepts 'offsets'. Heh, righto. 2013-05-06 Doug Evans * symfile.c (syms_from_objfile_1): Delete args offsets, num_offsets. All callers updated. (syms_from_objfile): Ditto. Make static. (symbol_file_add_with_addrs): Renamed from symbol_file_add_with_addrs_or_offsets. Delete args offsets, num_offsets. All callers updated. * symfile.h (syms_from_objfile): Delete. Index: symfile.c =================================================================== RCS file: /cvs/src/src/gdb/symfile.c,v retrieving revision 1.374 diff -u -p -r1.374 symfile.c --- symfile.c 6 May 2013 19:15:17 -0000 1.374 +++ symfile.c 6 May 2013 20:21:45 -0000 @@ -913,17 +913,6 @@ init_entry_point_info (struct objfile *o into an offset from the section VMA's as it appears in the object file, and then call the file's sym_offsets function to convert this into a format-specific offset table --- a `struct section_offsets'. - If ADDRS is non-zero, OFFSETS must be zero. - - OFFSETS is a table of section offsets already in the right - format-specific representation. NUM_OFFSETS is the number of - elements present in OFFSETS->offsets. If OFFSETS is non-zero, we - assume this is the proper table the call to sym_offsets described - above would produce. Instead of calling sym_offsets, we just dump - it right into objfile->section_offsets. (When we're re-reading - symbols from an objfile, we don't have the original load address - list any more; all we have is the section offset table.) If - OFFSETS is non-zero, ADDRS must be zero. ADD_FLAGS encodes verbosity level, whether this is main symbol or an extra symbol file such as dynamically loaded code, and wether @@ -932,16 +921,12 @@ init_entry_point_info (struct objfile *o static void syms_from_objfile_1 (struct objfile *objfile, struct section_addr_info *addrs, - const struct section_offsets *offsets, - int num_offsets, int add_flags) { struct section_addr_info *local_addr = NULL; struct cleanup *old_chain; const int mainline = add_flags & SYMFILE_MAINLINE; - gdb_assert (! (addrs && offsets)); - objfile->sf = find_sym_fns (objfile->obfd); if (objfile->sf == NULL) @@ -962,18 +947,16 @@ syms_from_objfile_1 (struct objfile *obj if an error occurs during symbol reading. */ old_chain = make_cleanup_free_objfile (objfile); - /* If ADDRS and OFFSETS are both NULL, put together a dummy address - list. We now establish the convention that an addr of zero means + /* If ADDRS is NULL, put together a dummy address list. + We now establish the convention that an addr of zero means no load address was specified. */ - if (! addrs && ! offsets) + if (! addrs) { local_addr = alloc_section_addr_info (1); make_cleanup (xfree, local_addr); addrs = local_addr; } - /* Now either addrs or offsets is non-zero. */ - if (mainline) { /* We will modify the main symbol table, make sure that all its users @@ -1002,7 +985,7 @@ syms_from_objfile_1 (struct objfile *obj We no longer warn if the lowest section is not a text segment (as happens for the PA64 port. */ - if (addrs && addrs->num_sections > 0) + if (addrs->num_sections > 0) addr_info_make_relative (addrs, objfile->obfd); /* Initialize symbol reading routines for this objfile, allow complaints to @@ -1012,21 +995,7 @@ syms_from_objfile_1 (struct objfile *obj (*objfile->sf->sym_init) (objfile); clear_complaints (&symfile_complaints, 1, add_flags & SYMFILE_VERBOSE); - if (addrs) - (*objfile->sf->sym_offsets) (objfile, addrs); - else - { - size_t size = SIZEOF_N_SECTION_OFFSETS (num_offsets); - - /* Just copy in the offset table directly as given to us. */ - objfile->num_sections = num_offsets; - objfile->section_offsets - = ((struct section_offsets *) - obstack_alloc (&objfile->objfile_obstack, size)); - memcpy (objfile->section_offsets, offsets, size); - - init_objfile_sect_indices (objfile); - } + (*objfile->sf->sym_offsets) (objfile, addrs); read_symbols (objfile, add_flags); @@ -1039,14 +1008,12 @@ syms_from_objfile_1 (struct objfile *obj /* Same as syms_from_objfile_1, but also initializes the objfile entry-point info. */ -void +static void syms_from_objfile (struct objfile *objfile, struct section_addr_info *addrs, - const struct section_offsets *offsets, - int num_offsets, int add_flags) { - syms_from_objfile_1 (objfile, addrs, offsets, num_offsets, add_flags); + syms_from_objfile_1 (objfile, addrs, add_flags); init_entry_point_info (objfile); } @@ -1085,8 +1052,7 @@ new_symfile_objfile (struct objfile *obj ADD_FLAGS encodes verbosity, whether this is main symbol file or extra, such as dynamically loaded code, and what to do with breakpoins. - ADDRS, OFFSETS, and NUM_OFFSETS are as described for - syms_from_objfile, above. + ADDRS is as described for syms_from_objfile_1, above. ADDRS is ignored when SYMFILE_MAINLINE bit is set in ADD_FLAGS. PARENT is the original objfile if ABFD is a separate debug info file. @@ -1096,12 +1062,9 @@ new_symfile_objfile (struct objfile *obj Upon failure, jumps back to command level (never returns). */ static struct objfile * -symbol_file_add_with_addrs_or_offsets (bfd *abfd, - int add_flags, - struct section_addr_info *addrs, - const struct section_offsets *offsets, - int num_offsets, - int flags, struct objfile *parent) +symbol_file_add_with_addrs (bfd *abfd, int add_flags, + struct section_addr_info *addrs, + int flags, struct objfile *parent) { struct objfile *objfile; const char *name = bfd_get_filename (abfd); @@ -1145,8 +1108,7 @@ symbol_file_add_with_addrs_or_offsets (b gdb_flush (gdb_stdout); } } - syms_from_objfile (objfile, addrs, offsets, num_offsets, - add_flags); + syms_from_objfile (objfile, addrs, add_flags); /* We now have at least a partial symbol table. Check to see if the user requested that all symbols be read on initial access via either @@ -1215,9 +1177,8 @@ symbol_file_add_separate (bfd *bfd, int sap = build_section_addr_info_from_objfile (objfile); my_cleanup = make_cleanup_free_section_addr_info (sap); - new_objfile = symbol_file_add_with_addrs_or_offsets - (bfd, symfile_flags, - sap, NULL, 0, + new_objfile = symbol_file_add_with_addrs + (bfd, symfile_flags, sap, objfile->flags & (OBJF_REORDERED | OBJF_SHARED | OBJF_READNOW | OBJF_USERLOADED), objfile); @@ -1228,21 +1189,18 @@ symbol_file_add_separate (bfd *bfd, int /* Process the symbol file ABFD, as either the main file or as a dynamically loaded file. - See symbol_file_add_with_addrs_or_offsets's comments for - details. */ + See symbol_file_add_with_addrs's comments for details. */ struct objfile * symbol_file_add_from_bfd (bfd *abfd, int add_flags, struct section_addr_info *addrs, int flags, struct objfile *parent) { - return symbol_file_add_with_addrs_or_offsets (abfd, add_flags, addrs, 0, 0, - flags, parent); + return symbol_file_add_with_addrs (abfd, add_flags, addrs, flags, parent); } /* Process a symbol file, as either the main file or as a dynamically - loaded file. See symbol_file_add_with_addrs_or_offsets's comments - for details. */ + loaded file. See symbol_file_add_with_addrs's comments for details. */ struct objfile * symbol_file_add (char *name, int add_flags, struct section_addr_info *addrs, int flags) Index: symfile.h =================================================================== RCS file: /cvs/src/src/gdb/symfile.h,v retrieving revision 1.126 diff -u -p -r1.126 symfile.h --- symfile.h 6 May 2013 19:15:17 -0000 1.126 +++ symfile.h 6 May 2013 20:21:45 -0000 @@ -453,7 +453,7 @@ extern struct symtab *allocate_symtab (c extern void add_symtab_fns (const struct sym_fns *); /* This enum encodes bit-flags passed as ADD_FLAGS parameter to - syms_from_objfile, symbol_file_add, etc. */ + symbol_file_add, etc. */ enum symfile_add_flags { @@ -472,10 +472,6 @@ enum symfile_add_flags SYMFILE_NO_READ = 1 << 4 }; -extern void syms_from_objfile (struct objfile *, - struct section_addr_info *, - const struct section_offsets *, int, int); - extern void new_symfile_objfile (struct objfile *, int); extern struct objfile *symbol_file_add (char *, int,