Commit Graph

34054 Commits

Author SHA1 Message Date
Thomas Schwinge c82f56d9d7 Hurd: Adjust to startup-with-shell changes.
In commit 98882a2651, STARTUP_WITH_SHELL was made
a runtime toggle, startup-with-shell.  The Hurd code was missed to be adjusted;
it had a value hard-coded instead of using START_INFERIOR_TRAPS_EXPECTED.  Fix
that, and also simplify gnu-nat's pending_execs handling from counting to just
a flag.

	gdb/
	* gnu-nat.c (struct inf): Change pending_execs member to a 1-bit
	flag.  Adjust all users; in particular...
	(gnu_wait): ..., don't decrement its value in here...
	(gnu_create_inferior): ..., and instead set the flag in here,
	around the startup_inferior call, and call that one with
	START_INFERIOR_TRAPS_EXPECTED.
2014-02-16 08:30:09 +01:00
Thomas Schwinge 3398af6aa3 Hurd: New RPC reply stub functions.
gdb/
	* gnu-nat.c (ill_rpc): Remove function; replaced with this...
	(ILL_RPC): ... new macro.
	(do_mach_notify_no_senders, do_mach_notify_port_deleted)
	(do_mach_notify_msg_accepted, do_mach_notify_port_destroyed)
	(do_mach_notify_send_once, S_proc_setmsgport_reply)
	(S_proc_getmsgport_reply, S_msg_sig_post_reply): Generate stub
	functions with ILL_RPC macro.
	(S_proc_pid2task_reply, S_proc_task2pid_reply)
	(S_proc_task2proc_reply, S_proc_proc2task_reply)
	(S_proc_pid2proc_reply, S_proc_getprocinfo_reply)
	(S_proc_getprocargs_reply, S_proc_getprocenv_reply)
	(S_proc_getloginid_reply, S_proc_getloginpids_reply)
	(S_proc_getlogin_reply, S_proc_getsid_reply)
	(S_proc_getsessionpgids_reply, S_proc_getsessionpids_reply)
	(S_proc_getsidport_reply, S_proc_getpgrp_reply)
	(S_proc_getpgrppids_reply, S_proc_get_tty_reply)
	(S_proc_getnports_reply, S_proc_is_important_reply)
	(S_proc_get_code_reply): New stub functions, generated with
	ILL_RPC macro.

Based on a patch by David Michael <fedora.dm0@gmail.com>.
2014-02-16 08:27:44 +01:00
Thomas Schwinge d47642c93d Hurd: Make MIG output parsing more robust.
gdb/
	* reply_mig_hack.awk: In phase 5, keep going if we have not yet
	collected the type check structures.

Based on a patch by David Michael <fedora.dm0@gmail.com>.
2014-02-16 08:26:53 +01:00
Thomas Schwinge bae8023e39 Hurd: Adapt to changed MIG output.
gdb/
	* reply_mig_hack.awk: Don't expect to see the auto keyword.

Based on a patch by David Michael <fedora.dm0@gmail.com>.
2014-02-16 08:26:08 +01:00
Doug Evans 8a55ffb082 * target.c (target_write_partial): Fix result type. 2014-02-14 14:57:37 -08:00
Jose E. Marchesi c2853f3d99 Fix offsets to access fpregset_t in sparc64-linux targets.
The %fsr register is not being properly accessed from gdb in
sparc64.  This is because sparc64_supply_fpregset and
sparc64_collect_fpregset are using the offsets from the
sparc32_bsd_fpregset constant instead of sparc64_bsd_fpregset.
This patch fixes this by registering the proper offsets for
sparc64-linux targets.

2014-02-14  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Register
	the proper offsets to access fpregset_t.
2014-02-14 02:29:11 -08:00
Yao Qi 0759a81e85 Compile rsp-low.c for IPA
gdb/gdbserver:

2014-02-14  Yao Qi  <yao@codesourcery.com>

	* Makefile.in (IPA_OBJS): Append rsp-low-ipa.o.
	(rsp-low-ipa.o): New target.
2014-02-14 09:53:51 +08:00
Sanimir Agovic ac61d2dbf7 cleanup: remove declared variables without any references
2014-02-13  Sanimir Agovic  <sanimir.agovic@intel.com>

	* cris-tdep.c (cris_supply_gregset): Remove zerobuf.
	(_initialize_cris_tdep): Remove cris_set_cmdlist, cris_show_cmdlist.
	* h8300-tdep.c (setmachinelist): Remove global.
	* hppa-tdep.c (hppa_sigtramp): Remove global.
	* mipsnbsd-tdep.c (sigtramp_retcode_mipsel, sigtramp_retcode_mipseb
	RETCODE_NWORDS, RETCODE_SIZE): Wrap code with #if 0.
	* ravenscar-thread.c (update_target_observer): Remove global.
	* rs6000-tdep.c (rs6000_gdbarch_init): Remove segment_regs.
2014-02-13 13:35:38 +00:00
Doug Evans 85f224e7e0 Test for binary,dwp symlinks into different directories.
* gdb.dwarf2/Makefile.in (EXECUTABLES): Add dwp-symlink.
	(MISCELLANEOUS): New variable.
	(clean): rm -rf $(MISCELLANEOUS).
	* gdb.dwarf2/dwp-symlink.exp: Test the case where the executable and
	dwp live in the same directory as symlinks, with each symlink pointed
	to a differently named file in a different directory.
2014-02-12 11:38:48 -08:00
Tom Tromey 9d2d0b8b04 update rsp-low comments
This updates all the comments in rsp-low.[ch], now that the
unification has been completed.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* common/rsp-low.c: Update comments.
	* common/rsp-low.h: Update comments.
2014-02-12 09:59:20 -07:00
Tom Tromey a7191e8bd7 replace convert_ascii_to_int with hex2bin
convert_ascii_to_int is identical to hex2bin.
This removes the former.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* common/rsp-low.c (convert_ascii_to_int): Remove.
	* common/rsp-low.h (convert_ascii_to_int): Don't declare.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* ax.c (gdb_parse_agent_expr): Use hex2bin, not
	convert_ascii_to_int.
	* regcache.c (registers_to_string): Likewise.
	* remote-utils.c (decode_M_packet): Likewise.
	* server.c (process_serial_event): Likewise.
2014-02-12 09:59:20 -07:00
Tom Tromey ff0e980e6f replace unhexify with hex2bin
unhexify and hex2bin are identical, so this removes unhexify.  The
particular choice of which to keep was made on the basis of
parallelism with the earlier patch that removed hexify.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* common/rsp-low.h (unhexify): Don't declare.
	* common/rsp-low.c (unhexify): Remove.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* server.c (handle_query, handle_v_run): Use hex2bin, not
	unhexify.
	* tracepoint.c (cmd_qtdpsrc, cmd_qtdv, cmd_qtnotes): Likewise.
2014-02-12 09:59:19 -07:00
Tom Tromey e9371aff2d replace convert_int_to_ascii with bin2hex
convert_int_to_ascii is identical to bin2hex.  This removes the
former.  In this case I made the choice of which to keep on the basis
that I consider the name bin2hex to be superior to
convert_int_to_ascii.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* common/rsp-low.h (convert_int_to_ascii): Don't declare.
	* common/rsp-low.c (convert_int_to_ascii): Remove.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* ax.c (gdb_unparse_agent_expr): Use bin2hex, not
	convert_int_to_ascii.
	* regcache.c (registers_to_string, collect_register_as_string):
	Likewise.
	* remote-utils.c (look_up_one_symbol, relocate_instruction):
	Likewise.
	* server.c (process_serial_event): Likewise.
	* tracepoint.c (cmd_qtstatus, response_source, response_tsv)
	(cmd_qtbuffer, cstr_to_hexstr): Likewise.
2014-02-12 09:59:18 -07:00
Tom Tromey 971dc0b89d replace hexify with bin2hex
This removes hexify in favor of bin2hex.
The choice of which to keep was arbitrary.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* common/rsp-low.h (hexify): Don't declare.
	* common/rsp-low.c (hexify): Remove.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* remote-utils.c (look_up_one_symbol, monitor_output): Use
	bin2hex, not hexify.
	* tracepoint.c (cmd_qtstatus): Likewise.
2014-02-12 09:59:17 -07:00
Tom Tromey 0a822afbcd don't let hexify call strlen
hexify had the same issue as bin2hex; and the fix is the same.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* common/rsp-low.c (hexify): Never take strlen of argument.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* remote-utils.c (monitor_output): Pass explicit length to
	hexify.
2014-02-12 09:59:16 -07:00
Tom Tromey 9f1b45b0da don't let bin2hex call strlen
Currently bin2hex may call strlen if the length argument is zero.
This prevents some function unification; and also it seems cleaner to
me not to have a special meaning for a zero length.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* common/rsp-low.c (bin2hex): Never take strlen of argument.
	* remote.c (extended_remote_run, remote_rcmd)
	(remote_download_trace_state_variable, remote_save_trace_data)
	(remote_set_trace_notes): Update.
	* tracepoint.c (encode_source_string, tfile_write_status)
	(tfile_write_uploaded_tsv): Update.
2014-02-12 09:59:15 -07:00
Tom Tromey 9c3d65319a move some rsp bits into rsp-low.h
This moves various low-level remote serial protocol bits into
common/rsp-low.[ch].

This is as close to a pure move as possible.  There are some
redundancies remaining but those will be dealt with in a subsequent
patch.

Note that the two variants of remote_escape_output disagreed on the
treatment of "*".  On the theory that quoting cannot hurt but the
absence possibly can, I chose the gdbserver variant to be the
canonical one.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* tracepoint.c: Include rsp-low.h.
	* remote.h (hex2bin, bin2hex, unpack_varlen_hex): Don't declare.
	* remote.c: Include rsp-low.h.
	(hexchars, ishex, unpack_varlen_hex, pack_nibble, pack_hex_byte)
	(fromhex, hex2bin, tohex, bin2hex, remote_escape_output)
	(remote_unescape_input): Move to common/rsp-low.c.
	* common/rsp-low.h: New file.
	* common/rsp-low.c: New file.
	* Makefile.in (SFILES): Add common/rsp-low.c.
	(HFILES_NO_SRCDIR): Add common/rsp-low.h.
	(COMMON_OBS): Add rsp-low.o.
	(rsp-low.o): New target.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* tracepoint.c: Include rsp-low.h.
	* server.c: Include rsp-low.h.
	* remote-utils.h (convert_ascii_to_int, convert_int_to_ascii)
	(unhexify, hexify, remote_escape_output, unpack_varlen_hex): Don't
	declare.
	* remote-utils.c: Include rsp-low.h.
	(fromhex, hexchars, ishex, unhexify, tohex, hexify)
	(remote_escape_output, remote_unescape_input, unpack_varlen_hex)
	(convert_int_to_ascii, convert_ascii_to_int): Move to
	common/rsp-low.c.
	* regcache.c: Include rsp-low.h.
	* ax.c: Include rsp-low.h.
	* Makefile.in (SFILES): Add common/rsp-low.c.
	(OBS): Add rsp-low.o.
	(rsp-low.o): New target.
2014-02-12 09:59:14 -07:00
Tom Tromey 01fd3ea573 share "cell" code
The "cell"-based printing code, like phex, was duplicated in both gdb
and gdbserver.  This patch merges the two implementations into a new
file in common/.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* utils.h: Include print-utils.h.
	(host_address_to_string, plongest, pulongest, phex, phex_nz)
	(int_string, core_addr_to_string, core_addr_to_string_nz)
	(hex_string, hex_string_custom): Don't declare.
	* utils.c (NUMCELLS, CELLSIZE, get_cell, decimal2str, pulongest)
	(plongest, thirty_two, phex, phex_nz, octal2str, hex_string)
	(hex_string_custom, int_string, core_addr_to_string)
	(core_addr_to_string_nz, host_address_to_string): Move to
	common/print-utils.c.
	* common/print-utils.h: New file.
	* common/print-utils.c: New file
	* Makefile.in (SFILES): Add common/print-utils.c.
	(HFILES_NO_SRCDIR): Add common/print-utils.h.
	(COMMON_OBS): Add print-utils.o.
	(print-utils.o): New target.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* utils.h (pulongest, plongest, phex_nz): Don't declare.
	Include print-utils.h.
	* utils.c (NUMCELLS, CELLSIZE, get_cell, decimal2str, pulongest)
	(plongest, thirty_two, phex_nz): Remove.
	* Makefile.in (SFILES): Add common/print-utils.c.
	(OBS): Add print-utils.o.
	(print-utils-ipa.o): New target.
	(print-utils.o): New target.
	(IPA_OBJS): Add print-utils-ipa.o.
2014-02-12 09:59:13 -07:00
Tom Tromey 9fb5010805 fix error in nios2-tdep.c
Since this change:

2014-02-12  Sanimir Agovic  <sanimir.agovic@intel.com>

	* nios2-tdep.c (nios2_stub_frame_base): Remove global.

nios2-tdep hasn't built:

../../binutils-gdb/gdb/nios2-tdep.c:1337:1: error: ‘nios2_stub_frame_base_address’ defined but not used [-Werror=unused-function]

This patch removes the offending function.

2014-02-12  Tom Tromey  <tromey@redhat.com>

	* nios2-tdep.c (nios2_stub_frame_base_address): Remove.
2014-02-12 09:20:02 -07:00
Mark Kettenis 0548b5db30 Call obsd_init_abi for OpenBSD/sparc64.
gdb/CHangeLog:

        * sparc64obsd-tdep.c (sparc64obsd_init_abi): Call obsd_init_abi.
2014-02-12 14:59:48 +01:00
Mark Kettenis 493443a47f FIX EOF detection in PT_IO-based to_xfer_partial implementation.
At least on OpenBSD PT_IO/PIOD_READ_AUXV can return sucessfully without
transferring any bytes.  Arguably a kernel bug, but interpreting this as EOF
seems sensible.

gdb/ChangeLog:

        * inf-ptrace.c (inf_ptrace_xfer_partial): Return TARGET_XFER_EOF
        if a PT_IO ptrace request returns sucessfully but indicates that 0
        bytes were transferred.
2014-02-12 14:51:19 +01:00
Pedro Alves 706d088346 Explicitly mark vtables as code space
Ports for Hardvard architectures will typically have in their
pointer_to_address hook a check for TYPE_CODE_SPACE in their
"pointer_to_address" gdbarch method.  E.g., rl78's:

  /* Is it a code address?  */
  if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
      || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD
      || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type))
      || TYPE_LENGTH (type) == 4)
    return rl78_make_instruction_address (addr);
  else
    return rl78_make_data_address (addr);

The avr port is similar.

The vtable type is a struct type gdb itself bakes.  Being neither a
function, nor a method, and absent explicit flagging as residing in
code space, ends up being considered data.

This patch marks the type as code when it is created, on the theory
that this is needed for all Hardvard architectures.  I believe this
should make no difference on archs with flat address space.  Testing
on x86-64 GNU/Linux shows no changes.

gdb/
2014-02-12  Pedro Alves  <palves@redhat.com>
	    Kevin Buettner <kevinb@redhat.com>

	* gnu-v3-abi.c (build_gdb_vtable_type): Return a type marked with
	TYPE_INSTANCE_FLAG_CODE_SPACE.

Kevin Buettner, at
<https://sourceware.org/ml/gdb-patches/2014-02/msg00338.html>, writes,
re. rl78:

This patch, for rl78 using the default multilib, fixes 5 failures in
gdb.cp/casts.exp, 2 failures in gdb.cp/class2.exp, 115 failures in
gdb.mi/mi-var-rtti.exp, and 2 failures in gdb.python/py-value.exp.

It introduces 9 failures (regressions) in gdb.mi/mi-var-rtti.exp.

One of the regressions is:

 FAIL: gdb.mi/mi-var-rtti.exp: list children of s.public in type_update_when_use_rtti

The relevant lines from the log file from a pre-patch test run are as
follows:

 -var-list-children  S.public
 ^done,numchild="1",children=[child={name="S.public.ptr",exp="ptr",numchild="1",type="Base *",thread-id="1"}],has_more="0"
 (gdb)
 PASS: gdb.mi/mi-var-rtti.exp: list children of s.public in type_update_when_use_rtti
 Expecting: \^done,numchild=".*",children=\[child={name="S.public.ptr.public",exp="public",numchild="1"(,thread-id="[0-9]+")?}.*\],has_more="0"
 Expecting: ^(-var-list-children  S\.public\.ptr  [
 ]+)?(\^done,numchild=".*",children=\[child={name="S.public.ptr.public",exp="public",numchild="1"(,thread-id="[0-9]+")?}.*\],has_more="0"[
 ]+[(]gdb[)]
 [ ]*)

The same set of lines for the failing (post-patch) run are instead:

 -var-list-children  S.public
 &"warning: can't find linker symbol for virtual table for `Base' value\n"
 &"warning:   found `typeinfo for __cxxabiv1::__vmi_class_type_info' instead\n"
 &"warning: can't find linker symbol for virtual table for `Base' value\n"
 &"warning:   found `typeinfo for __cxxabiv1::__vmi_class_type_info' instead\n"
 &"warning: can't find linker symbol for virtual table for `Base' value\n"
 &"warning:   found `typeinfo for __cxxabiv1::__vmi_class_type_info' instead\n"
 ^done,numchild="1",children=[child={name="S.public.ptr",exp="ptr",numchild="1",type="Base *",thread-id="1"}],has_more="0"
 (gdb)
 FAIL: gdb.mi/mi-var-rtti.exp: list children of s.public in type_update_when_use_rtti
 Expecting: \^done,numchild=".*",children=\[child={name="S.public.ptr.public",exp="public",numchild="1"(,thread-id="[0-9]+")?}.*\],has_more="0"
 Expecting: ^(-var-list-children  S\.public\.ptr  [
 ]+)?(\^done,numchild=".*",children=\[child={name="S.public.ptr.public",exp="public",numchild="1"(,thread-id="[0-9]+")?}.*\],has_more="0"[
 ]+[(]gdb[)]
 [ ]*)

Note that the difference between these are the warnings regarding
linker symbols.  Aside from the warnings, the result is the same.
I.e.  gdb produces the correct answer despite the warnings.  The
reason for the other 8 failures is the same: the test harness is not
expecting these warnings.

