Age | Commit message (Collapse) | Author | Files | Lines |
|
This changes symtab.c to use gdb:unordered_set.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This changes gdb_bfd.c to use gdb:unordered_map.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This changes dictionary.c to use gdb::unordered_map.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This changes breakpoint.c to use gdb:unordered_set.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This changes corelow.c to use gdb:unordered_set and
gdb::unordered_map.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
This changes linux-nat.c:proc_mem_file to use a scoped_fd and fixes up
the users. Regression tested on x86-64 Fedora 40.
Approved-by: Kevin Buettner <kevinb@redhat.com>
|
|
There are currently two functions using macros SYSCALL_MAP and
UNSUPPORTED_SYSCALL_MAP: aarch64_canonicalize_syscall, and
loongarch_canonicalize_syscall.
Here [1] I propose to do the same in i386_canonicalize_syscall, using one
additional macro: SYSCALL_MAP_RENAME.
Add the same macro in aarch64_canonicalize_syscall and
loongarch_canonicalize_syscall, and use it to map aarch64_sys_mmap and
loongarch_sys_mmap to gdb_sys_mmap2.
While we're at it:
- reformat the macro definitions to be more readable,
- add missing macro undefs in aarch64_canonicalize_syscall, and
- fix indentation in aarch64_canonicalize_syscall.
No functional changes.
Tested by rebuilding on x86_64-linux.
Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
[1] https://sourceware.org/pipermail/gdb-patches/2025-March/216230.html
|
|
- Adding Ssnpm, Smnpm, Smmpm, Sspm, and Supm
- No new CSR added
- Pointer masking only applies to RV64
- Ref: https://github.com/riscv/riscv-j-extension/releases/download/pointer-masking-ratified/pointer-masking-ratified.pdf
Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
|
|
|
|
T-Head has a range of vendor-specific instructions. Therefore
it makes sense to group them into smaller chunks in form of
vendor extensions.
This patch adds the additional extension "XTheadVdot" based on the
"V" extension, and it provides four 8-bit multiply and add with
32-bit instructions for the "v" extension. The 'th' prefix and the
"XTheadVector" extension are documented in a PR for the
RISC-V toolchain conventions ([2]).
Co-Authored-By: Lifang Xia <lifang_xia@linux.alibaba.com>
[1] https://github.com/XUANTIE-RV/thead-extension-spec/tree/master/xtheadvdot
[2] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19
bfd/ChangeLog:
* elfxx-riscv.c (riscv_multi_subset_supports): Add support
for "XTheadVdot" extension.
(riscv_multi_subset_supports_ext): Likewise.
gas/ChangeLog:
* doc/c-riscv.texi: Likewise.
* testsuite/gas/riscv/march-help.l: Likewise.
* testsuite/gas/riscv/x-thead-vdot.d: New test.
* testsuite/gas/riscv/x-thead-vdot.s: New test.
include/ChangeLog:
* opcode/riscv-opc.h (MATCH_TH_VMAQA_VV): New.
* opcode/riscv.h (enum riscv_insn_class): Add insn class for
XTheadVdot.
opcodes/ChangeLog:
* riscv-opc.c: Likewise.
|
|
Since we now always generate $x+isa for now, these would increase the
dis-assemble time by parsing the same architecture string repeatedly. We
already have `arch_str' field into `subset_list' to record the current
architecture stirng, but it's only useful for assembler, since dis-assembler
and linker don't need it before. Now for dis-assembler, we just need to
update the `arch_str' after parsing the architecture stirng, and then avoid
parsing repeatedly if the strings are the same.
|
|
The string returned from riscv_arch_str is allocated by xmalloc, so once we
called it multiple times, we should keep the newest one for the output elf
architecture attribute, but free the remaining unused strings.
|
|
The riscv_update_subset1 returning wrong boolean value if the
riscv_parse_check_conflicts isn't called, though the current return value
doesn't really useful.
|
|
|
|
Following the previous patch, this parameter is now unused. Remove it.
Change-Id: I7e96a3ba61ad9a0d6b64f9129aeeb9a8f3da22a7
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Add a few -Wunused-* diagnostic flags that look useful. Some are known
to gcc, some to clang, some to both. Fix the fallouts.
-Wunused-const-variable=1 is understood by gcc, but not clang.
-Wunused-const-variable would be undertsood by both, but for gcc at
least it would flag the unused const variables in headers. This doesn't
make sense to me, because as soon as one source file includes a header
but doesn't use a const variable defined in that header, it's an error.
With `=1`, gcc only warns about unused const variable in the main source
file. It's not a big deal that clang doesn't understand it though: any
instance of that problem will be flagged by any gcc build.
Change-Id: Ie20d99524b3054693f1ac5b53115bb46c89a5156
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Put them one per line and sort alphabetically.
Change-Id: Idb6947d444dc6e556a75645b04f97a915bba7a59
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Update the gdb-add-index script to offer --help and --version options.
The script currently accepts the argument '-dwarf-5' with a single
leading '-'. As two '--' is more common for long options, the
preferred argument form is now '--dwarf-5', the docs have been
updated, and the new help text uses this form.
For backward compatibility, the old '-dwarf-5' form is still
accepted.
The new arguments are '--help' or '-h', but I also accept '-help' for
consistency with '-dwarf-5'. And likewise for the version argument.
Handling of the gdb-add-index script is done basically the same as for
gcore and gstack; we use config.status to create a .in file within the
build directory, which is then processed by the Makefile to create the
final script.
The difference with gdb-add-index is that I left the original script
as gdb/contrib/gdb-add-index.sh rather than renaming it to something
like gdb/contrib/gdb-add-index-1.in, which is how gcore and gstack are
handled (though they are not in the contrib directory).
The reason for this is that the contrib/cc-with-tweaks.sh script looks
for gdb-add-index.sh within the gdb/contrib/ source directory.
As the only reason we process gdb-add-index.sh into the build
directory is to support the PKGVERSION and VERSION variables, allowing
cc-with-tweaks to continue using the unprocessed version seems
harmless, and avoids having to change cc-with-tweaks.sh at all.
I tested that I can still run tests using the cc-with-gdb-index target
board, and that the installed gdb-add-index script correctly shows a
version number when asked.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32325
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
|
|
The cli_styling variable is controlled by 'set style enabled on|off'
user setting, and is currently globally visible.
In a couple of places we access this variable directly, though in
ui-file.c the accesses are all performed through term_cli_styling(),
which is a function that wraps checking cli_styling along with a check
that GDB's terminal supports styling.
In a future commit, I'd plan to add a new parameter to gdb.execute()
which will allow styling to be temporarily suppressed. In an earlier
proposal, I made gdb.execute() disable styling by changing the value
of cli_styling, however, this approach has a problem.
If gdb.execute() is used to run 'show style enabled', the changing
cli_styling will change what is printed. Similarly, if gdb.execute()
is used to execute 'set style enabled on|off' then having
gdb.execute() save and restore the value of cli_styling will undo the
adjustment from 'set style enabled ...'.
So what I plan to do in the future, is add a new control flag which
can be used to temporarily disable styling.
To make this new control variable easier to add, lets force everyone
to call term_cli_styling() to check if styling is enabled or not. To
force everyone to use term_cli_styling() this commit makes cli_styling
static within gdb/cli/cli-style.c.
Approved-By: Tom Tromey <tom@tromey.com>
|
|
The following commit introduced a typo to the NEW file:
commit d21f28a067e94e0ab6548d97f650c14be76bfbde
Date: Sat Mar 15 12:03:50 2025 +0000
gdb/python: remove unused argument from builtin_disassemble
this commit fixes it.
I've also reworded the NEWS entry a little. Simon pointed out in
review that the unused argument was also documented in Python's help()
output, which I hadn't mentioned in the NEWS entry. I've updated the
NEWS entry to just highlight that the now removed argument was never
mentioned in the manual, I think that's all that really matters.
|
|
Direct replacement of an htab with a gdb::unordered_set.
Using a large test program, I see a small but consistent performance
improvement. The "file" command time goes on average from 7.88 to 7.73
seconds (~2%). To give a rough estimate of the scale of the test
program, the 8 seen_names hash tables (one for each worker thread) had
between 173846 and 866961 entries.
Change-Id: I0157cbd04bb55338bb1fcefd2690aeef52fe3afe
Approved-By: Tom Tromey <tom@tromey.com>
|
|
All 3 valid Guile pretty printer display hints are treated as the
value "string". As a result, if a printer specifies "array" or
"map", the output is instead formatted as a string.
This humble patch corrects the issue.
|
|
A GNU property section is now always generated when `-z stack-size` is
passed. This was probably introduced by GNU Property refactoring
within elfxx-aarch64.c.
|
|
|
|
|
|
This commit:
commit 15e15b2d9cd3b1db68f99cd3b047352142ddfd1c
Date: Fri Sep 17 18:12:34 2021 +0100
gdb/python: implement the print_insn extension language hook
added the gdb.disassembler.builtin_disassemble Python API function.
By mistake, the implementation accepted two arguments, the second
being a "memory_source".
However, this second argument was never used, it was left over from an
earlier proposed version of the API.
Luckily, the only place the unused argument was documented was in the
NEWS file and in the output of `help(gdb.builtin_disassemble)`, and
neither of these locations really describe what the argument was, or
how it would be used. The manual only describes the first (actually
used) argument, so I think we are safe enough to delete the unused
argument.
This allows some additional cleanup, with the store for the argument
also being deleted.
As the NEWS file did originally document the second argument, I have
added a NEWS entry to explain the argument has now been removed.
This could potentially break users code if they somehow decided to
pass a second argument, however, fixing things is as simple as
removing the second (unused) argument.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
I noticed that it was not possible to return a string containing non
utf-8 characters using gdb.execute(). For example, using the binary
from the gdb.python/py-source-styling.exp test:
(gdb) file ./gdb/testsuite/outputs/gdb.python/py-source-styling/py-source-styling
Reading symbols from ./gdb/testsuite/outputs/gdb.python/py-source-styling/py-source-styling...
(gdb) set style enabled off
(gdb) list 26
21 int some_variable = 1234;
22
23 /* The following line contains a character that is non-utf-8. This is a
24 critical part of the test as Python 3 can't convert this into a string
25 using its default mechanism. */
26 char c[] = "�"; /* List this line. */
27
28 return 0;
29 }
(gdb) python print(gdb.execute('list 26', to_string=True))
Python Exception <class 'UnicodeDecodeError'>: 'utf-8' codec can't decode byte 0xc0 in position 250: invalid start byte
Error occurred in Python: 'utf-8' codec can't decode byte 0xc0 in position 250: invalid start byte
It is necessary to disable styling before the initial 'list 26',
otherwise the source will be passed through GNU source highlight, and
GNU source highlight seems to be smart enough to figure out the
character encoding, and convert it to UTF-8. This conversion is then
cached in the source cache, and the later Python gdb.execute call will
get back a pure UTF-8 string.
If source styling is disabled, then GDB caches the string without the
conversion to UTF-8, now the gdb.execute call gets back the string
with a non-UTF-8 character within it, and Python throws an error
during its attempt to create a string object.
I'm not, at this point, proposing a solution that tries to guess the
source file encoding, though I guess such a thing could be done.
Instead, I think we should make use of the host_charset(), as set by
the user with 'set host-charset ....' during the creation of the
Python string.
To do this, in execute_gdb_command, we should switch from
PyUnicode_FromString, which requires the input be a UTF-8 string, to
using PyUnicode_Decode, which allows GDB to specify the string
encoding. We will use host_charset().
With this done, it is now possible to list the file contents using
gdb.execute(), with the contents passing through a string:
(gdb) set host-charset ISO-8859-1
(gdb) python print(gdb.execute('list 26', to_string=True), end='')
21 int some_variable = 1234;
22
23 /* The following line contains a character that is non-utf-8. This is a
24 critical part of the test as Python 3 can't convert this into a string
25 using its default mechanism. */
26 char c[] = "À"; /* List this line. */
27
28 return 0;
29 }
(gdb)
There are already plenty of other places in GDB's Python code where we
use PyUnicode_Decode to create a string from something that might
contain user generated content, so I believe this is the correct
approach.
|
|
|
|
When generating an ELF output file, if a note section is marked as
NOLOAD, clear the SEC_ALLOC bit so that it won't be treated as an
SHF_ALLOC section, like a .bss style section.
PR ld/32787
* ld.texi: Update NOLOAD for ELF output files.
* ldlang.c (lang_add_section): Clear the SEC_ALLOC bit for NOLOAD
note sections for ELF output files.
* testsuite/ld-elf/pr32787.d: New file.
* testsuite/ld-elf/pr32787.t: Likewise.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
|
C++11 initially omitted specialization of std::hash for enumeration
types, but this was rectified in LWG issue 2148. This patch removes a
redundant specialization. Tested by rebuilding.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
After staring at the code, I got convinced that it was not possible for
load_full_comp_unit to be called while a dwarf2_cu object exists in
per_objfile for this_cu. If you follow all callers of
load_full_comp_unit, you can see that all calls to load_full_comp_unit
(except one, see below) are gated one way or another by the fact that:
per_objfile->get_cu (per_cu) == nullptr
Some calls are gated by maybe_queue_comp_unit returning true. If it
returns true, then necessarily the dwarf2_cu is unset for that per_cu.
The spot that didn't seem to check for whether the dwarf2_cu is already
set before calling load_full_comp_unit is dw2_do_instantiate_symtab. It
didn't trigger when running the testsuite, but I could imagine a made up
case where the dwarf2_cu would already be set because we looked up a DIE
reference to it (follow_die_ref) for whatever reason. Then, something
would cause the symtab for that CU to be expanded and
dw2_do_instantiate_symtab to be called.
I added a check in that function, because it seemed prudent to do so.
All other load_cu calls are gated by this check, so it makes this call
look just like the others.
Finally, because all call sites that use cutu_reader::release_cu pass
nullptr for `existing_cu` (and therefore cutu_reader creates a new
dwarf2_cu), we know that cutu_reader::release_cu will always return a
non-nullptr value. Add an assert in it and remove checks in
load_full_comp_unit and read_signatured_type.
Change-Id: I496be34bd4bf7edfa38d5135cf4bc4ccd960abe2
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Following the previous patch, all callers now pass the same thing:
per_objfile->get_cu (this_cu)
Remove that parameter and to the call in the function itself.
Change-Id: Iafd36b058d7b95efae518bb65035c6a03728b018
Approved-By: Tom Tromey <tom@tromey.com>
|
|
After staring at the code for a while, I got convinced that it's not
possible for cu->dies to be nullptr in follow_die_offset. It might be a
leftover from the psymtab days.
In most cases, we see that the dwarf2_cu passedas `*ref_cu` has been
obtained by doing:
per_objfile->get_cu (per_cu);
The only way for a dwarf2_cu to end up in the per_objfile like this is
through load_full_comp_unit or read_signatured_type. Both of these
functions call `reader.read_all_dies ()` (which loads the DIEs in memory
and assigns dwarf2_cu::dies) before transferring the newly created
dwarf2_cu to the per_objfile. So any dwarf2_cu obtained through
per_objfile->get_cu (per_cu)
... will have its DIEs set.
The only case today I'm aware of of a dwarf2_cu without DIEs is in the
cooked indexer. It creates a cutu_reader, but does not call
read_all_dies. Instead, it gets the info_ptr from the cutu_reader and
reads the DIEs from the section buffer directly, on its own. But this
is an entirely different code path that doesn't assign dwarf2_cu
objects to per_objfile.
So, remove the code path in follow_die_offset that tests for
`source_cu->dies == NULL`. I added an assert at the top of the function
to verify that `source_cu->dies` is always non-nullptr, as a way to
test my hypothesis. We could probably get rid of it, but I left it
there because it doesn't cost much to have it.
Change-Id: I97f269f092128800850aa5e64eda7032c2edec60
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Rename some local variables to better make the distinction between the
source and target CUs.
Change-Id: I8b43fac91b8a6f1ca6fd1972846fd6bf28608fe3
Approved-By: Tom Tromey <tom@tromey.com>
|
|
cooked_indexer::ensure_cu_exists
The per_objfile object can be obtained from the cutu_reader. This is
actually how both callers get it in order to pass it as argument.
Change-Id: Iac134ded247d841f80ab5ca55dd9055b556410c3
Approved-By: Tom Tromey <tom@tromey.com>
|
|
These methods don't have (or no longer have) a counterpart without the
_1 suffix, so remove the suffix.
Change-Id: Ifdfe4fb3b6b09c6bb9e30c27acf9f9ecbcb207f2
Approved-By: Tom Tromey <tom@tromey.com>
|
|
This is a bit subjective, but I often struggle to understand what
cutu_reader::keep is meant to do (keep what, where). Perhaps it's just
a question of bad naming, but I think it's a bit confusing for
cutu_reader to transfer the ownership of the dwarf2_cu to the
per_objfile directly.
Add the cutu::release_cu method and make the caller of cutu_reader
transfer the ownership to the per_objfile object.
Right now, it is theoretically possible for release_cu to return
nullptr, so I made callers check the return value. A patch later in
this series will change release_cu to ensure it always return
non-nullptr, so those callers will get simplified.
Change-Id: I3103ff894d1654a95c9d69001073c218501c988a
Approved-By: Tom Tromey <tom@tromey.com>
|
|
cutu_reader::read_all_dies
After construction of a cutu_reader, only the top-level DIE has been
read in memory. If the caller wants to access the full DIE tree, it
does:
reader.top_level_die ()->child
= reader.read_die_and_siblings (reader.top_level_die ());
I don't really like this poking into cutu_reader's data structures from
the outside, I would prefer if that work was done by cutu_reader.
Rename the read_die_and_siblings method to read_all_dies, and do that
work inside cutu_reader.
I also moved these operations inside the read_all_dies method:
gdb_assert (cu->die_hash.empty ());
cu->die_hash.reserve (cu->header.get_length_without_initial () / 12);
...
cu->dies = reader.top_level_die ();
The rationale for this is that read_all_dies (and the functions it
calls) is responsible for filling the die_hash set. So I think it makes
sense for it to do the reserve.
It is also cutu_reader's job, currently, to create and fill the fields
of dwarf2_cu. So I think it makes sense for it to set cu->dies, after
having read the DIEs in memory.
Change-Id: I088c2e0b367db7d1f67e8c9e2d5b0d61165292fc
Approved-By: Tom Tromey <tom@tromey.com>
|
|
The few methods of cutu_reader that read DIEs into memory generally
receive an info_ptr that says where to start reading and return another
one (either by return value or parameter) indicating where the caller
should continue reading.
We can avoid all this passing around by having these methods access
m_info_ptr directly. This allows changing some methods that read DIEs
to return `die_info *`, instead of returning it by parameter, which just
makes the code simpler to read, I think.
The only method that meaningfully reads and writes m_info_ptr (except
the places that initially set it up) is read_full_die_1. It reads and
increments m_info_ptr once to read the abbrev and once again to read
each attribute. Other methods use it for logging.
The methods cutu_reader::read_attribute and
cutu_reader::read_attribute_value do not touch m_info_ptr directly,
because they are used in cooked-indexer.c, which appears to read some
things in a non-linear fashion, unlike cutu_reader's DIE-reading
methods. The cooked indexer calls cutu_reader::info_ptr to get the
m_info_ptr value just after the top-level DIE, and then it does its own
attribute reading after that.
Change-Id: I251f63d13d453a2827b21349760da033171880e2
Approved-By: Tom Tromey <tom@tromey.com>
|
|
I was reading cutu_reader::skip_one_die, and thought that the code to
skip one attribute made it quite difficult to read. Factor this code
out to a new method, to get it out of the way.
As a bonus, it transforms one goto in a recursion call, which is also
easier to follow. Unfortunately, I have no idea how to test
DW_FORM_indirect, as it doesn't seem to appear anywhere in the
testsuite, and I don't think that compilers often emit that.
Change-Id: I2257b3e594aafb7c7da52ddd55baa651cefb802f
Approved-By: Tom Tromey <tom@tromey.com>
|
|
I noticed that load_full_comp_unit and load_full_type_unit didn't use
their pretend_language parameter. Remove them, and then remove more
things that were needed to get the language value to that point,
including the dwarf2_queue_item field.
Change-Id: Ie8cb21c54ae49da065a1b0a20bf18ccb93961d1a
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Some programs like RTOS firmware may have a large number of symbols.
The profile information in the profile data file includes histogram
records, which capture low PC and high PC of program execution. If all
histogram records come in the profile data file before any call-graph
records and basic-block records, we can look up only the line numbers
within low PC and high PC in histogram records, which reduces processing
time for such a firmware from ~2 minutes to ~2 seconds.
Add symbol table access function, get_symtab, get_symtab_direct and
set_symtab to delay loading the symbol table until its first use.
* aarch64.c (aarch64_find_call): Call get_symtab to get the
symbol table pointer
* alpha.c (alpha_find_call): Likewise.
* basic_blocks.c (bb_read_rec): Likewise.
(bb_write_blocks): Likewise.
(print_exec_counts): Likewise.
(print_annotated_source): Likewise.
* call_graph.c (cg_tally): Likewise.
(cg_write_arcs): Likewise.
* cg_arcs.c (cycle_link): Likewise.
(propagate_flags): Likewise.
(cg_assemble): Likewise.
* cg_print.c (cg_print): Likewise.
(cg_print_index): Likewise.
(cg_print_function_ordering): Likewise.
* corefile.c: Include "gmon_io.h".
(core_create_syms_from): Call get_symtab_direct to get the
symbol table pointer.
(core_create_function_syms): Likewise.
(core_create_line_syms): Likewise. If all histogram records
come in the profile data file before any call-graph records and
basic-block records, we can look up only the line numbers within
low PC and high PC in histogram records.
* gmon_io.c (gmon_histograms_first): New.
(gmon_out_read): Set gmon_histograms_first to true if all
histogram records come first.
(gmon_out_write): Call get_symtab to get the symbol table
pointer.
* hist.c (scale_and_align_entries): Likewise.
(hist_assign_samples_1): Likewise.
(hist_print): Likewise.
* i386.c (i386_find_call): Likewise.
* mips.c (mips_find_call): Likewise.
* sparc.c (sparc_find_call): Likewise.
* sym_ids.c (sym_id_parse): Likewise.
* vax.c (vax_find_call): Likewise.
* gmon_io.h (gmon_histograms_first): New.
* gprof.c (man): Don't create profile info.
(symtab_init): New.
* gprof.h (symtab_init): New.
* symtab.c (symtab): Changed to static.
(get_symtab_direct): New.
(get_symtab): Likewise.
(set_symtab): Likewise.
* symtab.h (symtab): Removed.
(get_symtab_direct): New.
(get_symtab): Likewise.
(set_symtab): Likewise.
Signed-off-by: Richard Allen <rsaxvc@gmail.com>
Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
|
|
Some DW_CFA_* and DW_OP_* take wider than byte, but non-LEB128 operands.
Having to hand-encode such when needing to resort to .cfi_escape isn't
very helpful.
|
|
Many DW_CFA_* and DW_OP_* take LEB128 operands. Having to hand-encode
such when needing to resort to .cfi_escape isn't very helpful.
|
|
Presumably since no target enables this and there's also no configure
control, builds with NO_LISTING defined didn't really work anymore.
Convert fallback functions to macros and add #ifndef in a few places.
(Behavior is different for affected command line options vs directives:
The former are rejected as unrecognized, while the latter are silently
ignored. I think that's fair enough.)
|
|
These are data generating directives not overly different from e.g.
.byte and .long. Whatever (directly) results from should also be
represented in the listing, if one was requested. It's just that the
output data is generated much later than the parsing of the directive
arguments.
|
|
Ignoring return values often isn't a good idea. The Sparc assembler in
particular would report an internal error if an expression with
relocation specifier is used with .cfi_escape, when the same works fine
with .byte. Propagate the relocation indicator up from
do_parse_cons_expression(), and eventually into emit_expr_with_reloc().
dot_cfi_fde_data(), only retaining the expression's X_add_number, would
require further work. Simply report the lack of support there. While
there, also check that what we were dealt is actually a constant.
|
|
|
|
Commit:
commit be382ece165eefa3e65f61bfb6b2aa2ee95dd6b4
Date: Wed Feb 12 09:35:26 2025 -0700
Check for compiler support in scalar_storage.exp
Introduced an undefined variable use in gdb.ada/scalar_storage.exp,
fixed by this commit.
|
|
On Debian 12, with gcc 12 and ld 2.40, I get some failures when running:
$ make check TESTS="gdb.base/style.exp" RUNTESTFLAGS="--target_board=fission"
I think I stumble on this bug [1], preventing the test from doing
anything that requires expanding the compilation unit:
$ ./gdb -nx -q --data-directory=data-directory testsuite/outputs/gdb.base/style/style
Reading symbols from testsuite/outputs/gdb.base/style/style...
(gdb) p main
DW_FORM_strp pointing outside of .debug_str section [in module /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/style/style]
(gdb)
The error is thrown here:
#0 0x00007ffff693f0a1 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
#1 0x0000555569ce6852 in throw_it(return_reason, errors, const char *, typedef __va_list_tag __va_list_tag *) (reason=RETURN_ERROR, error=GENERIC_ERROR, fmt=0x555562a9fc40 "%s pointing outside of %s section [in module %s]", ap=0x7fffffff8df0) at /home/smarchi/src/binutils-gdb/gdbsupport/common-exceptions.cc:203
#2 0x0000555569ce690f in throw_verror (error=GENERIC_ERROR, fmt=0x555562a9fc40 "%s pointing outside of %s section [in module %s]", ap=0x7fffffff8df0) at /home/smarchi/src/binutils-gdb/gdbsupport/common-exceptions.cc:211
#3 0x000055556879c0cb in verror (string=0x555562a9fc40 "%s pointing outside of %s section [in module %s]", args=0x7fffffff8df0) at /home/smarchi/src/binutils-gdb/gdb/utils.c:193
#4 0x0000555569cfa88d in error (fmt=0x555562a9fc40 "%s pointing outside of %s section [in module %s]") at /home/smarchi/src/binutils-gdb/gdbsupport/errors.cc:45
#5 0x000055556667dbff in dwarf2_section_info::read_string (this=0x61b000042a08, objfile=0x616000055e80, str_offset=262811, form_name=0x555562886b40 "DW_FORM_strp") at /home/smarchi/src/binutils-gdb/gdb/dwarf2/section.c:211
#6 0x00005555662486b7 in dwarf_decode_macro_bytes (per_objfile=0x616000056180, builder=0x614000006040, abfd=0x6120000f4b40, mac_ptr=0x60300004f5be "", mac_end=0x60300004f5bb "\002\004", current_file=0x62100007ad70, lh=0x60f000028bd0, section=0x61700008ba78, section_is_gnu=1, section_is_dwz=0, offset_size=4, str_section=0x61700008bac8, str_offsets_section=0x61700008baf0, str_offsets_base=std::optional<unsigned long> = {...}, include_hash=..., cu=0x61700008b600) at /home/smarchi/src/binutils-gdb/gdb/dwarf2/macro.c:511
#7 0x000055556624af0e in dwarf_decode_macros (per_objfile=0x616000056180, builder=0x614000006040, section=0x61700008ba78, lh=0x60f000028bd0, offset_size=4, offset=0, str_section=0x61700008bac8, str_offsets_section=0x61700008baf0, str_offsets_base=std::optional<unsigned long> = {...}, section_is_gnu=1, cu=0x61700008b600) at /home/smarchi/src/binutils-gdb/gdb/dwarf2/macro.c:934
#8 0x000055556642cb82 in dwarf_decode_macros (cu=0x61700008b600, offset=0, section_is_gnu=1) at /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:19435
#9 0x000055556639bd12 in read_file_scope (die=0x6210000885c0, cu=0x61700008b600) at /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:6366
#10 0x0000555566392d99 in process_die (die=0x6210000885c0, cu=0x61700008b600) at /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:5310
#11 0x0000555566390d72 in process_full_comp_unit (cu=0x61700008b600, pretend_language=language_minimal) at /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:5075
The exception is then only caught at the event-loop level
(start_event_loop), causing the whole debug info reading process to be
aborted. I think it's a little harsh, considering that a lot of things
could work even if we failed to read macro information.
Catch the exception inside read_file_scope, print the exception, and
carry on. We could go even more fine-grained: if reading the string for
one macro definition fails, we could continue reading the macro
information. Perhaps it's just that one macro definition that is
broken. However, I don't need this level of granularity, so I haven't
attempted this. Also, my experience is that macro reading fails when
the compiler or linker has a bug, in which case pretty much everything
is messed up.
With this patch, it now looks like:
$ ./gdb -nx -q --data-directory=data-directory testsuite/outputs/gdb.base/style/style
Reading symbols from testsuite/outputs/gdb.base/style/style...
(gdb) p main
While reading section .debug_macro.dwo: DW_FORM_strp pointing outside of .debug_str section [in module /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/style/style]
$1 = {int (int, char **)} 0x684 <main>
(gdb)
In the test I am investigating (gdb.base/style.exp with the fission
board), it allows more tests to run:
-# of expected passes 107
-# of unexpected failures 17
+# of expected passes 448
+# of unexpected failures 19
Of course, we still see the error about the macro information, and some
macro-related tests still fail (those would be kfailed ideally), but
many tests that are not macro-dependent now pass.
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111409
Change-Id: I0bdb01f153eff23c63c96ce3f41114bb027e5796
Approved-By: Tom Tromey <tom@tromey.com>
|