Commit Graph

96875 Commits

Author SHA1 Message Date
Andrew Burgess 7cde5fc2ec gdb/testsuite: Prepare for DejaGnu 1.6.2
Changes in DejaGnu 1.6.2 mean that our testsuite will no longer run.
This is because of some confusion over how the gdb.exp file is
handled.

The gdb.exp file is really the tool init file, which is loaded from
within the DejaGnu core, and it should not be loaded directly from any
other file in the testsuite.

DejaGnu tries to prevent the same library being loaded twice by
remembering the names of library files as they are loaded.  Until
recently loading the tool init file in DejaGnu was very similar to
loading a library file, as a result, loading the gdb.exp tool init
file simply recorded 'gdb.exp' as having been loaded, future attempts
to load 'gdb.exp' as a library would then be ignored (as the file was
marked as already loaded).

DejaGnu has now changed so that it supports having both a tool init
file and a library with the same name, something that was not possible
before.  What this means however is that when the core loads the
'gdb.exp' tool init file it no longer marks the library 'gdb.exp' as
having been loaded.  When we then execute 'load_lib gdb.exp' we then
try to reload the 'gdb.exp' file.

Unfortunately our gdb.exp file can only be loaded once.  It use of
'rename cd builtin_cd' means that a second attempt to load this file
will fail.

This was discussed on the DejaGnu list here:
   http://lists.gnu.org/archive/html/dejagnu/2019-03/msg00000.html

and the suggested advice is that, unless we have some real requirement
to load the tool init file twice, we should remove calls to 'load_lib
gdb.exp' and rely on DejaGnu to load the file for us, which is what
this patch does.

I've tested with native X86-64/GNU Linux and see no regressions.

gdb/testsuite/ChangeLog:

	* config/default.exp: Remove 'load_lib gdb.exp'.
	* config/monitor.exp: Likewise.
	* config/sid.exp: Likewise.
	* config/sim.exp: Likewise.
	* config/slite.exp: Likewise.
	* config/unix.exp: Likewise.
	* gdb.base/default.exp: Remove unhelpful comment.
2019-03-12 19:50:43 +00:00
Eli Zaretskii 3a3508220e Fix MinGW build with source-highlight
gdb/ChangeLog
2019-03-12  Eli Zaretskii  <eliz@gnu.org>

	PR/24325
	* source-cache.c: #undef open and close, to avoid unresolved
	externals during linking.
2019-03-12 19:47:23 +02:00
Tom Tromey ffdd69cf78 Make remote.c ptid constants "const"
This changes magic_null_ptid, not_sent_ptid, and any_thread_ptid to be
"const".  This is a minor improvement that makes it so these can't be
accidentally modified.

Tested by rebuilding.  I'm checking this in.

gdb/ChangeLog
2019-03-12  Tom Tromey  <tromey@adacore.com>

	* remote.c (magic_null_ptid, not_sent_ptid, any_thread_ptid): Now
	const.  Add initializers.
	(_initialize_remote): Don't initialize ptid globals.
2019-03-12 11:07:43 -06:00
Pedro Alves ec148c577e Fix test-cp-name-parser build, parser_fprintf undefined
$ make test-cp-name-parser
  ...
  test-cp-name-parser.o: In function `yy_symbol_print(_IO_FILE*, int, YYSTYPE const*, cpname_state*)':
  build/gdb/cp-name-parser.c.tmp:1335: undefined reference to `parser_fprintf(_IO_FILE*, char const*, ...)'
  build/gdb/cp-name-parser.c.tmp:1339: undefined reference to `parser_fprintf(_IO_FILE*, char const*, ...)'
  test-cp-name-parser.o: In function `yy_stack_print(short*, short*)':
  build/gdb/cp-name-parser.c.tmp:1350: undefined reference to `parser_fprintf(_IO_FILE*, char const*, ...)'
  build/gdb/cp-name-parser.c.tmp:1354: undefined reference to `parser_fprintf(_IO_FILE*, char const*, ...)'
  build/gdb/cp-name-parser.c.tmp:1356: undefined reference to `parser_fprintf(_IO_FILE*, char const*, ...)'
  build/gdb/cp-name-parser.c.tmp:1376: more undefined references to `parser_fprintf(_IO_FILE*, char const*, ...)' follow
  collect2: error: ld returned 1 exit status
  make: *** [Makefile:1833: test-cp-name-parser] Error 1