I spent some time (a while ago) looking at the reason for these
warnings.  As I recall, we are now getting further along in the type
resolution process than we were without my patch.  I.e.  for the
example above, the code in question never got to the point where it
was looking for the specified linker symbol.  So it seems to me that,
at worst, my patch exposes some other problem, but is not directly the
cause of the problem.
2014-02-12 13:30:21 +00:00
Pedro Alves 5caa2f0b27 H8/300: Fix pseudo registers reads/writes.
'info registers ccr' corrupts memory.

Debugging gdb under Valgrind, we see:

 (gdb) info registers ccr
 ==23225== Invalid write of size 1
 ==23225==    at 0x4A0A308: memcpy@@GLIBC_2.14 (mc_replace_strmem.c:881)
 ==23225==    by 0x52D334: regcache_raw_read (regcache.c:625)
 ==23225==    by 0x45E4D8: h8300_pseudo_register_read (h8300-tdep.c:1171)
 ==23225==    by 0x5B694B: gdbarch_pseudo_register_read (gdbarch.c:1926)
 ==23225==    by 0x52DADB: regcache_cooked_read (regcache.c:740)
 ==23225==    by 0x52DC10: regcache_cooked_read_value (regcache.c:765)
 ==23225==    by 0x68CA41: sentinel_frame_prev_register (sentinel-frame.c:52)
 ==23225==    by 0x6B80CB: frame_unwind_register_value (frame.c:1105)
 ==23225==    by 0x6B7C97: frame_register_unwind (frame.c:1010)
 ==23225==    by 0x6B7F73: frame_unwind_register (frame.c:1064)
 ==23225==    by 0x6B8359: frame_unwind_register_signed (frame.c:1162)
 ==23225==    by 0x6B8396: get_frame_register_signed (frame.c:1169)
 ==23225==  Address 0x4f7b031 is 0 bytes after a block of size 1 alloc'd
 ==23225==    at 0x4A06B0F: calloc (vg_replace_malloc.c:593)
 ==23225==    by 0x6EB754: xcalloc (common-utils.c:91)
 ==23225==    by 0x6EB793: xzalloc (common-utils.c:101)
 ==23225==    by 0x53A782: allocate_value_contents (value.c:854)
 ==23225==    by 0x53A7B4: allocate_value (value.c:864)
 ==23225==    by 0x52DBC8: regcache_cooked_read_value (regcache.c:757)
 ==23225==    by 0x68CA41: sentinel_frame_prev_register (sentinel-frame.c:52)
 ==23225==    by 0x6B80CB: frame_unwind_register_value (frame.c:1105)
 ==23225==    by 0x6B7C97: frame_register_unwind (frame.c:1010)
 ==23225==    by 0x6B7F73: frame_unwind_register (frame.c:1064)
 ==23225==    by 0x6B8359: frame_unwind_register_signed (frame.c:1162)
 ==23225==    by 0x6B8396: get_frame_register_signed (frame.c:1169)
 ==23225==
 ccr            0x00        0    I-0 UI-0 H-0 U-0 N-0 Z-0 V-0 C-0 u> u>= != >= >
 (gdb)

This bit:

 ==23225== Invalid write of size 1
 ==23225==    at 0x4A0A308: memcpy@@GLIBC_2.14 (mc_replace_strmem.c:881)
 ==23225==    by 0x52D334: regcache_raw_read (regcache.c:625)
 ==23225==    by 0x45E4D8: h8300_pseudo_register_read (h8300-tdep.c:1171)

shows the problem.  The CCR pseudo register has type length of 1,
while the corresponding CCR raw register has a length of 2 or 4
(depending on mode).  In
sim/h8300/compile.c:sim_{fetch|store}_register we see that the sim
also treats those raw registers (CCR/EXR) as 2 or 4 bytes length.

gdb/
2014-02-12  Pedro Alves  <palves@redhat.com>

	* h8300-tdep.c (pseudo_from_raw_register)
	(raw_from_pseudo_register): New functions.
	(h8300_pseudo_register_read, h8300_pseudo_register_write): Use
	them.
2014-02-12 12:28:25 +00:00
Pedro Alves 76fd5f745a H8/300: Fix gdb<->sim register mapping.
Currently, printing the H8/300 ccr register when debugging with the
sim is broken:

 (gdb) target sim
 ...
 (gdb) load
 ...
 (gdb) start
 ...
 Breakpoint 1, foo (i=0x0 <foo>) at main.c:4
 4       {
 (gdb) info registers ccr
 Register 13 is not available

'13' is the ccr pseudo-register.  This pseudo-register provides an
8-bit view into the raw ccr register (regno=8).

The problem is that the H8/300 port does not define a
register_sim_regno gdbarch hook, and thus when fetching the raw
register off of the sim, we end up in legacy_register_sim_regno trying
to figure out the sim register number for the raw CCR register:

 int
 legacy_register_sim_regno (struct gdbarch *gdbarch, int regnum)
 {
   /* Only makes sense to supply raw registers.  */
   gdb_assert (regnum >= 0 && regnum < gdbarch_num_regs (gdbarch));
   /* NOTE: cagney/2002-05-13: The old code did it this way and it is
      suspected that some GDB/SIM combinations may rely on this
      behavour.  The default should be one2one_register_sim_regno
      (below).  */
   if (gdbarch_register_name (gdbarch, regnum) != NULL
       && gdbarch_register_name (gdbarch, regnum)[0] != '\0')
     return regnum;
   else
     return LEGACY_SIM_REGNO_IGNORE;
 }

Because the raw ccr register does not have a name (so that it is
hidden from the user), that returns LEGACY_SIM_REGNO_IGNORE.  That
means that we never actually read the value of the raw ccr register.

Before the <unavailable> support, this must have meant that ccr was
_always_ read as 0...  At least, I'm not seeing how this ever worked.

The fix for that is adding a gdbarch_register_sim_regno hook that maps
all raw registers.  Looking at sim/h8300/sim-main.h, I believe the
sim's register numbers are compatible with gdb's, so no actual
convertion is necessary.

gdb/
2014-02-12  Pedro Alves  <palves@redhat.com>

	* h8300-tdep.c (h8300_register_sim_regno): New function.
	(h8300_gdbarch_init): Install h8300_register_sim_regno as
	gdbarch_register_sim_regno hook.
2014-02-12 12:27:49 +00:00
Sanimir Agovic 8f0084065d nios2-tdep: remove unreferenced global nios2_stub_frame_base
2014-02-12  Sanimir Agovic  <sanimir.agovic@intel.com>

	* nios2-tdep.c (nios2_stub_frame_base): Remove global.
2014-02-12 12:09:45 +00:00
Sanimir Agovic 195abc10c0 tic6x-tdep: set default frame base
2014-02-12  Sanimir Agovic  <sanimir.agovic@intel.com>

	* tic6x-tdep.c (tic6x_gdbarch_init): Call frame_base_set_default.
2014-02-12 12:08:50 +00:00
Mark Kettenis 93ffa5b939 Add signal number conversions for OpenBSD.
gdb/ChangeLog:

        * obsd-tdep.h (obsd_init_abi): New prototype.
        * obsd-tdep.c: Define enum with OpenBSD signal numbers.
        (obsd_gdb_signal_from_target, obsd_gdb_signal_to_target)
        (obsd_init_abi): New functions.
        * i386obsd-tdep.c: Include "obsd-tdep.h".
        (i386obsd_init_abi): Call obsd_init_abi.
        * amd64obsd-tdep.c: Include "obsd-tdep.h".
        (amd64obsd_init_abi): Call obsd_init_abi.
        * configure.tgt (i[34567]86-*-openbsd*, x86_64-*-openbsd*): Add
        obsd-tdep.c to gdb_target_obs.
2014-02-12 12:08:28 +01:00
Doug Evans 6fb526eee4 Remove stray parantheses for deffn. 2014-02-11 23:19:22 -08:00
Doug Evans 149b30ffe4 * gdb.dwarf2/dwp-symlink.exp: Rewrite to use remote_* commands instead
of Tcl file commands.
2014-02-11 15:48:44 -08:00
Jose E. Marchesi 49caec94ae Fix passing double float complex arguments in sparc64.
Double float complex objects are not 16-byte aligned in either
gcc or solaris studio.  This patch makes gdb to not align double
float complex arguments in the dummy frame when calling a
function.

2014-02-11  Jose E. Marchesi  <jose.marchesi@oracle.com>

        * sparc64-tdep.c (sparc64_store_arguments): Do not align complex
        double float arguments to 16-byte in the argument slots.
2014-02-11 04:27:20 -08:00
Doug Evans e1402065ee Don't crash if pkg-config is not found and guile wasn't explicitly requested.
* configure.ac: Don't crash if pkg-config is not found and guile
	wasn't explicitly requested.  Use AC_MSG_ERROR instead of AC_ERROR
	in guile checks.
	* configure: Regenerate.
2014-02-10 23:04:38 -08:00
Yao Qi edcc890fce Update comments to to_xfer_partial implementations.
Some comments to to_xfer_partial implementations are out of date.
This patch updates them using the "Implement the to_xfer_partial
target_ops method" pattern.

gdb:

2014-02-11  Yao Qi  <yao@codesourcery.com>

	* aix-thread.c (aix_thread_xfer_partial): Update comments.
	* auxv.c (procfs_xfer_auxv, memory_xfer_auxv): Likewise.
	* bsd-uthread.c (bsd_uthread_xfer_partial): Likewise.
	* gnu-nat.c (gnu_xfer_memory): Likewise.
	* inf-ptrace.c (inf_ptrace_xfer_partial):  Likewise.
	* rs6000-nat.c (rs6000_xfer_partial): Likewise.
	* sparc-nat.c (sparc_xfer_wcookie): Likewise.
	* spu-linux-nat.c (spu_proc_xfer_spu): Likewise.
2014-02-11 14:20:39 +08:00
Yao Qi 9b409511d0 Return target_xfer_status in to_xfer_partial
This patch does the conversion of to_xfer_partial from

    LONGEST (*to_xfer_partial) (struct target_ops *ops,
				enum target_object object, const char *annex,
				gdb_byte *readbuf, const gdb_byte *writebuf,
				ULONGEST offset, ULONGEST len);

to

    enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
				enum target_object object, const char *annex,
				gdb_byte *readbuf, const gdb_byte *writebuf,
				ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);

It changes to_xfer_partial return the transfer status and the transfered
length by *XFERED_LEN.  Generally, the return status has three stats,

 - TARGET_XFER_OK,
 - TARGET_XFER_EOF,
 - TARGET_XFER_E_XXXX,

See the comments to them in 'enum target_xfer_status'.  Note that
Pedro suggested not name TARGET_XFER_DONE, as it is confusing,
compared with "TARGET_XFER_OK".  We finally name it TARGET_XFER_EOF.

With this change, GDB core can handle unavailable data in a convenient
way.

The rationale behind this change was mentioned here
https://sourceware.org/ml/gdb-patches/2013-10/msg00761.html

Consider an object/value like this:

  0          100      150        200           512
  DDDDDDDDDDDxxxxxxxxxDDDDDD...DDIIIIIIIIIIII..III

where D is valid data, and xxx is unavailable data, and I is beyond
the end of the object (Invalid).  Currently, if we start the
xfer at 0, requesting, say 512 bytes, we'll first get back 100 bytes.
The xfer machinery then retries fetching [100,512), and gets back
TARGET_XFER_E_UNAVAILABLE.  That's sufficient when you're either
interested in either having the whole of the 512 bytes available,
or erroring out.  But, in this scenario, we're interested in
the data at [150,512).  The problem is that the last
TARGET_XFER_E_UNAVAILABLE gives us no indication where to
start the read next.  We'd need something like:

get me [0,512) >>>
     <<< here's [0,100), *xfered_len is 100, returns TARGET_XFER_OK

get me [100,512)  >>> (**1)
     <<< [100,150) is unavailable, *xfered_len is 50, return TARGET_XFER_E_UNAVAILABLE.

get me [150,512) >>>
     <<< here's [150,200), *xfered_len is 50, return TARGET_XFER_OK.

get me [200,512) >>>
     <<< no more data, return TARGET_XFER_EOF.

