aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-08-13ubsan: undefined shift in sign_extendAlan Modra1-1/+1
* libhppa.h (sign_extend): Avoid undefined behaviour.
2022-08-13asan: NULL dereference in som_set_reloc_infoAlan Modra1-0/+5
* som.c (som_set_reloc_info): Ignore non-existent previous fixup references.
2022-08-13readelf: print 0x0 as 0, and remove trailing spacesAlan Modra77-455/+454
This changes readelf output a little, removing the 0x prefix on hex output when the value is 0, except in cases where a fixed field width is shown. %#010x is not a good replacement for 0x%08x.
2022-08-13Make dwarf_vma uint64_tAlan Modra8-1302/+931
This replaces dwarf_vma, dwarf_size_type and dwarf_signed_vma with uint64_t and int64_t everywhere. The patch also gets rid of DWARF_VMA_FMT since we can't use that with uint64_t, and all of the configure support for deciding the flavour of HOST_WIDEST_INT. dwarf_vmatoa also disappears, replacing most uses with one of PRIx64, PRId64 or PRIu64. Printing of size_t and ptrdiff_t values now use %z and %t rather than by casting to unsigned long. Also, most warning messages that used 0x%lx or similar now use %#lx and a few that didn't print the 0x hex prefix now also use %#. The patch doesn't change normal readelf output, except in odd cases where values previously might have been truncated.
2022-08-13Don't use bfd_vma in readelf.cAlan Modra1-221/+172
This replaces bfd_vma with uint64_t in readelf, defines BFD64 unconditionally, removes tests of BFD64 and sizeof (bfd_vma), and removes quite a few now unnecessary casts.
2022-08-13Don't use bfd_size_type in readelf.c and dwarf.cAlan Modra2-98/+89
Replacing bfd_size_type with dwarf_size_type or uint64_t is mostly cosmetic. The point of the change is to avoid use of a BFD type in readelf, where we'd like to keep as independent of BFD as possible. Also, the patch is a step towards using standard types.
2022-08-13Replace elf_vma with uint64_tAlan Modra3-110/+93
This patch replaces all uses of elf_vma with uint64_t, removes tests of sizeof (elf_vma), and does a little tidying of byte_get_little_endian and byte_get_big_endian.
2022-08-13Automatic date update in version.inGDB Administrator1-1/+1
2022-08-12[gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.expTom de Vries2-5/+10
When running test-case gdb.dwarf2/dw2-dir-file-name.exp on x86_64-linux, we have: ... (gdb) break compdir_missing__ldir_missing__file_basename^M Breakpoint 2 at 0x4004c4: file tmp-dw2-dir-file-name.c, line 999.^M (gdb) continue^M Continuing.^M ^M Breakpoint 2, 0x00000000004004c4 in \ compdir_missing__ldir_missing__file_basename () \ at tmp-dw2-dir-file-name.c:999^M (gdb) PASS: gdb.dwarf2/dw2-dir-file-name.exp: \ compdir_missing__ldir_missing__file_basename: continue to breakpoint: \ compdir_missing__ldir_missing__file_basename ... When trying to set a breakpoint on compdir_missing__ldir_missing__file_basename, the architecture-specific prologue skipper starts at 0x4004c0 and skips past two insns, to 0x4004c4: ... 00000000004004c0 <compdir_missing__ldir_missing__file_basename>: 4004c0: 55 push %rbp 4004c1: 48 89 e5 mov %rsp,%rbp 4004c4: 8b 05 72 1b 20 00 mov 0x201b72(%rip),%eax # 60203c <v> 4004ca: 83 c0 01 add $0x1,%eax 4004cd: 89 05 69 1b 20 00 mov %eax,0x201b69(%rip) # 60203c <v> 4004d3: 90 nop 4004d4: 5d pop %rbp 4004d5: c3 ret ... And because the line table info is rudamentary: ... CU: tmp-dw2-dir-file-name.c: File name Line number Starting address View Stmt tmp-dw2-dir-file-name.c 999 0x4004c0 x tmp-dw2-dir-file-name.c 1000 0x4004d6 x tmp-dw2-dir-file-name.c - 0x4004d6 ... the address does not fall at an actual line, so the breakpoint is shown with address, both when setting it and hitting it. when running the test-case with aarch64-linux, we have similarly: ... (gdb) break compdir_missing__ldir_missing__file_basename^M Breakpoint 2 at 0x400618: file tmp-dw2-dir-file-name.c, line 999.^M ... due to the architecture-specific prologue skipper starting at 0x400610 and skipping past two insns, to 0x400618: ... 0000000000400610 <compdir_missing__ldir_missing__file_basename>: 400610: 90000100 adrp x0, 420000 <__libc_start_main@GLIBC_2.17> 400614: 9100b000 add x0, x0, #0x2c 400618: b9400000 ldr w0, [x0] 40061c: 11000401 add w1, w0, #0x1 400620: 90000100 adrp x0, 420000 <__libc_start_main@GLIBC_2.17> 400624: 9100b000 add x0, x0, #0x2c 400628: b9000001 str w1, [x0] 40062c: d503201f nop 400630: d65f03c0 ret ... But interestingly, the aarch64 architecture-specific prologue skipper is wrong. There is no prologue, and the breakpoint should be set at 0x400610. By using "break *compdir_missing__ldir_missing__file_basename" we can get the breakpoint set at 0x400610: ... (gdb) break *compdir_missing__ldir_missing__file_basename^M Breakpoint 2 at 0x400610: file tmp-dw2-dir-file-name.c, line 999.^M ... and make the test-case independent of prologue analysis. This requires us to update the expected patterns. The fix ensures that once the aarch64 architecture-specific prologue skipper will be fixed, this test-case won't start failing. Tested on x86_64-linux.
2022-08-12Automatic date update in version.inGDB Administrator1-1/+1
2022-08-11gdb/varobj: Only re-evaluate invalid globals during re_setLancelot SIX2-15/+7
When doing varobj_re_set, we currently try to recreate floating varobj. This was introduced by 4e969b4f0128 "Re-evaluate floating varobj as part of varobj_invalidate" to deal with use a after free issue. However since bc20e562ec0 "Fix use after free in varobj" we now ensure that we never have dangling pointers so this all recreation is not strictly needed anymore for floating varobjs. This commit proposes to remove this recreation process for floating varobjs. Tested on x86_64-linux.
2022-08-11gdb/varobj: Reset varobj after relocations have been computedTom de Vries4-19/+16
[This patch is a followup to the discussion in https://sourceware.org/pipermail/gdb-patches/2022-August/191188.html] PR/29426 shows failures when running the gdb.mi/mi-var-invalidate-shlib test when using a compiler which does not produce a PIE executable by default. In the testcase, a varobj is created to track a global variable, and then the main binary is reloaded in GDB (using the file command). During the load of the new binary, GDB tries to recreate the varobj to track the global in the new binary (varobj_invalidate_iter). At this point, the old process is still in flight. So when we try to access to the value of the global, in a PIE executable we only have access to the unrelocated address (the objfile's text_section_offset () is 0). As a consequence down the line read_value_memory fails to read the unrelated address, so cannot evaluate the value of the global. Note that the expression used to access to the global’s value is valid, so the varobj can be created. When using a non PIE executable, the address of the global GDB knows about at this point does not need relocation, so read_value_memory can access the (old binary’s) value. So at this point, in the case of a non-PIE executable the value field is set, while it is cleared in the case of PIE executable. Later when the test issues a "-var-update global_var", the command sees no change in the case of the non-PIE executable, while in the case of the PIE executable install_new_value sees that value changes, leading to a different output. This patch makes sure that, as we do for breakpoints, we wait until relocation has happened before we try to recreate varobjs. This way we have a consistent behavior between PIE and non-PIE binaries. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29426 Co-authored-by: Lancelot SIX <lancelot.six@amd.com>
2022-08-11gdb/varobj: Do not invalidate locals in varobj_invalidate_iterLancelot SIX2-6/+36
The varobj_invalidate_iter function has logic to invalidate any local varobj it can find. However since bc20e562ec0 "gdb/varobj: Fix use after free in varobj" all varobj containing references to an objfile are cleared when the objfile goes out of scope. This means that at this point any local varobj seen by varobj_invalidate_iter either has already been invalidated by varobj_invalidate_if_uses_objfile or only contains valid references and there is no reason to invalidate it. This patch proposes to remove this unnecessary invalidation and adds a testcase which exercises a scenario where a local varobj can legitimately survive a call to varobj_invalidate_iter. At this point the varobj_invalidate and varobj_invalidate_iter seem misnamed since they deal with re-creating invalid objects and do not do invalidation, but this will be fixed in a following patch. Tested on x86_64-linux.
2022-08-11ppc/svp64: support svindex instructionDmitry Selyutin4-0/+40
https://libre-soc.org/openpower/sv/ https://libre-soc.org/openpower/sv/remap/#svindex https://libre-soc.org/openpower/isa/simplev/
2022-08-11ppc/svp64: support svremap instructionDmitry Selyutin4-0/+45
https://libre-soc.org/openpower/sv/ https://libre-soc.org/openpower/sv/remap/#svremap https://libre-soc.org/openpower/isa/simplev/
2022-08-11ppc/svp64: support svshape instructionDmitry Selyutin4-0/+42
https://libre-soc.org/openpower/sv/ https://libre-soc.org/openpower/sv/remap/#svshape https://libre-soc.org/openpower/isa/simplev/
2022-08-11ppc/svp64: support svstep instructionsDmitry Selyutin4-0/+22
https://libre-soc.org/openpower/sv/ https://libre-soc.org/openpower/sv/svstep/ https://libre-soc.org/openpower/isa/simplev/
2022-08-11ppc/svp64: support setvl instructionsDmitry Selyutin4-0/+46
https://libre-soc.org/openpower/sv/ https://libre-soc.org/openpower/sv/setvl/ https://libre-soc.org/openpower/isa/simplev/
2022-08-11ppc/svp64: introduce non-zero operand flagDmitry Selyutin3-3/+26
svstep and svshape instructions subtract 1 before encoding some of the operands. Obviously zero is not supported for these operands. Whilst PPC_OPERAND_PLUS1 fits perfectly to mark that maximal value should be incremented, there is no flag which marks the fact that zero values are not allowed. This patch adds a new flag, PPC_OPERAND_NONZERO, for this purpose.
2022-08-11ppc/svp64: support LibreSOC architectureDmitry Selyutin4-8/+19
This patch adds support for LibreSOC machine and SVP64 extension flag for PowerPC architecture. SV (Simple-V) is a strict RISC-paradigm Scalable Vector Extension for the Power ISA. SVP64 is the 64-bit Prefixed instruction format implementing SV. Funded by NLnet through EU Grants No: 825310 and 825322, SV is in DRAFT form and is to be publicly submitted via the OpenPOWER Foundation ISA Working Group via the newly-created External RFC Process. For more details, visit https://libre-soc.org.
2022-08-11[Arm] Cleanup arm_m_exception_cacheTorbjörn SVENSSON1-178/+203
With this change, only valid contents of LR are accepted when unwinding exception frames for m-profile targets. If the contents of LR are anything but EXC_RETURN or FNC_RETURN, it will cause GDB to print an error and/or abort unwinding of the frame as it's an invalid state for the unwinder. The FNC_RETURN pattern requires Security Extensions to be enabled. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2022-08-10RISC-V: Remove R_RISCV_GNU_VTINHERIT/R_RISCV_GNU_VTENTRYFangrui Song3-62/+4
They were legacy relocation types copied from other ports. The related -fvtable-gc was removed from GCC in 2003. The associated assembler directives (.vtable_inherit and .vtable_entry) have never been supported by the RISC-V port. Remove related ld code. Link: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/323
2022-08-11PR29466, APP/NO_APP with .linefileAlan Modra9-4/+43
Commit 53f2b36a54b9 exposed a bug in sb_scrub_and_add_sb that could result in losing input. If scrubbing results in expansion past the holding capacity of do_scrub_chars output buffer, then do_scrub_chars stashes the extra input for the next call. That call never came because sb_scrub_and_add_sb wrongly decided it was done. Fix that by allowing sb_scrub_and_add_sb to see whether there is pending input. Also allow a little extra space so that in most cases we won't need to resize the output buffer. sb_scrub_and_add_sb also limited output to the size of the input, rather than the actual output buffer size. Fixing that resulted in a fail of gas/testsuite/macros/dot with an extra warning: "end of file not at end of a line; newline inserted". OK, so the macro in dot.s really does finish without end-of-line. Apparently the macro expansion code relied on do_scrub_chars returning early. So fix that too by adding a newline if needed in macro_expand_body. PR 29466 * app.c (do_scrub_pending): New function. * as.h: Declare it. * input-scrub.c (input_scrub_include_sb): Add extra space for two .linefile directives. * sb.c (sb_scrub_and_add_sb): Take into account pending input. Allow output to max. * macro.c (macro_expand_body): Add terminating newline. * testsuite/config/default.exp (SIZE, SIZEFLAGS): Define. * testsuite/gas/macros/app5.d, * testsuite/gas/macros/app5.s: New test. * testsuite/gas/macros/macros.exp: Run it.
2022-08-11regen potfilesAlan Modra2-0/+2
2022-08-11Automatic date update in version.inGDB Administrator1-1/+1
2022-08-10gdb/mi: fix breakpoint script field outputSimon Marchi15-10/+225
The "script" field, output whenever information about a breakpoint with commands is output, uses wrong MI syntax. $ ./gdb -nx -q --data-directory=data-directory -x script -i mi =thread-group-added,id="i1" =breakpoint-created,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000000000000111d",func="main",file="test.c",fullname="/home/simark/build/binutils-gdb-one-target/gdb/test.c",line="3",thread-groups=["i1"],times="0",original-location="main"} =breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000000000000111d",func="main",file="test.c",fullname="/home/simark/build/binutils-gdb-one-target/gdb/test.c",line="3",thread-groups=["i1"],times="0",script={"aaa","bbb","ccc"},original-location="main"} (gdb) -break-info ^done,BreakpointTable={nr_rows="1",nr_cols="6",hdr=[{width="7",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="18",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000000000000111d",func="main",file="test.c",fullname="/home/simark/build/binutils-gdb-one-target/gdb/test.c",line="3",thread-groups=["i1"],times="0",script={"aaa","bbb","ccc"},original-location="main"}]} (gdb) In both the =breakpoint-modified and -break-info output, we have: script={"aaa","bbb","ccc"} According to the output syntax [1], curly braces means tuple, and a tuple contains key=value pairs. This looks like it should be a list, but uses curly braces by mistake. This would make more sense: script=["aaa","bbb","ccc"] Fix it, keeping the backwards compatibility by introducing a new MI version (MI4), in exactly the same way as was done when fixing multi-locations breakpoint output in [2]. - Add a fix_breakpoint_script_output uiout flag. MI uiouts will use this flag if the version is >= 4. - Add a fix_breakpoint_script_output_globally variable and the -fix-breakpoint-script-output MI command to set it, if frontends want to use the fixed output for this without using the newer MI version. - When emitting the script field, use list instead of tuple, if we want the fixed output (depending on the two criteria above) - [1] https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Output-Syntax.html#GDB_002fMI-Output-Syntax [2] https://gitlab.com/gnutools/binutils-gdb/-/commit/b4be1b0648608a2578bbed39841c8ee411773edd Change-Id: I7113c6892832c8d6805badb06ce42496677e2242 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24285
2022-08-10objdump: fix extended (256) disassembler colorsAndrew Burgess1-1/+1
After commit: commit a88c79b77036e4778e70d62081c3cfd1044bb8e3 Date: Tue Aug 9 14:57:48 2022 +0100 Default to enabling colored disassembly if output is to a terminal. The 256 extended-color support for --disassembler-color was broken. This is fixed in this commit. PR 29457 * objdump (objdump_styled_sprintf): Check disassembler_color against an enum value, don't treat it as a bool.
2022-08-10gdb/riscv: implement cannot_store_register gdbarch methodmga-sc1-0/+12
The x0 (zero) register is read-only on RISC-V. Implement the cannot_store_register gdbarch method to tell GDB this. Without this method GDB will try to write to x0, and relies on the target to ignore such writes. If you are using a target that complains (or throws an error) when writing to x0, this change will prevent this from happening. The gdb.arch/riscv-reg-aliases.exp test exercises writing to x0, and will show the errors when using a suitable target.
2022-08-10Disable year 2038 support on 32-bit hosts by defaultLuis Machado2-0/+40
With a recent import of gnulib, code has been pulled that tests and enables 64-bit time_t by default on 32-bit hosts that support it. Although gdb can use the gnulib support, bfd doesn't use gnulib and currently doesn't do these checks. As a consequence, if we have a 32-bit host that supports 64-bit time_t, we'll have a mismatch between gdb's notion of time_t and bfd's notion of time_t. This will lead to mismatches in the struct stat size, leading to memory corruption and crashes. This patch disables the year 2038 check for now, which makes things work reliably again. I'd consider this a temporary fix until we have proper bfd checks for the year 2038, if it makes sense. 64-bit hosts seems to be more common these days, so I'm not sure how important it is to have this support enabled and how soon we want to enable it. Thoughts?
2022-08-10gas/Dwarf: properly skip zero-size functionsJan Beulich1-19/+20
PR gas/29451 While out_debug_abbrev() properly skips such functions, out_debug_info() mistakenly didn't. It needs to calculate the high_pc expression ahead of time, in order to skip emitting any data for the function if the value is zero. The one case which would still leave a zero-size entry is when symbol_get_obj(symp)->size ends up evaluating to zero. I hope we can expect that to not be the case, otherwise we'd need to have a way to post-process .debug_info contents between resolving expressions and actually writing the data out to the file. Even then it wouldn't be entirely obvious in which way to alter the data.
2022-08-10PR29462, internal error in relocate, at powerpc.cc:10796Alan Modra1-54/+75
Prior to the inline plt call support (commit 08be322439), the only local syms with plt entries were local ifunc symbols. There shouldn't be stubs for other local symbols so don't look for them. The patch also fixes minor bugs in get_reference_flags; Many relocs are valid only for ppc64 and a couple only for ppc32. PR 29462 * powerpc.cc (Target_powerpc::Relocate::relocate): Rename use_plt_offset to pltcal_to_direct, invert logic. For relocs not used with inline plt sequences against local symbols, only look for stubs when the symbol is an ifunc. (Target_powerpc::Scan::get_reference_flags): Correct reloc handling for relocs not valid for both 32-bit and 64-bit.
2022-08-10bfd: Add support for LoongArch64 EFI (efi-*-loongarch64).Youling Tang19-27/+506
This adds support for efi-loongarch64 by virtue of adding a new PEI target pei-loongarch64. This is not a full target and only exists to support EFI at this time. This means that this target does not support relocation processing and is mostly a container format. This format has been added to elf based loongarch64 targets such that efi images can be made natively on Linux. However this target is not valid for use with gas but only with objcopy. We should't limit addresses to 32-bits for 64-bit vma, otherwise there will be "RVA truncated" error when using objcopy on loongarch64. With these changes the resulting file is recognized as an efi image. Any magic number is based on the Microsoft PE specification [1]. The test results are as follows: $ make check-binutils RUNTESTFLAGS='loongarch64.exp' PASS: Check if efi app format is recognized $ objdump -h -f tmpdir/loongarch64copy.o tmpdir/loongarch64copy.o: file format pei-loongarch64 architecture: Loongarch64, flags 0x00000132: EXEC_P, HAS_SYMS, HAS_LOCALS, D_PAGED start address 0x0000000000000000 Sections: Idx Name Size VMA LMA File off Algn 0 .text 0000003c 00000000200000b0 00000000200000b0 00000200 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE [1] https://docs.microsoft.com/en-us/windows/win32/debug/pe-format bfd: * .gitignore (pe-loongarch64igen.c): New. * Makefile.am (pei-loongarch64.lo, pe-loongarch64igen.lo, pei-loongarch64.c, pe-loongarch64igen.c): Add support. * Makefile.in: Likewise. * bfd.c (bfd_get_sign_extend_vma): Add pei-loongarch64. * coff-loongarch64.c: New file. * coffcode.h (coff_set_arch_mach_hook, coff_set_flags, coff_write_object_contents) Add loongarch64 (loongarch64_pei_vec) support. * config.bfd: Likewise. * configure: Likewise. * configure.ac: Likewise. * libpei.h (GET_OPTHDR_IMAGE_BASE, PUT_OPTHDR_IMAGE_BASE, GET_OPTHDR_SIZE_OF_STACK_RESERVE, PUT_OPTHDR_SIZE_OF_STACK_RESERVE, GET_OPTHDR_SIZE_OF_STACK_COMMIT, PUT_OPTHDR_SIZE_OF_STACK_COMMIT, GET_OPTHDR_SIZE_OF_HEAP_RESERVE, PUT_OPTHDR_SIZE_OF_HEAP_RESERVE, GET_OPTHDR_SIZE_OF_HEAP_COMMIT, PUT_OPTHDR_SIZE_OF_HEAP_COMMIT, GET_PDATA_ENTRY, _bfd_peLoongArch64_bfd_copy_private_bfd_data_common, _bfd_peLoongArch64_bfd_copy_private_section_data, _bfd_peLoongArch64_get_symbol_info, _bfd_peLoongArch64_only_swap_filehdr_out, _bfd_peLoongArch64_print_private_bfd_data_common, _bfd_peLoongArch64i_final_link_postscript, _bfd_peLoongArch64i_only_swap_filehdr_out, _bfd_peLoongArch64i_swap_aouthdr_in, _bfd_peLoongArch64i_swap_aouthdr_out, _bfd_peLoongArch64i_swap_aux_in, _bfd_peLoongArch64i_swap_aux_out, _bfd_peLoongArch64i_swap_lineno_in, _bfd_peLoongArch64i_swap_lineno_out, _bfd_peLoongArch64i_swap_scnhdr_out, _bfd_peLoongArch64i_swap_sym_in, _bfd_peLoongArch64i_swap_sym_out, _bfd_peLoongArch64i_swap_debugdir_in, _bfd_peLoongArch64i_swap_debugdir_out, _bfd_peLoongArch64i_write_codeview_record, _bfd_peLoongArch64i_slurp_codeview_record, _bfd_peLoongArch64_print_ce_compressed_pdata): New. * peXXigen.c (_bfd_XXi_swap_aouthdr_in, _bfd_XXi_swap_aouthdr_out, _bfd_XXi_swap_scnhdr_out, pe_print_pdata, _bfd_XX_print_private_bfd_data_common, _bfd_XX_bfd_copy_private_section_data, _bfd_XXi_final_link_postscript): Support COFF_WITH_peLoongArch64, * pei-loongarch64.c: New file. * peicode.h (coff_swap_scnhdr_in, pe_ILF_build_a_bfd, pe_ILF_object_p): Support COFF_WITH_peLoongArch64. (jtab): Add dummy entry that traps. * targets.c (loongarch64_pei_vec): New. binutils * testsuite/binutils-all/loongarch64/loongarch64.exp: New file. * testsuite/binutils-all/loongarch64/pei-loongarch64.d: New test. * testsuite/binutils-all/loongarch64/pei-loongarch64.s: New test. include * coff/loongarch64.h: New file. * coff/pe.h (IMAGE_FILE_MACHINE_LOONGARCH64): New. Signed-off-by: Youling Tang <tangyouling@loongson.cn>
2022-08-10Automatic date update in version.inGDB Administrator1-1/+1
2022-08-09gdb/riscv/testsuite: fix failures in gdb.arch/riscv-reg-aliases.expAndrew Burgess1-12/+20
When running on a native RISC-V Linux target I currently see failures in the gdb.arch/riscv-reg-aliases.exp test like this: set $ft0.float = 501 (gdb) PASS: gdb.arch/riscv-reg-aliases.exp: write non-zero value to ft0 p/d $ft0.float $263 = 1140490240 (gdb) FAIL: gdb.arch/riscv-reg-aliases.exp: read ft0 after non-zero write to ft0 This test started failing after this commit: commit 56262a931b7ca8ee3ec9104bc7e9e0b40cf3d64e Date: Thu Feb 17 13:43:59 2022 -0700 Change how "print/x" displays floating-point value The problem is that when 501 is written to $ft0.float the value is converted to floating point format and stored in the register. Prior to the above commit printing with /x and /d would first extract the value as a float, and then convert the value to an integer for display. After the above commit GDB now uses the raw register value when displaying /x and /d, and so we see this behaviour: (gdb) info registers $ft0 ft0 {float = 501, double = 5.6347704700123827e-315} (raw 0x0000000043fa8000) (gdb) p/f $ft0.float $1 = 501 (gdb) p/d $ft0.float $2 = 1140490240 (gdb) p/x $ft0.float $3 = 0x43fa8000 To fix this test I now print the float registers using the /f format rather than /d. With this change the test now passes.
2022-08-09Another gas manual typo correction.Stepan Nemec1-1/+1
2022-08-09Fix typos in assembler documentation.Stepan Nemec1-10/+11
2022-08-09gdb/gdbserver: LoongArch: Improve implementation of fcc registersFeiyang Chen6-11/+99
The current implementation of the fcc register is referenced to the user_fp_state structure of the kernel uapi [1]. struct user_fp_state { uint64_t fpr[32]; uint64_t fcc; uint32_t fcsr; }; But it is mistakenly defined as a 64-bit fputype register, resulting in a confusing output of "info register". (gdb) info register ... fcc {f = 0x0, d = 0x0} {f = 0, d = 0} ... According to "Condition Flag Register" in "LoongArch Reference Manual" [2], there are 8 condition flag registers of size 1. Use 8 registers of uint8 to make it easier for users to view the fcc register groups. (gdb) info register ... fcc0 0x1 1 fcc1 0x0 0 fcc2 0x0 0 fcc3 0x0 0 fcc4 0x0 0 fcc5 0x0 0 fcc6 0x0 0 fcc7 0x0 0 ... [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/loongarch/include/uapi/asm/ptrace.h [2] https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#_condition_flag_register Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
2022-08-09Default to enabling colored disassembly if output is to a terminal.Nick Clifton5-19/+71
PR 29457 * objdump.c (disassembler_color): Change type to an enum. (disassembler_extended_color): Remove. (usage): Update. (objdump_color_for_assembler_style): Update. (main): Update initialisation of disassembler_color. If not initialised via a command line option, set based upon terminal output. * doc/binutils.texi: Update description of disassmbler-color option. * testsuite/binutils-all/arc/objdump.exp: Add --disassembler-color=off option when disassembling. * testsuite/binutils-all/arm/objdump.exp: Likewise.
2022-08-09Fix-for-multiple-thread-detection-in-AIX.Aditya Vidyadhar Kamath1-28/+35
In AIX multiple threads were not added. This patch is a fix for the same When we create a pthread debug session we have callbacks to read symbols and memory. One of those call backs is pdc_read_data. Before we come into aix-thread wait() we switch to no thread and therefore the current thread is null. When we get into pdc_read_data we have a dependency that we need to be in the correct current thread that has caused an event of new thread, inorder to read memory. Hence we switch to the correct thread. This is done by passing the pid in the pthdb_user_t user_current_pid parameter in every call back.
2022-08-09[gdb/testsuite] Fix gdb.dwarf2/debug-names.expTom de Vries1-7/+4
When running test-case gdb.dwarf2/debug-names.exp on openSUSE Tumbleweed, I run into: ... (gdb) maint info symtabs^M ... ERROR: internal buffer is full. UNRESOLVED: gdb.dwarf2/debug-names.exp: break _start expanded symtab ... Fix this by simplifying the test-case to print _start rather running to it. Tested on x86_64-linux.
2022-08-09gdb/riscv: use register name enum values in riscv-linux-nat.cAndrew Burgess1-6/+6
There were a few places where we were using integer values rather than the RISCV_*_REGNUM constants defined in riscv-tdep.h. This commit replaces 0 with RISCV_ZERO_REGNUM and 32 with RISCV_PC_REGNUM in a few places. There should be no user visible changes after this commit.
2022-08-09x86-64: adjust MOVQ to/from SReg attributesJan Beulich4-9/+23
It is unclear to me why the corresponding MOV (no Q suffix) can be issued without REX.W, but MOVQ has to have that prefix (bit). Add NoRex64 and in exchange drop Size64.
2022-08-09x86: adjust MOVSD attributesJan Beulich2-3/+3
The non-SSE2AVX form of the SIMD variant of the instruction needlessly has the (still multi-purpose) IgnoreSize attribute. All other similar SSE2 insns use NoRex64 instead. Make this consistent, noting that the SSE2AVX form can't have the same change made - there the memory operand doesn't at the same time permit RegXMM (which logic uses when deciding whether a Q suffix is okay outside of 64-bit mode).
2022-08-09x86: fold AVX VGATHERDPD / VPGATHERDQJan Beulich2-44/+8
While the other three variants each differ in attributes and hence can't be folded, these two pairs actually can be (and were previously overlooked). This effectively matches their AVX512VL counterparts, which are also expressed as a single template.
2022-08-09x86: allow use of broadcast with X/Y/Z-suffixed AVX512-FP16 insnsJan Beulich8-54/+63
While the x/y/z suffix isn't necessary to use in this case, it is still odd that these forms don't support broadcast (unlike their AVX512F / AVX512DQ counterparts). The lack thereof can e.g. make macro-ized programming more difficult.
2022-08-09x86/Intel: split certain AVX512-FP16 VCVT*2PH templatesJan Beulich2-12/+108
One more place where pre-existing templates should have been taken as a basis: In Intel syntax we want to consistently issue an "ambiguous operand size" error when a size-less memory operand is specified for an insn where register use alone isn't sufficient for disambiguation.
2022-08-09gdb/csky fix build error in ubuntu20_04Jiangshuai Li1-4/+4
build error in: https://builder.sourceware.org/buildbot/#/builders/170/builds/246 ... ../../binutils-gdb/gdb/csky-linux-tdep.c: In function ‘void csky_supply_fregset(const regset*, regcache*, int, const void*, size_t)’: ../../binutils-gdb/gdb/csky-linux-tdep.c:194:18: error: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘size_t’ {aka ‘unsigned int’} [-Werror=format=] 194 | warning (_("Unknow size %ld of section .reg2, can not get value" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | " of float registers."), len); ... Fix it via using %s vs pulongest suggested by Tom.
2022-08-09Automatic date update in version.inGDB Administrator1-1/+1
2022-08-08Fix regression from gdbarch registry changeTom Tromey1-1/+7
The gdbarch registry patch introduced a regression that could cause a crash when opening files in gdb. The bug is that, previously, the solib ops would default to current_target_so_ops; but the patch changed this code to default to nullptr. This patch fixes the bug by reintroducing the earlier behavior. This is PR gdb/29449. I managed to reproduce the bug with a riscv-elf build and then verified that this fixes the problem. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29449
2022-08-08add splay tree for info_ptr -> CU mappingMartin Liska1-10/+67
While using perf top for MozillaThunderbird I noticed quite some slow dissably call with source code involved. E.g. time ./objdump --start-address=0x0000000004e0dcd0 --stop-address=0x0000000004e0df8b -l -d --no-show-raw-insn -S -C /usr/lib64/thunderbird/libxul.so took 2.071s and I noticed quite some time is spent in find_abstract_instance: 33.46% objdump objdump [.] find_abstract_instance 18.22% objdump objdump [.] arange_add 13.77% objdump objdump [.] read_attribute_value 4.82% objdump objdump [.] comp_unit_maybe_decode_line_info 3.10% objdump libc.so.6 [.] __memset_avx2_unaligned_erms where linked list of CU is iterated when searing for where info_ptr belongs to: : 3452 for (u = unit->prev_unit; u != NULL; u = u->prev_unit) 0.00 : 4c61f7: mov 0x10(%rbx),%rax 0.00 : 4c61fb: test %rax,%rax 0.00 : 4c61fe: je 4c6215 <find_abstract_instance+0x365> : 3453 if (info_ptr >= u->info_ptr_unit && info_ptr < u->end_ptr) 0.00 : 4c6200: cmp 0x60(%rax),%rdx 83.20 : 4c6204: jb 4c620c <find_abstract_instance+0x35c> 0.00 : 4c6206: cmp 0x78(%rax),%rdx 6.89 : 4c620a: jb 4c6270 <find_abstract_instance+0x3c0> : 3452 for (u = unit->prev_unit; u != NULL; u = u->prev_unit) 0.00 : 4c620c: mov 0x10(%rax),%rax 7.90 : 4c6210: test %rax,%rax 0.00 : 4c6213: jne 4c6200 <find_abstract_instance+0x350> The following scan can be replaced with search in a splay tree and with that I can get to 1.5s and there are other symbols where the difference is even bigger. bfd/ChangeLog: PR 29081 * dwarf2.c (struct addr_range): New. (addr_range_intersects): Likewise. (splay_tree_compare_addr_range): Likewise. (splay_tree_free_addr_range): Likewise. (struct dwarf2_debug_file): Add comp_unit_tree. (find_abstract_instance): Use the splay tree when searching for a info_ptr. (stash_comp_unit): Insert to the splay tree. (_bfd_dwarf2_cleanup_debug_info): Clean up the splay tree.