Commit Graph

32857 Commits

Author SHA1 Message Date
gdbadmin 6da195136d *** empty log message *** 2013-06-15 00:00:03 +00:00
gdbadmin 1a39a68ee7 *** empty log message *** 2013-06-14 00:00:32 +00:00
Doug Evans 9c02c12947 * dwarf2read.c (try_open_dwop_file): Work around behaviour of
OPF_TRY_CWD_FIRST to not search path if the file contains a '/'.
2013-06-13 23:01:37 +00:00
gdbadmin 479a1f0a6f *** empty log message *** 2013-06-13 00:00:32 +00:00
Pedro Alves 760256f967 [GDBserver] Fix gdb.threads/siginfo-threads.exp, gdb.base/siginfo-obj.exp regressions.
This fixes the regressions reported at
<http://sourceware.org/ml/gdb-patches/2013-06/msg00280.html>:

 $ runtest-gdbserver gdb.base/siginfo-obj.exp gdb.base/siginfo-thread.exp gdb.threads/siginfo-threads.exp
 Running ./gdb.base/siginfo-thread.exp ...
 FAIL: gdb.base/siginfo-thread.exp: p ssi_addr
 Running ./gdb.threads/siginfo-threads.exp ...
 FAIL: gdb.threads/siginfo-threads.exp: signal 0 si_pid
 FAIL: gdb.threads/siginfo-threads.exp: signal 1 si_pid
 FAIL: gdb.threads/siginfo-threads.exp: signal 2 si_pid
 FAIL: gdb.threads/siginfo-threads.exp: signal 3 si_pid
 Running ./gdb.base/siginfo-obj.exp ...
 FAIL: gdb.base/siginfo-obj.exp: p ssi_addr
 FAIL: gdb.base/siginfo-obj.exp: p ssi_addr

The multi-arch patch made GDBserver do the the wrong siginfo layout
conversion, because most uses of `linux_is_elf64' were removed, and it
ended up never set.  A global really is the wrong thing to use as
elf64-ness is a per-process property; `linux_is_elf64' was just
accidentally left behind.

Tested on x86_64 Fedora 17.

gdb/gdbserver/
2013-06-12  Pedro Alves  <palves@redhat.com>

	* linux-x86-low.c (linux_is_elf64): Delete global.
	(x86_siginfo_fixup): Replace reference to `linux_is_elf64' global
	with local linux_pid_exe_is_elf_64_file use.
2013-06-12 16:05:39 +00:00
Phil Muldoon d0548fa274 2013-06-12 Phil Muldoon <pmuldoon@redhat.com>
* stack.c (backtrace_command_1): Fix indentation.
2013-06-12 12:16:47 +00:00
gdbadmin a9bb8c343e *** empty log message *** 2013-06-12 00:00:02 +00:00
Pedro Alves 030031eed5 Lazily allocate 'struct regsets_info'::disabled_regsets.
There's no need for every arch to pre-allocate disabled_regsets.
Chances are the array won't be used.

(I have a hunch that with some more work we could dispense with
initialize_regsets_info.)

Tested on x86_64 Fedora 17 w/ -lmcheck.

gdb/gdbserver/
2013-06-11  Pedro Alves  <palves@redhat.com>

	* linux-low.c (regset_disabled, disable_regset): New functions.
	(regsets_fetch_inferior_registers)
	(regsets_store_inferior_registers): Use them.
	(initialize_regsets_info); Don't allocate the disabled_regsets
	array here.
	* linux-low.h (struct regsets_info) <disabled_regsets>: Extend
	comment.
2013-06-11 18:05:57 +00:00
Pedro Alves 5da6eb0a10 Fix regression from multi-arch patch.
This fixes the regression reported at
<http://sourceware.org/ml/gdb-patches/2013-06/msg00185.html>.

GDBserver was reaching:

static int
regsets_fetch_inferior_registers (struct regsets_info *regsets_info,
				  struct regcache *regcache)
{
  struct regset_info *regset;
  int saw_general_regs = 0;
  int pid;
  struct iovec iov;

  regset = regsets_info->regsets;

  pid = lwpid_of (get_thread_lwp (current_inferior));
  while (regset->size >= 0)
    {
      void *buf, *data;
      int nt_type, res;

      if (regset->size == 0
	  || regsets_info->disabled_regsets[regset - regsets_info->regsets])
	{
>>>>>>>	  regset ++;      <<<<<<<  HERE
	  continue;
	}

Because info->disabled_regsets[] was not being initialized, and that
causes all sorts of wrong.

gdb/gdbserver/
2013-06-11  Pedro Alves  <palves@redhat.com>

	* linux-low.c (initialize_regsets_info): Use xcalloc instead of
	xmalloc.
2013-06-11 17:26:25 +00:00
Pedro Alves 7e5aaa093c [GDBserver] Initialize the x32 avx target description.
All target descriptions must be initialized at startup, but this one was forgotten.

gdb/gdbserver/
2013-06-11  Pedro Alves  <palves@redhat.com>

	* linux-x86-low.c (initialize_low_arch): Call
	init_registers_x32_avx_linux.
2013-06-11 13:32:52 +00:00
Joel Brobecker 2212802810 windows-nat.c:thread_rec: Add missing empty line after var declaration.
gdb/ChangeLog:

        * window-nat.c (thread_rec): Add missing empty line after
        local variable declaration.
2013-06-11 11:03:42 +00:00
Joel Brobecker 2ed3e00940 [windows] Fix accidental change of %u -> %d in SuspendThread warning.
While enhancing the warning printed in when SuspendThread fails,
I accidently changed the format used to print the error code
from %u to %d. This patch reverts it back.

gdb/ChangeLog:

        * windows-nat.c (thread_rec): Revert format used to print
        error code returned by SuspendThread from %d back to %u.
2013-06-11 11:01:46 +00:00
Joel Brobecker 0c3d84be3e windows: Prefix thread ID values with "0x" in debug traces
The windows-nat.c debug traces print the thread ID in base 16,
but give no indication of it. So, in a trace like the following...

    gdb: kernel event for pid=4816 tid=720 code=CREATE_THREAD_DEBUG_EVENT)

... where tid is "720", it's easy to be confused and think that
the thread ID is 720 rather than 0x720.  This patch avoids the
confusion by adding the usual "0x" prefix used for hexadecimal
values.

gdb/ChangeLog:

        * windows-nat.c (windows_continue): Add "0x" prefix for thread
        ID in debug trace.
        (get_windows_debug_event): Likewise, for all debug traces.
2013-06-11 10:20:24 +00:00
Joel Brobecker 80e88e1aa2 windows: Add thread ID in SuspendThread error warning message.
This patch adds the thread ID to a warning printed when a call to
SuspendThread fails. It will help investigate issues, particularly
when correlated with the various debug traces provided by the
windows-nat module.

For the record, the output has been changed from...

    warning: SuspendThread failed. (winerr 6)

... to ...

    warning: SuspendThread (tid=0x720) failed. (winerr 6)

gdb/ChangeLog:

        * window-nat.c (thread_rec): Add thread ID in SuspendThread
        warning message.
2013-06-11 10:20:11 +00:00
gdbadmin 37f134cb96 *** empty log message *** 2013-06-11 00:00:02 +00:00
gdbadmin a7cfa99ecf *** empty log message *** 2013-06-10 00:00:32 +00:00
Jan Kratochvil d878444cd9 gdb/gdbserver/
Fix compatibility with Android Bionic.
	* linux-low.c (linux_qxfer_libraries_svr4): Ignore first entry even if
	it is not empty.
2013-06-09 17:08:47 +00:00
gdbadmin 65b8e0e1ca *** empty log message *** 2013-06-09 00:00:32 +00:00
Yao Qi 1edebdbff5 gdb/
* mi/mi-main.c (get_register): Remove declaration.
	(output_register): Declare.
	(mi_cmd_data_list_register_values): Remove local variable
	'tuple_cleanup'.  Move some code into output_register.
	(get_register): Renamed to ...
	(output_register): ... this.  Output the register's
	"number" ui_out tuple here.
2013-06-08 00:21:42 +00:00
gdbadmin 8d3caaf0a7 *** empty log message *** 2013-06-08 00:00:02 +00:00
Pedro Alves 4ec7020176 Remove superfluous semicolons from testsuite throughout.
A few months ago semicolons after "return" were removed throughout the
testsuite.  However, as I pointed out in review, they're unnecessary
not just after "return", but pretty much after any tcl command.  ';'
is the command separator, and you only need it if there's another
command on the same line afterwards.

This patch was written by running:

 $ find . -name "*.exp" | xargs grep -l ";\s*$" | xargs sed -i 's/\([^#][^\s*;]*\)\s*;\s*$/\1/'

and then undoing changes to comments, and lib/future.exp.

Tested on x86_64 Fedora 17.

gdb/testsuite/
2013-06-07  Pedro Alves  <palves@redhat.com>

	* boards/native-extended-gdbserver.exp: Remove semicolon.
	* config/arm-ice.exp: Likewise.
	* config/bfin.exp: Likewise.
	* config/cygmon.exp: Likewise.
	* config/h8300.exp: Likewise.
	* config/monitor.exp: Likewise.
	* config/sid.exp: Likewise.
	* config/sim.exp: Likewise.
	* config/slite.exp: Likewise.
	* config/vx.exp: Likewise.
	* gdb.arch/i386-bp_permanent.exp: Likewise.
	* gdb.asm/asm-source.exp: Likewise.
	* gdb.base/args.exp: Likewise.
	* gdb.base/attach-pie-misread.exp: Likewise.
	* gdb.base/auxv.exp: Likewise.
	* gdb.base/bigcore.exp: Likewise.
	* gdb.base/bitfields2.exp: Likewise.
	* gdb.base/bitfields.exp: Likewise.
	* gdb.base/break.exp: Likewise.
	* gdb.base/break-interp.exp: Likewise.
	* gdb.base/callfuncs.exp: Likewise.
	* gdb.base/call-sc.exp: Likewise.
	* gdb.base/commands.exp: Likewise.
	* gdb.base/corefile.exp: Likewise.
	* gdb.base/dbx.exp: Likewise.
	* gdb.base/ending-run.exp: Likewise.
	* gdb.base/exprs.exp: Likewise.
	* gdb.base/funcargs.exp: Likewise.
	* gdb.base/hbreak2.exp: Likewise.
	* gdb.base/huge.exp: Likewise.
	* gdb.base/list.exp: Likewise.
	* gdb.base/memattr.exp: Likewise.
	* gdb.base/overlays.exp: Likewise.
	* gdb.base/printcmds.exp: Likewise.
	* gdb.base/recurse.exp: Likewise.
	* gdb.base/remotetimeout.exp: Likewise.
	* gdb.base/reread.exp: Likewise.
	* gdb.base/savedregs.exp: Likewise.
	* gdb.base/scope.exp: Likewise.
	* gdb.base/sepdebug.exp: Likewise.
	* gdb.base/setshow.exp: Likewise.
	* gdb.base/setvar.exp: Likewise.
	* gdb.base/sigaltstack.exp: Likewise.
	* gdb.base/siginfo-addr.exp: Likewise.
	* gdb.base/siginfo.exp: Likewise.
	* gdb.base/siginfo-obj.exp: Likewise.
	* gdb.base/sigrepeat.exp: Likewise.
	* gdb.base/sigstep.exp: Likewise.
	* gdb.base/structs.exp: Likewise.
	* gdb.base/testenv.exp: Likewise.
	* gdb.base/twice.exp: Likewise.
	* gdb.base/valgrind-db-attach.exp: Likewise.
	* gdb.base/valgrind-infcall.exp: Likewise.
	* gdb.base/varargs.exp: Likewise.
	* gdb.base/watchpoint.exp: Likewise.
	* gdb.cp/gdb1355.exp: Likewise.
	* gdb.cp/misc.exp: Likewise.
	* gdb.disasm/hppa.exp: Likewise.
	* gdb.disasm/t01_mov.exp: Likewise.
	* gdb.disasm/t02_mova.exp: Likewise.
	* gdb.disasm/t03_add.exp: Likewise.
	* gdb.disasm/t04_sub.exp: Likewise.
	* gdb.disasm/t05_cmp.exp: Likewise.
	* gdb.disasm/t06_ari2.exp: Likewise.
	* gdb.disasm/t07_ari3.exp: Likewise.
	* gdb.disasm/t08_or.exp: Likewise.
	* gdb.disasm/t09_xor.exp: Likewise.
	* gdb.disasm/t10_and.exp: Likewise.
	* gdb.disasm/t11_logs.exp: Likewise.
	* gdb.disasm/t12_bit.exp: Likewise.
	* gdb.disasm/t13_otr.exp: Likewise.
	* gdb.gdb/selftest.exp: Likewise.
	* gdb.hp/gdb.base-hp/callfwmall.exp: Likewise.
	* gdb.mi/mi-reverse.exp: Likewise.
	* gdb.pascal/floats.exp: Likewise.
	* gdb.python/py-inferior.exp: Likewise.
	* gdb.threads/attach-into-signal.exp: Likewise.
	* gdb.threads/pthreads.exp: Likewise.
	* gdb.threads/thread_events.exp: Likewise.
	* gdb.threads/watchthreads.exp: Likewise.
	* gdb.trace/actions-changed.exp: Likewise.
	* gdb.trace/actions.exp: Likewise.
	* gdb.trace/ax.exp: Likewise.
	* gdb.trace/backtrace.exp: Likewise.
	* gdb.trace/change-loc.exp: Likewise.
	* gdb.trace/deltrace.exp: Likewise.
	* gdb.trace/disconnected-tracing.exp: Likewise.
	* gdb.trace/ftrace.exp: Likewise.
	* gdb.trace/infotrace.exp: Likewise.
	* gdb.trace/passc-dyn.exp: Likewise.
	* gdb.trace/passcount.exp: Likewise.
	* gdb.trace/pending.exp: Likewise.
	* gdb.trace/qtro.exp: Likewise.
	* gdb.trace/range-stepping.exp: Likewise.
	* gdb.trace/report.exp: Likewise.
	* gdb.trace/save-trace.exp: Likewise.
	* gdb.trace/status-stop.exp: Likewise.
	* gdb.trace/strace.exp: Likewise.
	* gdb.trace/tfile.exp: Likewise.
	* gdb.trace/tfind.exp: Likewise.
	* gdb.trace/trace-break.exp: Likewise.
	* gdb.trace/tracecmd.exp: Likewise.
	* gdb.trace/trace-mt.exp: Likewise.
	* gdb.trace/tspeed.exp: Likewise.
	* gdb.trace/tsv.exp: Likewise.
	* gdb.trace/while-stepping.exp: Likewise.
	* lib/gdb.exp: Likewise.
	* lib/gdbserver-support.exp: Likewise.
	* lib/java.exp: Likewise.
	* lib/mi-support.exp: Likewise.
	* lib/pascal.exp: Likewise.
	* lib/prompt.exp: Likewise.
	* lib/trace-support.exp: Likewise.
2013-06-07 17:31:09 +00:00
Pedro Alves 47d4871188 Fix formating in copyright headers.
File list found with:
$ grep "along with this program" * -A 1 -rn \
	| grep "*/" \
	| grep -v "along with this program" \
	| sed 's,-[0-9]\+-.*,,g'

Tested on x86_64 Fedora 17.

gdb/
2013-06-07  Pedro Alves  <palves@redhat.com>

	* darwin-nat.c: Fix formating in copyright header.
	* darwin-nat.h: Likewise.
	* gnu-nat.c: Likewise.
	* machoread.c: Likewise.

gdb/testsuite/
2013-06-07  Pedro Alves  <palves@redhat.com>

	* gdb.ada/info_types.c: Fix formating in copyright header.
	* gdb.base/break-on-linker-gcd-function.cc: Likewise.
	* gdb.base/float.c: Likewise.
	* gdb.base/inferior-died.c: Likewise.
	* gdb.base/interp.c: Likewise.
	* gdb.base/jit-main.c: Likewise.
	* gdb.base/jit-solib.c: Likewise.
	* gdb.base/long_long.c: Likewise.
	* gdb.base/longjmp.c: Likewise.
	* gdb.base/nextoverexit.c: Likewise.
	* gdb.base/pr11022.c: Likewise.
	* gdb.base/prelink-lib.c: Likewise.
	* gdb.base/prelink.c: Likewise.
	* gdb.base/prologue.c: Likewise.
	* gdb.base/restore.c: Likewise.
	* gdb.base/sigchld.c: Likewise.
	* gdb.base/solib-search-lib1.c: Likewise.
	* gdb.base/solib-search-lib2.c: Likewise.
	* gdb.base/solib-search.c: Likewise.
	* gdb.base/solib-search.h: Likewise.
	* gdb.base/whatis.c: Likewise.
	* gdb.cp/abstract-origin.cc: Likewise.
	* gdb.cp/anon-struct.cc: Likewise.
	* gdb.cp/baseenum.cc: Likewise.
	* gdb.cp/bs15503.cc: Likewise.
	* gdb.cp/call-c-1.c: Likewise.
	* gdb.cp/call-c.cc: Likewise.
	* gdb.cp/class2.cc: Likewise.
	* gdb.cp/classes.cc: Likewise.
	* gdb.cp/cttiadd.cc: Likewise.
	* gdb.cp/cttiadd1.cc: Likewise.
	* gdb.cp/cttiadd2.cc: Likewise.
	* gdb.cp/cttiadd3.cc: Likewise.
	* gdb.cp/derivation.cc: Likewise.
	* gdb.cp/derivation2.cc: Likewise.
	* gdb.cp/dispcxx.cc: Likewise.
	* gdb.cp/exception.cc: Likewise.
	* gdb.cp/gdb2384-base.cc: Likewise.
	* gdb.cp/gdb2384-base.h: Likewise.
	* gdb.cp/gdb2384.cc: Likewise.
	* gdb.cp/gdb2495.cc: Likewise.
	* gdb.cp/mb-inline.h: Likewise.
	* gdb.cp/mb-inline1.cc: Likewise.
	* gdb.cp/mb-inline2.cc: Likewise.
	* gdb.cp/member-name.cc: Likewise.
	* gdb.cp/member-ptr.cc: Likewise.
	* gdb.cp/misc.cc: Likewise.
	* gdb.cp/namespace1.cc: Likewise.
	* gdb.cp/nextoverthrow.cc: Likewise.
	* gdb.cp/pr-574.cc: Likewise.
	* gdb.cp/pr9631.cc: Likewise.
	* gdb.cp/printmethod.cc: Likewise.
	* gdb.cp/psmang1.cc: Likewise.
	* gdb.cp/psmang2.cc: Likewise.
	* gdb.cp/psymtab-parameter.cc: Likewise.
	* gdb.cp/ptype-flags.cc: Likewise.
	* gdb.cp/ref-params.cc: Likewise.
	* gdb.cp/ref-types.cc: Likewise.
	* gdb.cp/smartp.cc: Likewise.
	* gdb.cp/try_catch.cc: Likewise.
	* gdb.cp/userdef.cc: Likewise.
	* gdb.cp/using-crash.cc: Likewise.
	* gdb.cp/virtfunc.cc: Likewise.
	* gdb.cp/virtfunc2.cc: Likewise.
	* gdb.dwarf2/callframecfa.S: Likewise.
	* gdb.dwarf2/dw2-ranges.c: Likewise.
	* gdb.dwarf2/dw2-ranges2.c: Likewise.
	* gdb.dwarf2/dw2-ranges3.c: Likewise.
	* gdb.dwarf2/dw2-restore.S: Likewise.
	* gdb.dwarf2/pieces.S: Likewise.
	* gdb.dwarf2/valop.S: Likewise.
	* gdb.java/jnpe.java: Likewise.
	* gdb.mi/mi-stepn.c: Likewise.
	* gdb.mi/mi-var-cp.cc: Likewise.
	* gdb.mi/mi-var-rtti.cc: Likewise.
	* gdb.mi/ns-stale-regcache.c: Likewise.
	* gdb.mi/pr11022.c: Likewise.
	* gdb.mi/solib-lib.c: Likewise.
	* gdb.mi/solib-main.c: Likewise.
	* gdb.python/py-arch.c: Likewise.
	* gdb.python/py-block.c: Likewise.
	* gdb.python/py-breakpoint.c: Likewise.
	* gdb.python/py-events.c: Likewise.
	* gdb.python/py-evthreads.c: Likewise.
	* gdb.python/py-explore.c: Likewise.
	* gdb.python/py-explore.cc: Likewise.
	* gdb.python/py-finish-breakpoint.c: Likewise.
	* gdb.python/py-finish-breakpoint2.cc: Likewise.
	* gdb.python/py-symbol.c: Likewise.
	* gdb.threads/execl.c: Likewise.
	* gdb.threads/execl1.c: Likewise.
2013-06-07 14:39:33 +00:00
Pedro Alves 5f2b57b5ec Mention PR server/14823 in ChangeLogs. 2013-06-07 10:55:22 +00:00
Pedro Alves 3aee891821 [GDBserver] Multi-process + multi-arch
This patch makes GDBserver support multi-process + biarch.

Currently, if you're debugging more than one process at once with a
single gdbserver (in extended-remote mode), then all processes must
have the same architecture (e.g., 64-bit vs 32-bit).  Otherwise, you
see this:

Added inferior 2
[Switching to inferior 2 [<null>] (<noexec>)]
Reading symbols from /home/pedro/gdb/tests/main32...done.
Temporary breakpoint 2 at 0x4004cf: main. (2 locations)
Starting program: /home/pedro/gdb/tests/main32
warning: Selected architecture i386 is not compatible with reported target architecture i386:x86-64
warning: Architecture rejected target-supplied description
Remote 'g' packet reply is too long: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000090cfffff0000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000b042f7460000000000020000230000002b0000002b0000002b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007f03000000000000ffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000801f00003b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
... etc, etc ...

Even though the process was running a 32-bit program, GDBserver sent
back to GDB a register set in 64-bit layout.

A patch (http://sourceware.org/ml/gdb-patches/2012-11/msg00228.html) a
while ago made GDB track a target_gdbarch per inferior, and as
consequence, fetch a target description per-inferior.  This patch is
the GDBserver counterpart, that makes GDBserver keep track of each
process'es XML target description and register layout.  So in the
example above, GDBserver will send the correct register set in 32-bit
layout to GDB.

A new "struct target_desc" object (tdesc for short) is added, that
holds the target description and register layout information about
each process.  Each `struct process_info' holds a pointer to a target
description.  The regcache also gains a pointer to a target
description, mainly for convenience, and parallel with GDB (and
possible future support for programs that flip processor modes).

