Commit Graph

1897 Commits

Author SHA1 Message Date
Pedro Alves f348d89aec Fix PR gdb/18653: gdb disturbs inferior's inherited signal dispositions
gdb's (or gdbserver's) own signal handling should not interfere with
the signal dispositions their spawned children inherit.  However, it
currently does.  For example, some paths in gdb cause SIGPIPE to be
set to SIG_IGN, and as consequence, the child starts with SIGPIPE to
set to SIG_IGN too, even though gdb was started with SIGPIPE set to
SIG_DFL.

This is because the exec family of functions does not reset the signal
disposition of signals that are set to SIG_IGN:

  http://pubs.opengroup.org/onlinepubs/7908799/xsh/execve.html

  Signals set to the default action (SIG_DFL) in the calling process
  image are set to the default action in the new process
  image. Signals set to be ignored (SIG_IGN) by the calling process
  image are set to be ignored by the new process image. Signals set to
  be caught by the calling process image are set to the default action
  in the new process image (see <signal.h>).

And neither does it reset signal masks or flags.

In order to be transparent, when spawning new child processes to debug
(with "run", etc.), reset signal actions and mask back to what was
originally inherited from gdb/gdbserver's parent, just before execing
the target program to debug.

gdb/ChangeLog:
2016-08-09  Pedro Alves  <palves@redhat.com>

	PR gdb/18653
	* Makefile.in (SFILES): Add
	common/signals-state-save-restore.c.
	(HFILES_NO_SRCDIR): Add common/signals-state-save-restore.h.
	(COMMON_OBS): Add signals-state-save-restore.o.
	(signals-state-save-restore.o): New rule.
	* configure: Regenerate.
	* fork-child.c: Include "signals-state-save-restore.h".
	(fork_inferior): Call restore_original_signals_state.
	* main.c: Include "signals-state-save-restore.h".
	(captured_main): Call save_original_signals_state.
	* common/common.m4: Add sigaction to AC_CHECK_FUNCS checks.
	* common/signals-state-save-restore.c: New file.
	* common/signals-state-save-restore.h: New file.

gdb/gdbserver/ChangeLog:
2016-08-09  Pedro Alves  <palves@redhat.com>

	PR gdb/18653
	* Makefile.in (OBS): Add signals-state-save-restore.o.
	(signals-state-save-restore.o): New rule.
	* config.in: Regenerate.
	* configure: Regenerate.
	* linux-low.c: Include "signals-state-save-restore.h".
	(linux_create_inferior): Call
	restore_original_signals_state.
	* server.c: Include "dispositions-save-restore.h".
	(captured_main): Call save_original_signals_state.

gdb/testsuite/ChangeLog:
2016-08-09  Pedro Alves  <palves@redhat.com>

	PR gdb/18653
	* gdb.base/signals-state-child.c: New file.
	* gdb.base/signals-state-child.exp: New file.
	* gdb.gdb/selftest.exp (do_steps_and_nexts): Add new pattern.
2016-08-09 20:16:20 +01:00
John Baldwin a3405d124e Consolidate x86 debug register code for BSD native targets.
Move the debug register support code from amd64bsd-nat.c and
i386bsd-nat.c into a shared x86bsd-nat.c.

Instead of setting up x86_dr_low in amd64fbsd-nat.c and
i386fbsd-nat.c, add a x86bsd_target function that creates a new target
that inherits from inf_ptrace and sets up x86 debug registers if
supported.  In addition to initializing x86_dr_low, the x86bsd target
installs a custom mourn_inferior target operation to clean up the
x86 debug register state.  Previously this was only done on amd64.
Now it will be done for both i386 and amd64.  The i386bsd_target and
amd64bsd_target functions create targets that inherit from x86bsd
rather than inf_ptrace.

gdb/ChangeLog:

	* Makefile.in [HFILES_NO_SRCDIR]: Replace 'amd64bsd-nat.h' with
	'x86bsd-nat.h'.
	* amd64bsd-nat.c: Include 'x86bsd-nat.h' instead of
	'amd64bsd-nat.h'.
	(amd64bsd_xsave_len): Rename and move to x86bsd-nat.c.
	(amd64bsd_fetch_inferior_registers): Replace 'amd64bsd_xsave_len'
	with 'x86bsd_xsave_len'.
	(amd64bsd_store_inferior_registers): Likewise.
	(amd64bsd_target): Inherit from x86bsd_target.
	(amd64bsd_dr_get): Rename and move to x86bsd-nat.c.
	(amd64bsd_dr_set): Likewise.
	(amd64bsd_dr_set_control): Likewise.
	(amd64bsd_dr_set_addr): Likewise.
	(amd64bsd_dr_get_addr): Likewise.
	(amd64bsd_dr_get_status): Likewise.
	(amd64bsd_dr_get_control): Likewise.
	* amd64fbsd-nat.c: Include 'x86bsd-nat.h' instead of
	'amd64bsd-nat.h'.
	(super_mourn_inferior): Move to x86bsd-nat.c.
	(amd64fbsd_mourn_inferior): Rename and move to x86bsd-nat.c.
	(amd64fbsd_read_description): Replace 'amd64bsd_xsave_len' with
	'x86bsd_xsave_len'.
	(_initialize_amd64fbsd_nat): Remove x86 watchpoint setup and
	mourn_inferior' target op.
	* config/i386/fbsd.mh (NATDEPFILES): Add x86bsd-nat.o.
	* config/i386/fbsd64.mh: Likewise.
	* config/i386/nbsd64.mh: Likewise.
	* config/i386/nbsdelf.mh: Likewise.
	* config/i386/obsd.mh: Likewise.
	* config/i386/obsd64.mh: Likewise.
	* i386bsd-nat.c: Include 'x86bsd-nat.h'.
	(i386bsd_xsave_len): Rename and move to x86bsd-nat.c.
	(i386bsd_fetch_inferior_registers): Replace 'i386bsd_xsave_len'
	with 'x86bsd_xsave_len'.
	(i386bsd_store_inferior_registers): Likewise.
	(i386bsd_target): Inherit from x86bsd_target.
	(i386bsd_dr_get): Rename and move to x86bsd-nat.c.
	(i386bsd_dr_set): Likewise.
	(i386bsd_dr_set_control): Likewise.
	(i386bsd_dr_set_addr): Likewise.
	(i386bsd_dr_get_addr): Likewise.
	(i386bsd_dr_get_status): Likewise.
	(i386bsd_dr_get_control): Likewise.
	* i386bsd-nat.h (i386bsd_xsave_len): Remove.
	(i386bsd_dr_set_control): Remove.
	(i386bsd_dr_set_addr): Remove.
	(i386bsd_dr_get_addr): Remove.
	(i386bsd_dr_get_status): Remove.
	(i386bsd_dr_get_control): Remove.
	* i386fbsd-nat.c: Include 'x86bsd-nat.h'.
	(i386fbsd_read_description): Replace 'i386bsd_xsave_len' with
	'x86bsd_xsave_len'.
	(_initialize_i386fbsd_nat): Remove x86 watchpoint setup and
	mourn_inferior' target op.
	* x86bsd-nat.c: New file.
	* x86bsd-nat.h: New file.
2016-07-01 07:00:38 -07:00
Yan-Ting Lin a28d8e5037 gdb: new AndesTech NDS32 port
gdb/ChangeLog:

	* Makefile.in (ALL_TARGET_OBS): Add nds32-tdep.o.
	(HFILES_NO_SRCDIR): Add nds32-tdep.h.
	(ALLDEPFILES): Add nds32-tdep.c.
	* NEWS: Mention new NDS32 port.
	* configure.tgt: Add NDS32.
	* nds32-tdep.c: New file.
	* nds32-tdep.h: New file.
	* features/Makefile (XMLTOC): Add nds32.xml.
	* features/nds32-core.xml: New file.
	* features/nds32-fpu.xml: New file.
	* features/nds32-system.xml: New file.
	* features/nds32.c: New file (generated).
	* features/nds32.xml: New file.

gdb/doc/ChangeLog:

	* gdb.texinfo (Standard Target Features): Document NDS32 features.
	(NDS32 Features): New Section.

gdb/testsuite/ChangeLog:

	* gdb.base/float.exp: Add target check for nds32*-*-*.
	* gdb.xml/tdesc-regs.exp: Set core-regs for nds32*-*-*.
2016-06-17 16:58:05 +08:00
Tom Tromey edef7b8cf3 Fix rust-exp handling in makefile
I noticed that the rust-exp handling in the Makefile differed from
that of other .y files.  I believe I noticed this by seeing a stray
"rm" in the build log.

This patch changes the Makefile to bring the rust-exp handling in line
with that of other .y files.

2016-06-10  Tom Tromey  <tom@tromey.com>

	* Makefile.in (COMMON_OBS): Remove rust-exp.o.
	(YYFILES): Add rust-exp.c.
	(YYOBJ): Add rust-exp.o.
	(local-maintainer-clean): Remove rust-exp.c.
2016-06-10 09:57:08 -06:00
Tom Tromey c44af4ebc0 Add support for the Rust language
This patch adds support for the Rust language.

2016-05-17  Tom Tromey  <tom@tromey.com>
	    Manish Goregaokar <manishsmail@gmail.com>

	* symtab.c (symbol_find_demangled_name): Handle Rust.
	* symfile.c (init_filename_language_table): Treat ".rs" as Rust.
	* std-operator.def (STRUCTOP_ANONYMOUS, OP_RUST_ARRAY): New
	constants.
	* rust-lang.h: New file.
	* rust-lang.c: New file.
	* rust-exp.y: New file.
	* dwarf2read.c (read_file_scope): Add Rust producer sniffing.
	(dwarf2_compute_name, read_func_scope, read_structure_type)
	(read_base_type, read_subrange_type, set_cu_language)
	(new_symbol_full, determine_prefix): Handle Rust.
	* defs.h (enum language) <language_rust>: New constant.
	* Makefile.in (SFILES): Add rust-exp.y, rust-lang.c.
	(COMMON_OBS): Add rust-exp.o, rust-lang.o.

2016-05-17  Tom Tromey  <tom@tromey.com>

	* gdb.base/default.exp (set language): Add rust.
2016-05-17 12:02:00 -06:00
Tom Tromey dcd1f97951 Add self-test framework to gdb
I wanted to unit test the Rust lexer, so I added a simple unit testing
command to gdb.

The intent is that self tests will only be compiled into gdb in
development mode.  In release mode they simply won't exist.  So, this
exposes $development to C code as GDB_SELF_TEST.

In development mode, test functions are registered with the self test
module.  A test function is just a function that does some checks, and
throws an exception on failure.

Then this adds a new "maint selftest" command which invokes the test
functions, and a new dejagnu test case that invokes it.

2016-05-17  Tom Tromey  <tom@tromey.com>

	* NEWS: Add "maint selftest" entry.
	* selftest.h: New file.
	* selftest.c: New file.
	* maint.c: Include selftest.h.
	(maintenance_selftest): New function.
	(_initialize_maint_cmds): Add "maint selftest" command.
	* configure.ac (GDB_SELF_TEST): Maybe define.
	* config.in, configure: Rebuild.
	* Makefile.in (SFILES): Add selftest.c.
	(COMMON_OBS): Add selftest.o.

2016-05-17  Tom Tromey  <tom@tromey.com>

	* gdb.texinfo (Maintenance Commands): Document "maint selftest".

2016-05-17  Tom Tromey  <tom@tromey.com>

	* gdb.gdb/unittest.exp: New file.
2016-05-17 12:01:59 -06:00
Tom Tromey 9ab0bb2a67 Fix latent yacc-related bug in gdb/Makefile.in init.c rule
gdb's Makefile.in does not currently scan .y files to add global
initializers from these files to init.c.  However, at least ada-exp.y
tries to use this feature.

This patch fixes the problem.

2016-05-17  Tom Tromey  <tom@tromey.com>

	* Makefile.in (init.c): Search .y files for initialization
	functions.
2016-05-17 12:01:57 -06:00
Pedro Alves 00340e1b91 Introduce a serial interface for select'able events
This patch adds a new "event" struct serial type, that is an
abstraction specifically for waking up blocking waits/selects,
implemented on top of a pipe on POSIX, and on top of a native Windows
event (CreateEvent, etc.) on Windows.

This will be used to plug signal handler / mainline code races.

For example, GDB can indefinitely delay handling a quit request if the
user presses Ctrl-C between the last QUIT call and the next (blocking)
gdb_select call in the event loop:

      QUIT;
                  <<< press ctrl-c here and end up blocked in gdb_select
		      indefinitely.

      gdb_select (...); // whoops, SIGINT was already handled, no EINTR.

A global alone (either the quit flag, or the "ready" flag of the async
signal handlers in the event loop) is not sufficient.

