dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch] Add support for Ada (GNAT)


From: Joel Brobecker
Subject: Re: [patch] Add support for Ada (GNAT)
Date: Mon, 12 Apr 2004 14:41:56 -0700
User-agent: Mutt/1.4i

Hello,

I sent the following message two weeks ago, but never received any
response. Is this the proper address to send such messages. I see
in the archives that this list is plagued with spam, perhaps did
this message simply go unnoticed?

Thanks,

On Mon, Mar 29, 2004 at 11:42:53AM -0800, Joel Brobecker wrote:
> Hello,
> 
> My name is Joel Brobecker, and I am currently trying to add support
> for testing GDB against Ada programs. For this, I'd like to add support
> in dejagnu for building Ada applications. Here are a couple of patches
> that I am suggesting for inclusion.
> 
> The first patch adds a new function that locates the "gnatmake" program.
> This is the main program that GNAT users use in order to build they
> Ada application. As it name implies, it is very similar to "make"
> except that dependencies are automatically handled. A short example
> of usage would be the following:
> 
>         Suppose you have a program which main procedure (the equivalent
>         of procedure "main" in C) is named "foo", and that this procedure 
>         depends on 2 units: "bar" and "baz". To build his application
>         with debug info, the user would typically do:
>                 
>                 % gnatmake -g foo
> 
>         This command will automatically trigger the compilation of "bar"
>         and "baz", except if a unit have already been compiled and its
>         associated object file is still up to date. It will also take
>         care of the link.
> 
> As in "find_gcc", "find_gnatmake" also tried to see if we have an
> in-tree gnatmake. If this is the case, then it returns that gnatmake
> along with appropriate options to run it in-tree (for testing of a
> combined tree).
> 
> The second patch upgrades default_target_compile to support the "ada"
> keyword option, as well as the GNATMAKE_FOR_TARGET global.
> 
> The two patches have been tested inside the GDB dejagnu framework,
> where I defined a procedure gdb_compile_ada that would add the "ada"
> keyword for me, and then call "target_compile".
> 
> 2004-03-29  Joel Brobecker  <address@hidden>
> 
>         * lib/libgloss.exp (find_gnatmake): New procedure.
>         * lib/target.exp (default_target_compile): Add support for Ada.
> 
> Would this patch be acceptable for inclusion?
> 
> There is also an administrative detail that may need to be sorted out:
> I don't know if the company I work for has an assignment filed that
> covers dejagnu. I work for AdaCore (aka Ada Core Technologies, or ACT).
> Please let me know.
> 
> Thanks,
> -- 
> Joel
> 
> PS: The commands specified in your dejagnu webpage is slightly
>     incorrect. I didn't know much about anonymous CVS acccess,
>     so it took me a while to dig out of the CVS documentation
>     a way of getting the sources. You might want to fix this.
>     I did:
> 
>     $ cvs -z3 -d :ext:address@hidden:/cvsroot/dejagnu co dejagnu
> 
>     (it looks like all I had to do was to skip the first step which
>     timed-out).

> Index: libgloss.exp
> ===================================================================
> RCS file: /cvsroot/dejagnu/dejagnu/lib/libgloss.exp,v
> retrieving revision 1.14
> diff -u -p -r1.14 libgloss.exp
> --- libgloss.exp      23 Aug 2003 05:55:08 -0000      1.14
> +++ libgloss.exp      29 Mar 2004 19:17:57 -0000
> @@ -695,6 +695,26 @@ proc find_g77 {} {
>      return $CC
>  }
>  
> +proc find_gnatmake {} {
> +    global tool_root_dir
> +
> +    set root "$tool_root_dir/gcc"
> +    set GM ""
> +
> +    if ![is_remote host] {
> +        set file [lookfor_file $root gnatmake]
> +        if { $file != "" } {
> +            set GM "$file -I$root/ada/rts --GCC=$root/xgcc 
> --GNATBIND=$root/gnatbind --GNATLINK=$root/gnatlink -cargs -B$root -largs 
> --GCC=$root/xgcc -margs";
> +        }
> +    }
> +
> +    if {$GM == ""} {
> +        set GM [transform gnatmake]
> +    }
> +
> +    return $GM
> +}
> +
>  proc find_nm {} {
>      global tool_root_dir
>  

> Index: target.exp
> ===================================================================
> RCS file: /cvsroot/dejagnu/dejagnu/lib/target.exp,v
> retrieving revision 1.15
> diff -u -p -r1.15 target.exp
> --- target.exp        5 Feb 2004 23:41:21 -0000       1.15
> +++ target.exp        29 Mar 2004 19:18:14 -0000
> @@ -333,6 +333,19 @@ proc default_target_compile {source dest
>      }
>  
>      foreach i $options {
> +     if { $i == "ada" } {
> +         set compiler_type "ada"
> +         if [board_info $dest exists adaflags] {
> +             append add_flags " [target_info adaflags]"
> +         }
> +         # append add_flags " [gnatmake_include_flags]";
> +         if [board_info $dest exists gnatmake] {
> +             set compiler [target_info gnatmake];
> +         } else {
> +             set compiler [find_gnatmake];
> +         }
> +     }
> +
>       if { $i == "c++" } {
>           set compiler_type "c++"
>           if [board_info $dest exists cxxflags] {
> @@ -412,6 +425,7 @@ proc default_target_compile {source dest
>      global CC_FOR_TARGET
>      global CXX_FOR_TARGET
>      global F77_FOR_TARGET
> +    global GNATMAKE_FOR_TARGET
>  
>      if [info exists CC_FOR_TARGET] {
>       if { $compiler == "" } {
> @@ -428,6 +442,12 @@ proc default_target_compile {source dest
>      if [info exists F77_FOR_TARGET] {
>       if { $compiler_type == "f77" } {
>           set compiler $F77_FOR_TARGET
> +     }
> +    }
> +
> +    if [info exists GNATMAKE_FOR_TARGET] {
> +     if { $compiler_type == "ada" } {
> +         set compiler $GNATMAKE_FOR_TARGET
>       }
>      }
>  


-- 
Joel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]