aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-01-21drop old unused stamp-h.in fileMike Frysinger6-6/+0
This was needed by ancient versions of automake, but that hasn't been the case since at least automake-1.5, so punt this from the tree.
2022-01-20gdbsupport/gdb_regex.cc: replace defs.h include with common-defs.hSimon Marchi1-1/+1
This was forgotten when gdb_regex was moved from gdb to gdbsupport. Change-Id: I73b446f71861cabbf7afdb7408ef9d59fa64b804
2022-01-21Automatic date update in version.inGDB Administrator1-1/+1
2022-01-20Avoid bad breakpoints with --gc-sectionsTom Tromey5-2/+109
We found a case where --gc-sections can cause gdb to set an invalid breakpoint. In the included test case, gdb will set a breakpoint with two locations, one of which is 0x0. The code in lnp_state_machine::check_line_address is intended to filter out this sort of problem, but in this case, the entire CU is empty, causing unrelocated_lowpc==0x0 -- which circumvents the check. It seems to me that if a CU is empty like this, then it is ok to simply ignore the line table, as there won't be any locations anyway.
2022-01-20Automatic date update in version.inGDB Administrator1-1/+1
2022-01-19Add `set print array-indexes' tests for C/C++ arraysMaciej W. Rozycki3-0/+217
Add `set print array-indexes' tests for C/C++ arrays, complementing one for Fortran arrays.
2022-01-19Respect `set print array-indexes' with Fortran arraysMaciej W. Rozycki5-27/+279
Add `set print array-indexes' handling for Fortran arrays. Currently the setting is ignored and indices are never shown. Keep track of the most recent index handled so that any outstanding repeated elements printed when the limit set by `set print elements' is hit have the correct index shown. Output now looks like: (gdb) set print array-indexes on (gdb) print array_1d $1 = ((-2) = 1, (-1) = 1, (0) = 1, (1) = 1, (2) = 1) (gdb) set print repeats 4 (gdb) set print elements 12 (gdb) print array_2d $2 = ((-2) = ((-2) = 2, <repeats 5 times>) (-1) = ((-2) = 2, <repeats 5 times>) (0) = ((-2) = 2, (-1) = 2, ...) ...) (gdb) for a 5-element vector and a 5 by 5 array filled with the value of 2.
2022-01-19Add `set print repeats' tests for C/C++ arraysMaciej W. Rozycki4-0/+243
Add `set print repeats' tests for C/C++ arrays, complementing one for Fortran arrays and covering the different interpretation of the `set print elements' setting in particular where the per-dimension count of the elements handled is matched against the trigger rather than the total element count as with Fortran arrays.
2022-01-19Respect `set print repeats' with Fortran arraysMaciej W. Rozycki8-28/+572
Implement `set print repeats' handling for Fortran arrays. Currently the setting is ignored and always treated as if no limit was set. Unlike the generic array walker implemented decades ago the Fortran one is a proper C++ class. Rather than trying to mimic the old walker then, which turned out a bit of a challenge where interacting with the `set print elements' setting, write it entirely from scratch, by adding an extra specialization handler method for processing dimensions other than the innermost one and letting the specialization class call the `walk_1' method from the handler as it sees fit. This way repeats can be tracked and the next inner dimension recursed into as a need arises only, or unconditionally in the base class. Keep track of the dimension number being handled in the class rather as a parameter to the walker so that it does not have to be passed across by the specialization class. Use per-dimension element count tracking, needed to terminate processing early when the limit set by `set print elements' is hit. This requires extra care too where the limit triggers exactly where another element that is a subarray begins. In that case rather than recursing we need to terminate processing or lone `(...)' would be printed. Additionally if the skipped element is the last one in the current dimension we need to print `...' by hand, because `continue_walking' won't print it at the upper level, because it can see the last element has already been taken care of. Preserve the existing semantics of `set print elements' where the total count of the elements handled is matched against the trigger level which is unlike with the C/C++ array printer where the per-dimension element count is used instead. Output now looks like: (gdb) set print repeats 4 (gdb) print array_2d $1 = ((2, <repeats 5 times>) <repeats 5 times>) (gdb) set print elements 12 (gdb) print array_2d $2 = ((2, <repeats 5 times>) (2, <repeats 5 times>) (2, 2, ...) ...) (gdb) for a 5 by 5 array filled with the value of 2. Amend existing test cases accordingly that rely on the current incorrect behavior and explicitly request that there be no limit for printing repeated elements there. Add suitable test cases as well covering sliced arrays in particular. Co-Authored-By: Andrew Burgess <andrew.burgess@embecosm.com>
2022-01-19fbsd-nat: Add include for gdb_argv.John Baldwin1-0/+1
2022-01-19PowerPC64 DT_RELR ELFv1Alan Modra1-14/+14
More fun with R_PPC64_NONE found in .opd. Fixed by the allocate_dynrelocs and ppc64_elf_size_dynamic_sections changes, and since we are doing ifunc, opd and SYMBOL_REFERENCES_LOCAL tests later, don't duplicate that work in check_relocs. * elf64-ppc.c (ppc64_elf_check_relocs): Remove opd and ifunc conditions for rel_count. (dec_dynrel_count): Likewise. (allocate_dynrelocs): Test for opd and ifunc when allocating relative relocs. (ppc64_elf_size_dynamic_sections): Likewise.
2022-01-19PowerPC64 DT_RELR local PLTAlan Modra1-1/+2
Similarly to the local GOT case. * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Don't allocate space for PLT relocs against local syms when enable_dt_relr.
2022-01-19PowerPC64 DT_RELR local GOTAlan Modra1-4/+6
Fixes another case where we end up with superfluous R_PPC64_NONE. * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Don't allocate space for GOT relocs against non-TLS local syms when enable_dt_relr. (ppc64_elf_layout_multitoc): Likewise.
2022-01-19Automatic date update in version.inGDB Administrator1-1/+1
2022-01-19Re: PowerPC64 DT_RELRAlan Modra1-5/+3
HJ: "There are 238 R_PPC64_NONEs in libc.so.6 alone." Indeed, let's make them go away. I had the SYMBOL_REFERENCES_LOCAL test in the wrong place. check_relocs is too early to know whether a symbol is dynamic in a shared library. Lots of glibc symbols are made local by version script, but that doesn't happen until size_dynamic_sections. * elf64-ppc.c (ppc64_elf_check_relocs): Don't count relative relocs here depending on SYMBOL_REFERENCES_LOCAL. (dec_dynrel_count): Likewise. (allocate_dynrelocs): Do so here instead.
2022-01-18Fix the remote-sim.c buildTom Tromey1-0/+1
My earlier patch to move gdb_argv broke the remote-sim.c build. This patch fixes the bug. I'm checking it in.
2022-01-18gdbserver: introduce remote_debug_printfSimon Marchi5-97/+48
Add remote_debug_printf, and use it for all debug messages controlled by remote_debug. Change remote_debug to be a bool, which is trivial in this case. Change-Id: I90de13cb892faec3830047b571661822b126d6e8
2022-01-18gdbserver: introduce threads_debug_printf, THREADS_SCOPED_DEBUG_ENTER_EXITSimon Marchi13-798/+483
Add the threads_debug_printf and THREADS_SCOPED_DEBUG_ENTER_EXIT, which use the logging infrastructure from gdbsupport/common-debug.h. Replace all debug_print uses that are predicated by debug_threads with threads_dethreads_debug_printf. Replace uses of the debug_enter and debug_exit macros with THREADS_SCOPED_DEBUG_ENTER_EXIT, which serves essentially the same purpose, but allows showing what comes between the enter and the exit in an indented form. Note that "threads" debug is currently used for a bit of everything in GDBserver, not only threads related stuff. It should ideally be cleaned up and separated logically as is done in GDB, but that's out of the scope of this patch. Change-Id: I2d4546464462cb4c16f7f1168c5cec5a89f2289a
2022-01-18gdbserver: turn debug_threads into a booleanSimon Marchi5-17/+11
debug_threads is always used as a boolean. Except in ax.cc and tracepoint.cc. These files have their own macros that use debug_threads, and have a concept of verbosity level. But they both have a single level, so it's just a boolean in the end. Remove this concept of level. If we ever want to re-introduce it, I think it will be better implemented in a more common location. Change debug_threads to bool and adjust some users that were treating it as an int. Change-Id: I137f596eaf763a08c977dd74417969cedfee9ecf
2022-01-18Simplify Ada catchpointsTom Tromey1-65/+3
All the Ada catchpoints use the same breakpoint_ops contents, because the catchpoint itself records its kind. This patch simplifies the code by removing the redundant ops structures.
2022-01-18Move "catch exec" to a new fileTom Tromey3-191/+237
The "catch exec" code is reasonably self-contained, and so this patch moves it out of breakpoint.c (the second largest source file in gdb) and into a new file, break-catch-exec.c.
2022-01-18Move "catch fork" to a new fileTom Tromey3-243/+287
The "catch fork" code is reasonably self-contained, and so this patch moves it out of breakpoint.c (the second largest source file in gdb) and into a new file, break-catch-fork.c.
2022-01-18Unify "catch fork" and "catch vfork"Tom Tromey1-142/+41
I noticed that "catch fork" and "catch vfork" are nearly identical. This patch simplifies the code by unifying these two cases.
2022-01-18Move gdb_regex to gdbsupportTom Tromey29-34/+36
This moves the gdb_regex convenience class to gdbsupport.
2022-01-18Introduce gdb-hashtab module in gdbsupportTom Tromey10-59/+110
gdb has some extensions and helpers for working with the libiberty hash table. This patch consolidates these and moves them to gdbsupport.
2022-01-18Move gdb obstack code to gdbsupportTom Tromey63-69/+72
This moves the gdb-specific obstack code -- both extensions like obconcat and obstack_strdup, and things like auto_obstack -- to gdbsupport.
2022-01-18Move gdb_argv to gdbsupportTom Tromey18-185/+220
This moves the gdb_argv class to a new header in gdbsupport.
2022-01-18Simplify event_location_probeTom Tromey3-23/+16
event_location_probe currently stores two strings, but really only needs one. This patch simplifies it and removes some unnecessary copies as well.
2022-01-18Use std::string in event_locationTom Tromey2-39/+34
This changes event_location to use std::string, removing some manual memory management, and an unnecessary string copy.
2022-01-18Split event_location into subclassesTom Tromey1-239/+281
event_location uses the old C-style discriminated union approach. However, it's better to use subclassing, as this makes the code clearer and removes some chances for error. This also enables future cleanups to avoid manual memory management and copies.
2022-01-18Remove EL_* macros from location.cTom Tromey1-93/+90
This patch removes the old-style EL_* macros from location.c. This cleans up the code by itself, IMO, but also enables further cleanups in subsequent patches.
2022-01-18Boolify explicit_to_string_internalTom Tromey1-8/+8
This changes explicit_to_string_internal to use 'bool' rather than 'int'.
2022-01-18Remove a use of xfree in location.cTom Tromey3-23/+13
This small cleanup removes a use of xfree from location.c, by switching to unique_xmalloc_ptr. One function is only used in location.c, so it is made static. And, another function is changed to avoid a copy.
2022-01-18gdb: use ptid_t::to_string instead of target_pid_to_str in debug statementsSimon Marchi8-71/+71
Same idea as 0fab79556484 ("gdb: use ptid_t::to_string in infrun debug messages"), but throughout GDB. Change-Id: I62ba36eaef29935316d7187b9b13d7b88491acc1
2022-01-18gdb: preserve `|` in connection details stringAndrew Burgess3-6/+87
Consider this GDB session: $ gdb -q (gdb) target remote | gdbserver - ~/tmp/hello.x Remote debugging using | gdbserver - ~/tmp/hello.x ... snip ... (gdb) info connections Num What Description * 1 remote gdbserver - ~/tmp/hello.x Remote target using gdb-specific protocol (gdb) python conn = gdb.selected_inferior().connection (gdb) python print(conn.details) gdbserver - ~/tmp/hello.x (gdb) I think there are two things wrong here, first in the "What" column of the 'info connections' output, I think the text should be: remote | gdbserver - ~/tmp/hello.x to correctly show the user how the connection was established. And in a similar fashion, I think that the `details` string of the gdb.TargetConnection object should be: | gdbserver - ~/tmp/hello.x This commit makes this change. Currently the '|' is detected and removed in gdb/serial.c. The string passed to the pipe_ops structure (from gdb/ser-pipe.c), doesn't then, contain the `|`, this is instead implied by the fact that it is a pipes based implementation of the serial_ops interface. After this commit we still detect the `|` in gdb/serial.c, but we now store the full string (including the `|`) in the serial::name member variable. For pipe based serial connections, this name is only used for displaying the two fields I mention above, and in pipe_open (from gdb/ser-pipe.c), and in pipe_open, we now know to skip over the `|`. The benefit I see from this change is that GDB's output now more accurately reflects the commands used to start a target, thus making it easier for a user to understand what is going on.
2022-01-18gdb: testsuite: print explicit test result for gdb.base/dfp-test.expTiezhu Yang1-0/+1
In the current code, if decimal floating point is not supported for this target, there is no binary file dfp-test, and also there is no test result after execute the following commands: $ make check-gdb TESTS="gdb.base/dfp-test.exp" $ grep error gdb/testsuite/gdb.log /home/loongson/gdb.git/gdb/testsuite/gdb.base/dfp-test.c:39:1: error: decimal floating point not supported for this target [...] $ cat gdb/testsuite/gdb.sum [...] Running target unix Running /home/loongson/gdb.git/gdb/testsuite/gdb.base/dfp-test.exp ... === gdb Summary === [...] With this patch: $ make check-gdb TESTS="gdb.base/dfp-test.exp" $ cat gdb/testsuite/gdb.sum [...] Running target unix Running /home/loongson/gdb.git/gdb/testsuite/gdb.base/dfp-test.exp ... UNSUPPORTED: gdb.base/dfp-test.exp: decimal floating point not supported for this target. === gdb Summary === # of unsupported tests 1 [...] Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
2022-01-17bfd/elf64-ppc.c: fix clang -Wbitwise-instead-of-logical warning in ↵Simon Marchi1-2/+4
ppc64_elf_check_init_fini I see this error with clang-14: CC elf64-ppc.lo /home/smarchi/src/binutils-gdb/bfd/elf64-ppc.c:13131:11: error: use of bitwise '&' with boolean operands [-Werror,-Wbitwise-instead-of-logical] return (check_pasted_section (info, ".init") ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix by replacing & with &&. But given that the check_pasted_section function has side-effects and we want to make sure both calls are made, assign to temporary variables before evaluating the `&&`. Change-Id: I849e1b2401bea5f4d8ef3ab9af99ba9e3ef42490
2022-01-18PR28029, debuginfod testsAlan Modra1-50/+62
binutils/NEWS says of the change in --process-links semantics: If other debug section display options are also enabled (eg --debug-dump=info) then the contents of matching sections in both the main file and the separate debuginfo file *will* be displayed. This is because in most cases the debug section will only be present in one of the files. Implying that debug info is dumped without --process-links. Indeed that appears to be the case for readelf. This does the same for objdump. PR 28029 * objdump.c (dump_bfd): Do not exit early when !is_mainfile && !processlinks, instead just exclude non-debug output. (dump_dwarf): Add is_mainfile parameter and pass to dump_dwarf_section. (dump_dwarf_section): Only display debug sections when !is_mainfile and !process_links.
2022-01-18Check thin archive element file size against archive headerAlan Modra1-1/+11
Makes it a little less likely for someone to break their thin archives. * archive.c (_bfd_get_elt_at_filepos): Check thin archive element file size.
2022-01-18lang_size_relro_segment tidyAlan Modra1-16/+4
This function has seen too many minimal change style edits. No functional changes in this patch. * ldlang.c (lang_size_relro_segment): Tidy.
2022-01-18PowerPC64 DT_RELRAlan Modra7-87/+518
PowerPC64 takes a more traditional approach to DT_RELR than x86. Count relative relocs in check_relocs, allocate space for them and output in the usual places but not doing so when enable_dt_relr. DT_RELR is sized in the existing ppc stub relaxation machinery, run via the linker's ldemul_after_allocation hook. DT_RELR is output in the same function that writes ppc stubs, run via ldemul_finish. This support should be considered experimental. bfd/ * elf64-ppc.c (struct ppc_local_dyn_relocs): Renamed from ppc_dyn_relocs. Add rel_count field. Update uses. (struct ppc_dyn_relocs): New. Replace all uses of elf_dyn_relocs. (struct ppc_link_hash_table): Add relr_alloc, relr_count and relr_addr. (ppc64_elf_copy_indirect_symbol): Merge rel_count. (ppc64_elf_check_relocs): Init rel_count for global and local syms. (dec_dynrel_count): Change r_info param to reloc pointer. Update all callers. Handle decrementing rel_count. (allocate_got): Don't allocate space for relative relocs when enable_dt_relr. (allocate_dynrelocs): Likewise. (ppc64_elf_size_dynamic_sections): Likewise. Handle srelrdyn. (ppc_build_one_stub): Don't emit relative relocs on .branch_lt. (compare_relr_address, append_relr_off): New functions. (got_and_plt_relr_for_local_syms, got_and_plt_relr): Likewise. (ppc64_elf_size_stubs): Size .relr.syn. (ppc64_elf_build_stubs): Emit .relr.dyn. (build_global_entry_stubs_and_plt): Don't output relative relocs when enable_dt_relr. (write_plt_relocs_for_local_syms): Likewise. (ppc64_elf_relocate_section): Likewise. binutils/ * testsuite/lib/binutils-common.exp (supports_dt_relr): Add powerpc64. ld/ * emulparams/elf64ppc.sh: Source dt-relr.sh. * testsuite/ld-elf/dt-relr-2b.d: Adjust for powerpc. * testsuite/ld-elf/dt-relr-2c.d: Likewise. * testsuite/ld-elf/dt-relr-2d.d: Likewise. * testsuite/ld-elf/dt-relr-2e.d: Likewise.
2022-01-18tweak __ehdr_start visibility and flags for check_relocsAlan Modra3-11/+42
bfd/ * elf-bfd.h (UNDEFWEAK_NO_DYNAMIC_RELOC): Test linker_def. ld/ * ldelf.c (ldelf_before_allocation): Don't force __ehdr_start local and hidden here.. * ldlang.c (lang_symbol_tweaks): ..do so here instead and set def_regular and linker_def for check_relocs. New function extracted from lang_process.
2022-01-18Automatic date update in version.inGDB Administrator1-1/+1
2022-01-17Update the config.guess and config.sub files from the master repository and ↵Nick Clifton21-5371/+6375
regenerate files.
2022-01-17Fix Z80 assembly failure.Sergey Belyashov2-0/+7
PR 28762 * app.c (do_scrub_chars): Correct handling when the symbol is not 'af'.
2022-01-17gdb/infrun: rename variable and move to more specific scopeSimon Marchi1-4/+2
Move the "started" variable to the scope it's needed, and rename it to "step_over_started". Change-Id: I56f3384dbd328f55198063bb855edda10f1492a3
2022-01-17x86: adjust struct instr_info field typesJan Beulich1-36/+39
Now that this lives on the stack, let's have it be a little less wasteful in terms of space. Switch boolean fields to "bool" (also when this doesn't change their size) and also limit the widths of "rex", "rex_used", "op_ad", and "op_index". Do a little bit of re-ordering as well to limit the number of padding holes.
2022-01-17x86: drop index16 fieldJan Beulich1-5/+3
There's a single use on a generally infrequently taken code path. Put the necessary conditional there instead.
2022-01-17x86: drop most Intel syntax register name arraysJan Beulich1-230/+119
By making use of, in particular, oappend_maybe_intel() there's no need for this redundant set of static data.
2022-01-17x86: fold variables in memory operand index handlingJan Beulich1-19/+15
There's no real need for the pseudo-boolean "haveindex" or for separate 32-bit / 64-bit index pointers. Fold them into a single "indexes" and set that uniformly to AT&T names, compensating by emitting the register name via oappend_maybe_intel().