To plug races such as these on POSIX systems, we have to register some
waitable file descriptor in the set of files gdb_select waits on, and
write to it from the signal handler.  This is classically a pipe, and
the pattern called the self-pipe trick.  On Linux, it could be a more
efficient eventfd instead, but I'm sticking with a pipe for
simplifity, as we need it for portability anyway.

(Alternatively, we could use pselect/ppoll, and block signals until
the pselect.  The latter is not a design I think GDB could use,
because we want the QUIT macro to be super cheap, as it is used in
loops.  Plus, Windows.)

This is a "struct serial" because Windows's gdb_select relies on that.
Windows's gdb_select, our "select" replacement, knows how to wait on
all kinds of handles (regular files, pipes, sockets, console, etc.)
unlike the native Windows "select" function, which can only wait on
sockets.  Each file descriptor for a "serial" type that is not
normally waitable with WaitForMultipleObjects must have a
corresponding struct serial instance.  gdb_select then internally
looks up the struct serial instance that wraps each file descriptor,
and asks it for the corresponding Windows waitable handle.

We could use serial_pipe() to create a "struct serial"-wrapped pipe
that is usable everywhere, including Windows.  That's what currently
python/python.c uses for cross-thread posting of events.

However, serial_write and serial_readchar are not designed to be
async-signal-safe on POSIX hosts.  It's easier to bypass those when
setting/clearing the event source.

And writing and a serial pipe is a bit heavy weight on Windows.
gdb_select requires an extra thread to wait on the pipe and several
Windows events, when a single manual-reset Windows event, with no
extra thread is sufficient.

The intended usage is simply:

- Call make_serial_event to create a serial event object.

- From the signal handler call serial_event_set to set the event.

- From mainline code, have select/poll wait for serial_event_fd(), in
  addition to whatever other files you're about to wait for.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

	* Makefile.in (SFILES): Add ser-event.c.
	(HFILES_NO_SRCDIR): Add ser-event.h.
	(COMMON_OBS): Add ser-event.o.
	* ser-event.c, ser-event.h: New files.
	* serial.c (new_serial): New function, factored out from
	(serial_fdopen_ops): ... this.
	(serial_open_ops_1): New function, factored out from
	(serial_open): ... this.
	(serial_open_ops): New function.
	* serial.h (struct serial): Forware declare.
	(serial_open_ops): New declaration.
2016-04-12 16:53:21 +01:00
Pedro Alves f7c382926d Remove support for "target m32rsdi" and "target mips/pmon/ddb/rockhopper/lsi"
This removes support for:

 | target            | source                |
 |-------------------+-----------------------|
 | target m32rsdi    | gdb/remote-m32r-sdi.c |
 | target mips       | gdb/remote-mips.c     |
 | target pmon       | gdb/remote-mips.c     |
 | target ddb        | gdb/remote-mips.c     |
 | target rockhopper | gdb/remote-mips.c     |
 | target lsi        | gdb/remote-mips.c     |

That is:

 - Remote M32R debugging over SDI.

 - Debugging boards using the MIPS remote debugging protocol
   over a serial line, PMON, and a few variants.

These are the last non-"target remote" remote targets in the tree, if
you don't count "target sim".

Refs:

 https://sourceware.org/ml/gdb/2016-03/msg00004.html
 https://sourceware.org/ml/gdb-patches/2016-03/msg00580.html

gdb/ChangeLog:
2016-03-31  Pedro Alves  <palves@redhat.com>

	* NEWS: Mention that support for "target m32rsdi", "target mips",
	"target pmon", "target ddb", "target rockhopper", and "target lsi"
	was removed.
	* Makefile.in (ALL_TARGET_OBS): Remove remote-m32r-sdi.o and
	remote-mips.o.
	(ALLDEPFILES): Remove remote-m32r-sdi.c and remote-mips.c.
	* configure.tgt: Remove all references to remote-m32r-sdi.o and
	remote-mips.o.
	* mips-tdep.c (deprecated_mips_set_processor_regs_hack): Delete
	function.
	* mips-tdep.h (deprecated_mips_set_processor_regs_hack): Delete
	declaration.
	* remote-m32r-sdi.c, remote-mips.c: Delete files.
	* symfile.c (generic_load, generic_load): Remove comments.

gdb/doc/ChangeLog:
2016-03-31  Pedro Alves  <palves@redhat.com>

	* gdb.texinfo (M32R/SDI): Delete node.
	(MIPS Embedded): Remove references to the MIPS remote debugging
	protocol, PMON and variants, and the associated commands.
2016-03-31 13:24:34 +01:00
Pedro Alves e352bf0a3c Support 'make check-parallel' in gdb's build dir
Currently, you can cd to the gdb/testsuite/ dir and use
make check-parallel, instead of using FORCE_PARALLEL:

 $ make -j8 check-parallel RUNTESTFLAGS="--target_board=native-gdbserver"
 $ make -j8 check RUNTESTFLAGS="--target_board=native-gdbserver" FORCE_PARALLEL=1