This naturally implies pushing down the decision of whether
to return TARGET_XFER_E_UNAVAILABLE or something else
down to the target.  (Which kinds of leads back to tfile
itself reading from RO memory from file (though we could
export a function in exec.c for that that tfile delegates to,
instead of re-adding the old code).

Beside this change, we also add a macro TARGET_XFER_STATUS_ERROR_P to
check whether a status is an error or not, to stop using "status < 0".
This patch also eliminates the comparison between status and 0.

No target implementations to to_xfer_partial adapts this new
interface.  The interface still behaves as before.

gdb:

2014-02-11  Yao Qi  <yao@codesourcery.com>

	* target.h (enum target_xfer_error): Rename to ...
	(enum target_xfer_status): ... it.  New.  All users updated.
	(enum target_xfer_status) <TARGET_XFER_OK>, <TARGET_XFER_EOF>:
	New.
	(TARGET_XFER_STATUS_ERROR_P): New macro.
	(target_xfer_error_to_string): Remove declaration.
	(target_xfer_status_to_string): Declare.
	(target_xfer_partial_ftype): Adjust it.
	(struct target_ops) <to_xfer_partial>: Return
	target_xfer_status.  Add argument xfered_len.  Update
	comments.
	* target.c (target_xfer_error_to_string): Rename to ...
	(target_xfer_status_to_string): ... it.  New.  All callers
	updated.
	(target_read_live_memory): Likewise.  Call target_xfer_partial
	instead of target_read.
	(memory_xfer_live_readonly_partial): Return
	target_xfer_status.  Add argument xfered_len.
	(raw_memory_xfer_partial): Likewise.
	(memory_xfer_partial_1): Likewise.
	(memory_xfer_partial): Likewise.
	(target_xfer_partial): Likewise.  Check *XFERED_LEN is set
	properly.  Update debug message.
	(default_xfer_partial, current_xfer_partial): Likewise.
	(target_write_partial): Likewise.
	(target_read_partial): Likewise.  All callers updated.
	(read_whatever_is_readable): Likewise.
	(target_write_with_progress): Likewise.
	(target_read_alloc_1): Likewise.

	* aix-thread.c (aix_thread_xfer_partial): Likewise.
	* auxv.c (procfs_xfer_auxv): Likewise.
	(ld_so_xfer_auxv, memory_xfer_auxv): Likewise.
	* bfd-target.c (target_bfd_xfer_partial): Likewise.
	* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
	* bsd-uthread.c (bsd_uthread_xfer_partia): Likewise.
	* corefile.c (read_memory): Adjust.
	* corelow.c (core_xfer_partial): Likewise.
	* ctf.c (ctf_xfer_partial): Likewise.
	* darwin-nat.c (darwin_read_dyld_info): Likewise.  All callers
	updated.
	(darwin_xfer_partial): Likewise.
	* exec.c (section_table_xfer_memory_partial): Likewise.  All
	callers updated.
	(exec_xfer_partial): Likewise.
	* exec.h (section_table_xfer_memory_partial): Update
	declaration.
	* gnu-nat.c (gnu_xfer_memory): Likewise.  Assert 'res' is not
	negative.
	(gnu_xfer_partial): Likewise.
	* ia64-hpux-nat.c (ia64_hpux_xfer_memory_no_bs): Likewise.
	(ia64_hpux_xfer_memory, ia64_hpux_xfer_uregs): Likewise.
	(ia64_hpux_xfer_solib_got): Likewise.
	* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise.  Change
	type of 'partial_len' to ULONGEST.
	* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
	* linux-nat.c (linux_xfer_siginfo ): Likewise.
	(linux_nat_xfer_partial): Likewise.
	(linux_proc_xfer_partial, linux_xfer_partial): Likewise.
	(linux_proc_xfer_spu, linux_nat_xfer_osdata): Likewise.
	* monitor.c (monitor_xfer_memory): Likewise.
	(monitor_xfer_partial): Likewise.
	* procfs.c (procfs_xfer_partial): Likewise.
	* record-btrace.c (record_btrace_xfer_partial): Likewise.
	* record-full.c (record_full_xfer_partial): Likewise.
	(record_full_core_xfer_partial): Likewise.
	* remote-sim.c (gdbsim_xfer_memory): Likewise.
	(gdbsim_xfer_partial): Likewise.
	* remote.c (remote_write_bytes_aux): Likewise.  All callers
	updated.
	(remote_write_bytes, remote_read_bytes): Likewise.  All
	callers updated.
	(remote_flash_erase): Likewise.  All callers updated.
	(remote_write_qxfer): Likewise.  All callers updated.
	(remote_read_qxfer): Likewise.  All callers updated.
	(remote_xfer_partial): Likewise.
	* rs6000-nat.c (rs6000_xfer_partial): Likewise.
	(rs6000_xfer_shared_libraries): Likewise.
	* sol-thread.c (sol_thread_xfer_partial): Likewise.
	(sol_thread_xfer_partial): Likewise.
	* sparc-nat.c (sparc_xfer_wcookie): Likewise.
	(sparc_xfer_partial): Likewise.
	* spu-linux-nat.c (spu_proc_xfer_spu): Likewise.  All callers
	updated.
	(spu_xfer_partial): Likewise.
	* spu-multiarch.c (spu_xfer_partial): Likewise.
	* tracepoint.c (tfile_xfer_partial): Likewise.
	* windows-nat.c (windows_xfer_memory): Likewise.
	(windows_xfer_shared_libraries): Likewise.
	(windows_xfer_partial): Likewise.
	* valprint.c: Replace 'target_xfer_error' with
	'target_xfer_status' in comments.
2014-02-11 14:20:33 +08:00
Joel Brobecker a8e6308380 Fix thinko in mi/mi-main.c::mi_cmd_data_write_memory_bytes comment.
gdb/ChangeLog:
2014-02-11  Simon Marchi  <simon.marchi@ericsson.com>  (tiny patch)

	Checked in by Joel Brobecker <brobecker@adacore.com>.
	* mi/mi-main.c (mi_cmd_data_write_memory_bytes): Fix comment.
2014-02-11 07:59:14 +04:00
Joel Brobecker e86b67d3a1 Reformat symfile-debug.c::debug_qf_expand_symtabs_matching parameters.
gdb/ChangeLog:

	* symfile-debug.c (debug_qf_expand_symtabs_matching): Reformat
	function parameters.
2014-02-11 07:31:26 +04:00
Stan Shebs 1e0a51780b Add Doxygen support to GDB 2014-02-10 19:10:34 -08:00
Mark Kettenis 1dfdac3275 Avoid killing all processes.
gdb/ChangeLog:

        * gdb.threads/step-after-sr-lock.exp: Avoid executing
        "kill -SIGUSR1 -1".
2014-02-10 18:07:12 +01:00
Will Newton 4b7d1f7fb4 gdb/elfread.c: Enable ifunc support on ARM.
There are two failures in the gnu-ifunc.exp test on ARM. These are
due to the failure to resolve the correct target function when
attempting to breakpoint a GNU ifunc resolved function:

(gdb) break gnu_ifunc
Breakpoint 4 at gnu-indirect-function resolver at 0x2aacb5a2

when gnu_ifunc has been resolved this should actually be:

(gdb) break gnu_ifunc
Breakpoint 4 at 0x868c

There are two reasons for this. The first is that ARM does not have a
separate .got.plt section so looking this up will always fail. The second
is that the Thumb bit needs to be stripped from the address to allow
it to be reliably compared when inserting into the ifunc cache.

Tested with no regressions on arm-linux-gnueabihf and
x86_64-unknown-linux-gnu.

gdb/ChangeLog:

2014-02-10  Will Newton  <will.newton@linaro.org>

	* elfread.c (elf_rel_plt_read): Look for a .got section if
	looking up .got.plt fails.
	(elf_gnu_ifunc_resolve_by_got): Call gdbarch_addr_bits_remove
	on address passed to elf_gnu_ifunc_record_cache.
	(elf_gnu_ifunc_resolve_addr): Likewise.
	(elf_gnu_ifunc_resolver_return_stop): Likewise.
2014-02-10 16:45:47 +00:00
Jose E. Marchesi 961842b289 Add gdbarch_in_function_epilogue_p hook for sparc64.
watchpoint_update and watchpoint_cond avoid checking for
watchpoints when we are located at a function epilogue in the
current frame.  This is done in order to avoid using corrupted
local registers and unwinding a corrupted/destroyed stack.

The code determining whether we are in a function epilogue is
provided by the backends via the gdbarch_in_function_epilogue_p
hook.  This commit adds such a hook for sparc64 targets.

2014-02-10  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* sparc-tdep.c (sparc_in_function_epilogue_p): New function.
	(X_RETTURN): New macro.
	* sparc-tdep.h: sparc_in_function_epilogue_p prototype.

	* sparc64-tdep.c (sparc64_init_abi): Hook
	sparc_in_function_epilogue_p.
2014-02-10 07:11:03 -08:00
Gary Benson 3f03e7b140 Fix compile error
This commit fixes a compile error introduced by my previous commit.

Checked in as obvious.

2014-02-10  Gary Benson  <gbenson@redhat.com>

	* symfile-debug.c (debug_qf_expand_symtabs_matching):
	Rename name_matcher to symbol_matcher.
2014-02-10 14:24:32 +00:00
Gary Benson 96f861efe0 Update debug_qf_expand_symtabs_matching to use typedefs.
Commit 206f2a5777 added two new
typedefs, but did not update debug_qf_expand_symtabs_matching
to use them.  This patch fixes this.

Checked in as obvious.

2014-02-10  Gary Benson  <gbenson@redhat.com>

	* symfile-debug.c (debug_qf_expand_symtabs_matching):
	Use expand_symtabs_file_matcher_ftype and
	expand_symtabs_symbol_matcher_ftype.
2014-02-10 14:07:44 +00:00
Joel Brobecker ee01b6652a [Ada] Make the symbol cache per-program-space.
This patch moves the Ada symbol cache to per-program-space data.

gdb/ChangeLog:

        * ada-lang.c (struct cache_entry, HASH_SIZE): Move definition up.
        (struct ada_symbol_cache): New.
        (ada_free_symbol_cache): Forward declare.
        (struct ada_pspace_data): New.
        (ada_pspace_data_handle): New static global.
        (get_ada_pspace_data, ada_pspace_data_cleanup)
        (ada_init_symbol_cache, ada_free_symbol_cache): New functions.
        (cache_space, cache): Delete, now folded inside struct
        ada_pspace_data.
        (ada_get_symbol_cache): New function.
        (ada_clear_symbol_cache, find_entry, cache_symbol): Adjust
        implementation.
        (_initialize_ada_language): Remove initialization of cache_space.
        Move call to observer_attach_inferior_exit up, grouping it
        with the other observer registrations inside this function.
        Rename command to be more general.  Add call to
        register_program_space_data_with_cleanup.
2014-02-10 18:04:26 +04:00
Joel Brobecker 143adbbfa3 [Ada] Rename some observer callbacks in ada-tasks.c
This patch is mostly cosmetic, avoiding us to use the same callback
names as in ada-lang.c.

gdb/ChangeLog:

        * ada-tasks.c (ada_tasks_new_objfile_observer): Renames
        ada_new_objfile_observer.
        (ada_tasks_normal_stop_observer): Renames ada_normal_stop_observer.
        (_initialize_tasks): Update uses of ada_new_objfile_observer
        and ada_tasks_normal_stop_observer.
2014-02-10 13:44:01 +04:00
Joel Brobecker aa4fb036e9 Wrong type for 'Length result.
Consider the following code:

   type Color is (Black, Red, Green, Blue, White);
   type Primary_Table is array (Color range Red .. Blue) of Boolean;
   Prim : Primary_Table := (True, False, False);

GDB prints the length of arrays in a fairly odd way:

   (gdb) p prim'length
   $2 = blue

The length returned should be an integer, not the array index type,
and this patch fixes this.

gdb/ChangeLog:

	* ada-lang.c (ada_evaluate_subexp): Set the type of the value
	returned by the 'Length attribute to integer.

testsuite/ChangeLog:

	* gdb.ada/tick_length_array_enum_idx: New testcase.
2014-02-10 13:15:43 +04:00
Joel Brobecker 9dee8cc6aa Add missing call to obstack_init for ada-lang.c::cache_space
This bit was meant to be merged with the following patch:

    commit 3d9434b5dd
    Subject: [Ada] Add a symbol lookup cache

... but I forgot :-(. This causes the cache to be undefined, and
with a bit of (bad) luck:

    % gdb
    (gdb) set lang ada
    (gdb) set $xxx := 1
    [SEGV]

gdb/ChangeLog:

        * ada-lang.c (_initialize_ada_language): Initialize
        cache_space obstack.
2014-02-10 12:57:13 +04:00
Joel Brobecker 3d9434b5dd [Ada] Add a symbol lookup cache
This patch implements the caching mechanism alluded to in a comment
next to some stubbed functions.

gdb/ChangeLog:

        * ada-lang.c (HASH_SIZE): New macro.
        (struct cache_entry): New type.
        (cache_space, cache): New static globals.
        (ada_clear_symbol_cache, find_entry): New functions.
        (lookup_cached_symbol, cache_symbol): Implement.
        (ada_new_objfile_observer, ada_free_objfile_observer): New.
        (_initialize_ada_language): Attach ada_new_objfile_observer
        and ada_free_objfile_observer.
2014-02-10 11:48:53 +04:00
Joel Brobecker f0c5f9b2b8 struct block parameter constification in ada-lang.c
This patch series constifies a number of struct block * parameters.

gdb/ChangeLog:

        * ada-lang.c (ada_add_block_symbols, add_defn_to_vec)
        (lookup_cached_symbol, ada_add_local_symbols): Add "const" to
        struct block * parameter.
        (ada_lookup_symbol_list_worker): Constify local variable "block".
        Remove cast which is no longer necessary.
2014-02-10 11:45:55 +04:00
Doug Evans ed3ef33944 Add Guile as an extension language.
* NEWS: Mention Guile scripting.
	* Makefile.in (SUBDIR_GUILE_OBS): New variable.
	(SUBDIR_GUILE_SRCS, SUBDIR_GUILE_DEPS): New variables
	(SUBDIR_GUILE_LDFLAGS, SUBDIR_GUILE_CFLAGS): New variables.
	(INTERNAL_CPPFLAGS): Add GUILE_CPPFLAGS.
	(CLIBS): Add GUILE_LIBS.
	(install-guile): New rule.
	(guile.o): New rule.
	(scm-arch.o, scm-auto-load.o, scm-block.o): New rules.
	(scm-breakpoint.o, scm-disasm.o, scm-exception.o): New rules.
	(scm-frame.o, scm-iterator.o, scm-lazy-string.o): New rules.
	(scm-math.o, scm-objfile.o, scm-ports.o): New rules.
	(scm-pretty-print.o, scm-safe-call.o, scm-gsmob.o): New rules.
	(scm-string.o, scm-symbol.o, scm-symtab.o): New rules.
	(scm-type.o, scm-utils.o, scm-value.o): New rules.
	* configure.ac: New option --with-guile.
	* configure: Regenerate.
	* config.in: Regenerate.
	* auto-load.c: Remove #include "python/python.h".  Add #include
	"gdb/section-scripts.h".
	(source_section_scripts): Handle Guile scripts.
	(_initialize_auto_load): Add name of Guile objfile script to
	scripts-directory help text.
	* breakpoint.c (condition_command): Tweak comment to include Scheme.
	* breakpoint.h (gdbscm_breakpoint_object): Add forward decl.
	(struct breakpoint): New member scm_bp_object.
	* defs.h (enum command_control_type): New value guile_control.
	* cli/cli-cmds.c: Remove #include "python/python.h".  Add #include
	"extension.h".
	(show_user): Update comment.
	(_initialize_cli_cmds): Update help text for "show user".  Update help
	text for max-user-call-depth.
	* cli/cli-script.c: Remove #include "python/python.h".  Add #include
	"extension.h".
	(multi_line_command_p): Add guile_control.
	(print_command_lines): Handle guile_control.
	(execute_control_command, recurse_read_control_structure): Ditto.
	(process_next_line): Recognize "guile" commands.
	* disasm.c (gdb_disassemble_info): Make non-static.
	* disasm.h: #include "dis-asm.h".
	(struct gdbarch): Add forward decl.
	(gdb_disassemble_info): Declare.
	* extension.c: #include "guile/guile.h".
	(extension_languages): Add guile.
	(get_ext_lang_defn): Handle EXT_LANG_GDB.
	* extension.h (enum extension_language): New value EXT_LANG_GUILE.
	* gdbtypes.c (get_unsigned_type_max): New function.
	(get_signed_type_minmax): New function.
	* gdbtypes.h (get_unsigned_type_max): Declare.
	(get_signed_type_minmax): Declare.
	* guile/README: New file.
	* guile/guile-internal.h: New file.
	* guile/guile.c: New file.
	* guile/guile.h: New file.
	* guile/scm-arch.c: New file.
	* guile/scm-auto-load.c: New file.
	* guile/scm-block.c: New file.
	* guile/scm-breakpoint.c: New file.
	* guile/scm-disasm.c: New file.
	* guile/scm-exception.c: New file.
	* guile/scm-frame.c: New file.
	* guile/scm-gsmob.c: New file.
	* guile/scm-iterator.c: New file.
	* guile/scm-lazy-string.c: New file.
	* guile/scm-math.c: New file.
	* guile/scm-objfile.c: New file.
	* guile/scm-ports.c: New file.
	* guile/scm-pretty-print.c: New file.
	* guile/scm-safe-call.c: New file.
	* guile/scm-string.c: New file.
	* guile/scm-symbol.c: New file.
	* guile/scm-symtab.c: New file.
	* guile/scm-type.c: New file.
	* guile/scm-utils.c: New file.
	* guile/scm-value.c: New file.
	* guile/lib/gdb.scm: New file.
	* guile/lib/gdb/boot.scm: New file.
	* guile/lib/gdb/experimental.scm: New file.
	* guile/lib/gdb/init.scm: New file.
	* guile/lib/gdb/iterator.scm: New file.
	* guile/lib/gdb/printing.scm: New file.
	* guile/lib/gdb/types.scm: New file.
	* data-directory/Makefile.in (GUILE_SRCDIR): New variable.
	(VPATH): Add $(GUILE_SRCDIR).
	(GUILE_DIR): New variable.
	(GUILE_INSTALL_DIR, GUILE_FILES): New variables.
	(all): Add stamp-guile dependency.
	(stamp-guile): New rule.
	(clean-guile, install-guile, uninstall-guile): New rules.
	(install-only): Add install-guile dependency.
	(uninstall): Add uninstall-guile dependency.
	(clean): Add clean-guile dependency.

	doc/
	* Makefile.in (GDB_DOC_FILES): Add guile.texi.
	* gdb.texinfo (Auto-loading): Add set/show auto-load guile-scripts.
	(Extending GDB): New menu entries Guile, Multiple Extension Languages.
	(Guile docs): Include guile.texi.
	(objfile-gdbdotext file): Add objfile-gdb.scm.
	(dotdebug_gdb_scripts section): Mention Guile scripts.
	(Multiple Extension Languages): New node.
	* guile.texi: New file.

	testsuite/
	* configure.ac (AC_OUTPUT): Add gdb.guile.
	* configure: Regenerate.
	* lib/gdb-guile.exp: New file.
	* lib/gdb.exp (get_target_charset): New function.
	* gdb.base/help.exp: Update expected output from "apropos apropos".
	* gdb.guile/Makefile.in: New file.
	* gdb.guile/guile.exp: New file.
	* gdb.guile/scm-arch.c: New file.
	* gdb.guile/scm-arch.exp: New file.
	* gdb.guile/scm-block.c: New file.
	* gdb.guile/scm-block.exp: New file.
	* gdb.guile/scm-breakpoint.c: New file.
	* gdb.guile/scm-breakpoint.exp: New file.
	* gdb.guile/scm-disasm.c: New file.
	* gdb.guile/scm-disasm.exp: New file.
	* gdb.guile/scm-equal.c: New file.
	* gdb.guile/scm-equal.exp: New file.
	* gdb.guile/scm-error.exp: New file.
	* gdb.guile/scm-error.scm: New file.
	* gdb.guile/scm-frame-args.c: New file.
	* gdb.guile/scm-frame-args.exp: New file.
	* gdb.guile/scm-frame-args.scm: New file.
	* gdb.guile/scm-frame-inline.c: New file.
	* gdb.guile/scm-frame-inline.exp: New file.
	* gdb.guile/scm-frame.c: New file.
	* gdb.guile/scm-frame.exp: New file.
	* gdb.guile/scm-generics.exp: New file.
	* gdb.guile/scm-gsmob.exp: New file.
	* gdb.guile/scm-iterator.c: New file.
	* gdb.guile/scm-iterator.exp: New file.
	* gdb.guile/scm-math.c: New file.
	* gdb.guile/scm-math.exp: New file.
	* gdb.guile/scm-objfile-script-gdb.in: New file.
	* gdb.guile/scm-objfile-script.c: New file.
	* gdb.guile/scm-objfile-script.exp: New file.
	* gdb.guile/scm-objfile.c: New file.
	* gdb.guile/scm-objfile.exp: New file.
	* gdb.guile/scm-ports.exp: New file.
	* gdb.guile/scm-pretty-print.c: New file.
	* gdb.guile/scm-pretty-print.exp: New file.
	* gdb.guile/scm-pretty-print.scm: New file.
	* gdb.guile/scm-section-script.c: New file.
	* gdb.guile/scm-section-script.exp: New file.
	* gdb.guile/scm-section-script.scm: New file.
	* gdb.guile/scm-symbol.c: New file.
	* gdb.guile/scm-symbol.exp: New file.
	* gdb.guile/scm-symtab-2.c: New file.
	* gdb.guile/scm-symtab.c: New file.
	* gdb.guile/scm-symtab.exp: New file.
	* gdb.guile/scm-type.c: New file.
	* gdb.guile/scm-type.exp: New file.
	* gdb.guile/scm-value-cc.cc: New file.
	* gdb.guile/scm-value-cc.exp: New file.
	* gdb.guile/scm-value.c: New file.
	* gdb.guile/scm-value.exp: New file.
	* gdb.guile/source2.scm: New file.
	* gdb.guile/types-module.cc: New file.
	* gdb.guile/types-module.exp: New file.
2014-02-09 19:40:01 -08:00
Yao Qi 7026a7c16e Fix PR16543
Tests in gdb.gdb fail because directory gdb/testsuite/gdb.gdb doesn't
exist in build tree.  This patch appends gdb.gdb/Makefile in AC_OUTPUT,
and adds new Makefile.in in gdb.gdb, so that directory gdb.gdb can be
created during configure.

With this patch applied, tests under gdb.gdb can be run,

$ make check RUNTESTFLAGS='--directory=gdb.gdb'

Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using ../../../../git/gdb/testsuite/config/unix.exp as tool-and-target-specific interface file.
Running ../../../../git/gdb/testsuite/gdb.gdb/complaints.exp ...
Running ../../../../git/gdb/testsuite/gdb.gdb/observer.exp ...
Running ../../../../git/gdb/testsuite/gdb.gdb/python-interrupts.exp ...
FAIL: gdb.gdb/python-interrupts.exp: signal SIGINT
Running ../../../../git/gdb/testsuite/gdb.gdb/python-selftest.exp ...
FAIL: gdb.gdb/python-selftest.exp: call catch_command_errors(execute_command, "python print 5", 0, RETURN_MASK_ALL)
Running ../../../../git/gdb/testsuite/gdb.gdb/selftest.exp ...
Running ../../../../git/gdb/testsuite/gdb.gdb/xfullpath.exp ...

                === gdb Summary ===

gdb/testsuite:

2014-02-10  Yao Qi  <yao@codesourcery.com>

	PR testsuite/16543
	* configure.ac: Append gdb.gdb/Makefile in AC_OUTPUT.
	* configure: Regenerated.
	* Makefile.in: New file.
2014-02-10 09:51:10 +08:00
Doug Evans ac020ec5ae Revert Makefile.in patch to remove all-lib.
Revert this patch (which I approved, mea culpa).

	2014-02-08  Mark Kettenis  <kettenis@gnu.org>

	* Makefile.in (all-lib): Remove.
	($(LIBGNU) $(GNULIB_H)): Replace with gits of remove all-lib target.
2014-02-09 17:39:08 -08:00
Jan Kratochvil 2a081c592c Fix Python stack corruption
The fix is obvious.

gdb/
2014-02-09  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix Python stack corruption.
	* python/py-linetable.c (ltpy_get_pcs_for_line, ltpy_has_line): Use
	gdb_py_longest.

Message-ID: <20140207171701.GA25187@host2.jankratochvil.net>
2014-02-09 18:47:40 +01:00
Mark Kettenis 0a6bd22df7 A phony target should not be a prerequisite of a real target file
gdb/ChangeLog:

	* Makefile.in (all-lib): Remove.
	($(LIBGNU) $(GNULIB_H)): Replace with gits of remove all-lib target.
2014-02-08 12:36:17 +01:00
Andreas Schwab 6c46644734 Fix typo in test name
* gdb.python/py-framefilter.exp: Fix typo.
2014-02-08 10:44:11 +01:00
Yao Qi 6e85473513 Test no =breakpoint-modified is emitted for modifications from MI commands
As design, =breakpoint-modified isn't emitted when breakpoints are modified
by MI commands.  This patch is to add tests for this.

gdb/testsuite:

2014-02-08  Yao Qi  <yao@codesourcery.com>

	* gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify): Test
	that no =breakpoint-modified is emitted when breakpoints are
	modified through MI commands.
2014-02-08 09:41:01 +08:00
Doug Evans caf5a49149 add forgotten entry in previous checkin
(active_ext_lang_state): Fix typo in comment.
2014-02-07 11:56:58 -08:00
Doug Evans 1a86040918 * extension-priv.h (extension_language_script_ops): Add comment.
(extension_language_ops): Add comment.
2014-02-07 11:44:46 -08:00
Pedro Alves d137e6dc79 Make sure we don't resume the stepped thread by accident.
Say:

<stopped at a breakpoint in thread 2>
(gdb) thread 3
(gdb) step

The above triggers the prepare_to_proceed/deferred_step_ptid process,
which switches back to thread 2, to step over its breakpoint before
getting back to thread 3 and "step" it.

If while stepping over the breakpoint in thread 2, a signal arrives,
and it is set to pass/nostop, we'll set a step-resume breakpoint at
the supposed signal-handler resume address, and call keep_going.  The
problem is that we were supposedly stepping thread 3, and that
keep_going delivers a signal to thread 2, and due to scheduler-locking
off, resumes everything else, _including_ thread 3, the thread we want
stepping.  This means that we lose control of thread 3 until the next
event, when we stop everything.  The end result for the user, is that
GDB lost control of the "step".

Here's the current infrun debug output of the above, with the testcase
in the patch below:

infrun: clear_proceed_status_thread (Thread 0x2aaaab8f5700 (LWP 11663))
infrun: clear_proceed_status_thread (Thread 0x2aaaab6f4700 (LWP 11662))
infrun: clear_proceed_status_thread (Thread 0x2aaaab4f2b20 (LWP 11659))
infrun: proceed (addr=0xffffffffffffffff, signal=144, step=1)
infrun: prepare_to_proceed (step=1), switched to [Thread 0x2aaaab6f4700 (LWP 11662)]
infrun: resume (step=1, signal=0), trap_expected=1, current thread [Thread 0x2aaaab6f4700 (LWP 11662)] at 0x40098f
infrun: wait_for_inferior ()
infrun: target_wait (-1, status) =
infrun:   11659 [Thread 0x2aaaab6f4700 (LWP 11662)],
infrun:   status->kind = stopped, signal = SIGUSR1
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x40098f
infrun: random signal 30

Program received signal SIGUSR1, User defined signal 1.
infrun: signal arrived while stepping over breakpoint
infrun: inserting step-resume breakpoint at 0x40098f
infrun: resume (step=0, signal=30), trap_expected=0, current thread [Thread 0x2aaaab6f4700 (LWP 11662)] at 0x40098f

^^^ this is a wildcard resume.

infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun:   11659 [Thread 0x2aaaab6f4700 (LWP 11662)],
infrun:   status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x40098f
infrun: BPSTAT_WHAT_STEP_RESUME
infrun: resume (step=1, signal=0), trap_expected=1, current thread [Thread 0x2aaaab6f4700 (LWP 11662)] at 0x40098f

^^^ step-resume hit, meaning the handler returned, so we go back to stepping thread 3.

infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun:   11659 [Thread 0x2aaaab6f4700 (LWP 11662)],
infrun:   status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED

infrun: stop_pc = 0x40088b
infrun: switching back to stepped thread
infrun: Switching context from Thread 0x2aaaab6f4700 (LWP 11662) to Thread 0x2aaaab8f5700 (LWP 11663)
infrun: resume (step=1, signal=0), trap_expected=0, current thread [Thread 0x2aaaab8f5700 (LWP 11663)] at 0x400938
infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun:   11659 [Thread 0x2aaaab8f5700 (LWP 11663)],
infrun:   status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x40093a
infrun: keep going
infrun: resume (step=1, signal=0), trap_expected=0, current thread [Thread 0x2aaaab8f5700 (LWP 11663)] at 0x40093a
infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun:   11659 [Thread 0x2aaaab8f5700 (LWP 11663)],
infrun:   status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x40091e
infrun: stepped to a different line
infrun: stop_stepping
[Switching to Thread 0x2aaaab8f5700 (LWP 11663)]
69            (*myp) ++; /* set breakpoint child_two here */

^^^ we stopped at the wrong line.  We still stepped a bit because the
test is running in a loop, and when we got back to stepping thread 3,
it happened to be in the stepping range.  (The loop increments a
counter, and the test makes sure it increments exactly once.  Without
the fix, the counter increments a bunch, since the user-stepped thread
runs free without GDB noticing.)

The fix is to switch to the stepping thread before continuing for the
step-resume breakpoint.

gdb/
2014-02-07  Pedro Alves  <palves@redhat.com>

	* infrun.c (handle_signal_stop) <signal arrives while stepping
	over a breakpoint>: Switch back to the stepping thread.

gdb/testsuite/
2014-02-07  Pedro Alves  <pedro@codesourcery.com>
	    Pedro Alves  <palves@redhat.com>

	* gdb.threads/step-after-sr-lock.c: New file.
	* gdb.threads/step-after-sr-lock.exp: New file.
2014-02-07 19:35:30 +00:00
Pedro Alves b5ee5a50d4 Fix gdb.threads/stepi-random-signal.exp on software single-step targets.
Currently on software single-step Linux targets we get:

 (gdb) PASS: gdb.threads/stepi-random-signal.exp: before stepi: get hexadecimal valueof "$pc"
 stepi
 infrun: clear_proceed_status_thread (Thread 0x7ffff7fca700 (LWP 7073))
 infrun: clear_proceed_status_thread (Thread 0x7ffff7fcb740 (LWP 7069))
 infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT, step=1)
 infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff7fcb740 (LWP 7069)] at 0x400700
 infrun: wait_for_inferior ()
 infrun: target_wait (-1, status) =
 infrun:   7069 [Thread 0x7ffff7fcb740 (LWP 7069)],
 infrun:   status->kind = stopped, signal = GDB_SIGNAL_TRAP
 infrun: infwait_normal_state
 infrun: TARGET_WAITKIND_STOPPED
 infrun: stop_pc = 0x400704
 infrun: software single step trap for Thread 0x7ffff7fcb740 (LWP 7069)
 infrun: stepi/nexti
 infrun: stop_stepping
 44        while (counter != 0)
 (gdb) FAIL: gdb.threads/stepi-random-signal.exp: stepi (no random signal)

