Commit Graph

96045 Commits

Author SHA1 Message Date
John Darrington 6d0f8100c1 GDB: Document the unix::/path/to/socket of remote connection.
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-23 16:09:32 +02:00
John Darrington f19c7ff839 GDBSERVER: Listen on a unix domain (instead of TCP) socket if requested.
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-23 16:09:31 +02:00
John Darrington 2849d19feb S12Z: New 32 bit Reloc.
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-23 16:09:30 +02:00
John Darrington 405b61965f S12Z: Handle 16 bit fixups which are constant.
Commit 1f38083f42 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-23 16:09:29 +02:00
Andrew Burgess 420ecd9ce8 gdb/riscv: Give user-friendly names for CSRs
The recent commit:

    commit 0dbfcfffe9
    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-23 13:27:56 +01:00
Alan Modra 45a0eaf770 PR23806, NULL pointer dereference in merge_strings
PR 23806
	* merge.c (_bfd_add_merge_section): Don't attempt to merge
	sections with ridiculously large alignments.
2018-10-23 21:09:09 +10:30
Alan Modra 102def4da8 PR23805, NULL pointer dereference in elf_link_input_bfd
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-23 21:09:09 +10:30
Alan Modra ab419ddbb2 PR23804, buffer overflow in sec_merge_hash_lookup
PR 23804
	* merge.c (_bfd_add_merge_section): Don't attempt to merge
	sections where size is not a multiple of entsize.
2018-10-23 21:09:09 +10:30
Alan Modra 8e3152af14 alpha testsuite fixes
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-23 21:09:09 +10:30
Joel Brobecker 5a77b1b49f gdb/riscv: expect h/w watchpoints to trigger before the memory is written
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-23 11:31:27 +01:00
Andrew Burgess 0dbfcfffe9 gdb/riscv: Fix register access for register aliases
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-23 10:32:34 +01:00
GDB Administrator ba37fe2e8b Automatic date update in version.in 2018-10-23 00:00:53 +00:00
Jim Wilson 3399f1b303 RISC-V: NaN-box FP values smaller than an FP register.
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-22 14:11:55 -07:00
Jim Wilson 270b9329b7 RISC-V: Print FP regs as union of float types.
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-22 14:10:13 -07:00
John Darrington 192c2bfbd7 S12Z: Disassembly: Fallback to show the address if the symbol table is empty.
* opcodes/s12z-dis.c (decode_possible_symbol): Add fallback case.
  (rel_15_7): Likewise.
2018-10-22 20:53:15 +02:00
Alan Modra 1f38083f42 gas simple-forward test
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-22 22:32:43 +10:30
Alan Modra e1748c54a2 Apply alpha BFD_RELOC_8 fixups
* 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-22 22:32:43 +10:30
Alan Modra 38cf168be5 PR23040, .uleb128 directive doesn't accept some valid expressions
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-22 13:34:02 +10:30
Simon Marchi f6efe3f842 Introduce gdbarch_num_cooked_regs
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-21 22:29:21 -04:00
Simon Marchi 925047fed0 Allocate buffer with proper size in amd64_pseudo_register_{read_value,write}
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-21 22:10:02 -04:00
GDB Administrator df80d00c5f Automatic date update in version.in 2018-10-22 00:00:58 +00:00
GDB Administrator b8265d6194 Automatic date update in version.in 2018-10-21 00:01:05 +00:00
Philippe Waroquiers 4051d2d65a [PUSHED/OBVIOUS] ensure help set print type gives the correct help.
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-20 23:00:52 +02:00
Tom Tromey d6677607c2 Fix "make info" in gdb
"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-20 12:18:20 -06:00
John Darrington 1a088a2e26 GDB: Documentation: Remove greengrocer's apostrophe.
gdb/doc/gdb.texinfo (gdbserver man): "it's symbol" --> its symbol.
2018-10-20 12:24:20 +02:00
Alan Modra e4c2619ad1 PR23800, .eqv doesn't always defer expression evaluation
.eqv (and ==) ought not simplify expressions involving dot or other
symbols set by .eqv.  If such simplification occurs, the value of dot
will be that at the assignment rather than at the place where the
symbol is used.

	PR 23800
	* expr.c (expr): Don't simplify expressions involving forward_ref
	symbols when mode is expr_defer.
	* config/tc-spu.c (spu_cons): Parse expression using normal
	expression evaluation if @ppu is not detected.
	* testsuite/gas/all/eqv-dot.d,
	* testsuite/gas/all/eqv-dot.s: New test.
	* testsuite/gas/all/gas.exp: Run it.
