aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-04-26Fix gdb.arch/aarch64-dbreg-contents.exp FAILLuis Machado2-1/+6
The test checks for a particular ARCH level, but it needs to check for ARCH levels from a minimum and upwards. gdb/testsuite/ChangeLog: 2021-04-26 Luis Machado <luis.machado@linaro.org> * gdb.arch/aarch64-dbreg-contents.c (set_watchpoint): Fix arch level comparison.
2021-04-26x86: correct overflow checking for 16-bit PC-relative relocsJan Beulich9-2/+40
The only insn requiring a truly 16-bit PC-relative relocation outside of 16-bit mode is XBEGIN (with an operand size override). For it, the relocation generated should behave similar to 8- and (for 64-bit) 32-bit PC-relatives ones, i.e. be checked for a signed value to fit the field. This same mode is also correct for 16-bit code. Outside of 16-bit code, branches with operand size overrides act in a truly PC-relative way only when living in the low 32k of address space, as they truncate rIP to 16 bits. This can't be expressed by a PC-relative relocation. Putting in place a new testcase, I'd like to note that the two existing ones (pcrel16 and pcrel16abs) appear to be pretty pointless: They don't expect any error despite supposedly checking for overflow, and in fact there can't possibly be any error for the - former since gas doesn't emit any relocation in the first place there, - latter because the way the relocation gets expressed by gas doesn't allow the linker to notice the overflow; it should be detected by gas if at all, but see above (an error would be reported here for x86-64 afaict, but this test doesn't get re-used there).
2021-04-26x86: add IS_ELF to check whether to resolve @size relocJan Beulich2-1/+7
This may not be strictly needed, as BFD_RELOC_SIZE* shouldn't appear from elsewhere for non-ELF, but let's be on the safe side.
2021-04-26x86: limit 32-bit @size overflow checks to 64-bit objectsJan Beulich2-0/+6
For 32-bit objects the behavior should not be dependent upon the build being a BFD64 one.
2021-04-26x86: optimize LEAJan Beulich16-10/+576
Over the years I've seen a number of instances where people used lea (%reg1), %reg2 or lea symbol, %reg despite the same thing being expressable via MOV. Since additionally LEA often has restrictions towards the ports it can be issued to, while MOV typically gets dealt with simply by register renaming, transform to MOV when possible (without growing opcode size and without altering involved relocation types). Note that for Mach-O the new 64-bit testcases would fail (for BFD_RELOC_X86_64_32S not having a representation), and hence get skipped there.
2021-04-26x86-64: have value properly checked when resolving fixupJan Beulich5-1/+65
Constants not known at the time an individual insn gets assembled and going into a sign-extended field still shouldn't be silently truncated at the time the respective fixup gets resolved.
2021-04-26gdb: fix sparc build failure of linux-natSergei Trofimovich2-2/+7
On sparc build failed as: ``` gdb/sparc-linux-nat.c: In member function 'virtual void sparc_linux_nat_target::fetch_registers(regcache*, int)': gdb/sparc-linux-nat.c:36:37: error: cannot convert 'regcache*' to 'process_stratum_target*' 36 | { sparc_fetch_inferior_registers (regcache, regnum); } | ^~~~~~~~ | | | regcache* ``` The fix adopts gdb/sparc-nat.h API change in d1e93af64a6 ("gdb: set current thread in sparc_{fetch,collect}_inferior_registers"). gdb/ChangeLog: * sparc-linux-nat.c (sparc_linux_nat_target): fix sparc build by passing `process_stratum_target*` parameter.
2021-04-26Automatic date update in version.inGDB Administrator1-1/+1
2021-04-25[PR gdb/22640] ptype: add option to use hexadecimal notationLancelot SIX12-295/+559
This commit adds a flag to the ptype command in order to print the offsets and sizes of struct members using the hexadecimal notation. The 'x' flag ensures use of the hexadecimal notation while the 'd' flag ensures use of the decimal notation. The default is to use decimal notation. Before this patch, gdb only uses decimal notation, as pointed out in PR gdb/22640. Here is an example of this new behavior with hex output turned on: (gdb) ptype /ox struct type_print_options /* offset | size */ type = struct type_print_options { /* 0x0000: 0x0 | 0x0004 */ unsigned int raw : 1; /* 0x0000: 0x1 | 0x0004 */ unsigned int print_methods : 1; /* 0x0000: 0x2 | 0x0004 */ unsigned int print_typedefs : 1; /* 0x0000: 0x3 | 0x0004 */ unsigned int print_offsets : 1; /* 0x0000: 0x4 | 0x0004 */ unsigned int print_in_hex : 1; /* XXX 3-bit hole */ /* XXX 3-byte hole */ /* 0x0004 | 0x0004 */ int print_nested_type_limit; /* 0x0008 | 0x0008 */ typedef_hash_table *local_typedefs; /* 0x0010 | 0x0008 */ typedef_hash_table *global_typedefs; /* 0x0018 | 0x0008 */ ext_lang_type_printers *global_printers; /* total size (bytes): 32 */ } This patch also adds the 'set print type hex' and 'show print type hex' commands in order to set and inspect the default behavior regarding the use of decimal or hexadecimal notation when printing struct sizes and offsets. Tested using on x86_64. gdb/ChangeLog: PR gdb/22640 * typeprint.h (struct type_print_options): Add print_in_hex flag. (struct print_offset_data): Add print_in_hex flag, add a constructor accepting a type_print_options* argument. * typeprint.c (type_print_raw_options, default_ptype_flags): Set default value for print_in_hex. (print_offset_data::indentation): Allow more horizontal space. (print_offset_data::print_offset_data): Add ctor. (print_offset_data::maybe_print_hole, print_offset_data::update): Handle the print_in_hex flag. (whatis_exp): Handle 'x' and 'd' flags. (print_offsets_and_sizes_in_hex): Declare. (set_print_offsets_and_sizes_in_hex): Create. (show_print_offsets_and_sizes_in_hex): Create. (_initialize_typeprint): Update help message for the ptype command, register the 'set print type hex' and 'show print type hex' commands. * c-typeprint.c (c_print_type, c_type_print_base_struct_union) (c_type_print_base): Construct the print_offset_data object using the type_print_optons parameter. * rust-lang.c (rust_language::print_type): Construct the print_offset_data object using the type_print_optons parameter. * NEWS: Mention the new flags of the ptype command. gdb/doc/ChangeLog: PR gdb/22640 * gdb.texinfo (Symbols): Describe the 'x' and 'd' flags of the ptype command, describe 'set print type hex' and 'show print type hex' commands. Update 'ptype/o' examples. gdb/testsuite/ChangeLog: PR gdb/22640 * gdb.base/ptype-offsets.exp: Add tests to verify the behavior of 'ptype/ox' and 'ptype/od'. Check that 'set print type hex' changes the default behavior of 'ptype/o'. Update to take into account new horizontal layout. * gdb.rust/simple.exp: Update ptype test to check new horizontal layout. * gdb.rust/union.exp: Same.
2021-04-25gdb/typeprint.h: reorder struct declarationLancelot SIX2-30/+35
Move the declaration of struct type_print_raw_options before struct print_offset_data to ease upcoming changes. This is a helper commit intended to make it easier to build a print_offset_data object from configurations given by a type_print_raw_options. gdb/ChangeLog: * typeprint.h (struct type_print_options): Move before print_offset_data.
2021-04-25Add engv32.h to SIM_EXTRA_DEPS in sim/crisTom Tromey2-1/+5
A rebuild showed that an earlier change of mine missed a built header file -- cris/engv32.h. This patch fixes the problem. sim/cris/ChangeLog 2021-04-25 Tom Tromey <tom@tromey.com> * Makefile.in (SIM_EXTRA_DEPS): Add engv32.h.
2021-04-25Use htab_t in sim-options.cTom Tromey2-21/+25
This changes sim-options.c to use the libiberty hash table, rather than its own custom hash table. sim/common/ChangeLog 2021-04-25 Tom Tromey <tom@tromey.com> * sim-options.c (compare_strings): New function. (ARG_HASH_SIZE, ARG_HASH): Remove. (dup_arg_p): Use htab_t. (sim_parse_args): Remove assert.
2021-04-25Document the GDB 10.2 release in gdb/ChangeLogJoel Brobecker1-0/+4
gdb/ChangeLog: GDB 10.2 released.
2021-04-25Automatic date update in version.inGDB Administrator1-1/+1
2021-04-24gdbsupport: add observer_debug_printf, OBSERVER_SCOPED_DEBUG_ENTER_EXITSimon Marchi2-4/+32
Switch observer to use the "new" debug printf mechanism and sprinkle a few debug prints. Here's a small example of the output with "infrun" and "observer" debug output enabled: [infrun] proceed: enter [observer] notify: start: observable target_resumed notify() called [observer] notify: start: calling observer mi-interp of observable target_resumed [observer] notify: end: calling observer mi-interp of observable target_resumed [observer] notify: start: calling observer py-inferior of observable target_resumed [observer] notify: end: calling observer py-inferior of observable target_resumed [observer] notify: end: observable target_resumed notify() called ... gdbsupport/ChangeLog: * observable.h (observer_debug_printf, OBSERVER_SCOPED_DEBUG_START_END): New. (class observable) <notify, attach>: Use them. Change-Id: If3ae4b6b65450ca3b7cae56698a87fc526688b86
2021-04-24gdbsupport: allow passing format string to scoped_debug_start_endSimon Marchi2-12/+68
A little thing that bothers me with scoped_debug_start_end is that it's not possible to pass a format string to add context to the messages: the start and end messages are fixed. It was done like this at the time because there's the risk that debug output is not enabled on entry (when the constructor runs) but is enabled on exit (when the destructor runs). For example, a user debugging from a top-gdb may manually enable a debug_foo variable. If debug output is disabled while the constructor runs, we won't render the format string (to minimize overhead) so it won't be available in the destructor. I think it would be nice to be able to use a format string along with scoped_debug_start_end, and I think it's unfortunate that such a narrow use case prevents it. So with this patch, I propose that we allow passing a format string to scoped_debug_start_end, and if the rare situation described above happens, then we just show a "sorry, message not available" kind of message. The following patch makes use of this. gdbsupport/ChangeLog: * common-debug.h (struct scoped_debug_start_end) <scoped_debug_start_end>: Change start_msg/end_msg for start_prefix/end_prefix. Add format string parameter and make variadic. <~scoped_debug_start_end>: Adjust. <m_end_msg>: Rename to... <m_end_prefix>: ... this. <m_with_format>: New. <m_msg>: New. (scoped_debug_start_end): Make variadic. (scoped_debug_enter_exit): Adjust. Change-Id: I9427ce8877a246a46694b3a1fec3837dc6954d6e
2021-04-24gdbsupport, gdb: give names to observersSimon Marchi47-149/+219
Give a name to each observer, this will help produce more meaningful debug message. gdbsupport/ChangeLog: * observable.h (class observable) <struct observer> <observer>: Add name parameter. <name>: New field. <attach>: Add name parameter, update all callers. Change-Id: Ie0cc4664925215b8d2b09e026011b7803549fba0
2021-04-24gdbsupport: introduce struct observerSimon Marchi2-6/+22
Instead of using a pair. This allows keeping more data per observer in a structured way, and using field names is clearer than first/second. gdbsupport/ChangeLog: * observable.h (class observable) <struct observer>: New. <detach, notify>: Update. <m_observers>: Change type to vector of observers. Change-Id: Iadf7d1fa25049cfb089e6b1b429ddebc548825ab
2021-04-24sim: dv-cfi: fix printf formatMike Frysinger2-1/+5
Use the existing PRI constants to select the right format rather than assume signed_cell is always %u. Fixes building for riscv64.
2021-04-24sim: options: increase max option countMike Frysinger2-1/+9
As we turn on more modules by default for all ports, the number of options has been increasing. The sim-options module has a limit on the number of options it can support, and if it's exceeded, it likes to go into an infinite loop. Increase the ceiling and add an assert so we abort right away instead of hanging. This will be needed to turn on hw support for v850 as it will then exceed the current limit.
2021-04-23sim: simplify hardware m4 macroMike Frysinger30-89/+78
Every port using this sets the 1st arg to yes and the 2nd arg to "". These are the defaults we probably want anyways in order to unify the codebase, so move them to the macro and only allow ports to declare extra hardware models.
2021-04-24Automatic date update in version.inGDB Administrator1-1/+1
2021-04-23gdbsupport, gdb: change observer_debug to boolSimon Marchi4-7/+15
gdb/ChangeLog: * observable.c (observer_debug): Change to bool. gdbsupport/ChangeLog: * observable.h (observer_debug): Change to bool. Change-Id: I58634235a20740a66eacb1c83bae3cf3304ae1fd
2021-04-23ld: Properly create a symbolic link to tmpdir/ldscriptsH.J. Lu2-1/+9
Don't create a symbolic link to tmpdir/ldscripts if it exists. PR ld/27771 * testsuite/ld-bootstrap/bootstrap.exp: Create a symbolic link to tmpdir/ldscripts only if it doesn't exist.
2021-04-23gdbsupport: include preprocessor.h in common-debug.hSimon Marchi2-0/+6
While doing some changes, some code failed to compile because it used the scoped_debug_start_end macro, but couldn't find the CONCAT macro. Fix that by making common-debug.h include preprocessor.h, the header file that provides CONCAT. gdbsupport/ChangeLog: * common-debug.h: Include preprocessor.h. Change-Id: Ibf863a932a18cba9a57b4bd72df538ef52d39127
2021-04-23Fix type of .persistent.bss sectionEric Botcazou6-2/+22
The change implementing the .persistent family of sections broke the existing support for the .persistent.bss section in the compiler: int a __attribute__ ((section (".persistent.bss"))); t.s: Assembler messages: t.s:4: Warning: setting incorrect section type for .persistent.bss The compiler encodes it as @nobits but the assembler expects @progbits. The assembler is incorrect and should treat the section like the compiler. bfd/ * elf.c (special_sections_p): Add .persistent.bss. gas/ * testsuite/gas/elf/section25.d: Run it everywhere. * testsuite/gas/elf/section26.d: Likewise. * testsuite/gas/elf/section26.s: Add test for .persistent.bss.
2021-04-23Allow .seh_pushframe to take an optional [code] parameterJ?r?me Gardou2-1/+25
* config/obj-coff-seh.c (obj_coff_seh_pushframe): Allow an optional "code" argument.
2021-04-23opcodes: xtensa: display loaded literal valueMax Filippov2-1/+24
Display literal value loaded with l32r opcode as a part of disassembly. This significantly simplifies reading of disassembly output. 2020-04-23 Max Filippov <jcmvbkbc@gmail.com> opcodes/ * xtensa-dis.c (print_xtensa_operand): For PC-relative operand of l32r fetch and display referenced literal value.
2021-04-23opcodes: xtensa: improve literal outputMax Filippov2-0/+6
Output literals as 4-byte words, not as separate bytes. 2021-04-23 Max Filippov <jcmvbkbc@gmail.com> opcodes/ * xtensa-dis.c (print_insn_xtensa): Set info->bytes_per_chunk to 4 for literal disassembly.
2021-04-23gdb: remove some caching from the dwarf readerAndrew Burgess5-52/+53
While working on some changes to 'info sources' I ran into a situation where I was seeing the same source files reported twice in the output of the 'info sources' command when using either .gdb_index or the .debug_name index. I traced the problem back to some caching in dwarf2_base_index_functions::map_symbol_filenames; when called GDB caches the set of filenames, but, filesnames are not removed as the index entries are expanded into full symtabs. As a result we can end up seeing filenames reported both from a full symtab _and_ from a (stale) previously cached index entry. Now, obviously, when seeing a problem like this the "correct" fix is to remove the stale entries from the cache, however, I ran a few experiments to see why this wasn't really hitting us anywhere, and, as far as I can tell, ::map_symbol_filenames is only called from three places: 1. The mi command -file-list-exec-source-files, 2. The 'info sources' command, and 3. Filename completion However, the result of this "bug" is that we will see duplicate filenames, and readline's completion mechanism already removes duplicates, so for case #3 we will never see any problems. Cases #1 and #2 are basically the same, and in each case, to see a problem we need to ensure we craft the test in a particular way, start up ensuring we have some unexpected symtabs, then run one of the commands to populate the cache, then expand one of the symtabs, and list the sources again. At this point you'll see duplicate entries in the results. Hardly surprising we haven't randomly hit this situation in testing. So, considering that use cases #1 and #2 are certainly not "high performance" code (i.e. I don't think these justify the need for caching) this leaves use case #3. Does this use justify the need for caching? Well the psymbol_functions::map_symbol_filenames function doesn't seem to do any extra caching, and within dwarf2_base_index_functions::map_symbol_filenames, the only expensive bit appears to be the call to dw2_get_file_names, and this already does its own caching via this_cu->v.quick->file_names. The upshot of all this analysis was that I'm not convinced the need for the additional caching is justified, and so, I propose that to fix the bug in GDB, I just remove the extra caching (for now). If we later find that the caching _was_ useful, then we can reintroduce it, but add it back such that it doesn't reintroduce this bug. As I was changing dwarf2_base_index_functions::map_symbol_filenames I replaced the use of htab_up with std::unordered_set. Tested using target_boards cc-with-debug-names and dwarf4-gdb-index. gdb/ChangeLog: * dwarf2/read.c: Add 'unordered_set' include. (dwarf2_base_index_functions::map_symbol_filenames): Replace 'visited' hash table with 'qfn_cache' unordered_set. Remove use of per_Bfd->filenames_cache cache, and use function local filenames_cache instead. Reindent. * dwarf2/read.h (struct dwarf2_per_bfd) <filenames_cache>: Delete. gdb/testsuite/ChangeLog: * gdb.base/info_sources.exp: Add new tests.
2021-04-23x86: TLS desc call relocs target zero-size fieldsJan Beulich3-2/+9
These are marker relocations, so together with their bit size being zero their byte size should be zero as well. This is expressed by a value of 3, not 0.
2021-04-23x86-64: special case LEA when determining signedness of displacementJan Beulich2-8/+24
LEA behavior without a 64-bit destination is independent of address size - in particular LEA with 32-bit addressing and 64-bit destination is the same as LEA with 64-bit addressing and 32-bit destination. IOW checking merely i.prefix[ADDR_PREFIX] is insufficient. This also means wrong relocation types (R_X86_64_32S when R_X86_64_32 is needed) were used so far in such cases. Note that in one case in build_modrm_byte() the 64-bit check came too early altogether, and hence gets dropped in favor of the one included in the new helper. This is benign to non-64-bit code from all I can tell, but the failure to clear disp16 could have been a latent problem.
2021-04-23x86-64: defer 32-bit signed displacement checkJan Beulich2-19/+34
In preparation for extending the conditions here defer this check until operands have been parsed, as certain further attributes will need to be known for determinig applicability of this check to be correct to LEA.
2021-04-23x86: re-order optimize_disp()Jan Beulich2-16/+23
While I can't point out any specific case where things break, it looks wrong to have the consumer of a flag before its producer. Set .disp32 first, then do the possible conversion to signed 32-bit, and finally check whether the value fits in a signed long.
2021-04-23x86: don't truncate values in diagnostics and alikeJan Beulich2-4/+9
Truncating an expression's X_add_number to just "long" can result in confusing output (e.g. an apparently in-range number claimed to be out of range). Use the abstraction that bfd provides for this. Take the opportunity and also insert a missing "of".
2021-04-22gdb: use function_view for iterate_over_bp_locations' callbackSimon Marchi4-6/+13
Use a function_view instead of function pointer + data. Actually, nothing uses the data anyway, but that makes iterate_over_bp_locations more like iterate_over_breakpoints. gdb/ChangeLog: * breakpoint.c (iterate_over_bp_locations): Change callback to function view, remove data parameter. * breakpoint.h (iterate_over_bp_locations): Likewise. * record-full.c (record_full_sync_record_breakpoints): Remove data parameter. Change-Id: I66cdc94a505f67bc640bcc66865fb535ee939a57
2021-04-22Do not check for sys/time.h or sys/times.hTom Tromey104-455/+206
This updates the sim so that it unconditionally uses sys/time.h. This is in agreement with existing code, and a recent change to BFD. I also think that sys/times.h is never needed by the sim, so this patch removes the check and the one spot that was conditionally including it. sim/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * m4/sim_ac_common.m4 (SIM_AC_COMMON): Don't check for sys/time.h or sys/times.h. sim/aarch64/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/arm/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/avr/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/bfin/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/bpf/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/common/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * sim-utils.c: Update includes. sim/cr16/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * simops.c: Update includes. * configure, config.in: Rebuild. sim/cris/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * rvdummy.c: Update includes. * dv-rv.c: Update includes. * configure, config.in: Rebuild. sim/d10v/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/erc32/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/example-synacor/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/frv/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/ft32/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/h8300/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/iq2000/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/lm32/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/m32c/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/m32r/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/m68hc11/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/mcore/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/microblaze/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/mips/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/mn10300/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/moxie/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/msp430/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/or1k/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/ppc/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * mon.c: Update includes. * emul_unix.c: Update includes. (do_unix_gettimeofday): Update condition. sim/pru/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/riscv/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/rl78/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/rx/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. sim/sh/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * interp.c: Update includes. * configure, config.in: Rebuild. sim/v850/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild.
2021-04-22Remove LIBS from two sim MakefilesTom Tromey4-4/+8
A couple of sim Makefiles define LIBS, but don't use it. This removes these. sim/m32c/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (LIBS): Remove sim/rx/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (LIBS): Remove.
2021-04-22Remove INCLUDE variable from some sim MakefilesTom Tromey8-9/+16
Some Makefiles in sim define INCLUDE but don't use it. This removes these instances. sim/bfin/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (INCLUDE): Remove. sim/m68hc11/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (INCLUDE): Remove. sim/mn10300/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (INCLUDE): Remove. sim/v850/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (INCLUDE): Remove.
2021-04-22Remove and modernize dependencies in simTom Tromey33-193/+139
Some spots in the sim build used manual dependencies, and some spots did a compilation by hand but did not use the automatic dependency tracking code. This patch fixes these spots. I didn't touch ppc, because it doesn't use the common Makefile code. I also didn't touch objects that are for the build machine, because automatic dependencies don't work for those. sim/arm/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (armemu26.o, armemu32.o): Use COMPILE and POSTCOMPILE. sim/bpf/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (arch.o, cpu.o, sim-if.o, traps.o): Remove. (mloop-le.o, mloop-be.o, decode-le.o, decode-be.o, sim-le.o) (sim-be.o): Use COMPILE and POSTCOMPILE. (SIM_EXTRA_DEPS): Add eng-le.h, eng-be.h. sim/cr16/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (SIM_EXTRA_DEPS): New variable. (simops.o): Remove. sim/cris/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (sim-if.o, dv-cris.o, dv-rv.o, arch.o, traps.o) (devices.o, crisv10f.o, mloopv10f.o, cpuv10.o, decodev10.o) (modelv10.o, crisv32f.o, mloopv32f.o, cpuv32.o, decodev32.o) (modelv32.o): Remove. (SIM_EXTRA_DEPS): Add engv10.h. sim/d10v/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (SIM_EXTRA_DEPS): New variable. (simops.o): Remove. sim/frv/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (arch.o, devices.o, frv.o, traps.o, pipeline.o) (interrupts.o, memory.o, cache.o, options.o, reset.o) (registers.o, profile.o, profile-fr400.o, profile-fr450.o) (profile-fr500.o, profile-fr550.o, sim-if.o, mloop.o, cpu.o) (decode.o, sem.o, model.o): Remove. (SIM_EXTRA_DEPS): Add eng.h. sim/iq2000/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (sim-if.o): Remove. (arch.o): Use COMPILE and POSTCOMPILE. (devices.o, iq2000.o, mloop.o, cpu.o, decode.o, sem.o, model.o): Remove. (SIM_EXTRA_DEPS): Add eng.h. sim/lm32/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (arch.o, traps.o, sim-if.o, lm32.o, mloop.o) (cpu.o, decode.o, sem.o, model.o): Remove. (SIM_EXTRA_DEPS): Add eng.h. sim/m32r/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (sim-if.o, arch.o, traps.o, traps-linux.o) (devices.o, m32r.o, mloop.o, cpu.o, decode.o, sem.o, model.o) (m32rx.o, mloopx.o, cpux.o, decodex.o, semx.o, modelx.o) (m32r2.o, mloop2.o, cpu2.o, decode2.o, sem2.o, model2.o): Remove. (SIM_EXTRA_DEPS): Add eng.h, engx.h, eng2.h. sim/m68hc11/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (interp.o): Remove. sim/mips/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (interp.o, m16run.o, micromipsrun.o, multi-run.o): Remove. (SIM_EXTRA_DEPS): New variable. sim/mn10300/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (interp.o): Remove. (idecode.o op_utils.o semantics.o): Remove. sim/or1k/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (mloop.o, arch.o, cpu.o, decode.o, sem.o) (sem-switch.o, model.o): Remove. sim/rl78/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (err.o, fpu.o, gdb-if.o, load.o, main.o, mem.o) (reg.o, rl78.o): Remove. sim/rx/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (err.o, fpu.o, gdb-if.o, load.o, main.o, mem.o) (misc.o, reg.o, rx.o, syscalls.o, trace.o): Remove. sim/sh/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (SIM_EXTRA_DEPS): New variable. (interp.o): Remove. sim/v850/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (interp.o, simops.o, semantics.o): Remove.
2021-04-22Require GNU makeTom Tromey65-2102/+205
GDB has required GNU make for quite some time, and this patch applies this approach to the sim as well. Requiring GNU make means that automatic dependency tracking can be simple and reliable, and it also makes other refactorings simpler. sim/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * m4/sim_ac_common.m4 (SIM_AC_COMMON): Don't check for make. sim/aarch64/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/arm/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/avr/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/bfin/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/common/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Make-common.in: Require GNU make. sim/cr16/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/cris/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/d10v/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/erc32/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/example-synacor/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/frv/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/ft32/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/h8300/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/iq2000/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/lm32/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/m32c/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/m32r/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/m68hc11/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/mcore/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/microblaze/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/mips/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/mn10300/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/moxie/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/msp430/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/or1k/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/pru/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/riscv/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/rl78/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/rx/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/sh/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild. sim/v850/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * configure: Rebuild.
2021-04-22Add stamp files for generated files in sim/ppcTom Tromey2-2/+13
This changes the sim/ppc Makefile to use the stamp file idiom for a couple of generated files, avoiding extra rebuilds. sim/ppc/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Makefile.in (stamp-vals, stamp-map): New targets. (targ-vals.h, targ-map.c): Update. (clean): Remove files.
2021-04-22Introduce stamp file for hw-config.hTom Tromey2-2/+11
This adds a stamp file for hw-config.h, to avoid unnecessary rebuilds. It also arranges to remove hw-config.h in "mostlyclean", because the file is created by "make". sim/common/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Make-common.in (stamp-hw): New target. (hw-config.h): Depend on stamp-hw. (mostlyclean): Remove stamp-hw and hw-config.h.
2021-04-22Make mostlyclean an alias for cleanTom Tromey2-2/+7
I found out by accident that "mostlyclean" in a sim subdir removes all the configure artifacts. The usual rule is: * If the maintainer built it, maintainer-clean should remove it; * If configure built it, distclean should remove it; * If make built it, "clean" should remove it; * If there is a handy subset of "clean" that is "easy" to rebuild, "mostlyclean" should remove it; otherwise mostlyclean should be an alias for clean This patch makes mostlyclean an alias for clean. sim/common/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * Make-common.in (mostlyclean): Now an alias for clean, not distclean.
2021-04-22Fix sim build failureTom Tromey2-4/+6
On x86-64 Fedora 32, the sim was failing to build. sim_events_schedule was passing a 'dummy' argument to sim_events_schedule_vtracef, which caused an error because the format parameter was NULL. However, removing this dummy argument caused an error because too few arguments were being passed -- catch 22. This patch fixes the build problem by using sim_events_schedule_tracef instead. sim/common/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * sim-events.c (sim_events_schedule): Use sim_events_schedule_tracef.
2021-04-22Fix ptype/o bug with "<no data fields>"Tom Tromey5-5/+37
I noticed that when using ptype/o, the "<no data fields>" text that may be emitted is indented incorrectly. This patch fixes the bug and adds a new test case. I also removed a stray backslash from ptype-offsets.exp that I noticed while writing the test. This seemed too trivial to warrant a separate patch. gdb/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * c-typeprint.c (c_type_print_base_struct_union): Use print_spaces_filtered_with_print_options. gdb/testsuite/ChangeLog 2021-04-22 Tom Tromey <tom@tromey.com> * gdb.base/ptype-offsets.cc (struct empty_member): New. (main): Use empty_member. * gdb.base/ptype-offsets.exp: Add new test.
2021-04-23Automatic date update in version.inGDB Administrator1-1/+1
2021-04-22gdb/testsuite: add Python support check in gdb.python/flexible-array-member.expSimon Marchi2-0/+8
We don't want to execute this test if Python support is not compiled in GDB, add the necessary check. gdb/testsuite/ChangeLog: * gdb.python/flexible-array-member.exp: Add check for Python support. Change-Id: I853b937d2a193a0bb216566bef1a35354264b1c5
2021-04-22gdb: fix getting range of flexible array member in PythonSimon Marchi8-4/+210
As reported in bug 27757, we get an internal error when doing: $ cat test.c struct foo { int len; int items[]; }; struct foo *p; int main() { return 0; } $ gcc test.c -g -O0 -o test $ ./gdb -q -nx --data-directory=data-directory ./test -ex 'python gdb.parse_and_eval("p").type.target()["items"].type.range()' Reading symbols from ./test... /home/simark/src/binutils-gdb/gdb/gdbtypes.h:435: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) This is because the Python code (typy_range) blindly reads the high bound of the type of `items` as a constant value. Since it is a flexible array member, it has no high bound, the property is undefined. Since commit 8c2e4e0689 ("gdb: add accessors to struct dynamic_prop"), the getters check that you are not getting a property value of the wrong kind, so this causes a failed assertion. Fix it by checking if the property is indeed a constant value before accessing it as such. Otherwise, use 0. This restores the previous GDB behavior: because the structure was zero-initialized, this is what was returned before. But now this behavior is explicit and not accidental. Add a test, gdb.python/flexible-array-member.exp, that is derived from gdb.base/flexible-array-member.exp. It tests the same things, but through the Python API. It also specifically tests getting the range from the various kinds of flexible array member types (AFAIK it wasn't possible to do the equivalent through the CLI). gdb/ChangeLog: PR gdb/27757 * python/py-type.c (typy_range): Check that bounds are constant before accessing them as such. * guile/scm-type.c (gdbscm_type_range): Likewise. gdb/testsuite/ChangeLog: PR gdb/27757 * gdb.python/flexible-array-member.c: New test. * gdb.python/flexible-array-member.exp: New test. * gdb.guile/scm-type.exp (test_range): Add test for flexible array member. * gdb.guile/scm-type.c (struct flex_member): New. (main): Use it. Change-Id: Ibef92ee5fd871ecb7c791db2a788f203dff2b841
2021-04-22sim: sprinkle some ATTRIBUTE_PRINTFSimon Marchi4-8/+16
Add some ATTRIBUTE_PRINTF attributes to functions that take a format string, to fix a few -Wformat-nonliteral warnings. Use the ATTRIBUTE_PRINTF macro like we use in GDB, instead of spelling out __attribute__((format...)). Use ATTRIBUTE_NULL_PRINTF at one place, because callers expect to be able to pass NULL. sim/common/ChangeLog: * callback.c (os_printf_filtered, os_vprintf_filtered, os_evprintf_filtered, os_error): Use ATTRIBUTE_PRINTF. * sim-engine.h (sim_engine_abort, sim_engine_vabort): Likewise. * sim-events.h (sim_events_schedule_tracef, sim_events_schedule_vtracef): Use ATTRIBUTE_NULL_PRINTF. Change-Id: Icd206f7b2c325e8b144f72eb129fb2a6b5af2fa3