Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Pedro Alves <palves@redhat.com>, Tom Tromey <tromey@redhat.com>,
	       gdb-patches@sourceware.org
Subject: Re: RFC for: "Re: Regression for gdb.fortran/library-module.exp [Re: [RFA] choose symbol from given block's objfile first.]"
Date: Mon, 28 May 2012 16:12:00 -0000	[thread overview]
Message-ID: <20120528161200.GA19230@host2.jankratochvil.net> (raw)
In-Reply-To: <20120528142727.GH5492@adacore.com>

On Mon, 28 May 2012 16:27:27 +0200, Joel Brobecker wrote:
> I just want to make sure that we do not get carried away trying to
> implement the perfect solution, because I don't have the time in
> the next few weeks to implement it, and I don't even know how to
> do that at the moment.

I somehow also share this approach currently.


> What the code above does, in practice, is trying to go through
> the ALL_OBJFILES list in the same order as before, except that
> we try the "context" objfile file first.  But, to make things
> even more interesting, having a "context" objfile does not mean
> that it should be checked ahead of any MAINLINE objfile, because
> otherwise we break your Fortran test.

Just the MAINLINE exception is not enough, it still regresses GDB:

==> 50.c <==
//extern int v;
extern int f (void);
extern int g (void);
int main (void) {
  return 10 * f () + g ();
}
==> 50l.c <==
int v=1;
int f (void) {
  return v;
}
==> 50ll.c <==
int v=2;
int g (void) {
  return v;
}
==============
gcc -o 50l.so 50l.c -Wall -g -shared -fPIC;gcc -o 50ll.so 50ll.c -Wall -g -shared -fPIC;gcc -o 50a 50.c -Wall -g ./50l.so ./50ll.so;gcc -o 50b 50.c -Wall -g ./50ll.so ./50l.so;./50a;echo $?;./50b;echo $?
for e in 50a 50b;do ./$e;echo $?;./gdb -q ./$e -ex 'b f' -ex 'b g' -ex r -ex 'p v' -ex c -ex 'p v' -ex c -ex q;done

before your patches (and therefore matching GDB the inferior behavior):
11
$1 = 1
$2 = 1
22
$1 = 2
$2 = 2

with your final patches (undo the first, apply this WIP second patch)
11
$1 = 1
$2 = 2
22
$1 = 1
$2 = 2

GDB is just behaving right in normal cases.

GDB is not correct, that it does not correctly maintain objfiles order in the
case of some dlopens/dlcloses (at least I guess so, I did not try to
reproduce).


> Another way of expressing
> the intent of my patch is to say: Try the "context" objfile first,
> unless it's not a MAINLINE objfile, in which case we try the
> MAINLINE objfiles, and then our "context" objfile.

But '"context" objfile first' is incompatible with SVR4.  The behavior
apparently has to be target specific.


> So, we have two options, at this point:
> 
>   (1) Revert my original patch;
> 
>   (2) Enhance the heuristics in my patch. This second patch is an
>       attempt at this.
> 
> I think it would be a loss to revert, but if we cannot converge on
> the heuristics for the search, then we'll just go to the previous
> search order (which may also be arbitrary in some ways).

Not sure what do you call 'heuristics' but as long as it becomes target
dependent the patch should be simple.


Thanks,
Jan


  reply	other threads:[~2012-05-28 16:12 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-07 22:43 [RFC] choose symbol from given block's objfile first Joel Brobecker
2012-05-08 17:19 ` Tom Tromey
2012-05-09 19:05   ` [RFA] " Joel Brobecker
2012-05-09 19:08     ` Joel Brobecker
2012-05-09 20:15       ` Tom Tromey
2012-05-09 20:40         ` Joel Brobecker
2012-05-09 20:57           ` Tom Tromey
2012-05-09 21:06             ` Joel Brobecker
2012-05-10 13:42               ` Tom Tromey
2012-05-10 16:27                 ` checked in: " Joel Brobecker
2012-05-10 17:19               ` Joel Brobecker
2012-05-09 21:48       ` Joel Brobecker
2012-05-09 21:49         ` Joel Brobecker
2012-05-18 16:10           ` gdb.base/print-file-var.exp false PASS [Re: [RFA] choose symbol from given block's objfile first.] Jan Kratochvil
2012-05-18 17:17             ` Joel Brobecker
2012-05-18 17:37               ` Jan Kratochvil
2012-05-09 20:08     ` [RFA] choose symbol from given block's objfile first Tom Tromey
2012-05-11  7:26     ` Regression for gdb.fortran/library-module.exp [Re: [RFA] choose symbol from given block's objfile first.] Jan Kratochvil
2012-05-11 12:25       ` Joel Brobecker
2012-05-14 14:39       ` Joel Brobecker
2012-05-14 14:52         ` Jan Kratochvil
2012-05-14 15:06           ` Joel Brobecker
2012-05-14 15:15             ` Jan Kratochvil
2012-05-14 16:57               ` Joel Brobecker
2012-05-14 17:05                 ` Jan Kratochvil
2012-05-14 17:49           ` Pedro Alves
2012-05-14 17:59             ` Joel Brobecker
2012-05-14 18:07               ` Jan Kratochvil
2012-05-15 13:09                 ` Joel Brobecker
2012-05-16 19:57                   ` RFC for: "Re: Regression for gdb.fortran/library-module.exp [Re: [RFA] choose symbol from given block's objfile first.]" Joel Brobecker
2012-05-18 17:46                     ` Jan Kratochvil
2012-05-28 14:27                       ` Joel Brobecker
2012-05-28 16:12                         ` Jan Kratochvil [this message]
2012-05-29 15:44                           ` Joel Brobecker
2012-05-29 15:49                             ` Joel Brobecker
2012-05-29 15:56                             ` Jan Kratochvil
2012-05-29 16:02                               ` Joel Brobecker
2012-05-29 16:12                                 ` Jan Kratochvil
2012-05-29 16:31                                   ` Pedro Alves
2012-05-10 14:14 ` [RFC] choose symbol from given block's objfile first Pedro Alves
2012-05-10 14:32   ` Tom Tromey
2012-05-10 14:50     ` Matt Rice
2012-05-10 15:07       ` Pedro Alves

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=20120528161200.GA19230@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=tromey@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