2018-10-20 19:46:43 +10:30
Alan Modra ac85e67c05 PR23788, objcopy: failed to find link section
Symbol tables can change when a number of objcopy options are used.
I figure string tables are similarly changeable.

	PR 23788
	* elf.c (section_match): Don't require a size match for SHT_SYMTAB
	or SHT_STRTAB.
2018-10-20 19:46:43 +10:30
Alan Modra 91ae256e33 Relax a -r --gc-sections requirement
A symbol root is not needed if --gc-keep-exported is also given.

	* ldlang.c (lang_end): Don't error if no --entry or --undefined
	is given with -r -gc-sections if --gc-keep-exported.
2018-10-20 19:46:43 +10:30
GDB Administrator fe19e45ff3 Automatic date update in version.in 2018-10-20 00:00:40 +00:00
Tom Tromey 7806cea723 Deprecate and replace the "tabset" command
The "tabset" command sets the tab width as used by the TUI for source
and disassembly display.

This command has long seemed to be misnamed to me.  It is more in
keeping with gdb design to call it "set tui tab-width".  Also, making
this change allows for the corresponding "show" command to work.

gdb/ChangeLog
2018-10-19  Tom Tromey  <tom@tromey.com>

	PR tui/18388:
	* NEWS: Mention tabset deprecation.
	* tui/tui-win.c (tui_tab_width, internal_tab_width): New globals.
	(update_tab_width): New function.
	(tui_set_tab_width, tui_show_tab_width): New functions.
	(tui_set_tab_width_command): Use update_tab_width.
	(_initialize_tui_win): Move to end of file.  Deprecate "tabset".
	Add new "set tui tab-width" command.
	* tui/tui-source.c (tui_set_source_content): Update.
	* tui/tui-disasm.c (tui_set_disassem_content): Update.
	* tui/tui-data.h (tui_default_tab_len, tui_set_default_tab_len):
	Don't declare.
	(tui_tab_width): Declare.
	* tui/tui-data.c (default_tab_len, tui_default_tab_len)
	(tui_set_default_tab_len): Remove.

gdb/doc/ChangeLog
2018-10-19  Tom Tromey  <tom@tromey.com>

	PR tui/18388:
	* gdb.texinfo (TUI Commands): Remove tabset documentation.
	(TUI Configuration): Document "set tui tab-width".
2018-10-19 17:22:27 -06:00
Tom Tromey 84371624ad Minor cleanups in tui-io.c
I noticed that a couple of functions in tui-io.c could be static, and
that a couple more were unused and could be removed.

gdb/ChangeLog
2018-10-19  Tom Tromey  <tom@tromey.com>

	* tui/tui-io.h (key_is_start_sequence, key_is_end_sequence)
	(key_is_backspace, tui_getc): Don't declare.
	* tui/tui-io.c (key_is_start_sequence): Now static.
	(key_is_end_sequence, key_is_backspace): Remove.
	(tui_getc): Now static.
2018-10-19 17:22:27 -06:00
Tom Tromey 22ad8107d3 Clear static_links in reread_symbols
-fsanitize=address pointed out a use-after free in
objfile_register_static_link.  The bug turned out to be that
reread_symbols does not clear the static_links field; this leaves a
hash table that is filled with freed pointers.

Jan's (now quite old) idea of replacing reread_symbols with a simple
delete/new still seems good to me, and it's worth noting that it would
have avoided this bug.

Tested by the buildbot and by observing the change with
-fsanitize=address.

gdb/ChangeLog
2018-10-19  Tom Tromey  <tom@tromey.com>

	* symfile.c (reread_symbols): Clear "static_links".
2018-10-19 10:28:33 -06:00
Tamar Christina bacb77d018 Arm: Skip new binary decode tests on pe targets
The two new test I added require the use of the ".inst" directive which the PE
targets don't support.  Because of that I excluded *-unknown-pe but the mask needs
to be wider.  I am now excluding *-*-pe.

gas/ChangeLog:

	* testsuite/gas/arm/undefined-insn-arm.d: Widen pe skip.
	* testsuite/gas/arm/undefined-insn-thumb.d: Likewise.
2018-10-19 16:19:07 +01:00
Alan Hayward 74b3c71318 Aarch64: Better termination checks for sigcontext reading
When reading the reserved section in the sigcontext ensure the
address is updated on an unknown section. Also add additional
checks to prevent reading past the end of the array.

