aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-05-17sim: riscv: invert sim_state storageMike Frysinger4-12/+22
2021-05-17sim: h8300: invert sim_state storageMike Frysinger3-11/+32
2021-05-17sim: mips: invert sim_state storageMike Frysinger5-27/+27
2021-05-17sim: avr: invert sim_state storageMike Frysinger3-11/+23
2021-05-17sim: cgen: invert sim_state storage for cgen portsMike Frysinger17-74/+49
2021-05-17sim: bfin: invert sim_state storageMike Frysinger3-9/+12
2021-05-17sim: invert sim_state storageMike Frysinger33-124/+143
Currently all ports have to declare sim_state themselves in their sim-main.h and then embed the common sim_state_base & sim_cpu in it. This dynamic makes it impossible to share common object code among multiple ports because the core data structure is always different. Let's invert this relationship: common code declares sim_state, and if the port actually needs state on a per-instance basis, it can use the new arch_data field for it. Most ports don't actually use it, so they don't need to declare anything at all. This is the first in a series of changes: it adds a define to select between the old & new layouts, then converts all the ports that don't need custom state over to the new layout.
2021-05-16sim: install library header filesMike Frysinger3-37/+78
We install libsim.a for people to link against, but haven't been installing the header files to for its API. Export them!
2021-05-16sim: switch config.h usage to defs.hMike Frysinger302-169/+923
The defs.h header will take care of including the various config.h headers. For now, it's just config.h, but we'll add more when we integrate gnulib in. This header should be used instead of config.h, and should be the first include in every .c file. We won't rely on the old behavior where we expected files to include the port's sim-main.h which then includes the common sim-basics.h which then includes config.h. We have a ton of code that includes things before sim-main.h, and it sometimes needs to be that way. Creating a dedicated header avoids the ordering mess and implicit inclusion that shows up otherwise.
2021-05-17Automatic date update in version.inGDB Administrator1-1/+1
2021-05-16CTF: handle forward reference typeWeimin Pan5-27/+562
The problems can be illustrated, with any program, below: (gdb) print main $1 = {main} 0x0 The return type was incorrectly set in read_func_kind_type, with the name of the function, which leads c_type_print_base_1 to print it. In addition, the address of a new function needs to be set with that info in its minimal symtab entry, when the new function is added. After the fix: (gdb) print main $1 = {int ()} 0x4004b7 <main> A new test, gdb.ctf/funcreturn.exp, is added to the testsuite. gdb/ChangeLog: * ctfread.c (new_symbol): Set function address. (read_func_kind_type): Remove incorrect type name setting. Don't copy name returned from ctf_type_ame_raw throughout file. gdb/testsuite/ChangeLog: * gdb.ctf/funcreturn.exp: New file. * gdb.ctf/whatis.c: Copy from gdb.base.
2021-05-16sim: riscv: move __int128 check to configureMike Frysinger96-63/+596
2021-05-16Automatic date update in version.inGDB Administrator1-1/+1
2021-05-15sim: ppc: clean up various warningsMike Frysinger22-54/+122
A random grab bag of minor fixes to enable -Werror for this port. Cast address vars to long when the format was using %l. Use %zu with sizeof operations. Add const to a bunch of strings. Trim unused variables. Fix sizeof call to calculate target storage and not the pointer itself.
2021-05-15sim: switch to libiberty environ.hMike Frysinger4-24/+18
Drop our compat code and assume environ exists to simplify.
2021-05-15process_cu_tu_indexAlan Modra2-27/+14
* dwarf.c (process_cu_tu_index): Avoid pointer UB. Use _mul_overflow. Delete dead code.
2021-05-15display_gdb_indexAlan Modra2-11/+12
* dwarf.c (display_gdb_index): Avoid pointer UB and overflow in length calculations.
2021-05-15display_debug_namesAlan Modra2-15/+35
* dwarf.c (display_debug_names): Complain when header length is too small. Avoid pointer UB. Sanity check augmentation string, CU table, TU table and foreign TU table sizes.
2021-05-15display_debug_framesAlan Modra2-103/+114
* dwarf.c (display_debug_frames): Delete initial_length_size. Avoid pointer UB. Constrain data reads to length given in header. Sanity check cie header length. Only skip up to next FDE on finding augmentation data too long.
2021-05-15read_cieAlan Modra2-1/+17
* dwarf.c (read_cie): Add more sanity checks to ensure data pointer is not bumped past end.
2021-05-15display_debug_rangesAlan Modra2-10/+12
* dwarf.c (display_debug_ranges): Delete initial_length_size. Correct fallback size calculated on finding a reloc. Constrain data reads to length given in header. Avoid pointer UB.
2021-05-15display_debug_rnglists_listAlan Modra2-1/+5
* dwarf.c (display_debug_rnglists_list): Avoid pointer UB.
2021-05-15display_debug_str_offsetsAlan Modra2-2/+7
* dwarf.c (display_debug_str_offsets): Constrain reads to length given in header.
2021-05-15display_debug_arangesAlan Modra2-18/+21
* dwarf.c (display_debug_aranges): Delete initial_length_size. Use end_ranges to constrain data reads to header length. Avoid pointer UB.
2021-05-15display_loc_listAlan Modra2-7/+18
* dwarf.c (display_loc_list): Avoid pointer UB. Correct check before reading uleb length. Warn on excess length.
2021-05-15display_debug_macroAlan Modra2-6/+15
* dwarf.c (display_debug_macro): Print strings that might not be zero terminated with %*s. Don't bump curr if unterminated.
2021-05-15get_line_filename_and_dirnameAlan Modra2-15/+28
* dwarf.c (get_line_filename_and_dirname): Delete initial_length_size. Simplify length sanity check, and check for too small lengths. Constrain data reads to header length. Avoid pointer UB.
2021-05-15display_debug_macinfoAlan Modra2-9/+20
The existing code went to the bother of using strnlen for scanning but went wild when printing, and possibly incremented curr past end. * dwarf.c (display_debug_macinfo): Print strings that might not be zero terminated with %*s. Don't bump curr if unterminated.
2021-05-15display_debug_pubnames_workerAlan Modra2-20/+19
* dwarf.c (display_debug_pubnames_worker): Delete initial_length_size. Simplify length check. Constrain reads to length given by header.
2021-05-15display_debug_lines_decodedAlan Modra2-4/+9
The directory_table strnlen used the negative of the proper size. After fixing that I realised we don't need strnlen here. * dwarf.c (display_debug_lines_decoded): Don't use strnlen when we have already checked for NUL termination.
2021-05-15read_debug_line_headerAlan Modra2-18/+11
This patch also better constrains the data read, and removes pointer UB. * dwarf.c (read_debug_line_header): Delete initial_length_size. Avoid pointer UB. Keep within length specified by header. Delete dead code.
2021-05-15process_debug_infoAlan Modra2-82/+68
This patch constrains process_debug_info to stay within the data specified by the CU length rather than allowing access up to the end of the section. * dwarf.c (process_debug_info): Always do the first CU length scan for sanity checks. Remove initial_length_size var and instead calculate end_cu. Use end_cu to limit data reads. Delete now dead code checking length.
2021-05-15SAFE_BYTE_GET_INTERNALAlan Modra2-1/+8
We won't want this assert triggering in the next release. * dwarf.c (SAFE_BYTE_GET_INTERNAL): Assert only when ENABLE_CHECKING.
2021-05-15_mul_overflow and get_encoded_valueAlan Modra3-1/+14
A sufficiently mad compiler optimiser can take undefined behaviour according to the C standard as an opportunity to remove code. Since "data + size" might be seen to be past the end of an array, calculating such an expression is UB. _mul_overflow is infrastructure for later patches. * bucomm.h (_mul_overflow): Define. * dwarf.c (get_encoded_value): Avoid pointer UB.
2021-05-15[GOLD]: Re: Add -Bno-symbolicAlan Modra2-1/+7
PR 27834 * options.cc (General_options::General_options): Init bsymbolic_.
2021-05-14Fix Python pretty-printing bug in RustTom Tromey6-2/+133
An upstream Rust bug notes notes that the Python pretty-printing feature is broken for values that appear as members of certain types in Rust. The bug here is that some of the Rust value-printing code calls value_print_inner, a method on rust_language. This bypasses the common code that calls into Python. I'm checking this in. gdb/ChangeLog 2021-05-14 Tom Tromey <tom@tromey.com> * rust-lang.c (rust_language::val_print_struct) (rust_language::print_enum): Use common_val_print, not value_print_inner. gdb/testsuite/ChangeLog 2021-05-14 Tom Tromey <tom@tromey.com> * gdb.rust/pp.exp: New file. * gdb.rust/pp.py: New file. * gdb.rust/pp.rs: New file.
2021-05-14sim: callback: convert FS interfaces to 64-bitMike Frysinger6-11/+24
Rather than rely on off_t being the right size between the host & target, have the interface always be 64-bit. We can figure out if we need to truncate when actually outputting it to the right target.
2021-05-14sim: callback: convert time interface to 64-bitMike Frysinger11-22/+43
PR sim/27705 Rather than rely on time_t being the right size between the host & target, have the interface always be 64-bit. We can figure out if we need to truncate when actually outputting it to the right target.
2021-05-15Automatic date update in version.inGDB Administrator1-1/+1
2021-05-14gold: Add -Bno-symbolicFangrui Song3-4/+60
gold/ PR 27834 * options.h (General_options): Make -Bsymbolic and -Bsymbolic-functions special and adjust the help messages. Add enum Bsymbolic_kind and -Bno-symbolic. * options.cc (General_options): Define parse_Bno_symbolic, parse_Bsymbolic_functions, and parse_Bsymbolic.
2021-05-14testsuite: Cleanup some temp dirs with gdb-index filesBernd Edlinger3-0/+29
After the gdb test-suite runs there are some files left in /tmp/tmp*/*.gdb-index, remove those files and the directory at the end of the test case. gdb/testsuite: 2021-05-14 Bernd Edlinger <bernd.edlinger@hotmail.de> * gdb.base/index-cache.exp: Cleanup $cache_dir/*.gdb-index and remove the directory. * gdb.dwarf2/per-bfd-sharing.exp: Likewise.
2021-05-14gdb/python: add a 'connection_num' attribute to Inferior objectsTankut Baris Aktemur7-1/+70
Define a 'connection_num' attribute for Inferior objects. The read-only attribute is the ID of the connection of an inferior, as printed by "info inferiors". In GDB's internal terminology, that's the process stratum target of the inferior. If the inferior has no target connection, the attribute is None. gdb/ChangeLog: 2021-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * python/py-inferior.c (infpy_get_connection_num): New function. (inferior_object_getset): Add a new element for 'connection_num'. * NEWS: Mention the 'connection_num' attribute of Inferior objects. gdb/doc/ChangeLog: 2021-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * python.texi (Inferiors In Python): Mention the 'connection_num' attribute. gdb/testsuite/ChangeLog: 2021-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb.python/py-inferior.exp: Add test cases for 'connection_num'.
2021-05-14gdb: some int to bool conversion in remote.cAndrew Burgess2-17/+21
Convert a couple of local variables from int to bool. There should be no user visible changes after this commit. gdb/ChangeLog: * remote.c (check_pending_events_prevent_wildcard_vcont): Change argument type, update and re-wrap, header comment. (remote_target::commit_resumed): Convert any_process_wildcard and may_global_wildcard_vcont from int to bool.
2021-05-14RISC-V: Check the overflow for %pcrel_lo addend more strictly.Nelson Chu9-13/+60
The %pcrel_lo addend may causes the overflow, and need more than one %pcrel_hi values. But there may be only one auipc, shared by those %pcrel_lo with addends. However, the existing check method in the riscv_resolve_pcrel_lo_relocs, may not be able to work for some special/corner cases. Consider the testcases pcrel-lo-addend-2b. Before applying this patch, I can compile it successfully. But in fact the addend cause the value of %pcrel_hi to be different. This patch try to check the value of %pcrel_hi directly, to make sure it won't be changed. Otherwise, linker will report the following errors, (.text+0xa): dangerous relocation: %pcrel_lo overflow with an addend, the value of %pcrel_hi is 0x1000 without any addend, but may be 0x2000 after adding the %pcrel_lo addend The toolchain regressions, rv64gc-linux/rv64gc-elf/rv32gc-linux/rv32i-elf, pass expectedly and looks fine. bfd/ * elfnn-riscv.c (riscv_resolve_pcrel_lo_relocs): Check the values of %pcrel_hi, before and after adding the addend. Make sure the value won't be changed, otherwise, report dangerous error. ld/ * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated. * testsuite/ld-riscv-elf/pcrel-lo-addend-2a.d: Renamed from pcrel-lo-addend-2. * testsuite/ld-riscv-elf/pcrel-lo-addend-2a.s: Likewise. * testsuite/ld-riscv-elf/pcrel-lo-addend-2b.d: New testcase. * testsuite/ld-riscv-elf/pcrel-lo-addend-2b.s: Likewise.
2021-05-14gdb: fix pretty printing max depth behaviourKent Cheung9-37/+77
The 'print max-depth' feature incorrectly causes GDB to skip printing the string representation of pretty printed variables if the variable is stored at a nested depth corresponding to the set max-depth value. This change ensures that it is always printed before checking whether the maximum print depth has been reached. Regression tested with GCC 7.3.0 on x86_64, ppc64le, aarch64. gdb/ChangeLog: * cp-valprint.c (cp_print_value): Replaced duplicate code. * guile/scm-pretty-print.c (ppscm_print_children): Check max_depth just before printing child values. (gdbscm_apply_val_pretty_printer): Don't check max_depth before printing string representation. * python/py-prettyprint.c (print_children): Check max_depth just before printing child values. (gdbpy_apply_val_pretty_printer): Don't check max_depth before printing string representation. gdb/testsuite/ChangeLog: * gdb.python/py-format-string.c: Added a variable to test. * gdb.python/py-format-string.exp: Check string representation is printed at appropriate max_depth settings. * gdb.python/py-nested-maps.exp: Likewise. * gdb.guile/scm-pretty-print.exp: Add additional tests.
2021-05-14sim: callback: inline PTR defineMike Frysinger5-6/+16
We require C11 now, so no need for these pre-ANSI C hacks. PTR is simply void*, so use that directly.
2021-05-14sim: callback: use ATTRIBUTE_NORETURNMike Frysinger2-5/+5
This define is handled by ansidecl.h, so no need to duplicate effort.
2021-05-14sim: callback: always include necessary headersMike Frysinger2-4/+4
We use types from these headers, so always include them.
2021-05-14sim: create header namespaceMike Frysinger76-81/+211
The gdb/callback.h & gdb/remote-sim.h headers have nothing to do with gdb and are really definitions for the libsim API under the sim/ tree. While gdb uses those headers as a client, it's not specific to it. So create a new sim/ namespace and move the headers there.
2021-05-14gdb: lm32: drop unused sim headersMike Frysinger2-3/+5
Looks like these were copied & pasted as nothing from them are used.