This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Improve "start" command for Ada


This is a followup on a thread started at:

        http://sources.redhat.com/ml/gdb-patches/2004-05/msg00521.html

It is the second part of the change that introduced the start
command, needed to make this command work for Ada. The principle
was sort of agreed on but it was a while ago, so things may have
changed. See:

        http://sources.redhat.com/ml/gdb-patches/2004-05/msg00618.html

Small refresher (it took me a while to collect all the elements of
the puzzle again):

        . Around the 20th of March 2004, I introduced a new command
          named "start". The implementation of this command was
          relying on a function called "main_name". At the time,
          this function was returning either the name of the main
          provided by STABS, or was defaulting to "main".

          The name of the main procedure in Ada changes from executable
          to executable, so this is not enough for Ada. But this Ada
          support was not activated then, we stopped there.

        . Now that Ada is activated, it is no longer enough for
          main_name to default to "main". So the intent was to
          later update that main_name() to search for the name of
          the main procedure a bit more precisely. And the approach
          selected was just to call language-specific procedures that
          would return either the name of the main procedure, or NULL
          if not found.

This is essentially what this patch does.

But on top of this, we have to be a bit careful, because the name
of the main program is cached, and we don't want to use an old name
incorrectly. So I added a small observer, that notifies us when the
executable file being debug changes, so that we can reset the cached
name.

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.
        * Makefile.in (exec.o): Add dependency on observer.h.
        (symtab.o): Likewise.

Tested on x86-linux. Fixes the failure that I introduced with
the patch I submitted for gdb.ada/null_record.exp (making the
expected output a bit more stringent on what we verify). See

        http://sources.redhat.com/ml/gdb-patches/2004-10/msg00350.html

OK to commit?

Thanks,
-- 
Joel

Attachment: find_main_name.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]