But you can't do that in the build/gdb/ dir:

 $ make check-parallel RUNTESTFLAGS="--target_board=native-gdbserver"
 make: *** No rule to make target `check-parallel'.  Stop.

I find check-parallel a bit more convenient, and more typo-proof, so
this patch makes it work from the gdb build dir too.

While documenting this in testsuite/README, I found that the parallel
testing mode would better be pulled out to its own section and
extended.

gdb/ChangeLog:
2016-02-11  Pedro Alves  <palves@redhat.com>

	* Makefile.in (check-parallel): New rule.

gdb/testsuite/ChangeLog:
2016-02-11  Pedro Alves  <palves@redhat.com>

	* README (Parallel testing): New section.
	(GDB_PARALLEL): Rewrite.
	(FORCE_PARALLEL): Document.
2016-02-11 19:36:39 +00:00
Walfred Tedeschi 93813b37c8 Merge gdb and gdbserver implementations for siginfo
Extract the compatible siginfo handling from amd64-linux-nat.c and
gdbserver/linux-x86-low to a new file nat/amd64-linux-siginfo.c.

2016-02-02  Walfred Tedeschi  <walfred.tedeschi@intel.com>

gdb/ChangeLog:

	* nat/amd64-linux-siginfo.c: New file.
	* nat/amd64-linux-siginfo.h: New file.
	* Makefile.in (HFILES_NO_SRCDIR): Add nat/amd64-linux-siginfo.h.
	(amd64-linux-siginfo.o): New rule.
	* config/i386/linux64.mh (NATDEPFILES): Add amd64-linux-siginfo.o.
	* amd64-linux-nat.c (nat/amd64-linux-siginfo.h): New include.
	(compat_siginfo_from_siginfo, siginfo_from_compat_siginfo)
	(compat_x32_siginfo_from_siginfo, siginfo_from_compat_x32_siginfo)
	(compat_timeval, compat_sigval, compat_x32_clock, cpt_si_pid)
	(cpt_si_uid, cpt_si_timerid, cpt_si_overrun, cpt_si_status)
	(cpt_si_utime, cpt_si_stime, cpt_si_ptr, cpt_si_addr, cpt_si_band)
	(cpt_si_fd, si_timerid, si_overrun): Move to nat/amd64-linux-siginfo.c.

gdb/gdbserver/ChangeLog:

	* configure.srv (x86_64-*-linux*): Add amd64-linux-siginfo.o
	to srv_tgtobj.
	(i[34567]86-*-linux*): Add amd64-linux-siginfo.o
	to srv_tgtobj.
	* linux-x86-low.c [__x86_64__]: Include
	"nat/amd64-linux-siginfo.h".
	(compat_siginfo_from_siginfo, siginfo_from_compat_siginfo)
	(compat_x32_siginfo_from_siginfo, siginfo_from_compat_x32_siginfo)
	(compat_timeval, compat_sigval, compat_x32_clock, cpt_si_pid)
	(cpt_si_uid, cpt_si_timerid, cpt_si_overrun, cpt_si_status)
	(cpt_si_utime, cpt_si_stime, cpt_si_ptr, cpt_si_addr, cpt_si_band)
	(cpt_si_fd, si_timerid, si_overrun): Move from
	nat/amd64-linux-siginfo.c.
	* Makefile.in (amd64-linux-siginfo.o:): New rule.
2016-02-02 11:42:56 +01:00
Pedro Alves a994041db3 gdb: Respect CXXFLAGS when building with C++ compiler
Currently, even when built with --enable-build-with-cxx, gdb uses
CFLAGS instead of CXXFLAGS.  This commit fixes it.

CXXFLAGS set in the environment when configure was run is now honored
in the generated gdb/Makefile, and you can also override CXXFLAGS in
the command like at make time, with the usual 'make CXXFLAGS="..."'

Objects built with a C compiler (e.g., gnulib) still honor CFLAGS
instead.

gdb/ChangeLog:
2016-01-21  Pedro Alves  <palves@redhat.com>

	* Makefile.in (COMPILER_CFLAGS): New.
	(CXXFLAGS): Get it from configure.
	(INTERNAL_CFLAGS_BASE, INTERNAL_LDFLAGS): Use COMPILER_CFLAGS
	instead of CFLAGS.
	* build-with-cxx.m4 (GDB_AC_BUILD_WITH_CXX): Set and AC_SUBST
	COMPILER_CFLAGS.
	* configure: Regenerate.

gdb/gdbserver/ChangeLog:
2016-01-21  Pedro Alves  <palves@redhat.com>

	* Makefile.in (COMPILER_CFLAGS, CXXFLAGS): New.
	(INTERNAL_CFLAGS_BASE): Use COMPILER_CFLAGS instead of CFLAGS.
	* configure: Regenerate.
2016-01-21 11:18:45 +00:00
Pedro Alves 5d5658a1d3 Per-inferior/Inferior-qualified thread IDs
This commit changes GDB to track thread numbers per-inferior.  Then,
if you're debugging multiple inferiors, GDB displays
"inferior-num.thread-num" instead of just "thread-num" whenever it
needs to display a thread:

 (gdb) info inferiors
   Num  Description       Executable
   1    process 6022     /home/pedro/gdb/tests/threads
 * 2    process 6037     /home/pedro/gdb/tests/threads
 (gdb) info threads
   Id   Target Id         Frame
   1.1  Thread 0x7ffff7fc2740 (LWP 6022) "threads" (running)
   1.2  Thread 0x7ffff77c0700 (LWP 6028) "threads" (running)
   1.3  Thread 0x7ffff7fc2740 (LWP 6032) "threads" (running)
   2.1  Thread 0x7ffff7fc1700 (LWP 6037) "threads" (running)
   2.2  Thread 0x7ffff77c0700 (LWP 6038) "threads" (running)
 * 2.3  Thread 0x7ffff7fc2740 (LWP 6039) "threads" (running)
 (gdb)
...
 (gdb) thread 1.1
 [Switching to thread 1.1 (Thread 0x7ffff7fc2740 (LWP 8155))]
 (gdb)
...

etc.

You can still use "thread NUM", in which case GDB infers you're
referring to thread NUM of the current inferior.

The $_thread convenience var and Python's InferiorThread.num attribute
are remapped to the new per-inferior thread number.  It's a backward
compatibility break, but since it only matters when debugging multiple
inferiors, I think it's worth doing.

Because MI thread IDs need to be a single integer, we keep giving
threads a global identifier, _in addition_ to the per-inferior number,
and make MI always refer to the global thread IDs.  IOW, nothing
changes from a MI frontend's perspective.

Similarly, since Python's Breakpoint.thread and Guile's
breakpoint-thread/set-breakpoint-thread breakpoint methods need to
work with integers, those are adjusted to work with global thread IDs
too.  Follow up patches will provide convenient means to access
threads' global IDs.

To avoid potencially confusing users (which also avoids updating much
of the testsuite), if there's only one inferior and its ID is "1",
IOW, the user hasn't done anything multi-process/inferior related,
then the "INF." part of thread IDs is not shown.  E.g,.:

 (gdb) info inferiors
   Num  Description       Executable
 * 1    process 15275     /home/pedro/gdb/tests/threads
 (gdb) info threads
   Id   Target Id         Frame
 * 1    Thread 0x7ffff7fc1740 (LWP 15275) "threads" main () at threads.c:40
 (gdb) add-inferior
 Added inferior 2
 (gdb) info threads
   Id   Target Id         Frame
 * 1.1  Thread 0x7ffff7fc1740 (LWP 15275) "threads" main () at threads.c:40
 (gdb)

No regressions on x86_64 Fedora 20.

gdb/ChangeLog:
2016-01-13  Pedro Alves  <palves@redhat.com>

	* NEWS: Mention that thread IDs are now per inferior and global
	thread IDs.
	* Makefile.in (SFILES): Add tid-parse.c.
	(COMMON_OBS): Add tid-parse.o.
	(HFILES_NO_SRCDIR): Add tid-parse.h.
	* ada-tasks.c: Adjust to use ptid_to_global_thread_id.
	* breakpoint.c (insert_breakpoint_locations)
	(remove_threaded_breakpoints, bpstat_check_breakpoint_conditions)
	(print_one_breakpoint_location, set_longjmp_breakpoint)
	(check_longjmp_breakpoint_for_call_dummy)
	(set_momentary_breakpoint): Adjust to use global IDs.
	(find_condition_and_thread, watch_command_1): Use parse_thread_id.
	(until_break_command, longjmp_bkpt_dtor)
	(breakpoint_re_set_thread, insert_single_step_breakpoint): Adjust
	to use global IDs.
	* dummy-frame.c (pop_dummy_frame_bpt): Adjust to use
	ptid_to_global_thread_id.
	* elfread.c (elf_gnu_ifunc_resolver_stop): Likewise.
	* gdbthread.h (struct thread_info): Rename field 'num' to
	'global_num.  Add new fields 'per_inf_num' and 'inf'.
	(thread_id_to_pid): Rename thread_id_to_pid to
	global_thread_id_to_ptid.
	(pid_to_thread_id): Rename to ...
	(ptid_to_global_thread_id): ... this.
	(valid_thread_id): Rename to ...
	(valid_global_thread_id): ... this.
	(find_thread_id): Rename to ...
	(find_thread_global_id): ... this.
	(ALL_THREADS, ALL_THREADS_BY_INFERIOR): Declare.
	(print_thread_info): Add comment.
	* tid-parse.h: New file.
	* tid-parse.c: New file.
	* infcmd.c (step_command_fsm_prepare)
	(step_command_fsm_should_stop): Adjust to use the global thread
	ID.
	(until_next_command, until_next_command)
	(finish_command_fsm_should_stop): Adjust to use the global thread
	ID.
	(attach_post_wait): Adjust to check the inferior number too.
	* inferior.h (struct inferior) <highest_thread_num>: New field.
	* infrun.c (handle_signal_stop)
	(insert_exception_resume_breakpoint)
	(insert_exception_resume_from_probe): Adjust to use the global
	thread ID.
	* record-btrace.c (record_btrace_open): Use global thread IDs.
	* remote.c (process_initial_stop_replies): Also consider the
	inferior number.
	* target.c (target_pre_inferior): Clear the inferior's highest
	thread num.
	* thread.c (clear_thread_inferior_resources): Adjust to use the
	global thread ID.
	(new_thread): New inferior parameter.  Adjust to use it.  Set both
	the thread's global ID and the thread's per-inferior ID.
	(add_thread_silent): Adjust.
	(find_thread_global_id): New.
	(find_thread_id): Make static.  Adjust to rename.
	(valid_thread_id): Rename to ...
	(valid_global_thread_id): ... this.
	(pid_to_thread_id): Rename to ...
	(ptid_to_global_thread_id): ... this.
	(thread_id_to_pid): Rename to ...
	(global_thread_id_to_ptid): ... this.  Adjust.
	(first_thread_of_process): Adjust.
	(do_captured_list_thread_ids): Adjust to use global thread IDs.
	(should_print_thread): New function.
	(print_thread_info): Rename to ...
	(print_thread_info_1): ... this, and add new show_global_ids
	parameter.  Handle it.  Iterate over inferiors.
	(print_thread_info): Reimplement as wrapper around
	print_thread_info_1.
	(show_inferior_qualified_tids): New function.
	(print_thread_id): Use it.
	(tp_array_compar): Compare inferior numbers too.
	(thread_apply_command): Use tid_range_parser.
	(do_captured_thread_select): Use parse_thread_id.
	(thread_id_make_value): Adjust.
	(_initialize_thread): Adjust "info threads" help string.
	* varobj.c (struct varobj_root): Update comment.
	(varobj_create): Adjust to use global thread IDs.
	(value_of_root_1): Adjust to use global_thread_id_to_ptid.
	* windows-tdep.c (display_tib): No longer accept an argument.
	* cli/cli-utils.c (get_number_trailer): Make extern.
	* cli/cli-utils.h (get_number_trailer): Declare.
	(get_number_const): Adjust documentation.
	* mi/mi-cmd-var.c (mi_cmd_var_update_iter): Adjust to use global
	thread IDs.
	* mi/mi-interp.c (mi_new_thread, mi_thread_exit)
	(mi_on_normal_stop, mi_output_running_pid, mi_on_resume):
	* mi/mi-main.c (mi_execute_command, mi_cmd_execute): Likewise.
	* guile/scm-breakpoint.c (gdbscm_set_breakpoint_thread_x):
	Likewise.
	* python/py-breakpoint.c (bppy_set_thread): Likewise.
	* python/py-finishbreakpoint.c (bpfinishpy_init): Likewise.
	* python/py-infthread.c (thpy_get_num): Add comment and return the
	per-inferior thread ID.
	(thread_object_getset): Update comment of "num".

gdb/testsuite/ChangeLog:
2016-01-07  Pedro Alves  <palves@redhat.com>

	* gdb.base/break.exp: Adjust to output changes.
	* gdb.base/hbreak2.exp: Likewise.
	* gdb.base/sepdebug.exp: Likewise.
	* gdb.base/watch_thread_num.exp: Likewise.
	* gdb.linespec/keywords.exp: Likewise.
	* gdb.multi/info-threads.exp: Likewise.
	* gdb.threads/thread-find.exp: Likewise.
	* gdb.multi/tids.c: New file.
	* gdb.multi/tids.exp: New file.

gdb/doc/ChangeLog:
2016-01-07  Pedro Alves  <palves@redhat.com>

	* gdb.texinfo (Threads): Document per-inferior thread IDs,
	qualified thread IDs, global thread IDs and thread ID lists.
	(Set Watchpoints, Thread-Specific Breakpoints): Adjust to refer to
	thread IDs.
	(Convenience Vars): Document the $_thread convenience variable.
	(Ada Tasks): Adjust to refer to thread IDs.
	(GDB/MI Async Records, GDB/MI Thread Commands, GDB/MI Ada Tasking
	Commands, GDB/MI Variable Objects): Update to mention global
	thread IDs.
	* guile.texi (Breakpoints In Guile)
	<breakpoint-thread/set-breakpoint-thread breakpoint>: Mention
	global thread IDs instead of thread IDs.
	* python.texi (Threads In Python): Adjust documentation of
	InferiorThread.num.
	(Breakpoint.thread): Mention global thread IDs instead of thread
	IDs.
2016-01-13 10:59:43 +00:00
Joel Brobecker 618f726fcb GDB copyright headers update after running GDB's copyright.py script.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2016-01-01 08:43:22 +04:00
Antoine Tremblay d9311bfaf5 Support software single step on ARM in GDBServer
This patch teaches GDBServer how to software single step on ARM
linux by sharing code with GDB.

The arm_get_next_pcs function in GDB is now shared with GDBServer.  So
that GDBServer can use the function to return the possible addresses of
the next PC.

A proper shared context was also needed so that we could share the code,
this context is described in the arm_get_next_pcs structure.

Testing :

No regressions, tested on ubuntu 14.04 ARMv7 and x86.
With gdbserver-{native,extended} / { -marm -mthumb }

gdb/ChangeLog:

	* Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o,
	arm-linux.o.
	(ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c
	(arm-linux.o): New rule.
	(arm-get-next-pcs.o): New rule.
	* arch/arm-get-next-pcs.c: New file.
	* arch/arm-get-next-pcs.h: New file.
	* arch/arm-linux.h: New file.
	* arch/arm-linux.c: New file.
	* arm.c: Include common-regcache.c.
	(thumb_advance_itstate): Moved from arm-tdep.c.
	(arm_instruction_changes_pc): Likewise.
	(thumb_instruction_changes_pc): Likewise.
	(thumb2_instruction_changes_pc): Likewise.
	(shifted_reg_val): Likewise.
	* arm.h (submask): Move macro from arm-tdep.h
	(bit): Likewise.
	(bits): Likewise.
	(sbits): Likewise.
	(BranchDest): Likewise.
	(thumb_advance_itstate): Moved declaration from arm-tdep.h
	(arm_instruction_changes_pc): Likewise.
	(thumb_instruction_changes_pc): Likewise.
	(thumb2_instruction_changes_pc): Likewise.
	(shifted_reg_val): Likewise.
	* arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h
	arch/arm-linux.h.
	(arm_linux_get_next_pcs_ops): New struct.
	(ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT,
	ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT,
	ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack
	layout defines to arch/arm-linux.h.
	(arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c.
	(arm_linux_software_single_step): Adjust for arm_get_next_pcs
	implementation.
	* arm-tdep.c: Include arch/arm-get-next-pcs.h.
	(arm_get_next_pcs_ops): New struct.
	(submask): Move macro to arm.h.
	(bit): Likewise.
	(bits): Likewise.
	(sbits): Likewise.
	(BranchDest): Likewise.
	(thumb_instruction_changes_pc): Move to arm.c
	(thumb2_instruction_changes_pc): Likewise.
	(arm_instruction_changes_pc): Likewise.
	(shifted_reg_val): Likewise.
	(thumb_advance_itstate): Likewise.
	(thumb_get_next_pc_raw): Move to arm-get-next-pcs.c.
	(arm_get_next_pc_raw): Likewise.
	(arm_get_next_pc): Likewise.
	(thumb_deal_with_atomic_sequence_raw): Likewise.
	(arm_deal_with_atomic_sequence_raw): Likewise.
	(arm_deal_with_atomic_sequence): Likewise.
	(arm_get_next_pcs_read_memory_unsigned_integer): New function.
	(arm_get_next_pcs_addr_bits_remove): Likewise.
	(arm_get_next_pcs_syscall_next_pc): Likewise.
	(arm_get_next_pcs_is_thumb): Likewise.
	(arm_software_single_step): Adjust for arm_get_next_pcs
	implementation.
	* arm-tdep.h: (arm_get_next_pc): Remove declaration.
	(arm_get_next_pcs_read_memory_unsigned_integer):
	New declaration.
	(arm_get_next_pcs_addr_bits_remove): Likewise.
	(arm_get_next_pcs_syscall_next_pc): Likewise.
	(arm_get_next_pcs_is_thumb): Likewise.
	(arm_deal_with_atomic_sequence: Remove declaration.
	* common/gdb_vecs.h: Add CORE_ADDR vector definition.
	* configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o,
	arm-linux.o.
	(arm*-wince-pe): Add arm-get-next-pcs.o.
	(arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o,
	arm-get-next-pcs.o
	(arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o.
	(arm*-*-openbsd*): Likewise.
	(arm*-*-symbianelf*): Likewise.
	(arm*-*-*): Likewise.
	* symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h.

gdb/gdbserver/ChangeLog:

	* Makefile.in (SFILES): Append arch/arm-linux.c,
	arch/arm-get-next-pcs.c.
	(arm-linux.o): New rule.
	(arm-get-next-pcs.o): New rule.
	* configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o,
	arm-linux.o.
	* linux-aarch32-low.c (arm_abi_breakpoint): Remove macro.  Moved
	to linux-aarch32-low.c.
	(arm_eabi_breakpoint, arm_breakpoint): Likewise.
	(arm_breakpoint_len, thumb_breakpoint): Likewise.
	(thumb_breakpoint_len, thumb2_breakpoint): Likewise.
	(thumb2_breakpoint_len): Likewise.
	(arm_is_thumb_mode): Make non-static.
	* linux-aarch32-low.h (arm_abi_breakpoint): New macro.  Moved
	from linux-aarch32-low.c.
	(arm_eabi_breakpoint, arm_breakpoint): Likewise.
	(arm_breakpoint_len, thumb_breakpoint): Likewise.
	(thumb_breakpoint_len, thumb2_breakpoint): Likewise.
	(thumb2_breakpoint_len): Likewise.
	(arm_is_thumb_mode): New declaration.
	* linux-arm-low.c: Include arch/arm-linux.h
	aarch/arm-get-next-pcs.h, sys/syscall.h.
	(get_next_pcs_ops): New struct.
	(get_next_pcs_addr_bits_remove): New function.
	(get_next_pcs_is_thumb): New function.
	(get_next_pcs_read_memory_unsigned_integer): Likewise.
	(arm_sigreturn_next_pc): Likewise.
	(get_next_pcs_syscall_next_pc): Likewise.
	(arm_gdbserver_get_next_pcs): Likewise.
	(struct linux_target_ops) <arm_gdbserver_get_next_pcs>:
	Initialize.
	* linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h.
	* server.h: Include gdb_vecs.h.
2015-12-18 11:39:48 -05:00
Antoine Tremblay 68ce205943 Share regcache function regcache_raw_read_unsigned
This patch is in preparation for software single step support on ARM in
GDBServer. It adds a new shared function regcache_raw_read_unsigned and
regcache_raw_get_unsigned so that GDB and GDBServer can use the same call
to fetch a raw register into an integer.

No regressions, tested on ubuntu 14.04 ARMv7 and x86.
With gdbserver-{native,extended} / { -marm -mthumb }

gdb/ChangeLog:

	* Makefile.in (SFILES): Append common/common-regcache.c.
	(COMMON_OBS): Append common/common-regcache.o.
	(common-regcache.o): New rule.
	* common/common-regcache.h (register_status) New enum.
	(regcache_raw_read_unsigned): New declaration.
	* common/common-regcache.c: New file.
	* regcache.h (enum register_status): Move to common-regcache.h.
	(regcache_raw_read_unsigned): Likewise.
	(regcache_raw_get_unsigned): Likewise.

gdb/gdbserver/ChangeLog:

	* Makefile.in (SFILES): Append common/common-regcache.c.
	(OBS): Append common-regcache.o.
	(common-regcache.o): New rule.
	* regcache.c (init_register_cache): Initialize cache to
	REG_UNAVAILABLE.
	(regcache_raw_read_unsigned): New function.
	* regcache.h (REG_UNAVAILABLE, REG_VALID): Replaced by shared
	register_status enum.
2015-12-18 11:39:21 -05:00
Joel Brobecker 030f17b5eb Replace remaining references to i386-nat with x86-nat instead.
i386-nat.[hc] got renamed to x86-nat.[hc] a while back, but somehow
3 references to the old file name remained past the renaming. This
fixes all of them.

gdb/ChangeLog (with Mike Stump <mikestump@comcast.net>):

        * Makefile.in (TAGS): Replace i386-nat.h by x86-nat.h.
        * x86-nat.c: Replace remaining references to i386-nat
        by reference to x86-nat instead.
2015-12-06 18:44:46 +01:00
Antoine Tremblay 8689682cc3 Implement breakpoint_kind_from_pc and sw_breakpoint_from_kind for ARM in GDBServer.
ARM can have multiple breakpoint types based on the instruction set
it's currently in: arm, thumb or thumb2.

GDBServer needs to know what breakpoint is to be inserted at location
when inserting a breakpoint.

This is handled by the breakpoint_kind_from_pc and sw_breakpoint_from_kind
target ops introduced in a previous patch, this patch adds the
arm_breakpoint_kind_from_pc and arm_sw_breakpoint_from_kind implementation so
that the proper breakpoint type is returned based on the pc.

Also in order to share some code with GDB a new file called arm.c have been
introduced in arch/.

While this file does not contain much yet future patches will add more
to it thus the inclusion at this stage.

No regressions on Ubuntu 14.04 on ARMv7 and x86.
With gdbserver-{native,extended} / { -marm -mthumb }

gdb/ChangeLog:

	* Makefile.in: Add arm.c/o.
	* arch/arm.c: New file.
	* arch/arm.h: (IS_THUMB_ADDR): Move macro from arm-tdep.c.
	(MAKE_THUMB_ADDR): Likewise.
	(UNMAKE_THUMB_ADDR): Likewise.
	* arm-tdep.c (int thumb_insn_size): Move to arm.c.
	(IS_THUMB_ADDR): Move to arm.h.
	(MAKE_THUMB_ADDR): Likewise.
	(UNMAKE_THUMB_ADDR): Likewise.
	* configure.tgt: Add arm.o to all ARM configs.

gdb/gdbserver/ChangeLog:

	* Makefile.in: Add arm.c/o.
	* configure.srv: Likewise.
	* linux-arm-low.c (arm_breakpoint_kinds): New enum.
	(arm_breakpoint_kind_from_pc): New function.
	(arm_sw_breakpoint_from_kind): Return proper kind.
	(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.
2015-10-21 11:26:05 -04:00
Pierre Langlois 787749ead6 Move instruction decoding into new arch/ directory
This patch moves the following functions into the arch/ common
directory, in new files arch/aarch64-insn.{h,c}.  They are prefixed with
'aarch64_':

 - aarch64_decode_adrp
 - aarch64_decode_b
 - aarch64_decode_cb
 - aarch64_decode_tb

We will need them to implement fast tracepoints in GDBserver.

For consistency, this patch also adds the 'aarch64_' prefix to static
decoding functions that do not need to be shared right now.

V2:
 make sure the formatting issues propagated
 fix `gdbserver/configure.srv'.

