From 05da4302188949f1752cb1fa5def4b010450dbe4 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 8 Oct 2003 14:37:20 +0000 Subject: [PATCH] * 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. --- gas/ChangeLog | 13 +++++++++++++ gas/NEWS | 3 +++ gas/as.c | 8 ++++++++ gas/as.h | 1 + gas/doc/as.texinfo | 13 ++++++++++--- gas/stabs.c | 9 +++++++++ 6 files changed, 44 insertions(+), 3 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 583e0ca7b93..1d4f4586e16 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,16 @@ +2003-10-08 Philippe De Muyter + + * 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 Switch NetBSD/hppa to use Linux PA-RISC ELF ABI and diff --git a/gas/NEWS b/gas/NEWS index b363df48597..cec4132652b 100644 --- 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. diff --git a/gas/as.c b/gas/as.c index 8b27316d8bd..20d1522dbca 100644 --- 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; diff --git a/gas/as.h b/gas/as.h index 21219644d5a..28806d53e20 100644 --- 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; /* Maximum level of macro nesting. */ extern int max_macro_nest; diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index f7b40851ba8..e9f5a5b350c 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -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. diff --git a/gas/stabs.c b/gas/stabs.c index 900826b231f..33b14c149d3 100644 --- a/gas/stabs.c +++ b/gas/stabs.c @@ -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); } -- 2.30.2