gdb/ChangeLog:
2019-03-12  Pedro Alves  <palves@redhat.com>

	* yy-remap.h [TEST_CPNAMES] (YYFPRINTF): Don't define.
2019-03-12 16:56:02 +00:00
Pedro Alves 3276427003 Fix test-cp-name-parser build, unused variable
$ make test-cp-name-parser
  ...
  CXX    test-cp-name-parser.o
  src/gdb/cp-name-parser.y: In function ‘int gdb::main(int, char**)’:
  src/gdb/cp-name-parser.y:2137:6: error: unused variable ‘len’ [-Werror=unused-variable]
    int len;
	^~~
  cc1plus: all warnings being treated as errors

gdb/ChangeLog:
2019-03-12  Pedro Alves  <palves@redhat.com>

	* cp-name-parser.y (main): Remove unused 'len' variable.
2019-03-12 16:56:02 +00:00
Tom Tromey 17547186c2 Make null_ptid and minus_one_ptid "const"
This makes null_ptid and minus_one_ptid "const".  I think this is an
improvement because it means they can't be accidentally modified.

2019-03-12  Tom Tromey  <tromey@adacore.com>

	* common/ptid.c (null_ptid, minus_one_ptid): Now const.
	* common/ptid.h (null_ptid, minus_one_ptid): Now const.
2019-03-12 10:45:37 -06:00
Tom Tromey d3a70e03cf Change iterate_over_lwps to take a gdb::function_view
This changes iterate_over_lwps to use a gdb::function_view.  This was
needed in order to make null_ptid and minus_one_ptid 'const'.

gdb/ChangeLog
2019-03-12  Tom Tromey  <tromey@adacore.com>

	* linux-nat.c (iterate_over_lwps): Update.
	(stop_callback): Remove parameter.
	(stop_wait_callback, detach_callback, resume_set_callback)
	(select_singlestep_lwp_callback, set_ignore_sigint)
	(status_callback, resumed_callback, resume_clear_callback)
	(kill_callback, kill_wait_callback, linux_nat_stop_lwp): Remove
	data parameter.
	(linux_nat_target::detach, linux_nat_target::resume)
	(linux_stop_and_wait_all_lwps, select_event_lwp)
	(linux_nat_filter_event, linux_nat_wait_1)
	(linux_nat_target::kill, linux_nat_target::stop)
	(linux_nat_target::stop): Update.
	(linux_nat_resume_callback): Change type.
	(resume_stopped_resumed_lwps, count_events_callback)
	(select_event_lwp_callback): Likewise.
	(linux_stop_lwp, linux_nat_stop_lwp): Update.
	* arm-linux-nat.c (struct update_registers_data): Remove.
	(update_registers_callback): Change type.
	(arm_linux_insert_hw_breakpoint1): Update.
	* nat/x86-linux-dregs.c (update_debug_registers_callback): Remove
	parameter.
	(x86_linux_dr_set_addr): Update.
	(x86_linux_dr_set_control): Update.
	* nat/linux-nat.h (iterate_over_lwps_ftype): Remove parameter.
	(iterate_over_lwps): Use gdb::function_view.
	* nat/aarch64-linux-hw-point.c (struct
	aarch64_dr_update_callback_param): Remove.
	(debug_reg_change_callback): Change type.
	(aarch64_notify_debug_reg_change): Update.
	* s390-linux-nat.c (s390_refresh_per_info): Update.

gdb/gdbserver/ChangeLog
2019-03-12  Tom Tromey  <tromey@adacore.com>

	* linux-low.c (iterate_over_lwps): Update.
