* as.c (use_gnu_debug_info_extensions) : New variable.
authorNick Clifton <nickc@redhat.com>
Wed, 8 Oct 2003 14:37:20 +0000 (14:37 +0000)
committerNick Clifton <nickc@redhat.com>
Wed, 8 Oct 2003 14:37:20 +0000 (14:37 +0000)
 (parse_args) : Accept new --gstabs+ option, and set `use_gnu_debug_info_extensions'.
 (show_usage) : Document --gstabs+ option.
* as.h (use_gnu_debug_info_extensions) : New extern declaration.
* stabs.c (stabs_generate_asm_file) : If `use_gnu_debug_info_extensions' is set
  add the compilation directory to the stabs debug info.
* doc/as.texinfo : Document --gstabs+ option.
* NEWS: Mention new feature.

gas/ChangeLog
gas/NEWS
gas/as.c
gas/as.h
gas/doc/as.texinfo
gas/stabs.c

index 583e0ca..1d4f458 100644 (file)
@@ -1,3 +1,16 @@
+2003-10-08  Philippe De Muyter  <phdm@macqel.be>
+
+       * as.c (use_gnu_debug_info_extensions) : New variable. 
+       (parse_args) : Accept new --gstabs+ option, and set
+       `use_gnu_debug_info_extensions'.
+       (show_usage) : Document --gstabs+ option.
+       * as.h (use_gnu_debug_info_extensions) : New extern declaration.
+       * stabs.c (stabs_generate_asm_file) : If
+       `use_gnu_debug_info_extensions' is set, add the compilation
+       directory to the stabs debug info.
+       * doc/as.texinfo : Document --gstabs+ option.
+       * NEWS: Mention new feature.
+
 2003-10-06      Matt Thomas <matt@3am-software.com>
 
          Switch NetBSD/hppa to use Linux PA-RISC ELF ABI and
index b363df4..cec4132 100644 (file)
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -1,5 +1,8 @@
 -*- text -*-
 
+* Added --gstabs+ switch to enable the generation of STABS debug format
+  information with GNU extensions.
 * Added support for MIPS64 Release 2.
 
 * Added support for v850e1.
index 8b27316..20d1522 100644 (file)
--- a/gas/as.c
+++ b/gas/as.c
@@ -87,6 +87,7 @@ int listing;
 
 /* Type of debugging to generate.  */
 enum debug_info_type debug_type = DEBUG_UNSPECIFIED;
+int use_gnu_debug_info_extensions = 0;
 
 /* Maximum level of macro nesting.  */
 int max_macro_nest = 100;
@@ -276,6 +277,8 @@ Options:\n\
   fprintf (stream, _("\
   --gstabs                generate stabs debugging information\n"));
   fprintf (stream, _("\
+  --gstabs+               generate stabs debug info with GNU extensions\n"));
+  fprintf (stream, _("\
   --gdwarf2               generate DWARF2 debugging information\n"));
   fprintf (stream, _("\
   --help                  show this message and exit\n"));
@@ -403,6 +406,7 @@ parse_args (int * pargc, char *** pargv)
       OPTION_LISTING_CONT_LINES,
       OPTION_DEPFILE,
       OPTION_GSTABS,
+      OPTION_GSTABS_PLUS,
       OPTION_STRIP_LOCAL_ABSOLUTE,
       OPTION_TRADITIONAL_FORMAT,
       OPTION_GDWARF2,
@@ -442,6 +446,7 @@ parse_args (int * pargc, char *** pargv)
     {"listing-cont-lines", required_argument, NULL, OPTION_LISTING_CONT_LINES},
     {"MD", required_argument, NULL, OPTION_DEPFILE},
     {"gstabs", no_argument, NULL, OPTION_GSTABS},
+    {"gstabs+", no_argument, NULL, OPTION_GSTABS_PLUS},
     {"strip-local-absolute", no_argument, NULL, OPTION_STRIP_LOCAL_ABSOLUTE},
     {"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT},
     {"gdwarf2", no_argument, NULL, OPTION_GDWARF2},
@@ -643,6 +648,9 @@ the GNU General Public License.  This program has absolutely no warranty.\n"));
          start_dependencies (optarg);
          break;
 
+       case OPTION_GSTABS_PLUS:
+         use_gnu_debug_info_extensions = 1;
+         /* Fall through.  */
        case OPTION_GSTABS:
          debug_type = DEBUG_STABS;
          break;
index 2121964..28806d5 100644 (file)
--- a/gas/as.h
+++ b/gas/as.h
@@ -476,6 +476,7 @@ enum debug_info_type {
 };
 
 extern enum debug_info_type debug_type;
+extern int use_gnu_debug_info_extensions;
 \f
 /* Maximum level of macro nesting.  */
 extern int max_macro_nest;
index f7b4085..e9f5a5b 100644 (file)
@@ -263,8 +263,8 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}.
 @smallexample
 @c man begin SYNOPSIS
 @value{AS} [@b{-a}[@b{cdhlns}][=@var{file}]] [@b{-D}] [@b{--defsym} @var{sym}=@var{val}]
- [@b{-f}] [@b{--gstabs}] [@b{--gdwarf2}] [@b{--help}] [@b{-I} @var{dir}] 
- [@b{-J}] [@b{-K}] [@b{-L}]
+ [@b{-f}] [@b{--gstabs}] [@b{--gstabs+}] [@b{--gdwarf2}] [@b{--help}]
+ [@b{-I} @var{dir}] [@b{-J}] [@b{-K}] [@b{-L}]
  [@b{--listing-lhs-width}=@var{NUM}] [@b{--listing-lhs-width2}=@var{NUM}]
  [@b{--listing-rhs-width}=@var{NUM}] [@b{--listing-cont-lines}=@var{NUM}]
  [@b{--keep-locals}] [@b{-o} @var{objfile}] [@b{-R}] [@b{--statistics}] [@b{-v}]
@@ -514,6 +514,13 @@ compiler output).
 Generate stabs debugging information for each assembler line.  This
 may help debugging assembler code, if the debugger can handle it.
 
+@item --gstabs+
+Generate stabs debugging information for each assembler line, with GNU
+extensions that probably only gdb can handle, and that could make other
+debuggers crash or refuse to read your program.  This
+may help debugging assembler code.  Currently the only GNU extension is
+the location of the current working directory at assembling time.
+
 @item --gdwarf2
 Generate DWARF2 debugging information for each assembler line.  This
 may help debugging assembler code, if the debugger can handle it.  Note---this
@@ -4326,7 +4333,7 @@ in @sc{ieee} format.
 @cindex @code{func} directive
 @code{.func} emits debugging information to denote function @var{name}, and
 is ignored unless the file is assembled with debugging enabled.
-Only @samp{--gstabs} is currently supported.
+Only @samp{--gstabs[+]} is currently supported.
 @var{label} is the entry point of the function and if omitted @var{name}
 prepended with the @samp{leading char} is used.
 @samp{leading char} is usually @code{_} or nothing, depending on the target.
index 900826b..33b14c1 100644 (file)
@@ -502,6 +502,15 @@ stabs_generate_asm_file ()
   unsigned int lineno;
 
   as_where (&file, &lineno);
+  if (use_gnu_debug_info_extensions)
+    {
+      char *dir, *dir2;
+
+      dir = getpwd ();
+      dir2 = alloca (strlen (dir) + 2);
+      sprintf (dir2, "%s%s", dir, "/");
+      generate_asm_file (N_SO, dir2);
+    }
   generate_asm_file (N_SO, file);
 }