This patch introduces a new file, dwarf2/die.c, and moves some
DIE-related code out of dwarf2/read.c and into this new file. This is
just a small part of the long-term project to split up read.c.
(According to 'wc', dwarf2/read.c is the largest file in gdb by around
8000 LOC.)
Regression tested on x86-64 Fedora 36.
While debugging GDB I used 'show directories' and spotted lots of
entries that didn't make much sense. Here are all the entries that are
in my directories list:
/tmp/binutils-gdb/build
/tmp/binutils-gdb/build/../../src/gdb
/tmp/binutils-gdb/build/../../src/gdb/../bfd
/tmp/binutils-gdb/build/../../src/gdb/../libiberty
$cdir
$cwd
Notice the second, third, and fourth entries in this list, these
should really be:
/tmp/binutils-gdb/build/../src/gdb
/tmp/binutils-gdb/build/../src/gdb/../bfd
/tmp/binutils-gdb/build/../src/gdb/../libiberty
The problem is because I generally run everything from the top level
build directory, not the gdb/ sub-directory, thus, I start GDB like:
./gdb/gdb --data-directory ./gdb/data-directory
If run GDB under GDB, then I end up loading the gdb/gdb-gdb.gdb
script, which contains these lines:
dir ../../src/gdb/../libiberty
dir ../../src/gdb/../bfd
dir ../../src/gdb
dir .
These commands only make sense when running within the gdb/
sub-directory.
However, my debugging experience doesn't seem to be degraded at all, I
can still see the GDB source code just fine; which is because the
directory list still contains $cdir.
The build/gdb/gdb-gdb.gdb script is created from the
src/gdb/gdb-gdb.gdb.in template, which includes the automake @srcdir@
markers.
The 'dir' commands have mostly been around since the sourceware
repository was first created, though this commit 67f0714670 did
reorder some of the 'dir' commands, which would seem to indicate these
commands were important to some people, at some time.
One possible fix would be to replace @srcdir@ with @abs_srcdir@, this
would ensure that the entries added were all valid, no matter the
user's current directory when debugging GDB.
However... I'd like to propose that we instead remove all the extra
directories completely. My hope is that, with more recent tools, the
debug information should allow us to correctly find all of the source
files without having to add any extra 'dir' entries. Obviously,
commit 67f0714670 does make me a little nervous, but the
gdb-gdb.gdb script isn't something a non-maintainer will be using, so
I think we can afford to be a little more aggressive here. If it
turns out the 'dir' entries are needed then we can add them back, but
actually document why they are needed. Plus, when we add them back we
will use @abs_srcdir@ instead of @srcdir@.
Reviewed-By: Tom Tromey <tom@tromey.com>
Commit f34652de0b ("internal_error: remove need to pass
__FILE__/__LINE__") renamed the internal_error function to
internal_error_loc. Change gdb-gdb.gdb.in accordingly.
Change-Id: I876e1623607b6becf74ade53d102ead53a74ed86
As discussed on gdb-patches, this restores info_command and the
breakpoint on info_command in gdb-gdb.gdb. This reverts a tiny part
of 0743fc83c0 ("Replace most calls to help_list and cmd_show_list"),
as well as 652fc23a30 ("Remove gdb-gdb.gdb breakpoint on disappeared
function info_command.").
gdb/ChangeLog
2020-05-11 Tom Tromey <tromey@adacore.com>
* cli/cli-cmds.c (info_command): Restore.
(_initialize_cli_cmds): Use add_prefix_command for "info".
* gdb-gdb.gdb.in: Restore breakpoint on info_command.
The function info_command has disappeared, so this breakpoint does not
work anymore.
"info_command" was a function for the prefix command "info",
giving the list of "info" subcommands.
It is not very clear what the removed breakpoint and its associated
command list was supposed to do.
Removed and pushed as obvious, after discussion with Tom.