Commit Graph

39888 Commits

Author SHA1 Message Date
Simon Marchi d0d292a274 Use std::vector for traceframe_info::tvars
Straightforward change to get rid of a VEC.  We need to new/delete
traceframe_info instead of malloc/free it.  I found three places that
allocate a traceframe_info (ctf_traceframe_info, tfile_traceframe_info
and parse_traceframe_info) and only one that frees it
(free_traceframe_info).

gdb/ChangeLog:

	* tracepoint.h (struct traceframe_info) <tvars>: Change type to
	std::vector<int>.
	* tracepoint.c (free_traceframe_info): Deallocate with delete.
	(traceframe_info_start_tvar): Adjust to vector change.
	(parse_traceframe_info): Allocate with new.
	* ctf.c (ctf_traceframe_info): Allocate with new, adjust to
	vector change.
	* tracefile-tfile.c (build_traceframe_info): Adjust to vector
	change.
	tfile_traceframe_info): Allocate with new.
	* mi/mi-main.c (mi_cmd_trace_frame_collected): Adjust to vector
	change.
2017-10-14 08:42:23 -04:00
Simon Marchi 8d3c73ef6b Rename traceframe_info variable to current_traceframe_info
... so it doesn't shadow the traceframe_info type.  It think it's a
clearer name anyway.

gdb/ChangeLog:

	* tracepoint.c (traceframe_info): Rename to...
	(current_traceframe_info): ...this.
	(clear_traceframe_info): Adjust.
	(get_traceframe_info): Adjust.
2017-10-14 08:41:01 -04:00
Simon Marchi b129dcac88 Use std::vector in linux_xfer_osdata_processgroups
This simplifies the code quite a bit, by removing the array of PID_T
that's actually an array of pairs of PID_T.

This code is only used to implement "info os procgroups".  I tested by hand
as well as by running gdb.base/info-os.exp for unix, native-gdbserver
and native-extended-gdbserver.

gdb/ChangeLog:

	* nat/linux-osdata.c: Include algorithm.
	(compare_processes): Remove.
	(struct pid_pgid_entry): New struct.
	(linux_xfer_osdata_processgroups): Use std::vector instead of
	XNEWVEC.
2017-10-14 08:38:02 -04:00
Simon Marchi af5bf4ada4 Replace psymbol_allocation_list with std::vector
psymbol_allocation_list is basically a vector implementation.  We can
replace it with an std::vector, now that objfile has been C++-ified.

I sent this to the buildbot, there are a few suspicious failures, but
I don't think they are related to this patch.  For example on powerpc:

new FAIL: gdb.base/catch-syscall.exp: execve: syscall execve has returned
new FAIL: gdb.base/catch-syscall.exp: execve: continue to main
new FAIL: gdb.base/catch-syscall.exp: execve: continue until exit

I get the same failures when testing manually on gcc112, without this
patch.

gdb/ChangeLog:

	* objfiles.h: Don't include symfile.h.
	(struct partial_symbol): Remove forward-declaration.
	(struct objfile) <global_psymbols, static_psymbols>: Change type
	to std::vector<partial_symbol *>.
	* objfiles.c (objfile::objfile): Don't memset those fields.
	(objfile::~objfile): Don't free those fields.
	* psympriv.h (struct psymbol_allocation_list): Remove
	forward-declaration.
	(add_psymbol_to_list): Change psymbol_allocation_list parameter
	to std::vector.
	(start_psymtab_common): Change parameters to std::vector.
	* psymtab.c: Include algorithm.
	(require_partial_symbols): Call shrink_to_fit.
	(find_pc_sect_psymbol): Adjust to vector change.
	(match_partial_symbol): Likewise.
	(lookup_partial_symbol): Likewise.
	(psym_relocate): Likewise.
	(dump_psymtab): Likewise.
	(recursively_search_psymtabs): Likewise.
	(compare_psymbols): Remove.
	(sort_pst_symbols): Adjust to vector change.
	(start_psymtab_common): Likewise.
	(end_psymtab_common): Likewise.
	(psymbol_bcache_full): De-constify return value.
	(add_psymbol_to_bcache): Likewise.
	(extend_psymbol_list): Remove.
	(append_psymbol_to_list): Adjust to vector change.
	(add_psymbol_to_list): Likewise.
	(init_psymbol_list): Likewise.
	(maintenance_info_psymtabs): Likewise.
	(maintenance_check_psymtabs): Likewise.
	* symfile.h (struct psymbol_allocation_list): Remove.
	* symfile.c (reread_symbols): Adjust to vector change.
	* dbxread.c (start_psymtab): Change type of parameters.
	(dbx_symfile_read): Adjust to vector change.
	(read_dbx_symtab): Likewise.
	(start_psymtab): Change type of parameters.
	* dwarf2read.c (dwarf2_build_psymtabs): Adjust to vector change.
	(create_partial_symtab): Likewise.
	(add_partial_symbol): Likewise.
	(write_one_signatured_type): Likewise.
	(recursively_write_psymbols): Likewise.
	* mdebugread.c (parse_partial_symbols): Likewise.
	* xcoffread.c (xcoff_start_psymtab): Change type of parameters.
	(scan_xcoff_symtab): Adjust to vector change.
	(xcoff_initial_scan): Likewise.
2017-10-14 08:07:46 -04:00
Simon Marchi 3ec5942fbf ada: Use std::string in print_dynamic_range_bound
Replace this usage of GROW_VECT with an std::string.  I don't think
there's a reason for this variable to be static, other than it was
cumbersome to manage its lifetime (i.e. use a cleanup) before.