Vs hardware-step targets:

 (gdb) PASS: gdb.threads/stepi-random-signal.exp: before stepi: get hexadecimal valueof "$pc"
 stepi
 infrun: clear_proceed_status_thread (Thread 0x7ffff7fca700 (LWP 9565))
 infrun: clear_proceed_status_thread (Thread 0x7ffff7fcb740 (LWP 9561))
 infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT, step=1)
 infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff7fcb740 (LWP 9561)] at 0x400700
 infrun: wait_for_inferior ()
 infrun: target_wait (-1, status) =
 infrun:   9561 [Thread 0x7ffff7fcb740 (LWP 9561)],
 infrun:   status->kind = stopped, signal = GDB_SIGNAL_CHLD
 infrun: infwait_normal_state
 infrun: TARGET_WAITKIND_STOPPED
 infrun: stop_pc = 0x400700
 infrun: random signal (GDB_SIGNAL_CHLD)
 infrun: random signal, keep going
 infrun: resume (step=1, signal=GDB_SIGNAL_CHLD), trap_expected=0, current thread [Thread 0x7ffff7fcb740 (LWP 9561)] at 0x400700
 infrun: prepare_to_wait
 infrun: target_wait (-1, status) =
 infrun:   9561 [Thread 0x7ffff7fcb740 (LWP 9561)],
 infrun:   status->kind = stopped, signal = GDB_SIGNAL_TRAP
 infrun: infwait_normal_state
 infrun: TARGET_WAITKIND_STOPPED
 infrun: stop_pc = 0x400704
 infrun: stepi/nexti
 infrun: stop_stepping
 44        while (counter != 0)
 (gdb) PASS: gdb.threads/stepi-random-signal.exp: stepi

The test turns on infrun debug, does a stepi while a SIGCHLD is
pending, and checks whether the "random signal" paths in infrun.c are
taken.

On the software single-step variant above, those paths were not taken.

This is a test bug.

The Linux backend short-circuits reporting signals that are set to
pass/nostop/noprint.  But _only_ if the thread is _not_
single-stepping.  So on hardware-step targets, even though the signal
is set to pass/nostop/noprint by default, the thread is indeed told to
single-step, and so the core sees the signal.  On the other hand, on
software single-step architectures, the backend never actually gets a
single-step request (steps are emulated by setting a breakpoint at the
next pc, and then the target told to continue, not step).  So the
short-circuiting code triggers and the core doesn't see the signal.

The fix is to make the test be sure the target doesn't bypass
reporting the signal to the core.

Tested on x86_64 Fedora 17, both with and without a series that
implements software single-step for x86_64.

gdb/testsuite/
2014-02-07  Pedro Alves  <palves@redhat.com>

	* gdb.threads/stepi-random-signal.exp: Set SIGCHLD to print.
2014-02-07 19:04:10 +00:00
Yao Qi ce6d08922f Return early in target_xfer_partial when LEN is zero.
Nowadays, argument LEN of to_xfer_partial can be zero in some cases,
and each implementation may do nothing and return zero, indicating
transfer is done.  That is fine.  However, when we change
to_xfer_partial to return target_xfer_status, we have to check every
return value of most of to_xfer_partial implementations, return
TARGET_XFER_DONE if return value is zero.

This patch simplifies this by checking LEN in target_xfer_partial, and
return 0 if LEN is zero.  Regression tested on x86_84-linux.  Is it
OK?

gdb:

2014-02-07  Yao Qi  <yao@codesourcery.com>

	* target.c (target_xfer_partial): Return zero if LEN is zero.
2014-02-07 11:19:58 +08:00
Yao Qi 2ed4b5488f Replace -1 with TARGET_XFER_E_IO
Hi,
This patch replaces -1 with TARGET_XFER_E_IO in the implementations of
to_xfer_partial and their callees.  This change is quite mechanical,
and makes the next patch shorter.

gdb:

2014-02-07  Yao Qi  <yao@codesourcery.com>

	* auxv.c (procfs_xfer_auxv): Replace -1 with TARGET_XFER_E_IO.
	(ld_so_xfer_auxv): Likewise.
	* bfd-target.c (target_bfd_xfer_partial): Likewise.
	* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
	* corelow.c (core_xfer_partial): Likewise.
	* ctf.c (ctf_xfer_partial): Likewise.
	* darwin-nat.c (darwin_read_dyld_info): Likewise.
	(darwin_xfer_partial): Likewise.
	* exec.c (exec_xfer_partial): Likewise.
	* gnu-nat.c (gnu_xfer_partial): Likewise.
	* ia64-hpux-nat.c (ia64_hpux_xfer_uregs): Likewise.
	* inf-ptrace.c (inf_ptrace_xfer_partial): Likewise.
	* inf-ttrace.c (inf_ttrace_xfer_partial): Likewise.
	* linux-nat.c (linux_xfer_siginfo): Likewise.
	(linux_proc_xfer_spu): Likewise.
	* procfs.c (procfs_xfer_partial): Likewise.
	* record-full.c (record_full_xfer_partial): Likewise.
	(record_full_core_xfer_partial): Likewise.
	* remote-sim.c (gdbsim_xfer_partial): Likewise.
	* remote.c (remote_write_qxfer): Likewise.
	(remote_write_qxfer, remote_read_qxfer): Likewise.
	(remote_xfer_partial): Likewise.
	* rs6000-nat.c (rs6000_xfer_partial): Likewise.
	(rs6000_xfer_shared_libraries): Likewise.
	* sparc-nat.c (sparc_xfer_wcookie): Likewise.
	* spu-linux-nat.c (spu_proc_xfer_spu): Likewise.
	(spu_xfer_partial): Likewise.
	* target.c (memory_xfer_partial_1): Likewise.
	* tracepoint.c (tfile_xfer_partial): Likewise.
	* windows-nat.c (windows_xfer_shared_libraries): Likewise.
	(windows_xfer_partial): Likewise.
2014-02-07 11:19:58 +08:00
Yao Qi c09f20e469 core_xfer_shared_libraries and core_xfer_shared_libraries_aix returns ULONGEST
This patch documents the return value of core_xfer_shared_libraries_aix
and core_xfer_shared_libraries gdbarch methods, and changes return
type to ULONGEST from LONGEST.

In a following patch, core_xfer_partial. is changed to check their
return values and return an appropriate target_xfer_status.

gdb:

2014-02-07  Yao Qi  <yao@codesourcery.com>

	* gdbarch.sh (core_xfer_shared_libraries): Returns ULONGEST.  Add
	comments.
	(core_xfer_shared_libraries_aix): Likewise.
	* gdbarch.c, gdbarch.h: Regenerated.
	* i386-cygwin-tdep.c (windows_core_xfer_shared_libraries): Return
	ULONGEST.  Change 'len_avail' type to ULONGEST.
	* rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise.
	* rs6000-aix-tdep.h (rs6000_aix_ld_info_to_xml): Update
	declaration.
	(rs6000_aix_core_xfer_shared_libraries_aix): Return ULONGEST.
2014-02-07 11:19:57 +08:00
Yao Qi 8635b3bf59 Tweak in memory_error
This patch adds a local variable exception of type 'enum errors' and
pass it to throw_error, because 'err' is of type
'enum target_xfer_error', and we're abusing it to store an 'enum errors'.

gdb:

2014-02-07  Yao Qi  <yao@codesourcery.com>

	* corefile.c (memory_error): Get 'exception' from ERR and pass
	'exception' to throw_error.
2014-02-07 11:19:57 +08:00
Jan Kratochvil 3c77faf33d Fix i386-sse-stack-align.exp regression since GDB_PARALLEL.
gdb/testsuite/
2014-02-06  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix i386-sse-stack-align.exp regression since GDB_PARALLEL.
	* gdb.arch/i386-sse-stack-align.exp: Use standard_output_file.
2014-02-06 23:14:20 +01:00
Tom Tromey e99dc82053 indentation fixlet in gdbserver/Makefile.in.
This fixes a minor indentation issue in gdbserver/Makefile.in.

2014-02-06  Tom Tromey  <tromey@redhat.com>

	* Makefile.in (SFILES): Fix indentation.