gdb/ChangeLog:

	* Makefile.in (ALL_64_TARGET_OBS): Add aarch64-insn.o.
	(HFILES_NO_SRCDIR): Add arch/aarch64-insn.h.
	(aarch64-insn.o): New rule.
	* configure.tgt (aarch64*-*-elf): Add aarch64-insn.o.
	(aarch64*-*-linux*): Likewise.
	* arch/aarch64-insn.c: New file.
	* arch/aarch64-insn.h: New file.
	* aarch64-tdep.c: Include arch/aarch64-insn.h.
	(aarch64_debug): Move to arch/aarch64-insn.c.  Declare in
	arch/aarch64-insn.h.
	(decode_add_sub_imm): Rename to ...
	(aarch64_decode_add_sub_imm): ... this.
	(decode_adrp): Rename to ...
	(aarch64_decode_adrp): ... this.  Move to arch/aarch64-insn.c.
	Declare in arch/aarch64-insn.h.
	(decode_b): Rename to ...
	(aarch64_decode_b): ... this.  Move to arch/aarch64-insn.c.
	Declare in arch/aarch64-insn.h.
	(decode_bcond): Rename to ...
	(aarch64_decode_bcond): ... this.  Move to arch/aarch64-insn.c.
	Declare in arch/aarch64-insn.h.
	(decode_br): Rename to ...
	(aarch64_decode_br): ... this.
	(decode_cb): Rename to ...
	(aarch64_decode_cb): ... this.  Move to arch/aarch64-insn.c.
	Declare in arch/aarch64-insn.h.
	(decode_eret): Rename to ...
	(aarch64_decode_eret): ... this.
	(decode_movz): Rename to ...
	(aarch64_decode_movz): ... this.
	(decode_orr_shifted_register_x): Rename to ...
	(aarch64_decode_orr_shifted_register_x): ... this.
	(decode_ret): Rename to ...
	(aarch64_decode_ret): ... this.
	(decode_stp_offset): Rename to ...
	(aarch64_decode_stp_offset): ... this.
	(decode_stp_offset_wb): Rename to ...
	(aarch64_decode_stp_offset_wb): ... this.
	(decode_stur): Rename to ...
	(aarch64_decode_stur): ... this.
	(decode_tb): Rename to ...
	(aarch64_decode_tb): ... this.  Move to arch/aarch64-insn.c.
	Declare in arch/aarch64-insn.h.
	(aarch64_analyze_prologue): Adjust calls to renamed functions.

gdb/gdbserver/ChangeLog:

	* Makefile.in (aarch64-insn.o): New rule.
	* configure.srv (aarch64*-*-linux*): Add aarch64-insn.o.
2015-09-21 15:01:04 +01:00
Pedro Alves 243a925328 Replace "struct continuation" mechanism by something more extensible
This adds an object oriented replacement for the "struct continuation"
mechanism, and converts the stepping commands (step, next, stepi,
nexti) and the "finish" commands to use it.

It adds a new thread "class" (struct thread_fsm) that contains the
necessary info and callbacks to manage the state machine of a thread's
execution command.

This allows getting rid of some hacks.  E.g., in fetch_inferior_event
and normal_stop we no longer need to know whether a thread is doing a
multi-step (e.g., step N).  This effectively makes the
intermediate_continuations unused -- they'll be garbage collected in a
separate patch.  (They were never a proper abstraction, IMO.  See how
fetch_inferior_event needs to check step_multi before knowing whether
to call INF_EXEC_CONTINUE or INF_EXEC_COMPLETE.)

The target async vs !async uiout hacks in mi_on_normal_stop go away
too.

print_stop_event is no longer called from normal_stop.  Instead it is
now called from within each interpreter's normal_stop observer.  This
clears the path to make each interpreter print a stop event the way it
sees fit.  Currently we have some hacks in common code to
differenciate CLI vs TUI vs MI around this area.

The "finish" command's FSM class stores the return value plus that
value's position in the value history, so that those can be printed to
both MI and CLI's streams.  This fixes the CLI "finish" command when
run from MI -- it now also includes the function's return value in the
CLI stream:

  (gdb)
  ~"callee3 (strarg=0x400730 \"A string argument.\") at src/gdb/testsuite/gdb.mi/basics.c:35\n"
  ~"35\t}\n"
 +~"Value returned is $1 = 0\n"
  *stopped,reason="function-finished",frame=...,gdb-result-var="$1",return-value="0",thread-id="1",stopped-threads="all",core="0"
 -FAIL: gdb.mi/mi-cli.exp: CLI finish: check CLI output
 +PASS: gdb.mi/mi-cli.exp: CLI finish: check CLI output

gdb/ChangeLog:
2015-09-09  Pedro Alves  <palves@redhat.com>

	* Makefile.in (COMMON_OBS): Add thread-fsm.o.
	* breakpoint.c (handle_jit_event): Print debug output.
	(bpstat_what): Split event callback handling to ...
	(bpstat_run_callbacks): ... this new function.
	(momentary_bkpt_print_it): No longer handle bp_finish here.
	* breakpoint.h (bpstat_run_callbacks): Declare.
	* gdbthread.h (struct thread_info) <step_multi>: Delete field.
	<thread_fsm>: New field.
	(thread_cancel_execution_command): Declare.
	* infcmd.c: Include thread-fsm.h.
	(struct step_command_fsm): New.
	(step_command_fsm_ops): New global.
	(new_step_command_fsm, step_command_fsm_prepare): New functions.
	(step_1): Adjust to use step_command_fsm_prepare and
	prepare_one_step.
	(struct step_1_continuation_args): Delete.
	(step_1_continuation): Delete.
	(step_command_fsm_should_stop): New function.
	(step_once): Delete.
	(step_command_fsm_clean_up, step_command_fsm_async_reply_reason)
	(prepare_one_step): New function, based on step_once.
	(until_next_command): Remove step_multi reference.
	(struct return_value_info): New.
	(print_return_value): Rename to ...
	(print_return_value_1): ... this.  New struct return_value_info
	parameter.  Adjust.
	(print_return_value): Reimplement as wrapper around
	print_return_value_1.
	(struct finish_command_fsm): New.
	(finish_command_continuation): Delete.
	(finish_command_fsm_ops): New global.
	(new_finish_command_fsm, finish_command_fsm_should_stop): New
	functions.
	(finish_command_fsm_clean_up, finish_command_fsm_return_value):
	New.
	(finish_command_continuation_free_arg): Delete.
	(finish_command_fsm_async_reply_reason): New.
	(finish_backward, finish_forward): Change symbol parameter to a
	finish_command_fsm.  Adjust.
	(finish_command): Create a finish_command_fsm.  Adjust.
	* infrun.c: Include "thread-fsm.h".
	(clear_proceed_status_thread): Delete the thread's FSM.
	(infrun_thread_stop_requested_callback): Cancel the thread's
	execution command.
	(clean_up_just_stopped_threads_fsms): New function.
	(fetch_inferior_event): Handle the event_thread's should_stop
	method saying the command isn't done yet.
	(process_event_stop_test): Run breakpoint callbacks here.
	(print_stop_event): Rename to ...
	(print_stop_location): ... this.
	(restore_current_uiout_cleanup): New function.
	(print_stop_event): Reimplement.
	(normal_stop): No longer notify the end_stepping_range observers
	here handle "step N" nor "finish" here.  No longer call
	print_stop_event here.
	* infrun.h (struct return_value_info): Forward declare.
	(print_return_value): Declare.
	(print_stop_event): Change prototype.
	* thread-fsm.c: New file.
	* thread-fsm.h: New file.
	* thread.c: Include "thread-fsm.h".
	(thread_cancel_execution_command): New function.
	(clear_thread_inferior_resources): Call it.
	* cli/cli-interp.c (cli_on_normal_stop): New function.
	(cli_interpreter_init): Install cli_on_normal_stop as normal_stop
	observer.
	* mi/mi-interp.c: Include "thread-fsm.h".
	(restore_current_uiout_cleanup): Delete.
	(mi_on_normal_stop): If the thread has an FSM associated, and it
	finished, ask it for the async-reply-reason to print.  Always call
	print_stop_event here, regardless of the top-level interpreter.
	Check bpstat_what to tell whether an asynchronous breakpoint hit
	triggered.
	* tui/tui-interp.c (tui_on_normal_stop): New function.
	(tui_init): Install tui_on_normal_stop as normal_stop observer.

gdb/testsuite/ChangeLog:
2015-09-09  Pedro Alves  <palves@redhat.com>

	* gdb.mi/mi-cli.exp: Add CLI finish tests.
2015-09-09 18:24:00 +01:00
Yao Qi db3cb7cb3e Move aarch64_linux_prepare_to_resume to nat/aarch64-linux.c
gdb:

2015-08-25  Yao Qi  <yao.qi@linaro.org>

	* Makefile.in (aarch64-liunx.o): New rule.
	(HFILES_NO_SRCDIR): Add aarch64-linux.h.
	* config/aarch64/linux.mh (NAT_FILE): Add aarch64-linux.o.
	* aarch64-linux-nat.c: Include nat/aarch64-linux.h.
	* aarch64-linux-nat.c (aarch64_get_debug_reg_state): Make it
	extern.
	(aarch64_linux_prepare_to_resume): Move it nat/aarch64-linux.c.
	* nat/aarch64-linux-hw-point.h (aarch64_debug_reg_state): Declare
	* nat/aarch64-linux.c: New file.
	* nat/aarch64-linux.h: New file.

gdb/gdbserver:

2015-08-25  Yao Qi  <yao.qi@linaro.org>

	* Makefile.in (aarch64-linux.o): New rule.
	* configure.srv (aarch64*-*-linux*): Append aarch64-linux.o to
	srv_tgtobj.
	* linux-aarch64-low.c: Include nat/aarch64-linux.h.
	(aarch64_init_debug_reg_state): Make it extern.
	(aarch64_linux_prepare_to_resume): Remove.
2015-08-25 11:39:14 +01:00
Pedro Alves 438e1e427e Prepare for gnulib update
After the last gnulib import (Dec 2012), gnulib upstream started
replacing mingw's 'struct timeval' with a version with 64-bit time_t,
for POSIX compliance:

 commit f8e84098084b3b53bc6943a5542af1f607ffd477
 Author: Bruno Haible <bruno@clisp.org>
 Date:   Sat Jan 28 18:12:10 2012 +0100
     sys_time: Override 'struct timeval' on some native Windows platforms.

See:

 https://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00372.html

However, that results in conflicts with native Winsock2's 'select':

select()'s argument
	http://sourceforge.net/p/mingw-w64/mailman/message/29610438/

... and libiberty's timeval-utils.h timeval_add/timeval_sub, at the
least.

We don't really need the POSIX compliance, so this patch prepares us
to simply not use gnulib's 'struct timeval' replacement once a more
recent gnulib is imported, thus preserving the current behavior, by
adding a sys/time.h wrapper header that undefs gnulib's replacements,
and including that everywhere instead.

The SIZE -> OSIZE change is necessary because newer gnulib's
sys/time.h also includes windows.h/winsock2.h, which defines a
conflicting SIZE symbol.

Cross build-tested mingw-w64 32-bit and 64-bit.
Regtested on x86_64 Fedora 20.

gdb/ChangeLog:
2015-08-24  Pedro Alves  <palves@redhat.com>

	* Makefile.in (HFILES_NO_SRCDIR): Add common/gdb_sys_time.h.
	* common/gdb_sys_time.h: New file.
	* event-loop.c: Include gdb_sys_time.h instead of sys/time.h.
	* gdb_select.h: Likewise.
	* gdb_usleep.c: Likewise.
	* maint.c: Likewise.
	* mi/mi-main.c: Likewise.
	* mi/mi-parse.h: Likewise.
	* remote-fileio.c: Likewise.
	* remote-m32r-sdi.c: Likewise.
	* remote.c: Likewise.
	* ser-base.c: Likewise.
	* ser-pipe.c: Likewise.
	* ser-tcp.c: Likewise.
	* ser-unix.c: Likewise.
	* symfile.c: Likewise.
	* symfile.c: Likewise.  Rename OSIZE to SIZE throughout.
	* target-memory.c: Include gdb_sys_time.h instead of sys/time.h.
	* utils.c: Likewise.

gdb/gdbserver/ChangeLog:
2015-08-24  Pedro Alves  <palves@redhat.com>

	* debug.c: Include gdb_sys_time.h instead of sys/time.h.
	* event-loop.c: Likewise.
	* remote-utils.c: Likewise.
	* tracepoint.c: Likewise.
2015-08-24 18:50:55 +01:00
Pedro Alves 40e0b27177 Delete the remaining ROM monitor targets
Ref: https://sourceware.org/ml/gdb/2015-07/msg00011.html