2019-03-12 10:45:35 -06:00
Alan Modra 7a6e0d89bb Don't use bfd_get_file_size in objdump
Compressed debug sections can have uncompressed sizes that exceed the
original file size, so we can't use bfd_get_file_size.  objdump also
used bfd_get_file_size to limit reloc section size, but I believe the
underlying bug causing the PR22508 out of bounds buffer access was
that we had an integer overflow when calculating the reloc buffer
size.  I've fixed that instead in most of the backends, som and
vms-alpha being the exceptions.  SOM and vmd-alpha have rather more
serious bugs in their slurp_relocs routines that would need fixing
first if we want to fuss about making them safe against fuzzed object
files.

The patch also fixes a number of other potential overflows by using
the bfd_alloc2/malloc2/zalloc2 memory allocation functions.

bfd/
	* coffcode.h (buy_and_read): Delete unnecessary forward decl.  Add
	nmemb parameter.  Use bfd_alloc2.
	(coff_slurp_line_table): Use bfd_alloc2.  Update buy_and_read calls.
	Delete assertion.
	(coff_slurp_symbol_table): Use bfd_alloc2 and bfd_zalloc2.
	(coff_slurp_reloc_table): Use bfd_alloc2.  Update buy_and_read calls.
	* coffgen.c (coff_get_reloc_upper_bound): Ensure size calculation
	doesn't overflow.
	* elf.c (bfd_section_from_shdr): Use bfd_zalloc2.  Style fix.
	(assign_section_numbers): Style fix.
	(swap_out_syms): Use bfd_malloc2.
	(_bfd_elf_get_reloc_upper_bound): Ensure size calculation doesn't
	overflow.
	(_bfd_elf_make_empty_symbol): Style fix.
	(elfobj_grok_stapsdt_note_1): Formatting.
	* elfcode.h (elf_object_p): Use bfd_alloc2.
	(elf_write_relocs, elf_write_shdrs_and_ehdr): Likewise.
	(elf_slurp_symbol_table): Use bfd_zalloc2.
	(elf_slurp_reloc_table): Use bfd_alloc2.
	(_bfd_elf_bfd_from_remote_memory): Use bfd_malloc2.
	* elf64-sparc (elf64_sparc_get_reloc_upper_bound): Ensure
	size calculation doesn't overflow.
	(elf64_sparc_get_dynamic_reloc_upper_bound): Likewise.
	* mach-o.c (bfd_mach_o_get_reloc_upper_bound): Likewise.
	* pdp11.c (get_reloc_upper_bound): Copy aoutx.h version.
binutils/
	* objdump.c (load_specific_debug_section): Don't compare section
	size against file size.
	(dump_relocs_in_section): Don't compare reloc size against file size.
	Print "failed to read relocs" on bfd_get_reloc_upper_bound error.
2019-03-12 23:54:09 +10:30
Andreas Krebbel 0919bfe915 Add missing changelogs for previous commits. 2019-03-12 14:23:21 +01:00
Andreas Krebbel 40f382e88d S/390: arch13: Adjust to recent changes
opcodes/ChangeLog:

2019-03-12  Andreas Krebbel  <krebbel@linux.ibm.com>

	* s390-opc.txt: Rename selhhhr to selfhr.  Remove optional operand
	from vstrszb, vstrszh, and vstrszf.

gas/ChangeLog:

2019-03-12  Andreas Krebbel  <krebbel@linux.ibm.com>

	* testsuite/gas/s390/zarch-arch13.s: Adjust testcase to optable changes.
	* testsuite/gas/s390/zarch-arch13.d: Likewise.
2019-03-12 14:13:01 +01:00
Andreas Krebbel ba354106f0 S/390: arch13: Add instruction descriptions
opcodes/ChangeLog:

2019-03-12  Andreas Krebbel  <krebbel@linux.ibm.com>

	* s390-opc.txt: Add instruction descriptions.
2019-03-12 14:10:07 +01:00
GDB Administrator d16f140885 Automatic date update in version.in 2019-03-12 00:00:20 +00:00
Tom Tromey 82cb27ff6b Remove redundant assignment from dwarf2_find_containing_comp_unit
dwarf2_find_containing_comp_unit has two assignments to "this_cu" in
quick succession, both of which are just:

  this_cu = dwarf2_per_objfile->all_comp_units[low];

