public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Doug Gilmore <Doug.Gilmore@imgtec.com>
Cc: Luis Machado <lgustavo@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix PR 21337 v2: segfault when re-reading symbols with  remote debugging.
Date: Sat, 29 Apr 2017 23:26:00 -0000	[thread overview]
Message-ID: <e1620878165275e22429dbb746d40932@polymtl.ca> (raw)
In-Reply-To: <f6d52471-afdf-575f-488a-5ca9c2cb1158@imgtec.com>

On 2017-04-29 13:12, Doug Gilmore wrote:
> On 04/28/17 18:41, Simon Marchi wrote:
>> On 2017-04-28 19:44, Doug Gilmore wrote:
>>> 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?
>>> 
>>> I attached a diff for the change.
>>> 
>>> Thanks,
>>> 
>>> Doug
>> 
>> Hi Doug,
>> 
>> The comment certainly helps, but in the commit log I'd like to see a
>> more detailed list of events that leads to the crash.
>> 
>> Now that I look into it again, I think I understand.  The
>> objfile_pspace_info::sections array/vector is a list of obj_section
>> pointers (in C++ we'd probably use an std::vector<obj_section*>).
>> That list contains pointers to all the sections from all the
>> objfiles sorted in order of increasing address.  They point directly
>> to the sections allocated by the objfile in their obstacks (and
>> accessible through objfile::sections).  So when the obstack is freed
>> in reread_symbols, the sorted list contains stale pointers.  Is that
>> it?
> Right.
>> 
>> If that's what's happening, then I'm more convinced the fix is
>> right.  Is this behaviour caught by a test?  If not, could you write
>> one?
>> ...
> I'll need to take a look.  Last time I tried I it was more difficult
> to expose the problem on the native build of GDB.

reread_symbols is called when using the run (run_command_1), attach 
(attach_post_wait which then calls setup_inferior) and load 
(load_command) commands.  So maybe something like this would reproduce 
it?

- compile test program
- launch gdb with test program
- touch test program
- run

Simon

  reply	other threads:[~2017-04-29 23:26 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 23:04 [PATCH] [mips] Fix PR 21337 v1: " Doug Gilmore
2017-04-10 16:01 ` Doug Gilmore
2017-04-12 18:52 ` Luis Machado
2017-04-12 21:42   ` Doug Gilmore
2017-04-13 18:56     ` [PATCH] Fix PR 21337 v2: " Doug Gilmore
2017-04-14 15:33       ` Luis Machado
2017-04-22  2:15       ` Simon Marchi
2017-04-25 18:16         ` Doug Gilmore
2017-04-27 19:46           ` Simon Marchi
2017-04-28 23:44             ` Doug Gilmore
2017-04-29  1:13               ` Luis Machado
2017-04-29  1:42               ` Simon Marchi
2017-04-29 17:12                 ` Doug Gilmore
2017-04-29 23:26                   ` Simon Marchi [this message]
2017-04-30  5:14                     ` Doug Gilmore
2017-05-10 23:26                       ` Doug Gilmore
2017-05-12  3:29                         ` Simon Marchi
2017-05-12 19:24                           ` Doug Gilmore
2017-05-16 23:11                           ` [PATCH] Fix PR 21337 (v3): " Doug Gilmore
2017-06-06 16:08                             ` [PING][PATCH] " Doug Gilmore
2017-06-23 18:20                               ` [PING^2][PATCH] " Doug Gilmore
2017-06-25 11:25                             ` [PATCH] " Simon Marchi
2017-06-27 17:29                               ` [PATCH] Fix PR 21337 (v4): " Doug Gilmore
2017-06-27 21:35                                 ` Doug Gilmore
2017-06-28  2:01                                   ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e1620878165275e22429dbb746d40932@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=Doug.Gilmore@imgtec.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).