Commit Graph

21658 Commits

Author SHA1 Message Date
Andreas Arnez 3ca7dae4dd Constify regset structures. 2014-05-21 17:49:15 +02:00
Jan Kratochvil 5876f5032f Fix TLS access for -static -pthread
I have posted:
	TLS variables access for -static -lpthread executables
	https://sourceware.org/ml/libc-help/2014-03/msg00024.html
and the GDB patch below has been confirmed as OK for current glibcs.

Further work should be done for newer glibcs:
	Improve TLS variables glibc compatibility
	https://sourceware.org/bugzilla/show_bug.cgi?id=16954

Still the patch below implements the feature in a fully functional way backward
compatible with current glibcs, it depends on the following glibc source line:
	csu/libc-tls.c
	main_map->l_tls_modid = 1;

gdb/
2014-05-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix TLS access for -static -pthread.
	* linux-thread-db.c (struct thread_db_info): Add td_thr_tlsbase_p.
	(try_thread_db_load_1): Initialize it.
	(thread_db_get_thread_local_address): Call it if LM is zero.
	* target.c (target_translate_tls_address): Remove LM_ADDR zero check.
	* target.h (struct target_ops) (to_get_thread_local_address): Add
	load_module_addr comment.

gdb/gdbserver/
2014-05-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix TLS access for -static -pthread.
	* gdbserver/thread-db.c (struct thread_db): Add td_thr_tlsbase_p.
	(thread_db_get_tls_address): Call it if LOAD_MODULE is zero.
	(thread_db_load_search, try_thread_db_load_1): Initialize it.

gdb/testsuite/
2014-05-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix TLS access for -static -pthread.
	* gdb.threads/staticthreads.c <HAVE_TLS> (tlsvar): New.
	<HAVE_TLS> (thread_function, main): Initialize it.
	* gdb.threads/staticthreads.exp: Try gdb_compile_pthreads for $have_tls.
	Add clean_restart.
	<$have_tls != "">: Check TLSVAR.

Message-ID: <20140410115204.GB16411@host2.jankratochvil.net>
2014-05-21 16:25:53 +02:00
Pedro Alves 0256a6ac4b Make the dcache (code/stack cache) handle line reading errors better
The dcache (code/stack cache) is supposed to be transparent, but it's
actually not in one case.  dcache tries to read chunks (cache lines)
at a time off of the target.  This may end up trying to read
unaccessible or unavailable memory.  Currently the caller gets an xfer
error in this case.  But if the specific bits of memory the caller
actually wanted are available and accessible, then the caller should
get the memory it wanted, not an error.

gdb/
2014-05-21  Pedro Alves  <palves@redhat.com>

	* dcache.c (dcache_read_memory_partial): If reading the cache line
	fails, fallback to reading just the memory the caller wanted.

gdb/testsuite/
2014-05-21  Pedro Alves  <palves@redhat.com>

	* gdb.base/dcache-line-read-error.c: New.
	* gdb.base/dcache-line-read-error.exp: New.
2014-05-21 13:58:16 +01:00
Doug Evans 227533ac01 Fix gdb.multi/base.exp failures.
UNRESOLVED: gdb.multi/base.exp: remove-inferiors 2-3
UNRESOLVED: gdb.multi/base.exp: check remove-inferiors

gdb is crashing because it's accessing/freeing already freed memory.

==16368== Invalid read of size 4
==16368==    at 0x660A9D: find_pc_section (binutils-gdb/gdb/objfiles.c:1349)
==16368==    by 0x663ECB: lookup_minimal_symbol_by_pc_section (binutils-gdb/gdb/minsyms.c:734)
==16368==    by 0x5D987A: find_pc_sect_symtab (binutils-gdb/gdb/symtab.c:2153)
==16368==    by 0x5D4D77: blockvector_for_pc_sect (binutils-gdb/gdb/block.c:168)
==16368==    by 0x5D4F59: block_for_pc_sect (binutils-gdb/gdb/block.c:246)
==16368==    by 0x5D4F9B: block_for_pc (binutils-gdb/gdb/block.c:258)
==16368==    by 0x734C5D: inline_frame_sniffer (binutils-gdb/gdb/inline-frame.c:218)
==16368==    by 0x732104: frame_unwind_try_unwinder (binutils-gdb/gdb/frame-unwind.c:108)
==16368==    by 0x73223F: frame_unwind_find_by_frame (binutils-gdb/gdb/frame-unwind.c:159)
==16368==    by 0x72D5AA: compute_frame_id (binutils-gdb/gdb/frame.c:453)
==16368==    by 0x7300EC: get_prev_frame_if_no_cycle (binutils-gdb/gdb/frame.c:1758)
==16368==    by 0x73079A: get_prev_frame_always (binutils-gdb/gdb/frame.c:1931)
==16368==  Address 0x5b13500 is 16 bytes inside a block of size 24 free'd
==16368==    at 0x403072E: free (valgrind/coregrind/m_replacemalloc/vg_replace_malloc.c:445)
==16368==    by 0x762134: xfree (binutils-gdb/gdb/common/common-utils.c:108)
==16368==    by 0x65DACF: objfiles_pspace_data_cleanup (binutils-gdb/gdb/objfiles.c:91)
==16368==    by 0x75E546: program_spaceregistry_callback_adaptor (binutils-gdb/gdb/progspace.c:45)
==16368==    by 0x7644F6: registry_clear_data (binutils-gdb/gdb/registry.c:82)
==16368==    by 0x7645AB: registry_container_free_data (binutils-gdb/gdb/registry.c:95)
==16368==    by 0x75E5B4: program_space_free_data (binutils-gdb/gdb/progspace.c:45)
==16368==    by 0x75E9BA: release_program_space (binutils-gdb/gdb/progspace.c:167)
==16368==    by 0x75EB9B: prune_program_spaces (binutils-gdb/gdb/progspace.c:269)
==16368==    by 0x75303D: remove_inferior_command (binutils-gdb/gdb/inferior.c:792)
==16368==    by 0x50B5FD: do_cfunc (binutils-gdb/gdb/cli/cli-decode.c:107)
==16368==    by 0x50E6F2: cmd_func (binutils-gdb/gdb/cli/cli-decode.c:1886)

The problem originates from the get_current_arch call in
py-progspace.c:py_free_pspace.  The inferior associated with the
pspace is gone, and the current inferior is a different one and is running.
Therefore get_current_arch tries to read the current frame which
causes reads of data in the current program space which we've just deleted.

	* python/py-progspace.c (py_free_pspace): Call target_gdbarch
	instead of get_current_arch.
2014-05-20 13:06:26 -07:00
Pedro Alves 936d299246 Make compare-sections work against all targets; add compare-sections [-r] tests.
This does two things:

1. Adds a test.

Recently compare-sections got a new "-r" switch, but given no test
existed for compare-sections, the patch was allowed in with no
testsuite addition.  This now adds a test for both compare-sections
and compare-sections -r.

2. Makes the compare-sections command work against all targets.

