Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Elena Zannoni <ezannoni@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] Improve "start" command for Ada
Date: Wed, 09 Feb 2005 18:22:00 -0000	[thread overview]
Message-ID: <20050209170543.GE18540@adacore.com> (raw)
In-Reply-To: <20041201030309.GE1204@adacore.com>

Hello Elena,

There is one part of the patch that hasn't been approved yet. I tried
to explain a bit the history of the code you were concerned with, and
I was wondering what your thoughts were. Could you have a look? (way
at the bottom of the message - I kept the rest to keep the entire
context together).

Thanks,
-- 
Joel

> On Sun, Nov 28, 2004 at 09:08:21PM -0500, Elena Zannoni wrote:
> > Joel Brobecker writes:
> >  > Ping? (doco already approved by Eli)
> >  > 
> >  > On Thu, Oct 21, 2004 at 02:09:51PM -0700, Joel Brobecker wrote:
> >  > > 2004-10-20  Joel Brobecker  <brobecker@gnat.com>
> >  > > 
> >  > >         * doc/observer.texi (executable_changed): New observer.
> >  > >         * symtab.c: Include "observer.h".
> >  > >         (find_main_name): New function.
> >  > >         (main_name): If name_of_main is unset, then compute it
> >  > >         using find_main_name.
> >  > >         (symtab_observer_executable_changed): New function.
> >  > >         (_initialize_symtab): Attach executable_changed observer.
> >  > >         * exec.c: Include "observer.h".
> >  > >         (exec_file_attach): Emit executable_changed notification.
> >  > >         * symfile.c: Include "observer.h".
> >  > >         (reread_symbols): Send an executable_changed if appropriate.
> >  > >         * Makefile.in (exec.o): Add dependency on observer.h.
> >  > >         (symfile.o): Likewise.
> >  > >         (symtab.o): Likewise.
> >  > > 
> >  > > Tested on x86-linux. Still fixes 1 FAIL in gdb.ada/null_record.exp.
> >  > > 
> > 
> > We need a testcase where the name of the executable is changed, and
> > this code is exercised. Otherwise ok, except for this:
> 
> OK, I will add something along the line of reread.exp.
> 
> >  > > +/* Deduce the name of the main procedure, and set NAME_OF_MAIN
> >  > > +   accordingly.  */
> >  > > +
> >  > > +static void
> >  > > +find_main_name (void)
> >  > > +{
> >  > > +  char *new_main_name;
> >  > > +
> >  > > +  /* Try to see if the main procedure is in Ada.  */
> >  > > +  new_main_name = ada_main_name ();
> >  > > +  if (new_main_name != NULL)
> >  > > +    { 
> >  > > +      set_main_name (new_main_name);
> >  > > +      return;
> >  > > +    }
> >  > > +
> >  > > +  /* The languages above didn't identify the name of the main procedure.
> >  > > +     Fallback to "main".  */
> >  > > +  set_main_name ("main");
> >  > > +}
> >  > > +
> >  > >  char *
> >  > >  main_name (void)
> >  > >  {
> >  > > -  if (name_of_main != NULL)
> >  > > -    return name_of_main;
> >  > > -  else
> >  > > -    return "main";
> >  > > +  if (name_of_main == NULL)
> >  > > +    find_main_name ();
> >  > > +
> >  > > +  return name_of_main;
> >  > >  }
> >  > >  
> > 
> > Can this find_main_name become an element in the language vector? I
> > really don't want to have a special language cases in the symtab file.
> 
> This has actually been discussed already. There were several messages
> exchanged between Daniel and myself, but here are some important ones:
> 
>     http://sources.redhat.com/ml/gdb-patches/2004-05/msg00607.html
>     (one potential confusion if we use the *current* language vector
>     to determine the name of main. This is also where the suggestion
>     of calling the Ada routine directly was suggested.
> 
>     http://sources.redhat.com/ml/gdb-patches/2004-05/msg00612.html
>     (we agree that it's ok to call ada_main_name directly)
> 
> In short, the answer to the discussion was that this was probably the
> best approach for now. The reason why it can't be put in the language
> vector is that this is not a property of the language (which can vary
> within the same program, depending on the frame), but a property of
> the executable. None of us like this approach much, but it was something
> that we felt sucked the least.
> 
> If you want, what we can do is replace the hard-coded call to
> ada_main_name() by a loop of calls to a new language method,
> looping on all languages until we find a positive match. That
> way, the hard wiring to Ada disappears. But I don't think we're
> getting much from this extra slight complexity. 

-- 
Joel


  reply	other threads:[~2005-02-09 17:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-21  3:48 Joel Brobecker
2004-10-21  5:31 ` Eli Zaretskii
2004-10-21 21:09   ` Joel Brobecker
2004-10-23 10:05     ` Eli Zaretskii
2004-11-01 19:47     ` Joel Brobecker
2004-11-29  2:12       ` Elena Zannoni
2004-12-01  3:03         ` Joel Brobecker
2005-02-09 18:22           ` Joel Brobecker [this message]
2005-03-07 19:30             ` Joel Brobecker
2005-03-07 20:59               ` Elena Zannoni
2005-03-07 21:12                 ` Joel Brobecker
2005-03-08  4:40                 ` Joel Brobecker
2004-11-22 19:10     ` Joel Brobecker

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=20050209170543.GE18540@adacore.com \
    --to=brobecker@adacore.com \
    --cc=ezannoni@redhat.com \
    --cc=gdb-patches@sources.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