All of these targets use gdb/monitor.c, which has bit rotted
years ago (I'd guess around ~6), and nobody seems to
have noticed:

 | target         | source               |
 |----------------+----------------------|
 | target dbug    | gdb/dbug-rom.c       |
 | target picobug | gdb/microblaze-rom.c |
 | target dink32  | gdb/dink32-rom.c     |
 | target m32r    | gdb/m32r-rom.c       |
 | target mon2000 | gdb/m32r-rom.c       |
 | target ppcbug  | gdb/ppcbug-rom.c     |

This deletes them, along with finally removing monitor.c.

A manual update will be done separately.

gdb/ChangeLog:
2015-08-24  Pedro Alves  <palves@redhat.com>

	* NEWS: Mention removed support for the various ROM monitors.
	* Makefile.in (ALL_TARGET_OBS): Remove dbug-rom.o, dink32-rom.o,
	ppcbug-rom.o, m32r-rom.o, dsrec.o and monitor.o from gdb_target_obs.
	* configure.tgt (h8300-*-*): Remove monitor.o and m32r-rom.o from
	gdb_target_obs.
	(m68*-*-*): Remove monitor.o dbug-rom.o and dsrec.o from
	gdb_target_obs.
	(microblaze*-linux-*): Remove microblaze-rom.o, monitor.o and
	dsrec.o from gdb_target_obs.
	(microblaze*-*-*): Remove microblaze-rom.o, monitor.o and dsrec.o
	from gdb_target_obs.
	(powerpc-*-lynx*178): Remove monitor.o and dsrec.o from
	gdb_target_obs.
	(powerpc*-*-*): Remove monitor.o, dsrec.o, ppcbug-rom.o and
	dink32-rom.o from gdb_target_obs.
	(sh*-*-linux*): Remove monitor.o and dsrec.o from gdb_target_obs.
	(sh*): Remove monitor.o and dsrec.o from gdb_target_obs.
	* dbug-rom.c, dink32-rom.c, dsrec.c, m32r-rom.c, microblaze-rom.c,
	monitor.c, monitor.h, ppcbug-rom.c, srec.h: Delete files.
2015-08-24 15:40:26 +01:00
Iain Buclaw bc7c9fab61 [D] Support looking up symbols in the current and imported modules.
In D, there is the notion of modules, and importing from one to the other,
whether it is a basic, selective or renamed import declaration.

	module A;
	import X;
	void foo() {
	  import Y : bar;
	}

If the compiler emits DW_TAG_imported_declaration at the appropriate locations,
then we can make use of what gdb stores in using_direct when performing
nonlocal symbol lookups.

gdb/ChangeLog

	* Makefile.in (SFILES): Add d-namespace.c.
	(COMMON_OBS): Add d-namespace.o.
	* d-lang.c (d_language_defn): Use d_lookup_symbol_nonlocal as the
	la_lookup_symbol_nonlocal callback function pointer.
	* d-lang.h (d_lookup_symbol_nonlocal): New declaration.
	(d_lookup_nested_symbol): New declaration.
	* d-namespace.c: New file.
2015-08-13 21:07:09 +02:00
Pierre-Marie de Rodat 22cee43f9a [Ada] Add support for subprogram renamings
Consider the following declaration:

    function Foo (I : Integer) return Integer renames Pack.Bar;

As Foo is not materialized as a routine whose name is derived from Foo,
GDB currently cannot use it:

    (gdb) print foo(0)
    No definition of "foo" in current context.

However, compilers can emit DW_TAG_imported_declaration in order to
materialize the fact that Foo is actually another name for Pack.Bar.
This commit enhances the DWARF reader to record global renamings (it
used to put global ones in a static block) and enhances the Ada engine
to leverage this information during symbol lookup.

gdb/ChangeLog:

	* ada-lang.c: Include namespace.h
	(aux_add_nonlocal_symbols): Fix a function name in comment.
	(ada_add_block_renamings): New.
	(add_nonlocal_symbols): Add global renamings handling.
	(ada_lookup_symbol_list_worker): Move the symbol lookup part
	to...
	(ada_add_all_symbols): ... this new function.
	(ada_add_block_symbols): Try to match the input name against the
	"using directives list", perform a recursive symbol lookup on
	the matched declarations.
	* block.h (struct block): Move the_namespace to top-level as
	namespace_info. Remove the language_specific field.
	(BLOCK_NAMESPACE): Update access to the namespace_info field.
	* buildsym.h (using_directives): Rename into...
	(local_using_directives): ... this.
	(global_using_directives): New.
	(struct context_stack): Rename the using_directives field into
	local_using_directives.
	* buildsym.c (finish_block_internal): Deal with the proper
	using directives repository (local or global).
	(prepare_for_building): Reset local_using_directives. Assert
	that there is no pending global using directive.
	(reset_symtab_globals): Reset global_using_directives and
	local_using_directives.
	(end_symtab_get_static_block): Don't ignore symtabs that have
	only using directives.
	(push_context): Update references to local_using_directives.
	(buildsym_init): Do not reset using_directives.
	* cp-support.c: Include namespace.h.
	* cp-support.h (struct using_direct): Move to namespace.h.
	(cp_add_using_directives): Move to namespace.h.
	* cp-namespace.c: Include namespace.h
	(cp_add_using_directive): Move to namespace.c, rename it to
	add_using_directive, add a "using_directives" argument and use
	it as the pending using directives repository.  All callers
	updated.
	* dwarf2read.c (using_directives): New.
	(read_import_statement): Call using_directives.
	(read_func_scope): Update references to local_using_directives.
	(read_lexical_block_scope): Likewise.
	(read_namespace): Update the heading comment, call
	using_directives.
	* namespace.h: New file.
	* namespace.c: New file.
	* Makefile.in (SFILES): Add namespace.c.
	(COMMON_OBS): Add namespace.o

gdb/testsuite/ChangeLog:

	* gdb.ada/fun_renaming.exp: New testcase.
	* gdb.ada/fun_renaming/fun_renaming.adb: New file.
	* gdb.ada/fun_renaming/pack.adb: New file.
	* gdb.ada/fun_renaming/pack.ads: New file.

Tested on x86_64-linux.  Support for this in GCC is in the pipeline: see
<https://gcc.gnu.org/ml/gcc-patches/2015-07/msg02166.html>.
2015-08-13 09:33:42 +02:00
Keith Seitz c7c1b3e998 Explicit locations: introduce new struct event_location-based API
This patch introduces the new breakpoint/"linespec" API based on
a new struct event_location.  This API currently only supports
traditional linespecs, maintaining the status quo of the code base.
Future patches will add additional functionality for other location
types such as address locations.

gdb/ChangeLog:

	* Makefile.in (SFILES): Add location.c.
	(HFILES_NO_SRCDIR): Add location.h.
	(COMMON_OBS): Add location.o.
	* linespec.c (linespec_lex_to_end): New function.
	* linespec.h (linespec_lex_to_end): Declare.
	* location.c: New file.
	* location.h: New file.
2015-08-11 17:09:35 -07:00
DJ Delorie 016a325163 Yaakov Selkowitz: fixes for in-tree libiconv
* Makefile.def (libiconv): Define bootstrap=true.
        Mark pdf/html/info as missing.
        (configure-gcc): Depend on all-libiconv.
        (all-gcc): Ditto.
        (configure-libcpp): Ditto.
        (all-libcpp): Ditto.
        (configure-intl): Ditto.
        (all-intl): Ditto.
        * Makefile.in: Regenerate.

binutils/
        * configure: Regenerate.

gdb/
        * Makefile.in (LIBICONV): Define.
        (CLIBS): Add LIBICONV.
        * acinclude.m4: Use config/iconv.m4 instead of custom AM_ICONV.
        * configure: Regenerate.
2015-08-06 23:55:06 -04:00
Yao Qi ec74129274 Move ARM register numbers enum to arch/arm.h
This patch moves ARM register numbers enum to arch/arm.h, so that it
can used by GDBserver too.

This patch also creates a new directory gdb/arch in which arch-specific
or target-specific files are placed.

gdb:

2015-07-30  Yao Qi  <yao.qi@linaro.org>

	* arm-tdep.h (enum gdb_regnum): Move it to ...
	* arch/arm.h: ... here.  New file.
	* Makefile.in (HFILES_NO_SRCDIR): Add arch/arm.h.
2015-07-30 15:07:38 +01:00
Yao Qi 206350da0f Remove REMOTE_EXAMPLES from gdb/Makefile.in
I happen to see REMOTE_EXAMPLES isn't used anywhere, so this patch
removes it.

REMOTE_EXAMPLES was added in the following commit in 1991,

commit 86bbb439c8
Author: John Gilmore <gnu@cygnus>
Date:   Fri May 3 19:57:13 1991 +0000

    There should be a Makefile in the cvs main directory, configured
    for "./config.gdb none", so that things like "make tags" and "make tar"
    will work.

and it was used like:

TARFILES = ${TAGFILES_MAINDIR} ${OTHERS} ${REMOTE_EXAMPLES}

However TARFILES was removed by the change latter in 1994,

Tue Aug 16 15:24:03 1994  Jim Kingdon  (kingdon@lioth.cygnus.com)

	* symtab.c (decode_line_1): If funfirstline and we get a
	non-LOC_BLOCK symbol (e.g. variable or type), then error().

	* Makefile.in (TARFILES, NONSRC, SFILES_STAND, SFILES_KGDB):
	Remove; unused.

Since then, REMOTE_EXAMPLES is not used any more.

gdb:

2015-07-27  Yao Qi  <yao.qi@linaro.org>

	* Makefile.in (REMOTE_EXAMPLES): Remove it.
2015-07-27 16:06:31 +01:00
Yao Qi 554717a3ed Move common aarch64 HW breakpoint/watchpoint code to nat/
When I look at test fails related to watchpoint on aarch64-linux,
I find there are some code duplicates between GDB and GDBserver.
This patch is to move some of them to a nat/aarch64-linux-hw-point.{h,c}.

The only change I do is about the dr_changed_t typedef, which was
ULONGEST in GDB and 'unsigned long long' in GDBserver.  Each bit
of dr_changed_t represents a status of each HW breakpoint or
watchpoint register, and the max number of HW breakpoint or watchpoint
registers is 16, so the width of 'unsigned long long' is sufficient.

gdb:

2015-07-17  Yao Qi  <yao.qi@linaro.org>

	* Makefile.in (HFILES_NO_SRCDIR): Add
	nat/aarch64-linux-hw-point.h.
	(aarch64-linux-hw-point.o): New rule.
	* nat/aarch64-linux-hw-point.h: New file.
	* nat/aarch64-linux-hw-point.c: New file.
	* aarch64-linux-nat.c: Include nat/aarch64-linux-hw-point.h.
	(AARCH64_HBP_MAX_NUM): Move to nat/aarch64-linux-hw-point.h.
	(AARCH64_HWP_MAX_NUM, AARCH64_HBP_ALIGNMENT): Likewise.
	(AARCH64_HWP_ALIGNMENT): Likewise.
	(AARCH64_HWP_MAX_LEN_PER_REG): Likewise.
	(AARCH64_DEBUG_NUM_SLOTS, AARCH64_DEBUG_ARCH): Likewise.
	(AARCH64_DEBUG_ARCH_V8, DR_MARK_ALL_CHANGED): Likewise.
	(DR_MARK_N_CHANGED, DR_CLEAR_CHANGED): Likewise.
	(DR_HAS_CHANGED, DR_N_HAS_CHANGE): Likewise.
	(aarch64_num_bp_regs, aarch64_num_wp_regs): Likewise.
	(struct aarch64_debug_reg_state): Likewise.
	(struct arch_lwp_info):	Likewise.
	(aarch64_linux_set_debug_regs): Likewise.
	(aarch64_notify_debug_reg_change): Remove static.
	(aarch64_align_watchpoint): Likewise.
	(DR_CONTROL_ENABLED, DR_CONTROL_LENGTH): Likewise.
	(aarch64_watchpoint_length): Likewise.
	(aarch64_point_encode_ctrl_reg): Likewise
	(aarch64_point_is_aligned): Likewise.
	(aarch64_dr_state_insert_one_point): Likewise.
	(aarch64_dr_state_remove_one_point): Likewise.
	(aarch64_handle_breakpoint): Likewise.
	(aarch64_handle_aligned_watchpoint): Likewise.
	(aarch64_handle_unaligned_watchpoint): Likewise.
	(aarch64_handle_watchpoint): Likewise.
	* config/aarch64/linux.mh (NAT_FILE): Add
	aarch64-linux-hw-point.o.

gdb/gdbserver:

2015-07-17  Yao Qi  <yao.qi@linaro.org>

	* Makefile.in (aarch64-linux-hw-point.o): New rule.
	* configure.srv (srv_tgtobj): Append aarch64-linux-hw-point.o.
	* linux-aarch64-low.c: Include nat/aarch64-linux-hw-point.h.
	(AARCH64_HBP_MAX_NUM): Move to nat/aarch64-linux-hw-point.h.
	(AARCH64_HWP_MAX_NUM, AARCH64_HBP_ALIGNMENT): Likewise.
	(AARCH64_HWP_ALIGNMENT): Likewise.
	(AARCH64_HWP_MAX_LEN_PER_REG): Likewise.
	(AARCH64_DEBUG_NUM_SLOTS, AARCH64_DEBUG_ARCH): Likewise.
	(aarch64_num_bp_regs, aarch64_num_wp_regs): Likewise.
	(AARCH64_DEBUG_ARCH_V8, DR_MARK_ALL_CHANGED): Likewise.
	(DR_MARK_N_CHANGED, DR_CLEAR_CHANGED): Likewise.
	(DR_HAS_CHANGED, DR_N_HAS_CHANGE): Likewise.
	(struct aarch64_debug_reg_state): Likewise.
	(struct arch_lwp_info):	Likewise.
	(aarch64_align_watchpoint): Likewise.
	(DR_CONTROL_ENABLED, DR_CONTROL_LENGTH): Likewise.
	(aarch64_watchpoint_length): Likewise.
	(aarch64_point_encode_ctrl_reg): Likewise
	(aarch64_point_is_aligned): Likewise.
	(aarch64_align_watchpoint): Likewise.
	(aarch64_linux_set_debug_regs):
	(aarch64_dr_state_insert_one_point): Likewise.
	(aarch64_dr_state_remove_one_point): Likewise.
	(aarch64_handle_breakpoint): Likewise.
	(aarch64_handle_aligned_watchpoint): Likewise.
	(aarch64_handle_unaligned_watchpoint): Likewise.
	(aarch64_handle_watchpoint): Likewise.
2015-07-17 14:32:40 +01:00
Jan Kratochvil db1ff28b60 Revert the previous 7 commits of: Validate binary before use
ddc98fbf2f Create empty nat/linux-maps.[ch] and common/target-utils.[ch]
6e5b4429db Move gdb_regex* to common/
f7af1fcd75 Prepare linux_find_memory_regions_full & co. for move
9904185cfd Move linux_find_memory_regions_full & co.
700ca40f6f gdbserver build-id attribute generator
ca5268b6be Validate symbol file using build-id
0a94970d66 Tests for validate symbol file using build-id

gdb/ChangeLog
2015-07-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Revert the previous 6 commits:
	Create empty nat/linux-maps.[ch] and common/target-utils.[ch].
	Move gdb_regex* to common/
	Prepare linux_find_memory_regions_full & co. for move
	Move linux_find_memory_regions_full & co.
	gdbserver build-id attribute generator
	Validate symbol file using build-id

gdb/gdbserver/ChangeLog
2015-07-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Revert the previous 3 commits:
	Move gdb_regex* to common/
	Move linux_find_memory_regions_full & co.
	gdbserver build-id attribute generator

gdb/doc/ChangeLog
2015-07-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Revert the previous 2 commits:
	gdbserver build-id attribute generator
	Validate symbol file using build-id

gdb/testsuite/ChangeLog
2015-07-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Revert the previous commit:
	Tests for validate symbol file using build-id.
2015-07-15 20:27:32 +02:00
Jan Kratochvil 6e5b4429db Move gdb_regex* to common/
Later patches need regex support also in gdbserver.

gdb/ChangeLog
2015-07-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* Makefile.in (HFILES_NO_SRCDIR): Change gdb_regex.h to
	common/gdb_regex.h.
	(COMMON_OBS): Add gdb_regex.o.
	(gdb_regex.o): New.
	* common/common.m4 (GDB_AC_COMMON): Add gdb_use_included_regex,
	--without-included-regex and USE_INCLUDED_REGEX.
	* common/gdb_regex.c: New file from utils.c functions.
	* common/gdb_regex.h: Move it here from gdb_regex.h, update include
	file wrapping define name.
	* configure: Rebuilt.
	* configure.ac (gdb_use_included_regex, --without-included-regex)
	(USE_INCLUDED_REGEX): Move them to common/common.m4.
	* gdb_regex.h: Move it to common/gdb_regex.h.
	* utils.c: Remove include gdb_regex.h.
	(do_regfree_cleanup, make_regfree_cleanup, get_regcomp_error)
	(compile_rx_or_error): Move them to common/gdb_regex.c.

gdb/gdbserver/ChangeLog
2015-07-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* Makefile.in (OBS): Add gdb_regex.o.
	(gdb_regex.o): New.
	* config.in: Rebuilt.
	* configure: Rebuilt.
2015-07-15 17:39:17 +02:00
Jan Kratochvil ddc98fbf2f Create empty nat/linux-maps.[ch] and common/target-utils.[ch]
Prepare new files for later move.

gdb/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
	    Jan Kratochvil  <jan.kratochvil@redhat.com>

	Create empty nat/linux-maps.[ch] and common/target-utils.[ch].
	* Makefile.in (HFILES_NO_SRCDIR); Add nat/linux-maps.h,
	common/target-utils.h.
	(COMMON_OBS): Add target-utils.o.
	(linux-maps.o, target-utils.o): New.
	* target/target-utils.c: New file.
	* target/target-utils.h: New file.
	* config/i386/linux.mh (NATDEPFILES): Add linux-maps.o.
	* config/i386/linux64.mh (NATDEPFILES): Ditto.
	* nat/linux-maps.c: New file.
	* nat/linux-maps.h: New file.

gdb/gdbserver/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
	    Jan Kratochvil  <jan.kratochvil@redhat.com>

	Create empty nat/linux-maps.[ch] and common/target-utils.[ch].
	* Makefile.in (OBS): Add target-utils.o.
	(linux-maps.o, target-utils.o): New.
	* configure.srv (srv_linux_obj): Add linux-maps.o.
2015-07-15 17:37:27 +02:00
Markus Metzger 58bfce9343 configure: check for libipt
Check for libipt, an Intel(R) Processor Trace decoder library.  The sources
can be found on github at:

    https://github.com/01org/processor-trace

gdb/
	* configure.ac: Check for libipt
	* configure: Regenerate.
	* config.in: Regenerate.
	* Makefile.in (LIBIPT): New.
	(CLIBS): Add $LIBIPT.
	* NEWS: document new configure options
2015-07-02 12:45:50 +02:00
Gary Benson 4b8b5e7245 Introduce nat/linux-namespaces.[ch]
This commit introduces new shared files nat/linux-namespaces.[ch]
containing code to support Linux namespaces that will be used by
both GDB and gdbserver.

gdb/ChangeLog:

	* configure.ac (AC_CHECK_FUNCS): Add setns.
	* config.in: Regenerate.
	* configure: Likewise.
	* nat/linux-namespaces.h: New file.
	* nat/linux-namespaces.c: Likewise.
	* Makefile.in (HFILES_NO_SRCDIR): Add nat/linux-namespaces.h.
	(linux-namespaces.o): New rule.
	* config/aarch64/linux.mh (NATDEPFILES): Add linux-namespaces.o.
	* config/alpha/alpha-linux.mh (NATDEPFILES): Likewise.
	* config/arm/linux.mh (NATDEPFILES): Likewise.
	* config/i386/linux.mh (NATDEPFILES): Likewise.
	* config/i386/linux64.mh (NATDEPFILES): Likewise.
	* config/ia64/linux.mh (NATDEPFILES): Likewise.
	* config/m32r/linux.mh (NATDEPFILES): Likewise.
	* config/m68k/linux.mh (NATDEPFILES): Likewise.
	* config/mips/linux.mh (NATDEPFILES): Likewise.
	* config/pa/linux.mh (NATDEPFILES): Likewise.
	* config/powerpc/linux.mh (NATDEPFILES): Likewise.
	* config/powerpc/ppc64-linux.mh (NATDEPFILES): Likewise.
	* config/powerpc/spu-linux.mh (NATDEPFILES): Likewise.
	* config/s390/linux.mh (NATDEPFILES): Likewise.
	* config/sparc/linux.mh (NATDEPFILES): Likewise.
	* config/sparc/linux64.mh (NATDEPFILES): Likewise.
	* config/tilegx/linux.mh (NATDEPFILES): Likewise.
	* config/xtensa/linux.mh (NATDEPFILES): Likewise.

gdb/gdbserver/ChangeLog:

	* configure.ac (AC_CHECK_FUNCS): Add setns.
	* config.in: Regenerate.
	* configure: Likewise.
	* Makefile.in (SFILES): Add nat/linux-namespaces.c.
	(linux-namespaces.o): New rule.
	* configure.srv (srv_linux_obj): Add linux-namespaces.o.
2015-06-10 14:28:43 +01:00
Gary Benson 7823a9415b Rename common-remote-fileio.[ch] as fileio.[ch]
This commit renames common-remote-fileio.[ch] as fileio.[ch]
and renames all functions in these files.

gdb/ChangeLog:

	* common/common-remote-fileio.h: Rename to...
	* common/fileio.h: ...this.  Update all references.
	(remote_fileio_to_fio_error): Rename to...
	(host_to_fileio_error): ...this.
	(remote_fileio_to_be): Rename to...
	(host_to_bigendian): ...this.  Update all callers.
	(remote_fileio_to_fio_uint): Rename to...
	(host_to_fileio_uint): ...this.  Update all callers.
	(remote_fileio_to_fio_time): Rename to...
	(host_to_fileio_time): ...this.  Update all callers.
	(remote_fileio_to_fio_stat): Rename to...
	(host_to_fileio_stat): ...this.
	Update all references.
	* common/common-remote-fileio.c: Rename to...
	* common/fileio.c: ...this.  Update all references.
	(remote_fileio_to_fio_error): Rename to...
	(host_to_fileio_error): ...this.  Update all callers.
	(remote_fileio_mode_to_target): Rename to...
	(fileio_mode_pack): ...this.  Update all callers.
	(remote_fileio_to_fio_mode): Rename to...
	(host_to_fileio_mode): ...this.  Update all callers.
	(remote_fileio_to_fio_ulong): Rename to...
	(host_to_fileio_ulong): ...this.  Update all callers.
	(remote_fileio_to_fio_stat): Rename to...
	(host_to_fileio_stat): ...this.  Update all callers.
2015-04-09 15:44:31 +01:00
H.J. Lu 39f3de7c43 Regenerate configure in bfd/binutils/gas/gdb/gold
bfd/

	* configure: Regenerated.

binutils/

	* configure: Regenerated.

gas/

	* configure: Regenerated.

gdb/

	* Makefile.in (top_srcdir): New.
	* configure: Regenerated.

gold/

	* configure: Regenerated.
2015-04-02 05:45:03 -07:00
Sasha Smundak d11916aa89 Add support for writing unwinders in Python.
gdb/ChangeLog:

	* Makefile.in (SUBDIR_PYTHON_OBJS): Add py-unwind.o.
	(SUBDIR_PYTHON_SRCS): Add py-unwind.c.
	(py-unwind.o): New recipe.
	* NEWS: mention Python frame unwinding.
	* data-directory/Makefile.in (PYTHON_FILE_LIST): Add
	gdb/unwinder.py and gdb/command/unwinder.py
	* python/lib/gdb/__init__.py (packages): Add frame_unwinders
	list.
	(execute_unwinders): New function.
	* python/lib/gdb/command/unwinders.py: New file.
	* python/lib/gdb/unwinder.py: New file.
	* python/py-objfile.c (objfile_object): Add frame_unwinders field.
	(objfpy_dealloc): Decrement frame_unwinders reference count.
	(objfpy_initialize): Create frame_unwinders list.
	(objfpy_get_frame_unwinders): New function.
	(objfpy_set_frame_unwinders): Ditto.
	(objfile_getset): Add frame_unwinders attribute to Objfile.
	* python/py-progspace.c (pspace_object): Add frame_unwinders field.
	(pspy_dealloc): Decrement frame_unwinders reference count.
	(pspy_initialize): Create frame_unwinders list.
	(pspy_get_frame_unwinders): New function.
	(pspy_set_frame_unwinders): Ditto.
	(pspy_getset): Add frame_unwinders attribute to gdb.Progspace.
	* python/py-unwind.c: New file.
	* python/python-internal.h (pspy_get_name_unwinders): New prototype.
	(objpy_get_frame_unwinders): New prototype.
	(gdbpy_initialize_unwind): New prototype.
	* python/python.c (gdbpy_apply_type_printers): Call
	gdbpy_initialize_unwind.

gdb/doc/ChangeLog:

	* doc/python.texi (Writing a Frame Unwinder in Python): Add
	section.

gdb/testsuite/ChangeLog:

	* gdb.python/py-unwind-maint.c: New file.
	* gdb.python/py-unwind-maint.exp: New test.
	* gdb.python/py-unwind-maint.py: New file.
	* gdb.python/py-unwind.c: New file.
	* gdb.python/py-unwind.exp: New test.
	* gdb.python/py-unwind.py: New test.
2015-04-01 11:49:12 -07:00
H.J. Lu 711a72d3d6 Add --with-system-zlib in gdb
This patch adds --with-system-zlib and removes --with-zlib in gdb.

	* Makefile.in (ZLIB): New.
	(ZLIBINC): Likewise.
	(INTERNAL_CFLAGS_BASE): Add $(ZLIBINC).
	(CLIBS): Add $(ZLIB).
	* acinclude.m4: (GDB_AC_CHECK_BFD): Add $zlibdir to LDFLAGS.
	Add -lz to LIBS.
	* gdb_bfd.c: Don't check HAVE_ZLIB_H to include <zlib.h>.
	* top.c (print_gdb_configuration): Remove --with-zlib and
	--without-zlib.
	* config.in: Regenerated.
	* configure: Likewise.
2015-03-31 08:24:18 -07:00
James Bowman 49d45b20c0 gdb: ft32: new port
FT32 is a new high performance 32-bit RISC core developed by FTDI for
embedded applications.
2015-03-28 02:13:34 -04:00
Gary Benson 8e5d407004 Move low-level Linux x86 debug register code to a shared file
This commit moves the now-identical low-level Linux x86 debug register
code from gdb/x86-linux-nat.c and gdb/gdbserver/linux-x86-low.c into a
new shared file gdb/nat/x86-linux-dregs.c.

gdb/ChangeLog:

	* nat/x86-linux-dregs.h: New file.
	* nat/x86-linux-dregs.c: Likewise.
	* Makefile.in (HFILES_NO_SRCDIR): Add nat/x86-linux-dregs.h.
	(x86-linux-dregs.o): New rule.
	* config/i386/linux.mh (NATDEPFILES): Add x86-linux-dregs.o.
	* config/i386/linux64.mh (NATDEPFILES): Likewise.
	* x86-linux-nat.c: Include nat/x86-linux-dregs.h.
	(u_debugreg_offset): Moved to nat/x86-linux-dregs.c.
	(x86_linux_dr_get): Likewise.
	(x86_linux_dr_set): Likewise.
	(x86_linux_dr_get_addr): Likewise.
	(x86_linux_dr_get_control): Likewise.
	(x86_linux_dr_get_status): Likewise.
	(update_debug_registers_callback): Likewise.
	(x86_linux_dr_set_control): Likewise.
	(x86_linux_dr_set_addr): Likewise.
	(x86_linux_update_debug_registers): Likewise.

gdb/gdbserver/ChangeLog:

	* Makefile.in (x86-linux-dregs.o): New rule.
	* configure.srv: Add x86-linux-dregs.o to relevant targets.
	* linux-x86-low.c: Include nat/x86-linux-dregs.h.
	(u_debugreg_offset): Moved to nat/x86-linux-dregs.c.
	(x86_linux_dr_get): Likewise.
	(x86_linux_dr_set): Likewise.
	(update_debug_registers_callback): Likewise.
	(x86_linux_dr_set_addr): Likewise.
	(x86_linux_dr_get_addr): Likewise.
	(x86_linux_dr_set_control): Likewise.
	(x86_linux_dr_get_control): Likewise.
	(x86_linux_dr_get_status): Likewise.
	(x86_linux_update_debug_registers): Likewise.
2015-03-24 14:05:45 +00:00
Gary Benson 4b134ca108 Make lwp_info.arch_private handling shared
This commit moves the code to handle lwp_info.arch_private for
Linux x86 into a new shared file, nat/x86-linux.c.

gdb/ChangeLog:

	* nat/x86-linux.h: New file.
	* nat/x86-linux.c: Likewise.
	* Makefile.in (HFILES_NO_SRCDIR): Add nat/x86-linux.h.
	(x86-linux.o): New rule.
	* config/i386/linux.mh (NATDEPFILES): Add x86-linux.o.
	* config/i386/linux64.mh (NATDEPFILES): Likewise.
	* nat/linux-nat.h (struct arch_lwp_info): New forward declaration.
	(lwp_set_arch_private_info): New declaration.
	(lwp_arch_private_info): Likewise.
	* linux-nat.c (lwp_set_arch_private_info): New function.
	(lwp_arch_private_info): Likewise.
	* x86-linux-nat.c: Include nat/x86-linux.h.
	(arch_lwp_info): Removed structure.
	(update_debug_registers_callback):
	Use lwp_set_debug_registers_changed.
	(x86_linux_prepare_to_resume): Use lwp_debug_registers_changed
	and lwp_set_debug_registers_changed.
	(x86_linux_new_thread): Use lwp_set_debug_registers_changed.

gdb/gdbserver/ChangeLog:

	* Makefile.in (x86-linux.o): New rule.
	* configure.srv: Add x86-linux.o to relevant targets.
	* linux-low.c (lwp_set_arch_private_info): New function.
	(lwp_arch_private_info): Likewise.
	* linux-x86-low.c: Include nat/x86-linux.h.
	(arch_lwp_info): Removed structure.
	(update_debug_registers_callback):
	Use lwp_set_debug_registers_changed.
	(x86_linux_prepare_to_resume): Use lwp_debug_registers_changed
	and lwp_set_debug_registers_changed.
	(x86_linux_new_thread): Use lwp_set_debug_registers_changed.
2015-03-24 14:05:44 +00:00
Jan Kratochvil 61a12cfa7b Remove HPUX
IIUC it is a pre-requisite for IPv6 support, some UNICes do not support
getaddrinfo required for IPv6.  But coincidentally such UNICes are no longer
really supported by GDB.  Therefore it was concluded we can remove all such
UNICes and then we can implement IPv6 easily with getaddrinfo.

In mail
        Re: getaddrinfo available on all GDB hosts? [Re: [PATCH v2] Add IPv6 support for remote TCP connections]
        Message-ID: <20140211034157.GG5485@adacore.com>
        https://sourceware.org/ml/gdb-patches/2014-02/msg00333.html
Joel said:

So I chose HP-UX first for this patch.

gdb/ChangeLog
2014-10-16  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Remove HPUX.
	* Makefile.in (ALL_64_TARGET_OBS): Remove ia64-hpux-tdep.o.
	(ALL_TARGET_OBS): Remove hppa-hpux-tdep.o, solib-som.o and solib-pa64.o.
	(HFILES_NO_SRCDIR): Remove solib-som.h, inf-ttrace.h, solib-pa64.h and
	ia64-hpux-tdep.h, solib-ia64-hpux.h.
	(ALLDEPFILES): Remove hppa-hpux-tdep.c, hppa-hpux-nat.c,
	ia64-hpux-nat.c, ia64-hpux-tdep.c, somread.c and solib-som.c.
	* config/djgpp/fnchange.lst: Remove hppa-hpux-nat.c and
	hppa-hpux-tdep.c.
	* config/ia64/hpux.mh: Remove file.
	* config/pa/hpux.mh: Remove file.
	* configure: Rebuilt.
	* configure.ac (dlgetmodinfo, somread.o): Remove.
	* configure.host (hppa*-*-hpux*, ia64-*-hpux*): Make them obsolete.
	(ia64-*-hpux*): Remove its float format exception.
	* configure.tgt (hppa*-*-hpux*, ia64-*-hpux*): Make them obsolete.
	* hppa-hpux-nat.c: Remove file.
	* hppa-hpux-tdep.c: Remove file.
	* hppa-tdep.c (struct hppa_unwind_info, struct hppa_objfile_private):
	Move them here from hppa-tdep.h
	(hppa_objfile_priv_data, hppa_init_objfile_priv_data): Make it static.
	(hppa_frame_prev_register_helper): Remove HPPA_FLAGS_REGNUM exception.
	* hppa-tdep.h (struct hppa_unwind_info, struct hppa_objfile_private):
	Move them to hppa-tdep.c.
	(hppa_objfile_priv_data, hppa_init_objfile_priv_data): Remove
	declarations.
	* ia64-hpux-nat.c: Remove file.
	* ia64-hpux-tdep.c: Remove file.
	* ia64-hpux-tdep.h: Remove file.
	* inf-ttrace.c: Remove file.
	* inf-ttrace.h: Remove file.
	* solib-ia64-hpux.c: Remove file.
	* solib-ia64-hpux.h: Remove file.
	* solib-pa64.c: Remove file.
	* solib-pa64.h: Remove file.
	* solib-som.c: Remove file.
	* solib-som.h: Remove file.
	* somread.c: Remove file.
2015-03-13 20:24:22 +01:00
Sergio Durigan Junior 10304ef3e8 Create gdb/break-catch-syscall.c
This commits cleans up the gdb/breakpoint.c file and moves everything
that is related to the 'catch syscall' command to the new file
gdb/break-catch-syscall.c.  This is just code movement, and the only
new part is the adjustment needed on 'catching_syscall_number' to use
the new 'breakpoint_find_if' function insted of relying on the
ALL_BREAKPOINTS macro.

Tested by running the 'gdb.base/catch-syscall.exp' testcase.

gdb/ChangeLog:
2015-03-11  Sergio Durigan Junior  <sergiodj@redhat.com>

	* Makefile.in (SFILES): New source break-catch-syscall.c.
	(COMMON_OBS): New object break-catch-syscall.o.
	* break-catch-syscall.c: New file.
	* breakpoint.c: Remove inclusion of "xml-syscall.h".
	(syscall_catchpoint_p): Move declaration to break-catch-syscall.c
	(struct syscall_catchpoint): Likewise.
	(dtor_catch_syscall): Likewise.
	(catch_syscall_inferior_data): Likewise.
	(struct catch_syscall_inferior_data): Likewise.
	(get_catch_syscall_inferior_data): Likewise.
	(catch_syscall_inferior_data_cleanup): Likewise.
	(insert_catch_syscall): Likewise.
	(remove_catch_syscall): Likewise.
	(breakpoint_hit_catch_syscall): Likewise.
	(print_it_catch_syscall): Likewise.
	(print_one_catch_syscall): Likewise.
	(print_mention_catch_syscall): Likewise.
	(print_recreate_catch_syscall): Likewise.
	(catch_syscall_breakpoint_ops): Likewise.
	(syscall_catchpoint_p): Likewise.
	(create_syscall_event_catchpoint): Likewise.
	(catch_syscall_split_args): Likewise.
	(catch_syscall_command_1): Likewise.
	(is_syscall_catchpoint_enabled): Likewise.
	(catch_syscall_enabled): Likewise.
	(catching_syscall_number): Likewise.
	(catch_syscall_completer): Likewise.
	(clear_syscall_counts): Likewise.
	(initialize_breakpoint_ops): Move initialization of syscall
	catchpoints to break-catch-syscall.c.
	(_initialize_breakpoint): Move code related to syscall catchpoints
	to break-catch-syscall.c.
2015-03-11 14:13:49 -04:00
Gary Benson 791c00567a Move remote_fileio_to_fio_stat to gdb/common
This commit moves remote_fileio_to_fio_stat and its supporting
functions into new files common/common-remote-fileio.[ch].

gdb/ChangeLog:

	* common/common-remote-fileio.h: New file.
	* common/common-remote-fileio.c: Likewise.
	* Makefile.in (SFILES): Add common/common-remote-fileio.c.
	(HFILES_NO_SRCDIR): Add common/common-remote-fileio.h.
	(COMMON_OBS): Add common-remote-fileio.o.
	(common-remote-fileio.o): New rule.
	* remote-fileio.h (common-remote-fileio.h): New include.
	* remote-fileio.c (gdb/fileio.h): Do not include.
	(remote_fileio_to_be): Moved to common-remote-fileio.h.
	(remote_fileio_to_fio_uint): Likewise.
	(remote_fileio_to_fio_time): Likewise.
	(remote_fileio_mode_to_target): Moved to common-remote-fileio.c.
	(remote_fileio_to_fio_mode): Likewise.
	(remote_fileio_to_fio_ulong): Likewise.
	(remote_fileio_to_fio_stat): Likewise.

gdb/gdbserver/ChangeLog:

	* configure.ac (AC_CHECK_MEMBERS): Add checks for
	struct stat.st_blocks and struct stat.st_blksize.
	* configure: Regenerate.
	* config.in: Likewise.
	* Makefile.in (SFILES): Add common/common-remote-fileio.c.
	(OBS): Add common-remote-fileio.o.
	(common-remote-fileio.o): New rule.
2015-03-11 17:53:57 +00:00
Mark Kettenis 2dcb2b1a45 Enable rthreads support on OpenBSD/hppa
gdb/
2015-03-05  Mark Kettenis  <kettenis@gnu.org>

        * hppabsd-nat.c: Remove file.
        * hppaobsd-nat.c: New file.
        * Makefile.in (ALLDEPFILES): Remove hppabsd-nat.c.  Add
        hppaobsd-nat.c.
        * config/pa/obsd.mh (NATDEPFILES): Replace hppabsd-nat.o with
        hppaobsd-nat.o.
2015-03-05 17:21:03 +01:00
Pedro Alves 3bc3d82a00 Add --enable-build-with-cxx configure switch
This new option, disabled by default for now, allows specifying
whether to build GDB, GDBserver, and friends with a C++ (98/03)
compiler.

The name of the switch should be familiar to those who followed GCC's
own C++ conversion process.

. Adding -fpermissive to COMPILER in C++ mode (see the new
build-with-cxx.m4 file) makes errors like these be warnings instead:

  gdb/infrun.c:6597:1: error:   initializing argument 1 of ‘void sig_print_info(gdb_signal)’ [-fpermissive]
   sig_print_info (enum gdb_signal oursig)
   ^
  gdb/infrun.c: In function ‘void do_restore_infcall_suspend_state_cleanup(void*)’:
  gdb/infrun.c:7164:39: error: invalid conversion from ‘void*’ to ‘infcall_suspend_state*’ [-fpermissive]
     restore_infcall_suspend_state (state);
				 ^

so that the compiler carries on compiling the file.  -Werror still
catches the warnings, so nothing is lost, only our lifes are made
easier by concentrating on getting other more important things out of
the way first.

There's no way to quiet those warnings.  Until they're all fixed, when
building in C++ mode, -Werror is disabled by default.

. Adding -Wno-narrowing suppresses thousands of instances of this warning:

  gdb/arm-linux-tdep.c:439:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]
  gdb/arm-linux-tdep.c:439:1: error: narrowing conversion of ‘-1l’ from ‘LONGEST {aka long int}’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]
  gdb/arm-linux-tdep.c:450:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing]