Currently, compare-sections only works with remote targets, and only
those that support the qCRC packet.  The patch makes it so that if the
target doesn't support accelerating memory verification, then GDB
falls back to comparing memory itself.  This is of course slower, but
it's better than nothing, IMO.  While testing against extended-remote
GDBserver I noticed that we send the qCRC request to the target if
we're connected, but not yet running a program.  That can't work of
course -- the patch fixes that.  This all also goes in the direction
of bridging the local/remote parity gap.

I didn't decouple 1. from 2., because that would mean that the test
would need to handle the case of the target not supporting the
command.

Tested on x86_64 Fedora 17, native, remote GDBserver, and
extended-remote GDBserver.  I also hack-disabled qCRC support to make
sure the fallback paths in remote.c work.

gdb/doc/
2014-05-20  Pedro Alves  <palves@redhat.com>

	* gdb.texinfo (Memory) <compare-sections>: Generalize comments to
	not be remote specific.  Add cross reference to the qCRC packet.
	(Separate Debug Files): Update cross reference to the qCRC packet.
	(General Query Packets) <qCRC packet>: Add anchor.

gdb/
2014-05-20  Pedro Alves  <palves@redhat.com>

	* NEWS: Mention that compare-sections now works with all targets.

	* remote.c (PACKET_qCRC): New enum value.
	(remote_verify_memory): Don't send qCRC if the target has no
	execution.  Use packet_support/packet_ok.  If the target doesn't
	support the qCRC packet, fallback to a deep memory copy.
	(compare_sections_command): Say "target image" instead of "remote
	executable".
	(_initialize_remote): Add PACKET_qCRC to the list of config
	packets that have no associated command.  Extend comment.
	* target.c (simple_verify_memory, default_verify_memory): New
	function.
	* target.h (struct target_ops) <to_verify_memory>: Default to
	default_verify_memory.
	(simple_verify_memory): New declaration.
	* target-delegates.c: Regenerate.

gdb/testsuite/
2014-05-20  Pedro Alves  <palves@redhat.com>

	* gdb.base/compare-sections.c: New file.
	* gdb.base/compare-sections.exp: New file.
2014-05-20 19:11:39 +01:00
Markus Metzger e59fa00fa0 btrace: no replay without history
When using a reverse execution command without execution history, GDB
might end up in a state where replaying has been started but remains
at the current instruction.  This state is illegal.

Do not step if there is no execution history to avoid this.

2014-05-20  Markus Metzger  <markus.t.metzger@intel.com>

	* record-btrace.c (record_btrace_step_thread): Check for empty history.

testsuite/
	* gdb.btrace/nohist.exp: New.
2014-05-20 14:18:10 +02:00
Hui Zhu f2205de008 Fix issue #15778: GDB Aarch64 signal frame unwinder issue
The root cause of this issue is unwinder of "#3  <signal handler called>"
doesn't supply right values of registers.
When GDB want to get the previous frame of "#3  <signal handler called>",
it will call cache init function of unwinder "aarch64_linux_sigframe_init".
The address or the value of the registers is get from this function.
So the bug is inside thie function.

I check the asm code of "#3  <signal handler called>":
(gdb) frame 3
(gdb) p $pc
$1 = (void (*)()) 0x7f931fa4d0
(gdb) disassemble $pc, +10
Dump of assembler code from 0x7f931fa4d0 to 0x7f931fa4da:
=> 0x0000007f931fa4d0:	mov	x8, #0x8b                  	// #139
   0x0000007f931fa4d4:	svc	#0x0
   0x0000007f931fa4d8:	nop

This is the syscall sys_rt_sigreturn, Linux kernel function "restore_sigframe"
will set the frame:
	for (i = 0; i < 31; i++)
		__get_user_error(regs->regs[i], &sf->uc.uc_mcontext.regs[i],
				 err);
	__get_user_error(regs->sp, &sf->uc.uc_mcontext.sp, err);
	__get_user_error(regs->pc, &sf->uc.uc_mcontext.pc, err);
The struct of uc_mcontext is:
struct sigcontext {
	__u64 fault_address;
	/* AArch64 registers */
	__u64 regs[31];
	__u64 sp;
	__u64 pc;
	__u64 pstate;
	/* 4K reserved for FP/SIMD state and future expansion */
	__u8 __reserved[4096] __attribute__((__aligned__(16)));
};

But in GDB function "aarch64_linux_sigframe_init", the code the get address
of registers is:
  for (i = 0; i < 31; i++)
    {
      trad_frame_set_reg_addr (this_cache,
			       AARCH64_X0_REGNUM + i,
			       sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
			       + i * AARCH64_SIGCONTEXT_REG_SIZE);
    }

  trad_frame_set_reg_addr (this_cache, AARCH64_FP_REGNUM, fp);
  trad_frame_set_reg_addr (this_cache, AARCH64_LR_REGNUM, fp + 8);
  trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM, fp + 8);

The code that get pc and sp is not right, so I change the code according
to Linux kernel code:
  trad_frame_set_reg_addr (this_cache, AARCH64_SP_REGNUM,
			   sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
			     + 31 * AARCH64_SIGCONTEXT_REG_SIZE);
  trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM,
			   sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
			     + 32 * AARCH64_SIGCONTEXT_REG_SIZE);

The issue was fixed by this change, and I did the regression test.  It
also fixed a lot of other XFAIL and FAIL.

2014-05-20  Hui Zhu  <hui@codesourcery.com>
	    Yao Qi  <yao@codesourcery.com>

	PR backtrace/16558
	* aarch64-linux-tdep.c (aarch64_linux_sigframe_init): Update comments
	and change address of sp and pc.
2014-05-20 13:19:06 +08:00
Doug Evans 7305118224 build_type_unit_groups and moved closer to only caller and renamed
* dwarf2read.c (build_type_psymtabs_1): Renamed from
	build_type_unit_groups and moved closer to only caller.  Remove
	arguments.  All references updated.  Remove outdated .gdb_index
	comment.
	(struct tu_abbrev_offset, sort_tu_by_abbrev_offset): Move with
	build_type_psymtabs_1.
2014-05-19 16:06:59 -07:00
Tom Tromey c4e54771f8 fix two latent type errors
I'm checking this in as obvious.

I was looking at instances of "alloc.*sizeof" and noticed a couple
where the types in question are incorrect.

In gdbtypes, the code allocates sizeof(int) to represent a struct rank.
In mi-cmds, the code uses "struct mi_cmd **" -- one "*" too many.

In both cases the problems are latent because in practice the sizes
are the same as the sizes of the correct types.  Still, it's better to
be correct.

I think gdb would be improved by a wholesale change from explicit
sizeofs to using the libiberty.h allocation macros.  In most cases
they are both shorter and have better type safety.  However, the
resulting patch is rather large.

Built and regtested on x86-64 Fedora 20.

2014-05-19  Tom Tromey  <tromey@redhat.com>

	* gdbtypes.c (rank_function): Use XNEWVEC.
	* mi/mi-cmds.c (build_table): Use XCNEWVEC.