2014-02-06 12:04:50 -07:00
Doug Evans 4f8fcb74d3 fix copyright year in new files in previous checkin 2014-02-05 20:17:30 -08:00
Doug Evans 6dddc817c1 Extension Language API
* configure.ac (libpython checking): Remove all but python.o from
	CONFIG_OBS.  Remove all but python.c from CONFIG_SRCS.
	* configure: Regenerate.

	* Makefile.in (SFILES): Add extension.c.
	(HFILES_NO_SRCDIR): Add extension.h, extension-priv.h
	(COMMON_OBS): Add extension.o.
	* extension.h: New file.
	* extension-priv.h: New file.
	* extension.c: New file.

	* python/python-internal.h: #include "extension.h".
	(gdbpy_auto_load_enabled): Declare.
	(gdbpy_apply_val_pretty_printer): Declare.
	(gdbpy_apply_frame_filter): Declare.
	(gdbpy_preserve_values): Declare.
	(gdbpy_breakpoint_cond_says_stop): Declare.
	(gdbpy_breakpoint_has_cond): Declare.
	(void source_python_script_for_objfile): Delete.
	* python/python.c: #include "extension-priv.h".
	Delete inclusion of "observer.h".
	(extension_language_python): Moved here and renamed from
	script_language_python in py-auto-load.c.
	Redefined to be of type extension_language_defn.
	(python_extension_script_ops): New global.
	(python_extension_ops): New global.
	(struct python_env): New member previous_active.
	(restore_python_env): Call restore_active_ext_lang.
	(ensure_python_env): Call set_active_ext_lang.
	(gdbpy_clear_quit_flag): Renamed from clear_quit_flag, made static.
	New arg extlang.
	(gdbpy_set_quit_flag): Renamed from set_quit_flag, made static.
	New arg extlang.
	(gdbpy_check_quit_flag): Renamed from check_quit_flag, made static.
	New arg extlang.
	(gdbpy_eval_from_control_command): Renamed from
	eval_python_from_control_command, made static.  New arg extlang.
	(gdbpy_source_script) Renamed from source_python_script, made static.
	New arg extlang.
	(gdbpy_before_prompt_hook): Renamed from before_prompt_hook.  Change
	result to int.  New arg extlang.
	(gdbpy_source_objfile_script): Renamed from
	source_python_script_for_objfile, made static.  New arg extlang.
	(gdbpy_start_type_printers): Renamed from start_type_printers, made
	static.  New args extlang, extlang_printers.  Change result type to
	"void".
	(gdbpy_apply_type_printers): Renamed from apply_type_printers, made
	static.  New arg extlang.  Rename arg printers to extlang_printers
	and change type to ext_lang_type_printers *.
	(gdbpy_free_type_printers): Renamed from free_type_printers, made
	static.  Replace argument arg with extlang, extlang_printers.
	(!HAVE_PYTHON, eval_python_from_control_command): Delete.
	(!HAVE_PYTHON, source_python_script): Delete.
	(!HAVE_PYTHON, gdbpy_should_stop): Delete.
	(!HAVE_PYTHON, gdbpy_breakpoint_has_py_cond): Delete.
	(!HAVE_PYTHON, start_type_printers): Delete.
	(!HAVE_PYTHON, apply_type_printers): Delete.
	(!HAVE_PYTHON, free_type_printers): Delete.
	(_initialize_python): Delete call to observer_attach_before_prompt.
	(finalize_python): Set/restore active extension language.
	(gdbpy_finish_initialization) Renamed from
	finish_python_initialization, made static.  New arg extlang.
	(gdbpy_initialized): New function.
	* python/python.h: #include "extension.h".  Delete #include
	"value.h", "mi/mi-cmds.h".
	(extension_language_python): Declare.
	(GDBPY_AUTO_FILE_NAME): Delete.
	(enum py_bt_status): Moved to extension.h and renamed to
	ext_lang_bt_status.
	(enum frame_filter_flags): Moved to extension.h.
	(enum py_frame_args): Moved to extension.h and renamed to
	ext_lang_frame_args.
	(finish_python_initialization): Delete.
	(eval_python_from_control_command): Delete.
	(source_python_script): Delete.
	(apply_val_pretty_printer): Delete.
	(apply_frame_filter): Delete.
	(preserve_python_values): Delete.
	(gdbpy_script_language_defn): Delete.
	(gdbpy_should_stop, gdbpy_breakpoint_has_py_cond): Delete.
	(start_type_printers, apply_type_printers, free_type_printers): Delete.

	* auto-load.c: #include "extension.h".
	(GDB_AUTO_FILE_NAME): Delete.
	(auto_load_gdb_scripts_enabled): Make public.  New arg extlang.
	(script_language_gdb): Delete, moved to extension.c and renamed to
	extension_language_gdb.
	(source_gdb_script_for_objfile): Delete.
	(auto_load_pspace_info): New member unsupported_script_warning_printed.
	(loaded_script): Change type of language member to
	struct extension_language_defn *.
	(init_loaded_scripts_info): Initialize
	unsupported_script_warning_printed.
	(maybe_add_script): Make static.  Change type of language arg to
	struct extension_language_defn *.
	(clear_section_scripts): Reset unsupported_script_warning_printed.
	(auto_load_objfile_script_1): Rewrite to use extension language API.
	(auto_load_objfile_script): Make public.  Remove support-compiled-in
	and auto-load-enabled checks, moved to auto_load_scripts_for_objfile.
	(source_section_scripts): Rewrite to use extension language API.
	(load_auto_scripts_for_objfile): Rewrite to use
	auto_load_scripts_for_objfile.
	(collect_matching_scripts_data): Change type of language member to
	struct extension_language_defn *.
	(auto_load_info_scripts): Change type of language arg to
	struct extension_language_defn *.
	(unsupported_script_warning_print): New function.
	(script_not_found_warning_print): Make static.
	(_initialize_auto_load): Rewrite construction of scripts-directory
	help.
	* auto-load.h (struct objfile): Add forward decl.
	(struct script_language): Delete.
	(struct auto_load_pspace_info): Add forward decl.
	(struct extension_language_defn): Add forward decl.
	(maybe_add_script): Delete.
	(auto_load_objfile_script): Declare.
	(script_not_found_warning_print): Delete.
	(auto_load_info_scripts): Update prototype.
	(auto_load_gdb_scripts_enabled): Declare.
	* python/py-auto-load.c (gdbpy_auto_load_enabled): Renamed from
	auto_load_python_scripts_enabled and made public.
	(script_language_python): Delete, moved to python.c.
	(gdbpy_script_language_defn): Delete.
	(info_auto_load_python_scripts): Update to use
	extension_language_python.

	* breakpoint.c (condition_command): Replace call to
	gdbpy_breakpoint_has_py_cond with call to get_breakpoint_cond_ext_lang.
	(bpstat_check_breakpoint_conditions): Replace call to gdbpy_should_stop
	with call to breakpoint_ext_lang_cond_says_stop.
	* python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Renamed
	from gdbpy_should_stop.  Change result type to enum scr_bp_stop.
	New arg slang.  Return SCR_BP_STOP_UNSET if py_bp_object is NULL.
	(gdbpy_breakpoint_has_cond): Renamed from gdbpy_breakpoint_has_py_cond.
	New arg slang.
	(local_setattro): Print name of extension language with existing
	stop condition.

	* valprint.c (val_print, value_print): Update to call
	apply_ext_lang_val_pretty_printer.
	* cp-valprint.c (cp_print_value): Update call to
	apply_ext_lang_val_pretty_printer.
	* python/py-prettyprint.c: Remove #ifdef HAVE_PYTHON.
	(gdbpy_apply_val_pretty_printer): Renamed from
	apply_val_pretty_printer.  New arg extlang.
	(!HAVE_PYTHON, apply_val_pretty_printer): Delete.

	* cli/cli-cmds.c (source_script_from_stream): Rewrite to use
	extension language API.
	* cli/cli-script.c (execute_control_command): Update to call
	eval_ext_lang_from_control_command.

	* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Update to use
	enum ext_lang_bt_status values.  Update call to
	apply_ext_lang_frame_filter.
	(mi_cmd_stack_list_locals): Ditto.
	(mi_cmd_stack_list_args): Ditto.
	(mi_cmd_stack_list_variables): Ditto.
	* mi/mi-main.c: Delete #include "python/python-internal.h".
	Add #include "extension.h".
	(mi_cmd_list_features): Replace reference to python internal variable
	gdb_python_initialized with call to ext_lang_initialized_p.

	* stack.c (backtrace_command_1): Update to use enum ext_lang_bt_status.
	Update to use enum ext_lang_frame_args.  Update to call
	apply_ext_lang_frame_filter.
	* python/py-framefilter.c (extract_sym): Update to use enum
	ext_lang_bt_status.
	(extract_value, py_print_type, py_print_value): Ditto.
	(py_print_single_arg, enumerate_args, enumerate_locals): Ditto.
	(py_mi_print_variables, py_print_locals, py_print_args): Ditto.
	(py_print_frame): Ditto.
	(gdbpy_apply_frame_filter): Renamed from apply_frame_filter.
	New arg extlang.  Update to use enum ext_lang_bt_status.

	* top.c (gdb_init): Delete #ifdef HAVE_PYTHON call to
	finish_python_initialization.  Replace with call to
	finish_ext_lang_initialization.

	* typeprint.c (do_free_global_table): Update to call
	free_ext_lang_type_printers.
	(create_global_typedef_table): Update to call
	start_ext_lang_type_printers.
	(find_global_typedef): Update to call apply_ext_lang_type_printers.
	* typeprint.h (struct ext_lang_type_printers): Add forward decl.
	(type_print_options): Change type of global_printers from "void *"
	to "struct ext_lang_type_printers *".

	* value.c (preserve_values): Update to call preserve_ext_lang_values.
	* python/py-value.c: Remove #ifdef HAVE_PYTHON.
	(gdbpy_preserve_values): Renamed from preserve_python_values.
	New arg extlang.
	(!HAVE_PYTHON, preserve_python_values): Delete.

	* utils.c (quit_flag): Delete, moved to extension.c.
	(clear_quit_flag, set_quit_flag, check_quit_flag): Delete, moved to
	extension.c.

	* eval.c: Delete #include "python/python.h".
	* main.c: Delete #include "python/python.h".

	* defs.h: Update comment.

	testsuite/

	* gdb.python/py-breakpoint.exp (test_bkpt_eval_funcs): Update expected
	output.

	* gdb.gdb/python-interrupts.exp: New file.
2014-02-05 19:27:58 -08:00
Joel Brobecker 6af7998535 Document the GDB 7.7 release in gdb/ChangeLog
gdb/ChangeLog:

	GDB 7.7 released.
2014-02-06 06:48:24 +04:00
Doug Evans ee1e2d4fb6 Keep current_inferior in sync with event_child.
* linux-low.c (linux_wait_for_event): Improve comment.
	(linux_wait_1): Keep current_inferior in sync with event_child.
2014-02-05 16:08:59 -08:00
Mark Kettenis 12c5175d68 Avoid bison-isms when using yacc.
YYPRINT is a bison-ism so c_print_token() ends up being unused when yacc is
used which makes gcc unhappy.  Make sure we only define YYPRINT and
c_print_token() when bison is used to generate the parser.

gdb/ChangeLog:

        * c-exp.y (YYPRINT, c_print_token): Only define if YYBISON is
        defined.
2014-02-05 13:32:48 +01:00
Yao Qi 8dc5b31971 Use rs->buf after getpkt
Hi,
The following code snippet looks wrong to me

 char *buf = rs->buf;

 getpkt (&rs->buf, &rs->buf_size, 0);
 packet_ok (buf, );

if rs->buf is reallocated in getpkt, buf points to an out of dated
memory.  This patch removes local 'buf' and uses rs->buf.

gdb:

2014-02-05  Yao Qi  <yao@codesourcery.com>

	* remote.c (remote_pass_signals): Remove local 'buf' and use
	rs->buf.
	(remote_program_signals): Likewise.
2014-02-05 20:25:47 +08:00
Yao Qi de7b289385 Create inferior for ctf target.
This patch creates inferior when GDB opens a ctf trace data, to be
consistent with tfile target.  A test case is added to test for
live target, tfile and ctf target.

gdb:

2014-02-05  Yao Qi  <yao@codesourcery.com>

	* ctf.c: Include "inferior.h" and "gdbthread.h".
	(CTF_PID): A new macro.
	(ctf_open): Call inferior_appeared and add_thread_silent.
	(ctf_close): Call exit_inferior_silent and set inferior_ptid.
	(ctf_thread_alive): New function.
	(init_ctf_ops): Install ctf_thread_alive to to_thread_alive.

gdb/testsuite:

2014-02-05  Yao Qi  <yao@codesourcery.com>

	* gdb.trace/report.exp (use_collected_data): Test the output
	of "info threads" and "info inferiors".
2014-02-05 19:37:25 +08:00
Yao Qi 66d032ac62 Create inferior for tfile target
When a trace file is loaded in Eclipse, it is expected to see thread
and process (=thread-group-started and =thread-created).  Create an
inferior and add a thread for this purpose.

This patch just reverts my previous patch.

gdb/testsuite:

2014-02-05  Yao Qi  <yao@codesourcery.com>

	Revert this patch:

	2013-05-24  Yao Qi  <yao@codesourcery.com>

	* gdb.trace/tfile.exp: Test inferior and thread.

gdb:

2014-02-05  Yao Qi  <yao@codesourcery.com>

	Revert this patch:

	2013-05-24  Yao Qi  <yao@codesourcery.com>

	* 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.
2014-02-05 19:35:39 +08:00
Christian Eggers f4ccffad18 Call remote_check_symbols even if only symbol-file (not file) has been given
The Eclipse "C/C++ GDB Hardware Debugging" plugin runs only the
"symbol-file" command.  In this case, remote_check_symbols is not
called and no qSymbol:: packet is sent to the server (OpenOCD in my
case).

gdb/
2014-02-04  Christian Eggers  <ceggers@gmx.de>  (tiny change)

	* remote.c (remote_start_remote): Call remote_check_symbols even
	if only symbol-file (not file) has been given.
2014-02-04 19:42:12 +00:00
Ulrich Weigand 591a12a1d4 PowerPC64 ELFv2 ABI: skip global entry point code
This patch handles another aspect of the ELFv2 ABI, which unfortunately
requires common code changes.

