[mips] Fix PR 21337 v1: segfault when re-reading symbols with remote debugging.
Commit Message
This is a fix to a problem that was introduced with commit g3e29f34.
OK to apply?
Doug
Comments
On 03/31/2017 04:04 PM, Doug Gilmore wrote:
> This is a fix to a problem that was introduced with commit g3e29f34.
>
> OK to apply?
>
> Doug
>
Could a global maintainer review the patch attached to:
https://www.sourceware.org/ml/gdb-patches/2017-03/msg00559.html
when they have the chance? Note that patch involves changing code
that is not MIPS specific.
Thanks,
Doug
On 03/31/2017 06:04 PM, Doug Gilmore wrote:
> This is a fix to a problem that was introduced with commit g3e29f34.
>
Which commit is that? I couldn't find it in the git tree.
Incidentally, i have a local patch that does pretty much the same thing,
but a little further down compared to yours. It notifies gdb of objfile
changes right before the call to read_symbols (...).
But my patch doesn't remove the original call to objfiles_changed (...).
What is the rationale behind that change?
> diff --git a/gdb/symfile.c b/gdb/symfile.c
> index 8b79508..290b18b 100644
> --- a/gdb/symfile.c
> +++ b/gdb/symfile.c
> @@ -2592,6 +2592,12 @@ reread_symbols (void)
> /* Free the obstacks for non-reusable objfiles. */
> psymbol_bcache_free (objfile->psymbol_cache);
> objfile->psymbol_cache = psymbol_bcache_init ();
> +
> + /* Notify objfiles that we've modified objfile sections, which now
> + needs to be done early to ensure that, for the MIPS target,
> + find_pc_section won't access stale data. PR 21337. */
I think the PR number is not needed. After all the bug will be gone with
this fix.
On 04/12/2017 11:52 AM, Luis Machado wrote:
> On 03/31/2017 06:04 PM, Doug Gilmore wrote:
>> This is a fix to a problem that was introduced with commit g3e29f34.
>>
>
> Which commit is that? I couldn't find it in the git tree.
$ git log -n 1 3e29f34 | head
commit 3e29f34a4eef29f5b159749ccb1efb8867b2e651
Author: Maciej W. Rozycki <macro@codesourcery.com>
Date: Fri Dec 12 13:31:53 2014 +0000
MIPS: Keep the ISA bit in compressed code addresses
1. Background information
The MIPS architecture, as originally designed and implemented in
mid-1980s has a uniform instruction word size that is 4 bytes, naturally
$
>
> Incidentally, i have a local patch that does pretty much the same
> thing, but a little further down compared to yours. It notifies gdb
> of objfile changes right before the call to read_symbols (...).
That location is fine too, I just put the call at the point that
the data actually becomes stale.
>
> But my patch doesn't remove the original call to objfiles_changed
> (...). What is the rationale behind that change?
I removed it just because would always be an duplicate call.
>
>> diff --git a/gdb/symfile.c b/gdb/symfile.c
>> index 8b79508..290b18b 100644
>> --- a/gdb/symfile.c
>> +++ b/gdb/symfile.c
>> @@ -2592,6 +2592,12 @@ reread_symbols (void)
>> /* Free the obstacks for non-reusable objfiles. */
>> psymbol_bcache_free (objfile->psymbol_cache);
>> objfile->psymbol_cache = psymbol_bcache_init ();
>> +
>> + /* Notify objfiles that we've modified objfile sections, which now
>> + needs to be done early to ensure that, for the MIPS target,
>> + find_pc_section won't access stale data. PR 21337. */
>
> I think the PR number is not needed. After all the bug will be gone with this fix.
Your right, people can just run "git log -p" to recover that information.
I'll update the patch accordingly.
Thanks,
Doug
From 6746b67149f1158c072317e0f1a095d682e112aa Mon Sep 17 00:00:00 2001
From: Doug Gilmore <doug.gilmore@imgtec.com>
Date: Fri, 31 Mar 2017 15:41:06 -0700
Subject: [PATCH] [mips] Fix PR 21337 v1: segfault when re-reading symbols with
remote debugging.
gdb/
2017-??-?? Doug Gilmore <Doug.Gilmore@Doug.Gilmore@imgtec.com>
* symfile.c (reread_symbols): Fix PR 21337.
---
gdb/symfile.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
@@ -2592,6 +2592,12 @@ reread_symbols (void)
/* Free the obstacks for non-reusable objfiles. */
psymbol_bcache_free (objfile->psymbol_cache);
objfile->psymbol_cache = psymbol_bcache_init ();
+
+ /* Notify objfiles that we've modified objfile sections, which now
+ needs to be done early to ensure that, for the MIPS target,
+ find_pc_section won't access stale data. PR 21337. */
+ objfiles_changed ();
+
obstack_free (&objfile->objfile_obstack, 0);
objfile->sections = NULL;
objfile->compunit_symtabs = NULL;
@@ -2678,9 +2684,6 @@ reread_symbols (void)
{
int ix;
- /* Notify objfiles that we've modified objfile sections. */
- objfiles_changed ();
-
clear_symtab_users (0);
/* clear_objfile_data for each objfile was called before freeing it and
--
1.9.1