2014-05-19 14:17:16 -06:00
Doug Evans 8832e7e38e Remove all_type_unit_groups, unused.
* dwarf2read.c (struct dwarf2_per_objfile): Delete unused members
	n_type_unit_groups, all_type_unit_groups.  All uses removed.
	(get_type_unit_group, build_type_unit_groups): Delete forward decls.
	(dw2_get_cutu): Renamed from dw2_get_cu.  All callers updated.
	(dw2_get_cu): Renamed from dw2_get_primary_cu.  All callers updated.
	(add_type_unit_group_to_table): Delete.
2014-05-19 12:52:08 -07:00
Doug Evans cd8ae15e25 * eval.c (evaluate_subexp_standard): Add some comments. 2014-05-19 10:51:08 -07:00
Doug Evans 08f4850b5d * progspace.c (remove_program_space): Delete, unused.
* progspace.h (remove_program_space): Ditto.
2014-05-17 12:18:26 -07:00
Doug Evans bed8455c71 * inferior.c (prune_inferiors): Fix comment.
(remove_inferior_command): Call prune_program_spaces.
2014-05-17 11:59:34 -07:00
Doug Evans 8d551b0239 New command line option -D.
* NEWS: Mention it.
	* main.c (set_gdb_data_directory): New function.
	(captured_main): Recognize -D.  Flag error for --data-directory "".
	Call set_gdb_data_directory.
	(print_gdb_help): Print --data-directory, -D.
	* main.h (set_gdb_data_directory): Declare.
	* top.c (staged_gdb_datadir): New static global.
	(set_gdb_datadir): Call set_gdb_data_directory
	(show_gdb_datadir): New function.
	(init_main): Update init of data-directory parameter.

	testsuite/
	* gdb.base/catch-syscall.exp (test_catch_syscall_fail_nodatadir):
	Update.
	(do_syscall_tests_without_xml): Update.

	doc/
	* gdb.texinfo (Mode Options): Add -D.
2014-05-16 12:15:10 -07:00
Gregory Fong 18848e288c Import the "dirfd" gnulib module.
2014-05-16  Gregory Fong  <gregory.0xf0@gmail.com>

	Import the "dirfd" gnulib module.
	* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add dirfd.
	* gnulib/aclocal.m4: Update.
	* gnulib/config.in: Update.
	* gnulib/configure: Update.
	* gnulib/import/Makefile.am: Update.
	* gnulib/import/Makefile.in: Update.
	* gnulib/import/dirfd.c: New.
	* gnulib/import/m4/dirfd.m4: New.
	* gnulib/import/m4/gnulib-cache.m4: Update.
	* gnulib/import/m4/gnulib-comp.m4: Update.
2014-05-16 12:26:33 -06:00
Yao Qi 95c64f92be Fix display of tabulation character for mingw hosts.
Pierre proposed this patch
https://sourceware.org/ml/gdb-patches/2013-10/msg00011.html and
Tom gave a suggestion that it's better to do check \t in print_wchar
<https://sourceware.org/ml/gdb-patches/2013-11/msg00148.html>
However, I don't see the follow-up to this discussion.

We encounter two fails in printcmds.exp on mingw host, and Pierre's
patch fixes them.  I pick it up, update a little per Tom's
comments, and post it here for review.  This patch fixes these fails
below on mingw32 host.

FAIL: gdb.base/charset.exp: print string in ASCII
FAIL: gdb.base/charset.exp: try printing '\t' in ASCII
FAIL: gdb.base/charset.exp: print string in ISO-8859-1
FAIL: gdb.base/charset.exp: try printing '\t' in ISO-8859-1
FAIL: gdb.base/charset.exp: print string in UTF-32
FAIL: gdb.base/charset.exp: try printing '\t' in UTF-32
FAIL: gdb.base/printcmds.exp: p ctable1[9]
FAIL: gdb.base/printcmds.exp: p &ctable1[1*8]

Also regression tested on x86_64-linux.  Is it OK?

gdb:

2014-05-16  Pierre Muller  <muller@sourceware.org>
	    Yao Qi  <yao@codesourcery.com>

	* valprint.c (print_wchar): Move the code on checking whether
	W is a printable wide char to the default branch of switch
	statement below.  Call wchar_printable instead of gdb_iswprint.
2014-05-16 20:19:00 +08:00
Yao Qi 19679ecafc Fix changelong entry.
Each changelog entry should be tab-prefixed.
2014-05-16 20:11:21 +08:00
Taimoor Mirza cac395eae4 Fix prologue analysis for ldr.w and ldrd instruction
Prologue analysis for ldr.w and ldrd instruction obtains offset from
first two bytes that contains opcode of instruction. It should obtain
offset from next two bytes that actually contain operands.

       * arm-tdep.c (thumb_analyze_prologue): Fix offset calculation for
	ldr.w and ldrd instructions.

Signed-off-by: Taimoor Mirza <tmirza@codesourcery.com>
2014-05-16 11:39:05 +05:00
Doug Evans 83655187cb * dwarf2read.c (read_structure_type): Delete outdated comments. 2014-05-15 15:45:05 -07:00
Tom Tromey dd75668920 reindent print_macro_definition
I happened to notice that print_macro_definition is indented
improperly.  All the lines were a few extra spaces to the right.

This patch fixes the indentation.
Tested by rebuilding, committed.

2014-05-14  Tom Tromey  <tromey@redhat.com>

	* macrocmd.c (print_macro_definition): Reindent.
2014-05-14 13:31:10 -06:00
Doug Evans 75ddda778c * python/py-cmd.c (cmdpy_completer): Add comment.
(completers): Make const.
2014-05-13 19:44:51 -07:00
Simon Marchi b0f16a3eaf Remove unused variable
should_resume is set to 1 at the beginning and never changed.

gdb/ChangeLog:

2014-05-13  Simon Marchi  <simon.marchi@ericsson.com>

	* infrun.c (resume): Remove should_resume (unused).  Move up
	declaration of resume_ptid.
2014-05-13 16:54:29 -04:00
Tom Tromey 033c337911 remove an unused macro and an unused declaration
This patch removes an unused macro from language.h.  It also removes
the declaration of a function which is not defined.

I'm checking this in as obvious.
Tested by rebuilding.

2014-05-13  Tom Tromey  <tromey@redhat.com>

	* language.h (unop_type_check): Remove.
	(binop_type_check): Don't declare.
2014-05-13 11:47:43 -06:00
Andreas Arnez 9b44a3a57d S390: Fix erroneous offset in fill_gregset.
This fixes a bug that leads to various failures when debugging a
31-bit inferior with a 64-bit gdb on s390x.
2014-05-13 14:55:53 +02:00
Simon Marchi 303a33faef mi: Use the value in mi_console_file->quote as the quoting character
In mi_interpreter_init, multiple MI consoles/channels are created and a quoting
character is given.  In mi_console_raw_packet, we check if the value is not 0
to decide if we should quote the string, but we don't use the value. It is
hardcoded to ".  We might never use another quoting character than an actual
quote, but I suggest we change it, for correctness.  There is not visible
behavior change.

I changed the latest fputs_unfiltered changed to fputc_unfiltered just to stay
consistent.