In ELFv2, functions may provide both a global and a local entry point.
The global entry point (where the function symbol points to) is intended
to be used for function-pointer or cross-module (PLT) calls, and requires
r12 to be set up to the entry point address itself.   The local entry
point (which is found at a fixed offset after the global entry point,
as defined by bits in the symbol table entries' st_other field), instead
expects r2 to be set up to the current TOC.

Now, when setting a breakpoint on a function by name, you really want
that breakpoint to trigger either way, no matter whether the function
is called via its local or global entry point.  Since the global entry
point will always fall through into the local entry point, the way to
achieve that is to simply set the breakpoint at the local entry point.

One way to do that would be to have prologue parsing skip the code
sequence that makes up the global entry point.  Unfortunately, this
does not work reliably, since -for optimized code- GDB these days
will not actuall invoke the prologue parsing code but instead just
set the breakpoint at the symbol address and rely on DWARF being
correct at any point throughout the function ...

Unfortunately, I don't really see any way to express the notion of
local entry points with the current set of gdbarch callbacks.

Thus this patch adds a new callback, skip_entrypoint, that is
somewhat analogous to skip_prologue, but is called every time
GDB needs to determine a function start address, even in those
cases where GDB decides to not call skip_prologue.

As a side effect, the skip_entrypoint implementation on ppc64
does not need to perform any instruction parsing; it can simply
rely on the local entry point flags in the symbol table entry.

With this implemented, two test cases would still fail to set
the breakpoint correctly, but that's because they use the construct:

 gdb_test "break *hello"

Now, using "*hello" explicitly instructs GDB to set the breakpoint
at the numerical value of "hello" treated as function pointer, so
it will by definition only hit the global entry point.

I think this behaviour is unavoidable, but acceptable -- most people
do not use this construct, and if they do, they get what they
asked for ...

In one of those two test cases, use of this construct is really
not appropriate.  I think this was added way back when as a means
to work around prologue skipping problems on some platforms.  These
days that shouldn't really be necessary any more ...

For the other (step-bt), we really want to make sure backtracing
works on the very first instruction of the routine.  To enable that
test also on powerpc64le-linux, we can modify the code to call the
test function via function pointer (which makes it use the global
entry point in the ELFv2 ABI).

gdb/ChangeLog:

	* gdbarch.sh (skip_entrypoint): New callback.
	* gdbarch.c, gdbarch.h: Regenerate.
	* symtab.c (skip_prologue_sal): Call gdbarch_skip_entrypoint.
	* infrun.c (fill_in_stop_func): Likewise.
	* ppc-linux-tdep.c: Include "elf/ppc64.h".
	(ppc_elfv2_elf_make_msymbol_special): New function.
	(ppc_elfv2_skip_entrypoint): Likewise.
	(ppc_linux_init_abi): Install them for ELFv2.

gdb/testsuite/ChangeLog:

	* gdb.base/sigbpt.exp: Do not use "*" when setting breakpoint
	on a function.
	* gdb.base/step-bt.c: Call hello via function pointer to make
	sure its first instruction is executed on powerpc64le-linux.
2014-02-04 18:44:14 +01:00
Ulrich Weigand cc0e89c519 PowerPC64 ELFv2 ABI: structure passing / return
Another significant difference in the ELFv2 ABI is that "homogeneous"
floating-point and vector aggregates, i.e. aggregates the consist
(recursively) only of members of the same floating-point or vector type,
are passed in a series of floating-point / vector registers, as if they
were seperate parameters.  (This is similar to the ARM ABI.)  This
applies to both calls and returns.

In addition when returning any aggregate of up to 16 bytes, ELFv2 now
used general-purpose registers.

This patch adds support for these aspects of the ABI, which is relatively
straightforward after the refactoring patch to ppc-sysv-tdep.c.

gdb/ChangeLog:

	* ppc-sysv-tdep.c (ppc64_aggregate_candidate): New routine.
	(ppc64_elfv2_abi_homogeneous_aggregate): Likewise.
	(ppc64_sysv_abi_push_param): Handle ELFv2 homogeneous structs.
	(ppc64_sysv_abi_return_value): Likewise.  Also, handle small
	structures returned in GPRs.
2014-02-04 18:42:35 +01:00
Ulrich Weigand 52f548e41f PowerPC64 ELFv2 ABI: stack frame layout changes
This implementes another change in ELFv2: the stack frame no longer
contains the reserved double words for linker and compiler use
(which weren't really used for much of anything anyway).  This
affects placement of on-stack parameters in inferior calls.

gdb/ChangeLog:

	* ppc-sysv-tdep.c (ppc64_sysv_abi_push_dummy_call): Use correct
	offset to the stack parameter list for the ELFv2 ABI.
2014-02-04 18:41:36 +01:00
Ulrich Weigand d4094b6a88 PowerPC64 ELFv2 ABI: no function descriptors
This implements the most significant difference with the ELFv2 ABI:
we no longer use function descriptors.  The patch consists mostly
of switching off code to deal with descriptors :-)

In addition, when calling an inferior function, we no longer need
to provide its TOC in r2.  Instead, ELFv2 code expects to be called
with r12 pointing to the code address itself.

gdb/ChangeLog:

	* ppc-linux-tdep.c (ppc_linux_init_abi): Only call
	set_gdbarch_convert_from_func_ptr_addr and
	set_gdbarch_elf_make_msymbol_special for ELFv1.
	* ppc-sysv-tdep.c (ppc64_sysv_abi_push_param): Only handle
	function descriptors on ELFv1.
	(ppc64_sysv_abi_push_dummy_call): Likewise.  On ELFv2,
	set up r12 at function entry.
2014-02-04 18:40:16 +01:00
Ulrich Weigand cd453cd072 PowerPC64 ELFv2 ABI: base support
This is the first patch of a series to implement support for the
PowerPC ELFv2 ABI.  While powerpc64le-linux will use ELFv2, and
the existing powerpc64-linux code will continue to use ELFv1,
in theory ELFv2 is also defined for big-endian systems (and
ELFv1 was also defined for little-endian systems).

Therefore this patch adds a new tdep->elf_abi variable to decide
which ABI version to use.  This is detected from the ELF header
e_flags value; if this is not present, we default to ELFv2 on
little-endian and ELFv1 otherwise.

This patch does not yet introduce any actual difference in GDB's
handling of the two ABIs.  Those will be added by the remainder
of this patch series.

For an overview of the changes in ELFv2, have a look at the
comments in the patch series that added ELFv2 to GCC, starting at:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01144.html

gdb/ChangeLog:

	* ppc-tdep.h (enum powerpc_elf_abi): New data type.
	(struct gdbarch_tdep): New member elf_abi.

	* rs6000-tdep.c: Include "elf/ppc64.h".
	(rs6000_gdbarch_init): Detect ELF ABI version.
2014-02-04 18:38:56 +01:00
Ulrich Weigand 0ff3e01fdc PowerPC64 little-endian fixes: 128-bit DFP parameters / registers
The powerpc64le-linux ABI specifies that when a 128-bit DFP value is
passed in a pair of floating-point registers, the first register holds
the most-significant part of the value.  This is as opposed to the
usual rule on little-endian systems, where the first register would
hold the least-significant part.

This affects two places in GDB, the read/write routines for the
128-bit DFP pseudo-registers, and the function call / return
sequence.  For the former, current code already distinguishes
between big- and little-endian targets, but gets the latter
wrong.  This is presumably because *GCC* also got it wrong,
and GDB matches the old GCC behavior.  But GCC is now fixed:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02145.html
so GDB needs to be fixed too.  (Old code shouldn't really be
an issue since there is no code "out there" so far that uses
dfp128 on little-endian ...)

gdb/ChangeLog:

	* ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct order
	within a register pair holding a DFP 128-bit value on little-endian.
	(ppc64_sysv_abi_return_value_base): Likewise.
	* rs6000-tdep.c (dfp_pseudo_register_read): Likewise.
	(dfp_pseudo_register_write): Likewise.

gdb/testsuite/ChangeLog:

	* gdb.arch/powerpc-d128-regs.exp: Enable on powerpc64*-*.
2014-02-04 18:36:54 +01:00
Ulrich Weigand 5b757e5ddb PowerPC64 little-endian fixes: 32-bit DFP parameters
Passing a 32-bit DFP in register needs to use the least-significant part
of the register.  Like with a previous patch that addressed the same
issue for small structs, this patch makes sure the appropriate offset
is used on little-endian systems.

gdb/ChangeLog:

	* ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct
	offset on little-endian when passing _Decimal32.
	(ppc64_sysv_abi_return_value_base): Likewise for return values.
2014-02-04 18:36:47 +01:00
Ulrich Weigand 084ee54552 PowerPC64 little-endian fixes: VSX tests and pseudo-regs
Many VSX test were failing on powerpc64le-linux, since -as opposed to the
AltiVec tests- there never were little-endian versions of the test patterns.

This patch adds such patterns, along the lines of altivec-regs.exp.

In addition, there is an actual code change required: For those VSX
registers that overlap a floating-point register, the FP register
overlaps the most-significant half of the VSX register both on big-
and little-endian systems.  However, on little-endian systems, that
half is stored at an offset of 8 bytes (not 0).  This works already
for the "real" FP registers, but current code gets it wrong for
the "extended" pseudo FP register GDB generates for the second
half of the VSX register bank.

This patch updates the corresponding pseudo read/write routines
to take the appropriate offset into consideration.

gdb/ChangeLog:

	* rs6000-tdep.c (efpr_pseudo_register_read): Use correct offset
	of the overlapped FP register within the VSX register on little-
	endian platforms.
	(efpr_pseudo_register_write): Likewise.

gdb/testsuite/ChangeLog:

	* gdb.arch/vsx-regs.exp: Check target endianness.  Provide variants
	of the test patterns for use on little-endian systems.
2014-02-04 18:31:38 +01:00
Ulrich Weigand 6ed14ff339 PowerPC64 little-endian fixes: AltiVec tests
A couple of AltiVec tests fail spuriously on powerpc64le-linux, because
they compare against an incorrect pattern.  Note that those tests already
contain little-endian variants of the patterns, but those seem to have
bit-rotted a bit: when outputting a vector, GDB no longer omits trailing
zero elements (as it used to do in the past).

This patch updates the pattern to the new GDB output behavior.

In addition, the patch updates the endian test to use the new
gdb_test_multiple logic instead of gdb_expect.

gdb/testsuite/ChangeLog:

	* gdb.arch/altivec-regs.exp: Use gdb_test_multiple for endian test.
	(decimal_vector): Fix for little-endian.
2014-02-04 18:28:24 +01:00
Ulrich Weigand d63167affc PowerPC64 little-endian fixes: structure passing
When passing a small structure in a GPR, the ABI specifies that it
should be passed in the least-significant bytes of the register
(or stack slot).  On big-endian systems, this means the value
needs to be stored at an offset, which is what current code does.

However, on little-endian systems, the least-significant bytes are
addresses with offset 0.  This patch fixes that.

gdb/ChangeLog:

	* ppc-sysv-tdep.c (ppc64_sysv_abi_push_val): Use correct
	offset on little-endian when passing small structures.
2014-02-04 18:26:26 +01:00
Ulrich Weigand e765b44c38 Refactor ppc64 function call and return value handling
This patch refactors the ppc64 function call and return value handling code
in ppc-sysv-tdep.c.  The main problem to be addressed by this refactoring
is the code duplication caused by certain aggregate types:

According to the ABI, some types are to be decomposed into component types
for parameter and return value handling.  For example, complex types are
to be passed as if the real and imaginary component were separate arguments.
Similarly, certain OpenCL vector types are passed as if they were multiple
separate arguments of the vector element type.  With the new ELFv2 ABI,
there is another case: "homogeneous aggregates" (e.g. a struct containing
4 floats) are passed in multiple floating point registers as well.

Unfortunately, the current code is not structured to easily model these
ABI properties.  For example, code to pass complex values re-implements
code to pass the underlying (floating-point) type.  This has already
led to some unfortunate code duplication, and with the addition of
ELFv2 ABI support, I would have had to add yet more such duplication.

To avoid that, I've decided to refactor the code in order to re-use
subroutines that handle the "base" types when handling those aggregate
types.  This was not intended to cause any difference on current
(ELFv1) ABI code, but in fact it fixes a bug:

FAIL: gdb.base/varargs.exp: print find_max_float_real(4, fc1, fc2, fc3, fc4)

This was caused by the old code in ppc64_sysv_abi_push_float incorrectly
handling floating-point arguments to vararg routines, which just happens
to work out correctly automatically in the refactored code ...

gdb/ChangeLog:

	* ppc-sysv-tdep.c (get_decimal_float_return_value): Update comment.
	(struct ppc64_sysv_argpos): New data structure.
	(ppc64_sysv_abi_push_float): Remove.
	(ppc64_sysv_abi_push_val): New function.
	(ppc64_sysv_abi_push_integer): Likewise.
	(ppc64_sysv_abi_push_freg): Likewise.
	(ppc64_sysv_abi_push_vreg): Likewise.
	(ppc64_sysv_abi_push_param): Likewise.
	(ppc64_sysv_abi_push_dummy_call): Refactor to use those new routines.
	(ppc64_sysv_abi_return_value_base): New function.
	(ppc64_sysv_abi_return_value): Refactor to use it.
2014-02-04 18:24:42 +01:00
Ulrich Weigand 36c24d9538 Document support for powerpc64le-*-linux* target
gdb/ChangeLog:

	* NEWS: Document new target powerpc64le-*-linux*.
2014-02-04 18:23:08 +01:00
Mark Kettenis 26fd922825 Add support for ELF core files on OpenBSD/sparc64.
gdb/ChangeLog:

        * sparc64obsd-tdep.c (sparc64obsd_gregset): New variable.
        (sparc64obsd_supply_gregset): Handle registers sets used in ELF
        core dumps.
        (sparc64obsd_init_abi): Adjust minimum size of the general purpose
        register set used in ELF core dumps.  Add floating-point register set.
2014-02-04 13:18:15 +01:00
Kevin Buettner c5bb736278 Update mn10300 dwarf register map
This change updates the mn10300 dwarf register map.  It reduces the
failure count when doing simulator testing against the default
multilib from 788 to 99.

gdb/ChangeLog:

	* mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Rewrite
	dwarf2_to_gdb[] table using symbolic constants.  Adjust
	penultimate entry from number representing the PC register
	to symbolic constant representing the MDR register.  Add
	constant for the PC register to the end of the table.
2014-02-03 21:52:59 -07:00
Mark Kettenis af09351e0f Fix build on recent versions of OpenBSD.
gdb/ChangeLog:

        * bsd-kvm.c: Include <sys/param.h>
2014-02-03 14:38:59 +01:00
Mark Kettenis 8507e05d53 Fix build on OpenBSD/sparc64.
gdb/ChangeLog:

        * sparc64nbsd-nat.c (sparc64nbsd_supply_fpregset): Fix prototype.
2014-02-03 14:29:28 +01:00
Joel Brobecker ae56bfb8e7 Delete ada-lang.h::clear_ada_sym_cache (nonexistant function).
I happen to notice this extern function declaration in ada-lang.h
which does not actually exist...

gdb/ChangeLog:

        * ada-lang.h (clear_ada_sym_cache): Delete.
2014-01-31 15:32:00 +04:00
Ulrich Weigand 718ee4dc9b Add support for AT_HWCAP2 auxv entry
Recent ppc64 Linux kernels provide a new auxv entry AT_HWCAP2,
which is currently not recognized by GDB, causing every use of
"info auxv" to show an error.

This commit adds the AT_HWCAP2 define to include/elf/common.h
and handles it in GDB.

include/elf/ChangeLog:

	* common.h (AT_HWCAP2): Define.

gdb/ChangeLog:

	* auxv.c (fprint_target_auxv): Handle AT_HWCAP2.
2014-01-30 19:12:35 +01:00
Jose E. Marchesi 401e27fd71 This changeset makes sparc64_linux_step_trap to return 0 when a
breakpoint is set in a `ta 0x6d´ which is not a sigreturn syscall.  In
these cases no rt_frame exists in the stack and thus the read PC is
wrong.

ChangeLog
2014-01-29  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* sparc64-linux-tdep.c (sparc64_linux_step_trap): Get PC from
          the sigreturn register save area only if the syscall is
          sigreturn.

testsuite/ChangeLog
2014-01-29  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* gdb.arch/sparc-sysstep.exp: New file.
	* gdb.arch/sparc-sysstep.c: Likewise.

	* gdb.arch/Makefile.in (EXECUTABLES): Add sparc-sysstep.
2014-01-29 07:15:05 -08:00
Joel Brobecker a7c88acd1e Minor reformatting in valops.c::value_slice
I noticed that a small lexical block was over indented by 2 characters.
So this patch starts by reducing the indentation.

While looking at this area of the code, I also noticed a couple of lines
that had trailing spaces, so this patch also removes them.

And finally, it fixes one tiny to put the assignment operator at
the start of the next line, rather than at the end of the first line.

gdb/ChangeLog:

        * valops.c (value_slice): Minor reformatting.
2014-01-29 14:41:04 +04:00
Edjunior Barbosa Machado 8b92472967 Fix info-shared.exp testcase to expect the leading `.' found on ppc64's symbols.
gdb/testsuite/
2014-01-28  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

	* gdb.base/info-shared.exp: Expect leading `.' on ppc64's symbols.
2014-01-28 15:31:23 -02:00
Ulrich Weigand fa0079ea72 Fix typo in ppc64_standard_linkage7
The ppc64_standard_linkage7 pattern added by Alan's recent patch:
https://sourceware.org/ml/gdb-patches/2013-11/msg00274.html
contains a typo: the ELFv2 TOC slot offset is 24, not 40.
This was correct in the comment, but not the actual code.

ChangeLog:

	* ppc64-tdep.c (ppc64_standard_linkage7): Fix typo.
2014-01-28 17:49:13 +01:00
Joel Brobecker c6044dd124 New Ada maintenance command to ignore descriptive types (DWARF).
Currently, Ada debugging requires the use of certain GNAT-specific
encodings, which are generated by the compiler. These encodings
were created a long time ago to work around the fairly limited
capabilities of the stabs debugging format. With DWARF, the vast
majority of the encodings could be abandoned in favor of a pure
DWARF approach.

In order to make it easier to evaluate the quality of the DWARF
debugging information generated by the compiler, and how the debugger
handles it, we are introducing a small Ada-specific maintenance
setting which changes the debugger's behavior to ignore descriptive
types. Descriptive types are artificial types generated by the
compiler purely to give the debugger hints as to how to properly
decode certain properties of a type.  For instance, for array
types, it generates a parallel type whose name is the name of
the array suffixed with ___XA, whose contents tells us what
the array's index type is, and possibly its bounds. See GCC's
gcc/ada/exp_dbug.ads for the full description of all encodings.

This is only a first step, as this setting does not deactivate
all encodings; More settings dedicated to each type of encoding
will likely be implemented in the future, as we make progress.

gdb/ChangeLog:

        * ada-lang.c (maint_set_ada_cmdlist, maint_show_ada_cmdlist):
        New static globals.
        (maint_set_ada_cmd, maint_show_ada_cmd): New functions.
        (ada_ignore_descriptive_types_p): New static global.
        (find_parallel_type_by_descriptive_type): Return immediately
        if ada_ignore_descriptive_types_p is set.
        (_initialize_ada_language): Register new commands "maintenance
        set ada", "maintenance show ada", "maintenance set ada
        ignore-descriptive-types" and "maintenance show ada
        ignore-descriptive-types".
        * NEWS: Add entry for new "maint ada set/show
        ignore-descriptive-types" commands.

gdb/doc/ChangeLog:

        * gdb.texinfo (Ada Glitches): Document the new "maint ada set/show
        ignore-descriptive-types". commands.
2014-01-28 07:01:48 +04:00
Markus Metzger 568e808b7d btrace: initiate teardown when closing record btrace target
The to_teardown_btrace target method is used to free btrace resources
during shutdown when target record has already been unpushed and we
can't reliably talk to a remote target to disable branch tracing.

Tracing resources are freed for each thread when the thread is removed;
both on the GDB side and on the gdbserver side.

In the remote case, the remote target that provides to_teardown_btrace
to free the GDB side resources has already been unpushed when threads
are destroyed.  This results in a complaint "You can't do this ..." and
in a few bytes of memory leaked for each thread.

Initiate btrace teardown in record_btrace_close, so the remote target is
still in place.

2014-01-27  Markus Metzger  <markus.t.metzger@intel.com>

	* record-btrace.c (record_btrace_close): Call btrace_teardown
	for all threads.
2014-01-27 08:56:16 +01:00
Joel Brobecker 467d141bf5 ada-lang.c: Really include "ui-out.h".
Currently, ada-lang.c pretends to include "ui-out.h" as follow:

    #ifdef UI_OUT
    #include "ui-out.h"
    #endif

However, UI_OUT is never defined as far as I can tell. This is confirmed
by rebuilding with a #error pragma inside the #ifdef UI_OUT block,
which never triggers.

Since this unit makes references to declarations from ui-out.h,
this patch simply removes the #ifdef/#endif condition.  This has not
been an error so far because "ui-out.h" indirectly gets included,
via one of the other .h files being included.

gdb/ChangeLog:

        * ada-lang.c: Remove "#ifdef UI_OUT" condition for including
        "ui-out.h".
2014-01-27 08:29:47 +04:00
Joel Brobecker fb15121096 Try printing array range using the name of its index type
type Char_Table is array (Character range Character'First .. Character'Last)
     of Natural;

Trying to print the type description of this type currently yields:

   (gdb) ptype char_table
   type = array ('["00"]' .. '["ff"]') of natural

Although technically correct, it seemed more useful to print the array
range as:

   (gdb) ptype char_table
   type = array (character) of natural

This patch implements this suggestion.

gdb/ChangeLog:

        * ada-typeprint (type_is_full_subrange_of_target_type):
        New function.
        (print_range): Add parameter bounds_prefered_p.  If not set,
        try printing range types using the name of their base type.
        (print_range_type): Add parameter bounds_prefered_p.
        Use it in call to print_range.
        (print_array_type, ada_print_type): Update calls to print_range
        and print_range_type.

gdb/testsuite/ChangeLog:

        * gdb.ada/array_char_idx: New testcase.
2014-01-27 08:27:21 +04:00
Joel Brobecker aba0210970 Remove unncessary function declarations in ada-typeprint.c.
These declarations are unncessary, and make it extra work when trying
to change the profile of one of these functions. This patch just
removes them.

Note that one of them (print_dynamic_range_bound), was improperly
indented.

gdb/ChangeLog:

        * ada-typeprint.c (print_array_type, print_choices, print_range)
        (print_range_bound, print_dynamic_range_bound, print_range_type):
        Remove declaration.
2014-01-27 08:21:36 +04:00
Joel Brobecker e62e21fd47 Add missing empty line after declaration in ada-typeprint.c:print_range.
gdb/ChangeLog:

        * ada-typeprint.c (print_range): Add missing empty line
        after local declaration.
2014-01-27 08:19:54 +04:00
Joel Brobecker 859cf5d1de [Ada] Array bound incorrectly printed for array indexed by enum subrange
Consider the following declarations:

   type Range_Type is (One, Two, Three);
   type Array_Type is array (Range_Type range One .. Two) of Integer;
   A : Array_Type := (1, 2);

Trying to print A can yield:

   (gdb) print a
   $1 = (one => 1, 2)

The bound of the first element should not have been printed, since
"one" is the first enumerate of type Range_Type. Similarly, with
the following declarations:

   type Array2_Type is array (Range_Type range Two .. Three) of Integer;
   A2 : Array2_Type := (2, 3);

GDB is failing to print the bound of the first element of "A2":

   (gdb) print a2
   $2 = (2, 3)

This is because the index type for both types Array_Type and Array2_Type
are subranges (by DWARF definition for arrays), of an anonymous subrange
type. When deciding whether to print the bound of the first element,
we handle subranges, but only up to one level. This patch enhanced
the code to handle any number of subrange levels.

gdb/ChangeLog:

        * ada-valprint.c (print_optional_low_bound): Get index_type's
        target type for as long as it is a TYPE_CODE_RANGE.

No testcase with this patch, but this will be tested via the testcase
of another patch, which uses the DWARF assembler to generate debugging
info for an array indexed by an enum.
2014-01-27 08:13:49 +04:00
Joel Brobecker 25790f6fc1 Remove assert in procfs.c::procfs_make_note_section (x86-solaris)
On x86-solaris, the gcore command sometimes triggers the following
internal error:

    (gdb) gcore
    /[...]/procfs.c:5523: internal-error: procfs_make_note_section: Assertion `thread_args.note_data != note_data' failed.

The problem is extremely elusive, for reasons that will become clearer
as I explain what is going on.

The program used to produce this issue was really simple:

    | void break_me (void) { }
    |
    | int
    | main (void)
    | {
    |   break_me ();
    |   return 0;
    | }

The procfs_make_note_section builds a buffer incrementally with
the contents of the core's notes section.  The interesting bits are:

  char *note_data = NULL;
  [...]
  note_data = (char *) elfcore_write_prpsinfo (obfd,
                                               note_data,
                                               note_size,
                                               fname,
                                               psargs);

This is the first call to bfd's elfcore which initializes note_data.
After that, we have a few more calls, which keep updating notes_data
and note_size, but our interest lies in the following part of
the function:

  thread_args.note_data = note_data;
  [...]
  proc_iterate_over_threads (pi, procfs_corefile_thread_callback,
                             &thread_args);
  /* There should be always at least one thread.  */
  gdb_assert (thread_args.note_data != note_data);

The comment implies that the assert is to verify that our loop
iterated over at least one thread. The check is relying on the
fact that the notes_data returned by the elfcore module changes
at each iteration, via (in procfs_corefile_thread_callback):

      args->note_data = procfs_do_thread_registers (args->obfd, ptid,
                                                    args->note_data,
                                                    args->note_size,
                                                    args->stop_signal);

(which calls elfcore_write_lwpstatus).

But, while it happens most of the time, thanks to a call to realloc
in elfcore_write_note (the function that actually appends the data
at the end of the notes buffer),...

       buf = (char *) realloc (buf, *bufsiz + newspace);

... this is by no means guarantied. In fact, under the right
circumstances, the buffer was grown twice without changing
addresses. Unfortunately, the circumstances are very sensitive,
thus making this bug very elusive.

This patch fixes the problem by simply removing the assert.
This means we're losing the assertion that there is at least one
thread, but I think that's OK. If we still want to keep the
assertion, we have the option of either checking the buffer
size, or else adding a boolean flag in the context structure
that we'd set to true as soon as we have a thread.

gdb/ChangeLog:

        * procfs.c (procfs_make_note_section): Remove assertion and
        associated comment.
2014-01-27 07:01:09 +04:00
Yao Qi 6b6aa82881 Change len's type to ULONGEST: remote_read_bytes and get_core_siginfo
Functions remote_read_bytes and get_core_siginfo are the callees of
target to_xfer_partial interface, so argument 'len' should be changed
to type ULONGEST.

gdb:

2014-01-24  Yao Qi  <yao@codesourcery.com>

	* remote.c (remote_read_bytes): Change type of len to ULONGEST.
	* corelow.c (get_core_siginfo): Likewise.
2014-01-24 21:31:30 +08:00
Yao Qi 5d6df42390 Change len's type to ULONGEST: remote_write_bytes_aux
Hi,
This patch changes the type of 'len' from ssize_t to ULONGEST.

At the beginning Siddhesh Poyarekar proposed this patch

  [PATCH] Memory reads and writes should have size_t length
  https://sourceware.org/ml/gdb-patches/2012-05/msg01073.html

to change type of 'len' to size_t.  However, after Jan's review, we
decide to change it to ssize_t, because callers of these functions
may pass signed type to them.

AFAICS, the target layer is a boundary.  In one side, we pass size_t
or ssize_t to target related APIs, and in the other side, the
implementation side, we used LONGEST (ULONGEST in latest code) because
of to_xfer_partial.

Since remote_write_bytes_aux and remote_write_bytes belong to the
implementation of remote target, we should use ULONGEST for len, IMO.

Regression tested on x86_64-linux.  Is it OK?

gdb:

2014-01-24  Yao Qi  <yao@codesourcery.com>

	* remote.c (remote_write_bytes_aux): Change type of 'len' to
	ULONGEST.  Don't check 'len' is negative.
	(remote_write_bytes):  Change type of 'len' to ULONGEST.
2014-01-24 21:31:26 +08:00
Tom Tromey 83b645b833 avoid python exception in FrameDecorator.py
This fixes a bug in FrameDecorator.py.

FrameVars seems to assume that Frame.block can return None if there is
no block.  However, it actually throws an exception.

I saw this bug while developing a frame filter, but unfortunately I
don't know how to reproduce it.  It seems to me that the SAL tests in
_is_limited_frame should exclude the bad cases; and in my attempts to
write a test they do.

Nevertheless I think the fix is reasonably obvious and ought to go in.

2014-01-23  Tom Tromey  <tromey@redhat.com>

	PR python/16485:
	* python/lib/gdb/FrameDecorator.py: (FrameVars.fetch_frame_args):
	Handle exception from frame.block.
	(FrameVars.fetch_frame_locals): Likewise.
2014-01-23 08:03:52 -07:00
Tom Tromey 0740f8d82d fix erroneous error-handling in frame filter code
This fixes PR python/16487.

The bug here is that the function-name-handling code in py_print_frame
had a small logic error (really a misplaced closing brace).  This
error could lead to a Py_DECREF(NULL), which crashes.

This patch fixes the bug in the obvious way.

Built and regtested on x86-64 Fedora 18.  New test case included.

2014-01-23  Tom Tromey  <tromey@redhat.com>

	PR python/16487:
	* python/py-framefilter.c (py_print_frame): Don't call Py_DECREF
	on a NULL pointer.  Move "goto error" to correct place.

2014-01-23  Tom Tromey  <tromey@redhat.com>

	PR python/16487:
	* gdb.python/py-framefilter.exp: Add test using "Error" filter.
	* gdb.python/py-framefilter.py (ErrorInName, ErrorFilter): New
	classes.
2014-01-23 08:03:51 -07:00
Tom Tromey 21909fa1c6 fix crash in frame filters
apply_frame_filter calls ensure_python_env before computing the
gdbarch to use.  This means that python_gdbarch can be NULL while in
Python code, and if a frame filter depends on this somehow (easy to
do), gdb will crash.

The fix is to compute the gdbarch first.

Built and regtested on x86-64 Fedora 18.
New test case included.

2014-01-23  Tom Tromey  <tromey@redhat.com>

	PR python/16491:
	* python/py-framefilter.c (apply_frame_filter): Call
	ensure_python_env after computing gdbarch.

2014-01-23  Tom Tromey  <tromey@redhat.com>

	PR python/16491:
	* gdb.python/py-framefilter.py (Reverse_Function.function): Read a
	string from an inferior frame.
	* gdb.python/py-framefilter-mi.exp: Update.
2014-01-23 08:03:50 -07:00
Yao Qi 17fde6d091 Use gdb_byte * instead of void *
This patch changes the argument type to gdb_byte * in order to align
with the to_xfer_partial interface.

gdb:

2014-01-23  Yao Qi  <yao@codesourcery.com>

	* target.c (raw_memory_xfer_partial): Change argument type
	from void * to gdb_byte *.
	(memory_xfer_partial_1, memory_xfer_partial): Likewise.
2014-01-23 11:50:29 +08:00
Doug Evans f5a0277332 * gdbthread.h (gdb_id_to_thread): Delete, unused. 2014-01-22 16:42:07 -08:00
Doug Evans 87ce2a04c5 New gdbserver option --debug-format=timestamp.
* NEWS: Mention it.

	gdbserver/
	* configure.ac (AC_CHECK_FUNCS): Add test for gettimeofday.
	* configure: Regenerate.
	* config.in: Regenerate.
	* Makefile.in (SFILES): Add debug.c.
	(OBS): Add debug.o.
	* debug.c: New file.
	* debug.h: New file.
	* linux-aarch64-low.c (*): Update all debugging printfs to use
	debug_printf instead of fprintf.
	* linux-arm-low.c (*): Ditto.
	* linux-cris-low.c (*): Ditto.
	* linux-crisv32-low.c (*): Ditto.
	* linux-m32r-low.c (*): Ditto.
	* linux-sparc-low.c (*): Ditto.
	* linux-x86.c (*): Ditto.
	* linux-low.c (*): Ditto.
	(linux_wait_1): Add calls to debug_enter, debug_exit.
	(linux_wait): Remove redundant debugging printf.
	(stop_all_lwps): Add calls to debug_enter, debug_exit.
	(linux_resume, unstop_all_lwps): Ditto.
	* mem-break.c (*): Update all debugging printfs to use
	debug_printf instead of fprintf.
	* remote-utils.c (*): Ditto.
	* thread-db.c (*): Ditto.
	* server.c #include <ctype.h>, "gdb_vecs.h".
	(debug_threads): Moved to debug.c.
	(*): Update all debugging printfs to use debug_printf instead of
	fprintf.
	(start_inferior): Replace call to fflush with call to debug_flush.
	(monitor_show_help): Mention set debug-format.
	(parse_debug_format_options): New function.
	(handle_monitor_command): Handle "monitor set debug-format".
	(gdbserver_usage): Mention --debug-format.
	(main): Parse --debug-format.
	* server.h (debug_threads): Declaration moved to debug.h.
	#include "debug.h".
	* tracepoint.c (trace_debug_1) [!IN_PROCESS_AGENT]: Add version of
	trace_debug_1 that uses debug_printf.
	(tracepoint_look_up_symbols): Update all debugging printfs to use
	debug_printf instead of fprintf.

	doc/
	* gdb.texinfo (Server): Mention --debug-format=all|none|timestamp.
	(gdbserver man): Ditto.

	testsuite/
	* gdb.server/server-mon.exp: Add tests for "set debug-format".
2014-01-22 14:17:39 -08:00
Andreas Arnez 237b092b9f gdb/ChangeLog:
* syscalls/s390x-linux.xml: New file.
	* syscalls/s390-linux.xml: New file.
	* s390-linux-tdep.c (XML_SYSCALL_FILENAME_S390): New macro.
	(XML_SYSCALL_FILENAME_S390X): Likewise.
	(op_svc): New enum value for SVC opcode.
	(s390_sigtramp_frame_sniffer): Replace literal by 'op_svc'.
	(s390_linux_get_syscall_number): New function.
	(s390_gdbarch_init): Register '*get_syscall_number' and the
	syscall xml file name.
	* data-directory/Makefile.in (SYSCALLS_FILES): Add
	"s390-linux.xml" and "s390x-linux.xml".
	* NEWS: Announce new feature.

gdb/testsuite/ChangeLog:
	* gdb.base/catch-syscall.exp: Activate test on s390*-linux.
2014-01-22 18:54:43 +01:00
Andreas Arnez d674a7090f Fix regression on s390x with entry-values.exp.
The trace-specific test case 'entry-values' concludes fairly late in
the process that this platform doesn't support trace.  Before that,
there are some platform specifics that don't work on s390x.  The fix
addresses two aspects:

(1) Removal of an excess space character in the regex for the
    disassembly.  This is needed when there is a function alignment
    gap, because then the hex address is immediately followed by a
    colon, like in the first 'nopr' line below:

    (gdb) disassemble foo+50,+10
    Dump of assembler code from 0x32 to 0x3c:
       0x0000000000000032 <foo+50>: br      %r4
       0x0000000000000034:  nopr    %r7
       0x0000000000000036:  nopr    %r7
       0x0000000000000038 <bar+0>:  stmg    %r11,%r15,88(%r15)
    End of assembler dump.

(2) Handling for the s390-specific call instruction.

gdb/testsuite/ChangeLog:
	* gdb.trace/entry-values.exp: Remove excess space character from
	regex patterns.  Handle s390 call instruction.
2014-01-22 17:02:13 +01:00
Andreas Arnez 20fa339009 Re-introduce '_start' labels and add alignment in dw2-dir-file-name test case.
On ppc64-linux a function symbol does not point to code, but to the
function descriptor.  Thus the previous change for this test case
broke it:

      https://sourceware.org/ml/gdb-patches/2014-01/msg00275.html

This patch reverts to the original method, re-introducing '_start'
symbols.  In addition, it adds sufficient alignment before the label,
such that the label never points into an alignment gap.

gdb/testsuite/ChangeLog:
	* gdb.dwarf2/dw2-dir-file-name.c (FUNC): Insert alignment and
	define "*_start" label.  Make "name" static.
	* gdb.dwarf2/dw2-dir-file-name.exp: Replace references to
	${name} by references to ${name}_start.
2014-01-22 17:02:13 +01:00
Andreas Arnez 7846671423 Prevent appending "-g" after "-g3" to compile options in info-macros.exp.
When upstream gcc is given a command line with the "-g" option after
"-g3", it doesn't generate a ".debug_macro" section.  This is because
the last option wins, thus downgrading the debug level again.  Without
any macro debug information in the executable, info-macros.exp
obviously produces many failures.

Since the "-g" option is appended by DejaGnu's target_compile whenever
the "debug" option is set, the fix just removes that option.

gdb/testsuite/ChangeLog:
	* gdb.base/info-macros.exp: Remove "debug" from the compile
	options.
2014-01-22 17:02:13 +01:00
Baruch Siach 54bff65084 gdb: xtensa: fix on 64-bit hosts
On 64-bit hosts unsigned long is 64 bit.  Use uint32_t instead.

gdb/
2014-01-22  Baruch Siach  <baruch@tkos.co.il>

	* xtensa-tdep.h (xtensa_elf_greg_t): Change type to uint32_t.
2014-01-22 12:12:24 +00:00
Pedro Alves 14e361d7aa xtensa-config.c: missing defs.h include.
All .c files must start by including defs.h.

2014-01-22  Pedro Alves  <palves@redhat.com>

	* xtensa-config.c: Include defs.h.
2014-01-22 12:03:29 +00:00
Joel Brobecker 46bbb3edac Add ARI (ok) marker for __func__ reference in common-utils.h
The ARI script flagged the use of the __func__ variable, which
is normally not allowed (not defined in C90). However, this particular
use is OK, as the reference is only made when __STDC_VERSION__ >=
199901L.  So, add an "ARI:" comment to explicitly OK this use.

gdb/ChangeLog:

        * common/common-utils.h: Add "ARI:" comment beside __func__
        reference.
2014-01-22 09:03:31 +04:00
Joel Brobecker 3a80edfc74 Expand documentation of common-utils.h::FUNCTION_NAME
While looking at this macro, I noticed that it wasn't always necessarily
defined. That prompted me to search the current sources to make sure
that all uses were adequately protected, which they were. But to help
prevent future uses to be made unprotected, this patch expands the
current macro documentation a bit.

gdb/ChangeLog:

        * common/common-utils.h (FUNCTION_NAME): Expand the macro's
        documentation a bit.
2014-01-22 09:02:45 +04:00
Roland McGrath 4869db5e97 gdb: Support install-strip target
gdb/
	* configure.ac: Call AM_PROG_INSTALL_STRIP.
	* configure: Regenerate.
	* aclocal.m4: Regenerate.
	* Makefile.in (install_sh, INSTALL_STRIP_PROGRAM, STRIP):
	New substituted	variables.
	(install-strip): New target.
	(INSTALL_SCRIPT): New substituted variable.
	(FLAGS_TO_PASS): Add it.
	(install-only): Use $(INSTALL_SCRIPT) rather than
	$(INSTALL_PROGRAM) for gcore.
2014-01-21 11:01:04 -08:00
Tom Tromey 9ea4267d62 better packing for command struct
This moves all the bitfields in struct cmd_list_element to be closer
together.  This packs the structure somewhat better.  On a 64 bit
machine, this simple rearrangement saves around 50k at startup.

2014-01-20  Tom Tromey  <tromey@redhat.com>

	* cli/cli-decode.h (struct cmd_list_element): Move all bitfields
	together.
2014-01-20 09:10:52 -07:00
Tom Tromey 1f2bdf09c6 convert flags to bitfields
This changes various flags struct cmd_list_element into bitfields.  In
general I think bitfields are cleaner than flag words, at least in a
case like this where there is no need to pass the flags around
independently of the enclosing struct.

2014-01-20  Tom Tromey  <tromey@redhat.com>

	* cli/cli-decode.c (add_cmd, deprecate_cmd, add_alias_cmd)
	(add_setshow_cmd_full, delete_cmd, lookup_cmd_1)
	(deprecated_cmd_warning, complete_on_cmdlist): Update.
	* cli/cli-decode.h (CMD_DEPRECATED, DEPRECATED_WARN_USER)
	(MALLOCED_REPLACEMENT, DOC_ALLOCATED): Remove.
	(struct cmd_list_element) <flags>: Remove.
	<cmd_deprecated, deprecated_warn_user, malloced_replacement,
	doc_allocated>: New fields.
	<hook_in, allow_unknown, abbrev_flag, type, var_type>: Now
	bitfields.
	* maint.c (maintenance_do_deprecate): Update.
	* top.c (execute_command): Update.
2014-01-20 09:10:51 -07:00
Baruch Siach e671835b7a gdb: xtensa: fix linux ptrace includes
Currently, xtensa code using the Linux ptrace interface only include
sys/ptrace.h.  This file comes from the C library (glibc and uClibc,
at least), and includes a declaration of the ptrace() functions, along
with some cross architecture constants that are mostly copied from the
file located at include/uapi/linux/ptrace.h in recent Linux kernels.

For xtensa specific constants like PTRACE_GETXTREGS and
PTRACE_SETXTREGS the asm/ptrace.h include from the Linux kernel UAPI
is needed.  The code in gdbserver xtensa specific part doesn't call
ptrace() directly, so we can remove the unneeded sys/ptrace.h include.
The gdb xtensa specific code needs both headers, since it calls
ptrace().

gdb/
	* xtensa-linux-nat.c: Include asm/ptrace.h.

gdb/gdbserver/
	* linux-xtensa-low.c: Include asm/ptrace.h instead of
	sys/ptrace.h.
2014-01-20 11:43:44 +00:00
Iain Buclaw 50367cd2ad Move D demangling routines out of d-lang.c and into d-support.c, which
is intended to house other D language support functions.

gdb/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

    * Makefile.in (SFILES): Add d-support.c.
    (COMMON_OBS): Add d-support.o.
    * d-lang.h (d_parse_symbol): Add comment, now defined in
    d-support.c.
    * d-lang.c (parse_call_convention)
    (parse_attributes, parse_function_types)
    (parse_function_args, parse_type, parse_identifier)
    (call_convention_p, d_parse_symbol): Move functions to ...
    * d-support.c: ... New file.
2014-01-18 18:11:24 +00:00
Iain Buclaw ec9f644ac9 Fix and update D demangling support in gdb to the current mangling ABI.
gdb/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

    * d-lang.h (d_parse_symbol): Add declaration.
    * d-lang.c (extract_identifiers)
    (extract_type_info): Remove functions.
    (parse_call_convention, parse_attributes)
    (parse_function_types, parse_function_args)
    (parse_type, parse_identifier, call_convention_p)
    (d_parse_symbol): New functions.
    (d_demangle): Use d_parse_symbol to demangle D symbols.

gdb/testsuite/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

* gdb.dlang/demangle.exp: New file.
2014-01-18 18:11:06 +00:00
Iain Buclaw 94b1b47ee1 Define all basic data types of D and add them to the primitive type
language vector.

gdb/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

    * d-lang.h (struct builtin_d_type): New data type.
    (builtin_d_type): Add declaration.
    * d-lang.c (d_language_arch_info, build_d_types)
    (builtin_d_type): New functions.
    (enum d_primitive_types): New data type.
    (d_language_defn): Change c_language_arch_info to
    d_language_arch_info.
    (d_type_data): New static variable.
    (_initialize_d_language): Initialize d_type_data.

gdb/testsuite/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

    * gdb.dlang/primitive-types.exp: New file.
2014-01-18 18:10:47 +00:00
Iain Buclaw 6377854769 Add d_main_name to set the logical entry point for D programs.
gdb/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

    * d-lang.h (d_main_name): Add declaration.
    * d-lang.c (d_main_name): New function.
    * symtab.c (find_main_name): Add call to d_main_name.
2014-01-18 18:10:32 +00:00
Iain Buclaw 3271ba660a Update d_language_defn to reflect that D does not have any style of
macro expansion in its language.

gdb/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

    * d-lang.c (d_language_defn): Change macro_expansion_c to
    macro_expansion_no.
2014-01-18 18:09:48 +00:00
Iain Buclaw 7f420862a7 Add gdb.dlang to the gdb testsuite for the purpose of creating D
specific tests.

gdb/testsuite/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

    * configure.ac: Create gdb.dlang/Makefile.
    * configure: Regenerate.
    * Makefile.in (ALL_SUBDIRS): Add gdb.dlang.
    * gdb.dlang/Makefile.in: New file.
    * lib/d-support.exp: New file.
    * lib/gdb.exp (skip_d_tests): New proc.
2014-01-18 18:09:28 +00:00
Iain Buclaw d36b301294 Add myself as a write-after-approval gdb maintainer.
gdb/ChangeLog:
2014-01-17  Iain Buclaw  <ibuclaw@gdcproject.org>

    * MAINTAINERS: Add myself as a write-after-approval maintainer.
2014-01-18 18:09:12 +00:00
Sergio Durigan Junior c90a6fb765 Add "volatile" keyword to "struct gdb_exception" declaration
While doing something else, I found that those 2 places were incorrectly
declaring a "struct gdb_exception" without using the "volatile" keyword.
This commit fixes that.

2014-01-17  Sergio Durigan Junior  <sergiodj@redhat.com>

	* breakpoint.c (insert_bp_location): Add "volatile" keyword to "struct
	gdb_exception" declaration.
	* remote.c (getpkt_or_notif_sane): Likewise.
2014-01-17 19:39:57 -02:00
Doug Evans 749234e540 Add delim_string_to_char_ptr_vec.
* common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): New
	function, contents of dirnames_to_char_ptr_vec_append moved here.
	(delim_string_to_char_ptr_vec): New function.
	(dirnames_to_char_ptr_vec_append): Rewrite.
	* common/gdb_vecs.h (delim_string_to_char_ptr_vec): Declare.