We can defer handling those until we target C++11.


. Adding -Wno-sign-compare suppresses thousands of instances of this warning:

  gdb/linux-record.c:1763:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
	 if (tmpulongest == tdep->fcntl_F_GETLK64)
				  ^


. Adding -Wno-write-strings suppresses thousands of instances of this warning:

  gdb/mi/mi-cmd-var.c: In function ‘void mi_cmd_var_show_attributes(char*, char**, int)’:
  gdb/mi/mi-cmd-var.c:514:12: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
       attstr = "editable";
	      ^
  gdb/mi/mi-cmd-var.c:516:12: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
       attstr = "noneditable";
	      ^

For now, it's best to hide these warnings from view until we're
'-fpermissive'-clean, and can thus start building with -Werror.
The C compiler has always managed to build working GDBs with these
issues in the code, so a C++ compiler should too.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

	* Makefile.in (COMPILER): New, get it from autoconf.
	(COMPILE.pre, CC_LD): Use COMPILER.
	(CXX): Get from autoconf instead.
	(CXX_FOR_TARGET): Default to g++ instead of gcc.
	* acinclude.m4: Include build-with-cxx.m4.
	* build-with-cxx.m4: New file.
	* configure.ac: Call AC_PROG_CXX and GDB_AC_BUILD_WITH_CXX.
	Disable -Werror by default if building in C++ mode.
	(build_warnings): Add -Wno-sign-compare, -Wno-write-strings and
	-Wno-narrowing in C++ mode.  Only enable -Wpointer-sign in C mode.
	Run supported-warning-flags tests with the C++ compiler.
	Save/restore CXXFLAGS too.
	* configure: Regenerate.