gdb/ChangeLog:

2014-05-12  Simon Marchi  <simon.marchi@ericsson.com>

	* mi/mi-console.c (mi_console_raw_packet): Use the value from
	mi_console->quote as the quoting character.
2014-05-12 15:44:19 -04:00
Simon Marchi 196100a019 Add myself as write after approval maintainer
2014-05-12  Simon Marchi  <simon.marchi@ericsson.com>

	* MAINTAINERS (Write After Approval): Add "Simon Marchi".
2014-05-12 13:10:29 -04:00
Tom Tromey f989a1c8ec rename "set debugvarobj" to "set debug varobj"
I think "set debugvarobj" has the wrong name.
It ought to be "set debug varobj", like gdb's other debug settings.

This patch makes the change.

I chose not to install deprecated aliases, since this is only a debug
setting; but if someone feels strongly about it I will add them.

Built and regtested on x86-64 Fedora 20.

2014-04-29  Tom Tromey  <tromey@redhat.com>

	* varobj.c (_initialize_varobj): Rename to "set debug varobj" and
	"show debug varobj".

2014-04-29  Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (Debugging Output): Rename to "set debug varobj" and
	"show debug varobj".
2014-05-08 08:37:03 -06:00
Kyle McMartin 9404b58f46 aarch64: detect atomic sequences like other ll/sc architectures
gdb/Changelog:

        * aarch64-tdep.c (aarch64_software_single_step): New function.
        (aarch64_gdbarch_init): Handle single stepping of atomic sequences
        with aarch64_software_single_step.

gdb/testsuite/ChangeLog:

        * gdb.arch/aarch64-atomic-inst.c: New file.
        * gdb.arch/aarch64-atomic-inst.exp: New file.
2014-05-07 09:41:50 -07:00
Joel Brobecker 5e49ba5736 Document the GDB 7.7.1 release in gdb/ChangeLog
gdb/ChangeLog:

	GDB 7.7.1 released.
2014-05-05 15:03:06 -07:00
Keith Seitz c888a17da5 Fix a dangling cleanup in linspec_parse_basic.
2014-05-05  Keith Seitz  <keiths@redhat.com>

	* linespec.c (linespec_parse_basic): Run cleanups if a convenience
	variable or history value is successfully parsed.

2014-05-05  Keith Seitz  <keiths@redhat.com>

	* gdb.linespec/ls-dollar.exp: Add test for linespec
	file:convenience_variable.
2014-05-05 13:43:31 -07:00
Yao Qi 290a839c9a Partially available/unavailable data in requested range
In gdb.trace/unavailable.exp, an action is defined to collect
struct_b.struct_a.array[2] and struct_b.struct_a.array[100],

struct StructB
{
  int d, ef;
  StructA struct_a;
  int s:1;
  static StructA static_struct_a;
  const char *string;
};

and the other files are not collected.

When GDB examine traceframe collected by the action, "struct_b" is
unavailable completely, which is wrong.

(gdb) p struct_b
$1 = <unavailable>

When GDB reads 'struct_b', it will request to read memory at struct_b's address
of length LEN.  Since struct_b.d is not collected, no 'M' block
includes the first part of the desired range, so tfile_xfer_partial returns
TARGET_XFER_UNAVAILABLE and GDB thinks the whole requested range is unavailable.

In order to fix this problem, in the iteration to 'M' blocks, we record the
lowest address of blocks within the request range.  If it has, the requested
range isn't unavailable completely.  This applies to ctf too.  With this patch
applied, the result looks good and fails in unavailable.exp is fixed.

(gdb) p struct_b
$1 = {d = <unavailable>, ef = <unavailable>, struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable>,
<unavailable>, -1431655766, <unavailable> <repeats 97 times>, -1431655766, <unavailable> <repeats 9899 times>}, ptr = <unavailable>, bitfield = <unavailable>}, s = <unavailable>,   static static_struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable> <repeats 10000 times>}, ptr = <unavailable>,
bitfield = <unavailable>}, string = <unavailable>}

gdb:

2014-05-05  Yao Qi  <yao@codesourcery.com>
	    Pedro Alves  <palves@redhat.com>

	* tracefile-tfile.c (tfile_xfer_partial): Record the lowest
	address of blocks that intersects the requested range.  Trim
	LEN up to LOW_ADDR_AVAILABLE if read from executable read-only
	sections.
	* ctf.c (ctf_xfer_partial): Likewise.

gdb/testsuite:

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

	* gdb.trace/unavailable.exp (gdb_collect_args_test): Save
	traceframes into tfile and ctf trace files.  Read data from
	trace file and test collected data.
	(gdb_collect_locals_test): Likewise.
	(gdb_unavailable_registers_test): Likewise.
	(gdb_unavailable_floats): Likewise.
	(gdb_collect_globals_test): Likewise.
	(top-level): Append "ctf" to trace_file_targets if GDB
	supports.
2014-05-05 11:51:59 +08:00
Yao Qi 91256dc2fb Show new created display
When I run refactored unavailable.exp, I find
command display behaves a little different on live inferior and on
examining traceframes.  In live inferior, when command "display argc"
is typed, the value of "argc" is shown.

(gdb) display argc
1: argc = 1 '\001'

however, on tfile target, when command "display argc" is typed, the
value of "argc" is not shown.

(gdb) tfind
Found trace frame 0, tracepoint 1
    at ../../../../git/gdb/testsuite/gdb.trace/unavailable.cc:198
198       i =  (int) argc + argi + argf + argd + argstruct.memberi + argarray[1];
(gdb) display argc

I also notice that on "core" target, the value of "argc" isn't shown
either.  This difference is caused by the code below in printcmd.c:display_command,

      if (from_tty && target_has_execution)
        do_one_display (new);

Looks the value of each display is shown if the target has execution.
Source code archaeology doesn't tell much about this requirement.
However, if we type command "display" then on "core" or "tfile"
target, the value of "argc" is still displayed,

for "core" target,
(gdb) display argc
(gdb) display
1: argc = 1 '\001'

for "tfile" target,
(gdb) display argc
(gdb) display
1: argc = <unavailable>

I feel that it is not necessary to have such "target has execution"
requirement to show the value of new created display.  Auto-display is
a feature to show the value of expression frequently, has nothing to
do with whether target has execution or not.  On the other hand, GDB
has the requirement for new created display, but command "display" can
still show them, this is an inconsistency, which should be fixed.

This patch is to remove the checking to target_has_execution from the
condition.

gdb:

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

	* printcmd.c (display_command): Remove the check to
	target_has_execution.
2014-05-05 11:51:53 +08:00
Mark Kettenis 07284463de Enable rthreads support on OpenBSD/powerpc.
gdb/ChangeLog:

        * ppcobsd-nat.c: Include "obsd-nat.h".
        (_initialize_ppcobsd_nat): Call obsd_add_target instead of
        add_target.
        * config/powerpc/obsd.mh (NATDEPFILES): Add obsd-nat.o.