... with no intervening assignments.

This patch removes the second assignment.  I'm checking this in as
obvious.  Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-03-11  Tom Tromey  <tromey@adacore.com>

	* dwarf2read.c (dwarf2_find_containing_comp_unit): Remove
	redundant assignment to "this_cu".
2019-03-11 10:22:17 -06:00
GDB Administrator e7b681f1c6 Automatic date update in version.in 2019-03-11 00:00:22 +00:00
GDB Administrator 0e290772cd Automatic date update in version.in 2019-03-10 00:01:08 +00:00
Simon Marchi 568c0683da Remove unnecessary cases from rank_one_type's switch
We return INCOMPATIBLE_TYPE_BADNESS for all these type codes, so we might as
well just let them go to the default case.

Incidentally, this patch also makes this false positive error go away when
compiling with gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0, default compiler on
Ubuntu 18.04.

  CXX    gdbtypes.o
/home/smarchi/src/binutils-gdb/gdb/gdbtypes.c: In function ‘rank rank_one_type(type*, type*, value*)’:
/home/smarchi/src/binutils-gdb/gdb/gdbtypes.c:4259:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^

gdb/ChangeLog:

	* gdbtypes.c (rank_one_type): Remove unnecessary cases from switch.
2019-03-09 08:09:39 -05:00
Simon Marchi f09ce22d6a Split rank_one_type_parm_set from rank_one_type
gdb/ChangeLog:

	* gdbtypes.c (rank_one_type_parm_set): New function extracted
	from...
	(rank_one_type): ... this.
2019-03-09 08:09:38 -05:00
Simon Marchi 595f96a944 Split rank_one_type_parm_struct from rank_one_type
gdb/ChangeLog:

	* gdbtypes.c (rank_one_type_parm_struct): New function extracted
	from...
	(rank_one_type): ... this.
2019-03-09 08:09:38 -05:00
Simon Marchi 2598a94b1e Split rank_one_type_parm_complex from rank_one_type
gdb/ChangeLog:

	* gdbtypes.c (rank_one_type_parm_complex): New function extracted
	from...
	(rank_one_type): ... this.
2019-03-09 08:09:38 -05:00
Simon Marchi 7f17b20d60 Split rank_one_type_parm_float from rank_one_type
gdb/ChangeLog:

	* gdbtypes.c (rank_one_type_parm_float): New function extracted
	from...
	(rank_one_type): ... this.
2019-03-09 08:09:38 -05:00
Simon Marchi 2c50903575 Split rank_one_type_parm_bool from rank_one_type
gdb/ChangeLog:

	* gdbtypes.c (rank_one_type_parm_bool): New function extracted
	from...
	(rank_one_type): ... this.
2019-03-09 08:09:38 -05:00
Simon Marchi 0dd322dc13 Split rank_one_type_parm_range from rank_one_type
gdb/ChangeLog:

	* gdbtypes.c (rank_one_type_parm_range): New function extracted
	from...
	(rank_one_type): ... this.
2019-03-09 08:09:38 -05:00
Simon Marchi 41ea472809 Split rank_one_type_parm_char from rank_one_type
gdb/ChangeLog:

	* gdbtypes.c (rank_one_type_parm_char): New function extracted
	from...
	(rank_one_type): ... this.
2019-03-09 08:09:38 -05:00
Simon Marchi 793cd1d2a1 Split rank_one_type_parm_enum from rank_one_type
gdb/ChangeLog:

	* gdbtypes.c (rank_one_type_parm_enum): New function extracted
	from...
	(rank_one_type): ... this.
2019-03-09 08:09:38 -05:00
Simon Marchi 34910087eb Split rank_one_type_parm_int from rank_one_type
gdb/ChangeLog:

	* gdbtypes.c (rank_one_type_parm_int): New function extracted
	from...
	(rank_one_type): ... this.
2019-03-09 08:09:38 -05:00
Simon Marchi f1f832d6cd Split rank_one_type_parm_func from rank_one_type
gdb/ChangeLog:

	* gdbtypes.c (rank_one_type_parm_func): New function extracted
	from...
	(rank_one_type): ... this.
