OSDN Git Service

2008-04-08 Ed Schonberg <schonberg@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / vxaddr2line.adb
index 5fc7759..b64e364 100644 (file)
@@ -6,18 +6,17 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---            Copyright (C) 2002-2003 Ada Core Technologies, Inc.           --
+--                     Copyright (C) 2002-2007, AdaCore                     --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
--- ware  Foundation;  either version 2,  or (at your option) any later ver- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
 -- for  more details.  You should have  received  a copy of the GNU General --
--- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--- MA 02111-1307, USA.                                                      --
+-- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license.          --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
@@ -81,14 +80,16 @@ procedure VxAddr2Line is
 
    --  All supported architectures
    type Architecture is
-     (WINDOWS_POWERPC,
+     (SOLARIS_I586,
+      WINDOWS_POWERPC,
+      WINDOWS_I586,
       WINDOWS_M68K,
       SOLARIS_POWERPC,
       DEC_ALPHA);
 
    type Arch_Record is record
       Addr2line_Binary : String_Access;
-      --  Name of the addr2line utility to use.
+      --  Name of the addr2line utility to use
 
       Nm_Binary : String_Access;
       --  Name of the host nm utility, which will be used to find out the
@@ -120,11 +121,21 @@ procedure VxAddr2Line is
          Nm_Binary           => null,
          Addr_Digits_To_Skip => 0,
          Bt_Offset_From_Call => -4),
+      WINDOWS_I586 =>
+        (Addr2line_Binary    => null,
+         Nm_Binary           => null,
+         Addr_Digits_To_Skip => 0,
+         Bt_Offset_From_Call => -2),
       SOLARIS_POWERPC =>
         (Addr2line_Binary    => null,
          Nm_Binary           => null,
          Addr_Digits_To_Skip => 0,
          Bt_Offset_From_Call => 0),
+      SOLARIS_I586 =>
+        (Addr2line_Binary    => null,
+         Nm_Binary           => null,
+         Addr_Digits_To_Skip => 0,
+         Bt_Offset_From_Call => -2),
       DEC_ALPHA =>
         (Addr2line_Binary    => null,
          Nm_Binary           => null,
@@ -212,7 +223,6 @@ procedure VxAddr2Line is
          return;
    end Detect_Arch;
 
-
    -----------
    -- Error --
    -----------
@@ -224,7 +234,6 @@ procedure VxAddr2Line is
       raise Program_Error;
    end Error;
 
-
    --------------------------
    -- Get_Reference_Offset --
    --------------------------
@@ -284,7 +293,7 @@ procedure VxAddr2Line is
             return Value;
       end;
 
-      --  We can not get here
+      --  We cannot get here
 
       raise Program_Error;
 
@@ -398,7 +407,7 @@ begin
       Error ("Couldn't find " & Arch_List (Cur_Arch).Addr2line_Binary.all);
    end if;
 
-   --  The first argument specifies the image file. Check if it exists.
+   --  The first argument specifies the image file. Check if it exists
 
    if not Is_Regular_File (Argument (1)) then
       Error ("Couldn't find the executable " & Argument (1));
@@ -449,6 +458,10 @@ begin
    Spawn (Addr2line_Cmd.all,
           Addr2line_Args (1 .. Addr2line_Args_Count), Success);
 
+   if not Success then
+      Error ("Couldn't spawn " & Addr2line_Cmd.all);
+   end if;
+
 exception
    when others =>