Tested by comparing the gdb.ada/*.exp test results before and after the
patch.

gdb/ChangeLog:

	* ada-typeprint.c (print_dynamic_range_bound): Use std::string.
2017-10-13 22:45:14 -04:00
Pedro Alves 300b6685f1 Skip a few tests on targets that can't use the "run" commmand.
These tests want to use raw "run", so skip them on targets that can't
do that.

Also adds a small utility procedure that clearly conveys intent instead of
explicitly checking use_gdb_stub in the testcases.

This makes sure these testcases continue to be skipped with
--target_board=native-gdbserver once that board stops setting
is_remote.

gdb/testsuite/ChangeLog:
2017-10-13  Pedro Alves  <palves@redhat.com>

	* lib/gdb.exp (target_can_use_run_cmd): New procedure.
	* gdb.base/annota1.exp: Use it instead of is_remote.
	* gdb.base/annota3.exp: Use it instead of is_remote.
	* gdb.cp/annota2.exp: Use it instead of is_remote.
	* gdb.cp/annota3.exp: Use it instead of is_remote.
	* gdb.multi/bkpt-multi-exec.exp: Use it instead of is_remote.
2017-10-13 18:11:31 +01:00
Pedro Alves 50500caf81 Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:

  Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
  FAIL: gdb.base/testenv.exp: test no TEST_GDB var
  FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
  FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
  FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
  FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
  FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset

The problem is that the testcase relies on stdio.  While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all.  That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.

Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms.  E.g., with_test_prefix, proc_with_prefix,
save_vars, etc.  Also, a missing check for "is_remote host" is added.

gdb/testsuite/ChangeLog:
2017-10-13  Pedro Alves  <palves@redhat.com>

	* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
	(test_num_test_vars, run_and_count_vars, find_env)
	(test_set_unset_env, test_inherit_env_var): New procedures.
	(top level): Use them.
2017-10-13 17:50:19 +01:00
Pedro Alves dad0c6d2f7 Don't run gdb.gdb/ selftests if use_gdb_stub is true
If we make the native-gdbserver board be !is_remote, then the few
tests that use the selftest-support.exp routines to debug gdb itself
start running, and fail, with something like:

  Running ..../src/gdb/testsuite/gdb.gdb/selftest.exp ...
  ERROR: tcl error sourcing ..../src/gdb/testsuite/gdb.gdb/selftest.exp.
  ERROR: gdbserver does not support run [....] without extended-remote
      while executing
  "error "gdbserver does not support $command without extended-remote""
      (procedure "gdb_test_multiple" line 25)
      invoked from within
  "gdb_test_multiple "run $INTERNAL_GDBFLAGS" "$description" {
	  -re "Starting program.*Breakpoint \[0-9\]+,.*$function \\(\\).* at .*main.c:.*$gdb..."
      (procedure "selftest_setup" line 45)

This commit makes sure those tests continue to be skipped.

gdb/testsuite/ChangeLog:
2017-10-13  Pedro Alves  <palves@redhat.com>

	* lib/selftest-support.exp (selftest_setup): Extend comments, and
	also skip on stub-like targets.
2017-10-13 17:26:04 +01:00
Pedro Alves 8b0553c18f Make gdb.base/find-unmapped.exp pass on remote targets
Currently, with --target_board=native-extended-gdbserver, we get:

  Running .../src/gdb/testsuite/gdb.base/find-unmapped.exp ...
  FAIL: gdb.base/find-unmapped.exp: find global_var_0, global_var_2, 0xff
  FAIL: gdb.base/find-unmapped.exp: find global_var_1, global_var_2, 0xff
  FAIL: gdb.base/find-unmapped.exp: find global_var_2, (global_var_2 + 16), 0xff

This commit makes the test pass there, and also enables in on
--target_board=native-gdbserver, and other remote targets.

I've filed PR gdb/22293 to track the missing-warning problem.

gdb/testsuite/ChangeLog:
2017-10-13  Pedro Alves  <palves@redhat.com>

	PR gdb/22293
	* gdb.base/find-unmapped.exp: Don't skip if is_remote target.
	(top level): Move some tests to ...
	(test_not_found): ... this new procedure.
	(top level): Call it.
2017-10-13 16:34:50 +01:00
Yao Qi 2399fe6ab0 Simplify tic6x and s390x expedite registers
Nowadays, we have six tic6x expedite registers, which are duplicated.

tic6x-c64xp-expedite = A15,PC
tic6x-c64x-expedite = A15,PC
tic6x-c62x-expedite = A15,PC
tic6x-c64xp-linux-expedite = A15,PC
tic6x-c64x-linux-expedite = A15,PC
tic6x-c62x-linux-expedite = A15,PC

in features/Makefile, we have

   echo "expedite:$(if $($*-expedite),$($*-expedite),$($(firstword $(subst -, ,$(notdir $*)))-expedite))" \
        >> $(outdir)/$*.tmp

which means for a given bar/foo-baz.xml, we'll look for either
bar/foo-baz-expedite or foo-expedite.  We can define only one generic
expedite register for all different ti6cx and s390x target descriptions.
Actually, we've done that for x86 target descriptions.

Re-run 'make GDB=/path/build/gdb all' to regenerate regformats/*.dat files,
and they are not changed.

gdb:

2017-10-13  Yao Qi  <yao.qi@linaro.org>

	* features/Makefile: Remove tic6x-*-expedite, add tic6x-expedite.
	Remove s390x-*-expedite, add s390x-expedite.
2017-10-13 15:36:49 +01:00
Yao Qi 4bf3f4a810 Regenerate features/s390-gs-linux64.c and features/s390x-gs-linux64.c
gdb:

2017-10-13  Yao Qi  <yao.qi@linaro.org>

	* features/s390-gs-linux64.c: Regenerated.
	* features/s390x-gs-linux64.c: Regenerated.
2017-10-13 15:28:10 +01:00
Tom Tromey 9e86da0760 Change objfile to use new/delete
This changes objfiles to use new and delete rather than xmalloc and
free.  Simon noticed that it uses a non-POD and so shouldn't be
allocated with XCNEW; and I wanted to be able to use another non-POD as
a member; this patch is the result.

Regression tested by the buildbot.

2017-10-13  Tom Tromey  <tom@tromey.com>

	* compile/compile-object-run.c (do_module_cleanup): Use delete.
	* solib.c (update_solib_list, reload_shared_libraries_1): Use
	delete.
	* symfile.c (symbol_file_add_with_addrs): Use new.
	(symbol_file_add_separate): Update comment.
	(syms_from_objfile_1, remove_symbol_file_command): Use delete.
	* jit.c (jit_object_close_impl): Use new.
	(jit_unregister_code): Use delete.
	* objfiles.c (objfile::objfile): Rename from allocate_objfile.
	(~objfile): Rename from free_objfile.
	(free_objfile_separate_debug, do_free_objfile_cleanup)
	(free_all_objfiles, objfile_purge_solibs): Use delete.
	* objfiles.h (struct objfile): Add constructor and destructor.
	Use DISABLE_COPY_AND_ASSIGN.  Add initializers to data members.
	(allocate_objfile, free_objfile): Don't declare.
	(struct objstats): Add initializers.
2017-10-13 07:18:29 -06:00
Pedro Alves 7594f62360 Fix gdb.base/term.exp on non-"target native" boards
With --target_board=native-extended-gdbserver, we get:

  Running .../src/gdb/testsuite/gdb.base/term.exp ...
  FAIL: gdb.base/term.exp: info terminal at breakpoint

  (gdb) info terminal
  No saved terminal information.

Fix it by running the test everywhere, and expecting different output
on non-native targets.

gdb/testsuite/ChangeLog:
2017-10-13  Pedro Alves  <palves@redhat.com>

	* gdb.base/term.exp: Don't skip if is_remote target.  Instead,
	expect different "info terminal" output if testing with a
	non-native target.
2017-10-13 13:41:44 +01:00
Pedro Alves ebe3b40202 Remove is_remote kfail from gdb.python/py-evthreads.exp
This testcase works fine with gdbserver nowadays.  So remove the
kfail.

gdb/testsuite/ChangeLog:
2017-10-13  Pedro Alves  <palves@redhat.com>
	    Simon Marchi  <simon.marchi@polymtl.ca>

	PR python/12966
	* gdb.python/py-evthreads.exp: Remove is_remote target kfail.
2017-10-13 13:25:20 +01:00
Pedro Alves 42f1b1617e Fix gdb.python/py-evthreads.exp with --target_board=native-extended-gdbserver
Fixes:
  Running ..../src/gdb/testsuite/gdb.python/py-evthreads.exp ...
  FAIL: gdb.python/py-evthreads.exp: run to breakpoint 1
  FAIL: gdb.python/py-evthreads.exp: reached breakpoint 2
  FAIL: gdb.python/py-evthreads.exp: thread 2
  FAIL: gdb.python/py-evthreads.exp: reached breakpoint 3
  FAIL: gdb.python/py-evthreads.exp: thread 3
  FAIL: gdb.python/py-evthreads.exp: continue thread 1
  [... cascading time outs ...]

By following the usual pattern that makes sure that non-stop is enabled
before connecting to gdbserver.

gdb/testsuite/ChangeLog:
2017-10-13  Pedro Alves  <palves@redhat.com>

	* gdb.python/py-evthreads.exp: Start GDB with "set non-stop on"
	already.
2017-10-13 13:15:04 +01:00
Pedro Alves 8d6ef72b04 kfail gdb.python/py-evsignal.exp on RSP targets properly
Fixes, with --target_board=native-extended-gdbserver:

   Running ..../src/gdb/testsuite/gdb.python/py-evsignal.exp ...
   FAIL: gdb.python/py-evsignal.exp: signal Thread 3

gdb/testsuite/ChangeLog:
2017-10-13  Pedro Alves  <palves@redhat.com>

	* gdb.python/py-evsignal.exp: Check gdb_protocol instead of
	is_remote.
2017-10-13 12:29:49 +01:00
Pedro Alves d7bcd5b8e5 Skip gdb.threads/thread_events.exp on RSP targets properly
Fixes, with --target_board=native-extended-gdbserver:

  Running ..../src/gdb/testsuite/gdb.threads/thread_events.exp ...
  FAIL: gdb.threads/thread_events.exp: continue to after_join_func with messages enabled (saw 0, expected 1)

gdb/testsuite/ChangeLog:
2017-10-13  Pedro Alves  <palves@redhat.com>

	* gdb.threads/thread_events.exp: Check gdb_protocol instead of
	is_remote.
2017-10-13 12:23:32 +01:00
Pedro Alves df479dc6e0 Tweak gdb.base/corefile.exp is_remote check
1. Otherwise, when we make native-gdbserver board no longer is_remote,
   we get:

  Running .../src/gdb/testsuite/gdb.base/corefile.exp ...
  ERROR: tcl error sourcing .../src/gdb/testsuite/gdb.base/corefile.exp.
  ERROR: gdbserver does not support attach 9327 without extended-remote
      while executing
  "error "gdbserver does not support $command without extended-remote""

  That's fixed by using can_spawn_for_attach instead.

2. The gdb_protocol check fixes this current problem with
   --target_board=extended-remote-gdbserver:

     Running .../src/gdb/testsuite/gdb.base/corefile.exp ...
     FAIL: gdb.base/corefile.exp: run: with core
     FAIL: gdb.base/corefile.exp: run: core file is cleared
     FAIL: gdb.base/corefile.exp: attach: with core
     FAIL: gdb.base/corefile.exp: attach: core file is cleared

   gdb.log:
     (...)
     attach 10859
     Don't know how to attach.  Try "help target".
     (...)

The fix for #2 alone would fix #1 too, but can_spawn_for_attach
expresses the requirement directly, so I still left it there.

gdb/testsuite/ChangeLog:
2017-10-13  Pedro Alves  <palves@redhat.com>

	* gdb.base/corefile.exp (corefile_test_run): Skip if gdb_protocol
	is set.
	(corefile_test_attach): Likewise.  Check can_spawn_for_attach
	instead of is_remote.
2017-10-13 12:15:52 +01:00
Pedro Alves 23fb630af0 Fix is_remote check in gdb.base/remote.exp
1. Otherwise, when the native-gdbserver board stops setting is_remote,
   this test would stop running there.

2. Makes the test run with --target_board=native-extended-gdbserver
   too.

gdb/testsuite/ChangeLog:
2017-10-13  Pedro Alves  <palves@redhat.com>

	* gdb.base/remote.exp: Check gdb_protocol instead of is_remote.
	(top level): Add comment.
2017-10-13 11:20:37 +01:00
Pedro Alves cc77b1dc33 gdb.base/remote.exp: Fix typo and add missing return
(Dropped 'u' while at it because we're supposed to prefer American
English spelling...)

gdb/testsuite/ChangeLog:
2017-10-13  Pedro Alves  <palves@redhat.com>

	* gdb.base/remote.exp (top level): Fix comment typo and add
	missing return.
2017-10-13 11:14:16 +01:00
Pedro Alves 27c9e813f9 Make gdb.base/solib-nodir.exp work with --target_board=native-extended-gdbserver
Fixes:
 Running .../src/gdb/testsuite/gdb.base/solib-nodir.exp ...
 FAIL: gdb.base/solib-nodir.exp: library loaded

... by using the new "set cwd" command.

gdb/testsuite/ChangeLog:
2017-10-13  Pedro Alves  <palves@redhat.com>
	    Simon Marchi <simon.marchi@polymtl.ca>

	* gdb.base/solib-nodir.exp: Split is_remote and skip_shlib_tests
	calls and add comments.  Skip test if use_gdb_stub is set.
	(top level): Use "set cwd" command instead of "cd" command.
2017-10-13 10:29:30 +01:00
Pedro Alves 5e830d9807 Eliminate is_remote check in gdb.base/shlib-call.exp
gdb/testsuite/ChangeLog:
2017-10-13  Pedro Alves  <palves@redhat.com>

	* gdb.base/shlib-call.exp (top level): Use gdb_run_cmd and remove
	is_remote target check.
2017-10-13 10:22:09 +01:00
Simon Marchi c2508e905f Remove simple_displaced_step_copy_insn
Nothing uses this function.  Remove it, and adjust comments referring to
it.

gdb/ChangeLog:

	* arch-utils.h (simple_displaced_step_copy_insn): Remove.
	* arch-utils.c (simple_displaced_step_copy_insn): Remove.
	* gdbarch.sh (displaced_step_copy_insn): Adjust comment.
	* gdbarch.h: Regenerate.
	* i386-linux-tdep.c (i386_linux_displaced_step_copy_insn):
	Adjust comment.
	* i386-tdep.c (i386_displaced_step_copy_insn): Adjust comment.
	(i386_displaced_step_fixup): Adjust comment.
	* rs6000-tdep.c (ppc_displaced_step_copy_insn): Adjust comment.
2017-10-12 21:42:23 -04:00
Pedro Alves f5ca00321d Eliminate is_remote check in gdb.base/scope.exp
This commit makes --target_board=native-gdbserver (and in principle
all other is_remote boards) pass all the same gdb.base/scope.exp tests
as native testing.

I first wrote the gdb.base/scope.exp change described in the ChangeLog
below and in the new comments in the patch, knowing that gdb_file_cmd
was the right thing to use here.

However, that revealed that the native-extended-gdbserver board should
be overriding gdb_file_cmd+gdb_reload instead of gdb_load, as is
hinted at by the comments on top of the default implementations in
testsuite/lib/gdb.exp, because otherwise a gdb_run_cmd after
gdb_file_cmd misses setting "set remote exec-file".  However, if we do
that and remove gdb_load, then we regress gdb.base/dbx.exp, so for now
keep the gdb_load override as well.

gdb/testsuite/ChangeLog:
2017-10-13  Pedro Alves  <palves@redhat.com>

	* gdb.base/scope.exp: Use build_executable + clean_restart +
	gdb_file_cmd instead of prepare_for_testing and no longer skip
	"before run" tests on is_remote target boards.  Update comments.
	* boards/native-extended-gdbserver.exp
	(extended_gdbserver_load_last_file): New, factored out from ...
	(gdb_load): ... this.  Move further below and add comment.
	(extended_gdbserver_gdb_file_cmd, gdb_file_cmd, gdb_reload): New.
2017-10-13 01:27:18 +01:00
Pedro Alves 8aed1c0d04 Remove references to gdb64 in the testsuite
I'm not sure whether this gdb64 was ever a thing in the upstream repo,
but it certainly doesn't exist nowadays.

AFAICT, this came in with the original big merge with the HP tree:
https://sourceware.org/ml/gdb-patches/1999-q2/msg00149.html

gdb/testsuite/ChangeLog:
2017-10-12  Pedro Alves  <palves@redhat.com>

	* gdb.base/attach.exp: Remove references to gdb64.
	* gdb.base/dbx.exp: Remove references to gdb64.
2017-10-13 00:40:23 +01:00
Simon Marchi cfa34c871c Remove is_remote check in labels.exp
This works fine with remote target boards.

gdb/testsuite/ChangeLog:
2017-10-12  Simon Marchi  <simon.marchi@polymtl.ca>
	    Pedro Alves  <palves@redhat.com>

	* gdb.base/label.exp: Remove is_remote target check.
2017-10-12 23:14:09 +01:00
Pedro Alves 9192b7decc Make gdb.base/auvx.exp work with --target_board=native-extended-gdbserver
Currently we get:
 Running .../src/gdb/testsuite/gdb.base/auxv.exp ...
 WARNING: can't generate a core file - core tests suppressed - check ulimit -c

After this commit we get all the same PASSes as when native testing.

The problem is that the testcase wants to create a core dump in a
temporary directory and it is using the "cd" command to start the
inferior with that directory as current directory, but that command
only affects the inferior's cwd when native debugging.  Fix it by
using using the new "set cwd" command instead, which works with
gdbserver as well.

This still won't work with stub-like targets, because with those when
we connect the inferior is already running.  It'd be possible to make
it work by making the inferior itself change dirs, but we'll need to
make the native-gdbserver board no longer set is_remote first.

gdb/testsuite/ChangeLog:
2017-10-12  Pedro Alves  <palves@redhat.com>

	* gdb.base/auvx.exp (coredir): Update comment.
	(top level) <core_works>: Use "set cwd" command instead of "cd"
	command.
2017-10-12 23:06:15 +01:00
Tom Tromey a900ff724a Use bool in pv_area
This updates a couple of member functions in pv_area to return bool.

gdb/ChangeLog
2017-10-12  Tom Tromey  <tom@tromey.com>

	* prologue-value.h (pv_area::store_would_trash): Return bool.
	(pv_area::find_reg): Likewise.
	* prologue-value.c (pv_area::store_would_trash): Return bool.
	(pv_area::find_reg): Likewise.
2017-10-12 15:39:24 -06:00
Tom Tromey f7b7ed97a2 C++-ify prologue-value's pv_area
This patch is an initial C++-ification of pv_area, from
prologue-value.  It turns pv_area into a class with a constructor and
destructor; renames the data members; and changes various functions to
be member functions.  This allows the removal of
make_cleanup_free_pv_area.

gdb/ChangeLog
2017-10-12  Tom Tromey  <tom@tromey.com>

	* s390-linux-tdep.c (s390_store, s390_load)
	(s390_check_for_saved, s390_analyze_prologue): Update.
	* rx-tdep.c (check_for_saved, rx_analyze_prologue): Update.
	* rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update.
	* prologue-value.h (class pv_area): Move from prologue-value.c.
	Change names of members.  Add constructor, destructor, member
	functions.
	(make_pv_area, free_pv_area, make_cleanup_free_pv_area)
	(pv_area_store, pv_area_fetch, pv_area_store_would_trash)
	(pv_area_fetch, pv_area_scan): Don't declare.
	* prologue-value.c (struct pv_area::area_entry): Now member of
	pv_area.
	(struct pv_area): Move to prologue-value.h.
	(pv_area::pv_area): Rename from make_pv_area.
	(pv_area::~pv_area): Rename from free_pv_area.
	(do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove.
	(clear_entries, find_entry, overlaps, store_would_trash, store)
	(fetch, find_reg, scan): Now member of pv_area.
	Remove "area" argument.  Update.
	* msp430-tdep.c (check_for_saved, msp430_analyze_prologue):
	Update.
	* mn10300-tdep.c (push_reg, check_for_saved)
	(mn10300_analyze_prologue): Update.
	* mep-tdep.c (is_arg_spill, check_for_saved)
	(mep_analyze_prologue): Update.
	* m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch)
	(m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill)
	(m32c_is_struct_return, m32c_analyze_prologue): Update.
	* arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue):
	Update.
	* arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update.
	* aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-12 15:39:24 -06:00
Simon Marchi 04ec7890fc linux low: Make the arch code free arch_process_info
For the same reason as the previous patch, we need to make the
arch-specific code free the arch_process_info structure it allocates.

gdb/gdbserver/ChangeLog:

	* linux-low.h (struct linux_target_ops) <delete_process>: New
	field.
	* linux-low.c (linux_mourn): Call the_low_target.delete_process.
	* linux-aarch64-low.c (aarch64_linux_delete_process): New.
	(struct linux_target_ops): Add delete_process callback.
	* linux-arm-low.c (arm_delete_process): New.
	(struct linux_target_ops): Add delete_process callback.
	* linux-bfin-low.c (struct linux_target_ops): Likewise.
	* linux-crisv32-low.c (struct linux_target_ops): Likewise.
	* linux-m32r-low.c (struct linux_target_ops): Likewise.
	* linux-mips-low.c (mips_linux_delete_process): New.
	(struct linux_target_ops): Add delete_process callback.
	* linux-ppc-low.c (struct linux_target_ops): Likewise.
	* linux-s390-low.c (struct linux_target_ops): Likewise.
	* linux-sh-low.c (struct linux_target_ops): Likewise.
	* linux-tic6x-low.c (struct linux_target_ops): Likewise.
	* linux-tile-low.c (struct linux_target_ops): Likewise.
	* linux-x86-low.c (x86_linux_delete_process): New.
	(struct linux_target_ops): Add delete_process callback.
	* linux-xtensa-low.c (struct linux_target_ops): Likewise.
2017-10-12 16:49:27 -04:00
Simon Marchi 466eeceef4 lwp_info: Make the arch code free arch_lwp_info
I have the goal of "poisoning" the XNEW/xfree-family of functions, so
that we catch their usages with non-POD types.  A few things need to be
fixed in the mean time, this is one.

The common lwp code in linux-nat.c and gdbserver/linux-low.c xfrees the
private lwp data of type arch_lwp_info.  However, that type is opaque
from its point of view, as its defined differently in each arch-specific
implementation.  This trips on the std::is_pod<T> check, since the
compiler can't tell whether the type is POD or not if it doesn't know
about it.

My initial patch [1] made a class hierarchy with a virtual destructor.
However, as Pedro pointed out, we only have one native architecture at
the time built in gdb and gdbserver, so that's overkill.  Instead, we
can move the responsibility of free'ing arch_lwp_info to the arch code
(which is also the one that allocated it in the first place).  This is
what this patch does.

Also, I had the concern that if we wanted to use C++ features in these
structures, we would have a problem with the one-definition rule.
However, since a build will only have one version of arch_lwp_info,
that's not a problem.

There are changes in arch-specific files, I was only able to built-test
this patch with the following cross-compilers:

  aarch64-linux-gnu
  alpha-linux-gnu
  arm-linux-gnueabihf
  hppa-linux-gnu
  m68k-linux-gnu
  mips64el-linux-gnuabi64
  powerpc64-linux-gnu
  s390x-linux-gnu
  sh4-linux-gnu
  sparc64-linux-gnu
  x86_64-linux-gnu
  x86_64-w64-mingw32

A buildbot run didn't find any regression.

[1] https://sourceware.org/ml/gdb-patches/2017-08/msg00255.html

gdb/ChangeLog:

	* linux-nat.h (linux_nat_set_delete_thread): New declaration.
	* linux-nat.c (linux_nat_delete_thread): New variable.
	(lwp_free): Invoke linux_nat_delete_thread if set.
	(linux_nat_set_delete_thread): New function.
	* aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Assign
	thread delete callback.
	* arm-linux-nat.c (arm_linux_delete_thread): New function.
	(_initialize_arm_linux_nat): Assign thread delete callback.
	* s390-linux-nat.c (s390_delete_thread): New function.
	(_initialize_s390_nat): Assign thread delete callback.
	* x86-linux-nat.c (x86_linux_add_target): Likewise.
	* nat/aarch64-linux.c (aarch64_linux_delete_thread): New
	function.
	* nat/aarch64-linux.h (aarch64_linux_delete_thread): New
	declaration.
	* nat/x86-linux.c (x86_linux_delete_thread): New function.
	* nat/x86-linux.h (x86_linux_delete_thread): New declaration.

gdb/gdbserver/ChangeLog:

	* linux-aarch64-low.c (the_low_target): Add thread delete
	callback.
	* linux-arm-low.c (arm_delete_thread): New function.
	(the_low_target): Add thread delete callback.
	* linux-bfin-low.c (the_low_target): Likewise.
	* linux-crisv32-low.c (the_low_target): Likewise.
	* linux-low.c (delete_lwp): Invoke delete_thread callback if
	set.
	* linux-low.h (struct linux_target_ops) <delete_thread>: New
	field.
	* linux-m32r-low.c (the_low_target): Add thread delete callback.
	* linux-mips-low.c (mips_linux_delete_thread): New function.
	(the_low_target): Add thread delete callback.
	* linux-ppc-low.c (the_low_target): Likewise.
	* linux-s390-low.c (the_low_target): Likewise.
	* linux-sh-low.c (the_low_target): Likewise.
	* linux-tic6x-low.c (the_low_target): Likewise.
	* linux-tile-low.c (the_low_target): Likewise.
	* linux-x86-low.c (the_low_target): Likewise.
	* linux-xtensa-low.c (the_low_target): Likewise.
2017-10-12 16:48:22 -04:00
Pedro Alves 6bf0052db8 Run gdb.base/catch-fork-static.exp on remote target boards
Another case of a stale check.  We support following forks in the
remote protocol nowadays.

gdb/testsuite/ChangeLog:
2017-10-12  Pedro Alves  <palves@redhat.com>
	    Simon Marchi  <simon.marchi@polymtl.ca>

	* gdb.base/catch-fork-static.exp: No longer skip on is_remote
	target boards.
2017-10-12 20:06:59 +01:00
Pedro Alves e48ef82dd2 checkpoint.exp: Check for non-"target native" instead of isnative/is_remote
This gets rid of a number of FAILs with
--target_board=native-extended-gdbserver.

The fact that checkpointing does not work has nothing to do with
dejagnu's native and remote concepts.  It only works with native Linux
targets because the implementation is currently baked with
linux-nat.c.

gdb/testsuite/ChangeLog:
2017-10-12  Pedro Alves  <palves@redhat.com>
	    Simon Marchi  <simon.marchi@polymtl.ca>

	* gdb.base/checkpoint.exp: Don't check is_remote or isnative.
	Instead skip if there's any gdb_protocol set.
2017-10-12 19:54:57 +01:00
Simon Marchi 8d7aea574a Remove is_remote target check from gdb.base/dprintf-non-stop.exp
1. is_remote is not the right check.

2. Both Simon & Pedro ran it continuously for some time against
   native-gdbserver and didn't see a failure.

3. The test has been running against native-extended-gdbserver anyway.

gdb/testsuite/ChangeLog:
2017-10-12  Simon Marchi  <simon.marchi@polymtl.ca>
	    Pedro Alves  <palves@redhat.com>

	* gdb.base/dprintf-non-stop.exp: Remove is_remote target check.
2017-10-12 19:33:06 +01:00
Pedro Alves 30440677f3 Tighten remote check in gdb.base/argv0-symlink.exp
Check for gdbserver instead of dejagnu remote.  Unlike what the
comment says, the test actually fails with target remote + gdbserver
(it does pass with extended-remote).  The result is:

 FAIL -> KFAIL with --target_board=native-gdbserver
 KPASS -> PASS with --target_board=native-extended-gdbserver

gdb/testsuite/ChangeLog:
2017-10-12  Pedro Alves  <palves@redhat.com>
	    Simon Marchi  <simon.marchi@polymtl.ca>

	* gdb.base/argv0-symlink.exp: kfail on remote gdbserver,
	instead of on dejagnu remote boards.
2017-10-12 19:16:54 +01:00
Pedro Alves 4e04f0450f Enable gdb.base/inferior-died.exp on is_remote target boards
We support follow-fork in the remote protocol nowadays.

Also, the right way to enable non-stop mode is to do it before
connecting, and for use_gdb_stub boards, that means we have to do it
at gdb_load time.  The "modern" pattern for that is to pass non-stop
in GDBFLAGS.

This makes the test pass with --target_board=native-gdbserver.

gdb/testsuite/ChangeLog:
2017-10-12  Pedro Alves  <palves@redhat.com>
	    Simon Marchi <simon.marchi@polymtl.ca>

	* gdb.base/inferior-died.exp: Remove is_remote and isnative
	checks.  Use build_executable + clean_restart instead of
	prepare_for_testing.  Pass "set non-stop on" via GDBFLAGS instead
	of enabling non-stop after starting gdb.
2017-10-12 18:39:13 +01:00
Pedro Alves 871a186e41 Enable gdb.threads/non-ldr-exc-*.exp on is_remote target boards
This commit makes the gdb.threads/non-ldr-exc-*.exp tests run (and
pass) with --target_board=native-gdbserver.

(These tests were already running with
--target_board=native-extended-gdbserver, because that board is not
is_remote.)

The "No exec event support in the remote protocol." comment is stale.
It's actually supported.

gdb/ChangeLog:
2017-10-12  Pedro Alves  <palves@redhat.com>

	* gdb.threads/non-ldr-exc-1.exp: No longer skip if is_remote target.
	* gdb.threads/non-ldr-exc-2.exp: Ditto.
	* gdb.threads/non-ldr-exc-3.exp: Ditto.
	* gdb.threads/non-ldr-exc-4.exp: Ditto.
2017-10-12 18:05:33 +01:00
Tom Tromey f71c882261 Remove cleanups from TUI
This removes the last cleanups from the TUI, by using std::string
rather than manual memory management.

Regression tested against gdb.tui/*.exp on Fedora 26 x86-64.

gdb/ChangeLog
2017-10-09  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.c (tui_set_win_height, parse_scrolling_args): Use
	std::string.
	* tui/tui-layout.c (enum tui_status): Use std::string.
2017-10-11 16:21:43 -06:00
Tom Tromey 981a3fb359 Constify add_prefix_cmd
This changes add_prefix_cmd to accept a const-taking function as an
argument; then fixes up all the callers.

In a couple of spots I had to add a non-const overload of a function,
because the function is passed to two different command-adding
"constructors".  These overloads are temporary; once constification is
complete they can be removed.

This patch also fixes a typo I happened to notice while constifying.

Note that this touches a couple of files (gnu-nat.c and go32-nat.c)
that I can't build.  So, while I made a best-effort there, I am not
certain they will still compile.

Tested by rebuilding.

gdb/ChangeLog
2017-10-11  Tom Tromey  <tom@tromey.com>

	* gdbthread.h (thread_command): Constify.
	* inferior.h (detach_command): Constify.
	* top.h (set_history, show_history): Constify.
	* arm-tdep.c (set_arm_command, show_arm_command): Constify.
	* serial.c (serial_set_cmd, serial_show_cmd): Constify.
	* bsd-kvm.c (bsd_kvm_cmd): Constify.
	* printcmd.c (set_command): Constify.
	(non_const_set_command): New function.
	* dcache.c (set_dcache_command, show_dcache_command): Constify.
	* breakpoint.c (enable_command, disable_command, delete_command)
	(catch_command, tcatch_command, set_breakpoint_cmd)
	(show_breakpoint_cmd): Constify.
	* macrocmd.c (macro_command): Constify.
	* infcmd.c (unset_command, kill_command, detach_command)
	(info_proc_cmd): Constify.
	* i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Constify.
	* auto-load.c (show_auto_load_cmd, set_auto_load_cmd)
	(info_auto_load_cmd): Constify.
	* target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd)
	(unset_tdesc_cmd): Constify.
	* ada-lang.c (set_ada_command, show_ada_command)
	(maint_set_ada_cmd, maint_show_ada_cmd): Constify.
	* guile/guile.c (set_guile_command, show_guile_command)
	(info_guile_command): Constify.
	* tui/tui-win.c (tui_command, set_tui_cmd, show_tui_cmd):
	Constify.
	* skip.c (skip_command): Constify.
	* compile/compile.c (_initialize_compile): Constify.
	* dwarf2read.c (set_dwarf_cmd, show_dwarf_cmd): Constify.
	* btrace.c (maint_btrace_cmd, maint_btrace_set_cmd)
	(maint_btrace_show_cmd, maint_btrace_pt_set_cmd)
	(maint_btrace_pt_show_cmd): Constify.
	* remote.c (set_remote_cmd, show_remote_cmd, remote_command):
	Constify.
	* python/python.c (user_show_python, user_set_python): Constify.
	* mips-tdep.c (set_mips_command, show_mips_command)
	(set_mipsfpu_command): Constify.
	* record-btrace.c (cmd_record_btrace_start)
	(cmd_set_record_btrace, cmd_show_record_btrace)
	(cmd_set_record_btrace_bts, cmd_show_record_btrace_bts)
	(cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): Constify.
	* rs6000-tdep.c (set_powerpc_command, show_powerpc_command):
	Constify.
	* symfile.c (overlay_command): Constify.
	* spu-tdep.c (set_spu_command, show_spu_command): Constify.
	* cli/cli-logging.c (set_logging_command, show_logging_command):
	Constify.
	* cli/cli-dump.c (dump_command, append_command)
	(srec_dump_command, ihex_dump_command, verilog_dump_command)
	(tekhex_dump_command, binary_dump_command)
	(binary_append_command): Constify.
	* cli/cli-decode.c (struct cmd_list_element): Change type of
	"fun".
	* cli/cli-cmds.c (info_command, show_command, set_debug)
	(show_debug): Constify.
	(show_command): Add non-const overload.
	* top.c (set_history, show_history): Constify.
	* sh-tdep.c (set_sh_command, show_sh_command): Constify.
	* command.h (add_prefix_cmd): Accept a cmd_const_cfunc_ftype.
	* target.c (target_command): Constify.
	* sparc64-tdep.c (info_adi_command): Constify.
	* record-full.c (cmd_record_full_start): Constify.
	(set_record_full_command): Constify.  Fix typo.
	(show_record_full_command): Constify.
	* thread.c (thread_command, thread_apply_command): Constify.
	* memattr.c (dummy_cmd): Constify.
	* value.c (function_command): Constify.
	* frame.c (set_backtrace_cmd, show_backtrace_cmd): Constify.
	* probe.c (info_probes_command): Constify.
	* ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Constify.
	* gnu-nat.c (set_task_cmd, show_task_cmd, set_thread_cmd)
	(show_thread_cmd, set_thread_default_cmd)
	(show_thread_default_cmd): Constify.
	(check_empty): Constify.
	* tracepoint.c (tfind_command): Constify.
	* cp-support.c (maint_cplus_command): Constify.
	* windows-tdep.c (info_w32_command): Constify.
	* record.c (cmd_record_start, set_record_command)
	(show_record_command, info_record_command, cmd_record_goto):
	Constify.
	* ravenscar-thread.c (set_ravenscar_command)
	(show_ravenscar_command): Constify.
	* utils.c (set_internal_problem_cmd, show_internal_problem_cmd):
	Constify.
	(add_internal_problem_command): Remove casts.
	* arc-tdep.c (maintenance_print_arc_command): Constify.
	* valprint.c (set_print, show_print, set_print_raw)
	(show_print_raw): Constify.
	* maint.c (maintenance_command, maintenance_info_command)
	(maintenance_print_command, maintenance_set_cmd)
	(maintenance_show_cmd, set_per_command_cmd)
	(show_per_command_cmd, maintenance_check_command): Constify.
	* language.c (set_check, show_check): Constify.
	* typeprint.c (show_print_type, set_print_type): Constify.
	* go32-nat.c (go32_info_dos_command): Constify.
2017-10-11 16:21:02 -06:00
Tom Tromey fdf44873ec Remove prepare_re_set_context
prepare_re_set_context returns a null cleanup and doesn't seem
generally useful.  This patch removes it plus a few more cleanups; and
changes breakpoint_re_set to use scoped_restore rather than its own
manual mechanism.

2017-10-11  Tom Tromey  <tom@tromey.com>

	* breakpoint.c (prepare_re_set_context): Remove.
	(breakpoint_re_set_one): Update.  Don't use cleanups.
	(breakpoint_re_set): Use scoped_restore, std::string, and
	scoped_restore_current_language.
2017-10-11 15:46:31 -06:00
Tom Tromey 81b1e71c4a Remove some cleanups from breakpoint.c
This removes some cleanups from breakpoint.c, replacing them with C++
data structures.

2017-10-11  Tom Tromey  <tom@tromey.com>

	* breakpoint.c (commands_command_1): Use std::string.
	(cleanup_executing_breakpoints): Remove.
	(bpstat_do_actions_1): Use scoped_restore.
	(bpstat_check_watchpoint): Use std::string.
	(decode_static_tracepoint_spec): Likewise.
	(break_range_command): Likewise.
	(watch_command_1): Likewise.
	(compare_breakpoints): Change argument types.
	(clear_command): Use std::vector.
	(cleanup_executing_breakpoints): Remove.
	(update_global_location_list): Use unique_xmalloc_ptr.
	(strace_command): Remove unused declaration.
2017-10-11 15:46:31 -06:00
John Baldwin 4f9d99066e Add native target for FreeBSD/arm.
gdb/ChangeLog:

	* Makefile.in (ALLDEPFILES): Add arm-fbsd-nat.c.
	* NEWS: Mention new FreeBSD/arm native configuration.
	* configure.host: Add arm*-*-freebsd*.
	* configure.nat: Likewise.
	* arm-fbsd-nat.c: New file.
2017-10-11 11:16:34 -07:00
John Baldwin 7176dfd28d Add FreeBSD/arm architecture.
Support for collecting and supplying general purpose and floating
point registers is provided along with signal frame unwinding.  While
FreeBSD/arm kernels do populate NT_FPREGSET notes, they are always
zero-filled, so this implementation ignores them.  Recent FreeBSD/arm
kernels generate NT_ARM_VFP notes which are used to supply
floating-point registers.  As with Linux, the AT_HWCAP feature flags
are used to determine the correct target description.

gdb/ChangeLog:

	* Makefile.in (ALL_TARGET_OBS): Add arm-fbsd-tdep.o.
	(ALLDEPFILES): Add arm-fbsd-tdep.c.
	* NEWS: Mention new FreeBSD/arm target.
	* configure.tgt: Add arm*-*-freebsd*.
	* arm-fbsd-tdep.c: New file.
	* arm-fbsd-tdep.h: New file.
2017-10-11 11:16:34 -07:00
Maciej W. Rozycki fe22022617 GDB: Remove Linux core PRPSINFO note writer override
Revert parts of commit b3ac9c7756 ("Put more info in NT_PRPSINFO Linux
notes"), <https://sourceware.org/ml/binutils/2013-02/msg00024.html>, and
remove support for a Linux core PRPSINFO note writer override, now that
all variants are handled automatically within BFD itself.

	gdb/
	* linux-tdep.c (linux_make_corefile_notes): Remove call to
	`gdbarch_elfcore_write_linux_prpsinfo'.
	* gdbarch.sh (elfcore_write_linux_prpsinfo): Remove architecture
	method.
	(elf_internal_linux_prpsinfo): Remove declaration.
	* gdbarch.h: Regenerate.
	* gdbarch.c: Regenerate.
2017-10-11 15:01:41 +01:00
Maciej W. Rozycki a2f63b2e7a ELF/BFD,GDB: Handle both variants of the 32-bit Linux core PRPSINFO note
Fix commit 70a38d42c5 ("New entry points for writing Linux NT_PRPSINFO
notes."), <https://sourceware.org/ml/binutils/2013-02/msg00023.html>,
and commit b3ac9c7756 ("Put more info in NT_PRPSINFO Linux notes"),
<https://sourceware.org/ml/binutils/2013-02/msg00024.html>, and handle
both variants of the 32-bit Linux core PRPSINFO note across all targets.

The 32-bit Linux core PRPSINFO note matches the 32-bit kernel structure,
defined as follows:

(gdb) ptype struct elf_prpsinfo
type = struct elf_prpsinfo {
    char pr_state;
    char pr_sname;
    char pr_zomb;
    char pr_nice;
    unsigned long pr_flag;
    __kernel_uid_t pr_uid;
    __kernel_gid_t pr_gid;
    pid_t pr_pid;
    pid_t pr_ppid;
    pid_t pr_pgrp;
    pid_t pr_sid;
    char pr_fname[16];
    char pr_psargs[80];
}
(gdb)

where the individual data types of most members are the same across all
32-bit Linux ports, with the exception of `__kernel_uid_t' and
`__kernel_gid_t'.  These are defined in <asm-generic/posix_types.h> as
32-bit `unsigned int' by default, however overridden as 16-bit `unsigned
short' in port-specific <asm/posix_types.h> for a few targets, mostly
earlier ports of Linux, specifically: ARM, CRIS, FR-V, M32R, m68k,
MN10300/AM33, s390, SuperH, SPARC and i386.

The default is the same as the PowerPC variant already handled, as from
the commits referred.  Make the special PowerPC case generic then,
removing the GDB part, and provide a backend flag to switch between the
two cases possible, with the 32-bit one being the default and the 16-bit
one explicitly selected.  Set the flag in the target backends affected.

	bfd/
	* elf-bfd.h (elf_backend_data): Add `linux_prpsinfo32_ugid16'
	member.
	(elfcore_write_ppc_linux_prpsinfo32): Remove prototype.
	* elf32-ppc.c (elfcore_write_ppc_linux_prpsinfo32): Remove.
	(elf_external_ppc_linux_prpsinfo32)
	(swap_ppc_linux_prpsinfo32_out): Move to...
	* elf-linux-core.h (elf_external_linux_prpsinfo32_ugid32)
	(swap_linux_prpsinfo32_ugid32_out): ... these.
	(elf_external_linux_prpsinfo32): Rename to...
	(elf_external_linux_prpsinfo32_ugid16): ... this.
	(swap_linux_prpsinfo32_out): Rename to...
	(swap_linux_prpsinfo32_ugid16_out): ... this.
	* elfxx-target.h [!elf_backend_linux_prpsinfo32_ugid16]
	(elf_backend_linux_prpsinfo32_ugid16): Define.
	(elfNN_bed): Initialize `linux_prpsinfo32_ugid16' member.
	* elf.c (elfcore_write_linux_prpsinfo32): Handle both variants
	of the 32-bit Linux core PRPSINFO note.
	* elf32-am33lin.c (elf_backend_linux_prpsinfo32_ugid16): Define.
	* elf32-arm.c (elf_backend_linux_prpsinfo32_ugid16): Define.
	* elf32-cris.c (elf_backend_linux_prpsinfo32_ugid16): Define.
	* elf32-frv.c (elf_backend_linux_prpsinfo32_ugid16): Define.
	* elf32-i386.c (elf_backend_linux_prpsinfo32_ugid16): Define.
	* elf32-m32r.c (elf_backend_linux_prpsinfo32_ugid16): Define.
	* elf32-m68k.c (elf_backend_linux_prpsinfo32_ugid16): Define.
	* elf32-s390.c (elf_backend_linux_prpsinfo32_ugid16): Define.
	* elf32-sh.c (elf_backend_linux_prpsinfo32_ugid16): Define.
	* elf32-sparc.c (elf_backend_linux_prpsinfo32_ugid16): Define.

	gdb/
	* ppc-linux-tdep.c (ppc_linux_init_abi): Remove call to
	`set_gdbarch_elfcore_write_linux_prpsinfo'.
2017-10-11 15:01:40 +01:00
Pedro Alves 458ca1d02e Garbage collect reattach_breakpoints
Not used anywhere.

gdb/ChangeLog:
2017-10-11  Pedro Alves  <palves@redhat.com>

	* breakpoint.c (reattach_breakpoints): Delete.
	* breakpoint.h (reattach_breakpoints): Delete.
2017-10-11 14:45:17 +01:00
Simon Marchi 905014d720 Use std::vector for symtab_fns
Simple replacement of VEC with std::vector.

gdb/ChangeLog:

	* symfile.c (registered_sym_fns): Make struct, not typedef.
	(DEF_VEC_O (registered_sym_fns)): Remove.
	(symtab_fns): Change type to std::vector.
	(add_symtab_fns): Adjust.
	(find_sym_fns): Adjust.
2017-10-11 09:34:08 -04:00
Anton Kolesov 56d704daee arc: Pass proper CPU value to the disassembler
There was a problem with generation of the disassembler options for ARC in GDB,
because a BFD architecture name was used as a CPU name, but they have different
meaning even if some architectures have same name as respective CPUs.  Target
description specifies a BFD architecture, which is different from ARC CPU, as
accepted by the disassembler (and most other ARC tools), because CPU values are
much more fine grained - there can be multiple CPU values per single BFD
architecture.  As a result this code should translate architecture to some CPU
value.  Since there is no info on exact CPU configuration, it is best to use
the most feature-rich CPU, so that the disassembler will recognize all
instructions available to the specified architecture.

gdb/ChangeLog
yyyy-mm-dd  Anton Kolesov  <Anton.Kolesov@synopsys.com>

	* arc-tdep.c (arc_gdbarch_init): Pass proper cpu value to disassembler.
	* arc-tdep.h (arc_arch_is_em): New function.
	(arc_arch_is_hs): Likewise.

gdb/testsuite/ChangeLog
yyyy-mm-dd  Anton Kolesov  <Anton.Kolesov@synopsys.com>

	* gdb.arch/arc-tdesc-cpu.exp: New file.
	* gdb.arch/arc-tdesc-cpu.xml: Likewise.
2017-10-11 15:42:52 +03:00
Egeyar Bagcioglu 7fa29be949 Remove unnecessary parentheses in declarations
GCC commit a94975e57 ("C++ warning on vexing parse") introduces new
warnings "unnecessary parentheses in the declaration of ...".  These
cause the build of binutils and gdb to fail.  This patch removes those
parentheses for a successful build.

gdb/ChangeLog:
2017-10-11  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>

	* macrotab.h (macro_lookup_inclusion): Remove unnecessary
	parentheses in the declaration.
	(macro_lookup_inclusion): Likewise.
	(macro_lookup_definition): Likewise.
	* p-lang.h (pascal_builtin_types): Likewise.
	* tui/tui-data.c (tui_win_list): Likewise.
	* tui/tui-data.h (tui_win_list): Likewise.
	* utils.h (make_cleanup_free_section_addr_info): Likewise.
2017-10-11 11:00:48 +01:00
Kevin Buettner d9b477e3b7 Flash memory size not aligned to address
(This patch is from Mark Rages <markrages@gmail.com>.)

The Nordic nRF52 memory map, reported from black magic probe:

Num Enb Low Addr High Addr Attrs
0 y 0x00000000 0x00080000 flash blocksize 0x1000 nocache
1 y 0x10001000 0x10001210 flash blocksize 0x210 nocache
2 y 0x20000000 0x20010000 rw nocache

The region at 0x10001000 is "UICR" and it is a section of flash that is
erased all at once.

Notice the odd size: 0x210 is the size of the region defined in the
datasheet.

But because the block size was listed as 0x210, gdb was insisting on
issuing two erase commands divisible by 0x210, starting below 0x10001000.

This patch fixes it by doing the alignment computation from the start of
the region, not from address 0.

gdb/ChangeLog:

	* target-memory.c (block_boundaries): Fix for block address not
	aligned on block size.
2017-10-11 00:50:29 -07:00