aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-01-26gdb: convert maintenance target-async and target-non-stop settings to callbacksSimon Marchi1-36/+32
This simplifies things a bit, as we don't need two variables and think about reverting target_async_permitted_1 and target_non_stop_enabled_1 values if we can't change the setting. Change-Id: I36acab045dacf02ae1988486cfdb27c1dff309f6
2022-01-26Reference array of structs instead of first member during memcpyKeith Seitz1-1/+1
aarch64-tdep.c defines the following macro: #define MEM_ALLOC(MEMS, LENGTH, RECORD_BUF) \ do \ { \ unsigned int mem_len = LENGTH; \ if (mem_len) \ { \ MEMS = XNEWVEC (struct aarch64_mem_r, mem_len); \ memcpy(&MEMS->len, &RECORD_BUF[0], \ sizeof(struct aarch64_mem_r) * LENGTH); \ } \ } \ while (0) This is simlpy allocating a new array and copying it. However, for the destination address, it is actually copying into the first member of the first element of the array (`&MEMS->len"). This elicits a warning with GCC 12: ../../binutils-gdb/gdb/aarch64-tdep.c: In function ‘int aarch64_process_record(gdbarch*, regcache*, CORE_ADDR)’: ../../binutils-gdb/gdb/aarch64-tdep.c:3711:23: error: writing 16 bytes into a region of size 8 [-Werror=stringop-overflow=] 3711 | memcpy(&MEMS->len, &RECORD_BUF[0], \ | ^ ../../binutils-gdb/gdb/aarch64-tdep.c:4394:3: note: in expansion of macro ‘MEM_ALLOC’ 4394 | MEM_ALLOC (aarch64_insn_r->aarch64_mems, aarch64_insn_r->mem_rec_count, | ^~~~~~~~~ ../../binutils-gdb/gdb/aarch64-tdep.c:3721:12: note: destination object ‘aarch64_mem_r::len’ of size 8 3721 | uint64_t len; /* Record length. */ | ^~~ The simple fix is to reference the array, `MEMS' as the destination of the copy. Tested by rebuilding. # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Tue Jan 25 08:28:32 2022 -0800 # # On branch master # Your branch is ahead of 'origin/master' by 1 commit. # (use "git push" to publish your local commits) # # Changes to be committed: # modified: aarch64-tdep.c #
2022-01-26gdb: add string_file::release methodSimon Marchi17-34/+35
A common pattern for string_file is to want to move out the internal string buffer, because it is the result of the computation that we want to return. It is the reason why string_file::string returns a non-const reference, as explained in the comment. I think it would make sense to have a dedicated method for that instead and make string_file::string return a const reference. This allows removing the explicit std::move in the typical case. Note that compile_program::compute was missing a move, meaning that the resulting string was copied. With the new version, it's not possible to forget to move. Change-Id: Ieaefa35b73daa7930b2f3a26988b6e3b4121bb79
2022-01-26Add a way to temporarily set a gdb parameter from PythonTom Tromey4-0/+70
It's sometimes useful to temporarily set some gdb parameter from Python. Now that the 'endian' crash is fixed, and now that the current language is no longer captured by the Python layer, it seems reasonable to add a helper function for this situation. This adds a new gdb.with_parameter function. This creates a context manager which temporarily sets some parameter to a specified value. The old value is restored when the context is exited. This is most useful with the Python "with" statement: with gdb.with_parameter('language', 'ada'): ... do Ada stuff This also adds a simple function to set a parameter, gdb.set_parameter, as suggested by Andrew. This is PR python/10790. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=10790
2022-01-26Fix another crash with gdb parameters in PythonTom Tromey9-12/+41
While looking into the language-capturing issue, I found another way to crash gdb using parameters from Python: (gdb) python print(gdb.parameter('endian')) (This is related to PR python/12188, though this patch isn't going to fix what that bug is really about.) The problem here is that the global variable that underlies the "endian" parameter is initialized to NULL. However, that's not a valid value for an "enum" set/show parameter. My understanding is that, in gdb, an "enum" parameter's underlying variable must have a value that is "==" (not just strcmp-equal) to one of the values coming from the enum array. This invariant is relied on in various places. I started this patch by fixing the problem with "endian". Then I added some assertions to add_setshow_enum_cmd to try to catch other problems of the same type. This patch fixes all the problems that I found. I also looked at all the calls to add_setshow_enum_cmd to ensure that they were all included in the gdb I tested. I think they are: there are no calls in nat-* files, or in remote-sim.c; and I was trying a build with all targets, Python, and Guile enabled. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=12188
2022-01-26Change how Python architecture and language are handledTom Tromey20-105/+146
Currently, gdb's Python layer captures the current architecture and language when "entering" Python code. This has some undesirable effects, and so this series changes how this is handled. First, there is code like this: gdbpy_enter enter_py (python_gdbarch, python_language); This is incorrect, because both of these are NULL when not otherwise assigned. This can cause crashes in some cases -- I've added one to the test suite. (Note that this crasher is just an example, other ones along the same lines are possible.) Second, when the language is captured in this way, it means that Python code cannot affect the current language for its own purposes. It's reasonable to want to write code like this: gdb.execute('set language mumble') ... stuff using the current language gdb.execute('set language previous-value') However, this won't actually work, because the language is captured on entry. I've added a test to show this as well. This patch changes gdb to try to avoid capturing the current values. The Python concept of the current gdbarch is only set in those few cases where a non-default value is computed or needed; and the language is not captured at all -- instead, in the cases where it's required, the current language is temporarily changed.
2022-01-26bfd: Make bfd.stamp depend on source bfd.texiH.J. Lu2-4/+6
Make bfd.stamp depend on source bfd.texi to avoid regenerating doc/bfd.info for each make run. PR binutils/28807 * Makefile.in: Regenerate. * doc/local.mk (%D%/bfd.stamp): Depend on $(srcdir)/%D%/bfd.texi.
2022-01-26ld: Rewrite lang_size_relro_segment_1H.J. Lu4-44/+118
1. Compute the desired PT_GNU_RELRO segment base and find the maximum section alignment of sections starting from the PT_GNU_RELRO segment. 2. Find the first preceding load section. 3. Don't add the 1-page gap between the first preceding load section and the relro segment if the maximum page size >= the maximum section alignment. Align the PT_GNU_RELRO segment first. Subtract the maximum page size if therer is still a 1-page gap. PR ld/28743 PR ld/28819 * ldlang.c (lang_size_relro_segment_1): Rewrite. * testsuite/ld-x86-64/pr28743-1.d: New file. * testsuite/ld-x86-64/pr28743-1.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run pr28743-1.
2022-01-26gdb/testsuite: Ensure constant test name in gdb.base/break-interp.expLancelot SIX1-1/+1
When running the testsuite, I have lines similar to the following in the gdb.sum file: ~~~ PASS: gdb.base/break-interp.exp: ldprelink=NO: ldsepdebug=NO: first backtrace: p /x 0x7f283d2f0fd1 ... PASS: gdb.base/break-interp.exp: ldprelink=NO: ldsepdebug=NO: binprelink=NO: binsepdebug=NO: binpie=NO: INNER: first backtrace: p /x 0x7f00de0317a5 ... ~~~ The address part of the command might change between execution of the test, which adds noise to a diff between two .sum files. This patch changes to test name to "p /x $pc" in order to have constant test name. Tested on x86_64-Linux. Change-Id: I973c1237a084dd6d424276443cbf0920533c9a21
2022-01-26Automatic date update in version.inGDB Administrator1-1/+1
2022-01-25Always print the "host libthread-db" message to stdoutTom Tromey1-9/+2
linux-thread-db.c has a bit of unusual code that unconditionally prints a message, but decides whether to print to gdb_stdout or gdb_stdlog based on a debug flag. It seems better to me to simply always print this; and this is the only spot in gdb where we conditionally pass gdb_stdout to one of the f*_unfiltered functions.
2022-01-25Reduce explicit use of gdb_stdoutTom Tromey20-127/+109
In an earlier version of the pager rewrite series, it was important to audit unfiltered output calls to see which were truly necessary. This is no longer necessary, but it still seems like a decent cleanup to change calls to avoid explicitly passing gdb_stdout. That is, rather than using something like fprintf_unfiltered with gdb_stdout, the code ought to use plain printf_unfiltered instead. This patch makes this change. I went ahead and converted all the _filtered calls I could find, as well, for the same clarity.
2022-01-25Sent timing stats to gdb_stdlogTom Tromey1-22/+25
This changes the time / space / symtab per-command statistics code to send its output to gdb_stdlog rather than gdb_stdout. This seems slightly more correct to me.
2022-01-25Send some error output to gdb_stderrTom Tromey3-5/+6
This changes some code to send some error messages to gdb_stderr rather than gdb_stdout.
2022-01-25Fix a probem building the binutils on SPARC/amd64Klaus Ziegler2-0/+7
PR 28816 * elf/common.h (AT_SUN_HWCAP): Make definition conditional.
2022-01-25bfd: Regenerate Makefile.inH.J. Lu1-0/+1
* Makefile.in: Regenerate.
2022-01-24gold: drop old cygnus install hackMike Frysinger2-18/+10
The gold subdir doesn't actually have a manual, so this hack doesn't do anything. Plus the automake cygnus option was removed years ago by Simon in d0ac1c44885daf68f631befa37e ("Bump to autoconf 2.69 and automake 1.15.1"). So delete it here.
2022-01-24gas: drop old cygnus install hackMike Frysinger2-13/+5
This was needed when gas was using the automake cygnus option, but this was removed years ago by Simon in d0ac1c44885daf68f631befa37e ("Bump to autoconf 2.69 and automake 1.15.1"). So delete it here. The info pages are already & still installed by default w/out it.
2022-01-25Automatic date update in version.inGDB Administrator1-1/+1
2022-01-24bfd: Update doc/local.mkH.J. Lu2-7/+8
PR binutils/28807 * Makefile.in: Regenerate. * doc/local.mk (AM_MAKEINFOFLAGS): Add -I "$(srcdir)/%D%" -I %D%. (TEXI2DVI): New. (%D%/bfd.texi): Removed. (doc/bfd/index.html): Remove -I$(srcdir). Replace bfd.texi with %D%/bfd.texi.
2022-01-24bfd/doc: Fix racy build failure from missing mkdirRoland McGrath2-0/+5
bfd/ * doc/local.mk (%D%/bfdver.texi): Add mkdir command.
2022-01-24Fix a proble building the libiberty library with gcc-12.Martin Sebor2-0/+8
PR 28779 * regex.c: Suppress -Wuse-after-free.
2022-01-24gdb/doc: improve description for Window.click on Python TUI windowsAndrew Burgess1-3/+3
The description of the Window.click method doesn't mention where the coordinates are anchored (it's the top left corner). This minor tweak just mentions this point.
2022-01-24Update Bulgarian, French, Romaniam and Ukranian translation for some of the ↵Nick Clifton22-19812/+39081
sub-directories
2022-01-24Automatic date update in version.inGDB Administrator1-1/+1
2022-01-23Simplify some Rust expression-evaluation codeTom Tromey2-54/+29
A few Rust operations do a bit of work in their 'evaluate' functions and then call another function -- but are also the only caller. This patch simplifies this code by removing the extra layer. Tested on x86-64 Fedora 34. I'm checking this in.
2022-01-23bfd: Partially revert commit 0e3839bde6fH.J. Lu2-62/+64
Partially revert commit 0e3839bde6f93e1e3eefce815be3636e3d81054d Author: H.J. Lu <hjl.tools@gmail.com> Date: Sun Jan 23 07:29:27 2022 -0800 bfd: Properly install library and header files PR binutils/28807 * Makefile.am: Revert bfdlib_LTLIBRARIES and bfdinclude_HEADERS changes. * Makefile.in: Regenerate.
2022-01-23bfd: Properly install library and header filesH.J. Lu3-72/+64
Rename bfdlib_LTLIBRARIES and bfdinclude_HEADERS to lib_LTLIBRARIES and include_HEADERS to fix the missing installed library and header files in bfd caused by commit bd32be01c997f686ab0b53f0640eaa0aeb61fbd3 Author: Mike Frysinger <vapier@gentoo.org> Date: Fri Dec 3 00:23:20 2021 -0500 bfd: merge doc subdir up a level PR binutils/28807 * Makefile.am (bfdlib_LTLIBRARIES): Renamed to ... (lib_LTLIBRARIES): This. (bfdinclude_HEADERS): Renamed to ... (include_HEADERS): This. * Makefile.in: Regenerate. * doc/local.mk (install): Removed.
2022-01-23Regenerate Makefile.in files with automake 1.15.1H.J. Lu8-8/+0
Regenerate Makefile.in files with the unmodified automake 1.15.1 to remove runstatedir = @runstatedir@ bfd/ * Makefile.in: Regenerate. binutils/ * Makefile.in: Regenerate. gas/ * Makefile.in: Regenerate. gold/ * Makefile.in: Regenerate. * testsuite/Makefile.in: Likewise. gprof/ * Makefile.in: Regenerate. ld/ * Makefile.in: Regenerate. opcodes/ * Makefile.in: Regenerate.
2022-01-23Regenerate configure files with autoconf 2.69H.J. Lu7-103/+19
Regenerate configure files with the unmodified autoconf 2.69 to remove --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] bfd/ * configure: Regenerate. binutils/ * configure: Regenerate. gas/ * configure: Regenerate. gold/ * configure: Regenerate. gprof/ * configure: Regenerate. ld/ * configure: Regenerate. opcodes/ * configure: Regenerate.
2022-01-23Automatic date update in version.inGDB Administrator1-1/+1
2022-01-22bfd: merge doc subdir up a levelMike Frysinger7-1158/+628
This avoids a recursive make into the doc subdir and speeds up the build slightly. It also allows for more parallelism.
2022-01-22bfd: rename core.texi to corefile.texiMike Frysinger4-10/+4
This is a generated file name from a correspondingly named C file. Rename it to avoid unique build rules since there's no difference to the generated manual.
2022-01-22bfd: replace doc header generation with pattern rulesMike Frysinger2-156/+12
This unifies boilerplate rules for most files with pattern rules.
2022-01-22Allow inferring tmp_prefix from the dll name from a def file.Martin Storsj?2-17/+22
2022-01-22Adjust default page sizes for haiku arm.Alexander von Gluck IV3-3/+9
* configure.tgt (arm-haiku): Fix typo. * emulparams/armelf_haiku.su (MAXPAGESIZE): Use the default value. (COMMONPAGESIZE): Likewise.
2022-01-22Update release makeing script with new release numbersNick Clifton1-16/+19
2022-01-22Change version number to 2.38.50 and regenerate filesNick Clifton25-2296/+2660
2022-01-22Add markers for 2.38 branchNick Clifton18-0/+63
2022-01-22RISC-V: create new frag after alignment.Lifang Xia1-0/+6
PR 28793: The alignment may be removed in linker. We need to create new frag after alignment to prevent the assembler from computing static offsets. gas/ * config/tc-riscv.c (riscv_frag_align_code): Create new frag.
2022-01-22Automatic date update in version.inGDB Administrator1-1/+1
2022-01-21gdb: include gdbsupport/buildargv.h in ser-mingw.cSimon Marchi1-0/+1
Fixes: CXX ser-mingw.o /home/simark/src/binutils-gdb/gdb/ser-mingw.c: In function ‘int pipe_windows_open(serial*, const char*)’: /home/simark/src/binutils-gdb/gdb/ser-mingw.c:870:3: error: ‘gdb_argv’ was not declared in this scope 870 | gdb_argv argv (name); | ^~~~~~~~ Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28802 Change-Id: I7f3e8ec5f9ca8582d587545fdf6b69901259f199
2022-01-21Updated Serbian translation for the ld sub-directoryNick Clifton2-1989/+2270
2022-01-21gdb/doc: fill in two missing @rAndrew Burgess1-2/+2
I noticed two places in the docs where we appear to be missing @r. makeinfo seems to do the correct things despite these being missing (at least, I couldn't see any difference in the pdf or info output), but it doesn't hurt to have the @r in place.
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.