mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2025-02-07 18:01:18 +00:00
* listing.c: Add -ag listing flag to show general information in
listings such as gas version, passed options, and time stamp. (listing_general_info): New function. (print_options): New function. (print_single_option): New function. (print_timestamp): New function. (MAX_DATELEN): Define. (listing_print): Add call to listing_general_info. * listing.h (LISTING_GENERAL): Define. (listing_print): Add new parameter. * as.c (show_usage): Print new switch. (parse_args): Parse new switch. (main): Pass command line on to listing_print. * NEWS: Mention this new feature. * doc/as.texinfo: Document the new sub-option. * gas/all/gas.exp: Check the performance of the -ag command line switch.
This commit is contained in:
parent
45a5551e74
commit
83f10cb26a
@ -1,3 +1,21 @@
|
|||||||
|
2008-04-10 Santiago Urueña <suruena@gmail.com>
|
||||||
|
|
||||||
|
* listing.c: Add -ag listing flag to show general information in
|
||||||
|
listings such as gas version, passed options, and time stamp.
|
||||||
|
(listing_general_info): New function.
|
||||||
|
(print_options): New function.
|
||||||
|
(print_single_option): New function.
|
||||||
|
(print_timestamp): New function.
|
||||||
|
(MAX_DATELEN): Define.
|
||||||
|
(listing_print): Add call to listing_general_info.
|
||||||
|
* listing.h (LISTING_GENERAL): Define.
|
||||||
|
(listing_print): Add new parameter.
|
||||||
|
* as.c (show_usage): Print new switch.
|
||||||
|
(parse_args): Parse new switch.
|
||||||
|
(main): Pass command line on to listing_print.
|
||||||
|
* NEWS: Mention this new feature.
|
||||||
|
* doc/as.texinfo: Document the new sub-option.
|
||||||
|
|
||||||
2008-04-08 Alan Modra <amodra@bigpond.net.au>
|
2008-04-08 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
* dwarf2dbg.c (dwarf2_emit_insn): Simplify test before dwarf2_where
|
* dwarf2dbg.c (dwarf2_emit_insn): Simplify test before dwarf2_where
|
||||||
|
5
gas/NEWS
5
gas/NEWS
@ -1,4 +1,9 @@
|
|||||||
-*- text -*-
|
-*- text -*-
|
||||||
|
* New sub-option added to the assembler's -a command line switch to
|
||||||
|
generate a listing output. The 'g' sub-option will insert into the listing
|
||||||
|
various information about the assembly, such as assembler version, the
|
||||||
|
command line options used, and a time stamp.
|
||||||
|
|
||||||
* New command line option -msse2avx for x86 target to encode SSE
|
* New command line option -msse2avx for x86 target to encode SSE
|
||||||
instructions with VEX prefix.
|
instructions with VEX prefix.
|
||||||
|
|
||||||
|
10
gas/as.c
10
gas/as.c
@ -1,6 +1,6 @@
|
|||||||
/* as.c - GAS main program.
|
/* as.c - GAS main program.
|
||||||
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
||||||
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GAS, the GNU Assembler.
|
This file is part of GAS, the GNU Assembler.
|
||||||
@ -232,6 +232,7 @@ Options:\n\
|
|||||||
Sub-options [default hls]:\n\
|
Sub-options [default hls]:\n\
|
||||||
c omit false conditionals\n\
|
c omit false conditionals\n\
|
||||||
d omit debugging directives\n\
|
d omit debugging directives\n\
|
||||||
|
g include general info\n\
|
||||||
h include high-level source\n\
|
h include high-level source\n\
|
||||||
l include assembly\n\
|
l include assembly\n\
|
||||||
m include macro expansions\n\
|
m include macro expansions\n\
|
||||||
@ -825,6 +826,9 @@ This program has absolutely no warranty.\n"));
|
|||||||
case 'd':
|
case 'd':
|
||||||
listing |= LISTING_NODEBUG;
|
listing |= LISTING_NODEBUG;
|
||||||
break;
|
break;
|
||||||
|
case 'g':
|
||||||
|
listing |= LISTING_GENERAL;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
listing |= LISTING_HLL;
|
listing |= LISTING_HLL;
|
||||||
break;
|
break;
|
||||||
@ -1077,6 +1081,8 @@ create_obj_attrs_section (void)
|
|||||||
int
|
int
|
||||||
main (int argc, char ** argv)
|
main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
|
char ** argv_orig = argv;
|
||||||
|
|
||||||
int macro_strip_at;
|
int macro_strip_at;
|
||||||
int keep_it;
|
int keep_it;
|
||||||
|
|
||||||
@ -1232,7 +1238,7 @@ main (int argc, char ** argv)
|
|||||||
fflush (stderr);
|
fflush (stderr);
|
||||||
|
|
||||||
#ifndef NO_LISTING
|
#ifndef NO_LISTING
|
||||||
listing_print (listing_filename);
|
listing_print (listing_filename, argv_orig);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (flag_fatal_warnings && had_warnings () > 0 && had_errors () == 0)
|
if (flag_fatal_warnings && had_warnings () > 0 && had_errors () == 0)
|
||||||
|
@ -228,7 +228,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}.
|
|||||||
@c to be limited to one line for the header.
|
@c to be limited to one line for the header.
|
||||||
@smallexample
|
@smallexample
|
||||||
@c man begin SYNOPSIS
|
@c man begin SYNOPSIS
|
||||||
@value{AS} [@b{-a}[@b{cdhlns}][=@var{file}]] [@b{--alternate}] [@b{-D}]
|
@value{AS} [@b{-a}[@b{cdghlns}][=@var{file}]] [@b{--alternate}] [@b{-D}]
|
||||||
[@b{--debug-prefix-map} @var{old}=@var{new}]
|
[@b{--debug-prefix-map} @var{old}=@var{new}]
|
||||||
[@b{--defsym} @var{sym}=@var{val}] [@b{-f}] [@b{-g}] [@b{--gstabs}]
|
[@b{--defsym} @var{sym}=@var{val}] [@b{-f}] [@b{-g}] [@b{--gstabs}]
|
||||||
[@b{--gstabs+}] [@b{--gdwarf-2}] [@b{--help}] [@b{-I} @var{dir}] [@b{-J}]
|
[@b{--gstabs+}] [@b{--gdwarf-2}] [@b{--help}] [@b{-I} @var{dir}] [@b{-J}]
|
||||||
@ -462,7 +462,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}.
|
|||||||
@table @gcctabopt
|
@table @gcctabopt
|
||||||
@include at-file.texi
|
@include at-file.texi
|
||||||
|
|
||||||
@item -a[cdhlmns]
|
@item -a[cdghlmns]
|
||||||
Turn on listings, in any of a variety of ways:
|
Turn on listings, in any of a variety of ways:
|
||||||
|
|
||||||
@table @gcctabopt
|
@table @gcctabopt
|
||||||
@ -472,6 +472,9 @@ omit false conditionals
|
|||||||
@item -ad
|
@item -ad
|
||||||
omit debugging directives
|
omit debugging directives
|
||||||
|
|
||||||
|
@item -ag
|
||||||
|
include general information, like @value{AS} version and options passed
|
||||||
|
|
||||||
@item -ah
|
@item -ah
|
||||||
include high-level source
|
include high-level source
|
||||||
|
|
||||||
@ -1576,7 +1579,7 @@ assembler.)
|
|||||||
@c man end
|
@c man end
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* a:: -a[cdhlns] enable listings
|
* a:: -a[cdghlns] enable listings
|
||||||
* alternate:: --alternate enable alternate macro syntax
|
* alternate:: --alternate enable alternate macro syntax
|
||||||
* D:: -D for compatibility
|
* D:: -D for compatibility
|
||||||
* f:: -f to work faster
|
* f:: -f to work faster
|
||||||
@ -1602,11 +1605,12 @@ assembler.)
|
|||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node a
|
@node a
|
||||||
@section Enable Listings: @option{-a[cdhlns]}
|
@section Enable Listings: @option{-a[cdghlns]}
|
||||||
|
|
||||||
@kindex -a
|
@kindex -a
|
||||||
@kindex -ac
|
@kindex -ac
|
||||||
@kindex -ad
|
@kindex -ad
|
||||||
|
@kindex -ag
|
||||||
@kindex -ah
|
@kindex -ah
|
||||||
@kindex -al
|
@kindex -al
|
||||||
@kindex -an
|
@kindex -an
|
||||||
@ -1624,6 +1628,9 @@ High-level listings require that a compiler debugging option like
|
|||||||
@samp{-g} be used, and that assembly listings (@samp{-al}) be requested
|
@samp{-g} be used, and that assembly listings (@samp{-al}) be requested
|
||||||
also.
|
also.
|
||||||
|
|
||||||
|
Use the @samp{-ag} option to print a first section with general assembly
|
||||||
|
information, like @value{AS} version, switches passed, or time stamp.
|
||||||
|
|
||||||
Use the @samp{-ac} option to omit false conditionals from a listing. Any lines
|
Use the @samp{-ac} option to omit false conditionals from a listing. Any lines
|
||||||
which are not assembled because of a false @code{.if} (or @code{.ifdef}, or any
|
which are not assembled because of a false @code{.if} (or @code{.ifdef}, or any
|
||||||
other conditional), or a true @code{.if} followed by an @code{.else}, will be
|
other conditional), or a true @code{.if} followed by an @code{.else}, will be
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* listing.c - maintain assembly listings
|
/* listing.c - maintain assembly listings
|
||||||
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||||
2001, 2002, 2003, 2005, 2006, 2007
|
2001, 2002, 2003, 2005, 2006, 2007, 2008
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GAS, the GNU Assembler.
|
This file is part of GAS, the GNU Assembler.
|
||||||
@ -94,6 +94,8 @@
|
|||||||
#include "safe-ctype.h"
|
#include "safe-ctype.h"
|
||||||
#include "input-file.h"
|
#include "input-file.h"
|
||||||
#include "subsegs.h"
|
#include "subsegs.h"
|
||||||
|
#include "bfdver.h"
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#ifndef NO_LISTING
|
#ifndef NO_LISTING
|
||||||
|
|
||||||
@ -115,6 +117,7 @@
|
|||||||
#ifndef LISTING_LHS_CONT_LINES
|
#ifndef LISTING_LHS_CONT_LINES
|
||||||
#define LISTING_LHS_CONT_LINES 4
|
#define LISTING_LHS_CONT_LINES 4
|
||||||
#endif
|
#endif
|
||||||
|
#define MAX_DATELEN 30
|
||||||
|
|
||||||
/* This structure remembers which .s were used. */
|
/* This structure remembers which .s were used. */
|
||||||
typedef struct file_info_struct
|
typedef struct file_info_struct
|
||||||
@ -1056,8 +1059,93 @@ listing_listing (char *name ATTRIBUTE_UNUSED)
|
|||||||
data_buffer = NULL;
|
data_buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Print time stamp in ISO format: yyyy-mm-ddThh:mm:ss.ss+/-zzzz. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_timestamp (void)
|
||||||
|
{
|
||||||
|
const time_t now = time (NULL);
|
||||||
|
struct tm timestamp;
|
||||||
|
char stampstr[MAX_DATELEN];
|
||||||
|
|
||||||
|
/* Any portable way to obtain subsecond values??? */
|
||||||
|
localtime_r (&now, ×tamp);
|
||||||
|
strftime (stampstr, MAX_DATELEN, "%Y-%m-%dT%H:%M:%S.000%z", ×tamp);
|
||||||
|
fprintf (list_file, _("\n time stamp \t: %s\n\n"), stampstr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_single_option (char * opt, int *pos)
|
||||||
|
{
|
||||||
|
int opt_len = strlen (opt);
|
||||||
|
|
||||||
|
if ((*pos + opt_len) < paper_width)
|
||||||
|
{
|
||||||
|
fprintf (list_file, _("%s "), opt);
|
||||||
|
*pos = *pos + opt_len;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf (list_file, _("\n\t%s "), opt);
|
||||||
|
*pos = opt_len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Print options passed to as. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_options (char ** argv)
|
||||||
|
{
|
||||||
|
const char *field_name = _("\n options passed\t: ");
|
||||||
|
int pos = strlen (field_name);
|
||||||
|
char **p;
|
||||||
|
|
||||||
|
fprintf (list_file, field_name);
|
||||||
|
for (p = &argv[1]; *p != NULL; p++)
|
||||||
|
if (**p == '-')
|
||||||
|
{
|
||||||
|
/* Ignore these. */
|
||||||
|
if (strcmp (*p, "-o") == 0)
|
||||||
|
{
|
||||||
|
if (p[1] != NULL)
|
||||||
|
p++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (strcmp (*p, "-v") == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
print_single_option (*p, &pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Print a first section with basic info like file names, as version,
|
||||||
|
options passed, target, and timestamp.
|
||||||
|
The format of this section is as follows:
|
||||||
|
|
||||||
|
AS VERSION
|
||||||
|
|
||||||
|
fieldname TAB ':' fieldcontents
|
||||||
|
{ TAB fieldcontents-cont } */
|
||||||
|
|
||||||
|
static void
|
||||||
|
listing_general_info (char ** argv)
|
||||||
|
{
|
||||||
|
/* Print the stuff on the first line. */
|
||||||
|
eject = 1;
|
||||||
|
listing_page (0);
|
||||||
|
|
||||||
|
fprintf (list_file,
|
||||||
|
_(" GNU assembler version %s (%s)\n\t using BFD version %s."),
|
||||||
|
VERSION, TARGET_ALIAS, BFD_VERSION_STRING);
|
||||||
|
print_options (argv);
|
||||||
|
fprintf (list_file, _("\n input file \t: %s"), fn);
|
||||||
|
fprintf (list_file, _("\n output file \t: %s"), out_file_name);
|
||||||
|
fprintf (list_file, _("\n target \t: %s"), TARGET_CANONICAL);
|
||||||
|
print_timestamp ();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
listing_print (char *name)
|
listing_print (char *name, char **argv)
|
||||||
{
|
{
|
||||||
int using_stdout;
|
int using_stdout;
|
||||||
|
|
||||||
@ -1085,6 +1173,9 @@ listing_print (char *name)
|
|||||||
if (listing & LISTING_NOFORM)
|
if (listing & LISTING_NOFORM)
|
||||||
paper_height = 0;
|
paper_height = 0;
|
||||||
|
|
||||||
|
if (listing & LISTING_GENERAL)
|
||||||
|
listing_general_info (argv);
|
||||||
|
|
||||||
if (listing & LISTING_LISTING)
|
if (listing & LISTING_LISTING)
|
||||||
listing_listing (name);
|
listing_listing (name);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* This file is listing.h
|
/* This file is listing.h
|
||||||
Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1997, 1998,
|
Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1997, 1998,
|
||||||
2003, 2007 Free Software Foundation, Inc.
|
2003, 2007, 2008 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GAS, the GNU Assembler.
|
This file is part of GAS, the GNU Assembler.
|
||||||
|
|
||||||
@ -27,13 +27,14 @@
|
|||||||
#define LISTING_NOFORM 4
|
#define LISTING_NOFORM 4
|
||||||
#define LISTING_HLL 8
|
#define LISTING_HLL 8
|
||||||
#define LISTING_NODEBUG 16
|
#define LISTING_NODEBUG 16
|
||||||
#define LISTING_NOCOND 32
|
#define LISTING_NOCOND 32
|
||||||
#define LISTING_MACEXP 64
|
#define LISTING_MACEXP 64
|
||||||
|
#define LISTING_GENERAL 128
|
||||||
|
|
||||||
#define LISTING_DEFAULT (LISTING_LISTING | LISTING_HLL | LISTING_SYMBOLS)
|
#define LISTING_DEFAULT (LISTING_LISTING | LISTING_HLL | LISTING_SYMBOLS)
|
||||||
|
|
||||||
#ifndef NO_LISTING
|
#ifndef NO_LISTING
|
||||||
#define LISTING_NEWLINE() { if (listing) listing_newline(NULL); }
|
#define LISTING_NEWLINE() { if (listing) listing_newline (NULL); }
|
||||||
#else
|
#else
|
||||||
#define LISTING_NEWLINE() {;}
|
#define LISTING_NEWLINE() {;}
|
||||||
#endif
|
#endif
|
||||||
@ -48,7 +49,7 @@ void listing_flags (int);
|
|||||||
void listing_list (int on);
|
void listing_list (int on);
|
||||||
void listing_newline (char *ps);
|
void listing_newline (char *ps);
|
||||||
void listing_prev_line (void);
|
void listing_prev_line (void);
|
||||||
void listing_print (char *name);
|
void listing_print (char *, char **);
|
||||||
void listing_psize (int);
|
void listing_psize (int);
|
||||||
void listing_nopage (int);
|
void listing_nopage (int);
|
||||||
void listing_source_file (const char *);
|
void listing_source_file (const char *);
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2008-04-10 Santiago Urueña <suruena@gmail.com>
|
||||||
|
|
||||||
|
* gas/all/gas.exp: Check the performance of the -ag command line
|
||||||
|
switch.
|
||||||
|
|
||||||
2008-04-10 Andreas Krebbel <krebbel1@de.ibm.com>
|
2008-04-10 Andreas Krebbel <krebbel1@de.ibm.com>
|
||||||
|
|
||||||
* gas/s390/zarch-z10.d: Map the compare and branch variants
|
* gas/s390/zarch-z10.d: Map the compare and branch variants
|
||||||
|
@ -134,6 +134,31 @@ proc do_comment {} {
|
|||||||
|
|
||||||
do_comment
|
do_comment
|
||||||
|
|
||||||
|
# This test checks the output of the -ag switch. It must detect at least
|
||||||
|
# the name of the input file, output file, and options passed.
|
||||||
|
proc general_info_section {} {
|
||||||
|
set testname "general info section in listings"
|
||||||
|
set x1 0
|
||||||
|
set x2 0
|
||||||
|
set x3 0
|
||||||
|
set white {[ \t]*}
|
||||||
|
gas_start "comment.s" "-agn"
|
||||||
|
while 1 {
|
||||||
|
expect {
|
||||||
|
-re "^ \[^\n\]*\t: \-agn\[^\n\]*\n" { set x1 1 }
|
||||||
|
-re "^ \[^\n\]*\t: \[^\n\]*comment\.s\[^\n\]*\n" { set x2 1 }
|
||||||
|
-re "^ \[^\n\]*\t: a\.out\[^\n\]*\n" { set x3 1 }
|
||||||
|
-re "\[^\n\]*\n" { }
|
||||||
|
timeout { perror "timeout\n"; break }
|
||||||
|
eof { break }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gas_finish
|
||||||
|
if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname }
|
||||||
|
}
|
||||||
|
|
||||||
|
general_info_section
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test x930509a -- correct assembly of differences involving forward
|
# Test x930509a -- correct assembly of differences involving forward
|
||||||
# references.
|
# references.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user