Age | Commit message (Collapse) | Author | Files | Lines |
|
This patch rewrites the .gdb_index reader to create the same data
structures that are created by the cooked indexer and the .debug_names
reader.
This is done in support of this series; but also because, from what I
can tell, the "templates.exp" change didn't really work properly with
this reader.
In addition to fixing that problem, this patch removes a lot of code.
Implementing this required a couple of hacks, as .gdb_index does not
contain all the information that's used by the cooked index
implementation.
* The index-searching code likes to differentiate between the various
DWARF tags when matching, but .gdb_index lumps many things into a
single "other" category. To handle this, we introduce a phony tag
that's used so that the match method can match on multiple domains.
* Similarly, .gdb_index doesn't distinguish between the type and
struct domains, so another phony tag is used for this.
* The reader must attempt to guess the language of various symbols.
This is somewhat finicky. "Plain" (unqualified) symbols are marked
as language_unknown and then a couple of hacks are used to handle
these -- one in expand_symtabs_matching and another when recognizing
"main".
For what it's worth, I consider .gdb_index to be near the end of its
life. While .debug_names is not perfect -- we found a number of bugs
in the standard while implementing it -- it is better than .gdb_index
and also better documented.
After this patch, we could conceivably remove dwarf_scanner_base.
However, I have not done this.
Finally, this patch also changes this reader to dump the content of
the index, as the other DWARF readers do. This can be handy when
debugging gdb.
Acked-By: Simon Marchi <simon.marchi@efficios.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33316
|
|
Currently, gdb will search the already-expanded symtabs in one loop,
and then also expand matching symtabs in another loop. However, this
is somewhat inefficient -- when searching the already-expanded
symtabs, all such symtabs are examined. However, the various "quick"
implementations already know which subset of symtabs might have a
match.
This changes the contract of expand_symtabs_matching to also call the
callback for an already-expanded symtab. With this change, and some
subsequent enabling changes, the number of searched symtabs should
sometimes be reduced. This also cuts down on the amount of redundant
code.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30736
Acked-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This removes dwarf2_per_cu_data::mark, replacing it with a
locally-allocated boolean vector. It also inverts the sense of the
flag -- now, the flag is true when a CU should be skipped, and false
when the CU should be further examined. Also, the validity of the
flag is no longer dependent on 'file_matcher != NULL'.
This patch makes the subsequent patch to searching a bit simpler, so
I've separated it out.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998
Acked-By: Simon Marchi <simon.marchi@efficios.com>
|
|
g++ will sometimes use a typedef to give a name to an otherwise
anonymous type for linkage purposes. gdb tries to handle this odd
scenario, which is enforced by anon-struct.exp.
It's difficult to detect this problem in the current tree, but the
cooked index does not include an entry for these DIEs.
This patch changes gdb to add these to the index. This is needed by
subsequent changes in this series.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32519
Acked-By: Simon Marchi <simon.marchi@efficios.com>
|
|
When I rewrote the .debug_names writer (commit 91a42a61), I changed
the writer to not import .debug_str into the debug_str_lookup object.
However, a later patch in this series needed this again. The issue
here was that if a name occurs in the DWARF, and is also allocated,
then there is a race, where the created index depends on which DIE is
read first. This can cause index-file.exp failures.
This patch restores the old approach, avoiding this problem. I also
applied a couple of small cleanups to the class. And, I removed the
old complaint from the "ingestion" function, as this was not
necessary.
Acked-By: Simon Marchi <simon.marchi@efficios.com>
|
|
The new approach to searching (solely via the quick API) is more
sensitive to discrepancies between the partial and full readers. In
CTF, there is some disagreement about which scope to use. CTF doesn't
seem to really distinguish between the file and global scope, so this
patch takes the simple approach of putting all CTF symbols into the
global scope.
This changes one test as well. It seems to me that the behavior here
is arbitrary and the test is making unwarranted assumptions.
Acked-By: Simon Marchi <simon.marchi@efficios.com>
|
|
Currently the full symbol reader puts DW_TAG_imported_declaration in
TYPE_DOMAIN, in the global scope. This patch changes the cooked
indexer to follow.
Without this patch, a later patch in the series would cause
nsalias.exp to regress.
This also updates read-gdb-index.c to do something similar.
Acked-By: Simon Marchi <simon.marchi@efficios.com>
|
|
The cooked index does not currently contain entries for Ada import
functions. This means that whether or not these are visible to
"break" depends on which CUs were previously expanded -- clearly a
bug.
This patch fixes the issue. I think the comments in the patch explain
the fix reasonably well.
Perhaps one to-do item here is to change GNAT to use
DW_TAG_imported_declaration for these imports. This may eventually
let us remove some of the current hacks.
This version includes a fix from Simon to initialize the new member.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32511
Acked-By: Simon Marchi <simon.marchi@efficios.com>
|
|
If you run struct-decl.exp with the .gdb_index board, you will see
that "the_type" is not emitted in the index. This would cause a
failure in this series. The fix is to ensure that certain necessary
type declarations are emitted.
However, a naive fix here will regress stub-array-size.exp, where a
type declaration and a type definition are both seen -- but the
declaration is seen first and causes a failure. This is handled by
adding some code (including a mild hack) to filter out type
declarations when a corresponding type definition is seen.
Acked-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This patch is needed to avoid regressions later in the series.
The issue here is that ada_decode, when called with wide=false, would
act as though the input needed verbatim quoting. That would happen
because the 'W' character would be passed through; and then a later
loop would reject the result due to that character.
Similarly, with operators=false the upper-case-checking loop would be
skipped, but then some names that did need verbatim quoting would pass
through.
Furthermore I noticed that there isn't a need to distinguish between
the "wide" and "operators" cases -- all callers pass identical values
to both.
This patch cleans up the above, consolidating the parameters and
changing how upper-case detection is handled, so that both the
operator and wide cases pass-through without issue. I've added new
unit tests for this.
Acked-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This patch adds another minor hack to cooked_index_entry::full_name.
In particular, if GNAT emits non-hierarchical names (still the default
as the hierarchical series is blocked on one tricky problem), then a
request to compute the "linkage-style" name will now just return the
'name' field.
Without this tweak, this series would regress ada-cold-name.exp,
because the search would look for "name.cold" but the index would
return "name[cold]" as the "linkage" name (which would be wrong).
This area is a bit difficult to unravel. The best plan here, IMO, is
to change Ada to work like the other languages in gdb: store the
natural name and do searches with that name. I think this is
achievable, but I didn't want to try it here.
I've updated the relevant bug (tagged below) to reflect this.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32766
Acked-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This series pointed out a few tests that check that a particular index
is in use. It seems to me that this does not really make sense when
the "readnow" board is in use, as this actually skips index creation.
The tests do pass today, but by accident. This patch adds the
appropriate "require" line to the tests in question.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Acked-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This patch removes support for .gdb_index versions less than 7. See
the patch that rewrites the reader to understand why this is needed.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Acked-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This patch fixes var_arr_typedef.exp to preserve a local variable a
bit better, protecting it from a gnat-llvm optimization.
|
|
* gdb/NEWS : Add MicroBlaze gdbserver target
Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
Approved-by: Michael J. Eager <eager@eagercon.com>
|
|
This patch updates breakpoint instruction machine code to be inline
with the specification in MicroBlaze ISA [1]
* gdb/microblaze-tdep.h : Update MICROBLAZE_BREAKPOINT
[1] https://docs.amd.com/r/en-US/ug984-vivado-microblaze-ref/brki
Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
|
|
This changes type_stack::insert to take a gdbarch rather than an
expr_builder. This is simpler and means that type_stack doesn't have
to know anything about expression building; the parser-defs.h include
can be removed.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This changes type_stack so that an element that has an argument can't
be popped in isolation. The idea is to make type stack use a little
safer, making it so that the stack can't end up in an invalid state.
This also fixes up a few related comments.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This changes type_stack to make pushing elements a bit safer: if an
element requires an argument, these are now always pushed at the same
time, rather than separately.
This patch also adds a few comments to help document a bit better.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
gdb currently crashes if you try to get the dynamic_type from a
gdb.Value of a POD struct:
(gdb) py print(gdb.parse_and_eval('pod').dynamic_type)
Fatal signal: Segmentation fault
It happens because value_rtti_type() returns NULL for them, and this is
not handled correctly.
Fixed by using val->type() as a fallback in this case.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
PR ada/33217 points out that gdb incorrectly calls the <ctype.h>
functions. In particular, gdb feels free to pass a 'char' like:
char *str = ...;
... isdigit (*str)
This is incorrect as isdigit only accepts EOF and values that can be
represented as 'unsigned char' -- that is, a cast is needed here to
avoid undefined behavior when 'char' is signed and a character in the
string might be sign-extended. (As an aside, I think this API seems
obviously bad, but unfortunately this is what the standard says, and
some systems check this.)
Rather than adding casts everywhere, this changes all the code in gdb
that uses any <ctype.h> API to instead call the corresponding c-ctype
function.
Now, c-ctype has some limitations compared to <ctype.h>. It works as
if the C locale is in effect, so in theory some non-ASCII characters
may be misclassified. This would only affect a subset of character
sets, though, and in most places I think ASCII is sufficient -- for
example the many places in gdb that check for whitespace.
Furthermore, in practice most users are using UTF-8-based locales,
where these functions aren't really informative for non-ASCII
characters anyway; see the existing workarounds in gdb/c-support.h.
Note that safe-ctype.h cannot be used because it causes conflicts with
readline.h. And, we canot poison the <ctype.h> identifiers as this
provokes errors from some libstdc++ headers.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33217
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This changes gdb and related programs to use the gnulib c-ctype code
rather than safe-ctype.h. The gdb-safe-ctype.h header is removed.
This changes common-defs.h to include the c-ctype header, making it
available everywhere in gdb.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33217
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
The upstream build of GDB can fail on fedora rawhide, since the self
check in regcache.c uses an unitialized variable to be compared, which
now generates the following warning:
binutils-gdb/gdb/regcache.c:1847:42: error: variable
'buf' is uninitialized when passed as a const pointer argument here
[-Werror,-Wuninitialized-const-pointer]
1847 | SELF_CHECK (regcache->raw_compare (0, &buf, register_size (inf.arch (), 0)));
This commit fixes that by initializing the variable to 0.
Since the comment above that line would be changed, it was also
reformatted so that it doesn't go beyond 80 columns.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
ada_binop_in_bounds can be merged with its sole caller.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
ada_ternop_slice can be merged with its sole caller.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
ada_equal_binop can be merged with its sole caller.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
ada_unop_in_range can be merged with its sole caller. This change
points out that one of the arguments was not needed.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
commit a16f37e8 changed finish-var-size.exp to use have_fvar_tracking.
However, in Ada tests, ada_fvar_tracking must be used instead.
|
|
This changes dwarf_record_line_1 to be a method of lnp_state_machine,
simplifying it a bit.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This changes dwarf_finish_line to be a method of lnp_state_machine,
simplifying it a bit.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
I noticed that several spots in lnp_state_machine fetch the CU's
builder. Since this can't change over the lifetime of the object, it
seemed nicer to simply cache it.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This changes dwarf_record_line_p to be a method of lnp_state_machine.
This simplifies it, as it can refer to members of the object.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This changes some code in line-program.c to use bool rather than int.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
I noticed that the compute_include_file_name intro comment was
slightly wrong, and while looking at this, I also noticed that it has
a single caller. This patch hoists it slightly so that a forward
declaration isn't needed.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This patch moves lnp_state_machine and some supporting code to a new
file, dwarf2/line-program.c. The main benefit of this is shrinking
dwarf2/read.c a bit.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
cp-support.c has code to substitute types for typedef names when
canonicalizing a C++ name. I believe this code can use type-specific
search domains; and doing this greatly speeds up some cases.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33081
|
|
Currently, the C parser looks up any name it finds -- at lex time.
However, in an expression like "obj->field", looking up the field name
is wasteful, and can sometimes even yield pathological symtab
expansion behavior.
This patch arranges to avoid the name lookup in this case. (It would
be nice to really clean up this area, but I'm not convinced it can
readily be done in a yacc parser.)
Some special code is required for the C++ construct where a qualified
name is used, like "obj->type1::type2::field".
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33081
|
|
In an earlier version of this series, Simon noticed that something
like "ptype struct type" was much slower.
The deep problem here is the hack in best_symbol -- in this particular
case the C parser is including SEARCH_VAR_DOMAIN, which means that a
type is not "best".
Fixing best_symbol would be good to do, but it's difficult and I
already had many struggles getting this series to this point. So,
rather than fix that, I elected to modify the parser.
The key insight here is that the name lookup in classify_name is
useless when a tag name is expected. This patch adds a flag so that
this lookup is not done. (Incidentally, this kind of thing is much
more straightforward in a recursive descent parser, something like
classify_name would only be applied post-lexing where appropriate.)
This change speeds up the lookup by avoiding the best_symbol hack,
instead searching only for a type.
Acked-By: Simon Marchi <simon.marchi@efficios.com>
Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
|
|
GDB currently fails to build from source on i386 if compiled with
--enable-64-bit-bfd. This is happening because svr4-tls-tdep.o is
missing from the gdb_target_obs variable, while amd64-linux-tdep.o is
obviously there.
Fix the problem by adding svr4-tls-tdep.o to the object list, but only
when --enable-64-bit-bfd is provided.
Signed-off-by: Sergio Durigan Junior <sergiodj@sergiodj.net>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33399
|
|
This changes the gdb test suite to require Tcl 8.6.2. This allows the
removal of some more compatibility code.
I wrote this as a separate patch so make it simpler to drop if some
platform only provides Tcl 8.5. According to research in the bug,
though, it seems like this isn't likely.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33205
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
tcl_version_at_least can more easily be expressed using the built-in
"package" command.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This patch changes the gdb test suite to require Tcl 8.5. It also
removes the one pre-8.5 compatibility function.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33205
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
I noticed I was sometimes getting this failure:
FAIL: gdb.arch/amd64-extended-prologue-analysis.exp: offset \
initialization: ASM source: gdb_breakpoint: set breakpoint \
at *0x0000000000401151
The problem was introduced in commit:
commit f9aa48dc545ef511e19f4dfab88a196b820fd2da
Date: Thu Aug 28 11:50:13 2025 +0000
gdb, amd64: extend the amd64 prologue analyzer to skip register pushes
A gdb_test_multiple exits early when processing the results of a
'disassemble' command, without waiting for the prompt to be seen.
This can leave unhandled output in expect's input buffer, which will
then throw off the next test.
Update the gdb_test_multiple to wait for the prompt before declaring
the test passed.
After this I'm no longer seeing the above failure.
There should be no change in what is tested after this commit.
|
|
This patch enables software single stepping for gdbserver target
Includes fix for Bug 33381 using core_addr_to_string_nz
* gdb/microblaze-tdep.c: Add microblaze_get_next_pcs
Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
Error out in proc clean_restart if the argument is an absolute filename.
Likewise in proc mi_clean_restart.
Tested on x86_64-linux.
|
|
When starting GDB on Hurd amd64, one will currently see the following
warning:
# gdb -q
gdb: warning: A handler for the OS ABI "GNU/Hurd" is not built into this configuration
of GDB. Attempting to continue with the default i386 settings.
(gdb)
This happens because, in gdb/configure.tgt, the "x86_64-*-gnu*" target
is not pulling in the i386-gnu-tdep.o object, which means that only
64-bit debugging is currently supported.
The fix here is to add i386-gnu-tdep.o to the gdb_target_obs for Hurd
amd64.
Signed-off-by: Sergio Durigan Junior <sergiodj@sergiodj.net>
Suggested-by: Andrew Burgess <aburgess@redhat.com>
Reported-by: Mark Wielaard <mark@klomp.org>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33377
Approved-by: Kevin Buettner <kevinb@redhat.com>
|
|
This commit a new section for the next release branch, and renames
the section of the current branch, now that it has been cut.
|
|
Now that the GDB 17 branch has been created,
this commit bumps the version number in gdb/version.in to
18.0.50.DATE-git
For the record, the GDB 17 branch was created
from commit 46ada32fc979550ad4f46792b74c182bb7232aeb.
|
|
Currently, trying to convert a 128-bit integer from a gdb.Value to a
Python integer will fail. This is surprising because Python uses
bigints internally.
The bug here is that valpy_long uses value_as_long, which fails for
anything wider than LONGEST. This patch fixes the problem by using
the recommended Python API.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33366
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
Fix fallout in gdb.base from erroring out on clean_restart
<absolute filename>.
Tested on x86_64-linux.
|