aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-06-23[GOLD] Support setting DT_RELACOUNT lateAlan Modra11-16/+38
PowerPC gold adds relative dynamic relocs in do_relax. These aren't accounted for in the value set in add_target_dynamic_tags, which is called before do_relax. Provide a way of setting DT_RELCOUNT and DT_RELACOUNT at the point where .dynamic is written. * layout.cc (Layout::add_target_dynamic_tags): Add custom_relcount parameter. Emit DT_RELCOUNT/RELACOUNT as a custom target handled dynamic tag if set. * layout.h(Layout::add_target_dynamic_tags): Update prototype. * aarch64.cc (Target_aarch64::do_finalize_sections): Adjust add_target_dynamic_tags call. * arm.cc (Target_arm::do_finalize_sections): Likewise. * i386.cc (Target_i386::do_finalize_sections): Likewise. * mips.cc (Target_mips::do_finalize_sections): Likewise. * s390.cc (Target_s390::do_finalize_sections): Likewise. * sparc.cc (Target_sparc::do_finalize_sections): Likewise. * tilegx.cc (Target_tilegx::do_finalize_sections): Likewise. * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise. * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise. (Target_powerpc::do_dynamic_tag_custom_value): New function.
2023-06-23[GOLD] powerpc DT_RELACOUNTAlan Modra1-2/+7
DT_RELACOUNT was calculated incorrectly, and relative relocs not sorted as they should be to the start of .rela.dyn, due to adding one particular class of dynamic reloc using the wrong "add" method. * powerpc.cc (Target_powerpc::Scan::global): Add relative dyn relocs for ADDR64 and similar using add_global_relative.
2023-06-23lto test fails with -fno-inline in CFLAGSAlan Modra1-5/+5
Putting -fno-inline in CFLAGS results in these failures. FAIL: Build liblto-17b.so 1 FAIL: PR ld/12365 FAIL: PR ld/13183 * ld-plugin/lto.exp: Add -finline to compiler flags in some tests.
2023-06-22Fix off-by-one errorTom Tromey1-1/+1
Simon pointed out that commit a2bbca9fa5e ("Use std::vector<bool> for agent_expr::reg_mask") caused a regression in libstdc++ debug mode. This was due to an off-by-one error in a vector resize. This patch fixes the problem.
2023-06-23Automatic date update in version.inGDB Administrator1-1/+1
2023-06-22gdb/testsuite: fix gdb.python/py-unwind.exp with python >= 3.11Ilya Leoshkevich1-1/+3
Python 3.11 changed the AttributeError message - see commit 0cb765b2cec9 ("bpo-46730: Add more info to @property AttributeError messages (GH-31311)"). Add the new message to the expectations. Approved-By: Tom Tromey <tom@tromey.com> Link: https://sourceware.org/pipermail/gdb-patches/2023-June/200433.html
2023-06-22Revert "x86: Don't check if AVX512 template requires AVX512VL"H.J. Lu1-2/+3
This reverts commit c7face14225296a2f5d3ebeb8ace88c166d80c3e.
2023-06-22[gdb/testsuite] Clean or check standard_output_file dir in gdb_initTom de Vries2-5/+41
In commit e2adba909e7 ("[gdb/testsuite] Clean up before compilation in gdb.ada/call-no-debug.exp") I added some code in the test-case to remove some files at the start of the test-case: ... remote_file host delete [standard_output_file prog.o] remote_file host delete [standard_output_file prog.ali] ... Then in commit b7b77500dc5 ("[gdb/testsuite] Clean standard_output_file dir in gdb_init") I tried to do this more structurally, by cleaning up the entire standard_output_file directory, for all test-cases. This caused a regression when using "make check -j 2", due to the cleanup removing the active gdb.log, so I reverted the commit. Try again, this time handling the two cases separately. If the standard_output_file directory contains an active gdb.log, check that the directory contains no files other than gdb.log and gdb.sum. This puts the reponsibility for the cleanup at the callers in gdb/testsuite/Makefile.in which use --outdir. If the standard_output_file directory doesn't contain an active gdb.log, clean it by removing the entire directory. An exception is made for performance tests, where cleaning up the standard_output_file dir is the wrong thing to do, because an invocation with GDB_PERFTEST_MODE == run is intended to reuse binaries left there by an earlier invocation with GDB_PERFTEST_MODE == compile. Tested on x86_64-linux. Suggested-By: Tom Tromey <tom@tromey.com> Reviewed-By: Tom Tromey <tom@tromey.com> Tested-By: Luis Machado <luis.machado@arm.com>
2023-06-22Implement DAP "hover" contextTom Tromey4-6/+119
A DAP client can request that an expression be evaluated in "hover" context, meaning that it should not cause side effects. In gdb, this can be implemented by temporarily setting a few "may-" parameters to "off". In order to make this work, I had to also change "may-write-registers" so that it can be changed while the program is running. I don't think there was any reason for this prohibition in the first place. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30476
2023-06-22Implement DAP logging breakpointsTom Tromey3-3/+132
DAP allows a source breakpoint to specify a log message. When this is done, the breakpoint acts more like gdb's dprintf: it logs a message but does not cause a stop. I looked into implement this using dprintf with the new %V printf format. However, my initial attempt at this did not work, because when the inferior is continued, the dprintf output is captured by the gdb.execute call. Maybe this could be fixed by having all inferior-continuation commands use the "&" form; the main benefit of this would be that expressions are only parsed a single time.
2023-06-22Handle supportsVariablePaging in DAPTom Tromey3-9/+25
A bug report about the supportsVariablePaging capability in DAP resulted in a clarification: when this capability is not present, DAP implementations should ignore the paging parameters to the "variables" request. This patch implements this clarification.
2023-06-22Implement type checking for DAP breakpoint requestsTom Tromey1-46/+82
I realized that with a small refactoring, it is possible to type-check the parameters to the various DAP breakpoint requests. This would have caught the earlier bug involving hitCondition.
2023-06-22Handle exceptions when creating DAP breakpointsTom Tromey3-40/+92
When creating a DAP breakpoint, a failure should be returned by setting "verified" to False. gdb didn't properly implement this, and there was a FIXME comment to this effect. This patch fixes the problem.
2023-06-22Reuse breakpoints more frequently in DAPTom Tromey1-2/+4
The DAP breakpoint code tries to reuse a breakpoint when possible. Currently it uses the condition and the hit condition (aka ignore count) when making this determination. However, these attributes are just going to be reset anyway, so this patch changes the code to exclude these from the reuse decision.
2023-06-22Fix type of DAP hitConditionTom Tromey2-5/+8
DAP specifies a breakpoint's hitCondition as a string, meaning it is an expression to be evaluated. However, gdb implemented this as if it were an integer instead. This patch fixes this oversight.
2023-06-22gdb/DAP Few bug fixes & Evaluate Array Watch varsSimon Farre2-2/+2
v2. EvaluateResult does not need a name, just as what Tom pointed out in previous review. It's only the *children* that need to be made sure that their names are valid. An identifier for a variable, can't ever have an integer as a name, anyhow (not as far as I am aware, no programming languages allow for that). Removed the f-strings and use str() instead as pointed out that f-strings might not be supported fully. v1. This patch fixes a few bugs. First of all, name of VariableReferences must always be of string type. This patch makes sure that this is the case by formatting the name. If (when) the name is an integer, this will cause clients to fail or throw errors. Fixes a bug in NoOpArrayPrinter that calculated children to be N, but only ever retrieves N-1 children, which makes Python at some time later (during fetch_children -> fetch_one_child(N) ) raise an exception (out of list index) which makes the entire request go bad. The result[self.result_name] also f-strings the printer.to_string() value, because this can potentially be a LazyString (which is a Python object, not a string) and is not serializable by json.dumps. Approved-By: Tom Tromey <tom@tromey.com>
2023-06-22Automatic date update in version.inGDB Administrator1-1/+1
2023-06-21x86: Free the symbol buffer and the relocation buffer after useH.J. Lu1-14/+28
When --no-keep-memory is used, the symbol buffer and the relocation buffer aren't cached. When packing relative relocations, we may allocate a new symbol buffer and a new relocation buffer for each eligible section in an object file. If there are many sections, memory may be exhausted. In this case, we should free the symbol buffer and the relocation buffer after use. If symbol buffer entries are used to track relative relocations against local symbols for later use, the symbol buffer should be cached. PR ld/30566 * elfxx-x86.c (elf_x86_relative_reloc_record_add): Add an argument to inform caller if the symbol buffer should be kept. (_bfd_x86_elf_link_relax_section): Call _bfd_elf_link_info_read_relocs instead of _bfd_elf_link_read_relocs. Free the symbol buffer and the relocation buffer after use. Cache the symbol buffer if it is used.
2023-06-21Add missing backslash to update-gnulib.shTom Tromey5-4/+6
A user on irc noticed a missing backslash on one line in update-gnulib.sh. This patch adds it. Re-running update-gnulib.sh causes a few copyright notices to change. Presumably these are from upstream gnulib and shouldn't be touched by our yearly update. I've updated the script to account for this, but I did not want to try testing it...
2023-06-21[gdb/testsuite] Add have_host_localeTom de Vries7-0/+42
With test-case gdb.tui/pr30056.exp, I run into: ... sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)^M ... and then subsequently into: ... WARNING: timeout in accept_gdb_output FAIL: gdb.tui/pr30056.exp: Control-C ... This is on a CentOS 7 distro for powerpc64le. Either it has no C.UTF-8 support, or it's not installed: ... $ locale -a | grep ^C C $ ... Fix this by: - adding a new proc have_host_locale, and - using it in all test-cases using setenv LC_ALL. Tested on powerpc64le-linux and x86_64-linux.
2023-06-21[gdb/testsuite] Fix gdb.tui/wrap-line.expTom de Vries1-2/+8
PR testsuite/30458 reports the following FAIL: ... PASS: gdb.tui/wrap-line.exp: width-auto-detected: cli: wrap ^CQuit (gdb) WARNING: timeout in accept_gdb_output Screen Dump (size 50 columns x 24 rows, cursor at column 6, row 3): 0 Quit 1 (gdb) 7890123456789012345678901234567890123456789 2 W^CQuit 3 (gdb) ... FAIL: gdb.tui/wrap-line.exp: width-auto-detected: cli: prompt after wrap ... The problem is that the regexp doesn't account for the ^C: ... gdb_assert { [Term::wait_for "^WQuit"] } "prompt after wrap" ... The ^C occurs occasionally. This is something we'd like to fix. It's reported as a readline problem here ( https://lists.gnu.org/archive/html/bug-readline/2023-06/msg00000.html ). For now, fix this by updating the regexp, and likewise in another place in the test-case where we use ^C. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30458
2023-06-21PR30536, ppc64el gold linker produces unusable clang-16 binaryAlan Modra1-1/+9
In commit 0961e631575b, the fix for PR30217, make_lplt_section and make_brlt_section were changed to use rela_dyn_ rather than their own separate dynamic reloc sections. This fails miserably whenever brlt_ is needed for long branches, due to needing to iterate sizing and thus reset brlt_ sizes. PR 30536 PR 30217 * powerpc.cc (Target_powerpc::make_brlt_section): Don't use rela_dyn_.
2023-06-21[gdb/testsuite] Reimplement Term::command_no_prompt_prefixTom de Vries1-3/+17
Say we run test-case gdb.tui/basic.exp. It calls Term::enter_tui, which does: ... command_no_prompt_prefix "tui enable" ... The proc command_no_prompt_prefix is documented as: ... # As proc command, but don't wait for an initial prompt. This is used for # initial terminal commands, where there's no prompt yet. ... Indeed, before the "tui enable" command, the tuiterm is empty, so there is no prompt and just before switching to TUI we have in the tuiterm: ... tui enable ... The reason that there is no prompt, is that: - in order for tuiterm to show something, its input processing procs need to be called, and - the initial gdb prompt, and subsequent prompts generated by gdb_test-style procs, are all consumed by those procs instead. This is in principle not a problem, but the absence of a prompt makes a tuiterm session look less like a session on an actual xterm. Add a new proc gen_prompt, that: - generates a prompt using echo - consumes the response before the prompt using gdb_expect - consumes the prompt using Term::wait_for "". This allows us to reimplement Term::command_no_prompt_prefix using Term::command, and just before switching to TUI we have in the tuiterm: ... (gdb) tui enable ... Tested on x86_64-linux.
2023-06-21[gdb/testsuite] Make Term::wait_for "" match only a promptTom de Vries2-0/+17
The semantics of Term::wait_for is: ... # Accept some output from gdb and update the screen. WAIT_FOR is # a regexp matching the line to wait for. Return 0 on timeout, 1 # on success. proc wait_for {wait_for} { ... Note that besides the regexp, also a subsequent gdb prompt is matched. I recently used wait_for "" in a few test-cases, thinking that this would match just a prompt, but in fact that's not the case. Fix this in wait_for, and add a corresponding test in gdb.tui/tuiterm-2.exp. Tested on x86_64-linux.
2023-06-21Prune linker warnings about an executable stack being created with the -z ↵Nick Clifton2-2/+19
execstack option. * testsuite/lib/binutils-common.exp (prune_warnings_extra): Prune warnings about -z execstack creating an executable stack.
2023-06-21For test for PR 29072 when the linker is configured with ↵Nick Clifton2-0/+22
--enable-default-execstack=no. PR 29072 * testsuite/ld-elf/elf.exp (target_defaults_to_execstack): Always return false for linkers configured with the --enable-default-execstack=no option.
2023-06-21gdbserver: use target_waitstatus::to_string in 'prepare_resume_reply'Tankut Baris Aktemur1-2/+3
Use the to_string method of target_waitstatus in 'prepare_resume_reply' for a more readable log message. Approved-By: Tom Tromey <tom@tromey.com>
2023-06-21x86: fix expansion of %XVJan Beulich1-7/+8
Only %LV should continue on to S handling; avoid emitting a stray 'l' (typically) in suffix-always mode.
2023-06-21elf32_arm_get_synthetic_symtab memory leakAlan Modra1-15/+10
ARM get_synthetic_symtab reads .plt and caches that data. Caching the data doesn't make a lot of sense since get_synthetic_symtab is only called once per bfd, and the memory might be put to better use. It also leaks on closing the bfd. * elf32-arm.c (elf32_arm_get_synthetic_symtab): Don't cache plt contents. Free plt data before returning.
2023-06-21macho-o.c don't leak strtabAlan Modra1-0/+2
* mach-o.c (bfd_mach_o_write_symtab_content): Free strtab on success path.
2023-06-21Automatic date update in version.inGDB Administrator1-1/+1
2023-06-20Use ARRAY_SIZE in ax-general.cTom Tromey1-3/+2
This changes a couple of spots in ax-general.c to use ARRAY_SIZE. While making this change, I noticed that one of the bounds checks was incorrect. Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-06-20Remove aop_lastTom Tromey2-7/+0
aop_last is only used for an assertion. However, due to the '.def' construct in the sources, this assert could never plausibly trigger (the assert predates the use of a .def file here). This patch removes the constant and the assert. Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-06-20Make aop_map 'static'Tom Tromey2-31/+30
This changes aop_map to be 'static'. Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-06-20Use bool for agent_expr::tracingTom Tromey2-9/+8
This changese agent_expr::tracing to have type bool, allowing inline initialization and cleaning up the code a little. Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-06-20Simplify agent_expr constructorTom Tromey2-17/+6
This simplifies the agent_expr constructor a bit, and removes the destructor entirely. Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-06-20Use std::vector<bool> for agent_expr::reg_maskTom Tromey3-45/+19
agent_expr::reg_mask implements its own packed boolean vector. This patch replaces it with a std::vector<bool>, simplifying the code. Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-06-20Use gdb::byte_vector in agent_exprTom Tromey6-105/+63
This changes agent_expr to use gdb::byte_vector rather than manually reimplementing a vector. Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-06-20Remove mem2hexTom Tromey1-28/+2
tracepoint.c has a 'mem2hex' function that is functionally equivalent to bin2hex. This patch removes the redundancy. Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-06-20x86: Don't check if AVX512 template requires AVX512VLH.J. Lu1-3/+2
If the ZMM operand in an AVX12 template also allows XMM or ZMM, this template must require AVX512VL. Drop the AVX512VL requirement check on such AVX512 templates. * config/tc-i386.c (check_VecOperands): Don't check if AVX512 template requires AVX512VL.
2023-06-20Use std::string in do_set_commandTom Tromey1-15/+7
do_set_command manually updates a string, only to copy it to a std::string and free the working copy. This patch changes this code to use std::string for everything, simplifying the code and removing a copy. Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-06-20Use byte_vector in remote.c:readahead_cacheTom Tromey1-11/+8
This patch changes the remote.c readahead_cache to use gdb::byte_vector. This simplifies the code by removing manual memory management. Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-06-20Use std::string in linux-osdata.cTom Tromey1-36/+15
I found some code in linux-osdata that manually managed a string. Replacing this with std::string simplifies it. Reviewed-by: John Baldwin <jhb@FreeBSD.org>
2023-06-20Use unique_xmalloc_ptr for mi_parse::commandTom Tromey5-20/+20
This changes mi_parse::command to be a unique_xmalloc_ptr and fixes up all the uses. This avoids some manual memory management. std::string is not used here due to how the Python API works -- this approach avoids an extra copy there. Reviewed-by: Keith Seitz <keiths@redhat.com>
2023-06-20Use std::string for MI tokenTom Tromey4-24/+19
This changes the MI "token" to be a std::string, removing some manual memory management. It also makes current_token 'const' in order to support this change. Reviewed-by: Keith Seitz <keiths@redhat.com>
2023-06-20Don't segfault in mips reloc special_functionsAlan Modra4-13/+30
A symbol defined in a section from a shared library will have a NULL section->output_section during linking. * elf32-mips.c (gprel32_with_gp): Don't segfault on NULL symbol->section->output_section. * elf64-mips.c (mips_elf64_gprel32_reloc): Likewise. * elfn32-mips.c (mips_elf_gprel16_reloc): Likewise. (mips_elf_literal_reloc, mips_elf_gprel32_reloc): Likewise. (gprel32_with_gp, mips16_gprel_reloc): Likewise. * elfxx-mips.c (_bfd_mips_elf_gprel16_with_gp): Likewise. (_bfd_mips_elf_generic_reloc): Likewise.
2023-06-20Automatic date update in version.inGDB Administrator1-1/+1
2023-06-19Revert "[gdb/testsuite] Clean standard_output_file dir in gdb_init"Tom de Vries2-3/+5
This reverts commit b7b77500dc56e5bc21473dd4f3dde2543d894557.
2023-06-19Fixes 28ab59607ef40b9571c0702ffba8f6aa6fb1b033Simon Farre1-3/+12
Python formatting errors fixed, introduced by this commit.
2023-06-19Fixes f1a614dc8f015743e9fe7fe5f3f019303f8db718Simon Farre1-0/+2
Fixes failure reported by buildbot regarding ill-formatted Python code.