This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR 21337 v2: segfault when re-reading symbols with remote debugging.


On 04/28/2017 06:44 PM, Doug Gilmore wrote:
...
      /* We use the same section offsets as from last time.  I'm not
         sure whether that is always correct for shared libraries.  */
      objfile->section_offsets = (struct section_offsets *)
        obstack_alloc (&objfile->objfile_obstack,
               SIZEOF_N_SECTION_OFFSETS (num_offsets));
      memcpy (objfile->section_offsets, offsets,
          SIZEOF_N_SECTION_OFFSETS (num_offsets));
      objfile->num_sections = num_offsets;

so it should not be the culprit...  The s variable itself should point to an instance of obj_section, contained in the objfile_pspace_info::sections array.  This one is allocated with XNEWVEC, so it shouldn't be affected by the fact that we clear the obstack.

The objfile object itself doesn't change address, so the pointers to it should still be valid...

I find the obj_section_addr and obj_section_offset very bad for readability and debuggability.  Could you change them for inline functions that are not one liners?  Then it will be obvious in the backtrace which operation causes the crash.

Thanks,

Simon
Hi Simon,

After thinking about it my comment and code placement wasn't
particularly good.  Something along the line's of Luis's change
is better.

Does Luis's comment address the question you have?

If so, Luis: Should is it OK we incorporate your changes in the patch?

Sure. I have no problems with that.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]