Age | Commit message (Collapse) | Author | Files | Lines |
|
Move some declarations related to the "quit" machinery from defs.h to
event-top.h. Most of the definitions associated to these declarations
are in event-top.c. The exceptions are `quit()` and `maybe_quit()`,
that are defined in utils.c. For consistency, move these two
definitions to event-top.c.
Include "event-top.h" in many files that use these things.
Change-Id: I6594f6df9047a9a480e7b9934275d186afb14378
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Change-Id: I7dc5189ee172e82ef5b2c4a739c011f43a84258b
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Change the return type of the check_quit_flag function to bool. Update
a few related spots.
Change-Id: I9d3a15d3f8651efb02c7d211f06222a592bd4184
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Move them out of defs.h, to extension.h, since the implementations are
in extension.c.
Change-Id: Ie7321468bd7fecc684d70b09f72c3ee8ac75d8f4
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Remove the gdbcmd.h, which is reported as unused by clangd. Add
cli/cli-cmds.h instead, to get access to `cmdlist` and friends.
Change-Id: Ic0c60d2f6d3618f1bd9fd80b95ffd7c33c692a04
|
|
|
|
When building with this clang:
$ c++ --version
FreeBSD clang version 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a259152)
I see:
$ gmake
CXX dwarf2/read.o
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:4890:6: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
std::move (thread_storage.release_parent_map ()));
^
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:4890:6: note: remove std::move call here
std::move (thread_storage.release_parent_map ()));
^~~~~~~~~~~ ~
The compiler seems right, there is not need to std::move the result of
`release_parent_map ()`, it's already going to be an rvalue. Remove the
std::move.
The issue isn't FreeBSD-specific, I see it on Linux as well when
building hwith clang, I just noticed it on a FreeBSD build first.
Change-Id: I7aa20a4db56c799f20d838ad08099a01653bba19
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Run `pre-commit autoupdate`, this is the outcome. There is no change in
formatting of Python files.
Change-Id: I977781fa6cc924c398cc3b9d9954dc0fbb95d082
|
|
Using want_p_paddr_set_to_zero in commit 45d92439aebd was wrong. Even
solaris targets don't have want_p_paddr_set_to_zero, but we should
handle them at least somewhat reasonably.
PR 31667
* elf.c (IS_SECTION_IN_INPUT_SEGMENT): Remove bed arg, add
paddr_valid. Don't use bed->want_p_paddr_set_to_zero.
(INCLUDE_SECTION_IN_SEGMENT): Likewise.
(rewrite_elf_program_header): Adjust to suit.
|
|
The reason behind this patch was noticing that generic ELF targets
fail to remove "bar" in the recently committed ld-elf/undefweak-1
test. (Despite that, those targets pass the test due to it being too
strict when matching symbols. "bar" gets turned into a local weak
defined absolute symbol.)
swap_out_syms currently drops local section syms that are defined in
discarded sections. Extend that to also drop other symbols in
discarded sections too, even global symbols. The linker goes to quite
a lot of effort to ensure globals in discarded section take a
definition from the kept linkonce or comdat group section. So the
global sym change should only affect cases where something is quite
wrong about the set of linkonce or comdat group sections. However
that change to elf_map_symbols meant we dropped _DYNAMIC_LINK /
_DYNAMIC_LINKING for mips, a global absolute symbol given STT_SECTION
type for some reason. That problem is fixed by reverting the pr14493
change which is no longer needed due to a) BSF_SECTION_SYM_USED on
x86, and b) fixing objcopy to use copy_private_symbol_data.
bfd/
PR 14493
* elf.c (ignore_sym): Rename from ignore_section_sym. Return
true for any symbol without a section or in a discarded section.
Revert pr14493 change.
(elf_map_symbols): Tidy. Use ignore_sym on all symbols.
(swap_out_syms): Tidy.
ld/
* testsuite/ld-elf/undefweak-1.rd: Match any "bar".
|
|
".set" has a different meaning on alpha. Changing it to ".equ" runs
into ".equ" having a different meaning on hppa, and changing it to "="
runs into trouble on bfin.
* testsuite/ld-elf/elf.exp (undefweak-1): xfail on alpha,
don't xfail for genelf.
|
|
osympp appearing twice here is not a bug.
PR 14493
* objcopy.c (copy_object): Run the symbols through
bfd_copy_private_symbol_data.
|
|
bfd_copy_private_symbol_data is a bfd function that appeared in
commit 89665c8562da a long time ago, but seemingly wasn't used
anywhere until Jan added it to gas/symbols.c in commit 6a2b6326c21e.
The function is used to modify ELF symbol st_shndx for symbols defined
in odd sections like .symtab, so that they get the corresponding
section st_shndx in an output file. This patch fixes some bitrot in
the function. After commit c03551323c04 which introduced
output_elf_obj_tdata, elf_strtab_sec and elf_shstrtab_sec will
segfault if used on an input bfd.
PR 14493
* elf.c (_bfd_elf_copy_private_symbol_data): Don't use
elf_strtab_sec and elf_shstrtab_sec.
|
|
Nothing in defs.h actually uses this. Everything that I (and the
buildbot) can compile still compiles, so I guess that all users of
array_view already include it one way or another. Worst case, if this
causes some build failure, the fix will be one #include away.
Change-Id: I981be98b0653cc18c929d85e9afd8732332efd15
Approved-By: John Baldwin <jhb@FreeBSD.org>
|
|
Nothing in defs.h actually uses this.
Add some includes for some spots using things from hashtab.h. Note that
if the GDB build doesn't use libxxhash, hashtab.h is included by
gdbsupport/common-utils.h, so all files still see hashtab.h. It puzzled
me for some time why I didn't see build failures in my build (which
didn't use libxxhash) but the buildbot gave build failures (it uses
libxxhash).
Change-Id: I8efd68decdaf579f048941c7537cd689885caa2a
Approved-By: John Baldwin <jhb@FreeBSD.org>
|
|
Move it out of defs.h.
Change-Id: Ie1743d41a57f81667650048563e66073c72230cf
Approved-By: John Baldwin <jhb@FreeBSD.org>
|
|
Move the declarations out of defs.h, and the implementations out of
findvar.c.
I opted for a new file, because this functionality of converting
integers to bytes and vice-versa seems a bit to generic to live in
findvar.c.
Change-Id: I524858fca33901ee2150c582bac16042148d2251
Approved-By: John Baldwin <jhb@FreeBSD.org>
|
|
It is unused.
Change-Id: I5d4091368c4dfc29752b12061e38f1df8353ba74
Approved-By: John Baldwin <jhb@FreeBSD.org>
|
|
Move it out of defs.h, adjust the includes here and there.
Change-Id: I11901fdce55d54f5e51723e123cef154cfb1bbc5
Approved-By: John Baldwin <jhb@FreeBSD.org>
|
|
Move declarations of initialize_progspace and initialize_inferiors to
progspace.h and inferior.h, respectively.
Change-Id: I62292ffda429861b9f27d8c836a56d161dfa548d
Approved-By: John Baldwin <jhb@FreeBSD.org>
|
|
|
|
runto uses a hard-coded timeout of 30s in its invocation of gdb_expect.
This is normally fine, but for very a slow system (e.g., an emulator) it
may not be enough time for GDB to reach the intended breakpoint.
gdb_expect can obtain a timeout value from user-configurable variables
when it's not given one explicitly, so use that mechanism instead since
the user will have already adjusted the timeout variable to account for
the slow system.
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Fix 'val' -> 'value' typo in c-exp.y which was breaking the build.
Introduced in commit:
commit e6375bc8ebbbc177c79f08e9616eb0b131229f65
Date: Wed Apr 17 16:17:33 2024 -0600
Remove some alloca uses
|
|
Fix integer value being returned from boolean function, as introduced
in `aarch64: Remove asserts from operand qualifier decoders [PR31595]'.
|
|
In my occasional and continuing campaign against realloc, this patch
changes event-loop.cc to use std::vector to keep track of pollfd
objects. Regression tested on x86-64 Fedora 38.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Approved-By: John Baldwin <jhb@FreeBSD.org>
|
|
gas/ChangeLog:
* config/tc-i386.c (build_apx_evex_prefix): Added invalid check for APX
X4.
* testsuite/gas/i386/x86-64-apx-evex-promoted-bad.d: Added invalid
testcase.
* testsuite/gas/i386/x86-64-apx-evex-promoted-bad.s: Ditto.
opcodes/ChangeLog:
* i386-dis.c (get_valid_dis386): Added invalid check for APX X4.
|
|
|
|
I found a couple of spots where VLAs are in use but where they can
easily be removed.
In one spot, adding 'const' is enough -- and is already done in
similar code elsewhere in the file.
In another spot, one of two arrays will be used, so making the buffer
large enough for both works.
Approved-By: John Baldwin <jhb@FreeBSD.org>
|
|
A few spots (mostly in the parsers) use alloca to ensure that a string
is terminated before passing it to a printf-like function (mostly
'error'). However, this isn't needed as the "%.*s" format can be used
instead.
This patch makes this change.
In one spot the alloca is dead code and is simply removed.
Regression tested on x86-64 Fedora 38.
Approved-By: John Baldwin <jhb@FreeBSD.org>
|
|
|
|
Ignore .align at the start of a section may result in misalignment when
partial linking. Manually add -mignore-start-align option without partial
linking.
Gcc -falign-functions add .align 5 to the start of a section, it causes some
error message mismatch. Set these testcases to xfail on LoongArch target.
|
|
Seen on 64-bit targets.
ERROR: compilation of lookup program .../libctf-regression/gzrewrite.c failed
* testsuite/libctf-regression/gzrewrite.c (main): Use %zu to
print size_t values.
* testsuite/libctf-regression/zrewrite.c (main): Likewise.
|
|
|
|
Add the `target_debug_printf` and `target_debug_printf_nofunc` macros
and use them when outputting debug messages depending on `targetdebug`.
I opted for `target_debug_printf_nofunc` to follow the current style
where the function name is already printed, along with the arguments.
Modify the debug printfs in the `debug_target` methods (generated by
`make-target-delegates.py`) to use `target_debug_printf_nofunc` as well.
This makes the "target" debug prints integrate nicely with the other
debug prints that use the "new" debug print system:
[infrun] proceed: enter
[infrun] follow_fork: enter
[target] -> multi-thread->record_will_replay (...)
[target] <- multi-thread->record_will_replay (-1, 0) = false
[target] -> multi-thread->supports_multi_process (...)
[target] <- multi-thread->supports_multi_process () = true
[infrun] follow_fork: exit
...
Change-Id: Ide3c8c1b8a30e6d4c353a29cba911c7192de29ac
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Rename the method to `register_debug_string`.
This makes it easier to introduce `target_debug_printf` in a subsequent
patch.
Change-Id: I5bb2d49476d17940d503e66f40762e3f1e3baabc
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Turn the debug prints in debug_target's method to be one liners. For
instance, change this:
gdb_printf (gdb_stdlog, "<- %s->wait (", this->beneath ()->shortname ());
gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
gdb_puts (", ", gdb_stdlog);
gdb_puts (target_debug_print_target_waitstatus_p (arg1), gdb_stdlog);
gdb_puts (", ", gdb_stdlog);
gdb_puts (target_debug_print_target_wait_flags (arg2), gdb_stdlog);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_ptid_t (result);
gdb_puts ("\n", gdb_stdlog);
into this:
gdb_printf (gdb_stdlog,
"<- %s->wait (%s, %s, %s) = %s\n",
this->beneath ()->shortname (),
target_debug_print_ptid_t (arg0).c_str (),
target_debug_print_target_waitstatus_p (arg1).c_str (),
target_debug_print_target_wait_flags (arg2).c_str (),
target_debug_print_ptid_t (result).c_str ());
This makes it possible for a subsequent patch to turn this gdb_printf
call into a `target_debug_printf` call.
Change-Id: I808202438972fac1bba2f8ccb63e66a4fcef20c9
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Change the functions in target-debug.h to return string representations
in an std::string, such that they don't need to know how the printing
part is done. This also helps the following patch that makes the debug
prints in debug_target one-liners.
Update target-delegates.c (through make-target-delegates.py) to do the
printing.
Add an overload of gdb_puts to avoid using `.c_str ()`.
Change-Id: I55cbff1c1b03a3b24a81740e34c6ad41ac4f8453
Approved-By: Tom Tromey <tom@tromey.com>
|
|
clangd tells me that the gdb_signals.h include in target/waitstatus.h is
unused. This include was probably to give access to `enum gdb_signal`,
but this is in fact defined in gdb/signals.h. Change the include to
gdb/signals.h. Include gdbsupport/gdb_signals.h in some files that were
relying on the transitive include.
Change-Id: I6f4361b3d801394bf29abe8c1393aff110aa0ad6
|
|
Convert all the macros to static functions. Some macros were unused,
and now that they are functions, got flagged by the compiler, so I
omitted them.
No behavior change expected.
Change-Id: Ia88e61d95e29a0378901c71aa50df7c37d16bebe
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Editing target-debug.h with clangd shows a bunch of errors. Add some
includes to fix that (make target-debug.h include what it uses).
Change-Id: I49075a171e6875fa516d6b2ce56b4a03ac7b3376
|
|
libctf's version script is applied to two libraries: libctf.so,
and libctf-nobfd.so. The latter library is a subset of the former
which does not link to libbfd and does not include a few public
entry points that use it (found in libctf-open-bfd.c). This means
that some of the symbols in this version script only exist in one
of the libraries it's applied to.
A number of linkers dislike this: before now, only Solaris's linker
caused serious problems, introducing NOTYPE-typed symbols when such
things were found, but now LLD has started to complain as well:
ld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_arc_open' failed: symbol not defined
ld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_fdopen' failed: symbol not defined
ld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_open' failed: symbol not defined
ld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_bfdopen' failed: symbol not defined
ld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_bfdopen_ctfsect' failed: symbol not defined
Rather than adding more and more whack-a-mole fixes for every
linker we encounter that does this, simply exclude such symbols
unconditionally, using the same trick we used to use for Solaris.
(Well, unconditionally if we can use version scripts with this
linker at all, which is not always the case.)
Thanks to Nicholas Vinson for the original report and a fix very
similar to this one (but not quite identical).
libctf/
* configure.ac: Always exclude libctf symbols from
libctf-nobfd's version script.
* configure: Regenerated.
|
|
Starting with ld.lld-17, ld.lld is invoked with the option
--no-undefined-version enabled by default. Furthermore, The functions
ctf_label_set() and ctf_label_get() are not defined. Their inclusion in
libctf/libctf.ver causes ld.lld-17 to fail emitting the following error
messages:
ld.lld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_label_set' failed: symbol not defined
ld.lld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_label_get' failed: symbol not defined
This patch fixes the issue by removing the symbol names from
libctf/libctf.ver.
[nca: fused in later commit that marked ctf_arc_open as libctf
only as well. Added ChangeLog entry.]
Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
libctf/
* libctf.ver: drop nonexistent label functions: mark
ctf_arc_open as libctf-only.
|
|
The libctf-internal warning function ctf_err_warn() can be passed a libctf
errno as a parameter, and will add its textual errmsg form to the passed-in
error message. But if there is an error on the fp already, and this is
specifically an error and not a warning, ctf_err_warn() will print the error
out regardless: there's no need to pass in anything but 0.
There are still a lot of places where we do
ctf_err_warn (fp, 0, EFOO, ...);
return ctf_set_errno (fp, 0, EFOO);
I've left all of those alone, because fixing it makes the code a bit longer:
but fixing the cases where no return is involved and the error has just been
set on the fp itself costs nothing and reduces redundancy a bit.
libctf/
* ctf-dedup.c (ctf_dedup_walk_output_mapping): Drop the errno arg.
(ctf_dedup_emit): Likewise.
(ctf_dedup_type_mapping): Likewise.
* ctf-link.c (ctf_create_per_cu): Likewise.
(ctf_link_deduplicating_close_inputs): Likewise.
(ctf_link_deduplicating_one_symtypetab): Likewise.
(ctf_link_deduplicating_per_cu): Likewise.
* ctf-lookup.c (ctf_lookup_symbol_idx): Likewise.
* ctf-subr.c (ctf_assert_fail_internal): Likewise.
|
|
This purely serves to make it easier to interpret valgrind output.
No functional effect.
libctf/
* testsuite/libctf-lookup/conflicting-type-syms.c: Free everything.
|
|
Now there's a chance of it actually working, we can add more tests for
the long-broken dict read-and-rewrite cases. This is the first ever
test for the (rarely-used, unpleasant, and until recently completely
broken) ctf_gzwrite function.
libctf/
* testsuite/libctf-regression/gzrewrite*: New test.
* testsuite/libctf-regression/zrewrite*: Likewise.
|
|
libctf/
* ctf-lookup.c (ctf_symidx_sort): Fix a debugging typo.
|
|
In particular, we don't need a symbol table if we're looking up a
symbol by name and that type of symbol has an indexed symtypetab,
since in that case we get the name from the symtypetab index, not
from the symbol table.
This lets you do symbol lookups in unlinked object files and unlinked
dicts written out via libctf's writeout functions.
libctf/
* ctf-lookup.c (ctf_lookup_by_sym_or_name): Allow lookups
by index even when there is no symtab.
|
|
When dumping a type fails with an error, we want to emit a warning noting
this: a warning because it's not fatal and we can continue. But warnings
don't automatically print out the ctf_errno (because not all cases causing
warnings set the errno at all), so we must do it at warning-emission time or
lose track of what's gone wrong.
libctf/
* ctf-dump.c (ctf_dump_format_type): Dump the underlying error on
type dump failure.
|
|
Without this, you might get things like this in the output:
Flags: 0xa (CTF_F_NEWFUNCINFO, , CTF_F_DYNSTR)
Note the spurious comma.
libctf/
* ctf-dump.c (ctf_dump_header): Fix comma emission.
|
|
ctf_serialize() evolved from the old ctf_update(), which mutated the
in-memory CTF dict to make all the dynamic in-memory types into static,
unchanging written-to-the-dict types (by deserializing and reserializing
it): back in the days when you could only do type lookups on static types,
this meant you could see all the types you added recently, at the small,
small cost of making it impossible to change those older types ever again
and inducing an amortized O(n^2) cost if you actually wanted to add
references to types you added at arbitrary times to later types.
It also reset things so that ctf_discard() would throw away only types you
added after the most recent ctf_update() call.
Some time ago this was all changed so that you could look up dynamic types
just as easily as static types: ctf_update() changed so that only its
visible side-effect of affecting ctf_discard() remained: the old
ctf_update() was renamed to ctf_serialize(), made internal to libctf, and
called from the various functions that wrote files out.
... but it was still working by serializing and deserializing the entire
dict, swapping out its guts with the newly-serialized copy in an invasive
and horrible fashion that coupled ctf_serialize() to almost every field in
the ctf_dict_t. This is totally useless, and fixing it is easy: just rip
all that code out and have ctf_serialize return a serialized representation,
and let everything use that directly. This simplifies most of its callers
significantly.
(It also points up another bug: ctf_gzwrite() failed to call ctf_serialize()
at all, so it would only ever work for a dict you just ctf_write_mem()ed
yourself, just for its invisible side-effect of serializing the dict!)
This lets us simplify away a bunch of internal-only open-side functionality
for overriding the syn_ext_strtab and some just-added functionality for
forcing in an existing atoms table, without loss of functionality, and lets
us lift the restriction on reserializing a dict that was ctf_open()ed rather
than being ctf_create()d: it's now perfectly OK to open a dict, modify it
(except for adding members to existing structs, unions, or enums, which
fails with -ECTF_RDONLY), and write it out again, just as one would expect.
libctf/
* ctf-serialize.c (ctf_symtypetab_sect_sizes): Fix typos.
(ctf_type_sect_size): Add static type sizes too.
(ctf_serialize): Return the new dict rather than updating the
existing dict. No longer fail for dicts with static types;
copy them onto the start of the new types table.
(ctf_gzwrite): Actually serialize before gzwriting.
(ctf_write_mem): Improve forced (test-mode) endian-flipping:
flip dicts even if they are too small to be compressed.
Improve confusing variable naming.
* ctf-archive.c (arc_write_one_ctf): Don't bother to call
ctf_serialize: both the functions we call do so.
* ctf-string.c (ctf_str_create_atoms): Drop serializing case
(atoms arg).
* ctf-open.c (ctf_simple_open): Call ctf_bufopen directly.
(ctf_simple_open_internal): Delete.
(ctf_bufopen_internal): Delete/rename to ctf_bufopen: no
longer bother with syn_ext_strtab or forced atoms table,
serialization no longer needs them.
* ctf-create.c (ctf_create): Call ctf_bufopen directly.
* ctf-impl.h (ctf_str_create_atoms): Drop atoms arg.
(ctf_simple_open_internal): Delete.
(ctf_bufopen_internal): Likewise.
(ctf_serialize): Adjust.
* testsuite/libctf-lookup/add-to-opened.c: Adjust now that
this is supposed to work.
|