aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-07-07Use is_pecoff_format in ld testsuiteAlan Modra9-25/+46
--image-base 0 is not just for x86_64 mingw. This patch fixes that, and a case where a changed LDFLAGS leaked out of one script to the next. * testsuite/ld-scripts/align.exp: Use is_pecoff_format. * testsuite/ld-scripts/defined.exp: Likewise. * testsuite/ld-scripts/provide.exp: Likewise. * testsuite/ld-scripts/weak.exp: Likewise. * testsuite/ld-scripts/empty-address.exp: Likewise. Reset LDFLAGS on exit. * testsuite/ld-scripts/expr.exp: Set LDFLAGS earlier, and with --image-base for PE. * testsuite/ld-scripts/include.exp: Set LDFLAGS for PE. * testsuite/ld-scripts/script.exp: Use is_pecoff_format, and set LDFLAGS as well as flags.
2020-07-07Use is_xcoff_format in ld testsuiteAlan Modra11-116/+63
* testsuite/ld-checks/checks.exp: Use is_xcoff_format. * testsuite/ld-powerpc/powerpc.exp: Likewise. * testsuite/ld-scripts/print-memory-usage.exp: Likewise. * testsuite/ld-srec/srec.exp: Likewise. * testsuite/ld-undefined/require-defined.exp: Likewise. * testsuite/ld-scripts/expr2.d: Likewise. * testsuite/ld-scripts/section-match-1.d: Only run for ELF. * testsuite/ld-elfvers/vers.exp: Delete dead code. * testsuite/ld-elfvsb/elfvsb.exp: Likewise. * testsuite/ld-elfweak/elfweak.exp: Likewise.
2020-07-07Use is_xcoff_format in gas testsuiteAlan Modra4-5/+11
* testsuite/gas/all/gas.exp: Use is_xcoff_format. * testsuite/gas/ppc/ppc.exp: Likewise. * testsuite/gas/all/weakref1l.d: Likewise.
2020-07-07Use is_xcoff_format in binutils testsuiteAlan Modra7-12/+26
and restrict some other tests using is_*_format. * testsuite/binutils-all/ar.exp: Use is_xcoff_format. * testsuite/binutils-all/nm.exp: Likewise. * testsuite/binutils-all/copy-2.d: Run only for elf and pe targets. * testsuite/binutils-all/copy-3.d: Run only for elf targets. * testsuite/binutils-all/set-section-alignment.d: Likewise. * testsuite/binutils-all/copy-4.d: Don't run for xcoff.
2020-07-07XCOFF binutils testsuite fixAlan Modra3-1/+19
Avoid an UNRESOLVED test due to "Error: the XCOFF file format does not support arbitrary sections". * testsuite/lib/binutils-common.exp (is_xcoff_format): New. * testsuite/binutils-all/objcopy.exp (pr25662): Exclude xcoff.
2020-07-07XCOFF linker script PROVIDE supportAlan Modra2-0/+6
Fixes bit rot from git commit b46a87b1606. * emultempl/aix.em (gld${EMULATION_NAME}_find_exp_assignment): Handle etree_provided.
2020-07-07XCOFF ld segfaults when running ld testsuiteAlan Modra2-7/+30
The binutils XCOFF support doesn't handle random linker scripts very well at all. These tweaks to final_link fix segfaults when some linker created sections are discarded due to "/DISCARD/ : { *(.*) }" in scripts. The xcoff_mark change is necessary to not segfault on symbols defined in scripts, which may be bfd_link_hash_defined yet have u.def.section set to bfd_und_section_ptr. (Which might seem odd, but occurs during early stages of linking before input sections are mapped.) * xcofflink.c (xcoff_mark): Don't mark const sections. (bfd_xcoff_record_link_assignment): Add FIXME. (_bfd_xcoff_bfd_final_link): Don't segfault on assorted magic sections being discarded by linker script.
2020-07-07XCOFF deterministic archivesAlan Modra2-0/+20
Adds support for "ar -D". * coff-rs6000.c (xcoff_write_archive_contents_old): Set default time, uid, gid and mode for deterministic archive. (xcoff_write_archive_contents_big): Likewise.
2020-07-07XCOFF C_HIDEXT and C_AIX_WEAKEXT classificationAlan Modra2-0/+15
If C_HIDEXT and C_AIX_WEAKEXT symbols aren't handled as globals by coff_classify_symbol then we run into "warning: .. local symbol `some garbage name' has no section". These are of course both global symbols, but C_HIDEXT is like a local in some respects and returning COFF_SYMBOL_LOCAL for C_HIDEXT keeps nm output looking the same. Fixes these fails on rs6000-aix5.1: -FAIL: weakref tests, relocations -FAIL: weakref tests, global syms -FAIL: weakref tests, strong undefined syms -FAIL: weakref tests, weak undefined syms * coffcode.h (coff_classify_symbol): Handle C_HIDEXT and C_AIX_WEAKEXT.
2020-07-07sh vxworks testsAlan Modra3-2/+7
These tests were failing only due to not being updated for readelf output changes. * testsuite/ld-sh/vxworks1-lib.rd: Update expected output. * testsuite/ld-sh/vxworks4.d: Likewise.
2020-07-07Stop the GOLD linker from complaining about relocations from ↵Nick Clifton2-0/+6
.gnu.build.attributes sections to discarded code sections. * target-reloc.h (Default_comdat_behaviour:get): Ignore discarded relocs that refer to the .gnu.build.attributes section.
2020-07-07Fix recent failures in the ARM assembler testsuite due to the correction of ↵Nick Clifton2-92/+97
a spelling mistake. * testsuite/gas/arm/cde-missing-fp.l: Fix spelling mistake in expected output.
2020-07-07x86: introduce %BW to avoid going through vex_w_table[]Jan Beulich4-77/+27
This parallels %LW and %XW.
2020-07-07Automatic date update in version.inGDB Administrator1-1/+1
2020-07-06gdb: Python unwinders, inline frames, and tail-call framesAndrew Burgess9-48/+185
This started with me running into the bug described in python/22748, in summary, if the frame sniffing code accessed any registers within an inline frame then GDB would crash with this error: gdb/frame.c:579: internal-error: frame_id get_frame_id(frame_info*): Assertion `fi->level == 0' failed. The problem is that, when in the Python unwinder I write this: pending_frame.read_register ("register-name") This is translated internally into a call to `value_of_register', which in turn becomes a call to `value_of_register_lazy'. Usually this isn't a problem, `value_of_register_lazy' requires the next frame (more inner) to have a valid frame_id, which will be the case (if we're sniffing frame #1, then frame #0 will have had its frame-id figured out). Unfortunately if frame #0 is inline within frame #1, then the frame-id for frame #0 can't be computed until we have the frame-id for #1. As a result we can't create a lazy register for frame #1 when frame #0 is inline. Initially I proposed a solution inline with that proposed in bugzilla, changing value_of_register to avoid creating a lazy register value. However, when this was discussed on the mailing list I got this reply: https://sourceware.org/pipermail/gdb-patches/2020-June/169633.html Which led me to look at these two patches: [1] https://sourceware.org/pipermail/gdb-patches/2020-April/167612.html [2] https://sourceware.org/pipermail/gdb-patches/2020-April/167930.html When I considered patches [1] and [2] I saw that all of the issues being addressed here were related, and that there was a single solution that could address all of these issues. First I wrote the new test gdb.opt/inline-frame-tailcall.exp, which shows that [1] and [2] regress the inline tail-call unwinder, the reason for this is that these two patches replace a call to gdbarch_unwind_pc with a call to get_frame_register, however, this is not correct. The previous call to gdbarch_unwind_pc takes THIS_FRAME and returns the $pc value in the previous frame. In contrast get_frame_register takes THIS_FRAME and returns the value of the $pc in THIS_FRAME; these calls are not equivalent. The reason these patches appear (or do) fix the regressions listed in [1] is that the tail call sniffer depends on identifying the address of a caller and a callee, GDB then looks for a tail-call sequence that takes us from the caller address to the callee, if such a series is found then tail-call frames are added. The bug that was being hit, and which was address in patch [1] is that in order to find the address of the caller, GDB ended up creating a lazy register value for an inline frame with to frame-id. The solution in patch [1] is to instead take the address of the callee and treat this as the address of the caller. Getting the address of the callee works, but we then end up looking for a tail-call series from the callee to the callee, which obviously doesn't return any sane results, so we don't insert any tail call frames. The original patch [1] did cause some breakage, so patch [2] undid patch [1] in all cases except those where we had an inline frame with no frame-id. It just so happens that there were no tests that fitted this description _and_ which required tail-call frames to be successfully spotted, as a result patch [2] appeared to work. The new test inline-frame-tailcall.exp, exposes the flaw in patch [2]. This commit undoes patch [1] and [2], and replaces them with a new solution, which is also different to the solution proposed in the python/22748 bug report. In this solution I propose that we introduce some special case logic to value_of_register_lazy. To understand what this logic is we must first look at how inline frames unwind registers, this is very simple, they do this: static struct value * inline_frame_prev_register (struct frame_info *this_frame, void **this_cache, int regnum) { return get_frame_register_value (this_frame, regnum); } And remember: struct value * get_frame_register_value (struct frame_info *frame, int regnum) { return frame_unwind_register_value (frame->next, regnum); } So in all cases, unwinding a register in an inline frame just asks the next frame to unwind the register, this makes sense, as an inline frame doesn't really exist, when we unwind a register in an inline frame, we're really just asking the next frame for the value of the register in the previous, non-inline frame. So, if we assume that we only get into the missing frame-id situation when we try to unwind a register from an inline frame during the frame sniffing process, then we can change value_of_register_lazy to not create lazy register values for an inline frame. Imagine this stack setup, where #1 is inline within #2. #3 -> #2 -> #1 -> #0 \______/ inline Now when trying to figure out the frame-id for #1, we need to compute the frame-id for #2. If the frame sniffer for #2 causes a lazy register read in #2, either due to a Python Unwinder, or for the tail-call sniffer, then we call value_of_register_lazy passing in frame #2. In value_of_register_lazy, we grab the next frame, which is #1, and we used to then ask for the frame-id of #1, which was not computed, and this was our bug. Now, I propose we spot that #1 is an inline frame, and so lookup the next frame of #1, which is #0. As #0 is not inline it will have a valid frame-id, and so we create a lazy register value using #0 as the next-frame-id. This will give us the exact same result we had previously (thanks to the code we inspected above). Encoding into value_of_register_lazy the knowledge that reading an inline frame register will always just forward to the next frame feels.... not ideal, but this seems like the cleanest solution to this recursive frame-id computation/sniffing issue that appears to crop up. The following two commits are fully reverted with this commit, these correspond to patches [1] and [2] respectively: commit 5939967b355ba6a940887d19847b7893a4506067 Date: Tue Apr 14 17:26:22 2020 -0300 Fix inline frame unwinding breakage commit 991a3e2e9944a4b3a27bd989ac03c18285bd545d Date: Sat Apr 25 00:32:44 2020 -0300 Fix remaining inline/tailcall unwinding breakage for x86_64 gdb/ChangeLog: PR python/22748 * dwarf2/frame-tailcall.c (dwarf2_tailcall_sniffer_first): Remove special handling for inline frames. * findvar.c (value_of_register_lazy): Skip inline frames when creating lazy register values. * frame.c (frame_id_computed_p): Delete definition. * frame.h (frame_id_computed_p): Delete declaration. gdb/testsuite/ChangeLog: PR python/22748 * gdb.opt/inline-frame-tailcall.c: New file. * gdb.opt/inline-frame-tailcall.exp: New file. * gdb.python/py-unwind-inline.c: New file. * gdb.python/py-unwind-inline.exp: New file. * gdb.python/py-unwind-inline.py: New file.
2020-07-06gdb/python: New method to access list of register groupsAndrew Burgess10-0/+371
Add a new method gdb.Architecture.register_groups which returns a new object of type gdb.RegisterGroupsIterator. This new iterator then returns objects of type gdb.RegisterGroup. Each gdb.RegisterGroup object just wraps a single reggroup pointer, and (currently) has just one read-only property 'name' that is a string, the name of the register group. As with the previous commit (adding gdb.RegisterDescriptor) I made gdb.RegisterGroup an object rather than just a string in case we want to add additional properties in the future. gdb/ChangeLog: * NEWS: Mention additions to Python API. * python/py-arch.c (archpy_register_groups): New function. (arch_object_methods): Add 'register_groups' method. * python/py-registers.c (reggroup_iterator_object): New struct. (reggroup_object): New struct. (gdbpy_new_reggroup): New function. (gdbpy_reggroup_to_string): New function. (gdbpy_reggroup_name): New function. (gdbpy_reggroup_iter): New function. (gdbpy_reggroup_iter_next): New function. (gdbpy_new_reggroup_iterator): New function (gdbpy_initialize_registers): Register new types. (reggroup_iterator_object_type): Define new Python type. (gdbpy_reggroup_getset): New static global. (reggroup_object_type): Define new Python type. * python/python-internal.h gdb/testsuite/ChangeLog: * gdb.python/py-arch-reg-groups.exp: New file. gdb/doc/ChangeLog: * gdb.texi (Registers): Add @anchor for 'info registers <reggroup>' command. * python.texi (Architectures In Python): Document new register_groups method. (Registers In Python): Document two new object types related to register groups.
2020-07-06gdb/python: Add gdb.Architecture.registers methodAndrew Burgess11-0/+452
This commit adds a new method gdb.Architecture.registers that returns an object of the new type gdb.RegisterDescriptorIterator. This iterator returns objects of the new type gdb.RegisterDescriptor. A RegisterDescriptor is not a way to read the value of a register, this is already covered by Frame.read_register, a RegisterDescriptor is simply a way to discover from Python, which registers are available for a given architecture. I did consider just returning a string, the name of each register, instead of a RegisterDescriptor, however, I'm aware that it we don't want to break the existing Python API in any way, so if I return just a string now, but in the future we want more information about a register then we would have to add a second API to get that information. By going straight to a descriptor object now, it is easy to add additional properties in the future should we wish to. Right now the only property of a register that a user can access is the name of the register. In future we might want to be able to ask the register about is register groups, or its type. gdb/ChangeLog: * Makefile.in (SUBDIR_PYTHON_SRCS): Add py-registers.c * python/py-arch.c (archpy_registers): New function. (arch_object_methods): Add 'registers' method. * python/py-registers.c: New file. * python/python-internal.h (gdbpy_new_register_descriptor_iterator): Declare. (gdbpy_initialize_registers): Declare. * python/python.c (do_start_initialization): Call gdbpy_initialize_registers. * NEWS: Mention additions to the Python API. gdb/testsuite/ChangeLog: * gdb.python/py-arch-reg-names.exp: New file. gdb/doc/ChangeLog: * python.texi (Python API): Add new section the menu. (Frames In Python): Add new @anchor. (Architectures In Python): Document new registers method. (Registers In Python): New section.
2020-07-06gdb/python: Add architecture method to gdb.PendingFrameAndrew Burgess7-1/+54
It could be useful to determine the architecture of a frame being unwound during the frame unwind process, that is, before we have a gdb.Frame, but when we only have a gdb.PendingFrame. The PendingFrame already has a pointer to the gdbarch internally, this commit just exposes an 'architecture' method to Python, and has this return a gdb.Architecture object (list gdb.Frame.architecture does). gdb/ChangeLog: * NEWS: Mention new Python API method. * python/py-unwind.c (pending_framepy_architecture): New function. (pending_frame_object_methods): Add architecture method. gdb/testsuite/ChangeLog: * gdb.python/py-unwind.py (TestUnwinder::__call__): Add test for gdb.PendingFrame.architecture method. gdb/doc/ChangeLog: * python.texi (Unwinding Frames in Python): Document PendingFrame.architecture method.
2020-07-06gdb: Remove deprecated_set_gdbarch_dataAndrew Burgess6-68/+33
There are currently two remaining uses of deprecated_set_gdbarch_data, both of which are needed because during gdbarch initialisation we call gdbarch_data for a data field that is registered using: gdbarch_data_register_post_init (....) However, in both of these cases, the only thing that the call back needs from the gdbarch struct is its obstack. Given this there is nothing stopping us changing the post-init hooks into pre-init hooks. The pre-init hooks don't get passed the full gdbarch, they only get passed its obstack. The IA64 change is completely untested. The user-regs change has been tested a little by locally adding some user-regs to the x86-64 target, and also by running the RISC-V tests, which do use user-regs. gdb/ChangeLog: * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (deprecated_set_gdbarch_data): Delete. (gdbarch_data): Use internal_error for the case where deprecated_set_gdbarch_data was originally needed. * ia64-libunwind-tdep.c (libunwind_descr_init): Update parameters, and use passed in obstack. (libunwind_frame_set_descr): Should no longer get back NULL from gdbarch_data. (_initialize_libunwind_frame): Register as a pre-init gdbarch data type. * user-regs.c (user_regs_init): Update parameters, and use passed in obstack. (user_reg_add): Should no longer get back NULL from gdbarch_data. (_initialize_user_regs): Register as a pre-init gdbarch data type.
2020-07-06[gdb/symtab] Fix line-table end-of-sequence sortingTom de Vries5-6/+30
Consider test-case gdb.dwarf2/dw2-ranges-base.exp. It has (ignoring non-sensical entries that are filtered out by buildsym_compunit::record_line) a line-table for dw2-ranges-base.c like this: ... Line Number Statements: [0x0000014e] Extended opcode 2: set Address to 0x4004ba [0x00000159] Advance Line by 10 to 11 [0x0000015b] Copy [0x0000015c] Advance PC by 12 to 0x4004c6 [0x0000015e] Extended opcode 1: End of Sequence [0x00000161] Extended opcode 2: set Address to 0x4004ae [0x0000016c] Advance Line by 20 to 21 [0x0000016e] Copy [0x0000016f] Advance PC by 12 to 0x4004ba [0x00000171] Extended opcode 1: End of Sequence [0x00000174] Extended opcode 2: set Address to 0x4004a7 [0x0000017f] Advance Line by 30 to 31 [0x00000181] Copy [0x00000182] Advance PC by 7 to 0x4004ae [0x00000184] Extended opcode 1: End of Sequence ... If we disable the sorting in buildsym_compunit::end_symtab_with_blockvector, we have the unsorted line table: ... INDEX LINE ADDRESS IS-STMT 0 11 0x00000000004004ba Y 1 END 0x00000000004004c6 Y 2 21 0x00000000004004ae Y 3 END 0x00000000004004ba Y 4 31 0x00000000004004a7 Y 5 END 0x00000000004004ae Y ... It contains 3 sequences, 11/END, 21/END and 31/END. We want to sort the 3 sequences relative to each other, while sorting on address, to get: ... INDEX LINE ADDRESS IS-STMT 0 31 0x00000000004004a7 Y 1 END 0x00000000004004ae Y 2 21 0x00000000004004ae Y 3 END 0x00000000004004ba Y 4 11 0x00000000004004ba Y 5 END 0x00000000004004c6 Y ... However, if we re-enable the sorting, we have instead: ... INDEX LINE ADDRESS IS-STMT 0 31 0x00000000004004a7 Y 1 21 0x00000000004004ae Y 2 END 0x00000000004004ae Y 3 11 0x00000000004004ba Y 4 END 0x00000000004004ba Y 5 END 0x00000000004004c6 Y ... This is a regression since commit 3d92a3e313 "gdb: Don't reorder line table entries too much when sorting", that introduced sorting on address while keeping entries with the same address in pre-sort order. Indeed the entries 1 and 2 are in pre-sort order (they map to entries 2 and 5 in the unsorted line table), but entry 1 does not belong in the sequence terminated by 2. Fix this by handling End-Of-Sequence entries in the sorting function, such that they are sorted before other entries with the same address. Also, revert the find_pc_sect_line workaround introduced in commit 3d92a3e313, since that's no longer necessary. Tested on x86_64-linux. gdb/ChangeLog: 2020-07-06 Tom de Vries <tdevries@suse.de> * buildsym.c (buildsym_compunit::end_symtab_with_blockvector): Handle End-Of-Sequence in lte_is_less_than. * symtab.c (find_pc_sect_line): Revert change from commit 3d92a3e313 "gdb: Don't reorder line table entries too much when sorting". gdb/testsuite/ChangeLog: 2020-07-06 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/dw2-ranges-base.exp: Test line-table order.
2020-07-06x86: adjust/correct VFRCZ{P,S}{S,D} decodingJan Beulich2-12/+48
The unnecessary XOP.L decoding had caught my eye, together with the not really expected operand specifiers. Drop this decode step, and instead make sure XOP.W and XOP.PP don't get ignored. For the latter, do this in a form applicable to all XOP insns, rather than adding extra table layers - there are no encodings with the field non-zero. Besides these two, for the scalar forms XOP.L actually needs to also be zero.
2020-07-06x86: use %LW / %XW instead of going through vex_w_table[]Jan Beulich4-192/+77
Since we have these macros, there's no point having unnecessary table depth. VFPCLASSP{S,D} are now the first instance of using two %-prefixed macros, which has pointed out a problem with the implementation. Instead of using custom code in various case blocks, do the macro accumulation centralized at the top of the main loop of putop(), and zap the accumulated macros at the bottom of that loop once it has been processed.
2020-07-06x86: most VBROADCAST{F,I}{32,64}x* only accept memory operandsJan Beulich5-24/+90
VBROADCAST{F,I}32x2 are the only exceptions here.
2020-07-06x86: adjust/correct V*{F,I}{32x8,64x4}Jan Beulich2-14/+22
For all of these only the 512-bit forms are valid, so drop 256-bit ones from the integer insert/extract variants. Also replace EXxmmq by the more natural (here) EXymm.
2020-07-06x86: drop EVEX table entries that can be made served by VEX onesJan Beulich5-165/+92
By doing the EVEX.W decode first, in various cases VEX table entries can be re-used.
2020-07-06x86: AVX512 VPERM{D,Q,PS,PD} insns need to honor EVEX.L'LJan Beulich5-4/+47
Just like (where they exist) their AVX counterparts do for VEX.L. For all of them the 128-bit forms are invalid.
2020-07-06x86: AVX512 extract/insert insns need to honor EVEX.L'LJan Beulich10-45/+120
Just like their AVX counterparts do for VEX.L. At this occasion also make EVEX.W have the same effect as VEX.W on the printing of VPINSR{B,W}'s operands, bringing them also in sync with VPEXTR{B,W}.
2020-07-06x86: honor VEX.W for VCVT{PH2PS,PS2PH}Jan Beulich5-15/+27
Unlike for the EVEX-encoded versions, the VEX ones failed to decode VEX.W. Once the necessary adjustments are done, it becomes obvious that the EVEX and VEX table entries for VCVTPS2PH are identical and can hence be folded.
2020-07-06x86: drop EVEX table entries that can be served by VEX onesJan Beulich5-713/+185
The duplication is not only space inefficient, but also risks entries going out of sync (some of which that I became aware of while doing this work will get addressed subsequently). Right here note that for VGF2P8MULB this also addresses the prior lack of EVEX.W decoding (i.e. a first example of out of sync entries). This introduces EXxEVexR to some VEX templates, on the basis that this operand is benign there and only relevant when EVEX encoding ends up reaching these entries.
2020-07-06x86: replace EXqScalarS by EXqVexScalarSJan Beulich10-7/+29
There's only a single user, that that one can do fine with the alternative, as the "Vex" aspect of the other operand kind is meaningful only on 3-operand insns. While doing this I noticed that I didn't need to do the same adjustment in the EVEX tables, and voilà - there was a bug, which gets fixed at the same time (see the testsuite changes).
2020-07-06x86: replace EX{d,q}Scalar by EXxmm_m{d,q}Jan Beulich3-47/+48
Along the lines of 4102be5cf925 ("x86: replace EXxmm_mdq by EXVexWdqScalar"), but in the opposite direction, replace EXdScalar/ EXqScalar by EXxmm_md/EXxmm_mq respectively, rendering d_scalar_mode and q_scalar_mode unused. The change is done this way to improve telling apart operands affected here from ones using EXbScalar/EXwScalar, which work sufficiently differently. Additionally this increases similarity between several VEX-encoded insns and their EVEX-encoded counterparts.
2020-07-06Fix spelling mistakes in some of the binutils sub-directories.Nick Clifton11-1690/+1916
PR 26204 gas * config/tc-arm.c: Fix spelling mistake. * config/tc-riscv.c: Likewise. * config/tc-z80.c: Likewise. * po/gas.pot: Regenerate. ld * lexsup.c: Fix spelling mistake. * po/ld.pot: Regenerate. opcodes * arc-dis.c: Fix spelling mistake. * po/opcodes.pot: Regenerate.
2020-07-06Updated translations for various binutils sub-directoriesNick Clifton22-22170/+22964
2020-07-06[gdb/tui,c++17] Fix NULL string_view in tui_partial_win_by_nameTom de Vries2-13/+15
When building gdb with CFLAGS=-std=gnu17 and CXXFLAGS=-std=gnu++17 and running test-case gdb.tui/new-layout.exp, we run into: ... UNRESOLVED: gdb.tui/new-layout.exp: left window box after shrink (ll corner) FAIL: gdb.tui/new-layout.exp: right window box after shrink (ll corner) ... In a minimal form, we run into an abort when issuing a winheight command: ... $ gdb -tui -ex "winheight src - 5" <tui stuff> Aborted (core dumped) $ ... with this backtrace at the abort: ... \#0 0x0000000000438db0 in std::char_traits<char>::length (__s=0x0) at /usr/include/c++/9/bits/char_traits.h:335 \#1 0x000000000043b72e in std::basic_string_view<char, \ std::char_traits<char> >::basic_string_view (this=0x7fffffffd4f0, \ __str=0x0) at /usr/include/c++/9/string_view:124 \#2 0x000000000094971b in tui_partial_win_by_name (name="src") at src/gdb/tui/tui-win.c:663 ... due to a NULL comparison which constructs a string_view object from NULL: ... 657 /* Answer the window represented by name. */ 658 static struct tui_win_info * 659 tui_partial_win_by_name (gdb::string_view name) 660 { 661 struct tui_win_info *best = nullptr; 662 663 if (name != NULL) ... In gdbsupport/gdb_string_view.h, we either use: - gdb's copy of libstdc++-v3/include/experimental/string_view, or - the standard implementation of string_view, when built with C++17 or later (which in gcc's case comes from libstdc++-v3/include/std/string_view) In the first case, there's support for constructing a string_view from a NULL pointer: ... /*constexpr*/ basic_string_view(const _CharT* __str) : _M_len{__str == nullptr ? 0 : traits_type::length(__str)}, _M_str{__str} { } ... but in the second case, there's not: ... __attribute__((__nonnull__)) constexpr basic_string_view(const _CharT* __str) noexcept : _M_len{traits_type::length(__str)}, _M_str{__str} { } ... Fix this by removing the NULL comparison altogether. Build on x86_64-linux with CFLAGS=-std=gnu17 and CXXFLAGS=-std=gnu++17, and tested. gdb/ChangeLog: 2020-07-06 Tom de Vries <tdevries@suse.de> PR tui/26205 * tui/tui-win.c (tui_partial_win_by_name): Don't test for NULL name.
2020-07-06asan: readelf: stack buffer overflowAlan Modra2-2/+7
* readelf.c (print_dynamic_symbol): Don't sprintf to buffer to find string length.
2020-07-06Automatic date update in version.inGDB Administrator1-1/+1
2020-07-05[gdb/build,c++17] Fix use of deprecated std::uncaught_exceptionTom de Vries2-1/+16
When compiling gdb with -std=gnu++17, we run into: ... ../../gdb/inferior.h: In member function ‘void \ infcall_suspend_state_deleter::operator()(infcall_suspend_state*) const’: ../../gdb/inferior.h:83:12: error: ‘bool std::uncaught_exception()’ is \ deprecated [-Werror=deprecated-declarations] 83 | if (!std::uncaught_exception ()) ... Fix this by rewriting using std::uncaught_exceptions. Tested on x86_64-linux with gcc 9.3.1 and -std=gnu17/gnu++17. Tested with test-case from RFC patch https://sourceware.org/pipermail/gdb-patches/2020-June/169970.html. gdb/ChangeLog: 2020-07-05 Tom de Vries <tdevries@suse.de> PR build/26187 * inferior.h (struct infcall_suspend_state_deleter): If available, use std::uncaught_exceptions instead of deprecated std::uncaught_exception.
2020-07-05Automatic date update in version.inGDB Administrator1-1/+1
2020-07-04Tweak version numbers in release-howtoNick Clifton1-6/+6
2020-07-04oops - omitted from previous deltaNick Clifton1-0/+6
2020-07-04Update version to 2.35.50 and regenerate filesNick Clifton16-5105/+5331
2020-07-04Add markers for binutils 2.35 branchNick Clifton17-0/+59
2020-07-03gdb: make macro_stringify return a gdb::unique_xmalloc_ptr<char>Simon Marchi4-16/+15
The change to macro_stringify is straightforward. This allows removing the manual memory management in fixup_definition. gdb/ChangeLog: * macroexp.h (macro_stringify): Return gdb::unique_xmalloc_ptr<char>. * macroexp.c (macro_stringify): Likewise. * macrotab.c (fixup_definition): Update. Change-Id: Id7db8988bdbd569dd51c4f4655b00eb26db277cb
2020-07-03gdb: make macro_expand_next return a gdb::unique_xmalloc_ptr<char>Simon Marchi4-22/+28
For some reason, macro_expand_next does not return a gdb::unique_xmalloc_ptr<char>, like its counterparts macro_expand and macro_expand_once. This patch fixes that. macro_buffer::release now returns a gdb::unique_xmalloc_ptr<char> too, which required updating the other callers. The `.release (). release ()` in macro_stringify looks a bit funny, but it's because one release is for the macro_buffer, and the other is for the unique ptr. I removed the ATTRIBUTE_UNUSED_RESULT on macro_buffer::release, I don't really understand why it's there. I don't see how this method could be called without using the result, that would be an obvious memory leak. The commit that introduced it (4e4a8b932b7 "Add ATTRIBUTE_UNUSED_RESULT to macro_buffer") doesn't give any details. gdb/ChangeLog: * c-exp.y (scan_macro_expansion): Don't free `expansion`. (lex_one_token): Update. * macroexp.c (struct macro_buffer) <release>: Return gdb::unique_xmalloc_ptr<char>. (macro_stringify): Update. (macro_expand): Update. (macro_expand_next): Return gdb::unique_xmalloc_ptr<char>. * macroexp.h (macro_expand_next): Likewise. Change-Id: I67a74d0d479d2c20cdc82161ead7c54cea034f56
2020-07-03gdb: remove callback in macro expand functionsSimon Marchi7-91/+72
I started to look into changing the callbacks in macroexp.h to use gdb::function_view. However, I noticed that the passed lookup function was always `standard_macro_lookup`, which looks up a macro in a `macro_scope` object. Since that doesn't look like a very useful abstraction, it would be simpler to just pass the scope around and have the various functions call standard_macro_lookup themselves. This is what this patch does. gdb/ChangeLog: * macroexp.h (macro_lookup_ftype): Remove. (macro_expand, macro_expand_once, macro_expand_next): Remove lookup function parameters, add scope parameter. * macroexp.c (scan, substitute_args, expand, maybe_expand, macro_expand, macro_expand_once, macro_expand_next): Likewise. * macroscope.h (standard_macro_lookup): Change parameter type to macro_scope. * macroscope.c (standard_macro_lookup): Likewise. * c-exp.y (lex_one_token): Update. * macrocmd.c (macro_expand_command): Likewise. (macro_expand_once_command): Likewise. Change-Id: Id2431b1489359e1b0274dc2b81e5ea5d225d730c
2020-07-04Automatic date update in version.inGDB Administrator1-1/+1
2020-07-03sim/igen: Fix linker error with -fno-commonSebastian Huber4-0/+20
GCC 10 enables -fno-common by default. This resulted in multiple definition linker errors since a global variable was declared and defined in a header file: ld: libsim.a(idecode.o):sim/v850/idecode.h:71: multiple definition of `idecode_issue'; libsim.a(irun.o):sim/v850/idecode.h:71: first defined here ld: libsim.a(engine.o):sim/v850/idecode.h:71: multiple definition of `idecode_issue'; libsim.a(irun.o):sim/v850/idecode.h:71: first defined here ld: libsim.a(support.o):sim/v850/idecode.h:71: multiple definition of `idecode_issue'; libsim.a(irun.o):sim/v850/idecode.h:71: first defined here ld: libsim.a(semantics.o):sim/v850/idecode.h:71: multiple definition of `idecode_issue'; libsim.a(irun.o):sim/v850/idecode.h:71: first defined here sim/igen PR sim/26194 * lf.h (lf_get_file_type): Declare. * lf.c (lf_get_file_type): Define. * gen-idecode.c (print_idecode_issue_function_header): Use lf_get_file_type() to issue an extern variable declaration in case of header files.
2020-07-03sim/ppc: Fix linker error with -fno-commonSebastian Huber3-17/+38
GCC 10 enables -fno-common by default. This resulted in a multiple definition linker error since global variables were declared and defined in a header file: ld: ld-insn.o:sim/ppc/ld-insn.h:221: multiple definition of `max_model_fields_len'; igen.o:sim/ppc/ld-insn.h:221: first defined here sim/ppc * ld-insn.h (last_model, last_model_data, last_model_function, last_model_internal, last_model_macro, last_model_static): Delete. (max_model_fields_len, model_data, model_functions, model_internal, model_macros, model_static, models): Declare, but do not define. * ld-insn.c (last_model, last_model_data, last_model_function, last_model_internal, last_model_macro, last_model_static, max_model_fields_len, model_data, model_functions, model_internal, model_macros, model_static, models): Define.
2020-07-03Fix gdb.base/structs2.exp with ClangPedro Alves3-2/+8
gdb.base/structs2.exp fails to run with Clang, because of: gdb compile failed, /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/structs2.c:16:14: warning: implicit conversion from 'int' to 'signed char' changes value from 130 to -126 [-Wconstant-conversion] param_reg (130, 120, 33000, 32000); ~~~~~~~~~ ^~~ /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/structs2.c:16:24: warning: implicit conversion from 'int' to 'short' changes value from 33000 to -32536 [-Wconstant-conversion] param_reg (130, 120, 33000, 32000); ~~~~~~~~~ ^~~~~ 2 warnings generated. === gdb Summary === # of untested testcases 1 Fix it by passing actual negative numbers. gdb/testsuite/ChangeLog: * gdb.base/structs2.c (main): Adjust second parem_reg call to explicitly write negative numbers. * gdb.base/structs2.exp: Adjust expected output.
2020-07-03Fix gdb.base/charset.exp with ClangPedro Alves2-4/+18
gdb.base/charset.exp fails to run with Clang, because of: gdb compile failed, /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/charset.c:144:20: warning: implicit conversion from 'int' to 'char' changes value from 162 to -94 [-Wconstant-conversion] 11, 162, 17); ^~~ /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/charset.c:151:16: warning: implicit conversion from 'int' to 'char' changes value from 167 to -89 [-Wconstant-conversion] 167, ^~~ /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/charset.c:168:16: warning: implicit conversion from 'int' to 'char' changes value from 167 to -89 [-Wconstant-conversion] 167, ^~~ 3 warnings generated. === gdb Summary === # of untested testcases 1 Fix it by changing init_string to take unsigned char parameters. gdb/testsuite/ChangeLog: * gdb.base/charset.c (init_string): Change all char parameters to unsigned char parameters.