[TCWG CI] Regression caused by gdb: objdump/opcodes: add syntax highlighting to disassembler output: commit 60a3da00bd5407f07d64dff82a4dae98230dfaac Author: Andrew Burgess objdump/opcodes: add syntax highlighting to disassembler output Results regressed to # reset_artifacts: -10 # true: 0 # build_abe binutils: 1 # build_abe stage1: 2 # build_abe linux: 3 # build_abe glibc: 4 # build_abe stage2: 5 # First few build errors in logs: # 00:01:01 /home/tcwg-buildslave/workspace/tcwg_gnu_1/abe/snapshots/gdb.git~master/sim/arm/../common/sim-trace.c:925:52: error: macro requires 4 arguments, but only 3 given # 00:01:01 /home/tcwg-buildslave/workspace/tcwg_gnu_1/abe/snapshots/gdb.git~master/sim/arm/wrapper.c:324:49: error: macro requires 4 arguments, but only 3 given # 00:01:01 checking for ANSI C header files... /home/tcwg-buildslave/workspace/tcwg_gnu_1/abe/snapshots/gdb.git~master/sim/arm/wrapper.c:324:3: error: ‘INIT_DISASSEMBLE_INFO’ undeclared (first use in this function) # 00:01:01 make[3]: *** [Makefile:505: sim-trace.o] Error 1 # 00:01:01 make[3]: *** [Makefile:505: wrapper.o] Error 1 # 00:01:01 make[2]: *** [Makefile:1929: all-recursive] Error 1 # 00:01:01 make[1]: *** [Makefile:1181: all] Error 2 # 00:01:01 make: *** [Makefile:9928: all-sim] Error 2 from # reset_artifacts: -10 # true: 0 # build_abe binutils: 1 # build_abe stage1: 2 # build_abe linux: 3 # build_abe glibc: 4 # build_abe stage2: 5 # build_abe gdb: 6 # build_abe qemu: 7 THIS IS THE END OF INTERESTING STUFF. BELOW ARE LINKS TO BUILDS, REPRODUCTION INSTRUCTIONS, AND THE RAW COMMIT. This commit has regressed these CI configurations: - tcwg_gnu_cross_build/master-arm First_bad build: https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-arm/27/artifact/artifacts/build-60a3da00bd5407f07d64dff82a4dae98230dfaac/ Last_good build: https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-arm/27/artifact/artifacts/build-ea6303b4971b0959329a1ae01648b16a4f4ac154/ Baseline build: https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-arm/27/artifact/artifacts/build-baseline/ Even more details: https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-arm/27/artifact/artifacts/ Reproduce builds: mkdir investigate-gdb-60a3da00bd5407f07d64dff82a4dae98230dfaac cd investigate-gdb-60a3da00bd5407f07d64dff82a4dae98230dfaac # Fetch scripts git clone https://git.linaro.org/toolchain/jenkins-scripts # Fetch manifests and test.sh script mkdir -p artifacts/manifests curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-arm/27/artifact/artifacts/manifests/build-baseline.sh --fail curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-arm/27/artifact/artifacts/manifests/build-parameters.sh --fail curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_gnu_cross_build-bisect-master-arm/27/artifact/artifacts/test.sh --fail chmod +x artifacts/test.sh # Reproduce the baseline build (build all pre-requisites) ./jenkins-scripts/tcwg_gnu-build.sh @@ artifacts/manifests/build-baseline.sh # Save baseline build state (which is then restored in artifacts/test.sh) mkdir -p ./bisect rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ --exclude /gdb/ ./ ./bisect/baseline/ cd gdb # Reproduce first_bad build git checkout --detach 60a3da00bd5407f07d64dff82a4dae98230dfaac ../artifacts/test.sh # Reproduce last_good build git checkout --detach ea6303b4971b0959329a1ae01648b16a4f4ac154 ../artifacts/test.sh cd .. Full commit (up to 1000 lines): commit 60a3da00bd5407f07d64dff82a4dae98230dfaac Author: Andrew Burgess Date: Sat Jan 22 11:38:18 2022 +0000 objdump/opcodes: add syntax highlighting to disassembler output This commit adds the _option_ of having disassembler output syntax highlighted in objdump. This option is _off_ by default. The new command line options are: --disassembler-color=off # The default. --disassembler-color=color --disassembler-color=extended-color I have implemented two colour modes, using the same option names as we use of --visualize-jumps, a basic 8-color mode ("color"), and an extended 8bit color mode ("extended-color"). The syntax highlighting requires that each targets disassembler be updated; each time the disassembler produces some output we now pass through an additional parameter indicating what style should be applied to the text. As updating all target disassemblers is a large task, the old API is maintained. And so, a user of the disassembler (i.e. objdump, gdb) must provide two functions, the current non-styled print function, and a new, styled print function. I don't currently have a plan for converting every single target disassembler, my hope is that interested folk will update the disassemblers they are interested in. But it is possible some might never get updated. In this initial series I intend to convert the RISC-V disassembler completely, and also do a partial conversion of the x86 disassembler. Hopefully having the x86 disassembler at least partial converted will allow more people to try this out easily and provide feedback. In this commit I have focused on objdump. The changes to GDB at this point are the bare minimum required to get things compiling, GDB makes no use of the styling information to provide any colors, that will come later, if this commit is accepted. This first commit in the series doesn't convert any target disassemblers at all (the next two commits will update some targets), so after this commit, the only color you will see in the disassembler output, is that produced from objdump itself, e.g. from objdump_print_addr_with_sym, where we print an address and a symbol name, these are now printed with styling information, and so will have colors applied (if the option is on). Finally, my ability to pick "good" colors is ... well, terrible. I'm in no way committed to the colors I've picked here, so I encourage people to suggest new colors, or wait for this commit to land, and then patch the choice of colors. I do have an idea about using possibly an environment variable to allow the objdump colors to be customised, but I haven't done anything like that in this commit, the color choices are just fixed in the code for now. binutils/ChangeLog: * NEWS: Mention new feature. * doc/binutils.texi (objdump): Describe --disassembler-color option. * objdump.c (disassembler_color): New global. (disassembler_extended_color): Likewise. (disassembler_in_comment): Likewise. (usage): Mention --disassembler-color option. (long_options): Add --disassembler-color option. (objdump_print_value): Use fprintf_styled_func instead of fprintf_func. (objdump_print_symname): Likewise. (objdump_print_addr_with_sym): Likewise. (objdump_color_for_disassembler_style): New function. (objdump_styled_sprintf): New function. (fprintf_styled): New function. (disassemble_jumps): Use disassemble_set_printf, and reset disassembler_in_comment. (null_styled_print): New function. (disassemble_bytes): Use disassemble_set_printf, and reset disassembler_in_comment. (disassemble_data): Update init_disassemble_info call. (main): Handle --disassembler-color option. include/ChangeLog: * dis-asm.h (enum disassembler_style): New enum. (struct disassemble_info): Add fprintf_styled_func field, and created_styled_output field. (disassemble_set_printf): Declare. (init_disassemble_info): Add additional parameter. (INIT_DISASSEMBLE_INFO): Add additional parameter. opcodes/ChangeLog: * dis-init.c (init_disassemble_info): Take extra parameter, initialize the new fprintf_styled_func and created_styled_output fields. * disassembler.c (disassemble_set_printf): New function definition. --- binutils/NEWS | 4 + binutils/doc/binutils.texi | 11 ++ binutils/objdump.c | 249 +++++++++++++++++++++++++++++++++++++++------ gdb/disasm.c | 34 ++++++- gdb/disasm.h | 7 ++ include/dis-asm.h | 88 +++++++++++++++- opcodes/dis-init.c | 5 +- opcodes/disassemble.c | 13 +++ 8 files changed, 371 insertions(+), 40 deletions(-) diff --git a/binutils/NEWS b/binutils/NEWS index 7e3c005f25c..c266bb9c3de 100644 --- a/binutils/NEWS +++ b/binutils/NEWS @@ -5,6 +5,10 @@ * objcopy --weaken, --weaken-symbol, and --weaken-symbols now make ELF STB_GNU_UNIQUE symbols weak. +* objdump now supports syntax highlighting of disassembler output for some + architectures. Use the --disassembler-color=MODE command line flag, with + mode being either off, color, or extended-color. + Changes in 2.38: * elfedit: Add --output-abiversion option to update ABIVERSION. diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index c73837ee27b..2c234c682aa 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -2270,6 +2270,7 @@ objdump [@option{-a}|@option{--archive-headers}] [@option{--prefix-strip=}@var{level}] [@option{--insn-width=}@var{width}] [@option{--visualize-jumps[=color|=extended-color|=off]} + [@option{--disassembler-color=[color|extended-color|off]} [@option{-U} @var{method}] [@option{--unicode=}@var{method}] [@option{-V}|@option{--version}] [@option{-H}|@option{--help}] @@ -2807,6 +2808,16 @@ If it is necessary to disable the @option{visualize-jumps} option after it has previously been enabled then use @option{visualize-jumps=off}. +@item --disassembler-color=[color|extended-color|off] +Apply syntax highlighting to the disassembler output. The +@option{color} argument adds color using simple terminal colors. +Alternatively the @option{extended-color} argument will use 8bit +colors, but these might not work on all terminals. + +If it is necessary to disable the @option{--disassembler-color} option +after it has previously been enabled then use +@option{--disassembler-color=off}. + @item -W[lLiaprmfFsoORtUuTgAckK] @itemx --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links] @include debug.options.texi diff --git a/binutils/objdump.c b/binutils/objdump.c index 8e1c9cb0c21..54c89a32db2 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -130,10 +130,19 @@ static bool visualize_jumps = false; /* --visualize-jumps. */ static bool color_output = false; /* --visualize-jumps=color. */ static bool extended_color_output = false; /* --visualize-jumps=extended-color. */ static int process_links = false; /* --process-links. */ +static bool disassembler_color = false; /* --disassembler-color=color. */ +static bool disassembler_extended_color = false; /* --disassembler-color=extended-color. */ static int dump_any_debugging; static int demangle_flags = DMGL_ANSI | DMGL_PARAMS; +/* This is reset to false each time we enter the disassembler, and set true + when the disassembler emits something in the dis_style_comment_start + style. Once this is true, all further output on that line is done in + the comment style. This only has an effect when disassembler coloring + is turned on. */ +static bool disassembler_in_comment = false; + /* A structure to record the sections mentioned in -j switches. */ struct only { @@ -396,6 +405,10 @@ usage (FILE *stream, int status) Use extended 8-bit color codes\n")); fprintf (stream, _("\ --visualize-jumps=off Disable jump visualization\n\n")); + fprintf (stream, _("\ + --disassembler-color=off Disable disassembler color output.\n\n")); + fprintf (stream, _("\ + --disassembler-color=color Use basic colors in disassembler output.\n\n")); list_supported_targets (program_name, stream); list_supported_architectures (program_name, stream); @@ -437,7 +450,8 @@ enum option_values OPTION_CTF, OPTION_CTF_PARENT, #endif - OPTION_VISUALIZE_JUMPS + OPTION_VISUALIZE_JUMPS, + OPTION_DISASSEMBLER_COLOR }; static struct option long_options[]= @@ -503,6 +517,7 @@ static struct option long_options[]= {"version", no_argument, NULL, 'V'}, {"visualize-jumps", optional_argument, 0, OPTION_VISUALIZE_JUMPS}, {"wide", no_argument, NULL, 'w'}, + {"disassembler-color", required_argument, NULL, OPTION_DISASSEMBLER_COLOR}, {NULL, no_argument, NULL, 0} }; @@ -1246,7 +1261,7 @@ objdump_print_value (bfd_vma vma, struct disassemble_info *inf, if (*p == '\0') --p; } - (*inf->fprintf_func) (inf->stream, "%s", p); + (*inf->fprintf_styled_func) (inf->stream, dis_style_address, "%s", p); } /* Print the name of a symbol. */ @@ -1280,10 +1295,11 @@ objdump_print_symname (bfd *abfd, struct disassemble_info *inf, if (inf != NULL) { - (*inf->fprintf_func) (inf->stream, "%s", name); + (*inf->fprintf_styled_func) (inf->stream, dis_style_symbol, "%s", name); if (version_string && *version_string != '\0') - (*inf->fprintf_func) (inf->stream, hidden ? "@%s" : "@@%s", - version_string); + (*inf->fprintf_styled_func) (inf->stream, dis_style_symbol, + hidden ? "@%s" : "@@%s", + version_string); } else { @@ -1545,31 +1561,33 @@ objdump_print_addr_with_sym (bfd *abfd, asection *sec, asymbol *sym, if (!no_addresses) { objdump_print_value (vma, inf, skip_zeroes); - (*inf->fprintf_func) (inf->stream, " "); + (*inf->fprintf_styled_func) (inf->stream, dis_style_text, " "); } if (sym == NULL) { bfd_vma secaddr; - (*inf->fprintf_func) (inf->stream, "<%s", - sanitize_string (bfd_section_name (sec))); + (*inf->fprintf_styled_func) (inf->stream, dis_style_text,"<"); + (*inf->fprintf_styled_func) (inf->stream, dis_style_symbol, "%s", + sanitize_string (bfd_section_name (sec))); secaddr = bfd_section_vma (sec); if (vma < secaddr) { - (*inf->fprintf_func) (inf->stream, "-0x"); + (*inf->fprintf_styled_func) (inf->stream, dis_style_immediate, + "-0x"); objdump_print_value (secaddr - vma, inf, true); } else if (vma > secaddr) { - (*inf->fprintf_func) (inf->stream, "+0x"); + (*inf->fprintf_styled_func) (inf->stream, dis_style_immediate, "+0x"); objdump_print_value (vma - secaddr, inf, true); } - (*inf->fprintf_func) (inf->stream, ">"); + (*inf->fprintf_styled_func) (inf->stream, dis_style_text, ">"); } else { - (*inf->fprintf_func) (inf->stream, "<"); + (*inf->fprintf_styled_func) (inf->stream, dis_style_text, "<"); objdump_print_symname (abfd, inf, sym); @@ -1586,21 +1604,22 @@ objdump_print_addr_with_sym (bfd *abfd, asection *sec, asymbol *sym, ; else if (bfd_asymbol_value (sym) > vma) { - (*inf->fprintf_func) (inf->stream, "-0x"); + (*inf->fprintf_styled_func) (inf->stream, dis_style_immediate,"-0x"); objdump_print_value (bfd_asymbol_value (sym) - vma, inf, true); } else if (vma > bfd_asymbol_value (sym)) { - (*inf->fprintf_func) (inf->stream, "+0x"); + (*inf->fprintf_styled_func) (inf->stream, dis_style_immediate, "+0x"); objdump_print_value (vma - bfd_asymbol_value (sym), inf, true); } - (*inf->fprintf_func) (inf->stream, ">"); + (*inf->fprintf_styled_func) (inf->stream, dis_style_text, ">"); } if (display_file_offsets) - inf->fprintf_func (inf->stream, _(" (File Offset: 0x%lx)"), - (long int)(sec->filepos + (vma - sec->vma))); + inf->fprintf_styled_func (inf->stream, dis_style_text, + _(" (File Offset: 0x%lx)"), + (long int)(sec->filepos + (vma - sec->vma))); } /* Print an address (VMA), symbolically if possible. @@ -2127,6 +2146,143 @@ objdump_sprintf (SFILE *f, const char *format, ...) return n; } +/* Return an integer greater than, or equal to zero, representing the color + for STYLE, or -1 if no color should be used. */ + +static int +objdump_color_for_disassembler_style (enum disassembler_style style) +{ + int color = -1; + + if (style == dis_style_comment_start) + disassembler_in_comment = true; + + if (disassembler_color) + { + if (disassembler_in_comment) + return color; + + switch (style) + { + case dis_style_symbol: color = 32; break; + case dis_style_assembler_directive: + case dis_style_mnemonic: color = 33; break; + case dis_style_register: color = 34; break; + case dis_style_address: + case dis_style_address_offset: + case dis_style_immediate: color = 35; break; + default: + case dis_style_text: color = -1; break; + } + } + else if (disassembler_extended_color) + { + if (disassembler_in_comment) + return 250; + + switch (style) + { + case dis_style_symbol: color = 40; break; + case dis_style_assembler_directive: + case dis_style_mnemonic: color = 142; break; + case dis_style_register: color = 27; break; + case dis_style_address: + case dis_style_address_offset: + case dis_style_immediate: color = 134; break; + default: + case dis_style_text: color = -1; break; + } + } + + return color; +} + +/* Like objdump_sprintf, but add in escape sequences to highlight the + content according to STYLE. */ + +static int ATTRIBUTE_PRINTF_3 +objdump_styled_sprintf (SFILE *f, enum disassembler_style style, + const char *format, ...) +{ + size_t n; + va_list args; + int color = objdump_color_for_disassembler_style (style); + + if (color >= 0) + { + while (1) + { + size_t space = f->alloc - f->pos; + + if (disassembler_color) + n = snprintf (f->buffer + f->pos, space, "\033[%dm", color); + else + n = snprintf (f->buffer + f->pos, space, "\033[38;5;%dm", color); + if (space > n) + break; + + f->alloc = (f->alloc + n) * 2; + f->buffer = (char *) xrealloc (f->buffer, f->alloc); + } + f->pos += n; + } + + while (1) + { + size_t space = f->alloc - f->pos; + + va_start (args, format); + n = vsnprintf (f->buffer + f->pos, space, format, args); + va_end (args); + + if (space > n) + break; + + f->alloc = (f->alloc + n) * 2; + f->buffer = (char *) xrealloc (f->buffer, f->alloc); + } + f->pos += n; + + if (color >= 0) + { + while (1) + { + size_t space = f->alloc - f->pos; + + n = snprintf (f->buffer + f->pos, space, "\033[0m"); + + if (space > n) + break; + + f->alloc = (f->alloc + n) * 2; + f->buffer = (char *) xrealloc (f->buffer, f->alloc); + } + f->pos += n; + } + + return n; +} + +/* We discard the styling information here. This function is only used + when objdump is printing auxiliary information, the symbol headers, and + disassembly address, or the bytes of the disassembled instruction. We + don't (currently) apply styling to any of this stuff, so, for now, just + print the content with no additional style added. */ + +static int ATTRIBUTE_PRINTF_3 +fprintf_styled (FILE *f, enum disassembler_style style ATTRIBUTE_UNUSED, + const char *fmt, ...) +{ + int res; + va_list ap; + + va_start (ap, fmt); + res = vfprintf (f, fmt, ap); + va_end (ap); + + return res; +} + /* Code for generating (colored) diagrams of control flow start and end points. */ @@ -2558,8 +2714,8 @@ disassemble_jumps (struct disassemble_info * inf, sfile.pos = 0; inf->insn_info_valid = 0; - inf->fprintf_func = (fprintf_ftype) objdump_sprintf; - inf->stream = &sfile; + disassemble_set_printf (inf, &sfile, (fprintf_ftype) objdump_sprintf, + (fprintf_styled_ftype) objdump_styled_sprintf); addr_offset = start_offset; while (addr_offset < stop_offset) @@ -2621,6 +2777,7 @@ disassemble_jumps (struct disassemble_info * inf, /* Extract jump information. */ inf->insn_info_valid = 0; + disassembler_in_comment = false; octets = (*disassemble_fn) (section->vma + addr_offset, inf); /* Test if a jump was detected. */ if (inf->insn_info_valid @@ -2641,9 +2798,8 @@ disassemble_jumps (struct disassemble_info * inf, addr_offset += octets / opb; } - inf->fprintf_func = (fprintf_ftype) fprintf; - inf->stream = stdout; - + disassemble_set_printf (inf, (void *) stdout, (fprintf_ftype) fprintf, + (fprintf_styled_ftype) fprintf_styled); free (sfile.buffer); /* Merge jumps. */ @@ -2736,6 +2892,17 @@ null_print (const void * stream ATTRIBUTE_UNUSED, const char * format ATTRIBUTE_ return 1; } +/* Like null_print, but takes the extra STYLE argument. As this is not + going to print anything, the extra argument is just ignored. */ + +static int +null_styled_print (const void * stream ATTRIBUTE_UNUSED, + enum disassembler_style style ATTRIBUTE_UNUSED, + const char * format ATTRIBUTE_UNUSED, ...) +{ + return 1; +} + /* Print out jump visualization. */ static void @@ -2946,8 +3113,9 @@ disassemble_bytes (struct disassemble_info *inf, int insn_size; sfile.pos = 0; - inf->fprintf_func = (fprintf_ftype) objdump_sprintf; - inf->stream = &sfile; + disassemble_set_printf + (inf, &sfile, (fprintf_ftype) objdump_sprintf, + (fprintf_styled_ftype) objdump_styled_sprintf); inf->bytes_per_line = 0; inf->bytes_per_chunk = 0; inf->flags = ((disassemble_all ? DISASSEMBLE_DATA : 0) @@ -2989,10 +3157,15 @@ disassemble_bytes (struct disassemble_info *inf, twice, but we only do this when there is a high probability that there is a reloc that will affect the instruction. */ - inf->fprintf_func = (fprintf_ftype) null_print; + disassemble_set_printf + (inf, inf->stream, (fprintf_ftype) null_print, + (fprintf_styled_ftype) null_styled_print); insn_size = disassemble_fn (section->vma + addr_offset, inf); - inf->fprintf_func = (fprintf_ftype) objdump_sprintf; + disassemble_set_printf + (inf, inf->stream, + (fprintf_ftype) objdump_sprintf, + (fprintf_styled_ftype) objdump_styled_sprintf); } } @@ -3017,12 +3190,13 @@ disassemble_bytes (struct disassemble_info *inf, inf->stop_vma = section->vma + stop_offset; inf->stop_offset = stop_offset; + disassembler_in_comment = false; insn_size = (*disassemble_fn) (section->vma + addr_offset, inf); octets = insn_size; inf->stop_vma = 0; - inf->fprintf_func = (fprintf_ftype) fprintf; - inf->stream = stdout; + disassemble_set_printf (inf, stdout, (fprintf_ftype) fprintf, + (fprintf_styled_ftype) fprintf_styled); if (insn_width == 0 && inf->bytes_per_line != 0) octets_per_line = inf->bytes_per_line; if (insn_size < (int) opb) @@ -3583,8 +3757,9 @@ disassemble_section (bfd *abfd, asection *section, void *inf) sf.alloc = strlen (sym->name) + 40; sf.buffer = (char*) xmalloc (sf.alloc); sf.pos = 0; - di.fprintf_func = (fprintf_ftype) objdump_sprintf; - di.stream = &sf; + disassemble_set_printf + (&di, &sf, (fprintf_ftype) objdump_sprintf, + (fprintf_styled_ftype) objdump_styled_sprintf); objdump_print_symname (abfd, &di, sym); @@ -3653,8 +3828,8 @@ disassemble_data (bfd *abfd) ++sorted_symcount; } - init_disassemble_info (&disasm_info, stdout, (fprintf_ftype) fprintf); - + init_disassemble_info (&disasm_info, stdout, (fprintf_ftype) fprintf, + (fprintf_styled_ftype) fprintf_styled); disasm_info.application_data = (void *) &aux; aux.abfd = abfd; aux.require_sec = false; @@ -5495,6 +5670,16 @@ main (int argc, char **argv) nonfatal (_("unrecognized argument to --visualize-option")); } break; + case OPTION_DISASSEMBLER_COLOR: + if (streq (optarg, "off")) + disassembler_color = false; + else if (streq (optarg, "color")) + disassembler_color = true; + else if (streq (optarg, "extended-color")) + disassembler_extended_color = true; + else + nonfatal (_("unrecognized argument to --disassembler-color")); + break; case 'E': if (strcmp (optarg, "B") == 0) endian = BFD_ENDIAN_BIG; diff --git a/gdb/disasm.c b/gdb/disasm.c index 24d757aec33..8b6d9db7e84 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -177,6 +177,22 @@ gdb_disassembler::dis_asm_fprintf (void *stream, const char *format, ...) return 0; } +/* See disasm.h. */ + +int +gdb_disassembler::dis_asm_styled_fprintf (void *stream, + enum disassembler_style style, + const char *format, ...) +{ + va_list args; + + va_start (args, format); + vfprintf_filtered ((struct ui_file *) stream, format, args); + va_end (args); + /* Something non -ve. */ + return 0; +} + static bool line_is_less_than (const deprecated_dis_line_entry &mle1, const deprecated_dis_line_entry &mle2) @@ -787,7 +803,8 @@ gdb_disassembler::gdb_disassembler (struct gdbarch *gdbarch, && file->can_emit_style_escape ()), m_dest (file) { - init_disassemble_info (&m_di, &m_buffer, dis_asm_fprintf); + init_disassemble_info (&m_di, &m_buffer, dis_asm_fprintf, + dis_asm_styled_fprintf); m_di.flavour = bfd_target_unknown_flavour; m_di.memory_error_func = dis_asm_memory_error; m_di.print_address_func = dis_asm_print_address; @@ -954,12 +971,25 @@ gdb_disasm_null_printf (void *stream, const char *format, ...) return 0; } +/* An fprintf-function for use by the disassembler when we know we don't + want to print anything, and the disassembler is using style. Always + returns success. */ + +static int ATTRIBUTE_PRINTF (3, 4) +gdb_disasm_null_styled_printf (void *stream, + enum disassembler_style style, + const char *format, ...) +{ + return 0; +} + /* See disasm.h. */ void init_disassemble_info_for_no_printing (struct disassemble_info *dinfo) { - init_disassemble_info (dinfo, nullptr, gdb_disasm_null_printf); + init_disassemble_info (dinfo, nullptr, gdb_disasm_null_printf, + gdb_disasm_null_styled_printf); } /* Initialize a struct disassemble_info for gdb_buffered_insn_length. diff --git a/gdb/disasm.h b/gdb/disasm.h index 399afc5ae71..b71cd097a16 100644 --- a/gdb/disasm.h +++ b/gdb/disasm.h @@ -110,6 +110,13 @@ class gdb_disassembler static int dis_asm_fprintf (void *stream, const char *format, ...) ATTRIBUTE_PRINTF(2,3); + /* Print formatted message to STREAM, the content can be styled based on + STYLE if desired. */ + static int dis_asm_styled_fprintf (void *stream, + enum disassembler_style style, + const char *format, ...) + ATTRIBUTE_PRINTF(3,4); + static int dis_asm_read_memory (bfd_vma memaddr, gdb_byte *myaddr, unsigned int len, struct disassemble_info *info); diff --git a/include/dis-asm.h b/include/dis-asm.h index 317592448a2..4f91df12498 100644 --- a/include/dis-asm.h +++ b/include/dis-asm.h @@ -35,8 +35,6 @@ extern "C" { #include #include "bfd.h" - typedef int (*fprintf_ftype) (void *, const char*, ...) ATTRIBUTE_FPTR_PRINTF_2; - enum dis_insn_type { dis_noninsn, /* Not a valid instruction. */ @@ -49,6 +47,76 @@ enum dis_insn_type dis_dref2 /* Two data references in instruction. */ }; +/* When printing styled disassembler output, this describes what style + should be used. */ + +enum disassembler_style +{ + /* This is the default style, use this for any additional syntax + (e.g. commas between operands, brackets, etc), or just as a default if + no other style seems appropriate. */ + dis_style_text, + + /* Use this for all instruction mnemonics, or aliases for mnemonics. + These should be things that correspond to real machine + instructions. */ + dis_style_mnemonic, + + /* For things that aren't real machine instructions, but rather + assembler directives, e.g. .byte, etc. */ + dis_style_assembler_directive, + + /* Use this for any register names. This may or may-not include any + register prefix, e.g. '$', '%', at the discretion of the target, + though within each target the choice to include prefixes for not + should be kept consistent. If the prefix is not printed with this + style, then dis_style_text should be used. */ + dis_style_register, + + /* Use this for any constant values used within instructions or + directives, unless the value is an absolute address, or an offset + that will be added to an address (no matter where the address comes + from) before use. This style may, or may-not be used for any + prefix to the immediate value, e.g. '$', at the discretion of the + target, though within each target the choice to include these + prefixes should be kept consistent. */ + dis_style_immediate, + + /* The style for the numerical representation of an absolute address. + Anything that is an address offset should use the immediate style. + This style may, or may-not be used for any prefix to the immediate + value, e.g. '$', at the discretion of the target, though within + each target the choice to include these prefixes should be kept + consistent. */ + dis_style_address, + + /* The style for any constant value within an instruction or directive + that represents an offset that will be added to an address before + use. This style may, or may-not be used for any prefix to the + immediate value, e.g. '$', at the discretion of the target, though + within each target the choice to include these prefixes should be + kept consistent. */ + dis_style_address_offset, + + /* The style for a symbol's name. The numerical address of a symbol + should use the address style above, this style is reserved for the + name. */ + dis_style_symbol, + + /* The start of a comment that runs to the end of the line. Anything + printed after a comment start might be styled differently, + e.g. everything might be styled as a comment, regardless of the + actual style used. The disassembler itself should not try to adjust + the style emitted for comment content, e.g. an address emitted within + a comment should still be given dis_style_address, in this way it is + up to the user of the disassembler to decide how comments should be + styled. */ + dis_style_comment_start +}; + +typedef int (*fprintf_ftype) (void *, const char*, ...) ATTRIBUTE_FPTR_PRINTF_2; +typedef int (*fprintf_styled_ftype) (void *, enum disassembler_style, const char*, ...) ATTRIBUTE_FPTR_PRINTF_3; + /* This struct is passed into the instruction decoding routine, and is passed back out into each callback. The various fields are used for conveying information from your main routine into your callbacks, @@ -62,6 +130,7 @@ enum dis_insn_type typedef struct disassemble_info { fprintf_ftype fprintf_func; + fprintf_styled_ftype fprintf_styled_func; void *stream; void *application_data; @@ -228,6 +297,9 @@ typedef struct disassemble_info disassembling such as the way mapping symbols are found on AArch64. */ bfd_vma stop_offset; + /* Set to true if the disassembler applied styling to the output, + otherwise, set to false. */ + bool created_styled_output; } disassemble_info; /* This struct is used to pass information about valid disassembler @@ -337,6 +409,10 @@ extern void disassemble_init_for_target (struct disassemble_info *); /* Tidy any memory allocated by targets, such as info->private_data. */ extern void disassemble_free_target (struct disassemble_info *); +/* Set the basic disassembler print functions. */ +extern void disassemble_set_printf (struct disassemble_info *, void *, + fprintf_ftype, fprintf_styled_ftype); + /* Document any target specific options available from the disassembler. */ extern void disassembler_usage (FILE *); @@ -394,11 +470,13 @@ extern bool generic_symbol_is_valid /* Method to initialize a disassemble_info struct. This should be called by all applications creating such a struct. */ extern void init_disassemble_info (struct disassemble_info *dinfo, void *stream, - fprintf_ftype fprintf_func); + fprintf_ftype fprintf_func, + fprintf_styled_ftype fprintf_styled_func); /* For compatibility with existing code. */ -#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC) \ - init_disassemble_info (&(INFO), (STREAM), (fprintf_ftype) (FPRINTF_FUNC)) +#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC, FPRINTF_STYLED_FUNC) \ + init_disassemble_info (&(INFO), (STREAM), (fprintf_ftype) (FPRINTF_FUNC), \ + (fprintf_styled_ftype) (FPRINTF_STYLED_FUNC)) #ifdef __cplusplus } diff --git a/opcodes/dis-init.c b/opcodes/dis-init.c index 0b171c0f36d..59039ef8b11 100644 --- a/opcodes/dis-init.c +++ b/opcodes/dis-init.c @@ -25,7 +25,8 @@ void init_disassemble_info (struct disassemble_info *info, void *stream, - fprintf_ftype fprintf_func) + fprintf_ftype fprintf_func, + fprintf_styled_ftype fprintf_styled_func) { memset (info, 0, sizeof (*info)); @@ -35,6 +36,7 @@ init_disassemble_info (struct disassemble_info *info, void *stream, info->endian_code = info->endian; info->octets_per_byte = 1; info->fprintf_func = fprintf_func; + info->fprintf_styled_func = fprintf_styled_func; info->stream = stream; info->read_memory_func = buffer_read_memory; info->memory_error_func = perror_memory; @@ -42,5 +44,6 @@ init_disassemble_info (struct disassemble_info *info, void *stream, info->symbol_at_address_func = generic_symbol_at_address; info->symbol_is_valid = generic_symbol_is_valid; info->display_endian = BFD_ENDIAN_UNKNOWN; + info->created_styled_output = false; } diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c index 1f1fde7ae8f..7325394d985 100644 --- a/opcodes/disassemble.c +++ b/opcodes/disassemble.c @@ -858,3 +858,16 @@ opcodes_assert (const char *file, int line) opcodes_error_handler (_("Please report this bug")); abort (); } + +/* Set the stream, and the styled and unstyled printf functions within + INFO. */ + +void +disassemble_set_printf (struct disassemble_info *info, void *stream, + fprintf_ftype unstyled_printf, + fprintf_styled_ftype styled_printf) +{ + info->stream = stream; + info->fprintf_func = unstyled_printf; + info->fprintf_styled_func = styled_printf; +} >From ci_notify@linaro.org Mon Apr 4 20:01:26 2022 Return-Path: X-Original-To: gcc-regression@gcc.gnu.org Delivered-To: gcc-regression@gcc.gnu.org Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id A59073857823 for ; Mon, 4 Apr 2022 20:01:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A59073857823 Received: by mail-wr1-x433.google.com with SMTP id z1so3881382wrg.4 for ; Mon, 04 Apr 2022 13:01:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d100.net; s 210112; h=x-gm-message-state:from:date:to:cc:message-id:subject:mime-version :list-id; bh=bVPwOo+q3R5u5Qb0Ad9SLUfod8NNy5WI3Qqf56m2sBc=; b=ixNcDosVy/+5zyEdIRO2Aj/zHcJe+6qNTPZiIQwlM43RQt5PUtK7MHe6GetZRE5F5x CA8WJoP1Gg1bW5l0Q9yUA8N3wEHopQR+Eq7R3nHIeN4gFrdAv87BbQoADKljtFv+5Dim 7cJL+8unMvNYyLouZffmThu1uwa9jzBG+3eCl5H7HkiUXEqBoJo22gffz4bUx2/6oTgl 4V/UVMO20KTjY/RCDe9eQg4XOaowDtQUb9NnYp5Ad7KNbbEbh8deCh99+UIZpi/a9Fmy 5UrsLyuhE362E74/yvZZFOPVE7sNJ46arbf6Wuz3hRU24doeu3zaJVqR6FrX2vC6PkEB CkQw=X-Gm-Message-State: AOAM530M4mVKR/saL/kcBMk3wtsHIZnQgStS4xcXQxm4nTKOC8tKRZS0 sdkQhk0+Em6EX4V2Qbvca3zuuA=X-Google-Smtp-Source: ABdhPJxO74AVZ54iI6/fNQ4UZ+7a/jFXLYg4JjLVbQqRBmeGgforp0zoFhiw1DME7ep2evDm+I0d1g=X-Received: by 2002:adf:fd05:0:b0:206:ce2:3dd2 with SMTP id e5-20020adffd05000000b002060ce23dd2mr1048222wrr.312.1649102480056; Mon, 04 Apr 2022 13:01:20 -0700 (PDT) Received: from jenkins.jenkins (ci.linaro.org. [88.99.136.175]) by smtp.gmail.com with ESMTPSA id f13-20020adff58d000000b002060e84bcc9sm4405238wro.44.2022.04.04.13.01.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits%6/256); Mon, 04 Apr 2022 13:01:18 -0700 (PDT) From: ci_notify@linaro.org X-Google-Original-From: linaro-infrastructure-errors@lists.linaro.org Date: Mon, 4 Apr 2022 20:01:17 +0000 (UTC) To: Andrew Burgess Cc: gcc-regression@gcc.gnu.org Message-ID: <70574287.7242.1649102478952@jenkins.jenkins> Subject: [TCWG CI] Regression caused by gdb: objdump/opcodes: add syntax highlighting to disassembler output MIME-Version: 1.0 X-Jenkins-Job: TCWG Bisect tcwg_gnu_native_build/master-arm X-Jenkins-Result: SUCCESS X-Spam-Status: No, score=-10.1 required=5.0 testsºYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH, KAM_SOMETLD_ARE_BAD_TLD, PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-regression@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-regression mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2022 20:01:26 -0000 [TCWG CI] Regression caused by gdb: objdump/opcodes: add syntax highlighting to disassembler output: commit 60a3da00bd5407f07d64dff82a4dae98230dfaac Author: Andrew Burgess objdump/opcodes: add syntax highlighting to disassembler output Results regressed to # reset_artifacts: -10 # true: 0 # build_abe binutils: 1 # build_abe gcc: 2 # build_abe linux: 4 # build_abe glibc: 5 # First few build errors in logs: # 00:01:01 /home/tcwg-buildslave/workspace/tcwg_gnu_10/abe/snapshots/gdb.git~master/sim/arm/../common/sim-trace.c:925:52: error: macro requires 4 arguments, but only 3 given # 00:01:01 /home/tcwg-buildslave/workspace/tcwg_gnu_10/abe/snapshots/gdb.git~master/sim/arm/wrapper.c:324:49: error: macro requires 4 arguments, but only 3 given # 00:01:01 /home/tcwg-buildslave/workspace/tcwg_gnu_10/abe/snapshots/gdb.git~master/sim/arm/../common/sim-trace.c:925:7: error: ‘INIT_DISASSEMBLE_INFO’ undeclared (first use in this function) # 00:01:01 /home/tcwg-buildslave/workspace/tcwg_gnu_10/abe/snapshots/gdb.git~master/sim/arm/wrapper.c:324:3: error: ‘INIT_DISASSEMBLE_INFO’ undeclared (first use in this function) # 00:01:01 make[3]: *** [Makefile:505: sim-trace.o] Error 1 # 00:01:01 make[3]: *** [Makefile:505: wrapper.o] Error 1 # 00:01:01 make[2]: *** [Makefile:1929: all-recursive] Error 1 # 00:01:01 make[1]: *** [Makefile:1181: all] Error 2 # 00:01:01 make: *** [Makefile:9928: all-sim] Error 2 from # reset_artifacts: -10 # true: 0 # build_abe binutils: 1 # build_abe gcc: 2 # build_abe linux: 4 # build_abe glibc: 5 # build_abe gdb: 6 THIS IS THE END OF INTERESTING STUFF. BELOW ARE LINKS TO BUILDS, REPRODUCTION INSTRUCTIONS, AND THE RAW COMMIT. This commit has regressed these CI configurations: - tcwg_gnu_native_build/master-arm First_bad build: https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-arm/8/artifact/artifacts/build-60a3da00bd5407f07d64dff82a4dae98230dfaac/ Last_good build: https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-arm/8/artifact/artifacts/build-ea6303b4971b0959329a1ae01648b16a4f4ac154/ Baseline build: https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-arm/8/artifact/artifacts/build-baseline/ Even more details: https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-arm/8/artifact/artifacts/ Reproduce builds: mkdir investigate-gdb-60a3da00bd5407f07d64dff82a4dae98230dfaac cd investigate-gdb-60a3da00bd5407f07d64dff82a4dae98230dfaac # Fetch scripts git clone https://git.linaro.org/toolchain/jenkins-scripts # Fetch manifests and test.sh script mkdir -p artifacts/manifests curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-arm/8/artifact/artifacts/manifests/build-baseline.sh --fail curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-arm/8/artifact/artifacts/manifests/build-parameters.sh --fail curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_gnu_native_build-bisect-master-arm/8/artifact/artifacts/test.sh --fail chmod +x artifacts/test.sh # Reproduce the baseline build (build all pre-requisites) ./jenkins-scripts/tcwg_gnu-build.sh @@ artifacts/manifests/build-baseline.sh # Save baseline build state (which is then restored in artifacts/test.sh) mkdir -p ./bisect rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ --exclude /gdb/ ./ ./bisect/baseline/ cd gdb # Reproduce first_bad build git checkout --detach 60a3da00bd5407f07d64dff82a4dae98230dfaac ../artifacts/test.sh # Reproduce last_good build git checkout --detach ea6303b4971b0959329a1ae01648b16a4f4ac154 ../artifacts/test.sh cd .. Full commit (up to 1000 lines): commit 60a3da00bd5407f07d64dff82a4dae98230dfaac Author: Andrew Burgess Date: Sat Jan 22 11:38:18 2022 +0000 objdump/opcodes: add syntax highlighting to disassembler output This commit adds the _option_ of having disassembler output syntax highlighted in objdump. This option is _off_ by default. The new command line options are: --disassembler-color=off # The default. --disassembler-color=color --disassembler-color=extended-color I have implemented two colour modes, using the same option names as we use of --visualize-jumps, a basic 8-color mode ("color"), and an extended 8bit color mode ("extended-color"). The syntax highlighting requires that each targets disassembler be updated; each time the disassembler produces some output we now pass through an additional parameter indicating what style should be applied to the text. As updating all target disassemblers is a large task, the old API is maintained. And so, a user of the disassembler (i.e. objdump, gdb) must provide two functions, the current non-styled print function, and a new, styled print function. I don't currently have a plan for converting every single target disassembler, my hope is that interested folk will update the disassemblers they are interested in. But it is possible some might never get updated. In this initial series I intend to convert the RISC-V disassembler completely, and also do a partial conversion of the x86 disassembler. Hopefully having the x86 disassembler at least partial converted will allow more people to try this out easily and provide feedback. In this commit I have focused on objdump. The changes to GDB at this point are the bare minimum required to get things compiling, GDB makes no use of the styling information to provide any colors, that will come later, if this commit is accepted. This first commit in the series doesn't convert any target disassemblers at all (the next two commits will update some targets), so after this commit, the only color you will see in the disassembler output, is that produced from objdump itself, e.g. from objdump_print_addr_with_sym, where we print an address and a symbol name, these are now printed with styling information, and so will have colors applied (if the option is on). Finally, my ability to pick "good" colors is ... well, terrible. I'm in no way committed to the colors I've picked here, so I encourage people to suggest new colors, or wait for this commit to land, and then patch the choice of colors. I do have an idea about using possibly an environment variable to allow the objdump colors to be customised, but I haven't done anything like that in this commit, the color choices are just fixed in the code for now. binutils/ChangeLog: * NEWS: Mention new feature. * doc/binutils.texi (objdump): Describe --disassembler-color option. * objdump.c (disassembler_color): New global. (disassembler_extended_color): Likewise. (disassembler_in_comment): Likewise. (usage): Mention --disassembler-color option. (long_options): Add --disassembler-color option. (objdump_print_value): Use fprintf_styled_func instead of fprintf_func. (objdump_print_symname): Likewise. (objdump_print_addr_with_sym): Likewise. (objdump_color_for_disassembler_style): New function. (objdump_styled_sprintf): New function. (fprintf_styled): New function. (disassemble_jumps): Use disassemble_set_printf, and reset disassembler_in_comment. (null_styled_print): New function. (disassemble_bytes): Use disassemble_set_printf, and reset disassembler_in_comment. (disassemble_data): Update init_disassemble_info call. (main): Handle --disassembler-color option. include/ChangeLog: * dis-asm.h (enum disassembler_style): New enum. (struct disassemble_info): Add fprintf_styled_func field, and created_styled_output field. (disassemble_set_printf): Declare. (init_disassemble_info): Add additional parameter. (INIT_DISASSEMBLE_INFO): Add additional parameter. opcodes/ChangeLog: * dis-init.c (init_disassemble_info): Take extra parameter, initialize the new fprintf_styled_func and created_styled_output fields. * disassembler.c (disassemble_set_printf): New function definition. --- binutils/NEWS | 4 + binutils/doc/binutils.texi | 11 ++ binutils/objdump.c | 249 +++++++++++++++++++++++++++++++++++++++------ gdb/disasm.c | 34 ++++++- gdb/disasm.h | 7 ++ include/dis-asm.h | 88 +++++++++++++++- opcodes/dis-init.c | 5 +- opcodes/disassemble.c | 13 +++ 8 files changed, 371 insertions(+), 40 deletions(-) diff --git a/binutils/NEWS b/binutils/NEWS index 7e3c005f25c..c266bb9c3de 100644 --- a/binutils/NEWS +++ b/binutils/NEWS @@ -5,6 +5,10 @@ * objcopy --weaken, --weaken-symbol, and --weaken-symbols now make ELF STB_GNU_UNIQUE symbols weak. +* objdump now supports syntax highlighting of disassembler output for some + architectures. Use the --disassembler-color=MODE command line flag, with + mode being either off, color, or extended-color. + Changes in 2.38: * elfedit: Add --output-abiversion option to update ABIVERSION. diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index c73837ee27b..2c234c682aa 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -2270,6 +2270,7 @@ objdump [@option{-a}|@option{--archive-headers}] [@option{--prefix-strip=}@var{level}] [@option{--insn-width=}@var{width}] [@option{--visualize-jumps[=color|=extended-color|=off]} + [@option{--disassembler-color=[color|extended-color|off]} [@option{-U} @var{method}] [@option{--unicode=}@var{method}] [@option{-V}|@option{--version}] [@option{-H}|@option{--help}] @@ -2807,6 +2808,16 @@ If it is necessary to disable the @option{visualize-jumps} option after it has previously been enabled then use @option{visualize-jumps=off}. +@item --disassembler-color=[color|extended-color|off] +Apply syntax highlighting to the disassembler output. The +@option{color} argument adds color using simple terminal colors. +Alternatively the @option{extended-color} argument will use 8bit +colors, but these might not work on all terminals. + +If it is necessary to disable the @option{--disassembler-color} option +after it has previously been enabled then use +@option{--disassembler-color=off}. + @item -W[lLiaprmfFsoORtUuTgAckK] @itemx --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links] @include debug.options.texi diff --git a/binutils/objdump.c b/binutils/objdump.c index 8e1c9cb0c21..54c89a32db2 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -130,10 +130,19 @@ static bool visualize_jumps = false; /* --visualize-jumps. */ static bool color_output = false; /* --visualize-jumps=color. */ static bool extended_color_output = false; /* --visualize-jumps=extended-color. */ static int process_links = false; /* --process-links. */ +static bool disassembler_color = false; /* --disassembler-color=color. */ +static bool disassembler_extended_color = false; /* --disassembler-color=extended-color. */ static int dump_any_debugging; static int demangle_flags = DMGL_ANSI | DMGL_PARAMS; +/* This is reset to false each time we enter the disassembler, and set true + when the disassembler emits something in the dis_style_comment_start + style. Once this is true, all further output on that line is done in + the comment style. This only has an effect when disassembler coloring + is turned on. */ +static bool disassembler_in_comment = false; + /* A structure to record the sections mentioned in -j switches. */ struct only { @@ -396,6 +405,10 @@ usage (FILE *stream, int status) Use extended 8-bit color codes\n")); fprintf (stream, _("\ --visualize-jumps=off Disable jump visualization\n\n")); + fprintf (stream, _("\ + --disassembler-color=off Disable disassembler color output.\n\n")); + fprintf (stream, _("\ + --disassembler-color=color Use basic colors in disassembler output.\n\n")); list_supported_targets (program_name, stream); list_supported_architectures (program_name, stream); @@ -437,7 +450,8 @@ enum option_values OPTION_CTF, OPTION_CTF_PARENT, #endif - OPTION_VISUALIZE_JUMPS + OPTION_VISUALIZE_JUMPS, + OPTION_DISASSEMBLER_COLOR }; static struct option long_options[]= @@ -503,6 +517,7 @@ static struct option long_options[]= {"version", no_argument, NULL, 'V'}, {"visualize-jumps", optional_argument, 0, OPTION_VISUALIZE_JUMPS}, {"wide", no_argument, NULL, 'w'}, + {"disassembler-color", required_argument, NULL, OPTION_DISASSEMBLER_COLOR}, {NULL, no_argument, NULL, 0} }; @@ -1246,7 +1261,7 @@ objdump_print_value (bfd_vma vma, struct disassemble_info *inf, if (*p == '\0') --p; } - (*inf->fprintf_func) (inf->stream, "%s", p); + (*inf->fprintf_styled_func) (inf->stream, dis_style_address, "%s", p); } /* Print the name of a symbol. */ @@ -1280,10 +1295,11 @@ objdump_print_symname (bfd *abfd, struct disassemble_info *inf, if (inf != NULL) { - (*inf->fprintf_func) (inf->stream, "%s", name); + (*inf->fprintf_styled_func) (inf->stream, dis_style_symbol, "%s", name); if (version_string && *version_string != '\0') - (*inf->fprintf_func) (inf->stream, hidden ? "@%s" : "@@%s", - version_string); + (*inf->fprintf_styled_func) (inf->stream, dis_style_symbol, + hidden ? "@%s" : "@@%s", + version_string); } else { @@ -1545,31 +1561,33 @@ objdump_print_addr_with_sym (bfd *abfd, asection *sec, asymbol *sym, if (!no_addresses) { objdump_print_value (vma, inf, skip_zeroes); - (*inf->fprintf_func) (inf->stream, " "); + (*inf->fprintf_styled_func) (inf->stream, dis_style_text, " "); } if (sym == NULL) { bfd_vma secaddr; - (*inf->fprintf_func) (inf->stream, "<%s", - sanitize_string (bfd_section_name (sec))); + (*inf->fprintf_styled_func) (inf->stream, dis_style_text,"<"); + (*inf->fprintf_styled_func) (inf->stream, dis_style_symbol, "%s", + sanitize_string (bfd_section_name (sec))); secaddr = bfd_section_vma (sec); if (vma < secaddr) { - (*inf->fprintf_func) (inf->stream, "-0x"); + (*inf->fprintf_styled_func) (inf->stream, dis_style_immediate, + "-0x"); objdump_print_value (secaddr - vma, inf, true); } else if (vma > secaddr) { - (*inf->fprintf_func) (inf->stream, "+0x"); + (*inf->fprintf_styled_func) (inf->stream, dis_style_immediate, "+0x"); objdump_print_value (vma - secaddr, inf, true); } - (*inf->fprintf_func) (inf->stream, ">"); + (*inf->fprintf_styled_func) (inf->stream, dis_style_text, ">"); } else { - (*inf->fprintf_func) (inf->stream, "<"); + (*inf->fprintf_styled_func) (inf->stream, dis_style_text, "<"); objdump_print_symname (abfd, inf, sym); @@ -1586,21 +1604,22 @@ objdump_print_addr_with_sym (bfd *abfd, asection *sec, asymbol *sym, ; else if (bfd_asymbol_value (sym) > vma) { - (*inf->fprintf_func) (inf->stream, "-0x"); + (*inf->fprintf_styled_func) (inf->stream, dis_style_immediate,"-0x"); objdump_print_value (bfd_asymbol_value (sym) - vma, inf, true); } else if (vma > bfd_asymbol_value (sym)) { - (*inf->fprintf_func) (inf->stream, "+0x"); + (*inf->fprintf_styled_func) (inf->stream, dis_style_immediate, "+0x"); objdump_print_value (vma - bfd_asymbol_value (sym), inf, true); } - (*inf->fprintf_func) (inf->stream, ">"); + (*inf->fprintf_styled_func) (inf->stream, dis_style_text, ">"); } if (display_file_offsets) - inf->fprintf_func (inf->stream, _(" (File Offset: 0x%lx)"), - (long int)(sec->filepos + (vma - sec->vma))); + inf->fprintf_styled_func (inf->stream, dis_style_text, + _(" (File Offset: 0x%lx)"), + (long int)(sec->filepos + (vma - sec->vma))); } /* Print an address (VMA), symbolically if possible. @@ -2127,6 +2146,143 @@ objdump_sprintf (SFILE *f, const char *format, ...) return n; } +/* Return an integer greater than, or equal to zero, representing the color + for STYLE, or -1 if no color should be used. */ + +static int +objdump_color_for_disassembler_style (enum disassembler_style style) +{ + int color = -1; + + if (style == dis_style_comment_start) + disassembler_in_comment = true; + + if (disassembler_color) + { + if (disassembler_in_comment) + return color; + + switch (style) + { + case dis_style_symbol: color = 32; break; + case dis_style_assembler_directive: + case dis_style_mnemonic: color = 33; break; + case dis_style_register: color = 34; break; + case dis_style_address: + case dis_style_address_offset: + case dis_style_immediate: color = 35; break; + default: + case dis_style_text: color = -1; break; + } + } + else if (disassembler_extended_color) + { + if (disassembler_in_comment) + return 250; + + switch (style) + { + case dis_style_symbol: color = 40; break; + case dis_style_assembler_directive: + case dis_style_mnemonic: color = 142; break; + case dis_style_register: color = 27; break; + case dis_style_address: + case dis_style_address_offset: + case dis_style_immediate: color = 134; break; + default: + case dis_style_text: color = -1; break; + } + } + + return color; +} + +/* Like objdump_sprintf, but add in escape sequences to highlight the + content according to STYLE. */ + +static int ATTRIBUTE_PRINTF_3 +objdump_styled_sprintf (SFILE *f, enum disassembler_style style, + const char *format, ...) +{ + size_t n; + va_list args; + int color = objdump_color_for_disassembler_style (style); + + if (color >= 0) + { + while (1) + { + size_t space = f->alloc - f->pos; + + if (disassembler_color) + n = snprintf (f->buffer + f->pos, space, "\033[%dm", color); + else + n = snprintf (f->buffer + f->pos, space, "\033[38;5;%dm", color); + if (space > n) + break; + + f->alloc = (f->alloc + n) * 2; + f->buffer = (char *) xrealloc (f->buffer, f->alloc); + } + f->pos += n; + } + + while (1) + { + size_t space = f->alloc - f->pos; + + va_start (args, format); + n = vsnprintf (f->buffer + f->pos, space, format, args); + va_end (args); + + if (space > n) + break; + + f->alloc = (f->alloc + n) * 2; + f->buffer = (char *) xrealloc (f->buffer, f->alloc); + } + f->pos += n; + + if (color >= 0) + { + while (1) + { + size_t space = f->alloc - f->pos; + + n = snprintf (f->buffer + f->pos, space, "\033[0m"); + + if (space > n) + break; + + f->alloc = (f->alloc + n) * 2; + f->buffer = (char *) xrealloc (f->buffer, f->alloc); + } + f->pos += n; + } + + return n; +} + +/* We discard the styling information here. This function is only used + when objdump is printing auxiliary information, the symbol headers, and + disassembly address, or the bytes of the disassembled instruction. We + don't (currently) apply styling to any of this stuff, so, for now, just + print the content with no additional style added. */ + +static int ATTRIBUTE_PRINTF_3 +fprintf_styled (FILE *f, enum disassembler_style style ATTRIBUTE_UNUSED, + const char *fmt, ...) +{ + int res; + va_list ap; + + va_start (ap, fmt); + res = vfprintf (f, fmt, ap); + va_end (ap); + + return res; +} + /* Code for generating (colored) diagrams of control flow start and end points. */ @@ -2558,8 +2714,8 @@ disassemble_jumps (struct disassemble_info * inf, sfile.pos = 0; inf->insn_info_valid = 0; - inf->fprintf_func = (fprintf_ftype) objdump_sprintf; - inf->stream = &sfile; + disassemble_set_printf (inf, &sfile, (fprintf_ftype) objdump_sprintf, + (fprintf_styled_ftype) objdump_styled_sprintf); addr_offset = start_offset; while (addr_offset < stop_offset) @@ -2621,6 +2777,7 @@ disassemble_jumps (struct disassemble_info * inf, /* Extract jump information. */ inf->insn_info_valid = 0; + disassembler_in_comment = false; octets = (*disassemble_fn) (section->vma + addr_offset, inf); /* Test if a jump was detected. */ if (inf->insn_info_valid @@ -2641,9 +2798,8 @@ disassemble_jumps (struct disassemble_info * inf, addr_offset += octets / opb; } - inf->fprintf_func = (fprintf_ftype) fprintf; - inf->stream = stdout; - + disassemble_set_printf (inf, (void *) stdout, (fprintf_ftype) fprintf, + (fprintf_styled_ftype) fprintf_styled); free (sfile.buffer); /* Merge jumps. */ @@ -2736,6 +2892,17 @@ null_print (const void * stream ATTRIBUTE_UNUSED, const char * format ATTRIBUTE_ return 1; } +/* Like null_print, but takes the extra STYLE argument. As this is not + going to print anything, the extra argument is just ignored. */ + +static int +null_styled_print (const void * stream ATTRIBUTE_UNUSED, + enum disassembler_style style ATTRIBUTE_UNUSED, + const char * format ATTRIBUTE_UNUSED, ...) +{ + return 1; +} + /* Print out jump visualization. */ static void @@ -2946,8 +3113,9 @@ disassemble_bytes (struct disassemble_info *inf, int insn_size; sfile.pos = 0; - inf->fprintf_func = (fprintf_ftype) objdump_sprintf; - inf->stream = &sfile; + disassemble_set_printf + (inf, &sfile, (fprintf_ftype) objdump_sprintf, + (fprintf_styled_ftype) objdump_styled_sprintf); inf->bytes_per_line = 0; inf->bytes_per_chunk = 0; inf->flags = ((disassemble_all ? DISASSEMBLE_DATA : 0) @@ -2989,10 +3157,15 @@ disassemble_bytes (struct disassemble_info *inf, twice, but we only do this when there is a high probability that there is a reloc that will affect the instruction. */ - inf->fprintf_func = (fprintf_ftype) null_print; + disassemble_set_printf + (inf, inf->stream, (fprintf_ftype) null_print, + (fprintf_styled_ftype) null_styled_print); insn_size = disassemble_fn (section->vma + addr_offset, inf); - inf->fprintf_func = (fprintf_ftype) objdump_sprintf; + disassemble_set_printf + (inf, inf->stream, + (fprintf_ftype) objdump_sprintf, + (fprintf_styled_ftype) objdump_styled_sprintf); } } @@ -3017,12 +3190,13 @@ disassemble_bytes (struct disassemble_info *inf, inf->stop_vma = section->vma + stop_offset; inf->stop_offset = stop_offset; + disassembler_in_comment = false; insn_size = (*disassemble_fn) (section->vma + addr_offset, inf); octets = insn_size; inf->stop_vma = 0; - inf->fprintf_func = (fprintf_ftype) fprintf; - inf->stream = stdout; + disassemble_set_printf (inf, stdout, (fprintf_ftype) fprintf, + (fprintf_styled_ftype) fprintf_styled); if (insn_width == 0 && inf->bytes_per_line != 0) octets_per_line = inf->bytes_per_line; if (insn_size < (int) opb) @@ -3583,8 +3757,9 @@ disassemble_section (bfd *abfd, asection *section, void *inf) sf.alloc = strlen (sym->name) + 40; sf.buffer = (char*) xmalloc (sf.alloc); sf.pos = 0; - di.fprintf_func = (fprintf_ftype) objdump_sprintf; - di.stream = &sf; + disassemble_set_printf + (&di, &sf, (fprintf_ftype) objdump_sprintf, + (fprintf_styled_ftype) objdump_styled_sprintf); objdump_print_symname (abfd, &di, sym); @@ -3653,8 +3828,8 @@ disassemble_data (bfd *abfd) ++sorted_symcount; } - init_disassemble_info (&disasm_info, stdout, (fprintf_ftype) fprintf); - + init_disassemble_info (&disasm_info, stdout, (fprintf_ftype) fprintf, + (fprintf_styled_ftype) fprintf_styled); disasm_info.application_data = (void *) &aux; aux.abfd = abfd; aux.require_sec = false; @@ -5495,6 +5670,16 @@ main (int argc, char **argv) nonfatal (_("unrecognized argument to --visualize-option")); } break; + case OPTION_DISASSEMBLER_COLOR: + if (streq (optarg, "off")) + disassembler_color = false; + else if (streq (optarg, "color")) + disassembler_color = true; + else if (streq (optarg, "extended-color")) + disassembler_extended_color = true; + else + nonfatal (_("unrecognized argument to --disassembler-color")); + break; case 'E': if (strcmp (optarg, "B") == 0) endian = BFD_ENDIAN_BIG; diff --git a/gdb/disasm.c b/gdb/disasm.c index 24d757aec33..8b6d9db7e84 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -177,6 +177,22 @@ gdb_disassembler::dis_asm_fprintf (void *stream, const char *format, ...) return 0; } +/* See disasm.h. */ + +int +gdb_disassembler::dis_asm_styled_fprintf (void *stream, + enum disassembler_style style, + const char *format, ...) +{ + va_list args; + + va_start (args, format); + vfprintf_filtered ((struct ui_file *) stream, format, args); + va_end (args); + /* Something non -ve. */ + return 0; +} + static bool line_is_less_than (const deprecated_dis_line_entry &mle1, const deprecated_dis_line_entry &mle2) @@ -787,7 +803,8 @@ gdb_disassembler::gdb_disassembler (struct gdbarch *gdbarch, && file->can_emit_style_escape ()), m_dest (file) { - init_disassemble_info (&m_di, &m_buffer, dis_asm_fprintf); + init_disassemble_info (&m_di, &m_buffer, dis_asm_fprintf, + dis_asm_styled_fprintf); m_di.flavour = bfd_target_unknown_flavour; m_di.memory_error_func = dis_asm_memory_error; m_di.print_address_func = dis_asm_print_address; @@ -954,12 +971,25 @@ gdb_disasm_null_printf (void *stream, const char *format, ...) return 0; } +/* An fprintf-function for use by the disassembler when we know we don't + want to print anything, and the disassembler is using style. Always + returns success. */ + +static int ATTRIBUTE_PRINTF (3, 4) +gdb_disasm_null_styled_printf (void *stream, + enum disassembler_style style, + const char *format, ...) +{ + return 0; +} + /* See disasm.h. */ void init_disassemble_info_for_no_printing (struct disassemble_info *dinfo) { - init_disassemble_info (dinfo, nullptr, gdb_disasm_null_printf); + init_disassemble_info (dinfo, nullptr, gdb_disasm_null_printf, + gdb_disasm_null_styled_printf); } /* Initialize a struct disassemble_info for gdb_buffered_insn_length. diff --git a/gdb/disasm.h b/gdb/disasm.h index 399afc5ae71..b71cd097a16 100644 --- a/gdb/disasm.h +++ b/gdb/disasm.h @@ -110,6 +110,13 @@ class gdb_disassembler static int dis_asm_fprintf (void *stream, const char *format, ...) ATTRIBUTE_PRINTF(2,3); + /* Print formatted message to STREAM, the content can be styled based on + STYLE if desired. */ + static int dis_asm_styled_fprintf (void *stream, + enum disassembler_style style, + const char *format, ...) + ATTRIBUTE_PRINTF(3,4); + static int dis_asm_read_memory (bfd_vma memaddr, gdb_byte *myaddr, unsigned int len, struct disassemble_info *info); diff --git a/include/dis-asm.h b/include/dis-asm.h index 317592448a2..4f91df12498 100644 --- a/include/dis-asm.h +++ b/include/dis-asm.h @@ -35,8 +35,6 @@ extern "C" { #include #include "bfd.h" - typedef int (*fprintf_ftype) (void *, const char*, ...) ATTRIBUTE_FPTR_PRINTF_2; - enum dis_insn_type { dis_noninsn, /* Not a valid instruction. */ @@ -49,6 +47,76 @@ enum dis_insn_type dis_dref2 /* Two data references in instruction. */ }; +/* When printing styled disassembler output, this describes what style + should be used. */ + +enum disassembler_style +{ + /* This is the default style, use this for any additional syntax + (e.g. commas between operands, brackets, etc), or just as a default if + no other style seems appropriate. */ + dis_style_text, + + /* Use this for all instruction mnemonics, or aliases for mnemonics. + These should be things that correspond to real machine + instructions. */ + dis_style_mnemonic, + + /* For things that aren't real machine instructions, but rather + assembler directives, e.g. .byte, etc. */ + dis_style_assembler_directive, + + /* Use this for any register names. This may or may-not include any + register prefix, e.g. '$', '%', at the discretion of the target, + though within each target the choice to include prefixes for not + should be kept consistent. If the prefix is not printed with this + style, then dis_style_text should be used. */ + dis_style_register, + + /* Use this for any constant values used within instructions or + directives, unless the value is an absolute address, or an offset + that will be added to an address (no matter where the address comes + from) before use. This style may, or may-not be used for any + prefix to the immediate value, e.g. '$', at the discretion of the + target, though within each target the choice to include these + prefixes should be kept consistent. */ + dis_style_immediate, + + /* The style for the numerical representation of an absolute address. + Anything that is an address offset should use the immediate style. + This style may, or may-not be used for any prefix to the immediate + value, e.g. '$', at the discretion of the target, though within + each target the choice to include these prefixes should be kept + consistent. */ + dis_style_address, + + /* The style for any constant value within an instruction or directive + that represents an offset that will be added to an address before + use. This style may, or may-not be used for any prefix to the + immediate value, e.g. '$', at the discretion of the target, though + within each target the choice to include these prefixes should be + kept consistent. */ + dis_style_address_offset, + + /* The style for a symbol's name. The numerical address of a symbol + should use the address style above, this style is reserved for the + name. */ + dis_style_symbol, + + /* The start of a comment that runs to the end of the line. Anything + printed after a comment start might be styled differently, + e.g. everything might be styled as a comment, regardless of the + actual style used. The disassembler itself should not try to adjust + the style emitted for comment content, e.g. an address emitted within + a comment should still be given dis_style_address, in this way it is + up to the user of the disassembler to decide how comments should be + styled. */ + dis_style_comment_start +}; + +typedef int (*fprintf_ftype) (void *, const char*, ...) ATTRIBUTE_FPTR_PRINTF_2; +typedef int (*fprintf_styled_ftype) (void *, enum disassembler_style, const char*, ...) ATTRIBUTE_FPTR_PRINTF_3; + /* This struct is passed into the instruction decoding routine, and is passed back out into each callback. The various fields are used for conveying information from your main routine into your callbacks, @@ -62,6 +130,7 @@ enum dis_insn_type typedef struct disassemble_info { fprintf_ftype fprintf_func; + fprintf_styled_ftype fprintf_styled_func; void *stream; void *application_data; @@ -228,6 +297,9 @@ typedef struct disassemble_info disassembling such as the way mapping symbols are found on AArch64. */ bfd_vma stop_offset; + /* Set to true if the disassembler applied styling to the output, + otherwise, set to false. */ + bool created_styled_output; } disassemble_info; /* This struct is used to pass information about valid disassembler @@ -337,6 +409,10 @@ extern void disassemble_init_for_target (struct disassemble_info *); /* Tidy any memory allocated by targets, such as info->private_data. */ extern void disassemble_free_target (struct disassemble_info *); +/* Set the basic disassembler print functions. */ +extern void disassemble_set_printf (struct disassemble_info *, void *, + fprintf_ftype, fprintf_styled_ftype); + /* Document any target specific options available from the disassembler. */ extern void disassembler_usage (FILE *); @@ -394,11 +470,13 @@ extern bool generic_symbol_is_valid /* Method to initialize a disassemble_info struct. This should be called by all applications creating such a struct. */ extern void init_disassemble_info (struct disassemble_info *dinfo, void *stream, - fprintf_ftype fprintf_func); + fprintf_ftype fprintf_func, + fprintf_styled_ftype fprintf_styled_func); /* For compatibility with existing code. */ -#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC) \ - init_disassemble_info (&(INFO), (STREAM), (fprintf_ftype) (FPRINTF_FUNC)) +#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC, FPRINTF_STYLED_FUNC) \ + init_disassemble_info (&(INFO), (STREAM), (fprintf_ftype) (FPRINTF_FUNC), \ + (fprintf_styled_ftype) (FPRINTF_STYLED_FUNC)) #ifdef __cplusplus } diff --git a/opcodes/dis-init.c b/opcodes/dis-init.c index 0b171c0f36d..59039ef8b11 100644 --- a/opcodes/dis-init.c +++ b/opcodes/dis-init.c @@ -25,7 +25,8 @@ void init_disassemble_info (struct disassemble_info *info, void *stream, - fprintf_ftype fprintf_func) + fprintf_ftype fprintf_func, + fprintf_styled_ftype fprintf_styled_func) { memset (info, 0, sizeof (*info)); @@ -35,6 +36,7 @@ init_disassemble_info (struct disassemble_info *info, void *stream, info->endian_code = info->endian; info->octets_per_byte = 1; info->fprintf_func = fprintf_func; + info->fprintf_styled_func = fprintf_styled_func; info->stream = stream; info->read_memory_func = buffer_read_memory; info->memory_error_func = perror_memory; @@ -42,5 +44,6 @@ init_disassemble_info (struct disassemble_info *info, void *stream, info->symbol_at_address_func = generic_symbol_at_address; info->symbol_is_valid = generic_symbol_is_valid; info->display_endian = BFD_ENDIAN_UNKNOWN; + info->created_styled_output = false; } diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c index 1f1fde7ae8f..7325394d985 100644 --- a/opcodes/disassemble.c +++ b/opcodes/disassemble.c @@ -858,3 +858,16 @@ opcodes_assert (const char *file, int line) opcodes_error_handler (_("Please report this bug")); abort (); } + +/* Set the stream, and the styled and unstyled printf functions within + INFO. */ + +void +disassemble_set_printf (struct disassemble_info *info, void *stream, + fprintf_ftype unstyled_printf, + fprintf_styled_ftype styled_printf) +{ + info->stream = stream; + info->fprintf_func = unstyled_printf; + info->fprintf_styled_func = styled_printf; +} >From hjl@sc.intel.com Sun Apr 10 10:04:49 2022 Return-Path: X-Original-To: gcc-regression@gcc.gnu.org Delivered-To: gcc-regression@gcc.gnu.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by sourceware.org (Postfix) with ESMTPS id 285343858C56 for ; Sun, 10 Apr 2022 10:04:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 285343858C56 X-IronPort-AV: E=McAfee;i="6400,9594,10312"; a="260806137" X-IronPort-AV: E=Sophos;i="5.90,249,1643702400"; d="scan'208";a="260806137" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2022 03:04:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,249,1643702400"; d="scan'208";a="654195536" Received: from scymds01.sc.intel.com ([10.148.94.138]) by fmsmga002.fm.intel.com with ESMTP; 10 Apr 2022 03:04:43 -0700 Received: from gnu-hsw-1.sc.intel.com (gnu-hsw-1.sc.intel.com [172.25.70.172]) by scymds01.sc.intel.com with ESMTP id 23AA4hA2032473; Sun, 10 Apr 2022 03:04:43 -0700 Received: by gnu-hsw-1.sc.intel.com (Postfix, from userid 1000) id 8F3BB400888; Sun, 10 Apr 2022 03:04:43 -0700 (PDT) Date: Sun, 10 Apr 2022 03:04:43 -0700 To: skpgkp2@gmail.com, hjl.tools@gmail.com, gcc-regression@gcc.gnu.org, hjl.tools@gmail.com Subject: releases/gcc-10 branch: commit r10-10528 failed to bootstrap on Linux/i686 (commit r10-10515 builds)! User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-Id: <20220410100443.8F3BB400888@gnu-hsw-1.sc.intel.com> From: "H.J. Lu" X-Spam-Status: No, score=-3462.9 required=5.0 testsºYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-regression@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-regression mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Apr 2022 10:04:49 -0000 fi make[2]: Entering directory '/export/gnu/import/git/gcc-test-release-2-ia32' rm -rf bld mkdir -p bld cd bld; \ CC="gcc -m32 -fno-lto" CXX="g++ -m32 -fno-lto" ../src-10/configure \ --prefix=/usr/10.3.1 --enable-clocale=gnu --with-system-zlib --enable-shared --enable-cet --with-demangler-in-ld --enable-libmpx i686-linux --with-fpmath=sse grep "Error " makelog.r10-10528.i686 >> makelog.r10-10528.i686.mail; \ make[6]: [Makefile:1736: i686-linux/bits/largefile-config.h] Error 1 (ignored) make[6]: [Makefile:1736: i686-linux/bits/largefile-config.h] Error 1 (ignored) make[6]: [Makefile:1736: i686-linux/bits/largefile-config.h] Error 1 (ignored) make[6]: *** [Makefile:4223: matmul_i8.lo] Error 1 make[5]: *** [Makefile:1577: all] Error 2 make[4]: *** [Makefile:19890: all-target-libgfortran] Error 2 make[3]: *** [Makefile:23923: bootstrap] Error 2 make[2]: *** [Makefile:309: bootstrap] Error 2 libtool: compile: /export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/xgcc -shared-libgcc -B/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc -nostdinc++ -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src/.libs -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/libsupc++/.libs -B/usr/10.3.1/i686-linux/bin/ -B/usr/10.3.1/i686-linux/lib/ -isystem /usr/10.3.1/i686-linux/include -isystem /usr/10.3.1/i686-linux/sys-include -fchecking=1 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPIC -DCAN_SANITIZE_UB=1 -DUBSAN_CAN_USE_CXXABI=1 -I. -I../../../../src-10/libsanitizer/ubsan -I.. -I ../../../../src-10/libsanitizer -I ../../../../src-10/libsanitizer/include -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/i686-linux -I../../../../src-10/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -fcf-protection -mshstk -g -O2 -D_GNU_SOURCE -MT ubsan_type_hash_win.lo -MD -MP -MF .deps/ubsan_type_hash_win.Tpo -c ../../../../src-10/libsanitizer/ubsan/ubsan_type_hash_win.cpp -fPIC -DPIC -o .libs/ubsan_type_hash_win.o libtool: compile: /export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/xgcc -shared-libgcc -B/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc -nostdinc++ -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src/.libs -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/libsupc++/.libs -B/usr/10.3.1/i686-linux/bin/ -B/usr/10.3.1/i686-linux/lib/ -isystem /usr/10.3.1/i686-linux/include -isystem /usr/10.3.1/i686-linux/sys-include -fchecking=1 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPIC -DCAN_SANITIZE_UB=1 -DUBSAN_CAN_USE_CXXABI=1 -I. -I../../../../src-10/libsanitizer/ubsan -I.. -I ../../../../src-10/libsanitizer -I ../../../../src-10/libsanitizer/include -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/i686-linux -I../../../../src-10/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -fcf-protection -mshstk -g -O2 -D_GNU_SOURCE -MT ubsan_flags.lo -MD -MP -MF .deps/ubsan_flags.Tpo -c ../../../../src-10/libsanitizer/ubsan/ubsan_flags.cpp -o ubsan_flags.o >/dev/null 2>&1 libtool: compile: /export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/xgcc -shared-libgcc -B/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc -nostdinc++ -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src/.libs -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/libsupc++/.libs -B/usr/10.3.1/i686-linux/bin/ -B/usr/10.3.1/i686-linux/lib/ -isystem /usr/10.3.1/i686-linux/include -isystem /usr/10.3.1/i686-linux/sys-include -fchecking=1 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPIC -DCAN_SANITIZE_UB=1 -DUBSAN_CAN_USE_CXXABI=1 -I. -I../../../../src-10/libsanitizer/ubsan -I.. -I ../../../../src-10/libsanitizer -I ../../../../src-10/libsanitizer/include -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/i686-linux -I../../../../src-10/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -fcf-protection -mshstk -frtti -g -O2 -D_GNU_SOURCE -MT ubsan_type_hash_itanium.lo -MD -MP -MF .deps/ubsan_type_hash_itanium.Tpo -c ../../../../src-10/libsanitizer/ubsan/ubsan_type_hash_itanium.cpp -o ubsan_type_hash_itanium.o >/dev/null 2>&1 libtool: compile: /export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/xgcc -shared-libgcc -B/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc -nostdinc++ -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src/.libs -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/libsupc++/.libs -B/usr/10.3.1/i686-linux/bin/ -B/usr/10.3.1/i686-linux/lib/ -isystem /usr/10.3.1/i686-linux/include -isystem /usr/10.3.1/i686-linux/sys-include -fchecking=1 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPIC -DCAN_SANITIZE_UB=1 -DUBSAN_CAN_USE_CXXABI=1 -I. -I../../../../src-10/libsanitizer/ubsan -I.. -I ../../../../src-10/libsanitizer -I ../../../../src-10/libsanitizer/include -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/i686-linux -I../../../../src-10/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -fcf-protection -mshstk -g -O2 -D_GNU_SOURCE -MT ubsan_type_hash_win.lo -MD -MP -MF .deps/ubsan_type_hash_win.Tpo -c ../../../../src-10/libsanitizer/ubsan/ubsan_type_hash_win.cpp -o ubsan_type_hash_win.o >/dev/null 2>&1 libtool: compile: /export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/xgcc -shared-libgcc -B/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc -nostdinc++ -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src/.libs -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/libsupc++/.libs -B/usr/10.3.1/i686-linux/bin/ -B/usr/10.3.1/i686-linux/lib/ -isystem /usr/10.3.1/i686-linux/include -isystem /usr/10.3.1/i686-linux/sys-include -fchecking=1 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPIC -DCAN_SANITIZE_UB=1 -DUBSAN_CAN_USE_CXXABI=1 -I. -I../../../../src-10/libsanitizer/ubsan -I.. -I ../../../../src-10/libsanitizer -I ../../../../src-10/libsanitizer/include -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/i686-linux -I../../../../src-10/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -fcf-protection -mshstk -g -O2 -D_GNU_SOURCE -MT ubsan_init.lo -MD -MP -MF .deps/ubsan_init.Tpo -c ../../../../src-10/libsanitizer/ubsan/ubsan_init.cpp -o ubsan_init.o >/dev/null 2>&1 mv -f .deps/ubsan_type_hash_win.Tpo .deps/ubsan_type_hash_win.Plo /bin/sh ../libtool --tag=CXX --mode=compile /export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/xgcc -shared-libgcc -B/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc -nostdinc++ -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src/.libs -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/libsupc++/.libs -B/usr/10.3.1/i686-linux/bin/ -B/usr/10.3.1/i686-linux/lib/ -isystem /usr/10.3.1/i686-linux/include -isystem /usr/10.3.1/i686-linux/sys-include -fchecking=1 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPIC -DCAN_SANITIZE_UB=1 -DUBSAN_CAN_USE_CXXABI=1 -I. -I../../../../src-10/libsanitizer/ubsan -I.. -I ../../../../src-10/libsanitizer -I ../../../../src-10/libsanitizer/include -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/i686-linux -I../../../../src-10/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -fcf-protection -mshstk -g -O2 -D_GNU_SOURCE -MT ubsan_value.lo -MD -MP -MF .deps/ubsan_value.Tpo -c -o ubsan_value.lo ../../../../src-10/libsanitizer/ubsan/ubsan_value.cpp libtool: compile: /export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/xgcc -shared-libgcc -B/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc -nostdinc++ -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src/.libs -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/libsupc++/.libs -B/usr/10.3.1/i686-linux/bin/ -B/usr/10.3.1/i686-linux/lib/ -isystem /usr/10.3.1/i686-linux/include -isystem /usr/10.3.1/i686-linux/sys-include -fchecking=1 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPIC -DCAN_SANITIZE_UB=1 -DUBSAN_CAN_USE_CXXABI=1 -I. -I../../../../src-10/libsanitizer/ubsan -I.. -I ../../../../src-10/libsanitizer -I ../../../../src-10/libsanitizer/include -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/i686-linux -I../../../../src-10/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -fcf-protection -mshstk -g -O2 -D_GNU_SOURCE -MT ubsan_value.lo -MD -MP -MF .deps/ubsan_value.Tpo -c ../../../../src-10/libsanitizer/ubsan/ubsan_value.cpp -fPIC -DPIC -o .libs/ubsan_value.o libtool: compile: /export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/xgcc -shared-libgcc -B/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc -nostdinc++ -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src/.libs -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/libsupc++/.libs -B/usr/10.3.1/i686-linux/bin/ -B/usr/10.3.1/i686-linux/lib/ -isystem /usr/10.3.1/i686-linux/include -isystem /usr/10.3.1/i686-linux/sys-include -fchecking=1 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPIC -DCAN_SANITIZE_UB=1 -DUBSAN_CAN_USE_CXXABI=1 -I. -I../../../../src-10/libsanitizer/ubsan -I.. -I ../../../../src-10/libsanitizer -I ../../../../src-10/libsanitizer/include -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/i686-linux -I../../../../src-10/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -fcf-protection -mshstk -g -O2 -D_GNU_SOURCE -MT ubsan_monitor.lo -MD -MP -MF .deps/ubsan_monitor.Tpo -c ../../../../src-10/libsanitizer/ubsan/ubsan_monitor.cpp -o ubsan_monitor.o >/dev/null 2>&1 mv -f .deps/ubsan_flags.Tpo .deps/ubsan_flags.Plo mv -f .deps/ubsan_type_hash_itanium.Tpo .deps/ubsan_type_hash_itanium.Plo libtool: compile: /export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/xgcc -shared-libgcc -B/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc -nostdinc++ -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src/.libs -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/libsupc++/.libs -B/usr/10.3.1/i686-linux/bin/ -B/usr/10.3.1/i686-linux/lib/ -isystem /usr/10.3.1/i686-linux/include -isystem /usr/10.3.1/i686-linux/sys-include -fchecking=1 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPIC -DCAN_SANITIZE_UB=1 -DUBSAN_CAN_USE_CXXABI=1 -I. -I../../../../src-10/libsanitizer/ubsan -I.. -I ../../../../src-10/libsanitizer -I ../../../../src-10/libsanitizer/include -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/i686-linux -I../../../../src-10/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -fcf-protection -mshstk -g -O2 -D_GNU_SOURCE -MT ubsan_value.lo -MD -MP -MF .deps/ubsan_value.Tpo -c ../../../../src-10/libsanitizer/ubsan/ubsan_value.cpp -o ubsan_value.o >/dev/null 2>&1 mv -f .deps/ubsan_init.Tpo .deps/ubsan_init.Plo In file included from ../../../../src-10/libsanitizer/ubsan/ubsan_handlers_cxx.cpp:19: ../../../../src-10/libsanitizer/ubsan/ubsan_diag.h: In function ‘void __ubsan::__ubsan_handle_cfi_bad_type(__ubsan::CFICheckFailData*, __ubsan::ValueHandle, bool, __ubsan::ReportOptions)’: ../../../../src-10/libsanitizer/ubsan/ubsan_diag.h:193:21: warning: ‘CheckKindStr’ may be used uninitialized in this function [-Wmaybe-uninitialized] 193 | Args[NumArgs++] = A; | ~~~~~~~~~~~~~~~~^~~ ../../../../src-10/libsanitizer/ubsan/ubsan_handlers_cxx.cpp:111:15: note: ‘CheckKindStr’ was declared here 111 | const char *CheckKindStr; | ^~~~~~~~~~~~ mv -f .deps/ubsan_monitor.Tpo .deps/ubsan_monitor.Plo mv -f .deps/ubsan_value.Tpo .deps/ubsan_value.Plo libtool: compile: /export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/xgcc -shared-libgcc -B/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc -nostdinc++ -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src/.libs -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/libsupc++/.libs -B/usr/10.3.1/i686-linux/bin/ -B/usr/10.3.1/i686-linux/lib/ -isystem /usr/10.3.1/i686-linux/include -isystem /usr/10.3.1/i686-linux/sys-include -fchecking=1 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPIC -DCAN_SANITIZE_UB=1 -DUBSAN_CAN_USE_CXXABI=1 -I. -I../../../../src-10/libsanitizer/ubsan -I.. -I ../../../../src-10/libsanitizer -I ../../../../src-10/libsanitizer/include -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/i686-linux -I../../../../src-10/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -fcf-protection -mshstk -frtti -g -O2 -D_GNU_SOURCE -MT ubsan_handlers_cxx.lo -MD -MP -MF .deps/ubsan_handlers_cxx.Tpo -c ../../../../src-10/libsanitizer/ubsan/ubsan_handlers_cxx.cpp -o ubsan_handlers_cxx.o >/dev/null 2>&1 libtool: compile: /export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/xgcc -shared-libgcc -B/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc -nostdinc++ -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src/.libs -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/libsupc++/.libs -B/usr/10.3.1/i686-linux/bin/ -B/usr/10.3.1/i686-linux/lib/ -isystem /usr/10.3.1/i686-linux/include -isystem /usr/10.3.1/i686-linux/sys-include -fchecking=1 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPIC -DCAN_SANITIZE_UB=1 -DUBSAN_CAN_USE_CXXABI=1 -I. -I../../../../src-10/libsanitizer/ubsan -I.. -I ../../../../src-10/libsanitizer -I ../../../../src-10/libsanitizer/include -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/i686-linux -I../../../../src-10/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -fcf-protection -mshstk -g -O2 -D_GNU_SOURCE -MT ubsan_diag.lo -MD -MP -MF .deps/ubsan_diag.Tpo -c ../../../../src-10/libsanitizer/ubsan/ubsan_diag.cpp -o ubsan_diag.o >/dev/null 2>&1 mv -f .deps/ubsan_handlers_cxx.Tpo .deps/ubsan_handlers_cxx.Plo mv -f .deps/ubsan_diag.Tpo .deps/ubsan_diag.Plo libtool: compile: /export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/xgcc -shared-libgcc -B/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc -nostdinc++ -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src/.libs -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/libsupc++/.libs -B/usr/10.3.1/i686-linux/bin/ -B/usr/10.3.1/i686-linux/lib/ -isystem /usr/10.3.1/i686-linux/include -isystem /usr/10.3.1/i686-linux/sys-include -fchecking=1 -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPIC -DCAN_SANITIZE_UB=1 -DUBSAN_CAN_USE_CXXABI=1 -I. -I../../../../src-10/libsanitizer/ubsan -I.. -I ../../../../src-10/libsanitizer -I ../../../../src-10/libsanitizer/include -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/i686-linux -I../../../../src-10/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -fcf-protection -mshstk -g -O2 -D_GNU_SOURCE -MT ubsan_handlers.lo -MD -MP -MF .deps/ubsan_handlers.Tpo -c ../../../../src-10/libsanitizer/ubsan/ubsan_handlers.cpp -o ubsan_handlers.o >/dev/null 2>&1 mv -f .deps/ubsan_handlers.Tpo .deps/ubsan_handlers.Plo /bin/sh ../libtool --tag=CXX --mode=link /export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/xgcc -shared-libgcc -B/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc -nostdinc++ -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src/.libs -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/libsupc++/.libs -B/usr/10.3.1/i686-linux/bin/ -B/usr/10.3.1/i686-linux/lib/ -isystem /usr/10.3.1/i686-linux/include -isystem /usr/10.3.1/i686-linux/sys-include -fchecking=1 -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/i686-linux -I../../../../src-10/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11 -fcf-protection -mshstk -g -O2 -D_GNU_SOURCE -version-info `grep -v '^#' ../../../../src-10/libsanitizer/ubsan/libtool-version` -ldl -lrt -lpthread -lm -o libubsan.la -rpath /usr/10.3.1/lib ubsan_diag.lo ubsan_flags.lo ubsan_handlers.lo ubsan_handlers_cxx.lo ubsan_init.lo ubsan_monitor.lo ubsan_type_hash.lo ubsan_type_hash_itanium.lo ubsan_type_hash_win.lo ubsan_value.lo ../sanitizer_common/libsanitizer_common.la ../interception/libinterception.la ../libbacktrace/libsanitizer_libbacktrace.la ../../libstdc++-v3/src/libstdc++.la libtool: link: /export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/xgcc -shared-libgcc -B/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc -nostdinc++ -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src/.libs -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/libsupc++/.libs -B/usr/10.3.1/i686-linux/bin/ -B/usr/10.3.1/i686-linux/lib/ -isystem /usr/10.3.1/i686-linux/include -isystem /usr/10.3.1/i686-linux/sys-include -fchecking=1 -fPIC -DPIC -shared -nostdlib /lib/crti.o /export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/crtbeginS.o .libs/ubsan_diag.o .libs/ubsan_flags.o .libs/ubsan_handlers.o .libs/ubsan_handlers_cxx.o .libs/ubsan_init.o .libs/ubsan_monitor.o .libs/ubsan_type_hash.o .libs/ubsan_type_hash_itanium.o .libs/ubsan_type_hash_win.o .libs/ubsan_value.o -Wl,--whole-archive ../sanitizer_common/.libs/libsanitizer_common.a ../interception/.libs/libinterception.a ../libbacktrace/.libs/libsanitizer_libbacktrace.a -Wl,--no-whole-archive -Wl,-rpath -Wl,/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src/.libs -Wl,-rpath -Wl,/usr/10.3.1/lib -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src/.libs -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/src -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libstdc++-v3/libsupc++/.libs -ldl -lrt -lpthread ../../libstdc++-v3/src/.libs/libstdc++.so -lm -L/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc -lc -lgcc_s /export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/crtendS.o /lib/crtn.o -mshstk -Wl,-soname -Wl,libubsan.so.1 -o .libs/libubsan.so.1.0.0 libtool: link: (cd ".libs" && rm -f "libubsan.so.1" && ln -s "libubsan.so.1.0.0" "libubsan.so.1") libtool: link: (cd ".libs" && rm -f "libubsan.so" && ln -s "libubsan.so.1.0.0" "libubsan.so") libtool: link: (cd .libs/libubsan.lax/libsanitizer_common.a && ar x "/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libsanitizer/ubsan/../sanitizer_common/.libs/libsanitizer_common.a") libtool: link: (cd .libs/libubsan.lax/libinterception.a && ar x "/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libsanitizer/ubsan/../interception/.libs/libinterception.a") libtool: link: (cd .libs/libubsan.lax/libsanitizer_libbacktrace.a && ar x "/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libsanitizer/ubsan/../libbacktrace/.libs/libsanitizer_libbacktrace.a") libtool: link: ar rc .libs/libubsan.a ubsan_diag.o ubsan_flags.o ubsan_handlers.o ubsan_handlers_cxx.o ubsan_init.o ubsan_monitor.o ubsan_type_hash.o ubsan_type_hash_itanium.o ubsan_type_hash_win.o ubsan_value.o .libs/libubsan.lax/libsanitizer_common.a/sancov_flags.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_allocator.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_allocator_checks.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_allocator_report.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_common.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_common_libcdep.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_coverage_libcdep_new.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_deadlock_detector1.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_deadlock_detector2.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_errno.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_file.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_flag_parser.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_flags.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_libc.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_libignore.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_linux.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_linux_libcdep.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_linux_s390.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_mac.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_mac_libcdep.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_netbsd.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_openbsd.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_persistent_allocator.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_platform_limits_linux.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_platform_limits_openbsd.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_platform_limits_posix.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_platform_limits_solaris.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_posix.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_posix_libcdep.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_printf.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_procmaps_bsd.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_procmaps_common.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_procmaps_linux.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_procmaps_mac.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_procmaps_solaris.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_rtems.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_solaris.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_stackdepot.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_stacktrace.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_stacktrace_libcdep.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_stacktrace_printer.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_stacktrace_sparc.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_stoptheworld_linux_libcdep.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_stoptheworld_mac.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_suppressions.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_symbolizer.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_symbolizer_libbacktrace.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_symbolizer_libcdep.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_symbolizer_mac.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_symbolizer_posix_libcdep.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_symbolizer_report.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_symbolizer_win.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_termination.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_thread_registry.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_tls_get_addr.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_unwind_linux_libcdep.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_unwind_win.o .libs/libubsan.lax/libsanitizer_common.a/sanitizer_win.o .libs/libubsan.lax/libinterception.a/interception_linux.o .libs/libubsan.lax/libinterception.a/interception_mac.o .libs/libubsan.lax/libinterception.a/interception_type_test.o .libs/libubsan.lax/libinterception.a/interception_win.o .libs/libubsan.lax/libsanitizer_libbacktrace.a/atomic.o .libs/libubsan.lax/libsanitizer_libbacktrace.a/bridge.o .libs/libubsan.lax/libsanitizer_libbacktrace.a/cp-demangle.o .libs/libubsan.lax/libsanitizer_libbacktrace.a/dwarf.o .libs/libubsan.lax/libsanitizer_libbacktrace.a/elf.o .libs/libubsan.lax/libsanitizer_libbacktrace.a/fileline.o .libs/libubsan.lax/libsanitizer_libbacktrace.a/mmap.o .libs/libubsan.lax/libsanitizer_libbacktrace.a/mmapio.o .libs/libubsan.lax/libsanitizer_libbacktrace.a/posix.o .libs/libubsan.lax/libsanitizer_libbacktrace.a/sort.o .libs/libubsan.lax/libsanitizer_libbacktrace.a/state.o libtool: link: ranlib .libs/libubsan.a libtool: link: rm -fr .libs/libubsan.lax libtool: link: ( cd ".libs" && rm -f "libubsan.la" && ln -s "../libubsan.la" "libubsan.la" ) make[7]: Leaving directory '/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libsanitizer/ubsan' make[7]: Entering directory '/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libsanitizer' make "AR_FLAGS=rc" "CC_FOR_BUILD=gcc -m32 -fno-lto" "CFLAGS=-g -O2" "CXXFLAGS=-g -O2 -D_GNU_SOURCE" "CFLAGS_FOR_BUILD=-g -O2" "CFLAGS_FOR_TARGET=-g -O2" "INSTALL=/bin/install -c" "INSTALL_DATA=/bin/install -c -m 644" "INSTALL_PROGRAM=/bin/install -c" "INSTALL_SCRIPT=/bin/install -c" "JC1FLAGS=" "LDFLAGS=" "LIBCFLAGS=-g -O2" "LIBCFLAGS_FOR_TARGET=-g -O2" "MAKE=make" "MAKEINFO=makeinfo --split-size=5000000 --split-size=5000000 " "PICFLAG=" "PICFLAG_FOR_TARGET=" "SHELL=/bin/sh" "RUNTESTFLAGS=" "exec_prefix=/usr/10.3.1" "infodir=/usr/10.3.1/share/info" "libdir=/usr/10.3.1/lib" "prefix=/usr/10.3.1" "includedir=/usr/10.3.1/include" "AR=ar" "AS=/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/as" "LD=/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/collect-ld" "LIBCFLAGS=-g -O2" "NM=/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/nm" "PICFLAG=" "RANLIB=ranlib" "DESTDIR=" DO=all multi-do # make make[8]: Entering directory '/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libsanitizer' if [ -z "" ]; then \ true; \ else \ rootpre=`${PWDCMD-pwd}`/; export rootpre; \ srcrootpre=`cd ../../../src-10/libsanitizer; ${PWDCMD-pwd}`/; export srcrootpre; \ lib=`echo "${rootpre}" | sed -e 's,^.*/\([^/][^/]*\)/$,\1,'`; \ compiler="/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/xgcc -B/export/gnu/import/git/gcc-test-release-2-ia32/bld/./gcc/ -B/usr/10.3.1/i686-linux/bin/ -B/usr/10.3.1/i686-linux/lib/ -isystem /usr/10.3.1/i686-linux/include -isystem /usr/10.3.1/i686-linux/sys-include -fchecking=1"; \ for i in `${compiler} --print-multi-lib 2>/dev/null`; do \ dir=`echo $i | sed -e 's/;.*$//'`; \ if [ "${dir}" = "." ]; then \ true; \ else \ if [ -d ../${dir}/${lib} ]; then \ flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \ if (cd ../${dir}/${lib}; make \ CFLAGS="-g -O2 ${flags}" \ CCASFLAGS="-g -O2 ${flags}" \ FCFLAGS=" ${flags}" \ FFLAGS=" ${flags}" \ ADAFLAGS=" ${flags}" \ prefix="/usr/10.3.1" \ exec_prefix="/usr/10.3.1" \ GOCFLAGS="-O2 -g ${flags}" \ GDCFLAGS="-O2 -g ${flags}" \ CXXFLAGS="-g -O2 -D_GNU_SOURCE ${flags}" \ LIBCFLAGS="-g -O2 ${flags}" \ LIBCXXFLAGS="-g -O2 -D_GNU_SOURCE -fno-implicit-templates ${flags}" \ LDFLAGS=" ${flags}" \ MULTIFLAGS="${flags}" \ DESTDIR="" \ INSTALL="/bin/install -c" \ INSTALL_DATA="/bin/install -c -m 644" \ INSTALL_PROGRAM="/bin/install -c" \ INSTALL_SCRIPT="/bin/install -c" \ all); then \ true; \ else \ exit 1; \ fi; \ else true; \ fi; \ fi; \ done; \ fi make[8]: Leaving directory '/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libsanitizer' make[7]: Leaving directory '/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libsanitizer' make[6]: Leaving directory '/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libsanitizer' make[5]: Leaving directory '/export/gnu/import/git/gcc-test-release-2-ia32/bld/i686-linux/libsanitizer' make[4]: Leaving directory '/export/gnu/import/git/gcc-test-release-2-ia32/bld' make[3]: *** [Makefile:23923: bootstrap] Error 2 make[3]: Leaving directory '/export/gnu/import/git/gcc-test-release-2-ia32/bld' Command exited with non-zero status 2 12522.16user 382.72system 34:36.73elapsed 621%CPU (0avgtext+0avgdata 596860maxresident)k 334544inputs+11934520outputs (1530major+104638848minor)pagefaults 0swaps make[2]: *** [Makefile:309: bootstrap] Error 2 make[2]: Leaving directory '/export/gnu/import/git/gcc-test-release-2-ia32'