2014-01-17 10:23:29 -08:00
Doug Evans df049a5831 Move ASSERT_FUNCTION to FUNCTION_NAME.
* common/common-utils.h (FUNCTION_NAME): Renamed from ASSERT_FUNCTION,
	and moved here ...
	* common/gdb_assert.h (ASSERT_FUNCTION): ... from here.
	#include "common-utils.h".
	(gdb_assert, gdb_assert_fail, gdb_assert_not_reached): Update.
	* common/vec.h (VEC_ASSERT_PASS): Update.
	* darwin-nat.h: Replace #include of gdb_assert.h with common-utils.h.
	(MACH_CHECK_ERROR): Update.
2014-01-17 10:00:07 -08:00
Pedro Alves ea38d2a92e Fix PR mention in gdb/gdbserver/ChangeLog's previous change. 2014-01-17 16:28:38 +00:00
Pedro Alves c7faa97a85 Fix silly ChangeLog entry in previous change. 2014-01-17 15:27:43 +00:00
Pedro Alves b5737fa98a Fix PR PR16445 - gdbserver build failure on x86.
If gdb_proc_service.h ends up including linux/elf.h, we'll trip on
duplicate definitions:

 In file included from ../../../gdb/gdbserver/linux-x86-low.c:29:0:
 ../../../gdb/gdbserver/../../include/elf/common.h:36:0: error: "ELFMAG0"
                 redefined [-Werror]
 ... etc ...

