public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Defer breakpoint reset when cloning progspace for fork child
Date: Sat, 07 Apr 2018 18:43:00 -0000	[thread overview]
Message-ID: <399a5e0a-ce06-ace9-913c-e71aa2f15fe4@redhat.com> (raw)
In-Reply-To: <790ab9233396d15d8227212fb3e33993@polymtl.ca>

On 04/07/2018 06:52 PM, Simon Marchi wrote:

>> This issue happens only with position-independent executables.  Adding
>> the main objfile for the new inferior (the fork child) causes GDB to try
>> to reset the breakpoints.  However, that new objfile has not been
>> relocated yet.  So the breakpoint on "break_here" resolves to an
>> unrelocated address, from which we are trying to read/write to set a
>> breakpoint.  Passing SYMFILE_DEFER_BP_RESET avoids that problem.  The
>> executable is relocated just after, in the follow_fork_inferior
>> function.
>>

>> The buildbot seems happy with this patch.  I don't think it's necessary
>> to add a new test.  Just changing this made many tests go from FAIL to
>> PASS on my machine, where gcc produces PIE executables by default.  If
>> anything, I think we would need to add a board file that produces
>> position-independent executables, so that we can run all the tests with
>> PIE, even on machines where that is not the default.
> 
> I pushed this patch.

Thanks for the fix.

I'm not sure I agree with no test, though.  I think a simple test
that tries both pie and not-pie would be useful, because
defaults vary depending on distro/system and they change over
time -- having a smoke test like the one described above covering both
pie and non-pie ensures no developer or testing environment where pie
might be relevant ever misses the problem in the future.

Thanks,
Pedro Alves

  reply	other threads:[~2018-04-07 18:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-30 19:01 Simon Marchi
2018-04-07 17:52 ` Simon Marchi
2018-04-07 18:43   ` Pedro Alves [this message]
2018-04-09 19:10     ` Simon Marchi
2018-04-09 19:21       ` Pedro Alves
2018-04-09 19:35         ` Simon Marchi

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=399a5e0a-ce06-ace9-913c-e71aa2f15fe4@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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).