Commit Graph

39414 Commits

Author SHA1 Message Date
Simon Marchi 7b005726f9 Add missing PR mention in ChangeLog
I noticed that the patch pushed previously had an open bug about it, so
add a reference to it.
2017-08-07 18:27:29 +02:00
Maciej W. Rozycki ba7b109b29 PR breakpoints/21886: mem-break: Fix breakpoint insertion location
Fix a commit cd6c3b4ffc ("New gdbarch methods breakpoint_kind_from_pc
and sw_breakpoint_from_kind") regression and restore the use of
`->placed_address' rather than `->reqstd_address' as the location for a
memory breakpoint to be inserted at.  Previously
`gdbarch_breakpoint_from_pc' was used that made that adjustment in
`default_memory_insert_breakpoint' from the preinitialized value,
however with the said commit that call is gone, so the passed
`->placed_address' has to be used for the initialization.

The regression manifests itself as the inability to debug any MIPS/Linux
compressed ISA dynamic executable as GDB corrupts the dynamic loader
with one of its implicit breakpoints, causing the program to crash, as
seen for example with the `mips-linux-gnu' target, o32 ABI, MIPS16 code,
and the gdb.base/advance.exp test case:

(gdb) continue
Continuing.

Program received signal SIGBUS, Bus error.
_dl_debug_initialize (ldbase=0, ns=0) at dl-debug.c:51
51	    r = &_r_debug;
(gdb) FAIL: gdb.base/advance.exp: Can't run to main

	gdb/
	PR breakpoints/21886
	* mem-break.c (default_memory_insert_breakpoint): Use
	`->placed_address' rather than `->reqstd_address' for the
	breakpoint location.
2017-08-07 17:02:04 +01:00
Maciej W. Rozycki e347efc38b GDB/opcodes: Remove arch/mach/endian disassembler assertions
Fix `set architecture' and `set endian' command disassembly regressions
from commit 39503f8242 ("Delegate opcodes to select disassembler in
GDB"), and commit 003ca0fd22 ("Refactor disassembler selection"), as
well as a MIPS compressed ISA disassembly target regression from commit
6394c60699 ("Don't use print_insn_XXX in GDB"), which caused assertion
failures to trigger.

For example with the `mips-linux-gnu' target we get:

$ cat main.c
int
main (void)
{
  return 0;
}
$ gcc -mips32r2 -O2 main.c -o main
$ gcc -mips16 -mips32r2 -O2 main.c -o main16
$ gdb
GNU gdb (GDB) 8.0.50.20170731-git
[...]
(gdb) file main
Reading symbols from main...done.
(gdb) show architecture
The target architecture is set automatically (currently mips:isa32r2)
(gdb) show endian
The target endianness is set automatically (currently big endian)
(gdb) disassemble main
Dump of assembler code for function main:
   0x00400500 <+0>:	jr	ra
   0x00400504 <+4>:	move	v0,zero
End of assembler dump.
(gdb) set architecture mips:isa64r2
The target architecture is assumed to be mips:isa64r2
(gdb) disassemble main
Dump of assembler code for function main:
   0x00400500 <+0>:
.../gdb/arch-utils.c:979: internal-error: int default_print_insn(bfd_vma, disassemble_info*): Assertion `info->mach == bfd_get_mach (exec_bfd)' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n
[...]
Command aborted.
(gdb) set architecture auto
The target architecture is set automatically (currently mips:isa32r2)
(gdb) set endian little
The target is assumed to be little endian
(gdb) disassemble main
Dump of assembler code for function main:
   0x00400500 <+0>:
.../gdb/arch-utils.c:978: internal-error: int default_print_insn(bfd_vma, disassemble_info*): Assertion `info->endian == (bfd_big_endian (exec_bfd) ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE)' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n
[...]
Command aborted.
(gdb) set endian auto
The target endianness is set automatically (currently big endian)
(gdb) set architecture i386
The target architecture is assumed to be i386
(gdb) disassemble main
Dump of assembler code for function main:
   0x00400500 <+0>:
.../gdb/arch-utils.c:976: internal-error: int default_print_insn(bfd_vma, disassemble_info*): Assertion `info->arch == bfd_get_arch (exec_bfd)' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n
[...]
Command aborted.
(gdb) set architecture auto
The target architecture is set automatically (currently mips:isa32r2)
(gdb) file main16
Load new symbol table from "main16"? (y or n) y
Reading symbols from main16...done.
(gdb) disassemble main
Dump of assembler code for function main:
   0x00400501 <+0>:
.../gdb/arch-utils.c:979: internal-error: int default_print_insn(bfd_vma, disassemble_info*): Assertion `info->mach == bfd_get_mach (exec_bfd)' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n
Command aborted.
(gdb)

Remove the assertions then, restoring previous semantics:

(gdb) file main
Reading symbols from main...done.
(gdb) set architecture mips:isa64r2
The target architecture is assumed to be mips:isa64r2
(gdb) disassemble main
Dump of assembler code for function main:
   0x00400500 <+0>:	jr	ra
   0x00400504 <+4>:	move	v0,zero
End of assembler dump.
(gdb) set endian little
The target is assumed to be little endian
(gdb) disassemble main
Dump of assembler code for function main:
   0x00400500 <+0>:	j	0x3800c
   0x00400504 <+4>:	addiu	s0,t0,0
End of assembler dump.
(gdb) set architecture i386
The target architecture is assumed to be i386
(gdb) disassemble main
Dump of assembler code for function main:
   0x00400500 <+0>:	add    %eax,%esp
   0x00400502 <+2>:	add    %cl,(%eax)
   0x00400504 <+4>:	add    %al,(%eax)
   0x00400506 <+6>:	adc    %ah,0x0
End of assembler dump.
(gdb) set architecture auto
The target architecture is set automatically (currently mips:isa32r2)
(gdb) set endian auto
The target endianness is set automatically (currently big endian)
(gdb) file main16
Load new symbol table from "main16"? (y or n) y
Reading symbols from main16...done.
(gdb) disassemble main
Dump of assembler code for function main:
   0x00400501 <+0>:	jr	ra
   0x00400503 <+2>:	li	v0,0
End of assembler dump.
(gdb)

	gdb/
	* arch-utils.c (default_print_insn): Remove arch/mach/endian
	assertions.

	opcodes/
	* disassemble.c (disassembler): Remove arch/mach/endian
	assertions.
2017-08-07 15:53:54 +01:00
Maciej W. Rozycki 0dba2a6c09 gdbarch: Use an anonymous union for target data in `gdbarch_info'
As an update to commit ede5f15146 ("gdbarch.h: Change
gdbarch_info::tdep_info's type to void *") replace the definition of the
`tdep_info' member in `struct gdbarch_info' with an anonymous union,
comprising the original member, with its type reverted to `struct
gdbarch_tdep_info *', a `tdesc_data' member of a `struct tdesc_arch_data
*' type and an `id' member of an `int *' type.  Remove now unnecessary
casts throughout use places then, making code easier to read an less
prone to errors, which may happen with casting.

	gdb/
	* gdbarch.sh (gdbarch_info): Replace the `tdep_info' member with
	a union of `tdep_info', `tdesc_data' and `id'.
	* aarch64-tdep.c (aarch64_gdbarch_init): Use `info.tdesc_data'
	rather than `info.tdep_info'.
	* amd64-linux-tdep.c (amd64_linux_init_abi): Likewise.
	* i386-linux-tdep.c (i386_linux_init_abi): Likewise.
	* i386-tdep.c (i386_gdbarch_init): Likewise.
	* mips-linux-tdep.c (mips_linux_init_abi): Likewise.
	* mips-tdep.c (mips_gdbarch_init): Likewise.
	* nds32-tdep.c (nds32_gdbarch_init): Likewise.
	* rs6000-tdep.c (rs6000_gdbarch_init): Likewise.
	* ppc-linux-tdep.c (ppu2spu_sniffer): Use `info.id' rather than
	`info.tdep_info'.
	(ppc_linux_init_abi): Use `info.tdesc_data' rather than
	`info.tdep_info'.
	* sparc-tdep.c (sparc32_gdbarch_init): Likewise.
	* spu-multiarch.c (spu_gdbarch): Use `info.id' rather than
	`info.tdep_info'.
	* spu-tdep.c (spu_gdbarch_init): Likewise.
	* gdbarch.h: Regenerate.
2017-08-07 15:53:54 +01:00
Leszek Swirski 16eb6b2db4 Fix dwarf2_string_attr for -gsplit-dwarf
The dwarf2_string_attr did not allow DW_FORM_GNU_str_index as a form for
string types. This manifested as null strings in the namespace_name
lookup (replaced with "(anonymous namespace)") when debugging
Fission-compiled code.

gdb/ChangeLog:

	* dwarf2read.c (dwarf2_string_attr): Allow DW_FORM_GNU_strp_alt.
2017-08-07 16:40:46 +02:00
Simon Marchi 74cbb09e74 remote-sim.c: Fix arg variables conflicts
The recent change introducing gdb_argv introduced some build failures in
remote-sim.c.

  /home/emaisin/src/binutils-gdb/gdb/remote-sim.c: In function 'void gdbsim_load(target_ops*, const char*, int)':
  /home/emaisin/src/binutils-gdb/gdb/remote-sim.c:573:22: error: conflicting declaration 'gdb_argv argv'
     gdb_argv argv (args);
                        ^
  /home/emaisin/src/binutils-gdb/gdb/remote-sim.c:565:10: note: previous declaration as 'char** argv'
     char **argv;
            ^~~~
  /home/emaisin/src/binutils-gdb/gdb/remote-sim.c: In function 'void gdbsim_open(const char*, int)':
  /home/emaisin/src/binutils-gdb/gdb/remote-sim.c:730:25: error: declaration of 'gdb_argv args' shadows a parameter
     gdb_argv args (arg_buf);

In gdbsim_load, the new gdb_argv object conflicts with old char **argv
variable.  I think the old variable should be removed.

In gdbsim_open, the new gdb_argv object conflicts with the args
parameter.  This patch renames it to argv.

Built-tested for a mips host.

gdb/ChangeLog:

	* remote-sim.c (gdbsim_load): Remove char **argv local variable.
	(gdbsim_open): Rename gdb_argv args object to argv.
2017-08-07 12:13:00 +02:00
Tom Tromey ee0c32930c Use gdb::unique_xmalloc_ptr when calling tilde_expand
This patch changes most sites calling tilde_expand to use
gdb::unique_xmalloc_ptr, rather than a cleanup.  It also changes
scan_expression_with_cleanup to return a unique pointer, because the
patch was already touching code in that area.

Regression tested on the buildbot.

ChangeLog
2017-08-05  Tom Tromey  <tom@tromey.com>

	* compile/compile-object-load.c (compile_object_load): Use
	gdb::unique_xmalloc_ptr.
	* cli/cli-dump.c (scan_filename): Rename from
	scan_filename_with_cleanup.  Change return type.
	(scan_expression): Rename from scan_expression_with_cleanup.
	Change return type.
	(dump_memory_to_file, dump_value_to_file, restore_command):
	Use gdb::unique_xmalloc_ptr.  Update.
	* cli/cli-cmds.c (find_and_open_script): Use
	gdb::unique_xmalloc_ptr.
	* tracefile-tfile.c (tfile_open): Use gdb::unique_xmalloc_ptr.
	* symmisc.c (maintenance_print_symbols)
	(maintenance_print_msymbols): Use gdb::unique_xmalloc_ptr.
	* symfile.c (symfile_bfd_open, generic_load)
	(add_symbol_file_command, remove_symbol_file_command): Use
	gdb::unique_xmalloc_ptr.
	* source.c (openp): Use gdb::unique_xmalloc_ptr.
	* psymtab.c (maintenance_print_psymbols): Use
	gdb::unique_xmalloc_ptr.
	* corelow.c (core_open): Use gdb::unique_xmalloc_ptr.
	* breakpoint.c (save_breakpoints): Use gdb::unique_xmalloc_ptr.
	* solib.c (solib_map_sections): Use gdb::unique_xmalloc_ptr.
	(reload_shared_libraries_1): Likewise.
2017-08-05 15:52:49 -06:00
Tom Tromey fdffd6f411 Fix Rust test suite for 1.20 beta
I ran the gdb.rust tests against Rust 1.20 (beta) and saw a few
failures.  The failures all came because a particular item moved to a
different module.  Since the particular choice of module name isn't
important here, I simply widened the allowable results.

Tested locally against rustc 1.19, 1.20, and 1.21.

testsuite/ChangeLog
2017-08-05  Tom Tromey  <tom@tromey.com>

	* gdb.rust/simple.exp: Allow String to appear in a different
	namespace.
2017-08-05 15:38:32 -06:00
Tom Tromey 3232fabd2d Remove cleanups from Rust parser
This removes the few remaining cleanups in the Rust language code.
The main difficulty here was that the earlier code allocated VEC heads
on an obstack.  The new code instead introduces an object that
allocates and maintains the storage for whatever vectors are needed
during the parse.

Regression tested on the buildbot.

ChangeLog
2017-08-05  Tom Tromey  <tom@tromey.com>

	* rust-exp.y (rust_op_ptr, set_field): Remove typedefs.
	(rust_op_vector, rust_set_vector): New typedefs.
	(current_parser): New global.
	(work_obstack): Change to pointer type.  Update all users.
	(rust_ast, pstate): Remove globals.
	(struct rust_parser): New.
	(%union) <params, field_inits>: Change type.
	(start, tuple_expr, unit_expr, struct_expr_list, literal)
	(field_expr, expr_list, maybe_expr_list, type_list): Update.
	(ast_call_ish, ast_path, ast_function_type, ast_tuple_type)
	(convert_params_to_types, convert_params_to_expression): Change
	type of "params".
	(ast_string): Change type of "fields".
	(rust_parse): Make a rust_parser.  Remove cleanups.
	(rust_lex_tests): Make and install an auto_obstack.
2017-08-05 11:14:06 -06:00
Yao Qi f02fd7745d Unbreak GDBserver build for x32
When I verify my target description changes, I build GDB and GDBserver for
x32, but it failed.

/../../binutils-gdb/gdb/gdbserver/linux-amd64-ipa.c
../../../binutils-gdb/gdb/gdbserver/linux-amd64-ipa.c: In function ‘const target_desc* get_ipa_tdesc(int)’:
../../../binutils-gdb/gdb/gdbserver/linux-amd64-ipa.c:184:10: error: ‘X86_TDESC_AVX512’ was not declared in this scope
     case X86_TDESC_AVX512:
          ^
../../../binutils-gdb/gdb/gdbserver/linux-amd64-ipa.c:185:14: error: ‘tdesc_x32_avx512_linux’ was not declared in this scope
       return tdesc_x32_avx512_linux;
              ^
../../../binutils-gdb/gdb/gdbserver/linux-amd64-ipa.c: In function ‘void initialize_low_tracepoint()’:
../../../binutils-gdb/gdb/gdbserver/linux-amd64-ipa.c:282:36: error: ‘init_registers_x32_avx512_linux’ was not declared in this scope
   init_registers_x32_avx512_linux ();
                                    ^

ipa_x32_linux_regobj use to be there, but removed by
22049425ce by mistake.

gdb/gdbserver:

2017-08-04  Yao Qi  <yao.qi@linaro.org>

	* configure.srv (ipa_x32_linux_regobj): New.
	* linux-amd64-ipa.c (get_ipa_tdesc): Use X86_TDESC_AVX_AVX512
	instead of X86_TDESC_AVX512.
	(initialize_low_tracepoint): Call
	init_registers_x32_avx_avx512_linux.
2017-08-04 16:06:01 +01:00
Yao Qi 91975afd35 Add namespace std to nullptr_t
This patch fixes the build failure for target i686-w64-mingw32,

In file included from ../../binutils-gdb/gdb/defs.h:786:0,
                 from ../../binutils-gdb/gdb/gdb.c:19:
../../binutils-gdb/gdb/utils.h:188:20: error: ‘nullptr_t’ has not been declared
   bool operator!= (nullptr_t)
                    ^
../../binutils-gdb/gdb/utils.h:193:20: error: ‘nullptr_t’ has not been declared
   bool operator== (nullptr_t)
                    ^

gdb:

2017-08-04  Yao Qi  <yao.qi@linaro.org>

	* utils.h (gdb_argv): Add namespace std for nullptr_t.
2017-08-04 14:27:58 +01:00
Ruslan Kabatsayev 2331fa3af5 Add myself as a write-after-approval GDB maintainer. 2017-08-03 22:23:22 +03:00
Tom Tromey 744e4fe1db Remove make_cleanup_freeargv and gdb_buildargv
After the previous patches in this series, make_cleanup_freeargv and
gdb_buildargv are now unused and can be removed.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* utils.c (make_cleanup_freeargv, do_freeargv, gdb_buildargv):
	Remove.
	* utils.h (make_cleanup_freeargv, gdb_buildargv): Remove.
2017-08-03 07:59:10 -06:00
Tom Tromey 1c034b67a0 Use gdb_argv in Python
This changes one spot in the Python code to use gdb_argv.  This
removes the last cleanup from the Python layer.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* python/py-param.c (compute_enum_values): Use gdb_argv.
2017-08-03 07:59:09 -06:00
Tom Tromey 773a1edcd1 Introduce gdb_argv, a class wrapper for buildargv
This introduces gdb_argv, a class wrapping an "argv" pointer; that is,
a pointer to a NULL-terminated array of char*, where both the array
and each non-NULL element in the array are xmalloc'd.

This patch then changes most users of gdb_buildargv to use gdb_argv
instead.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* utils.h (struct gdb_argv_deleter): New.
	(gdb_argv): New class.
	* utils.c (gdb_argv::reset): New method.
	* tracepoint.c (delete_trace_variable_command): Use gdb_argv.
	* tracefile.c (tsave_command): Use gdb_argv.
	* top.c (new_ui_command): Use gdb_argv.
	* symmisc.c (maintenance_print_symbols)
	(maintenance_print_msymbols, maintenance_expand_symtabs): Use gdb_argv.
	* symfile.c (symbol_file_command, generic_load)
	(remove_symbol_file_command): Use gdb_argv.
	* stack.c (backtrace_command): Use gdb_argv.
	* source.c (add_path, show_substitute_path_command)
	(unset_substitute_path_command, set_substitute_path_command):
	Use gdb_argv.
	* skip.c (skip_command): Use gdb_argv.  Use gdb_buildargv.
	* ser-mingw.c (pipe_windows_open): Use gdb_argv.
	* remote.c (extended_remote_run, remote_put_command)
	(remote_get_command, remote_delete_command): Use gdb_argv.
	* remote-sim.c (gdbsim_load, gdbsim_create_inferior)
	(gdbsim_open): Use gdb_argv.
	* python/py-cmd.c (gdbpy_string_to_argv): Use gdb_argv.
	* psymtab.c (maintenance_print_psymbols): Use gdb_argv.
	* procfs.c (procfs_info_proc): Use gdb_argv.
	* interps.c (interpreter_exec_cmd): Use gdb_argv.
	* infrun.c (handle_command): Use gdb_argv.
	* inferior.c (add_inferior_command, clone_inferior_command):
	Use gdb_argv.
	* guile/scm-string.c (gdbscm_string_to_argv): Use gdb_argv.
	* exec.c (exec_file_command): Use gdb_argv.
	* cli/cli-cmds.c (alias_command): Use gdb_argv.
	* compile/compile.c (build_argc_argv): Use gdb_argv.
2017-08-03 07:59:08 -06:00
Tom Tromey 0d50bde32b Remove a cleanup in Python
This removes cleanups from gdbpy_decode_line, in favor of a use of
unique_xmalloc_ptr.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* python/python.c (gdbpy_decode_line): Use unique_xmalloc_ptr.
2017-08-03 07:59:07 -06:00
Tom Tromey 7f968c899f Avoid some manual memory management in Python
This changes a few places in the Python code to avoid manual memory
management, in favor of letting std::string do the work.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* python/python.c (compute_python_string): Return std::string.
	(gdbpy_eval_from_control_command): Update.
	(do_start_initialization): Use std::string.
	* python/py-varobj.c (py_varobj_iter_next): Use string_printf, not
	xstrprintf.
	* python/py-breakpoint.c (local_setattro): Use string_printf, not
	xstrprintf.
2017-08-03 07:59:07 -06:00
Tom Tromey 3c9ebddd93 Replace do_restore_instream_cleanup with scoped_restore
This changes the users of do_restore_instream_cleanup to use a
scoped_restore instead.  This patch is broken out because it warrants
some additional attention: in particular it's unclear to me whether
current_ui can change in the body of these functions -- but if it can,
then the cleanup would have modified a different UI's instream member.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* top.h (do_restore_instream_cleanup): Remove.
	* top.c (do_restore_instream_cleanup): Remove.
	(read_command_file): Use scoped_restore.
	* cli/cli-script.c (execute_user_command): Use scoped_restore.
2017-08-03 07:59:06 -06:00
Tom Tromey b51b225eb9 Use a scoped_restore for command_nest_depth
This changes a couple of places to use a scoped_restore when
manipulating command_nest_depth.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* cli/cli-script.c (execute_user_command)
	(execute_control_command): Use scoped_restore.
2017-08-03 07:59:05 -06:00
Tom Tromey ac991630ca Remove user_call_depth
This changes execute_user_command to remove user_call_depth, using the
size of user_args_stack instead.  This avoids a cleanup.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* cli/cli-script.c (do_restore_user_call_depth): Remove.
	(execute_user_command): Remove user_call_depth; use
	user_args_stack's size instead.
2017-08-03 07:59:04 -06:00
Tom Tromey 898e0c8e87 Remove in_user_command
While working on the next patch in this series, I found that the
global in_user_command is not used.  This patch removes it.  (I didn't
think to check Insight until submitting this series; and it's not very
convenient to do so, so if someone has it checked out and could look
at it, that would be nice.)

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* top.h (in_user_command): Remove.
	* top.c (in_user_command): Remove.
	* cli/cli-script.c (do_restore_user_call_depth)
	(execute_user_command): Update.
2017-08-03 07:59:03 -06:00
Tom Tromey 26fcd5d757 Use containers to avoid cleanups
This patch introduces the use of various containers -- std::vector,
std::string, or gdb::byte_vector -- in several spots in gdb that were
using xmalloc and a cleanup.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* valops.c (search_struct_method): Use gdb::byte_vector.
	* valarith.c (value_concat): Use std::vector.
	* target.c (memory_xfer_partial): Use gdb::byte_vector.
	(simple_search_memory): Likewise.
	* printcmd.c (find_string_backward): Use gdb::byte_vector.
	* mi/mi-main.c (mi_cmd_data_write_memory): Use gdb::byte_vector.
	* gcore.c (gcore_copy_callback): Use gdb::byte_vector.
	* elfread.c (elf_rel_plt_read): Use std::string.
	* cp-valprint.c (cp_print_value): Use gdb::byte_vector.
	* cli/cli-dump.c (restore_section_callback): Use
	gdb::byte_vector.
2017-08-03 07:59:02 -06:00
Tom Tromey 7c218e6c9c Use unique_xmalloc_ptr in jit.c
This removes some cleanups from jit.c by using unique_xmalloc_ptr
instead.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* jit.c (jit_reader_load_command): Use unique_xmalloc_ptr.
2017-08-03 07:59:01 -06:00
Tom Tromey 31b68d4ad7 Replace tui_restore_gdbout with scoped_restore
This patch replaces tui_restore_gdbout (a cleaup function) with a use
of scoped_restore.  This one is broken out into its own patch because
it might slightly change the behavior of gdb: it saves and restores
pagination_enabled, whereas the tui_restore_gdbout unconditionally set
pagination_enabled to 1; and I think this warrants closer review.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.c (tui_restore_gdbout): Remove.
	(tui_register_format): Use scoped_restore.
2017-08-03 07:59:01 -06:00
Tom Tromey 2ec845e758 More uses of scoped_restore
There were a few more places in gdb that could easily use
scoped_restore, replacing some cleanups.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* reverse.c (exec_direction_default): Remove.
	(exec_reverse_once): Use scoped_restore.
	* remote.c (restore_remote_timeout): Remove.
	(remote_flash_erase, remote_flash_write, remote_flash_done)
	(readchar, remote_serial_write): Use scoped_restore.
	* cli/cli-script.c (struct source_cleanup_lines_args)
	(source_cleanup_lines): Remove.
	(script_from_file): Use scoped_restore.
	* cli/cli-cmds.c (source_verbose_cleanup): Remove.
	(source_command): Use scoped_restore.
2017-08-03 07:59:00 -06:00
Tom Tromey b3bc84537b Remove make_cleanup_free_so
make_cleanup_free_so is used in a single spot.  This patch introduces
a unique pointer wrapper for struct so_list, and changes this spot to
use it.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* utils.h (make_cleanup_free_so): Remove.
	* utils.c (do_free_so, make_cleanup_free_so): Remove.
	* solist.h (struct so_deleter): New.
	(so_list_up): New typedef.
	* solib-svr4.c (svr4_read_so_list): Use so_list_up.
2017-08-03 07:58:59 -06:00
Tom Tromey e3ad2841b1 Remove make_cleanup_restore_current_language
This patch replaces make_cleanup_restore_current_language with an RAII
class that saves the current language, and restores it when the object
is destroyed.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* utils.h (make_cleanup_restore_current_language): Remove.
	* utils.c (do_restore_current_language)
	(make_cleanup_restore_current_language): Remove.
	* parse.c (parse_exp_in_context_1)
	(parse_expression_with_language): Use
	scoped_restore_current_language.
	* mi/mi-main.c (mi_cmd_execute): Use
	scoped_restore_current_language.
	* language.h (scoped_restore_current_language): New class.
2017-08-03 07:58:58 -06:00
Tom Tromey b80cf83844 Remove an unlink cleanup
compile/compile.c had its own cleanup to unlink a file.  This patch
replaces this cleanup with gdb::unlinker.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* compile/compile.c (cleanup_unlink_file): Remove.
	(compile_to_object): Use gdb::unlinker.
	(eval_compile_command): Likewise.
2017-08-03 07:58:57 -06:00
Tom Tromey fad0444a57 Remove make_cleanup_fclose
After the preceding patches, make_cleanup_fclose is no longer used, so
remove it.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* utils.h (make_cleanup_fclose): Remove.
	* utils.c (do_fclose_cleanup, make_cleanup_fclose): Remove.
2017-08-03 07:58:56 -06:00
Tom Tromey 6e7bc05c53 Change open_terminal_stream to return a gdb_file_up
This changes open_terminal_stream to return a gdb_file_up, eliminating
another use of make_cleanup_fclose.  Arguably perhaps new_ui should
take ownership of the files using a move, but there is at least one
spot where this isn't appropriate (or at least not currently done), so
I elected to use a more minimal approach.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* top.c (open_terminal_stream): Return gdb_file_up.
	(new_ui_command): Update.
2017-08-03 07:58:55 -06:00
Tom Tromey 4a45905b82 Use gdb_file_up in source.c
This changes some functions in source.c to use gdb_file_up.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* source.c (print_source_lines_base, forward_search_command)
	(reverse_search_command): Use gdb_file_up.
2017-08-03 07:58:54 -06:00
Tom Tromey 7cd06d6e89 Use gdb_file_up in fbsd-nat.c
This updates fbsd-nat.c to use gdb_file_up.  This removes a use of a
cleanup, and helps remove make_cleanup_fclose in a later patch.

I have no way to test this patch.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* fbsd-nat.c (fbsd_find_memory_regions): Update.
2017-08-03 07:58:54 -06:00
Tom Tromey ed1669453b Change return type of find_and_open_script
This changes find_and_open_script to return a
gdb::optional<open_script>, where open_script is a new type
encapsulating the two return values.  The new type helps avoid
cleanups in the callers.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* cli/cli-cmds.c (find_and_open_script): Change return type.
	Remove "streamp" and "full_path" parameters.
	(source_script_with_search): Update.
	* auto-load.c (source_script_file): Update.
	* cli/cli-cmds.h (find_and_open_script): Change type.
	(open_script): New struct.
2017-08-03 07:58:53 -06:00
Tom Tromey d419f42dd3 Introduce and use gdb_file_up
This introduces gdb_file_up, a unique pointer holding a FILE*, and
then changes some code in gdb to use it.  In particular
gdb_fopen_cloexec now returns a gdb_file_up.  This allow removing some
cleanups.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* xml-support.c (xml_fetch_content_from_file): Update.
	* ui-file.c (stdio_file::open): Update.
	* tracefile-tfile.c (tfile_start): Update.
	* remote.c (remote_file_put, remote_file_get): Update.
	* nat/linux-procfs.c (linux_proc_get_int)
	(linux_proc_pid_get_state, linux_proc_tid_get_name): Update.
	* nat/linux-osdata.c (linux_common_core_of_thread): Update.
	(command_from_pid, commandline_from_pid, linux_xfer_osdata_cpus)
	(print_sockets, linux_xfer_osdata_shm, linux_xfer_osdata_sem)
	(linux_xfer_osdata_msg, linux_xfer_osdata_modules): Update.
	* nat/linux-btrace.c (linux_determine_kernel_start): Update.
	* linux-nat.c (linux_proc_pending_signals): Update.
	* dwarf2read.c (write_psymtabs_to_index): Use gdb_file_up.
	(file_closer): Remove.
	* compile/compile.c (compile_to_object): Update.
	* common/filestuff.h (struct gdb_file_deleter): New.
	(gdb_file_up): New typedef.
	(gdb_fopen_cloexec): Change return type.
	* common/filestuff.c (gdb_fopen_cloexec): Return gdb_file_up.
	* cli/cli-dump.c (fopen_with_cleanup): Remove.
	(dump_binary_file, restore_binary_file): Update.
	* auto-load.c (auto_load_objfile_script_1): Update.
2017-08-03 07:58:52 -06:00
Tom Tromey 4a2b031d54 Introduce and use ui_out_emit_table
This introduces ui_out_emit_table, similar to the other existing
ui_out RAII classes, and then uses it in a number of places.  This
replaces some cleanups.

ChangeLog
2017-08-03  Tom Tromey  <tom@tromey.com>

	* tracepoint.c (tvariables_info_1): Use ui_out_emit_table.
	(info_static_tracepoint_markers_command): Likewise.
	* solib.c (info_sharedlibrary_command): Use ui_out_emit_table.
	* skip.c (skip_info): Use ui_out_emit_table.
	* progspace.c (print_program_space): Use ui_out_emit_table.
	* osdata.c (info_osdata): Use ui_out_emit_table.
	* mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Use
	ui_out_emit_table.
	* linux-thread-db.c (info_auto_load_libthread_db): Use
	ui_out_emit_table.
	* inferior.c (print_inferior): Use ui_out_emit_table.
	* gdb_bfd.c (maintenance_info_bfds): Use ui_out_emit_table.
	* breakpoint.c (breakpoint_1): Use ui_out_emit_table.
	* auto-load.c (auto_load_info_scripts): Use ui_out_emit_table.
	* ada-tasks.c (print_ada_task_info): Use ui_out_emit_table.
	* ui-out.h (class ui_out_emit_table): New.
2017-08-03 07:58:51 -06:00
Maciej W. Rozycki a4f320fd1b MIPS: Factor out FPU type naming in `gdbarch' debug
Replace chains of conditional expressions used in target-dependent MIPS
`gdbarch' debug output to get a textual name of the FPU type with calls
to a helper decoder function, improving code readability.  No functional
change.

	gdb/
	* mips-tdep.c (mips_fpu_type_str): New function.
	(mips_dump_tdep): Call it.
2017-08-02 16:40:16 +01:00
Maciej W. Rozycki a2f1f30853 MIPS: Consistently use MIPS_FPU_TYPE for `gdbarch' member
Complement commit 74ed0bb414 ("Replace current_gdbarch in *mips*"),
<https://sourceware.org/ml/gdb-patches/2008-06/msg00490.html>, and
consistently use the MIPS_FPU_TYPE macro to access the `->mips_fpu_type'
target-dependent `gdbarch' member.  No functional change.

	gdb/
	* mips-tdep.c (mips_gdbarch_init): Use MIPS_FPU_TYPE to access
	`->mips_fpu_type'.
2017-08-01 19:32:25 +01:00
Xavier Roirand 7e5ed83b22 Update ChangeLog (missed that in my previous commit)
gdb/
        * ChangeLog: Add previous commit entry

Change-Id: Ic4f07cca66126e73340f032f19a2d5029bf0d40a
2017-07-31 14:37:33 +02:00
Simon Marchi 791fb3d7a5 Fix documentation about rot agent expression bytecode
The rot agent expression bytecode rotates the three items on the top of
the stack.  It is not clear which way the rotation is.  However, the
documentation currently shows this as the effect of the instructions:

   a b c => c b a

which doesn't make sense, since the value b doesn't move.  The two
valid possibilities I see are

  a b c => b c a
  a b c => c a b

depending on which way you rotate.

When looking at the gdbserver code, the top of the stack becomes the
third item, and the next-to-top item becomes the top.  So the second
form would be the right one, since in this notation the top of the stack
is the rightmost element:

  a b c => c a b

I adjusted the symbolic description and added a bit of text to make it
more obvious.

gdb/doc/ChangeLog:

	* agentexpr.texi (rot): Fix symbolic description, improve
	textual description.
2017-07-31 11:26:50 +02:00
Xavier Roirand 4bbd4ef219 darwin: handle recent version of dyld
gdb/
        * solib-darwin.c (DYLD_VERSION_MAX): Increase value.

Change-Id: I45da25f46b3e452d44993b122a994c818d00020b
2017-07-31 11:10:14 +02:00
Xavier Roirand 4c9dc81149 Add myself as a write-after-approval GDB maintainer.
gdb/Changelog:

2017-07-27  Xavier Roirand  <roirand@adacore.com>

        * MAINTAINERS (Write After Approval): Add Xavier Roirand.

Change-Id: Iee1dae7597da8f2c8c3098c14649ff400a81a388
2017-07-27 16:06:55 +02:00
Yao Qi 27d41eac62 Add "maint check xml-descriptions" to test builtin xml target descriptions
Now, GDB is able to dynamically create i386-linux target descriptions
from features, instead of using pre-generated target descriptions.  These
pre-generated target descriptions are no longer used by GDB (note that
they are still used by GDBserver).

This patch add a new maint command "maint check xml-descriptions" to test
dynamically generated tdesc are identical to these generated from xml files.

gdb:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

	* cli/cli-cmds.c (maintenancechecklist): New variable.
	* gdbcmd.h (maintenancechecklist): Declare it.
	* i386-linux-tdep.c (_initialize_i386_linux_tdep) [GDB_SELF_TEST]:
	Call i386_linux_read_description with different masks.
	* maint.c (maintenance_check_command): New function.
	(_initialize_maint_cmds): Call add_prefix_cmd.
	* target-descriptions.c (tdesc_reg): override operator != and ==.
	(tdesc_type): Likewise.
	(tdesc_feature): Likewise.
	(target_desc): Likewise.
	[GDB_SELF_TEST] (selftests::record_xml_tdesc): New function.
	(maintenance_check_xml_descriptions): New function.
	(_initialize_target_descriptions) Add command "xml-descriptions".
	* target-descriptions.h (selftests::record_xml_tdesc): Declare.

gdb/testsuite:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

	* gdb.gdb/unittest.exp: Invoke command
	"maintenance check xml-descriptions".

gdb/doc:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

	* gdb.texinfo (Maintenance Commands): Document command
	"maint check xml-descriptions".
2017-07-26 14:55:31 +01:00
Yao Qi ea03d0d3c3 Lazily and dynamically create i386-linux target descriptions
Instead of using pre-generated target descriptions, this patch
changes GDB to lazily and dynamically create target descriptions
according to the target hardware capability (xcr0 in i386).
This support any combination of target features.

Some reg in target description has "regnum" attribute, so its register
number is got from the attribute value instead from sequential allocation.

  <reg name="xmm0" bitsize="128" type="vec128" regnum="32"/>

when target description is created, it should match the regnum, so this
patch adds a new field m_next_regnum to track it, if attribute number is
greater than the m_next_regnum, print the code to set register number
explicitly.

gdb:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

	* i386-linux-tdep.c: Don't include features/i386/i386-*linux.c.
	Include features/i386/32bit-*.c.
	(i386_linux_read_description): Generate target description if it
	doesn't exist.
	(_initialize_i386_linux_tdep): Don't call _initialize_tdesc_i386
	functions.
	* features/i386/32bit-linux.c: Re-generated.
	* features/i386/32bit-sse.c: Likewise.
	* target-descriptions.c (print_c_feature::visit): Print code to
	set register number if needed.
	(print_c_feature) <m_next_regnum>: New field.
2017-07-26 14:39:54 +01:00
Yao Qi 25aa13e522 Generate c for feature instead of tdesc
This patch changes Makefile and command "maint print c-files" so
that GDB can print c files for features instead target description.
Previously, we feed GDB a target description xml file, which generate
c files including multiple features.

With this patch, in Makefile, we wrap each feature xml file, and
create a temp target description which include only one feature.
Then, adjust the target description printer for them, and print
a c function for each given feature, so that we can use these
c functions later to create target description in a flexible way.

gdb:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

	* features/Makefile (CFILES): Rename with TDESC_CFILES.
	(FEATURE_XMLFILES): New.
	(FEATURE_CFILES): New.
	New rules.
	(clean-cfiles): Remove generated c files.
	* features/i386/32bit-avx.c: Generated.
 	* features/i386/32bit-avx512.c: Generated.
 	* features/i386/32bit-core.c: Generated.
 	* features/i386/32bit-linux.c: Generated.
 	* features/i386/32bit-mpx.c: Generated.
 	* features/i386/32bit-pkeys.c: Generated.
 	* features/i386/32bit-sse.c: Generated.
 	* target-descriptions.c: Include algorithm.
	(tdesc_element_visitor): Add method visit_end.
	(print_c_tdesc): Implement visit_end.
	(print_c_tdesc:: m_filename_after_features): Move it to
	protected.
	(print_c_feature): New class.
	(maint_print_c_tdesc_cmd): Use print_c_feature if XML file
	name starts with "i386/32bit-".
2017-07-26 14:24:08 +01:00
Yao Qi 6eb1e6a8c1 Use visitor pattern for "maint print c-tdesc"
Target description can be modeled as a tree, the target description
is the root node, features are children nodes, registers and types are
grand-children nodes.  So command "maint print c-tdesc" in effect
traverse/visit each node, and print them in c.  This can be
implemented by visitor pattern, this is the first reason.  Secondly,
I want to this command prints c files in a different way for some
specific xml files, but still print c files the same way for the rest
of xml files.  Third, I even want to print xml files from target
descriptions, so that GDBserver can use it to reply GDB's query
qXfer:features:read:target.xml.

gdb:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

	* target-descriptions.c (tdesc_element_visitor): New class.
	(tdesc_element): New class.
	(tdesc_reg): Inherit from tdesc_element.
	(tdesc_reg::accept): New function.
	(tdesc_type): Inherit from tdesc_element.
	(tdesc_type::accept): New function.
	(tdesc_feature): Inherit from tdesc_element.
	(tdesc_feature::accept): New function.
	(target_desc): Inherit from tdesc_element.
	(target_desc::target_desc): New.
	(target_desc::~target_desc): New.
	(target_desc::accept): New.
	(allocate_target_description): Use new.
	(free_target_description): Use delete.
	(print_c_tdesc): New class.
	(maint_print_c_tdesc_cmd): Adjust.

	* features/aarch64.c: Re-generated.
	* features/arc-arcompact.c: Re-generated.
	* features/arc-v2.c: Re-generated.
	* features/arm/arm-with-iwmmxt.c: Re-generated.
	* features/arm/arm-with-m.c: Re-generated.
	* features/arm/arm-with-m-fpa-layout.c: Re-generated.
	* features/arm/arm-with-m-vfp-d16.c: Re-generated.
	* features/arm/arm-with-neon.c: Re-generated.
	* features/arm/arm-with-vfpv2.c: Re-generated.
	* features/arm/arm-with-vfpv3.c: Re-generated.
	* features/i386/amd64-avx-avx512.c: Re-generated.
	* features/i386/amd64-avx-avx512-linux.c: Re-generated.
	* features/i386/amd64-avx.c: Re-generated.
	* features/i386/amd64-avx-linux.c: Re-generated.
	* features/i386/amd64-avx-mpx-avx512-pku.c: Re-generated.
	* features/i386/amd64-avx-mpx-avx512-pku-linux.c: Re-generated.
	* features/i386/amd64-avx-mpx.c: Re-generated.
	* features/i386/amd64-avx-mpx-linux.c: Re-generated.
	* features/i386/amd64.c: Re-generated.
	* features/i386/amd64-linux.c: Re-generated.
	* features/i386/amd64-mpx.c: Re-generated.
	* features/i386/amd64-mpx-linux.c: Re-generated.
	* features/i386/i386-avx-avx512.c: Re-generated.
	* features/i386/i386-avx-avx512-linux.c: Re-generated.
	* features/i386/i386-avx.c: Re-generated.
	* features/i386/i386-avx-linux.c: Re-generated.
	* features/i386/i386-avx-mpx-avx512-pku.c: Re-generated.
	* features/i386/i386-avx-mpx-avx512-pku-linux.c: Re-generated.
	* features/i386/i386-avx-mpx.c: Re-generated.
	* features/i386/i386-avx-mpx-linux.c: Re-generated.
	* features/i386/i386.c: Re-generated.
	* features/i386/i386-linux.c: Re-generated.
	* features/i386/i386-mmx.c: Re-generated.
	* features/i386/i386-mmx-linux.c: Re-generated.
	* features/i386/i386-mpx.c: Re-generated.
	* features/i386/i386-mpx-linux.c: Re-generated.
	* features/i386/x32-avx-avx512.c: Re-generated.
	* features/i386/x32-avx-avx512-linux.c: Re-generated.
	* features/i386/x32-avx.c: Re-generated.
	* features/i386/x32-avx-linux.c: Re-generated.
	* features/i386/x32.c: Re-generated.
	* features/i386/x32-linux.c: Re-generated.
	* features/microblaze.c: Re-generated.
	* features/microblaze-with-stack-protect.c: Re-generated.
	* features/mips64-dsp-linux.c: Re-generated.
	* features/mips64-linux.c: Re-generated.
	* features/mips-dsp-linux.c: Re-generated.
	* features/mips-linux.c: Re-generated.
	* features/nds32.c: Re-generated.
	* features/nios2.c: Re-generated.
	* features/nios2-linux.c: Re-generated.
	* features/rs6000/powerpc-32.c: Re-generated.
	* features/rs6000/powerpc-32l.c: Re-generated.
	* features/rs6000/powerpc-403.c: Re-generated.
	* features/rs6000/powerpc-403gc.c : Re-generated.
	* features/rs6000/powerpc-405.c: Re-generated.
	* features/rs6000/powerpc-505.c: Re-generated.
	* features/rs6000/powerpc-601.c: Re-generated.
	* features/rs6000/powerpc-602.c: Re-generated.
	* features/rs6000/powerpc-603.c: Re-generated.
	* features/rs6000/powerpc-604.c: Re-generated.
	* features/rs6000/powerpc-64.c: Re-generated.
	* features/rs6000/powerpc-64l.c: Re-generated.
	* features/rs6000/powerpc-7400.c: Re-generated.
	* features/rs6000/powerpc-750.c: Re-generated.
	* features/rs6000/powerpc-860.c: Re-generated.
	* features/rs6000/powerpc-altivec32.c: Re-generated.
	* features/rs6000/powerpc-altivec32l.c: Re-generated.
	* features/rs6000/powerpc-altivec64.c: Re-generated.
	* features/rs6000/powerpc-altivec64l.c: Re-generated.
	* features/rs6000/powerpc-cell32l.c: Re-generated.
	* features/rs6000/powerpc-cell64l.c: Re-generated.
	* features/rs6000/powerpc-e500.c: Re-generated.
	* features/rs6000/powerpc-e500l.c: Re-generated.
	* features/rs6000/powerpc-isa205-32l.c: Re-generated.
	* features/rs6000/powerpc-isa205-64l.c: Re-generated.
	* features/rs6000/powerpc-isa205-altivec32l.c: Re-generated.
	* features/rs6000/powerpc-isa205-altivec64l.c: Re-generated.
	* features/rs6000/powerpc-isa205-vsx32l.c: Re-generated.
	* features/rs6000/powerpc-isa205-vsx64l.c: Re-generated.
	* features/rs6000/powerpc-vsx32.c: Re-generated.
	* features/rs6000/powerpc-vsx32l.c: Re-generated.
	* features/rs6000/powerpc-vsx64.c: Re-generated.
	* features/rs6000/powerpc-vsx64l.c: Re-generated.
	* features/rs6000/rs6000.c: Re-generated.
	* features/s390-linux32.c: Re-generated.
	* features/s390-linux32v1.c: Re-generated.
	* features/s390-linux32v2.c: Re-generated.
	* features/s390-linux64.c: Re-generated.
	* features/s390-linux64v1.c: Re-generated.
	* features/s390-linux64v2.c: Re-generated.
	* features/s390-te-linux64.c: Re-generated.
	* features/s390-tevx-linux64.c: Re-generated.
	* features/s390-vx-linux64.c: Re-generated.
	* features/s390x-linux64.c: Re-generated.
	* features/s390x-linux64v1.c: Re-generated.
	* features/s390x-linux64v2.c: Re-generated.
	* features/s390x-te-linux64.c: Re-generated.
	* features/s390x-tevx-linux64.c: Re-generated.
	* features/s390x-vx-linux64.c: Re-generated.
	* features/sparc/sparc32-solaris.c: Re-generated.
	* features/sparc/sparc64-solaris.c: Re-generated.
	* features/tic6x-c62x.c: Re-generated.
	* features/tic6x-c62x-linux.c: Re-generated.
	* features/tic6x-c64x.c: Re-generated.
	* features/tic6x-c64x-linux.c: Re-generated.
	* features/tic6x-c64xp.c: Re-generated.
	* features/tic6x-c64xp-linux.c: Re-generated.
2017-07-26 12:56:54 +01:00
Yao Qi 35b4818d03 Centralize i386 linux target descriptions
This patch moves all the tdesc_i386*_linux target descriptions to a
function i386_linux_read_description, which returns the right target
description according to xcr0.  This also remove the duplication in
getting target descriptions in corefile and native target.

gdb:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

	* i386-linux-tdep.c (i386_linux_read_description): New function.
	(i386_linux_core_read_description): Call
	i386_linux_read_description.
	* i386-linux-tdep.h (i386_linux_read_description): Declare.
	(tdesc_i386_linux, tdesc_i386_mmx_linux): Remove declarations.
	(tdesc_i386_avx_linux, tdesc_i386_mpx_linux): Likewise
	(tdesc_i386_avx_mpx_linux, tdesc_i386_avx_avx512_linux): Likewise.
	(tdesc_i386_avx_mpx_avx512_pku_linux): Likewise.
	* x86-linux-nat.c (x86_linux_read_description): Call
	i386_linux_read_description.
2017-07-26 12:36:42 +01:00
Yao Qi 8e2141c6fb Add optional argument to command "maint prints c-tdesc"
Nowadays, we need two steps to print c files for xml target description,
that is, 1) read xml target description in, update the current tdesc,
2) visit the current tdesc, print the c file.  It is unnecessary to
involve in current tdesc, and some validations in each gdbarch are
performed unnecessarily, which will reject some target descriptions if
they are missing some mandatory feature.

This patch adds an optional argument to "maint print c-tdesc", which
is an XML file target description, so that we can combine the two
steps above into one step, and don't have to involve in global current
tdesc.

gdb:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

	* NEWS: Mention it.
	* features/Makefile (%.c: %.xml): Pass the xml file name to
	command "maint print c-tdesc".
	* target-descriptions.c (maint_print_c_tdesc_cmd): Get file
	name from 'arg'.

gdb/doc:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

	* gdb.texinfo (Maintenance Commands): Document optional
	argument of "maint print c-tdesc".
2017-07-26 12:03:47 +01:00
Yao Qi b468ff4cbf Class-fy target_desc
This patch adds ctor and dtor in target_desc.

gdb:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

	* target-descriptions.c (target_desc): Add ctor and dtor.  Do
	in-class initialization.
	(tdesc_create_feature): Call new instead of XCNEW.
	(free_target_description): Ue delete.
2017-07-26 10:37:17 +01:00
Simon Marchi 229d26fc9e Add enum for result of fast_tracepoint_collecting
I got confused by the result value of fast_tracepoint_collecting, while
it sounds like it would return true/false (whether the thread is
collecting or not), it actually returns:

  0: not collecting
  1: in the jump pad, before the relocated instruction
  2: in the jump pad, at or after the relocated instruction

To avoid confusion, I think it would be nice to make it return an enum.
If you can help find a shorter but still relavant name, it would be
awesome.  Otherwise, we'll go with that, fast_tpoint_collect_result,
which is at least consistent with the existing
fast_tpoint_collect_status.

gdb/gdbserver/ChangeLog:

	* tracepoint.h (enum class fast_tpoint_collect_result): New
	enumeration.
	(fast_tracepoint_collecting): Change return type to
	fast_tpoint_collect_result.
	* tracepoint.c (fast_tracepoint_collecting): Likewise.
	* linux-low.h: Include tracepoint.h.
	(struct lwp_info) <collecting_fast_tracepoint>: Change type to
	fast_tpoint_collect_result.
	* linux-low.c (handle_tracepoints): Adjust.
	(linux_fast_tracepoint_collecting): Change return type to
	fast_tpoint_collect_result.
	(maybe_move_out_of_jump_pad, linux_wait_for_event_filtered,
	linux_wait_1, stuck_in_jump_pad_callback,
	lwp_signal_can_be_delivered, linux_resume_one_lwp_throw,
	proceed_one_lwp): Adjust to type change.
2017-07-26 10:57:07 +02:00
John Baldwin b9c0e1b40e Fix two NetBSD-specific typos in the configure.nat conversion.
- Add the '-lkvm' library requirement for NetBSD/sparc64.
- Fix spelling of 'nbsdelf' host.

gdb/Changelog:

	* configure.nat: Add "-lkvm" for NetBSD/sparc64 and fix typo.
2017-07-25 09:40:44 -07:00