Handle this the same way linux-low.c and linux-arm-low.c handle this.

gdb/gdbserver/
2014-01-17  Pedro Alves  <palves@redhat.com>

	PR PR16445
	* linux-x86-low.c (linux-x86-low.c): Don't include elf/common.h if
	ELFMAG0 is defined after including gdb_proc_service.h.
2014-01-17 13:33:30 +00:00
Simon Marchi 69f9764846 Add comments to gdbarch_address_class_name_to_type_flags.
gdb/ChangeLog
2014-01-17  Simon Marchi  <simon.marchi@ericsson.com>

	* gdbarch.sh (gdbarch_address_class_name_to_type_flags): Add
	comments.
	* gdbarch.h: Regenerate.
2014-01-17 09:54:56 +00:00
Doug Evans 40ed484e74 * dll.c (UNSPECIFIED_CORE_ADDR): New macro.
(match_dll): Use it.
2014-01-16 15:47:43 -08:00
Tom Tromey 98b1cfdcc8 rearrange struct value to save memory
This patch rearranges struct value a tiny bit, moving the "regnum"
field into a hole.  This saves 8 bytes per value on a 64-bit machine,
and 4 bytes per value on a 32 bit machine.  I think it does not
negatively affect readability or performance.

Built and regtested on x86-64 Fedora 18.

2014-01-16  Tom Tromey  <tromey@redhat.com>

	* value.c (struct value) <regnum>: Move earlier.
2014-01-16 14:56:31 -07:00
Tom Tromey 77a1944595 remove extended_remote_create_inferior_1
I noticed that extended_remote_create_inferior_1 is called from a
single spot.  This patch unifies the callee and caller.  It's just a
simple cleanup that made the coming refactoring simpler.

2014-01-16  Tom Tromey  <tromey@redhat.com>

	* remote.c (extended_remote_create_inferior): Rename from
	extended_remote_create_inferior_1.  Add "ops" argument.  Remove
	old implementation.
2014-01-16 12:12:32 -07:00
Pedro Alves 62261490a3 Fix gdb.trace/mi-traceframe-changed.exp on s390.
The test fails on s390 with:

  -trace-find frame-number 0^M
  &"PC not available\n"^M
  ^done,found="1",tracepoint="1",traceframe="0",frame={level="-1",addr="<unavailable>",func="??",args=[]}^M
  (gdb) ^M
  FAIL: gdb.trace/mi-traceframe-changed.exp: tfile: -trace-find frame-number 0

tfile knows to infer the PC from the tracepoint's address if the PC
wasn't collected (tfile_fetch_registers) but, that only works on
targets whose PC register is a raw register, and on s390, the PC
register is a pseudo register.

But even if GDB doesn't know how to infer the value of PC, saying the
current frame is level -1 is a bug:

  ^done,found="1",tracepoint="1",traceframe="0",frame={level="-1",addr="<unavailable>",func="??",args=[]}^M
                                                       ^^^^^^^^^

'-1' is the level of the sentinel frame, which should never be visible.

This is caused by the s390's heuristic unwinder accepting the frame
(the fallback heuristic unwinders _always_ accept the frame), but then
the unwind->this_id method throws that "PC not available\n" error.

IOW, the s390's heuristic unwinder was never adjusted to handle
unavailable register values gracefully, which can happen with e.g., a
trimmed core file too.

This is just the minimal necessary for
<unavailable> frames, which at least gets us:

  (gdb) tfind
  Found trace frame 0, tracepoint 1
  #0  <unavailable> in ?? ()

That is, frame #0 instead of -1.

We could get better info out of "info frame" (this patch makes us show
"outermost"), but this change would still be necessary.

gdb/
2014-01-16  Pedro Alves  <palves@redhat.com>

	* s390-linux-tdep.c (s390_frame_unwind_cache): Swallow
	NOT_AVAILABLE_ERROR errors while parsing the prologue or reading
	the backchain.
2014-01-16 17:43:46 +00:00
Doug Evans 4d65956b03 dwarf2read.c (open_and_init_dwp_file): Fix typo in comment. 2014-01-16 09:29:10 -08:00
Markus Metzger 52834460bc record-btrace: add (reverse-)stepping support
Provide to_resume and to_wait target methods for the btrace record target
to allow reverse stepping and replay support.

Replay is limited in the sense that only stepping and source correlation
are supported.  We do not record data and thus can not show variables.

Non-stop mode is not working.  Do not allow record-btrace in non-stop mode.

2014-01-16  Markus Metzger  <markus.t.metzger@intel.com>

	* btrace.h (btrace_thread_flag): New.
	(struct btrace_thread_info) <flags>: New.
	* record-btrace.c (record_btrace_resume_thread)
	(record_btrace_find_thread_to_move, btrace_step_no_history)
	(btrace_step_stopped, record_btrace_start_replaying)
	(record_btrace_step_thread, record_btrace_decr_pc_after_break)
	(record_btrace_find_resume_thread): New.
	(record_btrace_resume, record_btrace_wait): Extend.
	(record_btrace_can_execute_reverse): New.
	(record_btrace_open): Fail in non-stop mode.
	(record_btrace_set_replay): Split into this, ...
	(record_btrace_stop_replaying): ... this, ...
	(record_btrace_clear_histories): ... and this.
	(init_record_btrace_ops): Init to_can_execute_reverse.
	* NEWS: Announce it.

testsuite/
	* gdb.btrace/delta.exp: Check reverse stepi.
	* gdb.btrace/tailcall.exp: Update.  Add stepping tests.
	* gdb.btrace/finish.exp: New.
	* gdb.btrace/next.exp: New.
	* gdb.btrace/nexti.exp: New.
	* gdb.btrace/record_goto.c: Add comments.
	* gdb.btrace/step.exp: New.
	* gdb.btrace/stepi.exp: New.
	* gdb.btrace/multi-thread-step.c: New.
	* gdb.btrace/multi-thread-step.exp: New.
	* gdb.btrace/rn-dl-bind.c: New.
	* gdb.btrace/rn-dl-bind.exp: New.
	* gdb.btrace/data.c: New.
	* gdb.btrace/data.exp: New.
	* gdb.btrace/Makefile.in (EXECUTABLES): Add new.

doc/
	* gdb.texinfo: Document limited reverse/replay support
	for target record-btrace.
2014-01-16 13:14:12 +01:00
Markus Metzger 118e6252ca target: allow decr_pc_after_break to be defined by the target
Allow the target to define which value to use in decr_pc_after_break.
It defaults to gdbarch_decr_pc_after_break (GDBARCH).

2014-01-16  Markus Metzger  <markus.t.metzger@intel.com>

	* target.h (struct target_ops) <to_decr_pc_after_break>: New.
	(forward_target_decr_pc_after_break)
	(target_decr_pc_after_break): New.
	* target.c (forward_target_decr_pc_after_break)
	(target_decr_pc_after_break): New.
	* aix-thread.c (aix_thread_wait): Call target_decr_pc_after_break
	instead of gdbarch_decr_pc_after_break.
	* darwin-nat.c (cancel_breakpoint): Call target_decr_pc_after_break
	instead of gdbarch_decr_pc_after_break.
	* infrun.c (adjust_pc_after_break): Call target_decr_pc_after_break
	instead of gdbarch_decr_pc_after_break.
	* linux-nat.c (cancel_breakpoint): Call target_decr_pc_after_break
	instead of gdbarch_decr_pc_after_break.
	* linux-thread-db.c (check_event): Call target_decr_pc_after_break
	instead of gdbarch_decr_pc_after_break.
	* record-full.c (record_full_wait_1): Call target_decr_pc_after_break
	instead of gdbarch_decr_pc_after_break.
2014-01-16 13:12:00 +01:00
Markus Metzger 6e07b1d27e record-btrace: show trace from enable location
The btrace record target shows the branch trace from the location of the first
branch destination.  This is the first BTS records.

After adding incremental updates, we can now add a dummy record for the current
PC when we enable tracing so we show the trace from the location where branch
tracing has been enabled.

2014-01-16  Markus Metzger  <markus.t.metzger@intel.com>

	* btrace.c: Include regcache.h.
	(btrace_add_pc): New.
	(btrace_enable): Call btrace_add_pc.
	(btrace_is_empty): New.
	* btrace.h (btrace_is_empty): New.
	* record-btrace.c (require_btrace, record_btrace_info): Call
	btrace_is_empty.

testsuite/
	* gdb.btrace/Makefile.in (EXECUTABLES): Add delta.
	* gdb.btrace/exception.exp: Update.
	* gdb.btrace/instruction_history.exp: Update.
	* gdb.btrace/record_goto.exp: Update.
	* gdb.btrace/tailcall.exp: Update.
	* gdb.btrace/unknown_functions.exp: Update.
	* gdb.btrace/delta.exp: New.
2014-01-16 13:12:00 +01:00
Markus Metzger 969c39fbcd btrace, gdbserver: read branch trace incrementally
Read branch trace data incrementally and extend the current trace rather than
discarding it and reading the entire trace buffer each time.

If the branch trace buffer overflowed, we can't extend the current trace so we
discard it and start anew by reading the entire branch trace buffer.

2014-01-16  Markus Metzger  <markus.t.metzger@intel.com>

	* common/linux-btrace.c (perf_event_read_bts, linux_read_btrace):
	Support delta reads.
	(linux_disable_btrace): Change return type.
	* common/linux-btrace.h (linux_read_btrace): Change parameters
	and return type to allow error reporting.  Update users.
	(linux_disable_btrace): Change return type.  Update users.
	* common/btrace-common.h (btrace_read_type) <BTRACE_READ_DELTA>:
	New.
	(btrace_error): New.
	(btrace_block) <begin>: Comment on BEGIN == 0.
	* btrace.c (btrace_compute_ftrace): Start from the end of
	the current trace.
	(btrace_stitch_trace, btrace_clear_history): New.
	(btrace_fetch): Read delta trace, return if replaying.
	(btrace_clear): Move clear history code to btrace_clear_history.
	(parse_xml_btrace): Throw an error if parsing failed.
	* target.h (struct target_ops) <to_read_btrace>: Change parameters
	and return type to allow error reporting.
	(target_read_btrace): Change parameters and return type to allow
	error reporting.
	* target.c (target_read_btrace): Update.
	* remote.c (remote_read_btrace): Support delta reads.  Pass
	errors on.
	* NEWS: Announce it.

gdbserver/
	* target.h (target_ops) <read_btrace>: Change parameters and
	return type to allow error reporting.
	* server.c (handle_qxfer_btrace): Support delta reads.  Pass
	trace reading errors on.
	* linux-low.c (linux_low_read_btrace): Pass trace reading
	errors on.
	(linux_low_disable_btrace): New.
2014-01-16 13:11:42 +01:00
Markus Metzger 0b722aec57 record-btrace: extend unwinder
Extend the always failing unwinder to provide the PC based on the call
structure detected in the branch trace.

The unwinder supports normal frames and tailcall frames.
Inline frames are not supported.

2014-01-16  Markus Metzger  <markus.t.metzger@intel.com>

	* record.h (record_btrace_frame_unwind)
	(record_btrace_tailcall_frame_unwind): New declarations.
	* dwarf2-frame: Include record.h
	(dwarf2_frame_cfa): Throw an error for btrace frames.
	* record-btrace.c: Include hashtab.h.
	(btrace_get_bfun_name): New.
	(btrace_call_history): Call btrace_get_bfun_name.
	(struct btrace_frame_cache): New.
	(bfcache): New.
	(bfcache_hash, bfcache_eq, bfcache_new): New.
	(btrace_get_frame_function): New.
	(record_btrace_frame_unwind_stop_reason): Allow unwinding.
	(record_btrace_frame_this_id): Compute own id.
	(record_btrace_frame_prev_register): Provide PC, throw_error
	for all other registers.
	(record_btrace_frame_sniffer): Detect btrace frames.
	(record_btrace_tailcall_frame_sniffer): New.
	(record_btrace_frame_dealloc_cache): New.
	(record_btrace_frame_unwind): Add new functions.
	(record_btrace_tailcall_frame_unwind): New.
	(_initialize_record_btrace): Allocate cache.
	* btrace.c (btrace_clear): Call reinit_frame_cache.
	* NEWS: Announce it.

testsuite/
	* gdb.btrace/record_goto.exp: Add backtrace test.
	* gdb.btrace/tailcall.exp: Add backtrace test.
2014-01-16 13:09:42 +01:00
Markus Metzger 066ce621f4 record-btrace: add record goto target methods
2014-01-16  Markus Metzger  <markus.t.metzger@intel.com>

	* record-btrace.c (record_btrace_set_replay)
	(record_btrace_goto_begin, record_btrace_goto_end)
	(record_btrace_goto): New.
	(init_record_btrace_ops): Initialize them.
	* NEWS: Announce it.

testsuite/
	* gdb.btrace/Makefile.in (EXECUTABLES): Add record_goto.
	* gdb.btrace/record_goto.c: New.
	* gdb.btrace/record_goto.exp: New.
	* gdb.btrace/x86-record_goto.S: New.
2014-01-16 13:08:05 +01:00
Markus Metzger e2887aa34f record-btrace: provide target_find_new_threads method
The "info threads" command tries to read memory, which is not possible during
replay.  This results in an error message and aborts the command without showing
the existing threads.

Provide a to_find_new_threads target method to skip the search while replaying.

2014-01-16  Markus Metzger  <markus.t.metzger@intel.com>

	* record-btrace.c (record_btrace_find_new_threads)
	(record_btrace_thread_alive): New.
	(init_record_btrace_ops): Initialize to_find_new_threads and
	to_thread_alive.
2014-01-16 13:06:15 +01:00
Markus Metzger b2f4cfdebc record-btrace: add to_wait and to_resume target methods.
Add simple to_wait and to_resume target methods that prevent stepping when the
current replay position is not at the end of the execution log.

2014-01-16  Markus Metzger  <markus.t.metzger@intel.com>

	* record-btrace.c (record_btrace_resume): New.
	(record_btrace_wait): New.
	(init_record_btrace_ops): Initialize to_wait and to_resume.
2014-01-16 13:06:14 +01:00