Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: jan.kratochvil@redhat.com (Jan Kratochvil)
Cc: gdb-patches@sourceware.org,
	brobecker@adacore.com (Joel Brobecker),
	       alves.ped@gmail.com (Pedro Alves)
Subject: Re: [patch+7.4] reread.exp 7.3->7.4 regression
Date: Mon, 19 Dec 2011 10:32:00 -0000	[thread overview]
Message-ID: <201112191030.pBJAUsf4028428@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <20111218115343.GB22534@host2.jankratochvil.net> from "Jan Kratochvil" at Dec 18, 2011 12:53:43 PM

Jan Kratochvil wrote:

> this patch should be tested on ARM, I do not yet have some ARM testing
> environment (I probably could build one).

I can test on ARM if you want.

> This is because objfile->OBFD can change underneath registered objfile data.
> 
> There are multiple such problems because objfile is not destroyed + recreated
> on objfile reload, there was a patch for it but it has never been checked in:
> 	[patch] Fix a reread_symbols regression by mmap
> 	http://sourceware.org/ml/gdb-patches/2009-06/msg00606.html
> 	http://sourceware.org/ml/gdb-patches/2009-08/msg00207.html
> 	http://sourceware.org/ml/gdb-patches/2011-12/msg00596.html
> 
> As I believe the patch above is not suitable for the 7.4 branch offering at
> least this very ugly patch which breaks ARM functionality on rereads but it at
> least does not break ARM-unrelated arches.

I really think this ought to be fixed in reread_symbols; freeing the old
OBFD needs to be done *after* all the callbacks to cleanup objfile data
have completed.   Your initial patch already moved the callbacks calls
up a bit; I think it needs to be moved up even further.  (There is the
issue of what state the objfile is left in if any of the "error" calls
is triggered, though.)   In addition, we should probably call 
observer_notify_new_objfile so that new tables can be built up for
the re-read file ...

>  struct arm_per_objfile
>  {
>    VEC(arm_mapping_symbol_s) **section_maps;
> +
> +  /* A copy from OBFD.  OBFD can change underneath by reread_symbols.  It is
> +     wrong then to use arm_per_objfile but at least do not crash.  */
> +  unsigned int section_count;
>  };

That said, I guess this is OK as a workaround.  However, even with the current
broken code, it seems only the _free routines ever see the "wrong" OBFD.  Thus
I'd prefer for only the _free routines to rely on this new value ...

> @@ -330,7 +334,7 @@ arm_find_mapping_symbol (CORE_ADDR memaddr, CORE_ADDR *start)
>        unsigned int idx;
>  
>        data = objfile_data (sec->objfile, arm_objfile_data_key);
> -      if (data != NULL)
> +      if (data != NULL && sec->the_bfd_section->index < data->section_count)
>  	{
>  	  map = data->section_maps[sec->the_bfd_section->index];

... and for checks in other users like this to be turned into assertions instead.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


  parent reply	other threads:[~2011-12-19 10:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-18 12:00 Jan Kratochvil
2011-12-19  4:17 ` Joel Brobecker
2011-12-19  9:54   ` Jan Kratochvil
2011-12-19 10:13     ` Joel Brobecker
2011-12-19 10:31       ` Jan Kratochvil
2011-12-19 10:32 ` Ulrich Weigand [this message]
2011-12-19 19:05   ` Tom Tromey
2011-12-19 19:12     ` Jan Kratochvil
2011-12-19 20:02       ` Tom Tromey
2011-12-19 19:47   ` Jan Kratochvil
2011-12-19 21:49     ` Ulrich Weigand
2011-12-19 22:56       ` [commit+7.4] " Jan Kratochvil
2011-12-21 11:46   ` [patch] reread_symbols observer_notify_new_objfile - fix ARM unwinding after reread [Re: [patch+7.4] reread.exp 7.3->7.4 regression] Jan Kratochvil
2011-12-21 13:13     ` [patch] reread_symbols observer_notify_new_objfile - fix ARM unwinding after reread [Re: [patch+7.4] reread.exp 7.3->7.4 regres Ulrich Weigand
2011-12-21 14:27       ` [commit] [patch] reread_symbols observer_notify_new_objfile - fix ARM unwinding after reread Jan Kratochvil
2011-12-19 15:28 ` [patch+7.4] reread.exp 7.3->7.4 regression Tom Tromey

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=201112191030.pBJAUsf4028428@d06av02.portsmouth.uk.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=alves.ped@gmail.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.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