2014-05-03 22:36:44 +02:00
Sergio Durigan Junior 30a1e6cc77 Extend recognized types of SDT probe's arguments
This commit is actually an update to make the parser in
gdb/stap-probe.c be aware of all the possible prefixes that a probe
argument can have.  According to the section "Argument Format" in:

  <https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation>

The bitness of the arguments can be 8, 16, 32 or 64 bits, signed or
unsigned.  Currently GDB recognizes only 32 and 64-bit arguments.
This commit extends this.  It also provides a testcase, only for
x86_64 systems.

gdb/
2014-05-02  Sergio Durigan Junior  <sergiodj@redhat.com>

	* stap-probe.c (enum stap_arg_bitness): New enums to represent 8
	and 16-bit signed and unsigned arguments.  Update comment.
	(stap_parse_probe_arguments): Extend code to handle such
	arguments.  Use warning instead of complaint to notify about
	unrecognized bitness.

gdb/testsuite/
2014-05-02  Sergio Durigan Junior  <sergiodj@redhat.com>

	* gdb.arch/amd64-stap-optional-prefix.S (main): Add several
	probes to test for bitness recognition.
	* gdb.arch/amd64-stap-optional-prefix.exp
	(test_probe_value_without_reg): New procedure.
	Add code to test for different kinds of bitness.
2014-05-02 17:50:45 -03:00
Sergio Durigan Junior f33da99a54 Fix PR breakpoints/16889: gdb segfaults when printing ASM SDT arguments
This commit fixes PR breakpoints/16889, which is about a bug that
triggers when GDB tries to parse probes whose arguments do not contain
the initial (and optional) "N@" part.  For reference sake, the de
facto format is described here:

  <https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation>

Anyway, this PR actually uncovered two bugs (related) that were
happening while parsing the arguments.  The first one was that the
parser *was* catching *some* arguments that were missing the "N@"
part, but it wasn't correctly setting the argument's type.  This was
causing a NULL pointer being dereferenced, ouch...

The second bug uncovered was that the parser was not catching all of
the cases for a probe which did not provide the "N@" part.  The fix
for that was to simplify the check that the code was making to
identify non-prefixed probes.  The code is simpler and easier to read
now.

I am also providing a testcase for this bug, only for x86_64
architectures.

gdb/
2014-05-02  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR breakpoints/16889
	* stap-probe.c (stap_parse_probe_arguments): Simplify
	check for non-prefixed probes (i.e., probes whose
	arguments do not start with "N@").  Always set the
	argument type to a sane value.

gdb/testsuite/
2014-05-02  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR breakpoints/16889
	* gdb.arch/amd64-stap-optional-prefix.S: New file.
	* gdb.arch/amd64-stap-optional-prefix.exp: Likewise.
2014-05-02 17:45:35 -03:00
David Taylor 95cf3b38cd compare-sections: New -r option.
When connecting to a remote system, we use the compare-sections
command to verify that the box is running the code that we think it is
running.  Since the system is up and running and *NOT* 'freshly
downloaded without yet executing anything', read-write sections, of
course, differ from what they were in the executable file.

Comparing read-write sections takes time and more importantly the
MIS-MATCHED output is confusing to some users.

The compare-sections command compares all loadable sections including
read-write sections.  This patch gives the user the option to compare
just the loadable read-only sections.

gdb/
2014-05-01  David Taylor  <dtaylor@emc.com>

	* remote.c (compare_sections_command): Add -r option to compare
	all loadable read-only sections.

gdb/doc/
2014-05-01  David Taylor  <dtaylor@emc.com>

	* gdb.texinfo (compare-sections): Document the new -r (read-only)
	option.
2014-05-01 18:09:43 +01:00
Siva Chandra 1cfdf5340a Remove unused arguments to few functions in dwarf2loc.c and gdbtypes.c.
gdb/ChangeLog:

	* dwarf2loc.c (dwarf2_locexpr_baton_eval,
	dwarf2_evaluate_property): Remove unused CORE_ADDR argument.
	Update all callers.
	* dwarf2loc.h (dwarf2_evaluate_property): Update signature.
	* gdbtypes.c (resolve_dynamic_range, resolve_dynamic_array):
	Remove unused CORE_ADDR argument.  Update all callers.
2014-04-30 06:27:07 -07:00
Pedro Alves ca4f7f8beb Fix remote connection to targets that don't support the QNonStop packet.
... and others.  The recent patch that fixed several "set remote
foo-packet on/off" commands introduced a regression, observable when
connecting GDB to QEMU.  For instance:

        (gdb) set debug remote 1
        (gdb) tar rem :4444
        Remote debugging using :4444
        Sending packet: $qSupported:multiprocess+;qRelocInsn+#2a...Ack
        Packet received: PacketSize=1000;qXfer:features:read+
        Packet qSupported (supported-packets) is supported
        Sending packet: $Hgp0.0#ad...Ack
        Packet received: OK
        Sending packet: $qXfer:features:read:target.xml:0,ffb#79...Ack
        Packet received: [...]
        Sending packet: $qXfer:features:read:arm-core.xml:0,ffb#08...Ack
        Packet received: [...]
 !!! -> Sending packet: $QNonStop:0#8c...Ack
        Packet received:
        Remote refused setting all-stop mode with:

The "QNonStop" feature is associated with the PACKET_QNonStop packet,
with a default of PACKET_DISABLE, so GDB should not be sending the
packet at all.

The patch that introduced the regression decoupled packet_config's
'detect' and 'support' fields, making the former (an auto_boolean)
purely the associated "set remote foo-packet" command's variable.  In
the example above, the packet config's 'supported' field does end up
correctly set to PACKET_DISABLE.  However, nothing is presently
initializing packet configs that don't actually have a command
associated.  Those configs's 'detect' field then ends up set to
AUTO_BOOLEAN_TRUE, simply because that happens to be 0.  This forces
GDB to assume the packet is supported, irrespective of what the target
claims it supports, just like if the user had done "set remote
foo-packet on" (this being the associated command, if there was one).

Ideally, all packet configs would have a command associated.  While
that isn't true, make sure all packet configs are initialized, even if
no command is associated, and add an assertion that prevents adding
more packets/features without an associated command.

Tested on x86_64 Fedora 17, against pristine gdbserver, and against a
gdbserver with the QNonStop packet/feature disabled with a local hack.

gdb/
2014-04-29  Pedro Alves  <palves@redhat.com>

	* remote.c (struct packet_config) <detect>: Extend comment.
	(add_packet_config_cmd): Don't set the config's detect or support
	fields here.
	(init_all_packet_configs): Also initialize the config's 'detect'
	field.
	(reset_all_packet_configs_support): New function.
	(remote_open_1): Call reset_all_packet_configs_support instead of
	init_all_packet_configs.
	(_initialize_remote): Initialize all packet configs.  Assert that
	all packets have an associated command, except a few known
	outliers.
2014-04-29 14:01:27 +01:00
Joel Brobecker 11c1ba7852 dwarf2read.c::read_subrange_type: Handle dynamic lower bounds
Currently, read_subrange_type handles dynamicity only in the case of
the upper bound, and assumes that the lower bound is always static.
That's rooted in the fact that dynamicity was added to support C99
variable-length arrays, where the lower bound is always zero, and
therefore never dynamic.  But the lower bound can, in fact, be dynamic
in other languages such as Ada.

