Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Joel Brobecker <brobecker@gnat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA/RFC] New command: ``start''
Date: Thu, 20 May 2004 17:14:00 -0000	[thread overview]
Message-ID: <20040520171404.GA3880@nevyn.them.org> (raw)
In-Reply-To: <20040520160259.GV10684@gnat.com>

On Thu, May 20, 2004 at 09:02:59AM -0700, Joel Brobecker wrote:
> Here is how we find the name of the main procedure: We lookup a certain
> symbol which is created by our binder, __gnat_ada_main_program_name.
> This symbol points to a string holding the name of the main procedure.
> You'll find the code in ada-lang.c:begin_command().

OK.  So this has the property that I was hoping for; it won't return a
false positive for a non-Ada main program.

> > I think the best approach may be to iterate over the languages
> > included in the object file, asking each of them whether this language
> > appears to contain a main procedure.  Or even to simply skip the
> > langhook complexity and just call an Ada find-main function!  For gcj
> > I suspect we will just change the debug information.
> 
> I thought about several approaches along the same idea. One of them
> was to implement a sniffing mechanism, with certain sniffers having
> certain priorities. But you know, I really like the idea of dropping
> the langhook, and just call the ada function. Something like this:
> 
>         char *
>         main_name ()
>         {
>           /* If we found the name of main from the debug info, or
>              already looked it up, then return the name of main.  */
>           if (name_of_main != NULL)
>             return name_of_main;
> 
>           /* Is the main in Ada?  */
>           tmp_main_name = ada_find_main_name ();
>           if (tmp_main_name != NULL)
>             {
>               set_main_name (tmp_main_name);
>               return name_of_main;
>             }
> 
>           /* Is the main in Java?  */
>           tmp_main_name = java_find_main_name ();
>           [etc...]
> 
>           /* Fallback: main_name must be the usual "main".  */
>           set_main_name ("main);
>           return name_of_main;
>         }
> 
> The only drawback I see from this is that I will need to include
> ada-lang.h. It would have been nice to avoid this, which is possible
> with the langhooks. I could also add the ada_find_main_name()
> declaration in another more common .h file, but that would be a dirty
> trick, IMO.

This is fine with me.  Let's see if anyone else objects to it.

Since I don't know of any language other than Ada that will have a
fallback for this, I don't think it's worth inventing a lot of
machinery for it.  I'm not especially interested in allowing a language
to be compiled out, either.

-- 
Daniel Jacobowitz


  reply	other threads:[~2004-05-20 17:14 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-18  2:47 Joel Brobecker
2004-05-18  6:32 ` Eli Zaretskii
2004-05-18 17:05   ` Joel Brobecker
2004-05-18 18:42     ` Eli Zaretskii
2004-05-18 19:03       ` Andrew Cagney
2004-05-19  5:39         ` Eli Zaretskii
2004-05-18 19:22       ` Joel Brobecker
2004-05-18 21:47 ` Daniel Jacobowitz
2004-05-18 22:27   ` Joel Brobecker
2004-05-18 22:41     ` Daniel Jacobowitz
2004-05-19 15:36       ` Joel Brobecker
2004-05-19 15:42         ` Daniel Jacobowitz
2004-05-19 16:10           ` Joel Brobecker
2004-05-20  1:01           ` Joel Brobecker
2004-05-20  5:29             ` Eli Zaretskii
2004-05-20 13:46             ` Daniel Jacobowitz
2004-05-20 16:03               ` Joel Brobecker
2004-05-20 17:14                 ` Daniel Jacobowitz [this message]
2004-05-20 20:33                   ` Paul Gilliam
2004-05-20 22:12                   ` Joel Brobecker
2004-05-21  0:26                     ` Daniel Jacobowitz
2004-05-21  1:31                       ` Joel Brobecker
2004-05-24 22:24                         ` Daniel Jacobowitz
2004-05-24 23:57                           ` Joel Brobecker
2004-05-19 14:30 ` Andrew Cagney
2004-05-19 15:39   ` Joel Brobecker
2004-05-19 20:02     ` Eli Zaretskii
2004-05-21 18:57       ` Andrew Cagney
2004-05-18 19:30 Michael Elizabeth Chastain
2004-05-18 19:45 ` Joel Brobecker
2004-05-18 20:21 Michael Elizabeth Chastain

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=20040520171404.GA3880@nevyn.them.org \
    --to=drow@false.org \
    --cc=brobecker@gnat.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