The low target's arch_setup routines are responsible for setting the
process'es correct tdesc.  This isn't that much different to how
things were done before, except that instead of detecting the inferior
process'es architecture and calling the corresponding
init_registers_FOO routine, which would change the regcache layout
globals and recreate the threads' regcaches, the regcache.c globals
are gone, and the init_registers_$BAR routines now each initialize a
separate global struct target_desc object (one for each arch variant
GDBserver supports), and so all the init_registers_$BAR routines that
are built into GDBserver are called early at GDBserver startup time
(similarly to how GDB handles its built-in target descriptions), and
then the arch_setup routine is responsible for making
process_info->tdesc point to one of these target description globals.
The regcache module is all parameterized to get the regcache's layout
from the tdesc object instead of the old register_bytes, etc. globals.

The threads' regcaches are now created lazily.  The old scheme where
we created each of them when we added a new thread doesn't work
anymore, because we add the main thread/lwp before we see it stop for
the first time, and it is only when we see the thread stop for the
first time that we have a chance of determining the inferior's
architecture (through the_low_target.arch_setup).  Therefore when we
add the main thread we don't know which architecture/tdesc its
regcache should have.

This patch makes the gdb.multi/multi-arch.exp test now pass against
(extended-remote) GDBserver.  It currently fails, without this patch.

The IPA also uses the regcache, so it gains a new global struct
target_desc pointer, which points at the description of the process it
is loaded in.

Re. the linux-low.c & friends changes.  Since the register map
etc. may differ between processes (64-bit vs 32-bit) etc., the
linux_target_ops num_regs, regmap and regset_bitmap data fields are no
longer sufficient.  A new method is added in their place that returns
a pointer to a new struct that includes all info linux-low.c needs to
access registers of the current inferior.