Consider for instance the following declaration in Ada...

    type Array_Type is array (L .. U) of Natural;

... where L and U are parameters of the function where the declaration
above was made, and whose value are 5 and 10.  Currently, the debugger
is able to print the value of the upper bound correctly, but not the
lower bound:

    (gdb) ptype array_type
    type = array (1 .. 10) of natural

After this patch, the debugger now prints:

    (gdb) ptype array_type
    type = array (5 .. 10) of natural

gdb/ChangeLog:

        * dwarf2read.c (read_subrange_type): Handle dynamic
        DW_AT_lower_bound attributes.
2014-04-28 15:46:29 -04:00
Joel Brobecker 8739bc53cd Improve Ada dynamic range type handling.
Consider the following declaration in Ada...

   type Array_Type is array (L .. U) of Natural;

... where L and U are parameters of the function where the declaration
above was made. At the moment, GDB relies on descriptive types in order
to properly decode the array bounds. For instance, if L was 5, and U
was 10, we would see the following:

    (gdb) ptype array_type
    type = array (5 .. 10) of natural
    (gdb) maintenance set ada ignore-descriptive-types
    (gdb) ptype array_type
    type = array (1 .. 28544912) of natural

This patch enhances ada_discrete_type_{high,low}_bound to resolve
any dynamicity.  This is sufficient to fix the case of the upper bound.
For the lower bound, the dwarf2read module does not handle dynamic
lower bounds yet, but once it does, the lower bound should be correctly
handled as well [1].

gdb/ChangeLog:

        * ada-lang.c (ada_discrete_type_high_bound): Resolve the type's
        dynamic bounds before computing its upper bound.
        (ada_discrete_type_low_bound): Same as above with the lower bound.

[1]: The reason why we do not enhance dwarf2read to handle dynamic
lower bounds ahead of this patch is because it unveils some latent
issues such as this one.
2014-04-28 15:44:48 -04:00
Joel Brobecker 6f8a3220a9 Enhance dwarfread.c::resolve_dynamic_type to resolve dynamic ranges
This change breaks down the resolve_dynamic_bounds function which
works only on arrays and its index range types into two functions,
one that resolves range types, and one that resolves arrays (using
the new routine to resolve the array's index range type). The
is_dynamic_type and resolve_dynamic_type function are then re-organized
to handle range types as well.

One small change worth mentioning is the fact that, now that range
types are resolved on their own (rather than in the limited context
of array index types), the resolved range types are created from
a copy of the dynamic range type, rather than from scratch (first
parameter of create_range_type). This allows us to preserve as many
original properties in the resolved type as possible (Eg. the type's
name).

This is preparation work that will help better support dynamic range
types for languages that allow the declaration of such types (Eg. Ada).

gdb/ChangeLog:

        * dwarf2read.c (is_dynamic_type): Return true for dynamic
        range types.  Adjust the array handling implementation to
        take advantage of this change.
        (resolve_dynamic_range): New function, mostly extracted from
        resolve_dynamic_bounds.
        (resolve_dynamic_array): New function, mostly extracted from
        resolve_dynamic_bounds.
        (resolve_dynamic_bounds): Delete.
        (resolve_dynamic_type): Reimplement.  Add handling of
        TYPE_CODE_RANGE types.
2014-04-28 15:41:48 -04:00
Joel Brobecker 4d072ce478 Unnecessary XA type handling in ada_varobj_describe_simple_array_child
ada-varobj.c::ada_varobj_describe_simple_array_child only ever gets
called after all GNAT encodings have been applied to (parent_value,
parent_type). So there is no point in redoing it partially by
checking for parallel XA types again.

gdb/ChangeLog:

	* ada-varobj.c (ada_varobj_describe_simple_array_child): Remove
	handling of parallel ___XA types.
2014-04-28 15:40:12 -04:00
Joel Brobecker 528653254b remove unnecessary second call to static_unwrap_type in ada_evaluate_subexp
In ada-lang.c::ada_evaluate_subexp, case OP_VAR_VALUE, when noside
is EVAL_AVOID_SIDE_EFFECTS, the first thing we do is set type as
follow:

    type = static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol));

Later on in the same block, we make the same call:

    return value_zero
      (to_static_fixed_type
       (static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol))),
       not_lval);

This patch removes the second call, since it should result in the same
type being returned, so no point in making that call again.

gdb/ChangeLog:

        * ada-lang.c (ada_evaluate_subexp) <OP_VAR_VALUE>: Remove
        unnecessary second call to static_unwrap_type.
2014-04-28 15:38:19 -04:00
Hui Zhu 433e77fad1 Make "set disassemble-next-line on" can work with DUMMY_FRAME, SIGTRAMP_FRAME and ARCH_FRAME
When GDB debug DUMMY_FRAME, SIGTRAMP_FRAME and ARCH_FRAME, even if
"set disassemble-next-line on", it will not output the asm code:
(gdb) set disassemble-next-line on
(gdb) si
<signal handler called>
(gdb)
<signal handler called>
(gdb)
<signal handler called>

So make this patch make they can work together, it will become:
(gdb) si
<signal handler called>
=> 0xffffffff816bfb09 <int_with_check+0>:	65 48 8b 0c 25 c8 c7 00 00	mov    %gs:0xc7c8,%rcx
(gdb)
<signal handler called>
=> 0xffffffff816bfb12 <int_with_check+9>:	48 81 e9 d8 1f 00 00	sub    $0x1fd8,%rcx
(gdb)
<signal handler called>
=> 0xffffffff816bfb19 <int_with_check+16>:	8b 51 10	mov    0x10(%rcx),%edx

2014-04-27  Hui Zhu  <hui@codesourcery.com>

	* stack.c (print_frame_info): Call do_gdb_disassembly with
	DUMMY_FRAME, SIGTRAMP_FRAME and ARCH_FRAME.
2014-04-27 22:23:43 +08:00
Doug Evans b51a69ee09 * guile/scm-safe-call.c (scscm_eval_scheme_string): Fix comment. 2014-04-26 13:13:13 -07:00
Pedro Alves 7ae1a6a6cc PR server/16255: gdbserver cannot attach to a second inferior that is multi-threaded.
On Linux, we need to explicitly ptrace attach to all lwps of a
process.  Because GDB might not be connected yet when an attach is
requested, and thus it may not be possible to activate thread_db, as
that requires access to symbols (IOW, gdbserver --attach), a while ago
we make linux_attach loop over the lwps as listed by /proc/PID/task to
find the lwps to attach to.

linux_attach_lwp_1 has:

...
  if (initial)
    /* If lwp is the tgid, we handle adding existing threads later.
       Otherwise we just add lwp without bothering about any other
       threads.  */
    ptid = ptid_build (lwpid, lwpid, 0);
  else
    {
      /* Note that extracting the pid from the current inferior is
	 safe, since we're always called in the context of the same
	 process as this new thread.  */
      int pid = pid_of (current_inferior);
      ptid = ptid_build (pid, lwpid, 0);
    }