Fixes gdb.base/savedregs.exp

	* aarch64-linux-tdep.c (AARCH64_SIGCONTEXT_RESERVED_SIZE): New
	define.
	(aarch64_linux_sigframe_init): Extra boundary checks.
2018-10-19 13:51:00 +01:00
Andreas Arnez 0667c50682 S390: Fix crash when remote tdesc doesn't define vec128
I've encountered a GDB crash when trying to read registers from a remote
stub that provided a target.xml with vector registers, but without the
'vec128' data type.  The crash is caused by NULL register type entries for
the "concatenated" pseudo-registers v0-v15.  These NULL entries are
introduced by the logic in s390_pseudo_register_type(), where the tdesc
type 'vec128' is returned unconditionally -- even if it doesn't exist (is
NULL).

The fixed logic for determining a "concatenated" vector register's type
now returns the type of the raw register v16 instead.  This also makes
sure that all vector register have the same type.

gdb/ChangeLog:

	* s390-tdep.c (s390_pseudo_register_type): For v0-v15 don't yield
	the possibly non-existent tdesc type 'vec128', but the type of raw
	register v16 instead.
2018-10-19 14:05:08 +02:00
Gary Benson ba543ca5af Fix cli_interp::cli_uiout resource leak found by Coverity
This commit fixes a resource leak found by Coverity, where cli_interp's
constructor creates a new cli_ui_out, but there was no corresponding
destructor to free it.

gdb/ChangeLog:

	* cli/cli-interp.c (cli_interp::~cli_interp): New function.
2018-10-19 11:52:33 +01:00
Alan Hayward b04480b119 Testsuite: Fix racy conditions in py-cmd.exp
The test loop in test_python_inline_or_multiline was not checking for the
gdb prompt. readline_is_used then reads in the prompt causing it to fail
and the final chunk of tests to be skipped.

Spotted this error because sometimes the gdb prompt does get processed
correctly and the final tests are run, causing it to show up in the
racy tests script output.

Fix by ensuring the prompt is always checked for. To do this the list
style needs reformatting so that variables get expanded.

2018-10-19  Alan Hayward  <alan.hayward@arm.com>

	* gdb.python/py-cmd.exp: Check for gdb_prompt.
2018-10-19 11:29:42 +01:00
Alan Hayward 2c6ac8d7ce Testsuite: vla-optimized-out.exp is too pessimistic
On aarch64 (and possibly other ports), for O3 the sizeof "a" can still be shown.

2018-10-19  Alan Hayward  <alan.hayward@arm.com>

	* gdb.base/vla-optimized-out.exp: Allow either optimized out or 6.
2018-10-19 11:21:12 +01:00
Alan Hayward 2bc69f2588 testsuite: ovldbreak.exp: fix regexp
Fix the layout used in the regexp for breakpoints.

Gets rid of two FAILS.

2018-10-18  Alan Hayward  <alan.hayward@arm.com>

	* gdb.cp/ovldbreak.exp: Fix regexps.
2018-10-19 11:13:40 +01:00
Alan Hayward 1f1ae3a34f Testsuite: compile-cplus-print.exp: Start inferior before compiling
skip_compile_feature_tests is only valid if the inferior has already
been started (see proc comments). Move the runto_main earlier.

2018-10-18  Alan Hayward  <alan.hayward@arm.com>

	* gdb.compile/compile-cplus-print.exp: Start inferior earlier.
2018-10-19 11:03:38 +01:00
Tamar Christina 0b347048e7 Arm: Fix disassembler crashing on -b binary when thumb file and thumb not forced.
The disassembler for Arm has some aborts in it in places it assumes can never
be reached.  Under normal circumstances they indeed cannot be reached because
the right options are selected from the ARM attributes in the ELF file.

However when disassembling with -b binary then if you do not get the options
right the disassembler just aborts.  This changes it so it just prints how it
was trying to interpret the instruction and prints UNKNOWN instructions next to it.

This way the user has an idea of what's going.

gas/ChangeLog:

	* testsuite/gas/arm/undefined-insn-arm.d: New test.
	* testsuite/gas/arm/undefined-insn-thumb.d: New test.
	* testsuite/gas/arm/undefined-insn.s: New test.

opcodes/ChangeLog:

	* arm-dis.c (UNKNOWN_INSTRUCTION_32BIT): Format specifier for arm mode.
	(UNKNOWN_INSTRUCTION_16BIT): Format specifier for thumb mode.
	(print_insn_arm, print_insn_thumb16, print_insn_thumb32): Use them.