The patch/discussion that originally introduced
linux-low.c:disabled_regsets mentions that the disabled_regsets set
may be different per mode (in a biarch setup), and indeed that is
cleared whenever we start a new (first) inferior, so that global is
moved as well behind the new `struct regs_info'.

On the x86 side:

I simply replaced the i387-fp.c:num_xmm_registers global with a check
for 64-bit or 32-bit process, which is equivalent to how the global
was set.  This avoided coming up with some more general mechanism that
would work for all targets that use this module (GNU/Linux, Windows,
etc.).

Tested:

  GNU/Linux IA64
  GNU/Linux MIPS64
  GNU/Linux PowerPC (Fedora 16)
  GNU/Linux s390x (Fedora 16)
  GNU/Linux sparc64 (Debian)
  GNU/Linux x86_64, -m64 and -m32 (Fedora 17)

Cross built, and smoke tested:

  i686-w64-mingw32, under Wine.
  GNU/Linux TI C6x, by Yao Qi.

Cross built but otherwise not tested:

  aarch64-linux-gnu
  arm-linux-gnu
  m68k-linux
  nios2-linux-gnu
  sh-linux-gnu
  spu
  tilegx-unknown-linux-gnu

Completely untested:

  GNU/Linux Blackfin
  GNU/Linux CRIS
  GNU/Linux CRISv32
  GNU/Linux TI Xtensa
  GNU/Linux M32R
  LynxOS
  QNX NTO

gdb/gdbserver/
2013-06-07  Pedro Alves  <palves@redhat.com>

	* Makefile.in (OBS): Add tdesc.o.
	(IPA_OBJS): Add tdesc-ipa.o.
	(tdesc-ipa.o): New rule.
	* ax.c (gdb_eval_agent_expr): Adjust register_size call to new
	interface.
	* linux-low.c (new_inferior): Delete.
	(disabled_regsets, num_regsets): Delete.
	(linux_add_process): Adjust to set the new per-process
	new_inferior flag.
	(linux_detach_one_lwp): Adjust to call regcache_invalidate_thread.
	(linux_wait_for_lwp): Adjust.  Only call arch_setup if the event
	was a stop.  When calling arch_setup, switch the current inferior
	to the thread that got an event.
	(linux_resume_one_lwp): Adjust to call regcache_invalidate_thread.
	(regsets_fetch_inferior_registers)
	(regsets_store_inferior_registers): New regsets_info parameter.
	Adjust to use it.
	(linux_register_in_regsets): New regs_info parameter.  Adjust to
	use it.
	(register_addr, fetch_register, store_register): New usrregs_info
	parameter.  Adjust to use it.
	(usr_fetch_inferior_registers, usr_store_inferior_registers): New
	parameter regs_info.  Adjust to use it.
	(linux_fetch_registers): Get the current inferior's regs_info, and
	adjust to use it.
	(linux_store_registers): Ditto.
	[HAVE_LINUX_REGSETS] (initialize_regsets_info): New.
	(initialize_low): Don't initialize the target_regsets here.  Call
	initialize_low_arch.
	* linux-low.h (target_regsets): Delete declaration.
	(struct regsets_info): New.
	(struct usrregs_info): New.
	(struct regs_info): New.
	(struct process_info_private) <new_inferior>: New field.
	(struct linux_target_ops): Delete the num_regs, regmap, and
	regset_bitmap fields.  New field regs_info.
	[HAVE_LINUX_REGSETS] (initialize_regsets_info): Declare.
	* i387-fp.c (num_xmm_registers): Delete.
	(i387_cache_to_fsave, i387_fsave_to_cache): Adjust find_regno
	calls to new interface.
	(i387_cache_to_fxsave, i387_cache_to_xsave, i387_fxsave_to_cache)
	(i387_xsave_to_cache): Adjust find_regno calls to new interface.
	Infer the number of xmm registers from the regcache's target
	description.
	* i387-fp.h (num_xmm_registers): Delete.
	* inferiors.c (add_thread): Don't install the thread's regcache
	here.
	* proc-service.c (gregset_info): Fetch the current inferior's
	regs_info.  Adjust to use it.
	* regcache.c: Include tdesc.h.
	(register_bytes, reg_defs, num_registers)
	(gdbserver_expedite_regs): Delete.
	(get_thread_regcache): If the thread doesn't have a regcache yet,
	create one, instead of aborting gdbserver.
	(regcache_invalidate_one): Rename to ...
	(regcache_invalidate_thread): ... this.
	(regcache_invalidate_one): New.
	(regcache_invalidate): Only invalidate registers of the current
	process.
	(init_register_cache): Add target_desc parameter, and use it.
	(new_register_cache): Ditto.  Assert the target description has a
	non zero registers_size.
	(regcache_cpy): Add assertions.  Adjust.
	(realloc_register_cache, set_register_cache): Delete.
	(registers_to_string, registers_from_string): Adjust.
	(find_register_by_name, find_regno, find_register_by_number)
	(register_cache_size): Add target_desc parameter, and use it.
	(free_register_cache_thread, free_register_cache_thread_one)
	(regcache_release, register_cache_size): New.
	(register_size): Add target_desc parameter, and use it.
	(register_data, supply_register, supply_register_zeroed)
	(supply_regblock, supply_register_by_name, collect_register)
	(collect_register_as_string, collect_register_by_name): Adjust.
	* regcache.h (struct target_desc): Forward declare.
	(struct regcache) <tdesc>: New field.
	(init_register_cache, new_register_cache): Add target_desc
	parameter.
	(regcache_invalidate_thread): Declare.
	(regcache_invalidate_one): Delete declaration.
	(regcache_release): Declare.
	(find_register_by_number, register_cache_size, register_size)
	(find_regno): Add target_desc parameter.
	(gdbserver_expedite_regs, gdbserver_xmltarget): Delete
	declarations.
	* remote-utils.c: Include tdesc.h.
	(outreg, prepare_resume_reply): Adjust.
	* server.c: Include tdesc.h.
	(gdbserver_xmltarget): Delete declaration.
	(get_features_xml, process_serial_event): Adjust.
	* server.h [IN_PROCESS_AGENT] (struct target_desc): Forward
	declare.
	(struct process_info) <tdesc>: New field.
	(ipa_tdesc): Declare.
	* tdesc.c: New file.
	* tdesc.h: New file.
	* tracepoint.c: Include tdesc.h.
	[IN_PROCESS_AGENT] (ipa_tdesc): Define.
	(get_context_regcache): Adjust to pass ipa_tdesc down.
	(do_action_at_tracepoint): Adjust to get the register cache size
	from the context regcache's description.
	(traceframe_walk_blocks): Adjust to get the register cache size
	from the current trace frame's description.
	(traceframe_get_pc): Adjust to get current trace frame's
	description and pass it down.
	(gdb_collect): Adjust to get the register cache size from the
	IPA's description.
	* linux-amd64-ipa.c (tdesc_amd64_linux): Declare.
	(gdbserver_xmltarget): Delete.
	(initialize_low_tracepoint): Set the ipa's target description.
	* linux-i386-ipa.c (tdesc_i386_linux): Declare.
	(initialize_low_tracepoint): Set the ipa's target description.
	* linux-x86-low.c: Include tdesc.h.
	[__x86_64__] (is_64bit_tdesc): New.
	(ps_get_thread_area, x86_get_thread_area): Use it.
	(i386_cannot_store_register): Rename to ...
	(x86_cannot_store_register): ... this.  Use is_64bit_tdesc.
	(i386_cannot_fetch_register): Rename to ...
	(x86_cannot_fetch_register): ... this.  Use is_64bit_tdesc.
	(x86_fill_gregset, x86_store_gregset): Adjust register_size calls
	to new interface.
	(target_regsets): Rename to ...
	(x86_regsets): ... this.
	(x86_get_pc, x86_set_pc): Adjust register_size calls to new
	interface.
	(x86_siginfo_fixup): Use is_64bit_tdesc.
	[__x86_64__] (tdesc_amd64_linux, tdesc_amd64_avx_linux)
	(tdesc_x32_avx_linux, tdesc_x32_linux)
	(tdesc_i386_linux, tdesc_i386_mmx_linux, tdesc_i386_avx_linux):
	Declare.
	(x86_linux_update_xmltarget): Delete.
	(I386_LINUX_XSAVE_XCR0_OFFSET): Define.
	(have_ptrace_getfpxregs, have_ptrace_getregset): New.
	(AMD64_LINUX_USER64_CS): New.
	(x86_linux_read_description): New, based on
	x86_linux_update_xmltarget.
	(same_process_callback): New.
	(x86_arch_setup_process_callback): New.
	(x86_linux_update_xmltarget): New.
	(x86_regsets_info): New.
	(amd64_linux_regs_info): New.
	(i386_linux_usrregs_info): New.
	(i386_linux_regs_info): New.
	(x86_linux_regs_info): New.
	(x86_arch_setup): Reimplement.
	(x86_install_fast_tracepoint_jump_pad): Use is_64bit_tdesc.
	(x86_emit_ops): Ditto.
	(the_low_target): Adjust.  Install x86_linux_regs_info,
	x86_cannot_fetch_register, and x86_cannot_store_register.
	(initialize_low_arch): New.
	* linux-ia64-low.c (tdesc_ia64): Declare.
	(ia64_fetch_register): Adjust.
	(ia64_usrregs_info, regs_info): New globals.
	(ia64_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-sparc-low.c (tdesc_sparc64): Declare.
	(sparc_fill_gregset_to_stack, sparc_store_gregset_from_stack):
	Adjust.
	(sparc_arch_setup): New function.
	(sparc_regsets_info, sparc_usrregs_info, regs_info): New globals.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-ppc-low.c (tdesc_powerpc_32l, tdesc_powerpc_altivec32l)
	(tdesc_powerpc_cell32l, tdesc_powerpc_vsx32l)
	(tdesc_powerpc_isa205_32l, tdesc_powerpc_isa205_altivec32l)
	(tdesc_powerpc_isa205_vsx32l, tdesc_powerpc_e500l)
	(tdesc_powerpc_64l, tdesc_powerpc_altivec64l)
	(tdesc_powerpc_cell64l, tdesc_powerpc_vsx64l)
	(tdesc_powerpc_isa205_64l, tdesc_powerpc_isa205_altivec64l)
	(tdesc_powerpc_isa205_vsx64l): Declare.
	(ppc_cannot_store_register, ppc_collect_ptrace_register)
	(ppc_supply_ptrace_register, parse_spufs_run, ppc_get_pc)
	(ppc_set_pc, ppc_get_hwcap): Adjust.
	(ppc_usrregs_info): Forward declare.
	(!__powerpc64__) ppc_regmap_adjusted: New global.
	(ppc_arch_setup): Adjust to the current process'es target
	description.
	(ppc_fill_vsxregset, ppc_store_vsxregset, ppc_fill_vrregset)
	(ppc_store_vrregset, ppc_fill_evrregset, ppc_store_evrregse)
	(ppc_store_evrregset): Adjust.
	(target_regsets): Rename to ...
	(ppc_regsets): ... this, and make static.
	(ppc_usrregs_info, ppc_regsets_info, regs_info): New globals.
	(ppc_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-s390-low.c (tdesc_s390_linux32, tdesc_s390_linux32v1)
	(tdesc_s390_linux32v2, tdesc_s390_linux64, tdesc_s390_linux64v1)
	(tdesc_s390_linux64v2, tdesc_s390x_linux64, tdesc_s390x_linux64v1)
	(tdesc_s390x_linux64v2): Declare.
	(s390_collect_ptrace_register, s390_supply_ptrace_register)
	(s390_fill_gregset, s390_store_last_break): Adjust.
	(target_regsets): Rename to ...
	(s390_regsets): ... this, and make static.
	(s390_get_pc, s390_set_pc): Adjust.
	(s390_get_hwcap): New target_desc parameter, and use it.
	[__s390x__] (have_hwcap_s390_high_gprs): New global.
	(s390_arch_setup): Adjust to set the current process'es target
	description.  Don't adjust the regmap.
	(s390_usrregs_info, s390_regsets_info, regs_info): New globals.
	[__s390x__] (s390_usrregs_info_3264, s390_regsets_info_3264)
	(regs_info_3264): New globals.
	(s390_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-mips-low.c (tdesc_mips_linux, tdesc_mips_dsp_linux)
	(tdesc_mips64_linux, tdesc_mips64_dsp_linux): Declare.
	[__mips64] (init_registers_mips_linux)
	(init_registers_mips_dsp_linux): Delete defines.
	[__mips64] (tdesc_mips_linux, tdesc_mips_dsp_linux): New defines.
	(have_dsp): New global.
	(mips_read_description): New, based on mips_arch_setup.
	(mips_arch_setup): Reimplement.
	(get_usrregs_info): New function.
	(mips_cannot_fetch_register, mips_cannot_store_register)
	(mips_get_pc, mips_set_pc, mips_fill_gregset, mips_store_gregset)
	(mips_fill_fpregset, mips_store_fpregset): Adjust.
	(target_regsets): Rename to ...
	(mips_regsets): ... this, and make static.
	(mips_regsets_info, mips_dsp_usrregs_info, mips_usrregs_info)
	(dsp_regs_info, regs_info): New globals.
	(mips_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-arm-low.c (tdesc_arm, tdesc_arm_with_iwmmxt)
	(tdesc_arm_with_vfpv2, tdesc_arm_with_vfpv3, tdesc_arm_with_neon):
	Declare.
	(arm_fill_vfpregset, arm_store_vfpregset): Adjust.
	(arm_read_description): New, with bits factored from
	arm_arch_setup.
	(arm_arch_setup): Reimplement.
	(target_regsets): Rename to ...
	(arm_regsets): ... this, and make static.
	(arm_regsets_info, arm_usrregs_info, regs_info): New globals.
	(arm_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-m68k-low.c (tdesc_m68k): Declare.
	(target_regsets): Rename to ...
	(m68k_regsets): ... this, and make static.
	(m68k_regsets_info, m68k_usrregs_info, regs_info): New globals.
	(m68k_regs_info): New function.
	(m68k_arch_setup): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-sh-low.c (tdesc_sharch): Declare.
	(target_regsets): Rename to ...
	(sh_regsets): ... this, and make static.
	(sh_regsets_info, sh_usrregs_info, regs_info): New globals.
	(sh_regs_info, sh_arch_setup): New functions.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-bfin-low.c (tdesc_bfin): Declare.
	(bfin_arch_setup): New function.
	(bfin_usrregs_info, regs_info): New globals.
	(bfin_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-cris-low.c (tdesc_cris): Declare.
	(cris_arch_setup): New function.
	(cris_usrregs_info, regs_info): New globals.
	(cris_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-cris-low.c (tdesc_crisv32): Declare.
	(cris_arch_setup): New function.
	(cris_regsets_info, cris_usrregs_info, regs_info): New globals.
	(cris_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-m32r-low.c (tdesc_m32r): Declare.
	(m32r_arch_setup): New function.
	(m32r_usrregs_info, regs_info): New globals.
	(m32r_regs_info): Adjust.
	(initialize_low_arch): New function.
	* linux-tic6x-low.c (tdesc_tic6x_c64xp_linux)
	(tdesc_tic6x_c64x_linux, tdesc_tic6x_c62x_linux): Declare.
	(tic6x_usrregs_info): Forward declare.
	(tic6x_read_description): New function, based on ...
	(tic6x_arch_setup): ... this.  Reimplement.
	(target_regsets): Rename to ...
	(tic6x_regsets): ... this, and make static.
	(tic6x_regsets_info, tic6x_usrregs_info, regs_info): New globals.
	(tic6x_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-xtensa-low.c (tdesc_xtensa): Declare.
	(xtensa_fill_gregset, xtensa_store_gregset): Adjust.
	(target_regsets): Rename to ...
	(xtensa_regsets): ... this, and make static.
	(xtensa_regsets_info, xtensa_usrregs_info, regs_info): New
	globals.
	(xtensa_arch_setup, xtensa_regs_info): New functions.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* linux-nios2-low.c (tdesc_nios2_linux): Declare.
	(nios2_arch_setup): Set the current process'es tdesc.
	(target_regsets): Rename to ...
	(nios2_regsets): ... this.
	(nios2_regsets_info, nios2_usrregs_info, regs_info): New globals.
	(nios2_regs_info): New function.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
        * linux-aarch64-low.c (tdesc_aarch64): Declare.
        (aarch64_arch_setup): Set the current process'es tdesc.
        (target_regsets): Rename to ...
        (aarch64_regsets): ... this.
        (aarch64_regsets_info, aarch64_usrregs_info, regs_info): New globals.
        (aarch64_regs_info): New function.
        (the_low_target): Adjust.
        (initialize_low_arch): New function.
	* linux-tile-low.c (tdesc_tilegx, tdesc_tilegx32): Declare
	globals.
	(target_regsets): Rename to ...
	(tile_regsets): ... this.
	(tile_regsets_info, tile_usrregs_info, regs_info): New globals.
	(tile_regs_info): New function.
	(tile_arch_setup): Set the current process'es tdesc.
	(the_low_target): Adjust.
	(initialize_low_arch): New function.
	* spu-low.c (tdesc_spu): Declare.
	(spu_create_inferior, spu_attach): Set the new process'es tdesc.
	* win32-arm-low.c (tdesc_arm): Declare.
	(arm_arch_setup): New function.
	(the_low_target): Install arm_arch_setup instead of
	init_registers_arm.
	* win32-i386-low.c (tdesc_i386, tdesc_amd64): Declare.
	(init_windows_x86): Rename to ...
	(i386_arch_setup): ... this.  Set `win32_tdesc'.
	(the_low_target): Adjust.
	* win32-low.c (win32_tdesc): New global.
	(child_add_thread): Don't create the thread cache here.
	(do_initial_child_stuff): Set the new process'es tdesc.
	* win32-low.h (struct target_desc): Forward declare.
	(win32_tdesc): Declare.
	* lynx-i386-low.c (tdesc_i386): Declare global.
	(lynx_i386_arch_setup): Set `lynx_tdesc'.
	* lynx-low.c (lynx_tdesc): New global.
	(lynx_add_process): Set the new process'es tdesc.
	* lynx-low.h (struct target_desc): Forward declare.
	(lynx_tdesc): Declare global.
	* lynx-ppc-low.c (tdesc_powerpc_32): Declare global.
	(lynx_ppc_arch_setup): Set `lynx_tdesc'.
	* nto-low.c (nto_tdesc): New global.
	(do_attach): Set the new process'es tdesc.
	* nto-low.h (struct target_desc): Forward declare.
	(nto_tdesc): Declare.
	* nto-x86-low.c (tdesc_i386): Declare.
	(nto_x86_arch_setup): Set `nto_tdesc'.

gdb/
2013-06-07  Pedro Alves  <palves@redhat.com>

	* regformats/regdat.sh: Output #include tdesc.h.  Make globals
	static.  Output a global target description pointer.
	(init_registers_${name}): Adjust to initialize a
	target description structure.
2013-06-07 10:46:59 +00:00
Will Newton 88ab56844a gdb/testsuite/gdb.base/long_long.exp: Fix ARM EABI target
glob.

The current glob missed gnueabihf targets. Expand to catch these
cases and fix the test failure on those systems.

gdb/testsuite/ChangeLog:

2013-06-07  Will Newton  <will.newton@linaro.org>

	* gdb.base/long_long.exp: Fix ARM EABI target glob.
2013-06-07 08:53:32 +00:00
Will Newton 42daa7a046 gdb/testsuite/gdb.cp/annota2.exp: Add missing empty line
in output.

There should be an empty line between "post-prompt" and "starting".
This fixes a testsuite failure on ARM.

gdb/testsuite/ChangeLog:

2013-06-07  Will Newton  <will.newton@linaro.org>

	* gdb.cp/annota2.exp: Add empty line between "post-prompt"
	and "starting".
2013-06-07 08:51:42 +00:00
Will Newton f4059ef3de gdb/testsuite/gdb.cp: Fix tests for ARM C++ ABI.
The ARM C++ ABI defines constructors and destructors to return
pointers to this. The C++ tests that check the types of constructors
and destructors expect a return type of void. Conditionalize these
tests so they pass on ARM.

gdb/testsuite/ChangeLog:

2013-06-07  Will Newton  <will.newton@linaro.org>

	* gdb.cp/anon-struct.exp: Conditionalize constructor and
	destructor prototypes for ARM ABI.
	* gdb.cp/m-static.exp: Likewise.
2013-06-07 08:47:09 +00:00
Will Newton fe8400b438 gdb/printcmd.c: Fix printing of Thumb minimal symbols.
In build_address_symbolic we call gdbarch_addr_bits_remove for
symbols in the symbol table but not for minimal symbols. This
causes a failure in gdb.cp/virtfunc.exp on ARM, as the address
of the virtual thunk is given an offset of 1 when in Thumb mode.

gdb/ChangeLog:

2013-06-07  Will Newton  <will.newton@linaro.org>

	* printcmd.c (build_address_symbolic): Call
	gdbarch_addr_bits_remove for text minimal symbols.
2013-06-07 07:49:10 +00:00
Will Newton 20df6206ba gdb/MAINTAINERS: Add myself to Write After Approval.
gdb/ChangeLog:

2013-06-07  Will Newton  <will.newton@linaro.org>

	* MAINTAINERS: Add myself to Write After Approval.
2013-06-07 07:44:20 +00:00
Yao Qi 7c57fa1e85 gdb/doc/
* gdb.texinfo (Symbols): Add kindex and cindex for
	'maint print msymbols'.
2013-06-07 00:33:25 +00:00
Yao Qi 8cb5cc78eb gdb/testsuite/
* gdb.trace/mi-trace-unavailable.exp: New.
	* gdb.trace/trace-unavailable.c: New.
2013-06-07 00:29:19 +00:00
Yao Qi aef525cb15 gdb/
* tracepoint.c (start_tracing): Move code to ...
	(trace_reset_local_state): ... here.  New.
	(disconnect_tracing): Don't call set_current_traceframe,
	set_tracepoint_num, and set_traceframe_context. Call
	trace_reset_local_state instead.
	(tfile_close): Call trace_reset_local_state.
	* ctf.c (ctf_close): Likewise.
	* remote.c (remote_close): Likewise.
	* tracepoint.h (trace_reset_local_state): Declare.
2013-06-07 00:19:36 +00:00
gdbadmin e808d707b4 *** empty log message *** 2013-06-07 00:00:03 +00:00
Doug Evans d2415c6cf4 * dwarf2read.c: Whitespace fixes for DWP file format documentation,
and fix header docs.
2013-06-06 23:51:09 +00:00
Doug Evans c6cf1712fb * gdb.cp/derivation.exp: Make tests have unique names. 2013-06-06 19:02:27 +00:00
Tom Tromey bf6be0f482 * gdb.base/dump.exp (capture_value): Don't put expression into
test name if arguments passed in.
	Rename a couple more tests to make them unique.
2013-06-06 19:00:13 +00:00
Doug Evans ac44adcb6a Add PR number to this entry:
PR server/15594
	* linux-x86-low.c (ps_get_thread_area): Properly extend address to
	64 bits in 64-cross-32 environment.
2013-06-06 18:02:48 +00:00
Tom Tromey ebb022fab5 * gdb.base/break-always.exp: Explicitly specify test name. 2013-06-06 15:50:37 +00:00
Gary Benson 8445cbf1cf Add missing PR to ChangeLog entry 2013-06-06 08:50:08 +00:00
Joel Brobecker 0059c61a29 Replace "(tiny patch)" by "(tiny change)" in gdb ChangeLogs...
... as this is the wording recommended by the FSF via the manual
for Maintainers of GNU software.
2013-06-06 05:16:06 +00:00
Joel Brobecker 63be840272 Annotate last gdb.texinfo patch as accepted as a "tiny patch"
(copyright assignment not needed because patch is small enough to
not be legally significant).
2013-06-06 05:10:20 +00:00
gdbadmin b997f18b20 *** empty log message *** 2013-06-06 00:00:02 +00:00
Doug Evans 69fc87c263 PR 15519
* cp-namespace.c (find_symbol_in_baseclass): Call
	cp_lookup_symbol_in_namespace instead of cp_lookup_symbol_namespace.
	Check result of call to lookup_symbol_static.
	Call lookup_static_symbol_aux unconditionally.
	Call check_typedef on base types before accessing them.
	(cp_lookup_nested_symbol): Fix comment.

	testsuite/
	* gdb.cp/derivation2.cc: New file.
	* gdb.cp/derivation.cc (main): Call foo2.
	* gdb.cp/derivation.exp: Add tests for typedefs in another
	file, and when there's an active block.
2013-06-05 22:28:51 +00:00
Luis Machado a513d1e8c0 * gnu-v3-abi.c (gnuv3_skip_trampoline): Handle thunk
minimal symbols pointing to function descriptors.
2013-06-05 20:43:53 +00:00
Luis Machado f993f39ec9 * gdb.cp/virtfunc.exp (make_one_vtable_result): Handle extra output
from targets that use function descriptors in the virtual tables.
	Handle presence of dot symbols.
2013-06-05 20:38:37 +00:00
Tom Tromey 351a6f0219 * python/py-utils.c (gdb_pymodule_addobject): Cast away const. 2013-06-05 17:32:51 +00:00
Marc Khouzam b77420921a 2013-06-05 Simon Marchi <simon.marchi@ericsson.com>
* gdb.texinfo (Miscellaneous gdb/mi Commands): Fix -add-inferior
	response field name (thread-group to inferior).
2013-06-05 14:11:47 +00:00
gdbadmin 256b85c25e *** empty log message *** 2013-06-05 00:00:33 +00:00
Sergio Durigan Junior c7c0b644b4 Fixing ChangeLog entry of the last commit. 2013-06-04 15:13:33 +00:00
Sergio Durigan Junior 5e1b953b8c GDB was not restoring the signal handler before returning when a notification
was received.  This patch fixes it.

2013-06-04  Sergio Durigan Junior  <sergiodj@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	* remote.c (remote_wait_as): Restore signal handler before returning
	when GDB gets a notification.
2013-06-04 15:12:52 +00:00
Gary Benson afacd7f34a 2013-06-04 Gary Benson <gbenson@redhat.com>
* gdb.base/break-probes.exp: New file.
	* gdb.base/break-probes.c: Likewise.
	* gdb.base/break-probes-solib.c: Likewise.
	* gdb.base/info-shared.exp: New file.
	* gdb.base/info-shared.c: Likewise.
	* gdb.base/info-shared-solib1.c: Likewise.
	* gdb.base/info-shared-solib2.c: Likewise.
2013-06-04 13:31:00 +00:00
Gary Benson a29a3fb7a3 2013-06-04 Jan Kratochvil <jan.kratochvil@redhat.com>
Gary Benson  <gbenson@redhat.com>

	* lib/gdb.exp (build_executable_from_specs): Use gdb_compile_pthread,
	gdb_compile_shlib or gdb_compile_shlib_pthreads where appropriate.
	* lib/prelink-support.exp (build_executable_own_libs): Allow INTERP
	to be set to "no" to indicate that no ld.so copy should be made.
	* gdb.base/break-interp.exp (solib_bp): New constant.
	(reach_1): Use the above instead of "_dl_debug_state".
	(test_attach): Likewise.
	(test_ld): Likewise.
	* gdb.threads/dlopen-libpthread.exp: New file.
	* gdb.threads/dlopen-libpthread.c: Likewise.
	* gdb.threads/dlopen-libpthread-lib.c: Likewise.
	* gdb.base/solib-corrupted.exp: Disable test if GDB is using probes.
2013-06-04 13:23:32 +00:00
Gary Benson f9e148520a 2013-06-04 Gary Benson <gbenson@redhat.com>
* breakpoint.h (handle_solib_event): Moved function declaration
	to solib.h.
	* breakpoint.c (handle_solib_event): Moved function to solib.c.
	(bpstat_stop_status): Pass new argument to handle_solib_event.
	* solib.h (update_solib_breakpoints): New function declaration.
	(handle_solib_event): Moved function declaration from
	breakpoint.h.
	* solib.c (update_solib_breakpoints): New function.
	(handle_solib_event): Moved function from breakpoint.c.
	Updated to call solib_ops->handle_event if not NULL.
	* solist.h (target_so_ops): New fields "update_breakpoints" and
	"handle_event".
	* infrun.c (set_stop_on_solib_events): New function.
	(_initialize_infrun): Use the above for "set
	stop-on-solib-events".
	(handle_inferior_event): Pass new argument to handle_solib_event.
	* solib-svr4.c (probe.h): New include.
	(svr4_free_library_list): New forward declaration.
	(probe_action): New enum.
	(probe_info): New struct.
	(probe_info): New static variable.
	(NUM_PROBES): New definition.
	(svr4_info): New fields "using_xfer", "probes_table" and
	"solib_list".
	(free_probes_table): New function.
	(free_solib_list): New function.
	(svr4_pspace_data_cleanup): Free probes table and solib list.
	(svr4_copy_library_list): New function.
	(svr4_current_sos_via_xfer_libraries): New parameter "annex".
	(svr4_read_so_list): New parameter "prev_lm".
	(svr4_current_sos_direct): Renamed from "svr4_current_sos".
	(svr4_current_sos): New function.
	(probe_and_action): New struct.
	(hash_probe_and_action): New function.
	(equal_probe_and_action): Likewise.
	(register_solib_event_probe): Likewise.
	(solib_event_probe_at): Likewise.
	(solib_event_probe_action): Likewise.
	(solist_update_full): Likewise.
	(solist_update_incremental): Likewise.
	(disable_probes_interface_cleanup): Likewise.
	(svr4_handle_solib_event): Likewise.
	(svr4_update_solib_event_breakpoint): Likewise.
	(svr4_update_solib_event_breakpoints): Likewise.
	(svr4_create_solib_event_breakpoints): Likewise.
	(enable_break): Free probes table before creating breakpoints.
	Use svr4_create_solib_event_breakpoints to create breakpoints.
	(svr4_solib_create_inferior_hook): Free the solib list.
	(_initialize_svr4_solib): Initialise
	svr4_so_ops.handle_solib_event and svr4_so_ops.update_breakpoints.
2013-06-04 13:17:06 +00:00
Gary Benson ced63ec087 2013-06-04 Gary Benson <gbenson@redhat.com>
* target.h (target_ops): New field
	"to_augmented_libraries_svr4_read".
	(target_augmented_libraries_svr4_read): New macro.
	* target.c (update_current_target): Handle
	to_augmented_libraries_svr4_read.
	* remote.c (remote_state): New field
	"augmented_libraries_svr4_read".
	(remote_augmented_libraries_svr4_read_feature): New function.
	(remote_protocol_features): Add entry for
	"augmented-libraries-svr4-read".
	(remote_augmented_libraries_svr4_read): New function.
	(init_remote_ops): Initialize
	remote_ops.to_augmented_libraries_svr4_read.
2013-06-04 13:10:53 +00:00
Gary Benson 85dc5a128b 2013-06-04 Gary Benson <gbenson@redhat.com>
* gdb.texinfo (General Query Packets/qSupported): Added
	"qXfer:libraries-svr4:read" and "augmented-libraries-svr4-read".
	to the table of currently defined stub features.
	Added a more detailed entry for "augmented-libraries-svr4-read".
	(General Query Packets/qXfer:libraries-svr4:read): Documented
	the augmented form of this packet.
2013-06-04 13:07:45 +00:00
Gary Benson 7f91dbec54 2013-06-04 Gary Benson <gbenson@redhat.com>
* NEWS: Update.
2013-06-04 13:02:15 +00:00
Gary Benson b1fbec6251 2013-06-04 Gary Benson <gbenson@redhat.com>
* server.c (handle_query): Add "augmented-libraries-svr4-read+"
	to qSupported response when appropriate.
	(handle_qxfer_libraries_svr4): Allow qXfer:libraries-svr4:read
	with nonzero-length annex.
	* linux-low.c (linux_qxfer_libraries_svr4): Parse and handle
	arguments supplied in annex.
2013-06-04 12:59:21 +00:00
Gary Benson 607ece04f4 2013-06-04 Gary Benson <gbenson@redhat.com>
* objfiles.h (inhibit_section_map_updates): New function
	declaration.
	(resume_section_map_updates): Likewise.
	(resume_section_map_updates_cleanup): Likewise.
	* objfiles.c (objfile_pspace_info): Removed field
	"objfiles_changed_p".  New fields "new_objfiles_available",
	"section_map_dirty" and "inhibit_updates".
	(allocate_objfile): Set new_objfiles_available.
	(free_objfile): Set section_map_dirty.
	(objfile_relocate1): Likewise.
	(in_plt_section): Likewise.
	(find_pc_section): Update the conditions under which the
	section map will be updated.
	(inhibit_section_map_updates): New function.
	(resume_section_map_updates): Likewise.
	(resume_section_map_updates_cleanup): Likewise.
2013-06-04 12:53:34 +00:00
Gary Benson 9ee6a5acd5 2013-06-04 Gary Benson <gbenson@redhat.com>
* probe.h (get_probe_argument_count): New declaration.
	(evaluate_probe_argument): Likewise.
	* probe.c (get_probe_argument_count): New function.
	(evaluate_probe_argument): Likewise.
	(probe_safe_evaluate_at_pc): Use the above new functions.
2013-06-04 12:50:21 +00:00
Alan Modra 845d47080b * ppc-tdep.h (ppc_insns_match_pattern): Update prototype.
* rs6000-tdep.c (read_insn): Add frame param, don't assume big-endian.
	(ppc_insns_match_pattern): Add frame param.  Avoid multiple
	target mem reads on optional insns.
	* ppc-linux-tdep.c (ppc_skip_trampoline_code): Update
	ppc_insns_match_pattern calls.
	* ppc64-tdep.c (ppc64_standard_linkage2, ppc64_standard_linkage3):
	Add match for power7 thread safety insns, and new order of
	std 2,40(1) insn.  Correct code shown for _dl_runtime_resolve
	invocation in comment, and update rest of comment.
	(PPC64_STANDARD_LINKAGE1_LEN, PPC64_STANDARD_LINKAGE2_LEN,
	PPC64_STANDARD_LINKAGE3_LEN): Delete.
	(ppc64_standard_linkage2_target): Update insn offsets.
	(ppc64_skip_trampoline_code): Use a single insn buffer.  Match newer
	stubs first.  Update calls.
2013-06-04 02:44:35 +00:00
Yao Qi 404e278f8d gdb/
* solib.c (solib_find): Don't need dir separator if path has
	drive spec.
2013-06-04 01:33:31 +00:00
gdbadmin 0e8faa7b6e *** empty log message *** 2013-06-04 00:00:32 +00:00
Joel Brobecker f6aea118f8 Revert "fix cleanup handling in macho_symfile_read"
This patch indirectly causes a SEGV by creating a dangling pointer.
Reverting this patch while working on a clearer memory management
method for this part of the code.

gdb/Changelog:

        Revert:
        * machoread.c (macho_symfile_read): Assign first cleanup to
        'back_to'.
2013-06-03 13:22:29 +00:00
Yao Qi 87967e273f gdb/
* mi/mi-cmd-var.c (mi_no_values, mi_simple_values): Move to
	mi-parse.c.  Make them static.
	(mi_all_values): Likewise.
	(mi_parse_values_option): Move to mi-parse.c.  Rename it to
	mi_parse_print_values.  Make it external.
	* mi/mi-cmds.h (mi_no_values, mi_simple_values, mi_all_values):
	Remove the declarations.
	* mi/mi-parse.c (mi_parse_print_values): Moved from mi-cmd-var.c.
	* mi/mi-parse.h (mi_parse_print_values): Declare.
	* mi/mi-cmd-stack.c: Include mi-parse.h.
	(parse_print_values): Remove
	(mi_cmd_stack_list_locals): Call mi_parse_print_values instead
	of parse_print_values.
	(mi_cmd_stack_list_args, mi_cmd_stack_list_variables): Likewise.
2013-06-03 03:16:24 +00:00
gdbadmin 2590d1455c *** empty log message *** 2013-06-03 00:00:03 +00:00
gdbadmin e55608f4cc *** empty log message *** 2013-06-02 00:00:32 +00:00
gdbadmin bb8779ef82 *** empty log message *** 2013-06-01 00:00:02 +00:00
Doug Evans d1ec4ce7c9 * linux-x86-low.c (ps_get_thread_area): Properly extend address to
64 bits in 64-cross-32 environment.
2013-05-31 19:14:33 +00:00
Yao Qi 3ca73e0c7d gdb/
* tracepoint.c (all_tracepoint_actions_and_cleanup): Declare.
	(encode_actions): Move code to ...
	(all_tracepoint_actions_and_cleanup): ... here.  New.
	(trace_dump_command): Likewise.
2013-05-31 10:06:02 +00:00
gdbadmin e8de40a833 *** empty log message *** 2013-05-31 00:00:32 +00:00
Tom Tromey 4e993a190a maintenance_expand_symtabs leaks a cleanup
It turns out that maintenance_expand_symtabs was missing a call to
do_cleanups.  I found this using the cleanup checker.

	* symmisc.c (maintenance_expand_symtabs): Call do_cleanups.
2013-05-30 17:44:54 +00:00
Tom Tromey e3b76b4f44 fix up xml-support.c
xml-support.c has a function that returns a cleanup via an out parameter.

This changes this function to be a normal cleanup constructor --
returning the cleanup directly and returning the other result via an
out parameter.

This is sort of a hack, but it lets the checker work here.

I also noticed that gdb_xml_create_parser_and_cleanup does not need to
be exported any more.

	* xml-support.c (gdb_xml_create_parser_and_cleanup): Rename from
	gdb_xml_create_parser_and_cleanup_1.  Return a cleanup.  Remove
	'old_chain' argument.  Add 'parser_result' argument.
	(gdb_xml_create_parser_and_cleanup): Remove old version.
	(gdb_xml_parse_quick): Update.
	(xml_process_xincludes): Update.
	* xml-support.h (gdb_xml_create_parser_and_cleanup): Don't
	declare.
2013-05-30 17:41:38 +00:00
Tom Tromey db26349c64 fix compile_rx_or_error
compile_rx_or_error looks like a constructor, but it can return NULL.
This patch changes it to remove the NULL return, making it work
like any other cleanup constructor.

This is a stylistic patch but I think it is also better for code to
follow the normal conventions.

	* probe.c (collect_probes): Check arguments for NULL before
	calling compile_rx_or_error.
	* utils.c (compile_rx_or_error): Require 'rx' to be non-NULL.
	Remove NULL return.
2013-05-30 17:39:34 +00:00
Tom Tromey 77f9e71302 some fixes to infrun.c
This fixes some of the problems in infrun.c that the checker reported.
I filed the remaining problems as bugs.

This patch is purely stylistic.

	* infrun.c (adjust_pc_after_break): Introduce an outer null
	cleanup.
2013-05-30 17:37:50 +00:00
Tom Tromey 45475de718 fix mi-cmd-var.c
This is a stylistic change in mi-cmd-var.c that adds outer cleanups
where needed by the checker.

	* mi/mi-cmd-var.c (varobj_update_one): Add an outer null cleanup.
2013-05-30 17:37:12 +00:00
Tom Tromey ac5007fd4e fix cli-script.c
read_command_lines_1 had some (IMNSHO) spaghetti-ish code for cleanup
handling.  This makes the code much simpler to understand, by
introducing an outer cleanup.

This is another case where a stylistic change for the checker is also
nice for the reader.

	* cli/cli-script.c (read_command_lines_1): Use a null cleanup
	for 'old_chain'.  Do not check 'head' before processing
	cleanups.
2013-05-30 17:36:29 +00:00
Tom Tromey cd82eddcf1 fix mi-cmd-stack.c
mi-cmd-stack.d had a conditional cleanup, "cleanup_tuple" that
confused the checker.  However, there was no need for this, since it
was only used via do_cleanups at the end of the function, just before
another call to do_cleanups.

So, while this is a stylistic patch for the checker, I also consider
it a generic improvement for readers of the code.

	* mi/mi-cmd-stack.c (list_arg_or_local): Remove
	"cleanup_tuple".
2013-05-30 17:35:40 +00:00
Tom Tromey 57cee33aee fix dbxread.c
This is a stylistic change to make some code in dbxread.c analyzable
by the checker.

	* dbxread.c (dbx_read_symtab): Declare 'back_to' in a more
	inner scope.  Unconditionally call do_cleanups.
2013-05-30 17:34:18 +00:00
Tom Tromey 795d915c9b fix source.c
find_and_open_source can leak a cleanup.

	* source.c (find_and_open_source): Call do_cleanups.
2013-05-30 17:33:41 +00:00
Tom Tromey 1fc3cf4a5a fix linux-thread-db.c
This is a stylistic change to make it so the checker can analyze a
function in linux-thread-db.c.

	* linux-thread-db.c (thread_db_load_search): Unconditionally
	call do_cleanups.
2013-05-30 17:31:48 +00:00
Tom Tromey e35ac9bf5c fix in solib-aix.c
solib_aix_bfd_open has an early "return" that doesn't run cleanups.
This fixes the problem by dropping the null_cleanup and using a later
cleanup as the master cleanup for the function.

	* solib-aix.c (solib_aix_bfd_open): Don't use a null cleanup
	for 'cleanup'; instead use a later one.
2013-05-30 17:31:00 +00:00
Tom Tromey f330038710 use explicit returns to avoid checker confusion
The checker does not understand the idiom

if (except.reason < 0) {
   do_cleanups (whatever);
   GDB_PY_HANDLE_EXCEPTION (except);
}

because it doesn't realize that the nested 'if' actually has the same
condition.

This fixes instances of this to be more explicit.

	* python/py-breakpoint.c (bppy_get_commands): Use
	explicit, unconditional return.
	* python/py-frame.c (frapy_read_var): Likewise.
	* python/python.c (gdbpy_decode_line): Likewise.
2013-05-30 17:30:03 +00:00
Tom Tromey c27e16e3f1 fix cp-namespace.c
cp_lookup_symbol_imports_or_template could return without
running cleanups.

	* cp-namespace.c (cp_lookup_symbol_imports_or_template): Call
	do_cleanups on all return paths.
2013-05-30 17:29:06 +00:00
Tom Tromey 5ae85e4448 fix top.c
execute_command can leak a cleanup along one return path.

	* top.c (execute_command): Discard 'cleanup_if_error' cleanups.
2013-05-30 17:27:44 +00:00
Tom Tromey 73b8d9dab1 fix one bug in stabsread.c
Some code in stabsread.c can return without running cleanups.

	* stabsread.c (read_struct_type): Call do_cleanups along
	all return paths.
2013-05-30 17:25:15 +00:00
Maciej W. Rozycki 7d26658403 * mips-linux-tdep.c: Adjust formatting throughout. 2013-05-30 17:23:05 +00:00
Tom Tromey 0f900f54b5 fix mipsread.c
Some code in mipsread.c could leak cleanups along some return paths.

	* mipsread.c (read_alphacoff_dynamic_symtab): Call do_cleanups
	along all return paths.
2013-05-30 17:21:51 +00:00
Tom Tromey a991ac289d fix one bug in symfile.c
find_separate_debug_file could leak a cleanup along some return paths.

	* symfile.c (find_separate_debug_file): Call do_cleanups
	along all return paths.
2013-05-30 17:21:15 +00:00
Tom Tromey 1abaf0423f fix symtab.c
search_symbols had some bad code resulting in a cleanup being both
discarded and run.

	* symtab.c (search_symbols): Introduce a null cleanup for
	'retval_chain'.
2013-05-30 17:20:02 +00:00
Tom Tromey edefe1dab2 fix py-value.c
Some code in py-value.c could exit a loop without running some
cleanups made in the loop.

	* python/py-value.c (valpy_binop): Call do_cleanups before
	exiting loop.
2013-05-30 17:18:54 +00:00
Tom Tromey 54f72dcc36 fix py-prettyprint.c
print_children, in py-prettyprint.c, could call do_cleanups twice on
the same cleanup.

	* python/py-prettyprint.c (print_children): Remove extra
	do_cleanups call.
2013-05-30 17:17:25 +00:00
Tom Tromey af1c697129 fix py-frame.c
A couple return paths in frapy_read_var were missing do_cleanups calls.

	* python/py-frame.c (frapy_read_var): Call do_cleanups along
	all return paths.
2013-05-30 17:16:05 +00:00
Tom Tromey b862ce75d2 fix py-breakpoint.c
One return path in bppy_get_commands was missing a do_cleanups call.

	* python/py-breakpoint.c (bppy_get_commands): Call do_cleanups
	along all return paths.
2013-05-30 17:14:35 +00:00
Tom Tromey e12fefc804 simplify cli-logging.c for analysis
This is another stylistic patch.  It changes cli-logging.c to be
analyzable by the checker, again following the method of adding an
outer cleanup and unconditionally calling do_cleanups.

	* cli/cli-logging.c (set_logging_redirect): Unconditionally
	call do_cleanups.
2013-05-30 17:13:19 +00:00
Tom Tromey 4867f990df fix varobj.c
c_value_of_root is missing a call to do_cleanups at one return.
This fixes the problem by removing that return and letting control
fall through.

	* varobj.c (c_value_of_root): Call do_cleanups along all
	return paths.
2013-05-30 17:11:38 +00:00
Tom Tromey 4fd2d6afa0 make a cleanup unconditionally in tracepoint.c
This is another cosmetic patch.  It introduces an "outer" cleanup in
trace_dump_command and arranges to unconditionally call do_cleanups.
This lets the checker analyze the function.

	* tracepoint.c (trace_dump_command): Unconditionally call
	do_cleanups.
2013-05-30 17:10:41 +00:00
Tom Tromey 752eb8b456 fix two buglets in breakpoint.c
First, output_thread_groups leaks a cleanup along one return path.

Second, parse_cmd_to_aexpr could return without running its cleanups,
if there was an exception in a TRY_CATCH.

	* breakpoint.c (output_thread_groups, parse_cmd_to_aexpr): Call
	do_cleanups earlier.
2013-05-30 17:09:02 +00:00
Tom Tromey e42d0aa5ba fix cleanup handling in macho_symfile_read
macho_symfile_read leaks a cleanup by assigning to 'back_to' too late.

	* machoread.c (macho_symfile_read): Assign first cleanup to
	'back_to'.
2013-05-30 17:06:31 +00:00
Tom Tromey 4bbc010a2d fix cleanup handling in m32r_load
m32r_load is missing a call to do_cleanups along one return path.

	* m32r-rom.c (m32r_load): Call do_cleanups at all returns.
2013-05-30 17:05:32 +00:00
Tom Tromey b963592585 fix list_available_thread_groups
list_available_thread_groups, in mi-main.c, leaks a cleanup.
This changes it to call do_cleanups.

	* mi/mi-main.c (list_available_thread_groups): Call do_cleanups.
2013-05-30 17:04:47 +00:00
Tom Tromey 25f4350049 cleanup fixes for inf-ptrace.c
This is one of the stylistic patches.  The code here in inf-ptrace.c
is not incorrect, but it is in a style that the cleanup checker cannot
handle.  This patch changes it to a simpler style, following the usual
method of introducing an unconditional "outer" cleanup.

	* inf-ptrace.c (inf_ptrace_create_inferior): Unconditionally
	call discard_cleanups.
	(inf_ptrace_attach): Likewise.
2013-05-30 17:04:03 +00:00
Tom Tromey d6a2e54a5d cleanup fixes for remote-mips.c
remote-mips.c has a few 'return's where cleanups are not run.

	* remote-mips.c (mips_exit_debug): Call do_cleanups on all
	return paths.
	(mips_initialize): Likewise.
	(common_open): Call do_cleanups.
2013-05-30 17:03:00 +00:00
Tom Tromey 48be7c1b92 fix up cleanup handling in internal_vproblem
internal_vproblem can return, so this introduces proper cleanup
handling there.  Otherwise it may make a cleanup that is leaked.

	* utils.c (internal_vproblem): Call do_cleanups.
2013-05-30 17:01:16 +00:00
Tom Tromey e61727abf0 fix linespec bug noticed by the checker
This fixes a linespec bug noticed by the cleanup checker.

find_linespec_symbols did this:

  cleanup = demangle_for_lookup (name, state->language->la_language,
				 &lookup_name);
[...]
      cleanup = make_cleanup (xfree, canon);

But this is wrong, as it makes a subsequent call to do_cleanups not
clean up all the local state.

	* linespec.c (find_linespec_symbols): Don't reassign to 'cleanup'.
2013-05-30 16:57:38 +00:00
Tom Tromey b81b921f79 remove erroneous return from setup_user_args
This fixes setup_user_args to drop a useless and confusing "return".

	* cli/cli-script.c (setup_user_args): Don't return after error.
2013-05-30 16:31:33 +00:00
Tom Tromey fe48dfb1ce fix cleanups in som_symtab_read
This fixes som_symtab_read not to leak cleanups.

	* somread.c (som_symtab_read): Call do_cleanups.
2013-05-30 16:28:29 +00:00
Tom Tromey 27833de78f fix print_command_1
This is a stylistic patch to make it so the checker can analyze
print_command_1.  This amounts to installing an outer cleanup and
unconditionally invoking it.

	* printcmd.c (print_command_1): Unconditionally call do_cleanups.
2013-05-30 16:25:49 +00:00
Tom Tromey 5b3fca71ae some cleanup checker fixes
Fix some bugs pointed out by the cleanup checker.  This one just fixes
some simple CLI reports, where CLI commands know that their caller
will do cleanups.  This an older style with few instances, so it is
simpler to fix them up than to teach the checker about it.

	* cli/cli-cmds.c (cd_command, alias_command): Call do_cleanups.
	* cli/cli-dump.c (restore_binary_file): Call do_cleanups.
	* interps.c (interpreter_exec_cmd): Call do_cleanups.
	* source.c (show_substitute_path_command): Call do_cleanups.
	(unset_substitute_path_command, set_substitute_path_command):
	Likewise.
	* symfile.c (load_command): Call do_cleanups.
2013-05-30 16:24:36 +00:00
Tom Tromey af83e3f886 add the cleanup checker
This patch adds the cleanup checker.  This is a Python plugin for GCC
that checks some rules for cleanup handling.  In particular it tries
to notice when cleanups are left dangling at the end of a function.

It does this by applying a few simple rules.

First, it understands that a function whose return type is "struct
cleanup *" is a "cleanup constructor".  Such functions are expected to
return the first cleanup that they make.

Then, it has the notion of a "master cleanup".  The checker keeps a
stack of all cleanups made in a basic block.  The first element is
pushed on the stack is the master cleanup -- the one that must later
be passed to either do_cleanups or discard_cleanups.

It is not perfect -- some constructs confuse it.  So, part of this
series rewrites some code in gdb so that it is analyzable.  I'll note
these spots and you can decide whether or not this is a good idea.

This patch also changes gcc-with-excheck to give it options.  Now you
must use either -Xc (for the cleanup checker) or -Xx (for the
exception checker).

	* contrib/cleanup_check.py: New file.
	* contrib/gcc-with-excheck: Add option parsing.
2013-05-30 16:22:06 +00:00
Joel Brobecker 564eac4292 windows_delete_thread: Add missing space in cast expression
gdb/ChangeLog:

	* windows-nat.c (windows_delete_thread): Add missing space
	in cast expression.
2013-05-30 13:52:31 +00:00
Hafiz Abid Qadeer 4790207643 2013-05-30 Hafiz Abid Qadeer <abidh@codesourcery.com>
* inferior.c (top level): Include tilde.h.
	(add_inferior_command): Call tilde_expand on the value of 'exec'
	argument.
2013-05-30 12:54:17 +00:00
Yao Qi 23da373ae1 gdb/
* tracepoint.c (encode_actions_1): Remove parameter 't'.
	Caller update.
	(encode_actions): Likewise.
	* remote.c (remote_download_tracepoint): Caller update.
	* tracepoint.h (encode_actions): Update declaration.
2013-05-30 09:29:18 +00:00
Pedro Alves a6e6f79133 Fix build breakage with Python 2.4.
With Python 2.4, we see this build failure:

./python/python-internal.h: In function 'gdb_Py_DECREF':
./python/python-internal.h:179: warning: dereferencing 'void *' pointer
./python/python-internal.h:179: error: request for member 'ob_refcnt' in something not a structure or union

Python 2.4 forgets to cast 'op' to PyObject pointer on the ob_refcnt
accesses:

  #define Py_DECREF(op)                                   \
          if (_Py_DEC_REFTOTAL  _Py_REF_DEBUG_COMMA       \
              --(op)->ob_refcnt != 0)                     \
                  _Py_CHECK_REFCNT(op)                    \
          else                                            \
                  _Py_Dealloc((PyObject *)(op))

...

  #define _Py_CHECK_REFCNT(OP)                                    \
  {       if ((OP)->ob_refcnt < 0)                                \
                  _Py_NegativeRefcount(__FILE__, __LINE__,        \
                                       (PyObject *)(OP));         \
  }

Python 2.7:

  #define Py_DECREF(op)                                   \
      do {                                                \
          if (_Py_DEC_REFTOTAL  _Py_REF_DEBUG_COMMA       \
          --((PyObject*)(op))->ob_refcnt != 0)            \
              _Py_CHECK_REFCNT(op)                        \
          else                                            \
          _Py_Dealloc((PyObject *)(op));                  \
      } while (0)

...

  #define _Py_CHECK_REFCNT(OP)                                    \
  {       if (((PyObject*)OP)->ob_refcnt < 0)                             \
                  _Py_NegativeRefcount(__FILE__, __LINE__,        \
                                       (PyObject *)(OP));         \
  }

gdb/
2013-05-30  Pedro Alves  <palves@redhat.com>

	* python/python-internal.h (gdb_Py_DECREF): Cast OP to PyObject
	pointer.
2013-05-30 08:56:56 +00:00
Yao Qi 36d25514de gdb/
* remote.c (remote_check_symbols): Remove unused parameter
	'objfile'.
	Declaration update.
	(remote_start_remote, remote_new_objfile): Caller update.
2013-05-30 00:40:21 +00:00
Yao Qi 62a813ccaf gdb/
* mi/mi-cmds.c (mi_cmds): Define MI command
	'-exec-arguments' by macro DEF_MI_CMD_CLI_1 instead of
	DEF_MI_CMD_CLI.

gdb/testsuite/
	* gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed):
	Add a test that no MI notification is emitted when executing
	-exec-arguments.
2013-05-30 00:25:16 +00:00
gdbadmin c0f316436d *** empty log message *** 2013-05-30 00:00:32 +00:00
Pedro Alves 28439a30ac [remote] Insert breakpoints in the right process.
I noticed that gdb.multi/multi-arch.exp wasn't passing with
extended-remote GDBserver with my pending multi-process+multi-arch
series anymore on current mainline, while it used to pass before:

 (gdb) run
 Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.multi/ma-hangout
 Process /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.multi/ma-hangout created; pid = 32067
 Warning:
 Cannot insert breakpoint 2.
 Error accessing memory address 0x4005c2: Unknown error -1.
 Cannot insert breakpoint -1.
 Temporarily disabling shared library breakpoints:
 breakpoint #-1

 (gdb) FAIL: gdb.multi/multi-arch.exp: starting inferior 2


Investigating manually, I found an easy way to reproduce.  You just
need breakpoints on distinct inferiors, and a way to have GDB install
them in one go:

 (gdb) set breakpoint always-inserted on
 (gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 2       breakpoint     del  n   <MULTIPLE>
 2.1                         y     0x00000000004005c2 in main at ../../../src/gdb/testsuite/gdb.multi/hello.c:40 inf 1
 2.2                         y     0x08048475         in main at ../../../src/gdb/testsuite/gdb.multi/hangout.c:22 inf 2
 (gdb) enable 2
 Warning:
 Cannot insert breakpoint 2.
 Error accessing memory address 0x4005c2: Unknown error -1.

And turning on remote debugging, we see:

 (gdb) set debug remote 1
 (gdb) disable 2
 (gdb) enable 2
 Sending packet: $Z0,4005c2,1#71...Packet received: E01
 Sending packet: $Z0,8048475,1#87...Packet received: OK
 Warning:
 Cannot insert breakpoint 2.
 Error accessing memory address 0x4005c2: Unknown error -1.

Notice that each of those Z0 breakpoints should be set in different
processes.  However, no Hg packet to select a process has been sent in
between, so GDBserver tries to plant both on the same process that
happens to be current.  The first Z0 then not so surprisingly fails.
IOW, the blame is on GDB, for telling GDBserver to plant both
breakpoints in the same process.

remote.c has a lazy scheme where it keeps a local cache of the
remote's selected general thread, and delays updating it on the remote
side until necessary (memory/register reads/writes, etc.).  This is
done to reduce RSP traffic.  The bug is that the Zx breakpoint
insert/remove methods weren't committing the selected thread/process
back to the remote side:

 Breakpoint 3, remote_insert_breakpoint (gdbarch=0x1383ae0, bp_tgt=0x140c2b0) at ../../src/gdb/remote.c:8148
 8148      if (remote_protocol_packets[PACKET_Z0].support != PACKET_DISABLE)
 (top-gdb) p inferior_ptid
 $3 = {pid = 3670, lwp = 0, tid = 3670}
 (top-gdb) p general_thread
 $4 = {pid = 3671, lwp = 0, tid = 3671}

IOW, a call to set_general_process is missing.

I did some auditing over remote.c, and added calls to all places I
found missing it.

This only used to work by chance before.  breakpoint.c switches to a
thread of the target process before installing a breakpoint location.
That calls switch_to_thread.  Before:

 2012-07-27  Yao Qi  <yao@codesourcery.com>

         * thread.c (switch_to_thread): Don't call registers_changed.

that caused the register caches to all be flushed and refetched before
installing the breakpoint location.  Given fetching registers commits
the remote general thread (with Hg), masking out the latent bug.

Tested on x86_64 Fedora 17 with GDBserver.

gdb/
2013-05-29  Pedro Alves  <palves@redhat.com>

	* remote.c (remote_insert_breakpoint, remote_remove_breakpoint)
	(remote_insert_watchpoint, remote_remove_watchpoint)
	(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint)
	(remote_verify_memory, compare_sections_command)
	(remote_search_memory): Set the general process/thread on the
	remote side.
2013-05-29 11:57:48 +00:00
Pedro Alves 6ac1c0821e [AArch64] Remove all traces of aarch64-without-fpu.xml.
The aarch64-without-fpu description is unused.

Linux requires an FPU, so the AArch64 native port always returns the
with-fpu variant:

static const struct target_desc *
aarch64_linux_read_description (struct target_ops *ops)
{
  initialize_tdesc_aarch64 ();
  return tdesc_aarch64;
}

When the target doesn't report a target description at all, we
fallback to a register set with an FPU:

aarch64_gdbarch_init ()
...
  if (!tdesc_has_registers (tdesc))
    tdesc = tdesc_aarch64;

This just removes the dead description.

Tested by building on x86_64 Fedora 17 with --enable=targets=all.

gdb/
2013-05-29  Pedro Alves  <palves@redhat.com>

	* aarch64-tdep.c: Don't include "features/aarch64-without-fpu.c".
	(_initialize_aarch64_tdep): Don't call
	initialize_tdesc_aarch64_without_fpu.
	* features/Makefile (WHICH): Remove reference to
	aarch64-without-fpu.
	* features/aarch64-without-fpu.c: Delete file.
	* regformats/aarch64-without-fpu.dat: Delete file.
2013-05-29 09:18:48 +00:00
gdbadmin 177565ddef *** empty log message *** 2013-05-29 00:00:02 +00:00
Pedro Alves 9b25f2d30c [GDBserver][AArch64] Remove references to aarch64-without-fpu.xml.
The GDBserver Aarch64 port includes the aarch64-without-fpu
description in the build, but doesn't actually use it anywhere.  As
Linux always requires an FPU, just remove the dead code.

gdb/gdbserver/
2013-05-28  Pedro Alves  <palves@redhat.com>

	* Makefile.in (clean): Remove reference to aarch64-without-fpu.c.
	(aarch64-without-fpu.c): Delete rule.
	* configure.srv (aarch64*-*-linux*): Remove references to
	aarch64-without-fpu.o and aarch64-without-fpu.xml.
	* linux-aarch64-low.c (init_registers_aarch64_without_fpu): Remove
	declaration.
2013-05-28 10:41:17 +00:00
Yao Qi a73e3634d1 gdb/
* tracepoint.c (stringify_collection_list): Remove parameter
	'string'.
	(encode_actions): Caller update.  Remove local variables.
2013-05-28 02:55:04 +00:00
gdbadmin 18e17b047d *** empty log message *** 2013-05-28 00:00:02 +00:00
gdbadmin 0513b0a3e8 *** empty log message *** 2013-05-27 00:00:03 +00:00
gdbadmin 89ca6a248b *** empty log message *** 2013-05-26 00:00:02 +00:00
gdbadmin b5cc0fabb4 *** empty log message *** 2013-05-25 00:00:03 +00:00
Jan Kratochvil 8f56dad4bb gdb/testsuite/
PR testsuite/12649
	* gdb.mi/mi-dprintf.exp (mi_continue_dprintf) (mi 2nd dprintf): Replace
	$mi_gdb_prompt expectation by mi_expect_stop.
	(mi 1st dprintf, agent, mi 2nd dprintf, agent)
	(mi info dprintf second time): Replace them by mi_send_resuming_command
	and mi_expect_stop.
2013-05-24 15:37:25 +00:00
Gary Benson c588eb206c 2013-05-24 Gary Benson <gbenson@redhat.com>
* gdb.base/solib-disc.exp (exec_opts): Remove unnecesary
	backslash.
	* gdb.base/unload.exp (exec_opts): Remove two unnecessary
	backslashes.
	* gdb.base/watchpoint-solib.exp (exec_opts): Remove unnecesary
	backslash.
2013-05-24 14:02:35 +00:00
Yao Qi c0ea94eb34 gdb/
* tracepoint.c (TFILE_PID): Remove.
	(tfile_open): Don't add thread and inferior.
	(tfile_close): Don't set 'inferior_ptid'.  Don't call
	exit_inferior_silent.
	(tfile_thread_alive): Remove.
	(init_tfile_ops): Don't set field 'to_thread_alive' of
	tfile_ops.

gdb/testsuite/

	* gdb.trace/tfile.exp: Test inferior and thread.
2013-05-24 12:27:39 +00:00
Pedro Alves 6740dc9c3e [gdbserver] Don't assume vCont;r ADDR1,ADDR2 comes with a ptid attached.
This bit:

+	  p1 = strchr (p, ':');
+	  decode_address (&resume_info[i].step_range_end, p, p1 - p);

should not expect the ':' to be there.  An action without a ptid is
valid:

 "If an action is specified with no thread-id, then it is applied to any
 threads that don't have a specific action specified"

This is handled further below:

      if (p[0] == 0)
	{
	  resume_info[i].thread = minus_one_ptid;
	  default_action = resume_info[i];

	  /* Note: we don't increment i here, we'll overwrite this entry
	     the next time through.  */
	}
      else if (p[0] == ':')

A stub that doesn't support and report to gdb thread ids at all (like
metal metal targets) only will always only see a single default action
with no ptid.

Use unpack_varlen_hex instead of decode_address.  The former doesn't
need to be told where the hex number ends, and it actually returns
that info instead, which we can use for validation.

Tested on x86_64 Fedora 17.

gdb/gdbserver/
2013-05-24  Pedro Alves  <palves@redhat.com>

	* server.c (handle_v_cont) <vCont;r>: Use unpack_varlen_hex
	instead of strchr/decode_address.  Error if the range isn't split
	with a ','.  Don't assume there's be a ':' in the action.
2013-05-24 11:28:06 +00:00
Yao Qi db1ac43683 gdb/testsuite/
* gdb.base/range-stepping.exp: Skip the rest of tests if the
	test fails.
	* lib/range-stepping-support.exp (exec_cmd_expect_vCont_count):
	Return 0 if the test passes, otherwise return 1.
2013-05-24 09:57:12 +00:00
Joel Brobecker 5901af59c9 Fix gdb.info build failure
gdb.texinfo:36367: `Installed System-wide Configuration Scripts' has no Up field (perhaps incorrect sectioning?).
    gdb.texinfo:36367: warning: unreferenced node `Installed System-wide Configuration Scripts'.

gdb/doc/ChangeLog:

        * gdb.texinfo (System-wide Configuration Scripts): Renames
        "Installed System-wide Configuration Scripts". Add associated
        @menu block.
2013-05-24 04:50:26 +00:00
Doug Evans c0803dc23a Update to load fission.exp. 2013-05-24 01:33:50 +00:00
Doug Evans b6abb10ccc * boards/fission-dwp.exp: New file. 2013-05-24 01:30:05 +00:00
Doug Evans 20d7f21139 * contrib/cc-with-tweaks.sh (-p): Handle no dwo files. 2013-05-24 00:30:24 +00:00
gdbadmin e6ec244956 *** empty log message *** 2013-05-24 00:00:02 +00:00
Pedro Alves 8658d16d9d common/filestuff.c: No sockets on DJGPP.
Building gdb with --host=i586-pc-msdosdjgpp ends up with:

 i586-pc-msdosdjgpp-gcc -g -O2 -I../../src/gdb/config/djgpp  -I. -I../../src/gdb -I../../src/gdb/common -I../../src/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../src/gdb/../include/opcode -I../../src/gdb/../opcodes/.. -I../../src/gdb/../readline/.. -I../bfd -I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber -I../../src/gdb/../libdecnumber -I./../intl -I../../src/gdb/gnulib/import -Ibuild-gnulib/import    -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Werror -c -o filestuff.o -MT filestuff.o -MMD -MP -MF .deps/filestuff.Tpo ../../src/gdb/common/filestuff.c
 ../../src/gdb/common/filestuff.c:38:24: fatal error: sys/socket.h: No such file or directory

There are no sockets on djgpp.  This #ifdef's out the bits in the file
that use sockets, depending on whether winsock or sys/socket.h is
available.

As alternative approach, given ser-tcp.c, ser-pipe.c, etc. are split
into separate files, and which to use is selected by configure.ac:

 dnl Figure out which of the many generic ser-*.c files the _host_ supports.
 SER_HARDWIRE="ser-base.o ser-unix.o ser-pipe.o ser-tcp.o"
 case ${host} in
  *go32* ) SER_HARDWIRE=ser-go32.o ;;
  *djgpp* ) SER_HARDWIRE=ser-go32.o ;;
  *mingw32*) SER_HARDWIRE="ser-base.o ser-tcp.o ser-mingw.o" ;;
 esac
 AC_SUBST(SER_HARDWIRE)

... I considered splitting filestuff.c similarly.  But I quickly gave
up on the idea, as it looked like a lot more complication over this
approach, for no real gain.  Plus, there are uses of these functions
outside the ser*.c framework.

gdbserver's configure.ac is already checking for sys/socket.h.

gdb/
2013-05-23  Pedro Alves  <palves@redhat.com>

	* common/filestuff.c [USE_WIN32API]: Define HAVE_SOCKETS.
	[HAVE_SYS_SOCKET_H]: Define HAVE_SOCKETS.
	(socket_mark_cloexec, gdb_socketpair_cloexec, gdb_socket_cloexec):
	Only define if HAVE_SOCKETS is defined.
	* configure.ac: Check for sys/socket.h.
	* config.in, configure: Regenerate.
2013-05-23 18:37:00 +00:00
Pedro Alves 21aa081e21 dwarf2read.c: Don't assume uint32_t is unsigned int on all hosts.
Building gdb on GNU/Linux, for --host=i586-pc-msdosdjgpp, I get:

 ../../src/gdb/dwarf2read.c: In function 'create_dwp_hash_table':
 ../../src/gdb/dwarf2read.c:8626:7: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' [-Werror=format]
 ../../src/gdb/dwarf2read.c:8632:7: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' [-Werror=format]
 ../../src/gdb/dwarf2read.c: In function 'create_dwo_in_dwp':
 ../../src/gdb/dwarf2read.c:8754:6: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t' [-Werror=format]
 ../../src/gdb/dwarf2read.c: In function 'open_and_init_dwp_file':
 ../../src/gdb/dwarf2read.c:9248:6: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Werror=format]
 ../../src/gdb/dwarf2read.c:9248:6: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int' [-Werror=format]

And:

 $ grep uint32_t /usr/i586-pc-msdosdjgpp/sys-include/*
 /usr/i586-pc-msdosdjgpp/sys-include/stdint.h:typedef unsigned long uint32_t;

As decided on the discussion at
<http://sourceware.org/ml/gdb-patches/2013-05/msg00788.html>, use
pulongest rather than PRIu32.

Tested on F17.  Also confirmed GDB still builds OK with
--host=i686-w64-mingw32.

gdb/
2013-05-23  Pedro Alves  <palves@redhat.com>

	* dwarf2read.c (create_dwp_hash_table, create_dwo_in_dwp)
	(open_and_init_dwp_file): Use %s/pulongest instead of %u for
	printing uint32_t variables.
2013-05-23 18:31:29 +00:00
Pedro Alves bc5065a70f range stepping: tests
This adds tests to verify range stepping is used as expected, by
inspecting the RSP traffic, looking for vCont;s and vCont;r packets.

gdb/testsuite/
2013-05-23  Yao Qi  <yao@codesourcery.com>
	    Pedro Alves  <palves@redhat.com>

	* gdb.base/range-stepping.c: New file.
	* gdb.base/range-stepping.exp: New file.
	* gdb.trace/range-stepping.c: New file.
	* gdb.trace/range-stepping.exp: New file.
	* lib/range-stepping-support.exp: New file.
2013-05-23 17:19:05 +00:00
Pedro Alves c2d6af84da range stepping: gdbserver (x86 GNU/Linux)
This patch adds support for range stepping to GDBserver, teaching it
about vCont;r.

It'd be easy to enable this for all hardware single-step targets
without needing the linux_target_ops hook, however, at least PPC needs
special care, due to the fact that PPC atomic sequences can't be
hardware single-stepped through, a thing which GDBserver doesn't know
about.  So this leaves the support limited to x86/x86_64.

gdb/
2013-05-23  Pedro Alves  <palves@redhat.com>

	* NEWS: Mention GDBserver range stepping support.

gdb/gdbserver/
2013-05-23  Yao Qi  <yao@codesourcery.com>
	    Pedro Alves  <palves@redhat.com>

	* linux-low.c (lwp_in_step_range): New function.
	(linux_wait_1): If the thread was range stepping and stopped
	outside the stepping range, report the stop to GDB.  Otherwise,
	continue stepping.  Add range stepping debug output.
	(linux_set_resume_request): Copy the step range from the resume
	request to the lwp.
	(linux_supports_range_stepping): New.
	(linux_target_ops) <supports_range_stepping>: Set to
	linux_supports_range_stepping.
	* linux-low.h (struct linux_target_ops)
	<supports_range_stepping>: New field.
	(struct lwp_info) <step_range_start, step_range_end>: New fields.
	* linux-x86-low.c (x86_supports_range_stepping): New.
	(the_low_target) <supports_range_stepping>: Set to
	x86_supports_range_stepping.
	* server.c (handle_v_cont): Handle 'r' action.
	(handle_v_requests): Append ";r" if the target supports range
	stepping.
	* target.h (struct thread_resume) <step_range_start,
	step_range_end>: New fields.
	(struct target_ops) <supports_range_stepping>:
	New field.
	(target_supports_range_stepping): New macro.
2013-05-23 17:17:50 +00:00
Pedro Alves c1e36e3e91 range stepping: gdb
This patch teaches GDB to take advantage of target-assisted range
stepping.  It adds a new 'r ADDR1,ADDR2' action to vCont (vCont;r),
meaning, "step once, and keep stepping as long as the thread is in the
[ADDR1,ADDR2) range".

Rationale:

When user issues the "step" command on the following line of source,

   a = b + c + d * e - a;

GDB single-steps every single instruction until the program reaches a
new different line.  E.g., on x86_64, that line compiles to:

   0x08048434 <+65>:    mov    0x1c(%esp),%eax
   0x08048438 <+69>:    mov    0x30(%esp),%edx
   0x0804843c <+73>:    add    %eax,%edx
   0x0804843e <+75>:    mov    0x18(%esp),%eax
   0x08048442 <+79>:    imul   0x2c(%esp),%eax
   0x08048447 <+84>:    add    %edx,%eax
   0x08048449 <+86>:    sub    0x34(%esp),%eax
   0x0804844d <+90>:    mov    %eax,0x34(%esp)
   0x08048451 <+94>:    mov    0x1c(%esp),%eax

and the following is the RSP traffic between GDB and GDBserver:

 --> vCont;s:p2e13.2e13;c
 <-- T0505:68efffbf;04:30efffbf;08:3c840408;thread:p2e13.2e13;core:1;
 --> vCont;s:p2e13.2e13;c
 <-- T0505:68efffbf;04:30efffbf;08:3e840408;thread:p2e13.2e13;core:2;
 --> vCont;s:p2e13.2e13;c
 <-- T0505:68efffbf;04:30efffbf;08:42840408;thread:p2e13.2e13;core:2;
 --> vCont;s:p2e13.2e13;c
 <-- T0505:68efffbf;04:30efffbf;08:47840408;thread:p2e13.2e13;core:0;
 --> vCont;s:p2e13.2e13;c
 <-- T0505:68efffbf;04:30efffbf;08:49840408;thread:p2e13.2e13;core:0;
 --> vCont;s:p2e13.2e13;c
 <-- T0505:68efffbf;04:30efffbf;08:4d840408;thread:p2e13.2e13;core:0;
 --> vCont;s:p2e13.2e13;c
 <-- T0505:68efffbf;04:30efffbf;08:51840408;thread:p2e13.2e13;core:0;

IOW, a lot of roundtrips between GDB and GDBserver.

If we add a new command to the RSP, meaning "keep stepping and don't
report a stop until the program goes out of the [0x08048434,
0x08048451) address range", then the RSP traffic can be reduced down
to:

 --> vCont;r8048434,8048451:p2db0.2db0;c
 <-- T0505:68efffbf;04:30efffbf;08:51840408;thread:p2db0.2db0;core:1;

As number of packets is reduced dramatically, the performance of
stepping source lines is much improved.

In case something is wrong with range stepping on the stub side, the
debug info or even gdb, this adds a "set/show range-stepping" command
to be able to turn range stepping off.

gdb/
2013-05-23  Yao Qi  <yao@codesourcery.com>
	    Pedro Alves  <palves@redhat.com>

	* gdbthread.h (struct thread_control_state) <may_range_step>: New
	field.
	* infcmd.c (step_once, until_next_command): Enable range stepping.
	* infrun.c (displaced_step_prepare): Disable range stepping.
	(resume): Disable range stepping if stepping over a breakpoint or
	we have software watchpoints.  If range stepping is enabled,
	assert the thread is in the stepping range.
	(clear_proceed_status_thread): Clear may_range_step.
	(handle_inferior_event): Disable range stepping as soon as we know
	the thread that hit the event.  Re-enable it whenever we're going
	to step with a step range.
	* remote.c (struct vCont_action_support) <r>: New field.
	(use_range_stepping): New global.
	(remote_vcont_probe): Handle 'r' action.
	(append_resumption): Append an 'r' action if the thread may range
	step.
	(show_range_stepping): New function.
	(set_range_stepping): New function.
	(_initialize_remote): Call add_setshow_boolean_cmd to register the
	'set range-stepping' and 'show range-stepping' commands.
	* NEWS: Mention range stepping, the new vCont;r action, and the
	new "set/show range-stepping" commands.

gdb/doc/
2013-05-23  Yao Qi  <yao@codesourcery.com>
	    Pedro Alves  <palves@redhat.com>

	* gdb.texinfo (Packets): Document 'vCont;r'.
	(Continuing and Stepping): Document target-assisted range
	stepping, and the 'set range-stepping' and 'show range-stepping'
	commands.
2013-05-23 17:15:35 +00:00
Pedro Alves d458bd84a8 Convert rs->support_vCont_t to a struct.
Convert the 'support_vCont_t' int field to a struct, in preparation
for adding more fields to it.

gdb/
2013-05-23  Yao Qi  <yao@codesourcery.com>
	    Pedro Alves  <palves@redhat.com>

	* remote.c (struct vCont_action_support): New struct.
	(struct remote_state) <support_vCont_t>: Remove field.
	<vCont_actions_support>: New field.
	(remote_vcont_probe, remote_stop_ns): Update.
2013-05-23 17:13:57 +00:00
Pedro Alves ce4c476a0f Factor out in-stepping-range checks.
This adds a function for doing within-thread's-stepping-range checks,
and converts a couple spots to use it.  Following patches will add
more uses.

gdb/
2013-05-23  Yao Qi  <yao@codesourcery.com>
	    Pedro Alves  <palves@redhat.com>

	* gdbthread.h (pc_in_thread_step_range): New declaration.
	* thread.c (pc_in_thread_step_range): New function.
	* infrun.c (handle_inferior_event): Use it.
2013-05-23 17:12:51 +00:00
Joel Brobecker ce70887aa8 mi/mi-cmd-break.c: Use xsnprintf instead of sprintf (ARI fix)
gdb/ChangeLog:

        * mi/mi-cmd-break.c (mi_argv_to_format): Use xsnprintf instead
        of sprintf.
2013-05-23 06:39:42 +00:00
Joel Brobecker 0201faace7 Document new <data-dir>/system-gdbinit area
gdb/doc/ChangeLog:

        * gdb.texinfo (Installed System-wide Configuration Scripts):
        Add subsection describing the scripts now available under
        the data-dir's system-gdbbinit subdirectory.
        * NEWS: Add entry announcing the availability of system-wide
        configuration scripts for ElinOS and Wind River Linux.
2013-05-23 06:00:53 +00:00
gdbadmin 5fd133faea *** empty log message *** 2013-05-23 00:00:03 +00:00
Keith Seitz 55b87a526f * ada-lang.c (is_known_support_routine): Add explicit free of
'func_name' from find_frame_funname.
	(ada_unhandled_exception_name_addr_from_raise): Add cleanups
	for func_name from find_frame_funname.
	* python/py-frame.c (frapy_name): Add explicit free of
	'name' from find_frame_funname.
	* stack.c (find_frame_funname): Add comment explaining that
	funcp must be freed by the caller.
	Return copy of symbol names instead of pointers.
	(print_frame): Add a cleanup for 'funname' from
	find_frame_funname.
	* stack.h (find_frame_funname): Remove "const" from
	'funname' parameter.
2013-05-22 21:16:18 +00:00
Tom Tromey 5f2e6b00f8 PR c++/15401:
* c-valprint.c (c_value_print): Use value_addr for
	references.  Convert back to reference type with value_ref.
gdb/testsuite
	* gdb.cp/class2.cc (main): New local 'aref'.
	* gdb.cp/class2.exp: Check printing of 'aref'.
2013-05-22 20:51:49 +00:00
Doug Evans e6ba475a03 * gdb.threads/wp-replication.c (main): Insert some code at the start
to ensure the breakpoint on main is only hit once.  Fix comment.
2013-05-22 16:30:24 +00:00
Eli Zaretskii d85c48475f Fix reporting of DLL unload events on MS-Windows.
gdb/windows-nat.c (handle_unload_dll): Don't call solib_add for the
 unloaded DLL, it will be done by handle_solib_event.  See
 http://sourceware.org/ml/gdb-patches/2013-05/msg00713.html for the
 details.
2013-05-22 16:18:12 +00:00
Phil Muldoon 54eb231c4b 2013-05-22 Phil Muldoon <pmuldoon@redhat.com>
* ui-out.c: Create typedef ui_out_level_p and define vector
	operations for that type.
	(struct ui_out): Use a vector instead of an array.
	(current_level): Return level from a vector.
	(push_level): Create a level in a vector.
	(pop_level): Delete a level in a vector.
	(ui_out_new): Create initial level zero level, and store in a
	vector.
	(ui_out_destroy): Add vector cleanup.
2013-05-22 12:27:13 +00:00