aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-06-16gdb, doc: Fix missed ChangeLog entry.Felix Willgerodt1-0/+6
My previous commit "btrace, doc: Clarify record function-call-history documentation." didn't add this to the actual ChangeLog file. Fix that.
2021-06-16btrace, doc: Clarify record function-call-history documentation.Felix Willgerodt1-15/+14
The documentation for 'record function-call-history' mentions lines instead of functions when talking about the number of functions printed, as currently there is only one line printed per function. Yet the code actually handles this on function granularity not on line basis. Future patches will extend the number of lines printed per function. This also makes it consistent with the 'record instruction-history' command, where multiple lines can be printed per instruction. gdb/doc/ChangeLog: 2021-06-16 Felix Willgerodt <felix.willgerodt@intel.com> * gdb.texinfo (Process Record and Replay): Stop mentioning lines for "record function-call-history" and "set record function-call-history-size".
2021-06-16[gdb/symtab] Fix infinite recursion in dwarf2_cu::get_builder(), againTom de Vries5-23/+36
This is another attempt at fixing the problem described in commit 4cf88725da1 "[gdb/symtab] Fix infinite recursion in dwarf2_cu::get_builder()", which was reverted in commit 3db19b2d724. First off, some context. A DWARF CU can be viewed as a symbol table: toplevel children of a CU DIE represent symbol table entries for that CU. Furthermore, there is a hierarchy: a symbol table entry such as a function itself has a symbol table containing parameters and local variables. The dwarf reader maintains a notion of current symbol table (that is: the symbol table a new symbol needs to be entered into) in dwarf2_cu member list_in_scope. A problem then presents itself when reading inter-CU references: - a new symbol read from a CU B needs to be entered into the symbol table of another CU A. - the notion of current symbol table is tracked on a per-CU basis. This is addressed in inherit_abstract_dies by temporarily overwriting the list_in_scope for CU B with the one for CU A. The current symbol table is one aspect of the current dwarf reader context that is tracked, but there are more, f.i. ones that are tracked via the dwarf2_cu member m_builder, f.i. m_builder->m_local_using_directives. A similar problem exists in relation to inter-CU references, but a different solution was chosen: - to keep track of an ancestor field in dwarf2_cu, which is updated when traversing inter-CU references, and - to use the ancestor field in dwarf2_cu::get_builder to return the m_builder in scope. There is no actual concept of a CU having an ancestor, it just marks the most recent CU from which a CU was inter-CU-referenced. Consequently, when following inter-CU references from a CU A to another CU B and back to CU A, the ancestors form a cycle, which causes dwarf2_cu::get_builder to hang or segfault, as reported in PR26327. ISTM that the ancestor implementation is confusing and fragile, and should go. Furthermore, it seems that keeping track of the m_builder in scope can be handled simply with a per-objfile variable. Fix the hang / segfault by: - keeping track of the m_builder in scope using a new variable per_obj->sym_cu, and - using it in dwarf2_cu::get_builder. Tested on x86_64-linux (openSUSE Leap 15.2), no regressions for config: - using default gcc version 7.5.0 (with 5 unexpected FAILs) - gcc 10.3.0 and target board unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects (with 1000 unexpected FAILs) gdb/ChangeLog: 2021-06-16 Tom de Vries <tdevries@suse.de> PR symtab/26327 * dwarf2/cu.h (dwarf2_cu::ancestor): Remove. (dwarf2_cu::get_builder): Declare and move ... * dwarf2/cu.c (dwarf2_cu::get_builder): ... here. Use sym_cu instead of ancestor. Assert return value is non-null. * dwarf2/read.c (read_file_scope): Set per_objfile->sym_cu. (follow_die_offset, follow_die_sig_1): Remove setting of ancestor. (dwarf2_per_objfile): Add sym_cu field.
2021-06-16gas: fix hex float parsing from .dcb.? directivesJan Beulich3-71/+75
Unlike for .dc.? the parsing here failed to skip the colon before calling hex_float(). To avoid both variants of parsing going out of sync again, introduce a helper used by both.
2021-06-16gas: fix overflow diagnosticsJan Beulich6-10/+72
While the logic in fixup_segment() so far was off by 1 for fixups dealing with quantities without known signedness, thus failing to report an overflow when e.g. a byte-sized resulting value is -0x100, the logic in emit_expr_with_reloc() reported an overflow even on large negative values when the respective positive ones would not be warned about, and when fixup_segment() wouldn't do so either. Such diagnostics all ought to follow a similar pattern of what value range is acceptable. (If expressions' X_unsigned was reliably set, emit_expr_with_reloc()'s checking might make sense to tighten based on that flag.) Note that with commit 80aab57939a0 ("Changes to let cons handle bignums like general expressions") having added handling of nbytes > sizeof(valueT) in the O_constant case, converting to O_big, the setting to zero of "hibit" had become dead. With "hibit" no longer used, this code now gets dropped altogether. But additionally a respective know() gets inserted.
2021-06-16sim: mips: add printf attribute to trace funcMike Frysinger3-2/+7
This helps catch format errors in code, although they're all clean at this point already.
2021-06-16sim: mips: rework dynamic printf logic to avoid compiler warningsMike Frysinger2-8/+38
The compiler doesn't like passing non-constant strings to printf functions, so tweak the code to always pass one in. This code is a little more verbose, but it's probably the same performance. The macro usage is a bit ugly, but maybe less than copying & pasting the extended conditional format logic.
2021-06-16sim: mips: tweak buffer signMike Frysinger2-1/+6
This model uses unsigned char buffers, but this temporary pointer is declared as signed. Switch it to unsigned since it's just a temporary variable to hold the new pointer.
2021-06-16sim: mips: fix uninitialized register useMike Frysinger2-1/+6
In the default case, this code will read from this variable before it is initialized as a dummy access. Set it to 0 to fix the compiler warning.
2021-06-16sim: drop obsolete AC_EXEEXT callMike Frysinger67-70/+133
The current autoconf 2.69 defines this to nothing because the logic in AC_PROG_CC takes care of it all the time now. Delete the call.
2021-06-16sim: ppc: use common sim-assert settingMike Frysinger4-38/+5
The common sim code already sets this up for us, so no need to duplicate the logic.
2021-06-16sim: ppc: convert to bfd_endianMike Frysinger11-59/+75
Rather than re-invent endian defines, as well as maintain our own list of OS & arch-specific includes, punt all that logic in favor of the bfd ones already set up and maintained elsewhere. We already rely on the bfd library, so leveraging the endian aspect should be fine. This was done for all the other ports years ago, so catch ppc up.
2021-06-16sim: ppc: replace local __attribute__ fallbackMike Frysinger3-15/+7
The common ansidecl.h provides fallbacks for these so we don't need to.
2021-06-16sim: ppc: use common ATTRIBUTE_PRINTF macrosMike Frysinger6-5/+23
Use the common ansidecl.h macros to replace our ad-hoc printf attributes.
2021-06-16sim: ppc: use common ATTRIBUTE_PACKED macroMike Frysinger3-6/+12
Drop local packed attribute with the common ansidecl.h define.
2021-06-16sim: ppc: replace local NORETURN macros with common oneMike Frysinger4-6/+12
Drop local NORETURN macro with the common ansidecl.h ATTRIBUTE_NORETURN define.
2021-06-16sim: ppc: replace local UNUSED macros with common oneMike Frysinger5-96/+97
Drop local UNUSED macro with the common ansidecl.h ATTRIBUTE_UNUSED define.
2021-06-16sim: ppc: replace local CONCAT macros with common onesMike Frysinger6-16/+12
Drop local copies of CONCAT macros that the common ansidecl.h provides.
2021-06-16sim: ppc: change bool variable name to booleanMike Frysinger2-1/+5
This is a reserved type with stdbool.h.
2021-06-16sim: ppc: drop host endian configure optionMike Frysinger12-928/+474
The --enable-sim-hostendian flag was purely so people had an escape route for when cross-compiling. This is because historically, AC_C_BIGENDIAN did not work in those cases. That was fixed a while ago though, so we can require that macro everywhere now and simplify a good bit of code. This was done for all the other ports years ago, so catch ppc up.
2021-06-16sim: mips: fix format warnings when setting up memoryMike Frysinger2-18/+22
The majority of these inputs are not long's, so don't use %lx. This fixes compiler warnings about type mismatches.
2021-06-16sim: drop arch-specific config.hMike Frysinger100-8706/+1478
All of the settings in here are handled by the common top-level config.h, so drop the individual arch-config.h files entirely. This will also help guarantee that we don't add any new arch specific defines that would affect common code which will help with the effort of unifying them.
2021-06-15sim: move dv-sockser define to CPPFLAGSMike Frysinger95-250/+161
This is the only define left in m4/ that is not in the common config.h, so move it to sim_hw_cflags so we can drop the arch-specific config.h.
2021-06-16Automatic date update in version.inGDB Administrator1-1/+1
2021-06-15sim: switch modules.c & version.c to stamp filesMike Frysinger5-7/+26
This fixes remaking of these files and avoids unnecessary rebuilds. Also add both to `make clean` to match other stamp files.
2021-06-15Fix typo in vsx-regs.exp testCarl Love1-1/+1
gdb/ChangeLog 2021-06-15 Carl Love <cel@us.ibm.com> * testsuite/gdb.arch/vsx-regs.exp (gdb_test_no_output): Fix typo in set \$vs$i.v2_double.
2021-06-15Allow readelf to recognise GO buildid notes.Nick Clifton4-0/+11
binutils * readelf.c (get_note_type): Add support for NT_GO_BUILDID. include * elf/common.h (NT_GO_BUILDID): Define.
2021-06-15x86: bring "gas --help" output for --32 etc in sync with realityJan Beulich3-4/+15
The testsuite uses the output to determine whether BFD64 is in effect. --x32 is supported for ELF only; don't advertise it for PE/COFF. --64 is also supported for Mach-O; advertise it. Adjust the testsuite's BFD64 check accordingly. Also replace "code" by "object", since it's the object format that the options primarily control. It's also _initial_ code bitness, but this can be changed by directives.
2021-06-15x86: simplify .dispNN settingJan Beulich2-51/+24
First of all eliminate the disp{16,32,32s} static variables, which are used solely for setting a temporary variable in build_modrm_byte(). The effect there can be had without use of such a temporary and without operand_type_or(), by just setting the single bit each that needs setting. Then use operand_type_and_not(..., anydisp) when all dispNN bits want clearing together.
2021-06-15x86: slightly simplify offset_in_range()Jan Beulich2-2/+7
Applying a mask with all bits set (or its inverse, with hence all bits clear) won't alter the result (or won't trigger the warning). Re-arrange the code to eliminate two more of the somewhat odd (2 << width_minus_1) constructs.
2021-06-15x86: harmonize disp with imm handlingJan Beulich5-23/+79
Certain disp values may trigger "... shortened to ..." warnings when equivalent imm ones don't. In some of the cases there are also differences (for non-64-bit code) between BFD64 and !BFD64 builds. The resulting encodings (i.e. use [or not] of the shorter disp8 / imm8 forms) are also different in some cases. Make this handling consistent. Note that using equivalent 16-bit mode displacements / immediates continues to expose entirely different behavior (see the disp-imm-16 testcase added by an earlier patch). This may want to be the subject of further changes, but it'll then quickly become obvious that e.g. keying use of extend_to_32bit_address() to non-64-bit mode isn't appropriate either: Once we allow wrapping operands, we would better do so consistently, in which case all of this would need to become dependent upon address or operand size instead of mode.
2021-06-15x86: make offset_in_range()'s warning contents useful (again)Jan Beulich2-6/+7
In case there is something which gets shortened (perhaps only on a BFD64 build targeting a 32-bit binary), seeing the full original value is often helpful to understand what's actually going wrong. Of course for non-64-bit binaries we better wouldn't be seeing such warnings at all, as they're often indicative of a behavioral difference between BFD64 and !BFD64 builds. Prior to "gas: drop sprint_value()", which introduced the use of bfd_sprintf_vma(), the output had other shortcomings.
2021-06-15x86: off-by-1 in offset_in_range()Jan Beulich7-1/+89
Just like e.g. 0x10000 triggers a warning for size 2, -0x10000 ought to as well. Note that some of the encodings produced aren't ones one would expect, and hence the generated code is not being checked for in the new testcases.
2021-06-15x86: permit parenthesized expressions again as addressing scale factorJan Beulich5-2/+26
The description of e68c3d59acd0 ("x86: better respect quotes in parse_operands()") wrongly states: "In i386_att_operand(), which needs adjustment to remain in sync, besides respecting double quotes now, also change the logic such that we don't count parentheses anymore: Finding any opening or closing parenthesis or any double quote means we're done, because the subsequent parsing code wouldn't accept (extra) instances of these anyway." I didn't pay attention to the possibility of the scale factor being specified as an expression, which may contain parentheses. Thanks to Martin for pointing this out. Restore prior behavior or matching parentheses (backwards), while giving the variable a more suitable name. Note that this simple and immediate fix is not ging to be enough: This expression could itself involve quoted symbols. However, to address this backwards parsing needs to be done away with altogether here (such that parentheses which are part of such a quoted symbol name can also properly be accounted for), which is going to be a more intrusive change.
2021-06-15readelf: report DF_1_PIE as "Position-Independent Executable"Alan Modra7-44/+155
I finally found time to teach readelf to identify PIEs in the file header display and program header display. So in place of "DYN (Shared object file)" which isn't completely true, show "DYN (Position-Independent Executable file)". It requires a little bit of untangling code in readelf due to process_program_headers setting up dynamic_addr and dynamic_size, needed to scan .dynamic for the DT_FLAGS_1 entry, and process_program_headers itself wanting to display the file type in some cases. At first I modified process_program_header using a "probe" parameter similar to get_section_headers in order to inhibit output, but decided it was cleaner to separate out locate_dynamic_sections. binutils/ * readelf.c (locate_dynamic_section, is_pie): New functions. (get_file_type): Replace e_type parameter with filedata. Call is_pie for ET_DYN. Update all callers. (process_program_headers): Use local variables dynamic_addr and dynamic_size, updating filedata on exit from function. Set dynamic_size of 1 to indicate no dynamic section or segment. Update tests of dynamic_size throughout. * testsuite/binutils-all/x86-64/pr27708.dump: Update expected output. ld/ * testsuite/ld-pie/vaddr-0.d: Update expected output. gdb/ * testsuite/lib/gdb.exp (exec_is_pie): Match new PIE readelf output.
2021-06-14sim: mn10300: enable -WerrorMike Frysinger3-106/+113
Now that all warnings are fixed in this port, enable -Werror by default.
2021-06-14sim: mn10300: switch abort to sim_engine_abortMike Frysinger2-1/+5
This allows the caller to catch engine aborts if they want, and fixes the warning about missing stdlib.h include by not using abort().
2021-06-14sim: erc32: fix build w/out F_{G,S}ETFLMike Frysinger3-2/+13
Add conditional logic around fcntl.h F_{G,S}ETFL usage to fix builds on systems that don't have it (e.g. Windows). The code is only used to save & restore limited terminal stdin state.
2021-06-14sim: erc32: fix build w/out termios.hMike Frysinger2-0/+20
Add conditional logic around termios.h usage to fix builds on systems that don't have it (e.g. Windows).
2021-06-14sim: drop redundant SIM_AC_OPTION_WARNINGSMike Frysinger27-214/+250
The common code already calls this, so no need to do so in arch dirs. We leave the calls that disable -Werror. This will help unify the configure scripts.
2021-06-14sim: enable silent rules in common buildsMike Frysinger8-30/+84
We only do the common code as automake simplifies the logic.
2021-06-15Automatic date update in version.inGDB Administrator1-1/+1
2021-06-14gnulib: define the path to gnulib's parent dirMike Frysinger8-12/+35
The current setting assumes that gnulib is only used by dirs immediately under the source root. Trying to build it two or more levels deep fails. Switch GNULIB_BUILDDIR to a relative GNULIB_PARENT_DIR so that it can be used to construct both the build & source paths.
2021-06-14fbsd nat: Disable address space randomization when requested.John Baldwin6-2/+96
Use procctl(2) with PROC_ASLR_CTL to disable address space randomization in the current gdb process before forking a child process for a new inferior when address space randomization is disabled. gdb/ChangeLog: * configure.ac: Check for <sys/procctl.h>. * config.in, configure: Regenerate. * fbsd-nat.c: Include <sys/procctl.h> if present. [PROC_ASLR_CTL] (maybe_disable_address_space_randomization): New. (fbsd_nat_target::create_inferior) (fbsd_nat_target::supports_disable_randomization): New. * fbsd-nat.h (fbsd_nat_target::create_inferior) (fbsd_nat_target::supports_disable_randomization): New.
2021-06-14Fix silent gdb.base/annota1.exp test coverage regressionPedro Alves2-3/+12
This commit fixes a test coverage regression caused by: commit b001de2320446ec803b4ee5e0b9710b025b84469 Author: Andrew Burgess <andrew.burgess@embecosm.com> AuthorDate: Mon Nov 26 17:56:39 2018 +0000 Commit: Andrew Burgess <andrew.burgess@embecosm.com> CommitDate: Wed Dec 12 17:33:52 2018 +0000 gdb: Update test pattern to deal with native-extended-gdbserver While looking at a regression caused by a local patch I was working on, I noticed this: pre-prompt (gdb) prompt PASS: gdb.base/annota1.exp: breakpoint info PASS: gdb.base/annota1.exp: run until main breakpoint run post-prompt Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/outputs/gdb.base/annota1/annota1 next Note how above, we get the "run until main breakpoint" pass even before "run" shows up in the log! The issue is that the test isn't really testing anything, it always passes regardless of the gdb output. There are a few problems here, fixed by this commit: - using {} to build the list for [join], when the strings we're joining include variable names that must be expanded. Such list need to be built with [list] instead. - [join] joins strings with a space character by default. We need to pass the empty string as second parameter so that it just concats the strings. - doing too much in a "-re" (calling procedures), which doesn't work correctly. I've seen this before and never digged deeper into why. Probably something to do with how gdb_test_multiple is implemented. Regardless, easy and clear enough to build the pattern first into a variable. gdb/testsuite/ChangeLog: yyyy-mm-dd Pedro Alves <pedro@palves.net> * gdb.base/annota1.exp: Build list using [list] instead of {}. Tell [join] to join with no character. Build expected pattern in separate variable instead of in the -re expression directly. Change-Id: Ib3c89290f0e9ae4a0a43422853fcd4a7a7e12b18
2021-06-14Include missing header signal.hBernd Edlinger2-0/+5
2021-06-14 Bernd Edlinger <bernd.edlinger@hotmail.de> * compile/compile.c: Include missing header signal.h.
2021-06-14Use consistent type in binutils/dwarf.cEric Botcazou2-10/+17
If you look at the type used for implicit_const objects in binutils/dwarf.c, you'll get sometimes bfd_signed_vma and sometimes dwarf_signed_vma. They are the same on 64-bit hosts, but not on 32-bit hosts, and the latter discrepancy, in particular in process_abbrev_set, is responsible for the following error issued by objdump on some object files containing DWARF 5: binutils/dwarf.c:1108: read LEB value is too large to store in destination variable binutis/ * dwarf.c (struct abbrev_attr): Change type of implicit_const. (add_abbrev_attr): Likewise. (process_abbrev_set): Likewise. (display_debug_abbrev): Adjust to above change.
2021-06-14GNU gettext introduced this change[0] in version 0.19.8 to fix gettext ↵Michael Forney4-20/+67
detection with musl libc, since it does not define these internal symbols. This allows binutils to build with musl gettext rather than falling back to the bundled version. [0] https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commit;h=b67399b4 2021-06-13 Michael Forney <mforney@mforney.org> config/ChangeLog: * gettext.m4 (AM_GNU_GETTEXT): Skip checks for the internal symbols _nl_msg_cat_cntr, _nl_domain_bindings, and _nl_expand_alias, if __GNU_GETTEXT_SUPPORTED_REVISION is defined. Backport of gettext serial 68 patch. intl/ChangeLog: * configure: Regenerate. --- Thi
2021-06-14gas: fold three as_warn() in emit_expr_with_reloc()Jan Beulich2-12/+6
Simply use the available abstraction instead of, effectively, trying to open-code it.
2021-06-14gas: drop TC_ADDRESS_BYTES conditionalsJan Beulich3-5/+8
I've been repeatedly confused by, in particular, the .dc.a potable[] entry being conditional. Grepping in gas/config/ reveals only very few targets actually #define-ing it. But as of 7be1c4891a20 the symbol is always defined, so #ifdef-s are pointless (and, as said, potentially confusing). Also adjust documentation to reflect this.