mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 12:23:31 +08:00

I noticed a test failure in gdb.base/completion.exp for RISC-V on a native Linux target. Upon investigation I discovered a couple of reasons for the failure, this commit addresses one of them. A later commit will address the other issue. The completion.exp test makes use of the capture_command_output proc to collect the output of the 'maint print registers' command. For RISC-V this command produces a lot of output. Currently the capture_command_output proc tries to collect the complete command output in a single expect buffer, and what I see is an error caused by the expect buffer becoming full. This commit rewrites capture_command_output to make use of gdb_test_multiple to collect the command output line at a time, in this way we avoid overflowing the expect buffer. The capture_command_output proc has some logic for skipping a prefix pattern, which is passed in to the proc as an argument. In order to handle this correctly (only matching the prefix at the start of the command output), I use two gdb_test_multiple calls, the first spots and discards the echoed command and the (optional) prefix pattern, the second gdb_test_multiple call then collects the rest of the command output line at a time until a prompt is seen. There is one slight oddity with the current implementation, which I have changed in my rewrite, this does, slightly, change the behaviour of the proc. The current implementation uses this pattern: -re "[string_to_regexp ${command}]\[\r\n\]+${prefix}(.*)\[\r\n\]+$gdb_prompt $" Now a typical command output will look like this: output here\r\n (gdb) As the TCL regexp matching is greedy, TCL will try to match as much as possible in one part of the pattern before moving on to the next. Thus, when this matches against (.*)[\r\n]+, the (.*) will end up matching against 'output here\r' and the [\r\n]+ will match '\n' only. In short the previous implementation would leave the '\r' on the end of the returned text, but not the final trailing '\n'. Now clearly I could make a new version of capture_command_output that maintained this behaviour, but I couldn't see any reason to do this. So, my new implementation drops the final '\r\n' completely, in our example above we now return 'output here' with no '\r'. This change doesn't seem to affect any of the existing tests, but I thought it was worth mentioning.
…
…
…
…
…
…
…
…
…
…
…
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%