From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31109 invoked by alias); 26 Jul 2013 19:10:26 -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 31099 invoked by uid 89); 26 Jul 2013 19:10:25 -0000 X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_50,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RDNS_NONE,TW_BJ autolearn=no version=3.3.1 Received: from Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 26 Jul 2013 19:10:24 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1V2nP5-0005Xz-VW from Luis_Gustavo@mentor.com ; Fri, 26 Jul 2013 12:10:16 -0700 Received: from NA1-MAIL.mgc.mentorg.com ([147.34.98.181]) by svr-orw-fem-01.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 26 Jul 2013 12:10:15 -0700 Received: from [172.30.2.5] ([172.30.2.5]) by NA1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 26 Jul 2013 12:10:14 -0700 Message-ID: <51F2C993.6090409@codesourcery.com> Date: Fri, 26 Jul 2013 19:10:00 -0000 From: Luis Machado Reply-To: lgustavo@codesourcery.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 MIME-Version: 1.0 To: Nicolas Blanc CC: gdb-patches@sourceware.org, dje@google.com Subject: Re: [PATCH v12 3/5] 'add-symbol-file' should update the current target sections. References: <1374078455-906-1-git-send-email-nicolas.blanc@intel.com> <1374078455-906-4-git-send-email-nicolas.blanc@intel.com> In-Reply-To: <1374078455-906-4-git-send-email-nicolas.blanc@intel.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2013-07/txt/msg00648.txt.bz2 Hi Nicolas, On 07/17/2013 01:27 PM, Nicolas Blanc wrote: > diff --git a/gdb/symfile.c b/gdb/symfile.c > index dbcccd3..96d9cdc 100644 > --- a/gdb/symfile.c > +++ b/gdb/symfile.c > @@ -57,6 +57,7 @@ > #include "stack.h" > #include "gdb_bfd.h" > #include "cli/cli-utils.h" > +#include "target.h" > > #include > #include > @@ -2158,6 +2159,51 @@ print_transfer_performance (struct ui_file *stream, > ui_out_text (uiout, ".\n"); > } > > +/* Add the sections of OBJFILE to the current set of target sections. */ > + > +static void > +add_target_sections_of_objfile (struct objfile *objfile) > +{ > + struct target_section_table *table = current_target_sections; > + struct obj_section *osect; > + int space; > + unsigned count = 0; > + struct target_section *ts; > + > + if (objfile == NULL) > + return; > + > + /* Compute the number of sections to add. */ > + ALL_OBJFILE_OSECTIONS (objfile, osect) > + { > + if (bfd_get_section_size (osect->the_bfd_section) == 0) > + continue; > + count++; > + } > + > + if (count == 0) > + return; > + > + space = resize_section_table (table, count); > + > + ts = table->sections + space; > + > + ALL_OBJFILE_OSECTIONS (objfile, osect) > + { > + if (bfd_get_section_size (osect->the_bfd_section) == 0) > + continue; > + > + gdb_assert (ts < table->sections + space + count); > + > + ts->addr = obj_section_addr (osect); > + ts->endaddr = obj_section_endaddr (osect); > + ts->the_bfd_section = osect->the_bfd_section; > + ts->key = (void *) objfile; > + > + ts++; > + } > +} > + This hunk needs to be updated because of this change: 2013-07-22 Doug Evans * exec.h (remove_target_sections): Delete arg abfd. * exec.c (exec_close): Update call to remove_target_sections. (remove_target_sections): Delete arg abfd. * solib.c (update_solib_list): Ditto. (reload_shared_libraries_1): Ditto. (clear_solib): Ditto, and unconditionally call remove_target_sections. * target.h (struct target_section): Rename key to owner. All uses updated. ts->key should be ts->owner now. > /* This function allows the addition of incrementally linked object files. > It does not modify any state in the target, only in the debugger. */ > /* Note: ezannoni 2000-04-13 This function/command used to have a > @@ -2181,6 +2227,7 @@ add_symbol_file_command (char *args, int from_tty) > int expecting_sec_name = 0; > int expecting_sec_addr = 0; > char **argv; > + struct objfile *objf; > > struct sect_opt > { > @@ -2316,8 +2363,10 @@ add_symbol_file_command (char *args, int from_tty) > if (from_tty && (!query ("%s", ""))) > error (_("Not confirmed.")); > > - symbol_file_add (filename, from_tty ? SYMFILE_VERBOSE : 0, > - section_addrs, flags); > + objf = symbol_file_add (filename, from_tty ? SYMFILE_VERBOSE : 0, > + section_addrs, flags); > + > + add_target_sections_of_objfile (objf); > > /* Getting new symbols may change our opinion about what is > frameless. */ > @@ -3792,11 +3841,26 @@ symfile_find_segment_sections (struct objfile *objfile) > free_symfile_segment_data (data); > } > > +/* Listen for free_objfile events. */ > + > +static void > +symfile_free_objfile (struct objfile *objfile) > +{ > + if (objfile == NULL) > + return; > + > + /* Remove the target sections of user-added objfiles. */ > + if (objfile->flags & OBJF_USERLOADED && objfile->obfd) > + remove_target_sections ((void*)objfile, objfile->obfd); > +} > + This hunk as well. The same change removed the second parameter of remove_target_sections. With those changes i can build it cleanly. Luis