That "safe" comment referred to linux_attach_lwp being called by
thread-db.c.  But this was clearly missed when a new call to
linux_attach_lwp_1 was added to linux_attach.  As a result,
current_inferior will be set to some random process, and non-initial
lwps of the second inferior get assigned the pid of the wrong
inferior.  E.g., in the case of attaching to two inferiors, for the
second inferior (and so on), non-initial lwps of the second inferior
get assigned the pid of the first inferior.  This doesn't trigger on
the first inferior, when current_inferior is NULL, add_thread switches
the current inferior to the newly added thread.

Rather than making linux_attach switch current_inferior temporarily
(thus avoiding further reliance on global state), or making
linux_attach_lwp_1 get the tgid from /proc, which add extra syscalls,
and will be wrong in case of the user having originally attached
directly to a non-tgid lwp, and then that lwp spawning new clones (the
ptid.pid field of further new clones should be the same as the
original lwp's pid, which is not the tgid), we note that callers of
linux_attach_lwp/linux_attach_lwp_1 always have the right pid handy
already, so they can pass it down along with the lwpid.

The only other reason for the "initial" parameter is to error out
instead of warn in case of attach failure, when we're first attaching
to a process.  There are only three callers of
linux_attach_lwp/linux_attach_lwp_1, and each wants to print a
different warn/error string, so we can just move the error/warn out of
linux_attach_lwp_1 to the callers, thus getting rid of the "initial"
parameter.

There really nothing gdbserver-specific about attaching to two
threaded processes, so this adds a new test under gdb.multi/.  The
test passes cleanly against the native GNU/Linux target, but
fails/triggers the bug against GDBserver (before the patch), with the
native-extended-remote board (as plain remote doesn't support
multi-process).

Tested on x86_64 Fedora 17, with the native-extended-gdbserver board.

gdb/gdbserver/
2014-04-25  Pedro Alves  <palves@redhat.com>

	PR server/16255
	* linux-low.c (linux_attach_fail_reason_string): New function.
	(linux_attach_lwp): Delete.
	(linux_attach_lwp_1): Rename to ...
	(linux_attach_lwp): ... this.  Take a ptid instead of a pid as
	argument.  Remove "initial" parameter.  Return int instead of
	void.  Don't error or warn here.
	(linux_attach): Adjust to call linux_attach_lwp.  Call error on
	failure to attach to the tgid.  Call warning when failing to
	attach to an lwp.
	* linux-low.h (linux_attach_lwp): Take a ptid instead of a pid as
	argument.  Remove "initial" parameter.  Return int instead of
	void.  Don't error or warn here.
	(linux_attach_fail_reason_string): New declaration.
	* thread-db.c (attach_thread): Adjust to linux_attach_lwp's
	interface change.  Use linux_attach_fail_reason_string.

gdb/
2014-04-25  Pedro Alves  <palves@redhat.com>

	PR server/16255
	* common/linux-ptrace.c (linux_ptrace_attach_warnings): Rename to ...
	(linux_ptrace_attach_fail_reason): ... this.  Remove "warning: "
	and newline from built string.
	* common/linux-ptrace.h (linux_ptrace_attach_warnings): Rename to ...
	(linux_ptrace_attach_fail_reason): ... this.
	* linux-nat.c (linux_nat_attach): Adjust to use
	linux_ptrace_attach_fail_reason.

gdb/testsuite/
2014-04-25  Simon Marchi  <simon.marchi@ericsson.com>
	    Pedro Alves  <palves@redhat.com>

	PR server/16255
	* gdb.multi/multi-attach.c: New file.
	* gdb.multi/multi-attach.exp: New file.
2014-04-25 19:07:33 +01:00
Pedro Alves 4082afcc3d Fix several "set remote foo-packet on/off" commands.
For several RSP packets, there's a corresponding "set remote
foo-packet on/off/auto" command that one can use do bypass
auto-detection of support for the packet or feature.  However, I
noticed that setting several of these commands to 'on' or 'off'
doesn't actually have any effect.  These are, at least:

 set remote breakpoint-commands-packet
 set remote conditional-breakpoints-packet
 set remote fast-tracepoints-packet
 set remote static-tracepoints-packet
 set remote install-in-trace-packet

These are commands that control a remote protocol feature that doesn't
have a corresponding regular packet, and because of that we cache the
knowledge of the remote side support as returned by the qSupported
packet in the remote_state object.

E.g., in the case of the 'set remote breakpoint-commands-packet'
command, whether the feature is supported is recorded in the
'breakpoint_commands' field of the remote_state object.

Whether to bypass packet support auto-detection or not is controlled
by the 'detect' field of the corresponding packet's packet_config
structure.  That field is the variable associated directly with the
"set remote foo-packet" command.  Actual remote stub support for the
packet (or feature) is recorded in the 'support' field of the same
structure.

However, when the user toggles the command, the 'support' field is
also correspondingly updated to PACKET_ENABLE/DISABLE/SUPPORT_UNKNOWN,
discarding the knowledge of whether the target actually supports the
feature.  If one toggles back to 'auto', it's no big issue for real
packets, as they'll just end up re-probed the next time they might be
necessary.  But features whose support is only reported through
qSupported don't get their corresponding (manually added/maintained)
fields in remote_state objected updated.  As we lost the actual status
of the target support for the feature, GDB would need to probe the
qSupported features again, which GDB doesn't do.

But we can avoid that extra traffic, and clean things up, IMO.
Instead of going in that direction, this patch completely decouples
struct packet_config's 'detect' and 'support' fields.  E.g., when the
user does "set remote foo-packet off", instead of setting the packet
config's 'support' field to PACKET_DISABLE, the 'support' field is not
touched at all anymore.  That is, we end up respecting this simple
table:

| packet_config->detect | packet_config->support | should use packet/feature? |
|-----------------------+------------------------+----------------------------|
| auto                  | PACKET_ENABLE          | PACKET_ENABLE              |
| auto                  | PACKET_DISABLE         | PACKET_DISABLE             |
| auto                  | PACKET_UNKNOWN         | PACKET_UNKNOWN             |
| yes                   | don't care             | PACKET_ENABLE              |
| no                    | don't care             | PACKET_DISABLE             |

This is implemented by the new packet_support function.  With that, we
need to update this pattern throughout:

  if (remote_protocol_packets[PACKET_foo].support == PACKET_DISABLE)

to do this instead:

  if (packet_support (PACKET_qAttached) == PACKET_DISABLE)

where as mentioned, the packet_support function takes struct
packet_config's 'detect' field into account, like in the table above.

As when the packet is force-disabled or force-enabled, the 'support'
field is just ignored, if the command is set back to auto, we'll
resume respecting whatever the target said it supports.  IOW, the end
result is that the 'support' field always represents whether the
target actually supports the packet or not.

After all that, the manually maintained breakpoint_commands and
equivalent fields of struct remote_state can then be eliminated, with
references replaced by checking the result of calling the
packet_support function on the corresponding packet or feature.  This
required adding new PACKET_foo enum values for several features that
didn't have it yet.  (The patch does not add corresponding "set remote
foo-packet" style commands though, focusing only on bug fixing and
laying the groundwork).