2018-10-19 10:33:11 +01:00
Fredrik Noring 33d64ca5db This set of changes clarifies the conditions for the R5900 short loop fix and extends its test with the border cases of six and seven instructions.
* testsuite/gas/mips/r5900.s: Extend the R5900 short loop fix
	test with border cases.
	* testsuite/gas/mips/r5900.d: Add extra expected disassembly.
	* config/tc-mips.c (can_swap_branch_p): Clarify the R5900 short
	loop hardware bug conditions.  Correct note on the R5900
	instruction count short loop fix.
2018-10-19 09:47:55 +01:00
GDB Administrator 08acaf5caf Automatic date update in version.in 2018-10-19 00:00:36 +00:00
Sergio Durigan Junior 94c18618a8 Fix PR cli/23785: Check if file exists when invoking "restore FILE binary"
This simple patch fixes the segfault reported on PR cli/23785, which
happens when using the "restore FILE binary" command with a
non-existent file.  We just have to check if the file handler returned
by "gdb_fopen_cloexec" is not NULL, and error out if it is.

A test has also been added to gdb.base/restore.exp in order to
exercise this scenario.

No regressions introduced.

gdb/ChangeLog:
2018-10-18  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR cli/23785
	* cli/cli-dump.c (restore_binary_file): Check if "file" is
	NULL.

gdb/testsuite/ChangeLog:
2018-10-18  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR cli/23785
	* gdb.base/restore.exp: New test to check if "restore" with an
	invalid file doesn't segfault.
2018-10-18 17:39:09 -04:00
Nick Clifton f63085d15f Update documentation of readelf's --unwind option.
* doc/binutils.texi (readelf): Document alternatives to the
	--unwind option if it is not supported for the target
	architecture.
2018-10-18 16:58:16 +01:00
Tom de Vries 812cd6eb05 [gdb/testsuite] Fix capitalized test names
At https://sourceware.org/gdb/wiki/GDBTestcaseCookbook\
  #Follow_the_test_name_convention we find:
..
Test names should start with a lower case and don't need to end with a period
(they are not sentences).
...

Fix some capitalized test names.

Tested on x86_64-linux.

2018-10-18  Tom de Vries  <tdevries@suse.de>

	* gdb.ada/bp_inlined_func.exp: Fix capitalized test name.
	* gdb.ada/excep_handle.exp: Same.
	* gdb.ada/mi_string_access.exp: Same.
	* gdb.ada/mi_var_union.exp: Same.
	* gdb.arch/arc-analyze-prologue.exp: Same.
	* gdb.arch/arc-decode-insn.exp: Same.
	* gdb.base/readnever.exp: Same.
	* gdb.fortran/printing-types.exp: Same.
	* gdb.guile/scm-lazy-string.exp: Same.
2018-10-18 15:06:38 +02:00
GDB Administrator 841ef605ee Automatic date update in version.in 2018-10-18 00:00:35 +00:00
Paul Koning 89eb3c5470 gdb/ChangeLog:
* charset.c (convert_between_encodings): Fix unsigned overflow.

    gdb/charset.c (convert_between_encodings): Fix unsigned overflow.
2018-10-17 19:26:55 -04:00
John Baldwin 6f3b1098e8 Share the code to format "info proc mappings" entries for FreeBSD.
gdb/ChangeLog:

	* fbsd-nat.c (fbsd_nat_target::info_proc) Use
	fbsd_info_proc_mappings_header and fbsd_info_proc_mappings_entry.
	* fbsd-tdep.c (fbsd_vm_map_entry_flags): Mark static.
	(fbsd_info_proc_mappings_header, fbsd_info_proc_mappings_entry):
	New functions.
	(fbsd_core_info_proc_mappings): Use fbsd_info_proc_mappings_header
	and fbsd_info_proc_mappings_header.
	* fbsd-tdep.h (fbsd_vm_map_entry_flags): Remove.
	(fbsd_info_proc_mappings_header, fbsd_info_proc_mappings_entry):
	New.
2018-10-17 11:42:00 -07:00
Joel Brobecker d500b4f23f gdb/MAINTAINERS: Add Rainer Orth as Solaris maintainer for GDB
gdb/ChangeLog:

	* MAINTAINERS (Responsible Maintainers): Add Rainer Orth as
	Solaris Maintainer.
2018-10-17 11:04:14 -07:00