gdb/gdbserver/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

	* Makefile.in (COMPILER): New, get it from autoconf.
	(CXX): Get from autoconf instead.
	(COMPILE.pre): Use COMPILER.
	(CC-LD): Rename to ...
	(CC_LD): ... this.  Use COMPILER.
	(gdbserver$(EXEEXT), gdbreplay$(EXEEXT), $(IPA_LIB)): Adjust.
	(CXX_FOR_TARGET): Default to g++ instead of gcc.
	* acinclude.m4: Include build-with-cxx.m4.
	* configure.ac: Call AC_PROG_CXX and GDB_AC_BUILD_WITH_CXX.
	Disable -Werror by default if building in C++ mode.
	(build_warnings): Add -Wno-sign-compare, -Wno-write-strings and
	-Wno-narrowing in C++ mode. Run supported-warning-flags tests with
	the C++ compiler.  Save/restore CXXFLAGS too.
	* configure: Regenerate.
2015-02-27 16:24:02 +00:00
Pedro Alves 532f44ed67 Rename windows-termcap.c -> stub-termcap.c
Preparation for using this on all hosts.

Confirmed that --host=x86_64-w64-mingw32 still builds the stub
termcap.

gdb/ChangeLog:
2015-02-26  Pedro Alves  <palves@redhat.com>

	* windows-termcap.c: Rename to ...
	* stub-termcap.c: ... this.  Adjust header line.
	* Makefile.in (SFILES): Refer to stub-termcap.c instead of
	windows-termcap.c.
	* configure: Regenerate.
	* configure.ac: Refer to stub-termcap.o instead of
	windows-termcap.o.
	* gdb_curses.h: Mention stub-termcap.c instead of
	windows-termcap.c.
2015-02-26 17:13:58 +00:00
Jose E. Marchesi f6a88844c3 Factorize target program transformations in the GDB_AC_TRANSFORM macro.
This patch introduces a new M4 macro GDB_AC_TRANSFORM to avoid repeating
the common idiom which is the transformation of target program names,
i.e. from gdb to sparc64-linux-gnu-gdb.  It also makes gdb/configure.ac
and gdb/testsuite/configure.ac to use the new macro.

gdb/ChangeLog:

2015-02-18  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* configure: Regenerated.
	* configure.ac: Use GDB_AC_TRANSFORM.
	* Makefile.in (aclocal_m4_deps): Added transform.m4.
	* acinclude.m4: sinclude transform.m4.
	* transform.m4: New file.
	(GDB_AC_TRANSFORM): New macro.

gdb/testsuite/ChangeLog:

2015-02-18  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* configure: Regenerated.
	* configure.ac: Use GDB_AC_TRANSFORM.
	* aclocal.m4: sinclude ../transform.m4.
2015-02-18 13:52:53 +01:00
Jose E. Marchesi d4777acbc9 New probe type: DTrace USDT probes.
This patch adds a new type of probe to GDB: the DTrace USDT probes.  The new
type is added by providing functions implementing all the entries of the
`probe_ops' structure defined in `probe.h'.  The implementation is
self-contained and does not depend on DTrace source code in any way.

gdb/ChangeLog:

2015-02-7  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* breakpoint.c (BREAK_ARGS_HELP): Help string updated to mention
	the -probe-dtrace new vpossible value for PROBE_MODIFIER.
	* configure.ac (CONFIG_OBS): dtrace-probe.o added if BFD can
	handle ELF files.
	* Makefile.in (SFILES): dtrace-probe.c added.
	* configure: Regenerate.
	* dtrace-probe.c: New file.
	(SHT_SUNW_dof): New constant.
	(dtrace_probe_type): New enum.
	(dtrace_probe_arg): New struct.
	(dtrace_probe_arg_s): New typedef.
	(struct dtrace_probe_enabler): New struct.
	(dtrace_probe_enabler_s): New typedef.
	(dtrace_probe): New struct.
	(dtrace_probe_is_linespec): New function.
	(dtrace_dof_sect_type): New enum.
	(dtrace_dof_dofh_ident): Likewise.
	(dtrace_dof_encoding): Likewise.
	(DTRACE_DOF_ENCODE_LSB): Likewise.
	(DTRACE_DOF_ENCODE_MSB): Likewise.
	(dtrace_dof_hdr): New struct.
	(dtrace_dof_sect): Likewise.
	(dtrace_dof_provider): Likewise.
	(dtrace_dof_probe): Likewise.
	(DOF_UINT): New macro.
	(DTRACE_DOF_PTR): Likewise.
	(DTRACE_DOF_SECT): Likewise.
	(dtrace_process_dof_probe): New function.
	(dtrace_process_dof): Likewise.
	(dtrace_build_arg_exprs): Likewise.
	(dtrace_get_arg): Likewise.
	(dtrace_get_probes): Likewise.
	(dtrace_get_probe_argument_count): Likewise.
	(dtrace_can_evaluate_probe_arguments): Likewise.
	(dtrace_evaluate_probe_argument): Likewise.
	(dtrace_compile_to_ax): Likewise.
	(dtrace_probe_destroy): Likewise.
	(dtrace_gen_info_probes_table_header): Likewise.
	(dtrace_gen_info_probes_table_values): Likewise.
	(dtrace_probe_is_enabled): Likewise.
	(dtrace_probe_ops): New variable.
	(info_probes_dtrace_command): New function.
	(_initialize_dtrace_probe): Likewise.
	(dtrace_type_name): Likewise.
2015-02-17 16:03:22 +01:00