aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-10-26[PowerPC] Don't zero-initialize vector register buffersPedro Franco de Carvalho4-24/+12
Now that linux-tdep.c already zero-initializes the buffer used for generating core file notes, there is no need to do this in the linux collect functions for the vector regset. The memsets in gdbserver were not useful to begin with. gdb/ChangeLog: 2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com> * ppc-linux-tdep.c (ppc_linux_collect_vrregset): Remove. (ppc32_le_linux_vrregset, ppc32_be_linux_vrregset): Replace ppc_linux_collect_vrregset by regcache_collect_regset. gdb/gdbserver/ChangeLog: 2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com> * linux-ppc-low.c (ppc_fill_vrregset): Remove memset calls.
2018-10-26Zero-initialize linux note sectionsPedro Franco de Carvalho2-6/+14
This patches changes linux-tdep.c so that the buffer used to write note sections when generating a core file is zero-initialized. This way, bytes that are not collected won't contain random data (e.g. padding bytes). gdb/ChangeLog: 2018-10-26 Pedro Franco de Carvalho <pedromfc@linux.ibm.com> * linux-tdep.c (linux_collect_regset_section_cb): Use std::vector<gdb_byte> instead of char * and malloc for buf. Remove xfree.
2018-10-26Fix SYMBOL_LANGUAGE assertion failure on AIX.Sangamesh Mallayya2-5/+12
2018-10-26gdb/riscv: Remove redundant code, and catch more errors when accessing MISAAndrew Burgess2-22/+36
When reading the MISA register, the RISC-V specification says that, if MISA can't be found then a default value of 0 should be assumed. As such, this patch ensures that GDB ignores errors when accessing both the new and old locations for the MISA register. Additionally, this patch removes an unneeded flag parameter which didn't provide any additional functionality beyond checking the MISA for the default value of 0. gdb/ChangeLog: * riscv-tdep.c (riscv_read_misa_reg): Update comment, remove READ_P parameter, catch and ignore register access errors from either the old or new MISA location. (riscv_has_feature): Update call to riscv_read_misa_reg.
2018-10-26Automatic date update in version.inGDB Administrator1-1/+1
2018-10-26ELF: update ld man page on `--gc-sections`Christoph Conrads2-3/+9
Commit 91ae256e33 fixes the behavior of ld when `--gc-sections` and `--gc-keep-exported` are both given on the linker command line. This updates the ld documentation to suit. * ld.texi (--gc-sections): Update.
2018-10-25[gdb/testsuite] Move valgrind-db-attach.{c,exp} to valgrind-bt.{c,exp}Tom de Vries2-0/+0
Now that valgrind-db-attach.exp no longer use --db-attach, rename valgrind-db-attach.{c,exp} to valgrind-bt.{c,exp}. 2018-10-25 Tom de Vries <tdevries@suse.de> * gdb.base/valgrind-db-attach.c: Rename to ... * gdb.base/valgrind-bt.c: ... this. * gdb.base/valgrind-db-attach.exp: Rename to ... * gdb.base/valgrind-bt.exp: ... this.
2018-10-25[gdb/testsuite] Rewrite valgrind-db-attach.exp to use vgdbTom de Vries2-25/+59
The valgrind option --db-attach has been deprecated in version 3.10.0, and removed in version 3.11.0, so the valgrind-db-attach.exp testcase is unsupported starting version 3.11.0. Rewrite the test-case to use vgdb instead (making it supported starting version 3.7.0). Tested on x86_64-linux with and without --target_board=native-gdbserver. 2018-10-25 Tom de Vries <tdevries@suse.de> * gdb.base/valgrind-db-attach.exp: Rewrite to use vgdb.
2018-10-25gdb/python: Make convert_values_to_python return gdbpy_ref<>Andrew Burgess2-3/+12
Make convert_values_to_python return a gdbpy_ref<> directly rather than building a gdbpy_ref<>, releasing it, and then having a new gdbpy_ref<> created to hold the result. I also added a header comment to convert_values_to_python. gdb/ChangeLog: * python/py-function.c (convert_values_to_python): Return gdbpy_ref<>. Add header comment. (fnpy_call): Adjust.
2018-10-25gdb/python: Make cmdpy_completer_helper return gdbpy_ref<>Andrew Burgess2-8/+14
Make cmdpy_completer_helper return a gdbpy_ref<> directly rather than building a gdbpy_ref<>, releasing it, and then having a new gdbpy_ref<> created to hold the result. gdb/ChangeLog: * python/py-cmd.c (cmdpy_completer_helper): Return gdbpy_ref<>. (cmdpy_completer_handle_brkchars): Adjust. (cmdpy_completer): Adjust.
2018-10-25gdb/riscv: Use correct regnum in riscv_linux_nat_target::fetch_registersAndrew Burgess2-4/+7
In riscv_linux_nat_target::fetch_registers, if we are asked to supply all registers (regnum parameter is -1), then we currently end up calling regcache::raw_supply_zeroed with the regnum -1, which is invalid. Instead we should be passing the regnum of the specific register we wish to supply zeroed, in this case RISCV_CSR_MISA_REGNUM. I removed the extra { ... } block in line with the coding standard while editing this area. gdb/ChangeLog: * riscv-linux-nat.c (riscv_linux_nat_target::fetch_registers): Pass correct regnum to raw_supply_zeroed.
2018-10-24ELF: Hide symbols defined in discarded input sectionsH.J. Lu8-2/+50
When assigning symbol version, we should hide debug symbols defined in discarded sections from IR objects so that they can be removed later. bfd/ PR ld/23818 * elflink.c (_bfd_elf_link_assign_sym_version): Hide symbols defined in discarded input sections. ld/ PR ld/23818 * testsuite/ld-plugin/lto.exp: Run PR ld/23818 test. * testsuite/ld-plugin/pr23818.d: New file. * testsuite/ld-plugin/pr23818.t: Likewise. * testsuite/ld-plugin/pr23818a.c: Likewise. * testsuite/ld-plugin/pr23818b.c: Likewise.
2018-10-25Automatic date update in version.inGDB Administrator1-1/+1
2018-10-24[gdb/testsuite] Log wait status on process no longer exists errorTom de Vries2-0/+16
Proc gdb_test_multiple can run into a process no longer exists error, but when that happens it shows no details about the process: ... ERROR: Process no longer exists ... Fix this by showing the wait status of the process in the log: ... ERROR: GDB process no longer exists GDB process exited with wait status 8106 exp8 0 0 CHILDKILLED SIGSEGV \ {segmentation violation} ... In order to run the wait commmand we need an explicit pid, so we can't use any_spawn_id, and duplicate the "-i any_spawn_id eof" pattern for gdb_spawn_id, and add the wait status logging there. Build and tested on x86_64-linux. 2018-10-24 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (gdb_test_multiple): Log wait status on process no longer exists error.
2018-10-24cmse_scan segfaultAlan Modra2-1/+7
elf_sym_hashes for as-needed libs will be zeroed if the library is found to be not needed. More than that, the local symbols for such a library should not be considered by cmse_scan. * elf32-arm.c (elf32_arm_size_stubs): Ignore as-needed libs that were not needed.
2018-10-24[gdb/testsuite] Rewrite catch-follow-exec.exp using gdb_testTom de Vries2-50/+17
The testcase catch-follow-exec.exp is written use gdb -batch in order to avoid a GDB SIGTTOU. After the commit of "Avoid GDB SIGTTOU on catch exec + set follow-exec-mode new (PR 23368)", that no longer is necessary. Rewrite the test using regular gdb_test commands. Tested with x86_64-linux. 2018-10-24 Tom de Vries <tdevries@suse.de> * gdb.base/catch-follow-exec.exp: Rewrite using gdb_test.
2018-10-24[gdb/testsuite] Handle removed valgrind option --db-attachTom de Vries2-0/+9
When running valgrind-db-attach.exp with valgrind version 3.13.0, we get: ... PASS: gdb.base/valgrind-db-attach.exp: spawn valgrind valgrind: Unknown option: --db-attach=yes valgrind: Use --help for more information or consult the user manual. ERROR: Process no longer exists UNRESOLVED: gdb.base/valgrind-db-attach.exp: valgrind started ... The valgrind option --db-attach has been deprecated in version 3.10.0, and removed in version 3.11.0. Fix valgrind-db-attach.exp to replace the ERROR/UNRESOLVED with: ... UNSUPPORTED: gdb.base/valgrind-db-attach.exp: valgrind started ... Tested on x86_64-linux. 2018-10-24 Tom de Vries <tdevries@suse.de> * gdb.base/valgrind-db-attach.exp: Handle removed support for --db-attach in valgrind.
2018-10-24Automatic date update in version.inGDB Administrator1-1/+1
2018-10-23Fix failing cooked_read selftest for CSKY.Hafiz Abid Qadeer2-1/+6
The problem was discussed and approved in https://sourceware.org/ml/gdb-patches/2018-10/msg00514.html 2018-10-23 Hafiz Abid Qadeer <abidh@codesourcery.com> * regcache.c (cooked_read_test): Add CSKY to the list of architectures with a save_reggroup
2018-10-23Avoid GDB SIGTTOU on catch exec + set follow-exec-mode new (PR 23368)Simon Marchi4-4/+33
Here's a summary of PR 23368: #include <unistd.h> int main (void) { char *exec_args[] = { "/bin/ls", NULL }; execve (exec_args[0], exec_args, NULL); } $ gdb -nx t -ex "catch exec" -ex "set follow-exec-mode new" -ex run ... [1] + 13146 suspended (tty output) gdb -q -nx t -ex "catch exec" -ex "set follow-exec-mode new" -ex run $ Here's what happens: when the inferior execs with "follow-exec-mode new", we first "mourn" it before creating the new one. This ends up calling inflow_inferior_exit, which sets the per-inferior terminal state to "is_ours": inf->terminal_state = target_terminal_state::is_ours; At this point, the inferior's terminal_state is is_ours, while the "reality", tracked by gdb_tty_state, is is_inferior (GDB doesn't own the terminal). Later, we continue processing the exec inferior event and decide we want to stop (because of the "catch exec") and call target_terminal::ours to make sure we own the terminal. However, we don't actually go to the target backend to change the settings, because the core thinks that no inferior owns the terminal (inf->terminal_state is target_terminal_state::is_ours, as checked in target_terminal_is_ours_kind, for both inferiors). When something in readline tries to mess with the terminal settings, it generates a SIGTTOU. This patch fixes this by tranferring the state of the terminal from the old inferior to the new inferior. gdb/ChangeLog: PR gdb/23368 * infrun.c (follow_exec): In the follow_exec_mode_new case, transfer terminal state from old new new inferior. * terminal.h (swap_terminal_info): New function. * inflow.c (swap_terminal_info): New function.
2018-10-23Fix use-after-free in record_btrace_start_replayingTom Tromey2-11/+14
-fsanitize=address showed a use-after-free in record_btrace_start_replaying. The bug occurred because get_thread_current_frame returned a frame_info, but this object was then invalidated before the return by ~scoped_restore_current_thread. This patch fixes the problem by renaming get_thread_current_frame and having it return a frame id. gdb/ChangeLog 2018-10-23 Tom Tromey <tom@tromey.com> * record-btrace.c (get_thread_current_frame_id): Rename from get_thread_current_frame. Return a frame_id. (record_btrace_start_replaying): Update.
2018-10-23S/390: Support vector alignment hintsAndreas Krebbel4-0/+38
This patch adds the vector alignment hints to the vector load and store instructions as documented in the IBM z14 Principles of Operations manual: http://publibfi.boulder.ibm.com/epubs/pdf/dz9zr011.pdf opcodes/ChangeLog: 2018-10-23 Andreas Krebbel <krebbel@linux.ibm.com> * s390-opc.txt: Add vector load/store instructions with additional alignment parameter. gas/ChangeLog: 2018-10-23 Andreas Krebbel <krebbel@linux.ibm.com> * config/tc-s390.c (md_gather_operands): Fix for optional operands following memory addresses. * testsuite/gas/s390/zarch-arch12.d: Add regexp checks for new instruction variants. * testsuite/gas/s390/zarch-arch12.s: Emit new instruction variants.
2018-10-23GDB: New target s12zJohn Darrington5-0/+570
gdb/ * configure.tgt: Add configuration for s12z. * s12z-tdep.c: New file. * NEWS: Mention new target.
2018-10-23GDB: Remote target can now accept the form unix::/path/to/socket.John Darrington2-4/+19
Allow target remote to use the unix::/path/to/socket syntax as well as just plain /path/to/socket gdb/ * ser-uds.c (uds_open): Use parse_connection_spec to deal with the comm form unix::/path/to/socket. * serial.c (serial_open): Consider the "unix:" prefix when deciding which interface to use.
2018-10-23GDB: Fix documentation for invoking GDBSERVERJohn Darrington1-16/+44
The documentation did not mention the possibility of invoking gdbserver with the new connection forms such as tcp6:host:port. This change fixes that. gdb/doc/ * gdb.texinfo (Server): Tabulate the various permitted forms of the @var{comm} metasyntactical variable. Include the unix:@var{host}:@var{socket} form as one of them.
2018-10-23GDB: Document the unix::/path/to/socket of remote connection.John Darrington1-1/+23
gdb/doc: * gdb.texinfo (Connecting)[Remote Connection Commands]: Provide alternative unix::/tmp/xxx example. Include @code{unix::@var{local-socket}} in the list of remote and extended-remote syntaxes.
2018-10-23GDBSERVER: Listen on a unix domain (instead of TCP) socket if requested.John Darrington4-47/+126
When invoking gdbserver, if the COMM parameter takes the form "unix::/path/name" then a local (unix) domain socket will be created with that name and gdbserver will listen for connections on that. gdb/ * NEWS: Mention new feature. gdb/gdbserver/ * configure.ac (AC_CHECK_HEADERS): Add sys/un.h. * configure: Regenerate. * remote-utils.c (remote_prepare): Create a local socket if requested. (remote_open): Don't attempt to open a file if it's a socket. (handle_accept_event): Display the name of the socket on connection. gdb/common/ * netstuff.c (parse_connection_spec)[prefixes]: New member for local domain sockets.
2018-10-23S12Z: New 32 bit Reloc.John Darrington3-2/+27
Third party tools produce 32 bit relocs at index 6 with strange properties. This change moves the existing 32 bit reloc (R_S12Z_EXT32) to index 7 and introduces a new one (R_S12Z_CW32) at index 6 to try to support code generated by these tools. * bfd/elf32-s12z.c (elf_s12z_howto_table) [R_S12Z_CW32]: New member. * binutils/readelf.c (is_32bit_abs_reloc): Reloc type 7 is also 32 bit. * include/elf/s12z.h (elf_s12z_reloc_tpe) [RELOC_NUMBER (R_S12Z_CW32)]: New enum.
2018-10-23S12Z: Handle 16 bit fixups which are constant.John Darrington2-0/+8
Commit 1f38083f425e03faf55595414daf291306738222 added a test to check that the assembler handled fixups with resolved to constant values. We were not handling this in the case of 16 bit values. This change fixes that. * gas/config/tc-s12z.c (md_apply_fix): Handle BFD_RELOC_16
2018-10-23gdb/riscv: Give user-friendly names for CSRsAndrew Burgess2-4/+20
The recent commit: commit 0dbfcfffe9abbc5198bce95eb8c66b6bc9b364be Date: Tue Oct 16 22:40:09 2018 +0100 gdb/riscv: Fix register access for register aliases broke the CSR names for RISC-V, now all of the CSRs have names like, csr0, csr1, csr2, etc. This commit restores the previous user-friendly names. gdb/ChangeLog: * riscv-tdep.c (riscv_register_name): Use the user-friendly names for CSRs.
2018-10-23PR23806, NULL pointer dereference in merge_stringsAlan Modra2-4/+17
PR 23806 * merge.c (_bfd_add_merge_section): Don't attempt to merge sections with ridiculously large alignments.
2018-10-23PR23805, NULL pointer dereference in elf_link_input_bfdAlan Modra2-6/+21
PR 23805 * elflink.c (elf_link_input_bfd): Don't segfault on finding STT_TLS symbols without any TLS sections. Instead, change the symbol type to STT_NOTYPE.
2018-10-23PR23804, buffer overflow in sec_merge_hash_lookupAlan Modra2-0/+9
PR 23804 * merge.c (_bfd_add_merge_section): Don't attempt to merge sections where size is not a multiple of entsize.
2018-10-23alpha testsuite fixesAlan Modra3-6/+22
Fixes a couple of ERROR results due to .set difference on alpha. * testsuite/ld-elf/shared.exp: Don't build pr19073 test on alpha. * testsuite/ld-elf/pr18720b.c: Don't use .set on alpha.
2018-10-23gdb/riscv: expect h/w watchpoints to trigger before the memory is writtenJoel Brobecker2-0/+6
When using QEMU as a RISCV simulator, hardware watchpoint events are reported to GDB before the target memory gets written. GDB currently expects the event to be reported after it is written. As a result of this mismatch, upon receiving the event, GDB sees that the target memory region has not changed, and therefore decides to ignore the event. It therefore resumes the program's execution with a continue, which is the start of an infinite loop between QEMU repeatedly reporting the same watchpoint event over and over, and GDB repeatedly ignoring it. This patch fixes the issue by telling GDB to expect the watchpoint event to be reported ahead of the memory region being modified. Upon receiving the event, GDB then single-steps the program before checking the watched memory value. gdb/ChangeLog: * riscv-tdep.c (riscv_gdbarch_init): Set the gdbarch's have_nonsteppable_watchpoint attribute to 1.
2018-10-23gdb/riscv: Fix register access for register aliasesAndrew Burgess5-105/+286
Some confusion over how the register names and aliases are setup in riscv means that we currently can't access registers through their architectural name. This commit fixes this issue, and moves some of the csr register handling out of the alias handling code and deals with it separately. This has the benefit that we can now directly access some arrays rather than having to iterate over them. A new test is added to ensure that register aliases now work correctly. gdb/ChangeLog: * riscv-tdep.c (riscv_gdb_reg_names): Update comment, and all register names. (struct register_alias): Rename to... (struct riscv_register_alias): ...this, and update comment. (riscv_register_aliases): Update type, and alias names. Remove CSR names from this list. (riscv_register_name): Use riscv_gdb_reg_names for int and float register names. Add an extra assertion. (riscv_is_regnum_a_named_csr): New function. (riscv_register_reggroup_p): Use riscv_is_regnum_a_named_csr. gdb/testsuite/ChangeLog: * gdb.arch/riscv-reg-aliases.c: New file. * gdb.arch/riscv-reg-aliases.exp: New file.
2018-10-23Automatic date update in version.inGDB Administrator1-1/+1
2018-10-22RISC-V: NaN-box FP values smaller than an FP register.Jim Wilson2-2/+15
The hardware requires that values in FP registers be NaN-boxed, so we must extend them with 1's instead of 0's as we do for integer values. gdb/ * riscv-tdep.c (riscv_push_dummy_call) <in_reg>: Check for value in FP reg smaller than FP reg size, and fill with -1 instead of 0.
2018-10-22RISC-V: Print FP regs as union of float types.Jim Wilson3-3/+94
A 64-bit FP register can hold either a single or double float value, so print it as both types by using a union type for FP registers. Likewise for 128-bit regs which can also hold long double. gdb/ * riscv-tdep.c (riscv_fpreg_d_type, riscv_fpreg_q_type): New. (riscv_register_type): Use them. (riscv_print_one_register_info): Handle union of floats same as float. * riscv-tdep.h (struct gdbarch_tdep): Add riscv_fpreg_d_type and riscv_fpreg_q_type fields.
2018-10-22S12Z: Disassembly: Fallback to show the address if the symbol table is empty.John Darrington2-0/+9
* opcodes/s12z-dis.c (decode_possible_symbol): Add fallback case. (rel_15_7): Likewise.
2018-10-22gas simple-forward testAlan Modra5-2/+36
Tests that target md_apply_fix can handle fixups that have resolved down to a constant and thus do not need relocations. Also a fix for eqv-dot xfails. * testsuite/gas/all/simple-forward.d, * testsuite/gas/all/simple-forward.s: New test. * testsuite/gas/all/gas.exp: Run it. * testsuite/gas/all/eqv-dot.d: xfail tic30 and tic54x.
2018-10-22Apply alpha BFD_RELOC_8 fixupsAlan Modra4-4/+15
* config/tc-alpha.c (md_apply_fix): Handle BFD_RELOC_8 for fixups without a symbol. * testsuite/gas/all/gas.exp: Don't xfail forward test here.. * testsuite/gas/all/forward.d: ..do so here, removing alpha.
2018-10-22PR23040, .uleb128 directive doesn't accept some valid expressionsAlan Modra4-20/+48
What a trip down a rabbit hole this bug has been. First observation: You can't use deferred_expression in s_leb128. deferred_expression implements the semantics of .eqv or '==', saving an expression with minimal simplification for assignment to a symbol so that the expression is evaluated at uses of the symbol. In particular, the value of "dot" is not evaluated at the .eqv symbol assignment, but later. When s_leb128 uses deferred_expression, "later" is at the end of assembly, giving entirely the wrong value of "dot". There is no way to fix this for the s_leb128 use without breaking .equ (which incidentally was already somewhat broken, see commit e4c2619ad1). So, don't use deferred_expression in s_leb128. But that leads to the gas test elf/dwarf2-17 failing, because view symbols are calculated with a chain of expression symbols. In the dwarf2-17 .L1 case there is a "temp_sym_1 > temp_sym_2" expression, with temp_sym_1 and temp_sym_2 on either side of a ".balign". Since ".balign" and many other directives moving "dot" are not calculated on the first (and only) pass over source, .L1 cannot be calculated until final addresses are assigned to frags. However, ".uleb128 .L1" *is* calculated immediately, resulting in the wrong value. The reason why .L1 is calculated immediately is that code in expr.c:operand after the comment /* If we have an absolute symbol or a reg, then we know its value now. */ does as it says and fixes the value of .L1, because .L1 is assigned to absolute_section in dwarf2dbg.c:set_or_check_view. So, correct that to expr_section. Unfortunately that fix leads to failure of the elf/dwarf2-5 test with ../gas/elf/dwarf2-5.s: Error: attempt to get value of unresolved symbol `.L5' ../gas/elf/dwarf2-5.s: Error: attempt to get value of unresolved symbol `.L11' ../gas/elf/dwarf2-5.s: Error: attempt to get value of unresolved symbol `.L12' So why is that? Well, it turns out that .L5 is defined in terms of .L4, and apparently .L4 is undefined. But .L4 clearly is defined, otherwise we would hit an error when trying to use .L4 a little earlier. There are two copies of .L4! So, symbols are cloned when that should not happen. Symbol cloning is a technique used by gas to support saving the value of symbols that change between uses, but that isn't the case with .L4. Only one value is set and used for .L4, but indeed .L4 was being cloned by symbol_clone_if_forward_ref. This despite no forward refs being present. Also, .L4 is a local symbol and a cursory glance at symbol_clone_if_forward_ref "if (symbolP && !LOCAL_SYMBOL_CHECK (symbolP))" would seem to prevent cloning of local symbols. All is not as it seems though, a curse of using macros. LOCAL_SYMBOL_CHECK modifies its argument if a "struct local_symbol" is converted to the larger "struct symbol", as happens when assigning a view symbol value. That fact results in the recursive call to symbol_clone_if_forward_ref returning a different address for "add_symbol". This problem could have been fixed by using symbol_same_p rather than comparing symbol pointers, but I thought it better to use the real symbol throughout. Note that symbol_find_exact also returns the real symbol for a converted local symbol. Finally, this patch does expose lack of support for forward symbol definitions in various targets. For example: alpha-linux +ERROR: ../ld/testsuite/ld-elf/pr11138-2.c: compilation failed This is caused by view symbol uses. On alpha-linux-gcc (GCC) 8.1.1 20180502 they happen to occur in .byte directives so were silently broken in cases like elf/dwarf2-17 anyway. /tmp/ccvtsMfU.s: Assembler messages: /tmp/ccvtsMfU.s: Fatal error: unhandled relocation type BFD_RELOC_8 /tmp/ccvtsMfU.s: Fatal error: unhandled relocation type BFD_RELOC_8 md_apply_fix on those targets needs to handle fixups that resolve down to a constant. PR 23040 * symbols.c (get_real_sym): New function. (symbol_same_p): Use get_real_sym. (symbol_clone_if_forward_ref): Save real original add_symbol and op_symbol for comparison against that returned from lookup or recursive calls. * dwarf2dbg.c (set_or_check_view): Use expr_section for expression symbols, not absolute_section. (dwarf2_directive_loc): Check symbol_equated_p and tidy cloning of view symbols. * read.c (s_leb128): Don't use deferred_expression.
2018-10-21Introduce gdbarch_num_cooked_regsSimon Marchi26-119/+122
The expression gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch) is used quite often to find the number of cooked registers (raw + pseudo registers). This patch introduces gdbarch_num_cooked_regs, which does the equivalent. It substantially reduces required wrapping in some places, so should improve readability. There is a for loop in m68hc11_frame_unwind_cache that had iterated until (the equivalent of) gdbarch_num_cooked_regs (gdbarch) - 1. During review, we concluded that this is most likely an off-by-one mistake, so I replaced it with gdbarch_num_cooked_regs (gdbarch). gdb/ChangeLog: * gdbarch.sh (gdbarch_num_cooked_regs): New. * gdbarch.h: Re-generate. * ax-gdb.c (gen_expr): Use gdbarch_num_cooked_regs. * dwarf2-frame.c (dwarf2_frame_cache): Likewise. * eval.c (evaluate_subexp_standard): Likewise. * findvar.c (value_of_register): Likewise. (value_of_register_lazy): Likewise. (address_from_register): Likewise. * frame.c (get_frame_register_bytes): Likewise. * gdbarch-selftests.c (register_to_value_test): Likewise. * h8300-tdep.c (h8300_register_type): Likewise. * i386-tdep.c (i386_dbx_reg_to_regnum): Likewise. (i386_svr4_reg_to_regnum): Likewise. * infcmd.c (default_print_registers_info): Likewise. (registers_info): Likewise. (print_vector_info): Likewise. (default_print_float_info): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise. * mdebugread.c (mdebug_reg_to_regnum): Likewise. * mi/mi-main.c (mi_cmd_data_list_register_names): Likewise. (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_list_register_values): Likewise. (mi_cmd_data_write_register_values): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mips-tdep.c (print_gp_register_row): Likewise. (mips_print_registers_info): Likewise. * nds32-tdep.c (nds32_gdbarch_init): Likewise. * regcache.c (init_regcache_descr): Likewise. (register_size): Likewise. (register_dump::dump): Likewise. (cooked_read_test): Likewise. (cooked_write_test): Likewise. * rs6000-tdep.c (rs6000_register_sim_regno): Likewise. (rs6000_gdbarch_init): Likewise. * stabsread.c (stab_reg_to_regnum): Likewise. * stack.c (info_frame_command): Likewise. * target-descriptions.c (tdesc_register_name): Likewise. * trad-frame.c (trad_frame_alloc_saved_regs): Likewise. * tui/tui-regs.c (tui_show_register_group): Likewise. * user-regs.c (user_reg_map_name_to_regnum): Likewise. (user_reg_map_regnum_to_name): Likewise. (value_of_user_reg): Likewise. (maintenance_print_user_registers): Likewise. * xtensa-tdep.c (xtensa_find_register_by_name): Likewise. (xtensa_register_name): Likewise. (xtensa_register_type): Likewise. (xtensa_reg_to_regnum): Likewise. (xtensa_pseudo_register_read): Likewise. (xtensa_pseudo_register_write): Likewise.
2018-10-21Allocate buffer with proper size in amd64_pseudo_register_{read_value,write}Simon Marchi2-13/+25
Running "maintenance selftest" on an amd64 build with AddressSanitizer enabled, I get this: ==18126==ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address 0x7ffdf72397c1 at pc 0x7fb5f437b011 bp 0x7ffdf7239740 sp 0x7ffdf7238ee8 WRITE of size 8 at 0x7ffdf72397c1 thread T0 #0 0x7fb5f437b010 in __interceptor_memcpy /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:737 #1 0x55a1f899c1b3 in readable_regcache::raw_read(int, unsigned char*) /home/simark/src/binutils-gdb/gdb/regcache.c:530 #2 0x55a1f7db241b in amd64_pseudo_register_read_value /home/simark/src/binutils-gdb/gdb/amd64-tdep.c:384 #3 0x55a1f8413a2e in gdbarch_pseudo_register_read_value(gdbarch*, readable_regcache*, int) /home/simark/src/binutils-gdb/gdb/gdbarch.c:1992 #4 0x55a1f899c9d1 in readable_regcache::cooked_read(int, unsigned char*) /home/simark/src/binutils-gdb/gdb/regcache.c:636 #5 0x55a1f89a2251 in cooked_read_test /home/simark/src/binutils-gdb/gdb/regcache.c:1649 In amd64_pseudo_register_read_value, when we try to read the al register, for example, we need to read rax and extract al from it. We allocate a buffer of the size of al (1 byte): gdb_byte *raw_buf = (gdb_byte *) alloca (register_size (gdbarch, regnum)); but read in it the whole rax value (8 bytes): status = regcache->raw_read (gpnum, raw_buf); Fix it by allocating a buffer correctly sized for the full register from which the smaller register is extracted. The amd64_pseudo_register_write function had the same problem. gdb/ChangeLog: * amd64-tdep.c (amd64_pseudo_register_read_value): Use correctly-sized buffer with raw_read. (amd64_pseudo_register_write): Use correctly-sized buffer for raw_read/raw_write.
2018-10-22Automatic date update in version.inGDB Administrator1-1/+1
2018-10-21Automatic date update in version.inGDB Administrator1-1/+1
2018-10-20[PUSHED/OBVIOUS] ensure help set print type gives the correct help.Philippe Waroquiers2-1/+6
Without this patch: (gdb) help set print type Generic command for setting how types print. List of show print type subcommands: show print type methods -- Set printing of methods defined in classes ... With this patch: (gdb) h set print type Generic command for setting how types print. List of set print type subcommands: set print type methods -- Set printing of methods defined in classes ...
2018-10-20Fix "make info" in gdbTom Tromey2-1/+6
"make info" in gdb was broken by my last patch. This fixes it. Tested by rebuilding; committing as obvious. gdb/doc/ChangeLog 2018-10-20 Tom Tromey <tom@tromey.com> * gdb.texinfo (TUI Commands): Add @end table. (TUI Configuration): Remove stray @end table.
2018-10-20GDB: Documentation: Remove greengrocer's apostrophe.John Darrington1-1/+1
gdb/doc/gdb.texinfo (gdbserver man): "it's symbol" --> its symbol.