Go to file
Andrew Burgess fc7df214ef gdb: install CLI uiout while processing early init files
The next commit wants to use a 'show' command within an early
initialisation file, despite these commands not being in the list of
acceptable commands for use within an early initialisation file.

The problem we run into is that the early initialisation files are
processed before GDB has installed the top level interpreter.  The
interpreter is responsible to installing the default uiout (accessed
through current_uiout), and as a result code that depends on
uiout (e.g. 'show' commands) will end up dereferencing a nullptr, and
crashing GDB.

I did consider moving the interpreter installation before the early
initialisation, and this would work fine except for the new DAP
interpreter, which relies on having Python available during its
initialisation.  Which means we can't install the interpreter until
after Python has been initialised, and the early initialisation
handling has to occur before Python is setup -- that's the whole point
of this feature (to allow customisation of how Python is setup).

So, what I propose is that early within captured_main_1, we install a
temporary cli_ui_out as the current_uiout.  This will remain in place
until the top-level interpreter is installed, at which point the
temporary will be replaced.

What this means is that current_uiout will no longer be nullptr,
instead, any commands within an early initialisation file that trigger
output, will perform that output in a CLI style.

I propose that we don't update the documentation for early
initialisation files, we leave the user advice as being only 'set' and
'source' commands are acceptable.  But now, if a user does try a
'show' command, then instead of crashing, GDB will do something
predictable.

I've not added a test in this commit.  The next commit relies on this
patch and will serve as a test.

Tested-By: Richard Bunt <richard.bunt@linaro.org>
2023-12-04 14:23:17 +00:00
bfd Automatic date update in version.in 2023-12-04 00:00:11 +00:00
binutils binutils: Fix documentation typo in the --set-sect-name option 2023-12-02 17:39:18 +01:00
config libiberty: Disable hwcaps for sha1.o 2023-11-30 10:14:30 +01:00
contrib
cpu
elfcpp
etc
gas gas: drop unused fields from struct segment_info_struct 2023-12-01 08:29:33 +01:00
gdb gdb: install CLI uiout while processing early init files 2023-12-04 14:23:17 +00:00
gdbserver Bail out of "attach" if a thread cannot be traced 2023-12-01 10:36:00 -07:00
gdbsupport Remove gdb_static_assert 2023-11-29 14:29:44 -07:00
gnulib gnulib: mark configure +x 2023-11-28 12:55:29 -05:00
gold Gold/MIPS: Add targ_extra_size=64 for mips32 triples 2023-11-17 14:33:33 +00:00
gprof Finalized intl-update patches 2023-11-15 12:53:04 +00:00
gprofng gprofng: support GNU option syntax in gp-display-html, plus various fixes 2023-11-29 10:18:35 -08:00
include RISC-V: Add SiFive custom vector coprocessor interface instructions v1.0 2023-12-01 09:29:07 +08:00
ld Fix ld/x86: reduce testsuite dependency on system object files 2023-12-01 18:55:14 -08:00
libbacktrace
libctf libctf: adding CU mappings should be idempotent 2023-11-20 12:31:41 +00:00
libdecnumber
libiberty libiberty: Disable hwcaps for sha1.o 2023-11-30 10:14:30 +01:00
libsframe
opcodes x86: allow 32-bit reg to be used with U{RD,WR}MSR 2023-12-01 08:26:36 +01:00
readline
sim Fix right shifts in mcore simulator on 64 bit hosts. 2023-12-01 07:19:50 -07:00
texinfo
zlib
.cvsignore
.editorconfig
.gitattributes
.gitignore Finalized intl-update patches 2023-11-15 12:53:04 +00:00
ar-lib
ChangeLog Finalized intl-update patches 2023-11-15 12:53:04 +00:00
compile
config-ml.in
config.guess
config.rpath
config.sub
configure Finalized intl-update patches 2023-11-15 12:53:04 +00:00
configure.ac Finalized intl-update patches 2023-11-15 12:53:04 +00:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.LIBGLOSS
COPYING.NEWLIB
depcomp
djunpack.bat
install-sh
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS
Makefile.def Finalized intl-update patches 2023-11-15 12:53:04 +00:00
Makefile.in Finalized intl-update patches 2023-11-15 12:53:04 +00:00
Makefile.tpl
makefile.vms
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
README-maintainer-mode
SECURITY.txt
setup.com
src-release.sh Finalized intl-update patches 2023-11-15 12:53:04 +00:00
symlink-tree
test-driver
ylwrap

		   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.