aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-06-11Automatic date update in version.inGDB Administrator1-1/+1
2023-06-10Automatic date update in version.inGDB Administrator1-1/+1
2023-06-09libsframe: testsuite: add sframe_find_fre tests for pltN entriesIndu Bhagat4-5/+175
Add a new test plt-findfre-1 to ensure lookup of SFrame stack trace information for pltN entries is correct. In this test, a dummy SFrame FDE of type SFRAME_FDE_TYPE_PCMASK is created. The size of the 'function code block' covered by the SFrame FDE is equivalent to 5 pltN entries of 16 bytes each. The test first looks up SFrame FREs for some addresses in the first pltN entry, followed by lookups for some addresses in the fourth pltN entry. libsframe/ * Makefile.in: Regenerated. * testsuite/libsframe.find/find.exp: Add new test. * testsuite/libsframe.find/local.mk: Likewise. * testsuite/libsframe.find/plt-findfre-1.c: New test.
2023-06-09libsframe: fix sframe_find_fre for pltN entriesIndu Bhagat1-1/+1
To find SFrame stack trace information from an FDE of type SFRAME_FDE_TYPE_PCMASK, sframe_find_fre () was doing an operation like, (start_ip_offset & 0xff) >= (pc & 0xff), etc. This is buggy and needs correction. The mask 0xff should be 0xf (to work for a pltN entry of size say, 16 bytes). At this time, the size of the pltN entry is implicitly assumed to be 16 bytes by libsframe. In next version of the SFrame format, we can encode this information explicitly in the SFrame FDE. For now, we should fix the code to at least behave correctly for the generated code and the generated SFrame stack trace information for the pltN entries on x86_64. libsframe/ * sframe.c (sframe_find_fre): Correct the bitmask used for SFrame FDEs of type SFRAME_FDE_TYPE_PCMASK.
2023-06-09[AArch64,arm] Fix some formatting issues in the aarch64/arm codebaseLuis Machado2-12/+12
As noted by Tom Tromey, there are some formatting issues with the ternary operator in the aarch64/arm codebase. This patch fixes those. Reviewed-By: Tom Tromey <tom@tromey.com>
2023-06-09[gdb/tui] Simplify tui_puts_internalTom de Vries1-19/+20
Simplify tui_puts_internal by using continue, as per this [1] coding standard rule, making the function more readable and easier to understand. No functional changes. Tested on x86_64-linux. [1] https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code Reviewed-By: Tom Tromey <tom@tromey.com>
2023-06-09[gdb/tui] Delete line buffer when switching to singlekeyTom de Vries2-0/+47
Say we're in TUI mode, and type "sun": ... (gdb) sun ... After switching to SingleKey mode using C-x s, we have just: ... sun ... After typing "d", we get: ... sun Undefined command: "sundown". Try "help". ... The SingleKey "d" is supposed run the "down" command. Fix this by clearing the readline line buffer when switching to SingleKey mode. Tested on x86_64-linux. PR tui/30522 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30522 Reviewed-By: Tom Tromey <tom@tromey.com>
2023-06-09[gdb/testsuite] Add test-case gdb.tui/single-key.expTom de Vries1-0/+60
I noticed that there's no test-case excercising SingleKey mode, so add a test-case. Tested on x86_64-linux. Reviewed-By: Tom Tromey <tom@tromey.com>
2023-06-09gdb/debuginfod: cleanup debuginfod earlierAndrew Burgess1-18/+29
A GDB crash was discovered on Fedora GDB that was tracked back to an issue with the way that debuginfod is cleaned up. The bug was reported on Fedora 37, 38, and 39. Here are the steps to reproduce: 1. The file /etc/ssl/openssl.cnf contains the following lines: [provider_sect] default = default_sect ##legacy = legacy_sect ## [default_sect] activate = 1 ##[legacy_sect] ##activate = 1 The bug will occur when the '##' characters are removed so that the lines in question look like this: [provider_sect] default = default_sect legacy = legacy_sect [default_sect] activate = 1 [legacy_sect] activate = 1 2. Clean up any existing debuginfod cache data: > rm -rf $HOME/.cache/debuginfod_client 3. Run GDB: > gdb -nx -q -iex 'set trace-commands on' \ -iex 'set debuginfod enabled on' \ -iex 'set confirm off' \ -ex 'start' -ex 'quit' /bin/ls +set debuginfod enabled on +set confirm off Reading symbols from /bin/ls... Downloading separate debug info for /usr/bin/ls ... snip ... Temporary breakpoint 1, main (argc=1, argv=0x7fffffffde38) at ../src/ls.c:1646 1646 { +quit Fatal signal: Segmentation fault ----- Backtrace ----- ... snip ... So GDB ends up crashing during exit. What's happening is that when debuginfod is initialised debuginfod_begin is called (this is in the debuginfod library), this in turn sets up libcurl, which makes use of openssl. Somewhere during this setup process an at_exit function is registered to cleanup some state. Back in GDB the debuginfod_client object is managed using this code: /* Deleter for a debuginfod_client. */ struct debuginfod_client_deleter { void operator() (debuginfod_client *c) { debuginfod_end (c); } }; using debuginfod_client_up = std::unique_ptr<debuginfod_client, debuginfod_client_deleter>; And then a global debuginfod_client_up is created to hold a pointer to the debuginfod_client object. As a global this will be cleaned up using the standard C++ global object destructor mechanism, which is run after the at_exit handlers. However, it is expected that when debuginfod_end is called the debuginfod_client object will still be in a usable state, that is, we don't expect the at_exit handlers to have run and started cleaning up the library state. To fix this issue we need to ensure that debuginfod_end is called before the at_exit handlers have a chance to run. This commit removes the debuginfod_client_up type, and instead has GDB hold a raw pointer to the debuginfod_client object. We then make use of GDB's make_final_cleanup to register a function that will call debuginfod_end. As GDB's final cleanups are called before exit is called, this means that debuginfod_end will be called before the at_exit handlers are called, and the crash identified above is resolved. It's not obvious how this issue can easily be tested for. The bug does not appear to manifest when using a local debuginfod server, so we'd need to setup something more involved. For now I'm proposing this patch without any associated tests. Co-Authored-By: Mark Wielaard <mark@klomp.org> Co-Authored-By: Simon Marchi <simark@simark.ca> Reviewed-By: Tom Tromey <tom@tromey.com> Reviewed-By: Aaron Merey <amerey@redhat.com>
2023-06-09gdb: fix ASan failure after recent string changesAndrew Burgess1-1/+7
After this commit: commit baab375361c365afee2577c94cbbd3fdd443d6da Date: Tue Jul 13 14:44:27 2021 -0400 gdb: building inferior strings from within GDB It was pointed out that a new ASan failure had been introduced which was triggered by gdb.base/internal-string-values.exp: (gdb) PASS: gdb.base/internal-string-values.exp: test_setting: all langs: lang=ada: ptype "foo" print $_gdb_maint_setting("test-settings string") ================================================================= ==80377==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000068034 at pc 0x564785cba682 bp 0x7ffd20644620 sp 0x7ffd20644610 READ of size 1 at 0x603000068034 thread T0 #0 0x564785cba681 in find_command_name_length(char const*) /tmp/src/binutils-gdb/gdb/cli/cli-decode.c:2129 #1 0x564785cbacb2 in lookup_cmd_1(char const**, cmd_list_element*, cmd_list_element**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int, bool) /tmp/src/binutils-gdb/gdb/cli/cli-decode.c:2186 #2 0x564785cbb539 in lookup_cmd_1(char const**, cmd_list_element*, cmd_list_element**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int, bool) /tmp/src/binutils-gdb/gdb/cli/cli-decode.c:2248 #3 0x564785cbbcf3 in lookup_cmd(char const**, cmd_list_element*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int, int) /tmp/src/binutils-gdb/gdb/cli/cli-decode.c:2339 #4 0x564785c82df2 in setting_cmd /tmp/src/binutils-gdb/gdb/cli/cli-cmds.c:2219 #5 0x564785c84274 in gdb_maint_setting_internal_fn /tmp/src/binutils-gdb/gdb/cli/cli-cmds.c:2348 #6 0x564788167b3b in call_internal_function(gdbarch*, language_defn const*, value*, int, value**) /tmp/src/binutils-gdb/gdb/value.c:2321 #7 0x5647854b6ebd in expr::ada_funcall_operation::evaluate(type*, expression*, noside) /tmp/src/binutils-gdb/gdb/ada-lang.c:11254 #8 0x564786658266 in expression::evaluate(type*, noside) /tmp/src/binutils-gdb/gdb/eval.c:111 #9 0x5647871242d6 in process_print_command_args /tmp/src/binutils-gdb/gdb/printcmd.c:1322 #10 0x5647871244b3 in print_command_1 /tmp/src/binutils-gdb/gdb/printcmd.c:1335 #11 0x564787125384 in print_command /tmp/src/binutils-gdb/gdb/printcmd.c:1468 #12 0x564785caac44 in do_simple_func /tmp/src/binutils-gdb/gdb/cli/cli-decode.c:95 #13 0x564785cc18f0 in cmd_func(cmd_list_element*, char const*, int) /tmp/src/binutils-gdb/gdb/cli/cli-decode.c:2735 #14 0x564787c70c68 in execute_command(char const*, int) /tmp/src/binutils-gdb/gdb/top.c:574 #15 0x564786686180 in command_handler(char const*) /tmp/src/binutils-gdb/gdb/event-top.c:543 #16 0x56478668752f in command_line_handler(std::unique_ptr<char, gdb::xfree_deleter<char> >&&) /tmp/src/binutils-gdb/gdb/event-top.c:779 #17 0x564787dcb29a in tui_command_line_handler /tmp/src/binutils-gdb/gdb/tui/tui-interp.c:104 #18 0x56478668443d in gdb_rl_callback_handler /tmp/src/binutils-gdb/gdb/event-top.c:250 #19 0x7f4efd506246 in rl_callback_read_char (/usr/lib/libreadline.so.8+0x3b246) (BuildId: 092e91fc4361b0ef94561e3ae03a75f69398acbb) #20 0x564786683dea in gdb_rl_callback_read_char_wrapper_noexcept /tmp/src/binutils-gdb/gdb/event-top.c:192 #21 0x564786684042 in gdb_rl_callback_read_char_wrapper /tmp/src/binutils-gdb/gdb/event-top.c:225 #22 0x564787f1b119 in stdin_event_handler /tmp/src/binutils-gdb/gdb/ui.c:155 #23 0x56478862438d in handle_file_event /tmp/src/binutils-gdb/gdbsupport/event-loop.cc:573 #24 0x564788624d23 in gdb_wait_for_event /tmp/src/binutils-gdb/gdbsupport/event-loop.cc:694 #25 0x56478862297c in gdb_do_one_event(int) /tmp/src/binutils-gdb/gdbsupport/event-loop.cc:264 #26 0x564786df99f0 in start_event_loop /tmp/src/binutils-gdb/gdb/main.c:412 #27 0x564786dfa069 in captured_command_loop /tmp/src/binutils-gdb/gdb/main.c:476 #28 0x564786dff61f in captured_main /tmp/src/binutils-gdb/gdb/main.c:1320 #29 0x564786dff75c in gdb_main(captured_main_args*) /tmp/src/binutils-gdb/gdb/main.c:1339 #30 0x564785381b6d in main /tmp/src/binutils-gdb/gdb/gdb.c:32 #31 0x7f4efbc3984f (/usr/lib/libc.so.6+0x2384f) (BuildId: 2f005a79cd1a8e385972f5a102f16adba414d75e) #32 0x7f4efbc39909 in __libc_start_main (/usr/lib/libc.so.6+0x23909) (BuildId: 2f005a79cd1a8e385972f5a102f16adba414d75e) #33 0x564785381934 in _start (/tmp/build/binutils-gdb/gdb/gdb+0xabc5934) (BuildId: 90de353ac158646e7dab501b76a18a76628fca33) 0x603000068034 is located 0 bytes after 20-byte region [0x603000068020,0x603000068034) allocated by thread T0 here: #0 0x7f4efcee0cd1 in __interceptor_calloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:77 #1 0x5647856265d8 in xcalloc /tmp/src/binutils-gdb/gdb/alloc.c:97 #2 0x564788610c6b in xzalloc(unsigned long) /tmp/src/binutils-gdb/gdbsupport/common-utils.cc:29 #3 0x56478815721a in value::allocate_contents(bool) /tmp/src/binutils-gdb/gdb/value.c:929 #4 0x564788157285 in value::allocate(type*, bool) /tmp/src/binutils-gdb/gdb/value.c:941 #5 0x56478815733a in value::allocate(type*) /tmp/src/binutils-gdb/gdb/value.c:951 #6 0x5647854ae81c in expr::ada_string_operation::evaluate(type*, expression*, noside) /tmp/src/binutils-gdb/gdb/ada-lang.c:10675 #7 0x5647854b63b8 in expr::ada_funcall_operation::evaluate(type*, expression*, noside) /tmp/src/binutils-gdb/gdb/ada-lang.c:11184 #8 0x564786658266 in expression::evaluate(type*, noside) /tmp/src/binutils-gdb/gdb/eval.c:111 #9 0x5647871242d6 in process_print_command_args /tmp/src/binutils-gdb/gdb/printcmd.c:1322 #10 0x5647871244b3 in print_command_1 /tmp/src/binutils-gdb/gdb/printcmd.c:1335 #11 0x564787125384 in print_command /tmp/src/binutils-gdb/gdb/printcmd.c:1468 #12 0x564785caac44 in do_simple_func /tmp/src/binutils-gdb/gdb/cli/cli-decode.c:95 #13 0x564785cc18f0 in cmd_func(cmd_list_element*, char const*, int) /tmp/src/binutils-gdb/gdb/cli/cli-decode.c:2735 #14 0x564787c70c68 in execute_command(char const*, int) /tmp/src/binutils-gdb/gdb/top.c:574 #15 0x564786686180 in command_handler(char const*) /tmp/src/binutils-gdb/gdb/event-top.c:543 #16 0x56478668752f in command_line_handler(std::unique_ptr<char, gdb::xfree_deleter<char> >&&) /tmp/src/binutils-gdb/gdb/event-top.c:779 #17 0x564787dcb29a in tui_command_line_handler /tmp/src/binutils-gdb/gdb/tui/tui-interp.c:104 #18 0x56478668443d in gdb_rl_callback_handler /tmp/src/binutils-gdb/gdb/event-top.c:250 #19 0x7f4efd506246 in rl_callback_read_char (/usr/lib/libreadline.so.8+0x3b246) (BuildId: 092e91fc4361b0ef94561e3ae03a75f69398acbb) The problem is in cli/cli-cmds.c, in the function setting_cmd, where we do this: const char *a0 = (const char *) argv[0]->contents ().data (); Here argv[0] is a value* which we know is either a TYPE_CODE_ARRAY or a TYPE_CODE_STRING. The problem is that the above line is casting the value contents directly to a C-string, i.e. one that is assumed to have a null-terminator at the end. After the above commit this can no longer be assumed to be true. A string value will be represented just as it would be in the current language, so for Ada and Fortran the string will be an array of characters with no null-terminator at the end. My proposed solution is to copy the string contents into a std::string object, and then use the std::string::c_str() value, this will ensure that a null-terminator has been added. I had a check through GDB at places TYPE_CODE_STRING was used and couldn't see any other obvious places where this type of assumption was being made, so hopefully this is the only offender. Running the above test with ASan compiled in no longer gives an error. Reviewed-By: Tom Tromey <tom@tromey.com>
2023-06-09Use scoped_value_mark in two more placesTom Tromey2-13/+10
I found a couple of spots that could use scoped_value_mark. One of them is a spot that didn't consider the possibility that value_mark can return NULL. I tend to doubt this can be seen in this context, but nevertheless this is safer. Regression tested on x86-64 Fedora 36.
2023-06-09[gdb] Fix typosTom de Vries3-4/+4
Fix typos: - reponse -> response - inital -> initial - a -> an
2023-06-09readelf/objdump remember_state memory leaksAlan Modra1-5/+7
* dwarf.c (display_debug_frames <DW_CFA_restore_state>): Do free invalid remember_state.
2023-06-09ecoff find_nearest_line and final link leaksAlan Modra10-84/+66
Freeing ecoff_debug_info "pointers to the unswapped symbolic info" isn't a simple matter, due to differing allocation strategies. In _bfd_ecoff_slurp_symbolic_info the pointers are to objalloc memory. In the ecoff linker they are to separately malloc'd memory. In gas we have most (obj-elf) or all (obj-ecoff) into a single malloc'd buffer. This patch fixes the leaks for binutils and ld, leaving the gas leaks for another day. The mips elf backend already had this covered, and the ecoff backend had a pointer, raw_syments used as a flag, so most of the patch is moving these around a little so they are accessible for both ecoff and elf. include/ * coff/ecoff.h (struct ecoff_debug_info): Add alloc_syments. bfd/ * libecoff.h (struct ecoff_tdata): Delete raw_syments. * elfxx-mips.c (free_ecoff_debug): Delete. Replace uses with _bfd_ecoff_free_ecoff_debug_info. (_bfd_mips_elf_final_link): Init debug.alloc_syments. * ecofflink.c (_bfd_ecoff_free_ecoff_debug_info): New function. * ecoff.c (_bfd_ecoff_bfd_free_cached_info): Call _bfd_ecoff_free_ecoff_debug_info. (_bfd_ecoff_slurp_symbolic_info): Replace uses of raw_syments with alloc_syments. (ecoff_final_link_debug_accumulate): Likewise. Use _bfd_ecoff_free_ecoff_debug_info. (_bfd_ecoff_bfd_copy_private_bfd_data): Set alloc_syments for copied output. * elf64-alpha.c (elf64_alpha_read_ecoff_info): Use _bfd_ecoff_free_ecoff_debug_info. * libbfd-in.h (_bfd_ecoff_free_ecoff_debug_info): Declare. * libbfd.h: Regenerate. gas/ * config/obj-ecoff.c (ecoff_frob_file): Set alloc_syments. * config/obj-elf.c (elf_frob_file_after_relocs): Likewise.
2023-06-09Automatic date update in version.inGDB Administrator1-1/+1
2023-06-09[gdb/testsuite] Add test-case gdb.tui/long-prompt.expTom de Vries1-0/+158
I noticed that the test-suite doesn't excercise the case in tui_redisplay_readline that height (initially 1) is changed by this call: ... tui_puts_internal (w, prompt, &height); ... Add a test-case that excercises this. Tested on x86_64-linux.
2023-06-08gdb/corelow.c: do not try to reopen a file if open failed onceLancelot SIX1-9/+18
In the current implementation, core_target::build_file_mappings will try to locate and open files which were mapped in the process for which the core dump was produced. If the file cannot be found or cannot be opened, GDB will re-try to open it once for each time it was mapped in the process's address space. This patch makes it so GDB recognizes that it has already failed to open a given file once and does not re-try the process for each mapping. Reviewed-By: John Baldwin <jhb@FreeBSD.org> Approved-By: Andrew Burgess <aburgess@redhat.com>
2023-06-08gdb/corelow.c: avoid repeated warnings in build_file_mappingsLancelot SIX1-12/+5
When GDB opens a coredump it tries to locate and then open all files which were mapped in the process. If a file is found but cannot be opened with BFD (bfd_open / bfd_check_format fails), then a warning is printed to the user. If the same file was mapped multiple times in the process's address space, the warning is printed once for each time the file was mapped. I find this un-necessarily noisy. This patch makes it so the warning message is printed only once per file. There was a comment in the code assuming that if the file was found on the system, opening it (bfd_open + bfd_check_format) should always succeed. A recent change in BFD (014a602b86f "Don't optimise bfd_seek to same position") showed that this assumption is not valid. For example, it is possible to have a core dump of a process which had mmaped an IO page from a DRI render node (/dev/dri/runderD$NUM). In such case the core dump does contain the information that portions of this special file were mapped in the host process, but trying to seek to position 0 will fail, making bfd_check_format fail. This patch removes this comment. Reviewed-By: John Baldwin <jhb@FreeBSD.org> Approved-By: Andrew Burgess <aburgess@redhat.com>
2023-06-08gdb/corelow.c: fix use-after-free in build_file_mappingsLancelot SIX1-2/+2
In core_target::build_file_mappings, GDB tries to open files referenced in the core dump. The process goes like this: struct bfd *bfd = bfd_map[filename]; if (bfd == nullptr) { bfd = bfd_map[filename] = bfd_openr (expanded_fname.get (), "binary"); if (bfd == nullptr || !bfd_check_format (bfd, bfd_object)) { if (bfd != nullptr) bfd_close (bfd); return; } } asection *sec = bfd_make_section_anyway (bfd, "load"); ... The problem is that if bfd_check_format fails, we close the bfd but keep a reference to it in the bfd_map. If the same filename appears another time in the NT_FILE note, we enter this code again. The second time, bfd_map[filename] is not nullptr and we try to call bfd_make_section_anyway on an already closed BFD, which is a use-after-free error. This patch makes sure that the bfd is only saved in the bfd_map if it got opened successfully. This error got exposed by a recent change in BFD (014a602b86f "Don't optimise bfd_seek to same position"). Since this change, opening a coredump which contains mapping to some special files such as a DRI render node (/dev/dri/renderD$NUM) exposes the issue. This happens for example for processes using AMDGPU devices to offload compute tasks. Reviewed-By: John Baldwin <jhb@FreeBSD.org> Approved-By: Andrew Burgess <aburgess@redhat.com>
2023-06-08Re: _bfd_free_cached_infoAlan Modra3-3/+3
Oops, another leak caused by not defining the correct macro. * elf32-mips.c: Define bfd_elf32_bfd_free_cached_info. * elfn32-mips.c: Likewise. * elf64-mips.c: Define bfd_elf64_bfd_free_cached_info.
2023-06-08Re: _bfd_free_cached_infoAlan Modra2-2/+2
ELF targets with target-specific free_cache_info functions need to call _bfd_elf_free_cached_info, not _bfd_generic_bfd_free_cached_info. * elf64-ppc.c (ppc64_elf_free_cached_info): Call _bfd_elf_free_cached_info. * elfnn-aarch64.c (elfNN_aarch64_bfd_free_cached_info): Likewise.
2023-06-08Automatic date update in version.inGDB Administrator1-1/+1
2023-06-07libsframe: reuse static function sframe_decoder_get_funcdesc_at_indexIndu Bhagat1-23/+25
sframe_decoder_get_funcdesc_at_index () is the function to access SFrame FDEs in the SFrame decoder context. Use it consistently. Avoid unnecessary type cast and include minor enhancements as the code is moved around. libsframe/ * sframe.c (sframe_decoder_get_funcdesc_at_index): Move some checks here. Move the static function definition before the new use. (sframe_decoder_get_funcdesc): Use sframe_decoder_get_funcdesc_at_index instead.
2023-06-07Simplify ada_lookup_struct_elt_typeTom Tromey1-78/+5
This patch simplifies ada_lookup_struct_elt_type by changing it to call find_struct_field. The two functions were substantially similar, even to the point of having identical comments. I tested this using both the gdb test suite and the internal AdaCore test suite. Given this and the fact that it is Ada-specific, I am checking it in.
2023-06-07Add extra linker warning message about discrepancies between normal and ↵Nick Clifton4-11/+35
common symbols. PR 30499 bfd * elflink.c (elf_link_add_object_symbols): Add a message indicating that alignment and size discrepancies between the definition of common symbols and normal symbols are serious and should be investigated. ld * testsuite/ld-elfcomm/elfcomm.exp: Update regexps to match new output from the linker.
2023-06-07[gdb/tui] Factor out border-mode help textTom de Vries1-15/+16
I noticed that the help texts for tui border-mode and tui active-border-mode are similar. Factor out the common part into macro HELP_ATTRIBUTE_MODE. Tested on x86_64-linux.
2023-06-07[gdb/cli] Handle pending ^C after rl_callback_read_char for readline 7Tom de Vries1-1/+10
In commit faf01aee1d0 ("[gdb] Handle pending ^C after rl_callback_read_char") we handled a problem (described in detail in that commit) for readline >= 8 using public readline functions rl_pending_signal and rl_check_signals. For readline 7 (note that we require at least readline 7 so there's no need to worry about readline 6), there was no fix though, because rl_check_signals was not available. Fix this by instead using the private readline function _rl_signal_handler. There is precedent for using private readline variables and functions, but it's something we want to get rid of (PR build/10723). Nevertheless, I think we can allow this specific instance because it's not used when building against readline >= 8. [ In the meanwhile, a fix was committed in the devel branch of the readline repo, contained in commit 8d0c439 ("rollup of changes since readline-8.2"), first proposed here ( https://lists.gnu.org/archive/html/bug-readline/2022-10/msg00008.html ). ] Tested on x86_64-linux, against system readline 7.0 on openSUSE Leap 15.4. PR cli/27813 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27813
2023-06-07Fix PR30369 regression on aarch64/arm (PR30506)Tom de Vries3-11/+32
The gdb.dwarf2/dw2-prologue-end-2.exp test was failing for both AArch64 and Arm. As Tom pointed out here (https://inbox.sourceware.org/gdb-patches/6663707c-4297-c2f2-a0bd-f3e84fc62aad@suse.de/), there are issues with both the prologue skipper for AArch64 and Arm and an incorrect assumption by the testcase. This patch fixes both of AArch64's and Arm's prologue skippers to not skip past the end of a function. It also incorporates a fix to the testcase so it doesn't assume the prologue skipper will stop at the first instruction of the functions/labels. Regression-tested on aarch64-linux/arm-linux Ubuntu 20.04/22.04 and x86_64-linux Ubuntu 20.04. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30506 Co-Authored-By: Tom de Vries <tdevries@suse.de> Co-Authored-By: Luis Machado <luis.machado@arm.com>
2023-06-07[gdb/testsuite] Add missing wait in gdb.python/tui-window-disabled.expTom de Vries1-0/+3
While working on PR tui/30526, I noticed a bug in test-case gdb.python/tui-window-disabled.exp. Here we send "tui enable" to gdb, but don't wait for it to arrive before checking for a window box: ... send_gdb "tui enable\n" Term::check_box "check for python window" 0 0 80 16 ... Fix this by waiting for the prompt to be issued in TUI before doing the check. Tested on x86_64-linux.
2023-06-07[gdb/testsuite] Fix two typos in gdb.python/tui-window-disabled.expTom de Vries1-2/+2
Fix two typos in test-case gdb.python/tui-window-disabled.exp.
2023-06-07[gdb/testsuite] Handle output after prompt in ↵Tom de Vries1-1/+1
gdb.threads/step-N-all-progress.exp Using "taskset -c 0" I run into this timeout: ... (gdb) PASS: gdb.threads/step-N-all-progress.exp: non-stop=on: \ target-non-stop=on: continue to breakpoint: break here next 3^M [New Thread 0x7ffff7dbd6c0 (LWP 10202)]^M 50 return 0;^M (gdb) [Thread 0x7ffff7dbd6c0 (LWP 10202) exited]^M FAIL: gdb.threads/step-N-all-progress.exp: non-stop=on: target-non-stop=on: \ next 3 (timeout) ... The problem is that this test: ... gdb_test "next 3" "return 0;" ... expects no output after the prompt. Fix this by using -no-prompt-anchor. Tested on x86_64-linux.
2023-06-07ld-elf/eh5 remove xfail hppa64Alan Modra1-7/+7
Commit cb81e84c72 resulted in an xpass for hppa64-hp-hpux11, but the test still fails on hpp64-linux. Let's make it pass for hppa64-linux too, by accepting pcrel sdata8 encoding in the augmentation data.
2023-06-07Fix gdb.base/memtag.exp failureLuis Machado1-1/+1
While running this test on an emulator, I noticed we're failing to match the output message when "memory-tag check" is issued with no arguments. That's because I coded the message using "error" and missed a period at the end. Other similar messages are issued with error_no_arg. This patch changes that call to use error_no_arg. Tested on aarch64-linux Ubuntu 20.04/22.04.
2023-06-07_bfd_free_cached_infoAlan Modra31-178/+149
doc/bfdint.texi and comments in the aout and som code about this function are just wrong, and its name is not very apt. Better would be _bfd_mostly_destroy, and we certainly should not be saying anything about the possibility of later recreating anything lost by this function. What's more, if _bfd_free_cached_info is called when creating an archive map to reduce memory usage by throwing away symbols, the target _close_and_cleanup function won't have access to tdata or section bfd_user_data to tidy memory. This means most of the target _close_and_cleanup function won't do anything, and therefore sometimes will result in memory leaks. This patch fixes the documentation problems and moves most of the target _close_and_cleanup code to target _bfd_free_cached_info. Another notable change is that bfd_generic_bfd_free_cached_info is now defined as _bfd_free_cached_info rather than _bfd_bool_bfd_true, ie. the default now frees objalloc memory.
2023-06-07Memory leaks in bfd/vms-lib.cAlan Modra1-13/+28
* vms-lib.c (vms_lib_read_index): Free malloc'd memory on error return paths. (vms_write_index, _bfd_vms_lib_write_archive_contents): Likewise.
2023-06-07bfd/elf.c strtab memory leakAlan Modra1-1/+5
* elf.c (_bfd_elf_compute_section_file_positions): Free strtab on set_group_contents failure return path.
2023-06-07objcopy memory leaks after errorsAlan Modra1-0/+5
These aren't important at all, but tidy them in case they obscure other more important leaks. * objcopy (copy_file): Close input bfd after errors.
2023-06-07Automatic date update in version.inGDB Administrator1-1/+1
2023-06-06libsframe: fix cosmetic issues and typosIndu Bhagat3-5/+7
include/ * sframe-api.h (sframe_decoder_get_num_fidx): Use extern. libsframe/ * sframe-dump.c (dump_sframe_func_with_fres): Fix line length. * sframe.c (sframe_frame_row_entry_copy): Likewise. (sframe_decode_fre_start_address): Use the intended type uint32_t.
2023-06-06Re: loongarch readelf supportAlan Modra1-1/+1
Commit 89c70cd358b8 apparently results in a bogus "value may be used uninitialized" warning with some combination of compiler and optimisation options. * readelf.c (target_specific_reloc_handling): Init value.
2023-06-06Automatic date update in version.inGDB Administrator1-1/+1
2023-06-05libsframe: avoid unnecessary type castsIndu Bhagat2-25/+34
Change the data type of some of the members of the sframe_decoder_ctx and sframe_encoder_ctx data structures to use the applicable data types explicitly. Current implementation in libsframe does type casts, which seem unnecessary. libsframe/ * libsframe/sframe-impl.h (struct sframe_decoder_ctx): Use applicable data type explicitly. (struct sframe_encoder_ctx): Likewise. Use same style of comments consistently. * libsframe/sframe.c (struct sf_fde_tbl): Define without typedef. (struct sf_fre_tbl): Likewise. (sframe_decode): Remove unnecessary type casts. (sframe_encoder_get_funcdesc_at_index): Likewise. (sframe_encoder_add_fre): Likewise. (sframe_encoder_add_funcdesc): Likewise. (sframe_sort_funcdesc): Likewise. (sframe_encoder_write_sframe): Likewise.
2023-06-05ELF: Add "#pass" to ld-elf/pr30508.dH.J. Lu1-0/+1
Add "#pass" to ld-elf/pr30508.d to allow extra segments. PR binutils/30508 * testsuite/ld-elf/pr30508.d: Add "#pass".
2023-06-05Use unrelocated_addr in dwarf2_fdeTom Tromey1-32/+39
This changes dwarf2_fde to use the unrelocated_addr type. This pointed out a latent bug in dwarf2_frame_cache, where a relocated address is compared to an unrelocated address.
2023-06-05Use local "text offset" variable in dwarf2_frame_cacheTom Tromey1-5/+6
A few spots in dwarf2_frame_cache use: cache->per_objfile->objfile->text_section_offset () ... and a subsequent patch will add more, so move this into a local variable.
2023-06-05Constify dwarf2_cie::augmentationTom Tromey1-3/+3
I noticed that dwarf2_cie::augmentation could be 'const'.
2023-06-05Use "unrelocated" terminology in linetable_entryTom Tromey9-22/+29
I forgot to convert struct linetable_entry to use the "unrelocated" (as opposed to "raw") terminology. This patch corrects the oversight.
2023-06-05Fix comment in address_classTom Tromey1-5/+5
enum address_class has a stale comment referring to MSYMBOL_VALUE_RAW_ADDRESS, which no longer exists. This patch updates the comment.
2023-06-05Use unrelocated_addr in dwarf_decode_linesTom Tromey1-11/+7
This changes dwarf_decode_lines to accept an unrelocated_addr and fixes up the fallout.
2023-06-05Use unrelocated_addr in the DWARF readerTom Tromey15-310/+339
This changes various spots in the DWARF reader to use unrelocated_addr.