aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-10-13[gdb/testsuite] Fix gdb.mi/mi-disassemble.exp with -m32Tom de Vries1-1/+1
With target board unix/-m32 and test-case gdb.mi/mi-disassemble.exp we have: ... (gdb) ^M print/x *((unsigned char *) 0x8048485)^M &"print/x *((unsigned char *) 0x8048485)\n"^M ~"$9 = 0x83\n"^M ^done^M (gdb) ^M PASS: gdb.mi/mi-disassemble.exp: get valueof "*((unsigned char *) 0x8048485)" FAIL: gdb.mi/mi-disassemble.exp: byte at 0x8048485 matches ... The test-case passes with native. With native we see in gdb.log that variable longest_insn_bytes is: ... Longest instruction at 0x0000000000400549 with bytes '48 8b 05 20 01 00 00' ... and variable split_bytes (added debug puts) ends up as: ... SPLIT_BYTES: 48 8b 05 20 01 00 00 ... But with unix/-m32 we have longest_insn_byte: ... Longest instruction at 0x08048481 with bytes '8d 4c 24 04 ' ... and split_bytes ends up as: ... SPLIT_BYTES: 8d 4c 24 04 {} {} {} {} {} {} {} {} ... so the trailing whitespace is translated by split to empty bytes, and the mismatch FAILs are generated for those. Fix this by stripping the whitespace, which makes us end up with a different and indeed longer insn: ... Longest instruction at 0x08048492 with bytes 'dd 05 98 85 04 08' ... Tested on x86_64-linux, with native and target board unix/-m32.
2022-10-13Automatic date update in version.inGDB Administrator1-1/+1
2022-10-12PowerPC, fix test gdb.base/watchpoint-stops-at-right-insn.expCarl Love1-1/+1
Test gdb.base/watchpoint-stops-at-right-insn.exp generates 4 test errors on Power 9. The test uses the test [target_info exists gdb, no_hardware_watchpoints] to determine if the processor supports hardware watchpoints. The check only examines the processor type to determine if it supports hardware watchpoints. Note, the test works fine on Power 10. The PowerPC processors support hardware watchpoints with the exception of Power 9. The hardware watchpoint support is disabled on Power 9. The test skip_hw_watchpoint_tests must be used to correctly determine if the PowerPC processor supports hardware watchpoints. This patch replaces the [target_info exists gdb,no_hardware_watchpoints] with the skip_hw_watchpoint_tests_p check. With the patch, the test is disabled on Power 9 but runs on all other PowerPC processors. The patch has been tested on Power 9, Power 10 and X86-64 with no regression failures.
2022-10-12x86: drop "regmask" static variableJan Beulich1-3/+2
Replace its two uses by more direct checks, paralleling what's already there for SIMD registers.
2022-10-12[gdb/symtab] Factor out elf_symfile_read_dwarf2Tom de Vries1-64/+78
Factor out elf_symfile_read_dwarf2 from elf_symfile_read. NFC. Tested on x86_64-linux.
2022-10-12[gdb/testsuite] Fix ctf test-cases on openSUSE TumbleweedTom de Vries7-12/+44
When running test-case gdb.base/ctf-constvars.exp on openSUSE Tumbleweed (with system gcc version 12, providing gcc -gctf support, enabling the ctf test-cases in the gdb testsuite), I run into: ... (gdb) print vox^M 'vox' has unknown type; cast it to its declared type^M (gdb) FAIL: gdb.base/ctf-constvars.exp: print vox ... There are two causes for this: - the linker flags are missing --ctf-variables, so the information for variable vox is missing (reported in PR29468), and - the executable contains some dwarf2 due to some linked-in glibc objects, so the ctf info is ignored (reported in PR29160). By using: - -Wl,--ctf-variable, - -Wl,--strip-debug, and we can make the test-case and some similar test-cases pass. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29160 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29468
2022-10-12[gdb/testsuite] Silence warnings about obsolete -gstabsTom de Vries3-3/+3
When running test-case gdb.base/gdbindex-stabs.exp on openSUSE Tumbleweed (with gcc 12) I get: ... gdb compile failed, gdb/testsuite/gdb.base/gdbindex-stabs.c: warning: \ STABS debugging information is obsolete and not supported anymore ... Silence the warning by passing quiet to gdb_compile. Likewise in two other test-cases.
2022-10-12[gdb/testsuite] Replace remaining -gt with -gctfTom de Vries2-2/+2
With test-cases gdb.base/cvexpr.exp and gdb.base/whatis.exp I run into: ... gdb compile failed, gcc: error: unrecognized debug output level 't' ... This is due to using additional_flags=-gt. Commit ffb3f587933 ("CTF: multi-CU and archive support") replaced additional_flags=-gt with additional_flags=-gctf in gdb.ctf/*.exp and gdb.base/ctf-*.exp. Do the same in these two test-cases. Tested on x86_64-linux.
2022-10-12[gdb/testsuite] Fix gdb.base/infoline-reloc-main-from-zero.exp with recent ldTom de Vries1-1/+9
On openSUSE Tumbleweed (with ld 2.39) and test-case gdb.base/infoline-reloc-main-from-zero.exp, I get: ... gdb compile failed, ld: warning: infoline-reloc-main-from-zero has a LOAD \ segment with RWX permissions UNTESTED: gdb.base/infoline-reloc-main-from-zero.exp: \ infoline-reloc-main-from-zero.exp ... Fix this by compiling with -Wl,--no-warn-rwx-segments. Tested on x86_64-linux.
2022-10-12[gdb/testsuite] Fix gdb.base/nested-subp{2,3}.exp with recent ldTom de Vries2-6/+24
On openSUSE Tumbleweed (with ld 2.39) I get for test-case gdb.base/nested-subp2.exp: ... gdb compile failed, ld: warning: tmp.o: requires executable stack \ (because the .note.GNU-stack section is executable) ... Fix this by compiling with -Wl,--no-warn-execstack. Likewise in gdb.base/nested-subp3.exp Tested on x86_64-linux.
2022-10-12[gdb/testsuite] Remove unnecessary perror in some test-casesTom de Vries2-2/+0
On openSUSE Tumbleweed I noticed: ... UNTESTED: gdb.dwarf2/fission-absolute-dwo.exp: fission-absolute-dwo.exp ERROR: failed to compile fission-absolute-dwo ... The ERROR is unnecessary, given that an UNTESTED is already emitted. Furthermore, it could be argued that it is incorrect because it's not a testsuite error to not be able to compile something, and UNTESTED or UNSUPPORTED is more appropriate. Remove the perror call, likewise in fission-relative-dwo.exp. Tested on x86_64-linux.
2022-10-12Fix objcopy's error message when it cannot add a .gnu_debuglink section ↵Nick Clifton2-1/+7
because the section already exists. PR 29665 * objcopy.c (copy_object): Use the input filename when reporting that a .gnu_debuglink section already exists.
2022-10-12sim/ppc: Fix core_find_mapping diagnosticsTsukasa OI1-1/+1
Because "%p" is the pointer conversion specifier to print a pointer in an implementation-defined manner, the result with format string containing "0x%p" can be strange. For instance, core_map_find_mapping prints error containing "0x0x...." (processor is not NULL) or "0x(null)" (processor is NULL) on glibc. This commit replaces "0x%p" with "%p" to prevent unpredictable behavior.
2022-10-12sim/ppc: fixes for arguments to printf style functionsAndrew Burgess5-8/+10
After the recent series of fixes to mark more functions in the simulator with ATTRIBUTE_PRINTF, there were some build failures in the ppc sim due, in some cases, to bugs with the arguments being passed, and in other cases, the issues were (maybe) less serious, with arguments being the wrong size, or type, for the printf format being used. This commit fixes all of the issues that I ran into. In each case I selected the easiest solution to the problem, which is usually just casting the argument to the correct type. If anyone later on thinks the print format should change, please feel free to do that. What we have here should keep the simulator basically working as it does currently, which is my goal with this commit.
2022-10-12[gdb/contrib] Use OBJCOPY everywhere in cc-with-tweaks.shTom de Vries1-1/+1
I noticed that the $want_gnu_debuglink code in gdb/contrib/cc-with-tweaks.sh uses objcopy instead of $OBJCOPY. Fix this. Script checked with shellcheck, no new warnings added. Tested on x86_64-linux.
2022-10-11Re-apply "Pass PKG_CONFIG_PATH down from top-level Makefile"Simon Marchi2-0/+3
Commit 228cf97dd3c8 ("Merge configure.ac from gcc project") undid the change originally done in de83289ef32e ("Pass PKG_CONFIG_PATH down from top-level Makefile"). Re-apply it. Change-Id: I91138dfca41c43b05e53e445f62e4b27882536bf
2022-10-11gdb: rename target_read_auxv(target_ops *) to target_read_auxv_rawSimon Marchi7-9/+8
Having two overloads of target_read_auxv that don't have the same goals is confusing. Rename the one that reads from an explicit target_ops to target_read_auxv_raw. Also, it occured to me that the non-raw version could use the raw version, that reduces duplication a bit. Change-Id: I28e5f7cecbfcacd0174d4686efb3e4a23b4ad491
2022-10-12Automatic date update in version.inGDB Administrator1-1/+1
2022-10-12Re: Merge configure.ac from gcc projectAlan Modra2-5/+156
Also copy over config.acx.m4, and regenerate.
2022-10-11gdb: fix auxv cachingSimon Marchi20-116/+200
There's a flaw in the interaction of the auxv caching and the fact that target_auxv_search allows reading auxv from an arbitrary target_ops (passed in as a parameter). This has consequences as explained in this thread: https://inbox.sourceware.org/gdb-patches/20220719144542.1478037-1-luis.machado@arm.com/ In summary, when loading an AArch64 core file with MTE support by passing the executable and core file names directly to GDB, we see the MTE info: $ ./gdb -nx --data-directory=data-directory -q aarch64-mte-gcore aarch64-mte-gcore.core ... Program terminated with signal SIGSEGV, Segmentation fault Memory tag violation while accessing address 0x0000ffff8ef5e000 Allocation tag 0x1 Logical tag 0x0. #0 0x0000aaaade3d0b4c in ?? () (gdb) But if we do it as two separate commands (file and core) we don't: $ ./gdb -nx --data-directory=data-directory -q -ex "file aarch64-mte-gcore" -ex "core aarch64-mte-gcore.core" ... Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000aaaade3d0b4c in ?? () (gdb) The problem with the latter is that auxv data gets improperly cached between the two commands. When executing the file command, auxv gets first queried here, when loading the executable: #0 target_auxv_search (ops=0x55555b842400 <exec_ops>, match=0x9, valp=0x7fffffffc5d0) at /home/simark/src/binutils-gdb/gdb/auxv.c:383 #1 0x0000555557e576f2 in svr4_exec_displacement (displacementp=0x7fffffffc8c0) at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:2482 #2 0x0000555557e594d1 in svr4_relocate_main_executable () at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:2878 #3 0x0000555557e5989e in svr4_solib_create_inferior_hook (from_tty=1) at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:2933 #4 0x0000555557e6e49f in solib_create_inferior_hook (from_tty=1) at /home/simark/src/binutils-gdb/gdb/solib.c:1253 #5 0x0000555557f33e29 in symbol_file_command (args=0x7fffffffe01c "aarch64-mte-gcore", from_tty=1) at /home/simark/src/binutils-gdb/gdb/symfile.c:1655 #6 0x00005555573319c3 in file_command (arg=0x7fffffffe01c "aarch64-mte-gcore", from_tty=1) at /home/simark/src/binutils-gdb/gdb/exec.c:555 #7 0x0000555556e47185 in do_simple_func (args=0x7fffffffe01c "aarch64-mte-gcore", from_tty=1, c=0x612000047740) at /home/simark/src/binutils-gdb/gdb/cli/cli-decode.c:95 #8 0x0000555556e551c9 in cmd_func (cmd=0x612000047740, args=0x7fffffffe01c "aarch64-mte-gcore", from_tty=1) at /home/simark/src/binutils-gdb/gdb/cli/cli-decode.c:2543 #9 0x00005555580e63fd in execute_command (p=0x7fffffffe02c "e", from_tty=1) at /home/simark/src/binutils-gdb/gdb/top.c:692 #10 0x0000555557771913 in catch_command_errors (command=0x5555580e55ad <execute_command(char const*, int)>, arg=0x7fffffffe017 "file aarch64-mte-gcore", from_tty=1, do_bp_actions=true) at /home/simark/src/binutils-gdb/gdb/main.c:513 #11 0x0000555557771fba in execute_cmdargs (cmdarg_vec=0x7fffffffd570, file_type=CMDARG_FILE, cmd_type=CMDARG_COMMAND, ret=0x7fffffffd230) at /home/simark/src/binutils-gdb/gdb/main.c:608 #12 0x00005555577755ac in captured_main_1 (context=0x7fffffffda10) at /home/simark/src/binutils-gdb/gdb/main.c:1299 #13 0x0000555557775c2d in captured_main (data=0x7fffffffda10) at /home/simark/src/binutils-gdb/gdb/main.c:1320 #14 0x0000555557775cc2 in gdb_main (args=0x7fffffffda10) at /home/simark/src/binutils-gdb/gdb/main.c:1345 #15 0x00005555568bdcbe in main (argc=10, argv=0x7fffffffdba8) at /home/simark/src/binutils-gdb/gdb/gdb.c:32 Here, target_auxv_search is called on the inferior's target stack. The target stack only contains the exec target, so the query returns empty auxv data. This gets cached for that inferior in `auxv_inferior_data`. In its constructor (before it is pushed to the inferior's target stack), the core_target needs to identify the right target description from the core, and for that asks the gdbarch to read a target description from the core file. Because some implementations of gdbarch_core_read_description (such as AArch64's) need to read auxv data from the core in order to determine the right target description, the core_target passes a pointer to itself, allowing implementations to call target_auxv_search it. However, because we have previously cached (empty) auxv data for that inferior, target_auxv_search searched that cached (empty) auxv data, not auxv data read from the core. Remember that this data was obtained by reading auxv on the inferior's target stack, which only contained an exec target. The problem I see is that while target_auxv_search offers the flexibility of reading from an arbitrary (passed as an argument) target, the caching doesn't do the distinction of which target is being queried, and where the cached data came from. So, you could read auxv from a target A, it gets cached, then you try to read auxv from a target B, and it returns the cached data from target A. That sounds wrong. In our case, we expect to read different auxv data from the core target than what we have read from the target stack earlier, so it doesn't make sense to hit the cache in this case. To fix this, I propose splitting the code paths that read auxv data from an inferior's target stack and those that read from a passed-in target. The code path that reads from the target stack will keep caching, whereas the one that reads from a passed-in target won't. And since, searching in auxv data is independent from where this data came from, split the "read" part from the "search" part. From what I understand, auxv caching was introduced mostly to reduce latency on remote connections, when doing many queries. With the change I propose, only the queries done while constructing the core_target end up not using cached auxv data. This is fine, because there are just a handful of queries max, done at this point, and reading core files is local. The changes to auxv functions are: - Introduce 2 target_read_auxv functions. One reads from an explicit target_ops and doesn't do caching (to be used in gdbarch_core_read_description context). The other takes no argument, reads from the current inferior's target stack (it looks just like a standard target function wrapper) and does caching. The first target_read_auxv actually replaces get_auxv_inferior_data, since it became a trivial wrapper around it. - Change the existing target_auxv_search to not read auxv data from the target, but to accept it as a parameter (a gdb::byte_vector). This function doesn't care where the data came from, it just searches in it. It still needs to take a target_ops and gdbarch to know how to parse auxv entries. - Add a convenience target_auxv_search overload that reads auxv data from the inferior's target stack and searches in it. This overload is useful to replace the exist target_auxv_search calls that passed the `current_inferior ()->top_target ()` target and keep the call sites short. - Modify parse_auxv to accept a target_ops and gdbarch to use for parsing entries. Not strictly related to the rest of this change, but it seems like a good change in the context. Changes in architecture-specific files (tdep and nat): - In linux-tdep, linux_get_hwcap and linux_get_hwcap2 get split in two, similar to target_auxv_search. One version receives auxv data, target and arch as parameters. The other gets everything from the current inferior. The latter is for convenience, to avoid making call sites too ugly. - Call sites of linux_get_hwcap and linux_get_hwcap2 are adjusted to use either of the new versions. The call sites in gdbarch_core_read_description context explicitly read auxv data from the passed-in target and call the linux_get_hwcap{,2} function with parameters. Other call sites use the versions without parameters. - Same idea for arm_fbsd_read_description_auxv. - Call sites of target_auxv_search that passed `current_inferior ()->top_target ()` are changed to use the target_auxv_search overload that works in the current inferior. Reviewed-By: John Baldwin <jhb@FreeBSD.org> Reviewed-By: Luis Machado <luis.machado@arm.com> Change-Id: Ib775a220cf1e76443fb7da2fdff8fc631128fe66
2022-10-11[gdb/testsuite] Fix gdb.debuginfod/fetch_src_and_symbols.exp with ↵Tom de Vries1-1/+3
native-gdbserver When running test-case gdb.debuginfod/fetch_src_and_symbols.exp with target board native-gdbserver, I get: ... Running gdb.debuginfod/fetch_src_and_symbols.exp ... ERROR: tcl error sourcing gdb.debuginfod/fetch_src_and_symbols.exp. ERROR: gdbserver does not support start without extended-remote while executing "error "gdbserver does not support $command without extended-remote"" (procedure "gdb_test_multiple" line 51) invoked from within "gdb_test_multiple $command $message {*}$opts $user_code" (procedure "gdb_test" line 56) invoked from within "gdb_test "start" "Temporary breakpoint.*"" ... Fix this by replacing gdb_test "start" with runto_main. Tested on x86_64-linux.
2022-10-11Re: Error: attempt to get value of unresolved symbol `L0'Nick Clifton4-10/+26
* symbols.c (S_GET_VALUE): If the unresolved symbol is the fake label provide a more helpful error message to the user. (S_GET_VALUE_WHERE): Like S_GET_VALUE, but includes a file/line number for error reporting purposes. * symbols.h (S_GET_VALUE_WHERE): Prototype. * write.c (fixup_segment): Use S_GET_VALUE_WHERE.
2022-10-11sim: Initialize pbb_br_* by defaultTsukasa OI1-4/+4
On the files generated by sim/common/genmloop.sh, variables pbb_br_type and pbb_br_npc are declared uninitialized and passed to other functions in some cases. Despite that those are harmless, they will generate GCC warnings ("-Wmaybe-uninitialized"). This commit ensures that pbb_br_type and pbb_br_npc variables are initialized to a harmless value.
2022-10-11sim: Check known getopt definition existenceTsukasa OI3-0/+45
Clang generates a warning if there is a function declaration/definition with zero arguments. Such declarations/definitions without a prototype (an argument list) are deprecated forms of indefinite arguments ("-Wdeprecated-non-prototype"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). include/getopt.h defines some getopt function definitions but one of them has a form "extern int getopt ();". If this form is selected in include/getopt.h, Clang generates a warning and the build fails by default. In really old environments, this getopt definition with no arguments is necessary (because the definition may change between environments). However, this definition is now a cause of problems on modern environments. A good news is, this definition is not always selected (e.g. if used by binutils/*.c). This is because configuration scripts of binutils, gas, gprof and ld tries to find known definition of getopt function is used and defines HAVE_DECL_GETOPT macro. If this macro is defined when getopt.h is included, a good form of getopt is used and Clang won't generate warnings. This commit adds a modified portion of ld/configure.ac to find the known getopt definition. If we could find one (and we *will* in most modern environments), we don't need to rely on the deprecated definition.
2022-10-11sim: Suppress non-literal printf warningTsukasa OI2-13/+17
Clang generates a warning if the format string of a printf-like function is not a literal ("-Wformat-nonliteral"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). To avoid this warning, this commit now uses vsnprintf to format error message and pass the message to sim_engine_abort function with another printf-style formatting. This patch is mostly authored by Andrew Burgess and slightly modified by Tsukasa OI. Co-authored-by: Andrew Burgess <aburgess@redhat.com> Signed-off-by: Tsukasa OI <research_trasio@irq.a4lg.com>
2022-10-11sim: Make WITH_{TRACE,PROFILE}-based macros boolTsukasa OI2-8/+8
Clang generates a warning if there is an ambiguous expression (possibly a bitwise operation (& or |), but a logical operator (&& or ||) is used; "-Wconstant-logical-operand"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). This is caused by predicate macros that use the form (base_variable & flag). Clang considers them as regular integer values (not boolean) and generates that warning. This commit makes Clang think those predicate macros to be boolean.
2022-10-11sim: Remove self-assignmentsTsukasa OI2-4/+0
Clang generates a warning if there is a redundant self-assignment ("-Wself-assign"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). This commit removes redundant self-assignments from two files.
2022-10-11sim/rl78: Add ATTRIBUTE_PRINTFTsukasa OI1-2/+2
Clang generates a warning if the format string of a printf-like function is not a literal ("-Wformat-nonliteral"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). To avoid warnings on the printf-like wrapper, it requires proper __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason. This commit adds ATTRIBUTE_PRINTF to the printf-like functions.
2022-10-11sim/ppc: Add ATTRIBUTE_PRINTFTsukasa OI3-8/+7
Clang generates a warning if the format string of a printf-like function is not a literal ("-Wformat-nonliteral"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). To avoid warnings on the printf-like wrapper, it requires proper __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason. This commit adds ATTRIBUTE_PRINTF to the printf-like functions. For the error function defined in sim_calls.c, the ATTRIBUTE_NORETURN has been moved to the function declaration.
2022-10-11sim/m68hc11: Add ATTRIBUTE_PRINTFTsukasa OI1-1/+2
Clang generates a warning if the format string of a printf-like function is not a literal ("-Wformat-nonliteral"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). To avoid warnings on the printf-like wrapper, it requires proper __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason. This commit adds ATTRIBUTE_PRINTF to a printf-like function.
2022-10-11sim/m32c: Add ATTRIBUTE_PRINTFTsukasa OI1-2/+2
Clang generates a warning if the format string of a printf-like function is not a literal ("-Wformat-nonliteral"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). To avoid warnings on the printf-like wrapper, it requires proper __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason. This commit adds ATTRIBUTE_PRINTF to the printf-like functions.
2022-10-11sim/erc32: Add ATTRIBUTE_PRINTFTsukasa OI2-2/+2
Clang generates a warning if the format string of a printf-like function is not a literal ("-Wformat-nonliteral"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). To avoid warnings on the printf-like wrapper, it requires proper __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason. This commit adds ATTRIBUTE_PRINTF to the printf-like functions.
2022-10-11sim/cris: Add ATTRIBUTE_PRINTFTsukasa OI1-1/+1
Clang generates a warning if the format string of a printf-like function is not a literal ("-Wformat-nonliteral"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). To avoid warnings on the printf-like wrapper, it requires proper __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason. This commit adds ATTRIBUTE_PRINTF to a printf-like function.
2022-10-11sim/common: Add ATTRIBUTE_PRINTFTsukasa OI1-1/+2
Clang generates a warning if the format string of a printf-like function is not a literal ("-Wformat-nonliteral"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). To avoid warnings on the printf-like wrapper, it requires proper __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason. This commit adds ATTRIBUTE_PRINTF to a printf-like function.
2022-10-11fix compressed_debug_section_names definition for "zlib"Martin Liska1-1/+1
bfd/ChangeLog: * libbfd.c: Set COMPRESS_DEBUG_GABI_ZLIB for "zlib" value.
2022-10-11add --enable-default-compressed-debug-sections-algorithm configure optionMartin Liska12-6/+99
ChangeLog: * configure.ac: Add --enable-default-compressed-debug-sections-algorithm. * configure: Regenerate. gas/ChangeLog: * NEWS: Document the new option. * as.c (flag_compress_debug): Set default algorithm based on the configure option. * configure.ac: Add --enable-default-compressed-debug-sections-algorithm. * configure: Regenerate. * config.in: Likewise. ld/ChangeLog: * NEWS: Document the new option. * configure.ac: Add --enable-default-compressed-debug-sections-algorithm. * configure: Regenerate. * config.in: Likewise. * ldmain.c: Set default algorithm based on the configure option.
2022-10-11refactor usage of compressed_debug_section_typeMartin Liska6-52/+88
bfd/ChangeLog: * bfd-in.h (bfd_hash_set_default_size): Add COMPRESS_UNKNOWN enum value. (struct compressed_type_tuple): New. * bfd-in2.h (bfd_hash_set_default_size): Regenerate. (struct compressed_type_tuple): Likewise. * libbfd.c (ARRAY_SIZE): New macro. (bfd_get_compression_algorithm): New function. (bfd_get_compression_algorithm_name): Likewise. gas/ChangeLog: * as.c: Do not special-case, use the new functions. ld/ChangeLog: * emultempl/elf.em: Do not special-case, use the new functions. * lexsup.c (elf_static_list_options): Likewise.
2022-10-11sim/riscv: fix multiply instructions on simulatorTsukasa OI2-0/+19
After this commit: commit 0938b032daa52129b4215d8e0eedb6c9804f5280 Date: Wed Feb 2 10:06:15 2022 +0900 RISC-V: Add 'Zmmul' extension in assembler. some instructions in the RISC-V simulator stopped working as a new instruction class 'INSN_CLASS_ZMMUL' was added, and some existing instructions were moved into this class. The simulator doesn't currently handle this instruction class, and so the instructions will now cause an illegal instruction trap. This commit adds support for INSN_CLASS_ZMMUL, and adds a test that ensures the affected instructions can be executed by the simulator. Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com> Reviewed-by: Andrew Burgess <aburgess@redhat.com>
2022-10-11Error: attempt to get value of unresolved symbol `L0'Nick Clifton2-2/+12
* symbols.c (S_GET_VALUE): If the unresolved symbol is the fake label provide a more helpful error message to the user.
2022-10-11sim/moxie: add custom directory stamp ruleTsukasa OI2-9/+23
Because sim/moxie/moxie-gdb.dtb is neither a program nor a library, automake does not generate dirstamp file ($builddir/sim/moxie/.dirstamp) for it. When maintainer mode is enabled, it tries to rebuild sim/moxie/moxie-gdb.dtb but fails because there's no rules for automake-generated dirstamp file which moxie-gdb.dtb depends. This commit adds its own rule for the directory stamp (modified copy of the automake output) and adds the directory stamp file to DISTCLEANFILES to mimic automake-generated behavior (although "make distclean" does not work when maintainer mode is enabled).
2022-10-11gdb/testsuite: Fix formatting of python scriptBruno Larsen1-3/+7
The python black formatter was complaining about formatting on the script gdb.python/pretty-print-call-by-hand.py. This commit changed the offending lines to make the formatter happy.
2022-10-11[gdb/testsuite] Fix prompt parsing in capture_command_outputTom de Vries2-19/+51
I noticed in capture_command_output that the output of a single command is matched using two gdb_test_multiples: - the first one matching the echoed command and skipping an optional prefix, - the second one matching the output and the prompt. This is error-prone, because the first gdb_test_multiple has implicit clauses which may consume the prompt. The problem is easy to spot with an example. First consider: ... set output [capture_command_output "print 1" "\\\$1 = "] gdb_assert { [string equal $output "1"] } ... for which we get: ... PASS: [string equal $output "1"] ... If we change the prefix string to a no-match, say "1 = ", and update the output string match accordingly, we get instead: ... FAIL: capture_command_output for print 1 FAIL: [string equal $output "\$1 = 1"] ... The first FAIL is produced by the first gdb_test_multiple, consuming the prompt. The second gdb_test_multiple then silently times out waiting for another prompt, after which the second FAIL is produced. Note that the timeout is silent because the gdb_test_multiple is called with an empty message argument. The second FAIL is because capture_command_output returns "", given that all the command output was consumed by the first gdb_test_multiple. Fix this by rewriting capture_command_output to use only a single gdb_test_multiple. Tested on x86_64-linux.
2022-10-11gprofng: no need to build version.texiVladimir Mezentsev2-29/+4
gprofng/ChangeLog 2022-10-10 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/29465 PR gprofng/29667 * doc/Makefile.am: No need to build version.texi. * doc/Makefile.in: Rebuild.
2022-10-11gprofng: use the --libdir path to find librariesVladimir Mezentsev3-3/+9
gprofng/ChangeLog 2022-10-10 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/29663 * src/Makefile.am: Add -DLIBDIR to CPPFLAGS. * src/Makefile.in: Rebuild. * src/envsets.cc (putenv_libcollector_ld_misc): Use LIBDIR to find the gprofng libraries.
2022-10-11gprofng: run tests without installationVladimir Mezentsev3-5/+6
gprofng/ChangeLog 2022-10-10 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/29107 * testsuite/config/default.exp: Set up environment to run gprofng tests without installation. * testsuite/lib/Makefile.skel: Likewise. * testsuite/lib/display-lib.exp: Likewise.
2022-10-10gdb/testsuite: fix race in gdb.base/async-shell.expSimon Marchi2-8/+23
I see some random failures in this test: FAIL: gdb.base/async-shell.exp: run & (timeout) It can be reliably reproduced on a recent enough GNU/Linux with this change: diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 44cc28b30051..2a3c8253ba5a 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1301,6 +1301,7 @@ proc gdb_test_multiple { command message args } { } set gdb_test_name "$message" + sleep 2 set result 0 set code [catch {gdb_expect $code} string] "recent enough" means a system where libpthread.so was merged with libc.so, so at least glibc 2.34. The problem is that the `run &` command prints some things after the prompt: (gdb) [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/../lib/libthread_db.so.1". If expect is quick enough, it will consume only up to the prompt. But if it is slow enough, it will consume those messages at the same time as the prompt, in which case the gdb_test used for "run &" won't match. By default, the prompt used by gdb_test uses a `$` to anchor the match at the end of the buffer. If there's anything following the prompt, it won't match. The diff above adds a delay between sending the command and consuming the output, giving GDB more time to output the messages, giving a good chance that expect consumes them at the same time as the prompt. This is normally handled by using gdb_test_multiple and specifying a pattern that ends with "$gdb_prompt", but not a trailing $. I think this is common enough that it deserves its own gdb_test option. Therefore, add the -no-anchor-prompt option to gdb_test, and gdb_test_no_output for completeness. Use it in gdb.base/async-shell.exp. Change-Id: I9051d8800d1c10a2e95db1a575991f7723492f1b Approved-By: Tom de Vries <tdevries@suse.de>
2022-10-11Automatic date update in version.inGDB Administrator1-1/+1
2022-10-10Fix a latent bug in print_wcharTom Tromey3-10/+24
print_wchar keeps track of when escape sequences are emitted, to force an escape sequence if needed by a subsequent character. For example for the string concatenation "\0" "1", gdb will print "\000\061" -- because printing "\0001" might be confusing. However, this code has two errors. First, this logic is not needed for octal escapes, because there is a length limit of 3 for octal escapes, and gdb always prints these with "%.3o". Second, though, this *is* needed for hex escapes, because those do not have a length limit. This patch fixes these problems and adds the appropriate tests.
2022-10-10Don't use wchar_printable in print_wcharTom Tromey1-6/+5
print_wchar uses wchar_printable, but this isn't needed -- all the relevant cases are already handled by the 'switch'. This changes the code to use gdb_iswprint, and removes a somewhat confusing comment related to this code.
2022-10-10Remove c_printstrTom Tromey4-26/+7
This renames c_printstr, removing a layer of indirection.