Tested on x86_64 Fedora 17, native GDBserver.  The new tests all fail
without this patch.

gdb/
2014-04-25  Pedro Alves  <palves@redhat.com>

	* remote.c (struct remote_state): Remove multi_process_aware,
	non_stop_aware, cond_tracepoints, cond_breakpoints,
	breakpoint_commands, fast_tracepoints, static_tracepoints,
	install_in_trace, disconnected_tracing,
	enable_disable_tracepoints, string_tracing, and
	augmented_libraries_svr4_read fields.
	(remote_multi_process_p): Move further below in the file.
	(struct packet_config): Add comments.
	(update_packet_config): Delete function.
	(show_packet_config_cmd): Use packet_config_support.
	(add_packet_config_cmd): Use NULL as set callback.
	(packet_ok): "set remote foo-packet"-style commands no longer
	change config->supported -- adjust.
	(PACKET_ConditionalTracepoints, PACKET_ConditionalBreakpoints)
	(PACKET_BreakpointCommands, PACKET_FastTracepoints)
	(PACKET_StaticTracepoints, PACKET_InstallInTrace): Add comments.
	(PACKET_QNonStop, PACKET_multiprocess_feature)
	(PACKET_EnableDisableTracepoints_feature, PACKET_tracenz_feature)
	(PACKET_DisconnectedTracing_feature)
	(PACKET_augmented_libraries_svr4_read_feature): New enum values.
	(set_remote_protocol_packet_cmd): Delete function.
	(packet_config_support, packet_support): New functions.
	(set_remote_protocol_Z_packet_cmd): Don't call
	update_packet_config.
	(remote_query_attached, remote_pass_signals)
	(remote_program_signals, remote_threads_info)
	(remote_threads_extra_info, remote_start_remote): Use
	packet_support.
	(remote_start_remote): Use packet_config_support and
	packet_support.
	(init_all_packet_configs): Set all packets to unknown support,
	instead of calling update_packet_config.
	(remote_check_symbols): Use packet_support.
	(remote_supported_packet): Unconditionally set the packet config's
	support status.
	(remote_multi_process_feature, remote_non_stop_feature)
	(remote_cond_tracepoint_feature, remote_cond_breakpoint_feature)
	(remote_breakpoint_commands_feature)
	(remote_fast_tracepoint_feature, remote_static_tracepoint_feature)
	(remote_install_in_trace_feature)
	(remote_disconnected_tracing_feature)
	(remote_enable_disable_tracepoint_feature)
	(remote_string_tracing_feature)
	(remote_augmented_libraries_svr4_read_feature): Delete functions.
	(remote_protocol_features): Adjust to use remote_supported_packet
	for "augmented-libraries-svr4-read", "multiprocess", "QNonStop",
	"ConditionalTracepoints", "ConditionalBreakpoints",
	"BreakpointCommands", "FastTracepoints", "StaticTracepoints",
	"InstallInTrace", "DisconnectedTracing", "DisconnectedTracing",
	"EnableDisableTracepoints", and "tracenz".
	(remote_query_supported): Use packet_support.
	(remote_open_1): Adjust.
	(extended_remote_attach_1): Use packet_support.  Switch on the
	result of packet_ok instead of checking whether the packet ended
	up disabled.
	(remote_vcont_resume): Use packet_support.
	(remote_resume, remote_stop_ns, fetch_register_using_p)
	(remote_prepare_to_store, store_register_using_P)
	(check_binary_download, remote_write_bytes): Use packet_support.
	(remote_vkill): Use packet_support.  Switch on the result of
	packet_ok instead of checking whether the packet ended up
	disabled.
	(extended_remote_supports_disable_randomization): Use
	packet_support.
	(extended_remote_run): Switch on the result of packet_ok instead
	of checking whether the packet ended up disabled.
	(remote_insert_breakpoint, remote_remove_breakpoint)
	(remote_insert_watchpoint, remote_remove_watchpoint)
	(remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Use
	packet_support.
	(remote_search_memory): Use packet_config_support.
	(remote_get_thread_local_address, remote_get_tib_address)
	(remote_hostio_send_command, remote_can_execute_reverse): Use
	packet_support.
	(remote_supports_cond_tracepoints)
	(remote_supports_cond_breakpoints)
	(remote_supports_fast_tracepoints)
	(remote_supports_static_tracepoints)
	(remote_supports_install_in_trace)
	(remote_supports_enable_disable_tracepoint)
	(remote_supports_string_tracing)
	(remote_can_run_breakpoint_commands): Rewrite, checking whether
	the packet config says the feature is enabled or disabled.
	(remote_download_tracepoint, remote_trace_set_readonly_regions)
	(remote_get_trace_status): Use packet_support.
	(remote_set_disconnected_tracing): Adjust to check whether the
	feature is enabled with packet_support.
	(remote_set_trace_buffer_size, remote_use_agent)
	(remote_can_use_agent, remote_supports_btrace): Use
	packet_support.
	(remote_enable_btrace, remote_disable_btrace, remote_read_btrace):
	Use packet_config_support.
	(remote_augmented_libraries_svr4_read): Rewrite, checking whether
	the packet config says the feature is enabled or disabled.
	(set_range_stepping): Use packet_support.

gdb/testsuite/
2014-04-25  Pedro Alves  <palves@redhat.com>

	* gdb.base/cond-eval-mode.exp (warning): Move trailing \r\n to
	user.
	(top level): Test that "set remote conditional-breakpoints-packet
	off" works as intended.
	* gdb.base/dprintf.exp: Test that "set remote
	breakpoint-commands-packet off" works as intended.
	* gdb.trace/change-loc.exp (tracepoint_install_in_trace_disabled):
	New function.
	(top level): Call it.
	* gdb.trace/ftrace.exp (test_fast_tracepoints): Test that "set
	remote fast-tracepoints-packet off" works as intended.
	* gdb.trace/qtro.exp (gdb_is_target_remote): Moved ...
	* lib/gdb.exp (gdb_is_target_remote): ... here.
2014-04-25 18:07:02 +01:00
Tom Tromey bdb52a22a7 document "quit" command's argument
2014-04-25  Tom Tromey  <tromey@redhat.com>

	* cli/cli-cmds.c (_initialize_cli_cmds): Document "quit" command's
	argument.
2014-04-25 09:43:47 -06:00
Sanimir Agovic e9475ead98 news: mention support for C99 variable length arrays
* NEWS: Mention support for C99 variable length arrays.
2014-04-25 14:13:59 +01:00
Joel Brobecker 82eacd52ba ada-lang.c: Expand standard_exc's introductory comment.
This patch expands standard_exc's introductory comment to explain
why this table does not include Numeric_Error.

gdb/ChangeLog:

        * ada-lang.c (standard_exc): Expand introductory comment.
2014-04-24 13:20:33 -07:00