mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-26 13:56:22 +08:00

For ifort, ifx, and flang the tests "complete modm" and "complete modmany" fail. This is because all three emit additional completion suggestions. These additional suggestions have their origin in symbols emitted by the compilers which can also be completed from the respective incomplete word (modm or modmany). For this specific example gfortran does not emit any additional symbols. For example, in this test the linkage name for var_a in ifx is "modmany_mp_var_a_" while gfortran uses "__modmany_MOD_var_a" instead. Since modmany_mp_var_a can be completed from modm and also modmany they will get displayed, while gfortran's symbol starts with "__" and thus will be ignored (it cannot be a completion of a word starting with "m"). Similar things happen in flang and ifort. Some example output is shown below: FLANG (gdb) complete p modm p modmany p modmany::var_a p modmany::var_b p modmany::var_c p modmany::var_i p modmany_ IFX/IFORT (gdb) complete p modm p modmany p modmany._ p modmany::var_a p modmany::var_b p modmany::var_c p modmany::var_i p modmany_mp_var_a_ p modmany_mp_var_b_ p modmany_mp_var_c_ p modmany_mp_var_i_ GFORTRAN (gdb) complete p modm p modmany p modmany::var_a p modmany::var_b p modmany::var_c p modmany::var_i I want to emphasize: for Fortran (and also C/C++) the complete command does not actually check whether its suggestions make sense - all it does is look for any symbol (in the minimal symbols, partial symbols etc.) that a given substring can be completed to (meaning that the given substring is the beginning of the symbol). One can easily produce a similar output for the gfortran compiled executable. For this look at the slightly modified "complete p mod" in gfortran: (gdb) complete p mod p mod1 p mod1::var_const ... p mod_1.c p modcounter p mode_t p modf ... p modify_ldt p modmany p modmany::var_a p modmany::var_b p modmany::var_c p modmany::var_i p module p module.f90 p module_entry p moduse p moduse::var_x p moduse::var_y Many of the displayed symbols do not actually work with print: (gdb) p mode_t Attempt to use a type name as an expression (gdb) p mod_1.c No symbol "mod_1" in current context. (gdb) I think that in the given test the output for gfortran only looks nice "by chance" rather than is actually expected. Expected is any output that also contains the completions p modmany p modmany::var_a p modmany::var_b p modmany::var_c p modmany::var_i while anythings else can be displayed as well (depending on the compiler and its emitted symbols). This, I'd consider all three outputs as valid and expected - one is just somewhat lucky that gfortran does not produce any additional symbols that got matched. The given patch improves test performance for all three compilers by allowing additional suggested completions inbetween and after the two given blocks in the test. I did not allow additional print within the modmany_list block since the output is ordered alphabetically and there should normally not appear any additional symbols there. For flang/ifx/ifort I each see 2 failures less (which are exactly the two complete tests). As a side note and since I mentioned C++ in the beginning: I also tried the gdb.cp/completion.exp. The output seems a bit more reasonable, mainly since C++ actually has a demangler in place and linkage symbols do not appear in the output of complete. Still, with a poor enough to-be-completed string one can easily produce similar results: (gdb) complete p t ... p typeinfo name for void p typeinfo name for void const* p typeinfo name for void* p typeinfo name for wchar_t p typeinfo name for wchar_t const* p typeinfo name for wchar_t* p t *** List may be truncated, max-completions reached. *** (gdb) p typeinfo name for void* No symbol "typeinfo" in current context. (gdb) complete p B p BACK_SLASH p BUF_FIRST p BUF_LAST ... p Base p Base::Base() p Base::get_foo() p bad_key_err p buf p buffer p buffer_size p buflen p bufsize p build_charclass.isra (gdb) p bad_key_err No symbol "bad_key_err" in current context. (compiled with gcc/g++ and breaking at main). This patch is only about making the referenced test more 'fair' for the other compilers. Generally, I find the behavior of complete a bit confusing and maybe one wants to change this at some point but this would be a bigger task.
…
…
…
…
…
…
…
…
…
…
…
README for GNU development tools This directory contains various GNU compilers, assemblers, linkers, debuggers, etc., plus their support routines, definitions, and documentation. If you are receiving this as part of a GDB release, see the file gdb/README. If with a binutils release, see binutils/README; if with a libg++ release, see libg++/README, etc. That'll give you info about this package -- supported targets, how to use it, how to report bugs, etc. It is now possible to automatically configure and build a variety of tools with one command. To build all of the tools contained herein, run the ``configure'' script here, e.g.: ./configure make To install them (by default in /usr/local/bin, /usr/local/lib, etc), then do: make install (If the configure script can't determine your type of computer, give it the name as an argument, for instance ``./configure sun4''. You can use the script ``config.sub'' to test whether a name is recognized; if it is, config.sub translates it to a triplet specifying CPU, vendor, and OS.) If you have more than one compiler on your system, it is often best to explicitly set CC in the environment before running configure, and to also set CC when running make. For example (assuming sh/bash/ksh): CC=gcc ./configure make A similar example using csh: setenv CC gcc ./configure make Much of the code and documentation enclosed is copyright by the Free Software Foundation, Inc. See the file COPYING or COPYING.LIB in the various directories, for a description of the GNU General Public License terms under which you can copy the files. REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info on where and how to report problems.
Description
Languages
C
51.8%
Makefile
22.4%
Assembly
12.3%
C++
6%
Roff
1.4%
Other
5.4%