2019-03-09 08:09:38 -05:00
Simon Marchi b9f4512f25 Split rank_one_type_parm_array from rank_one_type
gdb/ChangeLog:

	* gdbtypes.c (rank_one_type_parm_array): New function extracted
	from...
	(rank_one_type): ... this.
2019-03-09 08:09:38 -05:00
Simon Marchi 9293fc6304 Split rank_one_type_parm_ptr from rank_one_type
gdb/ChangeLog:

	* gdbtypes.c (rank_one_type_parm_ptr): New function extracted
	from...
	(rank_one_type): ... this.
2019-03-09 08:09:38 -05:00
Philippe Waroquiers e3abbe7e94 Ensure 'help set/show print inferior-events' shows the example events.
Without this patch, the help stops after  'e.g.' :
  (gdb) apropos \(inferior\|thread\) event
  set print inferior-events -- Set printing of inferior events (e.g.
  set print thread-events -- Set printing of thread events (such as thread start and exit)
  show print inferior-events -- Show printing of inferior events (e.g.
  show print thread-events -- Show printing of thread events (such as thread start and exit)

Using the same notation as for the thread evenets (i.e. 'such as') gives:
 (gdb) apropos \(inferior\|thread\) event
 set print inferior-events -- Set printing of inferior events (such as inferior start and exit)
 set print thread-events -- Set printing of thread events (such as thread start and exit)
 show print inferior-events -- Show printing of inferior events (such as inferior start and exit)
 show print thread-events -- Show printing of thread events (such as thread start and exit)
2019-03-09 12:25:11 +01:00
Eli Zaretskii e4adb93903 Support styling on native MS-Windows console
gdb/ChangeLog:
2019-03-08  Eli Zaretskii  <eliz@gnu.org>

	PR/24315
	* utils.c (can_emit_style_escape) [_WIN32]: Don't disable styling
	on MS-Windows if $TERM is not defined.

	* cli/cli-style.c: Set cli_styling to 1 in the MinGW build.

	* posix-hdep.c (gdb_console_fputs):
	* mingw-hdep.c (rgb_to_16colors, gdb_console_fputs): New
	functions.
	* ui-file.h (gdb_console_fputs): Add prototype.

	* ui-file.c (stdio_file::puts): Call gdb_console_fputs, and fall
	back to fputs only if the former returns zero.
2019-03-09 08:44:56 +02:00
GDB Administrator 4639b61ae3 Automatic date update in version.in 2019-03-09 00:00:30 +00:00
Alan Modra ebd2263ba9 PR24311, FAIL: S-records with constructors
Not padding string merge section output to its alignment can cause
failures of the S-record tests when input string merge sections are
padded, since the ELF linker output for the single string section
would shrink compared to the SREC linker output.  That might result in
following sections having different addresses.
On the other hand, padding string merge section output when input
string merge sections are *not* padded can also cause failures, in
this case due to the ELF linker output for the string section being
larger (due to padding) than the SREC linker output.

It would be better to write a more robust test, but it is also nice
to leave input unchanged when no string merges occur.

	PR 24311
	* merge.c (merge_strings): Return secinfo.  Don't pad section
	to alignment here.
	(_bfd_merge_sections): Pad section to alignment here, if input
	sections contributing to merged output all pad to alignment.
	Formatting.
2019-03-08 23:28:34 +10:30
GDB Administrator 65d8004072 Automatic date update in version.in 2019-03-08 00:00:42 +00:00
Tom Tromey 25629dfdb4 C++-ify bcache
This somewhat C++-ifies bcache.  It replaces bcache_xmalloc and
bcache_xfree with constructors; changes some functions into methods;
and changes various structures to include a bcache directly (as
opposed to a pointer to a bcache).

Tested by the buildbot.

gdb/ChangeLog
2019-03-07  Tom Tromey  <tom@tromey.com>

	* symmisc.c (print_symbol_bcache_statistics): Update.
	(print_objfile_statistics): Update.
	* symfile.c (allocate_symtab): Update.
	* stabsread.c: Don't include bcache.h.
	* psymtab.h (struct psymbol_bcache): Don't declare.
	(class psymtab_storage) <psymbol_cache>: Now a bcache.
	(psymbol_bcache_init, psymbol_bcache_free)
	(psymbol_bcache_get_bcache): Don't declare.
	* psymtab.c (struct psymbol_bcache): Remove.
	(psymtab_storage::psymtab_storage): Update.
	(psymtab_storage::~psymtab_storage): Update.
	(psymbol_bcache_init, psymbol_bcache_free)
	(psymbol_bcache_get_bcache, psymbol_bcache_full): Remove.
	(add_psymbol_to_bcache): Update.
	(allocate_psymtab): Update.
	* objfiles.h (struct objfile_per_bfd_storage) <filename_cache,
	macro_cache>: No longer pointers.
	* objfiles.c (get_objfile_bfd_data): Don't call bcache_xmalloc.
	(free_objfile_per_bfd_storage): Don't call bcache_xfree.
	* macrotab.c (macro_bcache): Update.
	* macroexp.c: Don't include bcache.h.
	* gdbtypes.c (check_types_worklist): Update.
	(types_deeply_equal): Remove TRY/CATCH.  Update.
	* elfread.c (elf_symtab_read): Update.
	* dwarf2read.c: Don't include bcache.h.
	* buildsym.c (buildsym_compunit::get_macro_table): Update.
	* bcache.h (bcache, bcache_full, bcache_xffree, bcache_xmalloc)
	(print_bcache_statistics, bcache_memory_used): Don't declare.
	(struct bcache): Move from bcache.c.  Add constructor, destructor,
	methods.  Rename all data members.
	* bcache.c (struct bcache): Move to bcache.h.
	(bcache::expand_hash_table): Rename from expand_hash_table.
	(bcache): Remove.
	(bcache::insert): Rename from bcache_full.
	(bcache::compare): Rename from bcache_compare.
	(bcache_xmalloc): Remove.
	(bcache::~bcache): Rename from bcache_xfree.
	(bcache::print_statistics): Rename from print_bcache_statistics.
	(bcache::memory_used): Rename from bcache_memory_used.
2019-03-07 10:48:02 -07:00
Pedro Alves fe72666741 Fix normal_stop latent bug
TARGET_WAITKIND_NO_RESUMED doesn't have an associated event thread, so
we shouldn't be referring to inferior_thread() assuming it points to
one.

This was caught on the multi-target branch, where we always switch to
no-thread-selected whenever we start handling an event, exactly to
catch places that incorrectly use "inferior_ptid/inferior_thread()"
without switching to the right event thread / target.

Here, on the branch, we assert in inferior_thread() because
TARGET_WAITKIND_NO_RESUMED doesn't have an associated event thread, so
inferior_ptid is still null_ptid.

gdb/ChangeLog:
2019-03-07  Pedro Alves  <palves@redhat.com>

	* infrun.c (normal_stop): Also check for
	TARGET_WAITKIND_NO_RESUMED before referring to inferior_thread().
2019-03-07 16:35:06 +00:00
Andrew Burgess 7584bb30cf gdb: Move value_from_host_double into value.c and make more use of it
The function value_from_host_double can be moved from f-lang.c into
value.c as a generally useful function, and then used more widely.

Tested on X86-64/GNU Linux with no regressions.

gdb/ChangeLog:

	* f-lang.c (value_from_host_double): Moved to...
	* value.c (value_from_host_double): ...here.
	* value.h (value_from_host_double): Declare.
	* guile/scm-math.c (vlscm_convert_typed_number): Use
	value_from_host_double.
	(vlscm_convert_number): Likewise.
	* guile/scm-value.c (gdbscm_value_to_real): Likewise.
	* python/py-value.c (convert_value_from_python): Likewise.
2019-03-07 14:53:37 +00:00
GDB Administrator 2c5ebf1239 Automatic date update in version.in 2019-03-07 00:00:23 +00:00
Tom Tromey a7b1986e13 Use SCOPE_EXIT in write_gcore_file
This replaces a TRY/CATCH in write_gcore_file with a use of SCOPE_EXIT
instead.  I find that this is simpler to understand.

2019-03-06  Tom Tromey  <tom@tromey.com>

	* gcore.c (write_gcore_file): Use SCOPE_EXIT.
2019-03-06 16:04:31 -07:00
Tom Tromey 0ccf4211fd Remove free_current_contents
free_current_contents is no longer used, so this patch removes it.

2019-03-06  Tom Tromey  <tom@tromey.com>

	* utils.h (free_current_contents): Don't declare.
	* utils.c (free_current_contents): Remove.
2019-03-06 16:04:31 -07:00
Tom Tromey fe7b42e584 Remove basic cleanup code
This removes the basic cleanup code: make_cleanups, do_cleanups,
discard_cleanups, and friends.  This code is no longer needed, as
nothing in gdb makes an ordinary cleanup.  Final cleanups are still
needed.

2019-03-06  Tom Tromey  <tom@tromey.com>

	* top.c (quit_force): Update.
	* main.c (captured_command_loop): Update.
	* common/new-op.c (operator new): Update.
	* common/common-exceptions.c (struct catcher)
	<save_cleanup_chain>: Remove member.
	(exceptions_state_mc_init): Update.
	(exception_try_scope_entry): Return nullptr.
	(exception_try_scope_exit, exception_rethrow)
	(throw_exception_sjlj, throw_exception_cxx): Update.
	* common/cleanups.h (make_cleanup, make_cleanup_dtor)
	(all_cleanups, do_cleanups, discard_cleanups)
	(discard_final_cleanups, save_cleanups, save_final_cleanups)
	(restore_cleanups, restore_final_cleanups): Don't declare.
	(do_final_cleanups): Remove parameter.
	* common/cleanups.c (cleanup_chain, make_cleanup)
	(make_cleanup_dtor, all_cleanups, do_cleanups)
	(discard_my_cleanups, discard_cleanups)
	(discard_final_cleanups, save_my_cleanups, save_cleanups)
	(save_final_cleanups, restore_my_cleanups, restore_cleanups)
	(null_cleanup): Remove.
	(do_final_cleanups): Remove parameter.
2019-03-06 16:04:31 -07:00
Tom Tromey c6321f19c5 Use unique_xmalloc_ptr in remote.c
This removes a cleanup from remote.c, replacing it with
unique_xmalloc_ptr.

2019-03-06  Tom Tromey  <tom@tromey.com>

	* remote.c (remote_target::remote_parse_stop_reply): Use
	unique_xmalloc_ptr.
2019-03-06 16:04:31 -07:00
Tom Tromey 61b3009970 Remove last cleanups from stabsread.c
This removes the last cleanups from stabsread.c.  Similar code in
dwarf2read.c was C++-ified, but considering that stabs are deprecated,
it seemed simpler to just change these allocations to use an obstack
and leave the data structures in place.

This patch renames field_info to stabs_field_info -- adding a
constructor here provoked a bug due to the resulting ODR violation.

2019-03-06  Tom Tromey  <tom@tromey.com>

	* stabsread.c (struct stabs_field_info): Rename from field_info.
	<list, fnlist>: Add initializers.
	<obstack>: New member.
	(read_member_functions, read_struct_fields, read_baseclasses):
	Allocate on obstack.  Don't use cleanups.
	(read_one_struct_field, read_member_functions, read_struct_fields)
	(read_baseclasses, read_tilde_fields, attach_fn_fields_to_type)
	(attach_fields_to_type, read_cpp_abbrev, read_member_functions)
	(read_struct_type): Update.
2019-03-06 16:04:31 -07:00
Tom Tromey 6cceac9414 Remove last cleanup from linux-namespaces.c
This removes the last cleanup from linux-namespaces.c, replacing it
with a use of SCOPE_EXIT.

2019-03-06  Tom Tromey  <tom@tromey.com>

	* nat/linux-namespaces.c (linux_mntns_access_fs): Use SCOPE_EXIT.
	* common/filestuff.h (make_cleanup_close): Don't declare.
	* common/filestuff.c (do_close_cleanup, make_cleanup_close):
	Remove.
2019-03-06 16:04:31 -07:00
Tom Tromey 724127627f Remove last cleanup solib-aix.c
This removes the last cleanup solib-aix.c, replacing it with a use of
make_scope_exit.

2019-03-06  Tom Tromey  <tom@tromey.com>

	* solib-aix.c: Use make_scope_exit.
2019-03-06 16:04:31 -07:00
Tom Tromey 2b6ff1c047 Remove last cleanups from solib-svr4.c
This removes the last cleanups from solib-svr4.c, replacing them with
uses of make_scope_exit.

2019-03-06  Tom Tromey  <tom@tromey.com>

	* solib-svr4.c (svr4_parse_libraries, svr4_current_sos_direct):
	Use make_scope_exit.
2019-03-06 16:04:31 -07:00
Tom Tromey d01c587766 Remove cleanup from solib-svr4.c
This removes a cleanup from solib-svr4.c, replacing it with
make_scope_exit.

2019-03-06  Tom Tromey  <tom@tromey.com>

	* solib-svr4.c (disable_probes_interface): Remove parameter.
	(svr4_handle_solib_event): Use make_scope_exit.
2019-03-06 16:04:31 -07:00
Tom Tromey 37991b4f52 Remove last cleanup from gdbserver
This removes the last cleanup from gdbserver, replacing it with
SCOPE_EXIT.  This could perhaps be done in a different way, but this
approach was direct and obviously correct.

2019-03-06  Tom Tromey  <tom@tromey.com>

	* server.c (detach_or_kill_for_exit_cleanup): Remove parameter.
	(captured_main): Use SCOPE_EXIT.
2019-03-06 16:04:31 -07:00
Tom Tromey 32603266e5 C++ify remote notification code
This C++ifies the remote notification code -- replacing function
pointers with virtual methods and using unique_ptr.  This allows for
the removal of some cleanups.

2019-03-06  Tom Tromey  <tom@tromey.com>

	* remote.c (struct stop_reply_deleter): Remove.
	(stop_reply_up): Update.
	(struct stop_reply): Derive from notif_event.  Don't typedef.
	<regcache>: Now a std::vector.
	(stop_reply_xfree): Remove.
	(stop_reply::~stop_reply): Rename from stop_reply_dtr.
	(remote_notif_stop_alloc_reply): Return a unique_ptr.  Use new.
	(remote_target::discard_pending_stop_replies): Use delete.
	(remote_target::remote_parse_stop_reply): Update.
	(remote_target::process_stop_reply): Update.
	* remote-notif.h (struct notif_event): Add virtual destructor.
	Remove "dtr" member.
	(struct notif_client) <alloc_event>: Return a unique_ptr.
	(notif_event_xfree): Don't declare.
	(notif_event_up): New typedef.
	* remote-notif.c (remote_notif_ack, remote_notif_parse): Update.
	(notif_event_xfree, do_notif_event_xfree): Remove.
	(remote_notif_state_xfree): Update.
2019-03-06 16:04:31 -07:00
Tom Tromey 9799571ecb Change displaced_step_clear_cleanup to a forward_scope_exit
This changes displaced_step_clear_cleanup to be a forward_scope_exit
and updates the callers.

gdb/ChangeLog
2019-03-06  Tom Tromey  <tom@tromey.com>

	* infrun.c (displaced_step_clear_cleanup): Now a
	forward_scope_exit type.
	(displaced_step_prepare_throw): Update.
	(displaced_step_fixup): Update.
2019-03-06 16:04:32 -07:00
Tom Tromey 09e3c4ca13 Update two cleanup comments
This updates another couple of comments to remove mentions of
cleanups.

gdb/ChangeLog
2019-03-06  Tom Tromey  <tom@tromey.com>

	* inferior.h (class inferior): Update comment.
	* gdbthread.h (class thread_info): Update comment.
2019-03-06 14:05:28 -07:00